@stacksjs/stx 0.2.111 → 0.2.112

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:x$,getOwnPropertyNames:UJ,getOwnPropertyDescriptor:WJ}=Object,zJ=Object.prototype.hasOwnProperty;function BJ($){return this[$]}var A6=($)=>{var Z=(R6??=new WeakMap).get($),Y;if(Z)return Z;if(Z=x$({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function"){for(var X of UJ($))if(!zJ.call(Z,X))x$(Z,X,{get:BJ.bind($,X),enumerable:!(Y=WJ($,X))||Y.enumerable})}return R6.set($,Z),Z},R6;var _J=($)=>$;function jJ($,Z){this[$]=_J.bind(null,Z)}var o=($,Z)=>{for(var Y in Z)x$($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:jJ.bind(Z,Y)})};var b=($,Z)=>()=>($&&(Z=$($=0)),Z);var Q0=import.meta.require;import n5 from"fs";import o5 from"path";function LJ($){let Z=0;for(let Y=0;Y<$.length;Y++){let X=$[Y];Z=(Z<<5)-Z+X,Z=Z&Z}return Math.abs(Z).toString(16).padStart(8,"0")}function FJ($,Z){let Y=o5.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 VJ($,Z,Y){let X=o5.extname($).toLowerCase(),Q=OJ[X],J=(Y.maxFileSizeKB||500)*1024;if(Z>J)return!1;if(Y.exclude&&FJ($,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 D6($,Z,Y,X){let Q=n5.readdirSync($,{withFileTypes:!0});for(let J of Q){let G=o5.join($,J.name);if(J.isDirectory()){if(["node_modules",".git",".stx"].includes(J.name))continue;D6(G,Z,Y,X)}else if(J.isFile()){let K=n5.statSync(G),q=o5.relative(Z,G);if(VJ(q,K.size,Y)){let W=n5.readFileSync(G),U=LJ(W),z=`/${q.replace(/\\/g,"/")}`;X.push({url:z,revision:U,size:K.size})}}}}function H1($,Z){let Y=Z.pwa?.precache,X=[];if(!Y?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!n5.existsSync($))return{entries:[],totalSize:0,fileCount:0};D6($,$,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 s5($){if($.entries.length===0)return"[]";return`[
2
+ var{defineProperty:x$,getOwnPropertyNames:zJ,getOwnPropertyDescriptor:BJ}=Object,_J=Object.prototype.hasOwnProperty;function jJ($){return this[$]}var A6=($)=>{var Z=(N6??=new WeakMap).get($),Y;if(Z)return Z;if(Z=x$({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function"){for(var X of zJ($))if(!_J.call(Z,X))x$(Z,X,{get:jJ.bind($,X),enumerable:!(Y=BJ($,X))||Y.enumerable})}return N6.set($,Z),Z},N6;var HJ=($)=>$;function OJ($,Z){this[$]=HJ.bind(null,Z)}var o=($,Z)=>{for(var Y in Z)x$($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:OJ.bind(Z,Y)})};var b=($,Z)=>()=>($&&(Z=$($=0)),Z);var Q0=import.meta.require;import n5 from"fs";import o5 from"path";function VJ($){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 RJ($,Z){let Y=o5.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 NJ($,Z,Y){let X=o5.extname($).toLowerCase(),Q=FJ[X],J=(Y.maxFileSizeKB||500)*1024;if(Z>J)return!1;if(Y.exclude&&RJ($,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 E6($,Z,Y,X){let Q=n5.readdirSync($,{withFileTypes:!0});for(let J of Q){let G=o5.join($,J.name);if(J.isDirectory()){if(["node_modules",".git",".stx"].includes(J.name))continue;E6(G,Z,Y,X)}else if(J.isFile()){let K=n5.statSync(G),q=o5.relative(Z,G);if(NJ(q,K.size,Y)){let U=n5.readFileSync(G),W=VJ(U),z=`/${q.replace(/\\/g,"/")}`;X.push({url:z,revision:W,size:K.size})}}}}function H1($,Z){let Y=Z.pwa?.precache,X=[];if(!Y?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!n5.existsSync($))return{entries:[],totalSize:0,fileCount:0};E6($,$,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 s5($){if($.entries.length===0)return"[]";return`[
3
3
  ${$.entries.map((Y)=>` { url: '${Y.url}', revision: '${Y.revision}' }`).join(`,
4
4
  `)}
5
- ]`}function E6($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1048576).toFixed(2)} MB`}var OJ;var G5=b(()=>{OJ={".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 RJ($){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 f$($){return RJ($).className}function k6($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.routes||[],X=Z.cacheStorage,Q=[];for(let J of Y){let G=f$(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
- maxEntries: ${W},
7
- ${U?`maxAgeSeconds: ${U},`:""}
5
+ ]`}function k6($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1048576).toFixed(2)} MB`}var FJ;var q5=b(()=>{FJ={".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 AJ($){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 f$($){return AJ($).className}function b6($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.routes||[],X=Z.cacheStorage,Q=[];for(let J of Y){let G=f$(J.strategy),K=[];if(J.maxAgeSeconds||J.maxEntries||X?.maxEntries){let U=J.maxEntries||X?.maxEntries||100,W=J.maxAgeSeconds||(X?.maxAge?X.maxAge*24*60*60:void 0);K.push(`new ExpirationPlugin({
6
+ maxEntries: ${U},
7
+ ${W?`maxAgeSeconds: ${W},`:""}
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=AJ(J.pattern);Q.push(`
11
+ })`);let q=wJ(J.pattern);Q.push(`
12
12
  // ${J.pattern}
13
13
  registerRoute(
14
14
  ${q},
15
15
  new ${G}({
16
- cacheName: '${J.cacheName||wJ(J.pattern)}',
16
+ cacheName: '${J.cacheName||MJ(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 AJ($){if($.startsWith("*.")){let Z=$.slice(2);return`({ request }) => request.destination === '${NJ(Z)}'`}if($.endsWith("/**"))return`({ url }) => url.pathname.startsWith('${$.slice(0,-3)}')`;if($.endsWith("/*")){let Z=$.slice(0,-2);return`({ url }) => url.pathname.startsWith('${Z}') && !url.pathname.slice(${Z.length+1}).includes('/')`}if($.includes("*")&&!$.startsWith("*")){let[Z,Y]=$.split("*");return`({ url }) => url.pathname.startsWith('${Z}') && url.pathname.endsWith('${Y}')`}if($==="/"||!$.includes("*"))return`({ url }) => url.pathname === '${$}'`;return`new RegExp('${TJ($).replace(/\\\*/g,".*")}')`}function NJ($){return{js:"script",mjs:"script",css:"style",html:"document",htm:"document",png:"image",jpg:"image",jpeg:"image",gif:"image",svg:"image",webp:"image",avif:"image",ico:"image",woff:"font",woff2:"font",ttf:"font",eot:"font",otf:"font"}[$.toLowerCase()]||"empty"}function wJ($){return"stx-"+$.replace(/[^\w]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase().slice(0,30)+"-cache"}function TJ($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var P6={};o(P6,{isWorkboxEnabled:()=>y6,getServiceWorkerGenerator:()=>kJ,generateWorkboxServiceWorker:()=>S6,generateWorkboxConfig:()=>b6});function b6($,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(f$(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?H1(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 S6($,Z){let Y=$.pwa;if(!Y?.enabled)return"";let X=b6($,Z),Q=Y.serviceWorker||{},J=Y.push,G=Y.backgroundSync,K=Z?H1(Z,$):null,q=K?s5(K):"[]",W=MJ(X.modules),U=k6($);return`/**
23
+ `)}function wJ($){if($.startsWith("*.")){let Z=$.slice(2);return`({ request }) => request.destination === '${TJ(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('${IJ($).replace(/\\\*/g,".*")}')`}function TJ($){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 MJ($){return"stx-"+$.replace(/[^\w]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase().slice(0,30)+"-cache"}function IJ($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var C6={};o(C6,{isWorkboxEnabled:()=>P6,getServiceWorkerGenerator:()=>SJ,generateWorkboxServiceWorker:()=>y6,generateWorkboxConfig:()=>S6});function S6($,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 U of Q)G.add(f$(U.strategy));if(G.size>0)J.push({name:"workbox-strategies",exports:Array.from(G)});if(Q.some((U)=>U.maxAgeSeconds||U.maxEntries)||Y.cacheStorage)J.push({name:"workbox-expiration",exports:["ExpirationPlugin"]});if(Q.some((U)=>U.strategy==="network-first"||U.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?H1(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 y6($,Z){let Y=$.pwa;if(!Y?.enabled)return"";let X=S6($,Z),Q=Y.serviceWorker||{},J=Y.push,G=Y.backgroundSync,K=Z?H1(Z,$):null,q=K?s5(K):"[]",U=DJ(X.modules),W=b6($);return`/**
24
24
  * Service Worker - Generated by stx with Workbox
25
25
  * Cache Version: ${X.cacheVersion}
26
26
  *
@@ -42,7 +42,7 @@ importScripts('https://storage.googleapis.com/workbox-cdn/releases/7.0.0/workbox
42
42
  workbox.setConfig({ debug: true });
43
43
 
44
44
  // Extract modules from workbox global
45
- ${W}
45
+ ${U}
46
46
 
47
47
  const CACHE_VERSION = '${X.cacheVersion}';
48
48
  const OFFLINE_PAGE = '${X.offlineFallback||"/offline.html"}';
@@ -79,7 +79,7 @@ enable();`:"// Navigation preload disabled"}
79
79
  // Runtime Caching
80
80
  // ============================================================================
81
81
 
82
- ${U}
82
+ ${W}
83
83
 
84
84
  // ============================================================================
85
85
  // Offline Fallback
@@ -169,13 +169,13 @@ self.addEventListener('message', (event) => {
169
169
  }
170
170
  });
171
171
 
172
- ${J?.enabled?DJ(J):"// Push notifications disabled"}
172
+ ${J?.enabled?kJ(J):"// Push notifications disabled"}
173
173
 
174
- ${G?.enabled?EJ(G):"// Background sync disabled"}
174
+ ${G?.enabled?bJ(G):"// Background sync disabled"}
175
175
 
176
176
  console.log('[Workbox SW] Service Worker loaded - Version:', CACHE_VERSION);
177
- `}function MJ($){let Z=[];for(let Y of $){let X=Y.name.replace("workbox-","");Z.push(`const { ${Y.exports.join(", ")} } = workbox.${IJ(X)};`)}return Z.join(`
178
- `)}function IJ($){return $.replace(/-([a-z])/g,(Z,Y)=>Y.toUpperCase())}function DJ($){return`
177
+ `}function DJ($){let Z=[];for(let Y of $){let X=Y.name.replace("workbox-","");Z.push(`const { ${Y.exports.join(", ")} } = workbox.${EJ(X)};`)}return Z.join(`
178
+ `)}function EJ($){return $.replace(/-([a-z])/g,(Z,Y)=>Y.toUpperCase())}function kJ($){return`
179
179
  // ============================================================================
180
180
  // Push Notifications
181
181
  // ============================================================================
@@ -244,7 +244,7 @@ self.addEventListener('notificationclick', (event) => {
244
244
  })
245
245
  );
246
246
  });
247
- `}function EJ($){return`
247
+ `}function bJ($){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 y6($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function kJ($){if(y6($))return S6;let{generateServiceWorker:Z}=(K5(),A6(v6));return Z}var C6=b(()=>{G5()});var v6={};o(v6,{isWorkboxEnabled:()=>x6,getServiceWorkerFileName:()=>f1,generateServiceWorkerAuto:()=>yJ,generateServiceWorker:()=>r5});function r5($,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?H1(Z,$):null,B=z?s5(z):"[]",_=["/","/manifest.json",...G?.enabled?[K]:[],...G?.precacheAssets||[]];return`/**
309
+ `}function P6($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function SJ($){if(P6($))return y6;let{generateServiceWorker:Z}=(U5(),A6(x6));return Z}var v6=b(()=>{q5()});var x6={};o(x6,{isWorkboxEnabled:()=>f6,getServiceWorkerFileName:()=>f1,generateServiceWorkerAuto:()=>CJ,generateServiceWorker:()=>r5});function r5($,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,U=Y.backgroundSync,W=Y.cacheStorage,z=Z?H1(Z,$):null,B=z?s5(z):"[]",_=["/","/manifest.json",...G?.enabled?[K]:[],...G?.precacheAssets||[]];return`/**
310
310
  * Service Worker - Auto-generated by stx
311
311
  * Cache Version: ${J}
312
312
  *
@@ -319,8 +319,8 @@ self.addEventListener('message', (event) => {
319
319
  *
320
320
  * Additional features:
321
321
  * - Push notifications: ${q?.enabled?"enabled":"disabled"}
322
- * - Background sync: ${W?.enabled?"enabled":"disabled"}
323
- * - Cache limits: ${U?.maxSize?`${E6(U.maxSize*1024*1024)}`:"unlimited"}
322
+ * - Background sync: ${U?.enabled?"enabled":"disabled"}
323
+ * - Cache limits: ${W?.maxSize?`${k6(W.maxSize*1024*1024)}`:"unlimited"}
324
324
  */
325
325
 
326
326
  const CACHE_VERSION = '${J}';
@@ -341,18 +341,18 @@ const EXCLUDED_ROUTES = ${JSON.stringify(X.excludeRoutes||[],null,2)};
341
341
 
342
342
  // Cache storage configuration
343
343
  const CACHE_CONFIG = {
344
- maxSize: ${U?.maxSize||0} * 1024 * 1024, // Convert MB to bytes
345
- maxAge: ${U?.maxAge||0} * 24 * 60 * 60 * 1000, // Convert days to ms
346
- maxEntries: ${U?.maxEntries||0},
347
- purgeStrategy: '${U?.purgeStrategy||"lru"}',
344
+ maxSize: ${W?.maxSize||0} * 1024 * 1024, // Convert MB to bytes
345
+ maxAge: ${W?.maxAge||0} * 24 * 60 * 60 * 1000, // Convert days to ms
346
+ maxEntries: ${W?.maxEntries||0},
347
+ purgeStrategy: '${W?.purgeStrategy||"lru"}',
348
348
  };
349
349
 
350
350
  // Background sync configuration
351
351
  const SYNC_CONFIG = {
352
- enabled: ${W?.enabled||!1},
353
- queueName: '${W?.queueName||"stx-sync-queue"}',
354
- maxRetries: ${W?.maxRetries||3},
355
- minInterval: ${W?.minInterval||1000},
352
+ enabled: ${U?.enabled||!1},
353
+ queueName: '${U?.queueName||"stx-sync-queue"}',
354
+ maxRetries: ${U?.maxRetries||3},
355
+ minInterval: ${U?.minInterval||1000},
356
356
  };
357
357
 
358
358
  // Push notification configuration
@@ -501,9 +501,9 @@ self.addEventListener('message', (event) => {
501
501
  }
502
502
  });
503
503
 
504
- ${q?.enabled?bJ():"// Push notifications disabled"}
504
+ ${q?.enabled?yJ():"// Push notifications disabled"}
505
505
 
506
- ${W?.enabled?SJ():"// Background sync disabled"}
506
+ ${U?.enabled?PJ():"// 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 bJ(){return`
871
+ `}function yJ(){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 SJ(){return`
953
+ `}function PJ(){return`
954
954
  /**
955
955
  * Background sync queue storage (IndexedDB)
956
956
  */
@@ -1132,7 +1132,7 @@ self.addEventListener('message', (event) => {
1132
1132
  event.waitUntil(registerFormSync(event.data.payload));
1133
1133
  }
1134
1134
  });
1135
- `}function f1($){return $.pwa?.serviceWorker?.fileName||"sw.js"}function x6($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function yJ($,Z){if(!$.pwa?.enabled)return"";if(x6($)){let{generateWorkboxServiceWorker:Y}=(C6(),A6(P6));return Y($,Z)}return r5($,Z)}var K5=b(()=>{G5()});var f6={};o(f6,{injectPwaTags:()=>h$,generateThemeColorMeta:()=>vJ,generateSwRegistrationScript:()=>PJ,generatePwaTags:()=>a5,generateManifestLink:()=>CJ});function a5($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,X=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",Q=f1($),J=`
1135
+ `}function f1($){return $.pwa?.serviceWorker?.fileName||"sw.js"}function f6($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function CJ($,Z){if(!$.pwa?.enabled)return"";if(f6($)){let{generateWorkboxServiceWorker:Y}=(v6(),A6(C6));return Y($,Z)}return r5($,Z)}var U5=b(()=>{q5()});var g6={};o(g6,{injectPwaTags:()=>h$,generateThemeColorMeta:()=>fJ,generateSwRegistrationScript:()=>vJ,generatePwaTags:()=>a5,generateManifestLink:()=>xJ});function a5($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,X=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",Q=f1($),J=`
1136
1136
  <!-- stx PWA Meta Tags -->
1137
1137
  <link rel="manifest" href="/manifest.json">
1138
1138
  <meta name="theme-color" content="${g$(Y?.themeColor||"#000000")}">
@@ -1178,7 +1178,7 @@ if ('serviceWorker' in navigator) {
1178
1178
  </script>
1179
1179
  <!-- End stx PWA -->`,J}function h$($,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=a5(Z);return $.slice(0,Q)+J+`
1180
1180
  `+$.slice(Q)}return $+a5(Z)}let X=a5(Z);return $.replace("</head>",`${X}
1181
- </head>`)}function PJ($){if(!$.pwa?.enabled)return"";return`<script>
1181
+ </head>`)}function vJ($){if(!$.pwa?.enabled)return"";return`<script>
1182
1182
  if ('serviceWorker' in navigator) {
1183
1183
  window.addEventListener('load', function() {
1184
1184
  navigator.serviceWorker.register('/${f1($)}')
@@ -1190,7 +1190,7 @@ if ('serviceWorker' in navigator) {
1190
1190
  });
1191
1191
  });
1192
1192
  }
1193
- </script>`}function CJ(){return'<link rel="manifest" href="/manifest.json">'}function vJ($){return`<meta name="theme-color" content="${g$($)}">`}function g$($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var t5=b(()=>{K5()});import q5 from"path";function d6($){h6=$?.trim()||null}function U5(){return process.env[uJ]?.trim()||h6||g1}function W5($=process.cwd(),...Z){let Y=U5();return q5.isAbsolute(Y)?q5.join(Y,...Z):q5.join($,Y,...Z)}function z5($){if(!$||q5.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==g1&&!Z.startsWith(`${g1}/`))return $;let Y=Z.slice(g1.length+1);return Y?q5.join(U5(),Y):U5()}var g1=".stx",uJ="STX_DIR",h6=null;var e5=()=>{};var _0;var m6=b(()=>{_0={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}});function u6($,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 l6,p6;var d$=b(()=>{l6={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},p6={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function lJ($,Z={}){let{duration:Y,delay:X,ease:Q,direction:J,custom:G}={...r0,...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 xJ(){return'<link rel="manifest" href="/manifest.json">'}function fJ($){return`<meta name="theme-color" content="${g$($)}">`}function g$($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var t5=b(()=>{U5()});import W5 from"path";function m6($){d6=$?.trim()||null}function z5(){return process.env[pJ]?.trim()||d6||g1}function B5($=process.cwd(),...Z){let Y=z5();return W5.isAbsolute(Y)?W5.join(Y,...Z):W5.join($,Y,...Z)}function _5($){if(!$||W5.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==g1&&!Z.startsWith(`${g1}/`))return $;let Y=Z.slice(g1.length+1);return Y?W5.join(z5(),Y):z5()}var g1=".stx",pJ="STX_DIR",d6=null;var e5=()=>{};var _0;var u6=b(()=>{_0={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}});function l6($,Z,Y,X){let Q=$;Q=Q.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,q)=>{let W={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[K]||"Make this element accessible";return`<!-- a11y-hint: ${q||W} -->`});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 p6,c6;var d$=b(()=>{p6={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},c6={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function cJ($,Z={}){let{duration:Y,delay:X,ease:Q,direction:J,custom:G}={...a0,...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 pJ(){return`
1203
+ @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function iJ(){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 cJ($){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 iJ($=0.1,Z="0px"){return`
1231
+ `}function nJ($){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 oJ($=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 nJ(){return`
1274
+ `}function sJ(){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 oJ($,Z,Y={}){let{staggerDelay:X=50,sequence:Q=!1}=Y;return`
1389
+ `}function rJ($,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 s6($,Z,Y,X){let Q=$;if(X.animation?.enabled===!1)return Q;let J=Y.includes("test")&&Y.includes("animation");if(!cJ(Q)&&!J)return Q;if(!Q.includes('<style id="stx-animation-base">')){let K=nJ();Q=Q.replace("</head>",`${K}
1427
- </head>`)}if(Q.includes("stx-observe")){if(!Q.includes("Intersection Observer for scroll animations")){let q=iJ(),W=Q.lastIndexOf("</body>");if(W!==-1)Q=Q.slice(0,W)+q+`
1428
- `+Q.slice(W)}}return Q}var r0,c6,i6,n6,o6;var m$=b(()=>{r0={duration:300,delay:0,ease:"ease",direction:"both"};c6={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)||r0.duration:r0.duration,G=Z.length>2?Z[2]||r0.ease:r0.ease,K=Z.length>3?Number.parseInt(Z[3],10)||r0.delay:r0.delay,q=Z.length>4?Z[4]||r0.direction:r0.direction,W=`stx-transition-${Math.random().toString(36).substr(2,9)}`,U=lJ(Q,{duration:J,delay:K,ease:G,direction:q}),z="stx-transition",B="";if(Q==="fade")B="stx-fade";else if(Q==="slide")B="stx-slide";else if(Q==="scale")B="stx-scale";else if(Q==="flip")B="stx-flip";else if(Q==="rotate")B="stx-rotate";return`<div id="${W}" class="${z} ${B} ${q==="out"?"stx-out":""}"
1429
- style="--stx-transition-duration: ${J}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},i6={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"},n6={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=oJ(Q,J,{staggerDelay:G,sequence:K});return`${$}
1430
- ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},o6={name:"motion",handler:($,Z,Y,X)=>{let Q=Z.length>0?Z[0].toLowerCase()==="true":!0,J=pJ();return`<div data-animate="${Q?"auto":"true"}">${$}</div>${J}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as r6}from"stx-router";var a6=b(()=>{u$()});async function sJ($,Z,Y,X){let Q=Z[0]?.replace(/['"]/g,"")||"main",J=r6();if(Q!=="main")J=J.replace("container:'main'",`container:'${Q}'`);return`<script data-stx-router>${J}</script>`}var t6;var u$=b(()=>{a6();t6={name:"stxRouter",handler:sJ,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function e6($){let Z=$.heatmap;if(!Z?.enabled)return"";let Y={...rJ,...Z};return`
1426
+ `}function r6($,Z,Y,X){let Q=$;if(X.animation?.enabled===!1)return Q;let J=Y.includes("test")&&Y.includes("animation");if(!nJ(Q)&&!J)return Q;if(!Q.includes('<style id="stx-animation-base">')){let K=sJ();Q=Q.replace("</head>",`${K}
1427
+ </head>`)}if(Q.includes("stx-observe")){if(!Q.includes("Intersection Observer for scroll animations")){let q=oJ(),U=Q.lastIndexOf("</body>");if(U!==-1)Q=Q.slice(0,U)+q+`
1428
+ `+Q.slice(U)}}return Q}var a0,i6,n6,o6,s6;var m$=b(()=>{a0={duration:300,delay:0,ease:"ease",direction:"both"};i6={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)||a0.duration:a0.duration,G=Z.length>2?Z[2]||a0.ease:a0.ease,K=Z.length>3?Number.parseInt(Z[3],10)||a0.delay:a0.delay,q=Z.length>4?Z[4]||a0.direction:a0.direction,U=`stx-transition-${Math.random().toString(36).substr(2,9)}`,W=cJ(Q,{duration:J,delay:K,ease:G,direction:q}),z="stx-transition",B="";if(Q==="fade")B="stx-fade";else if(Q==="slide")B="stx-slide";else if(Q==="scale")B="stx-scale";else if(Q==="flip")B="stx-flip";else if(Q==="rotate")B="stx-rotate";return`<div id="${U}" class="${z} ${B} ${q==="out"?"stx-out":""}"
1429
+ style="--stx-transition-duration: ${J}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},n6={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,U=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,W=`--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="${U}" class="${z}" style="${W}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},o6={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((U)=>U.startsWith("#")||U.startsWith(".")?U:`#${U}`),G=Y.staggerDelay||50,K=Y.sequence||!0,q=rJ(Q,J,{staggerDelay:G,sequence:K});return`${$}
1430
+ ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},s6={name:"motion",handler:($,Z,Y,X)=>{let Q=Z.length>0?Z[0].toLowerCase()==="true":!0,J=iJ();return`<div data-animate="${Q?"auto":"true"}">${$}</div>${J}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as a6}from"stx-router";var t6=b(()=>{u$()});async function aJ($,Z,Y,X){let Q=Z[0]?.replace(/['"]/g,"")||"main",J=a6();if(Q!=="main")J=J.replace("container:'main'",`container:'${Q}'`);return`<script data-stx-router>${J}</script>`}var e6;var u$=b(()=>{t6();e6={name:"stxRouter",handler:aJ,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function $9($){let Z=$.heatmap;if(!Z?.enabled)return"";let Y={...tJ,...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 $9($,Z){let Y=e6(Z);if(!Y)return $;let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Y+$.slice(X);return $+Y}function aJ($){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 rJ,Z9;var l$=b(()=>{rJ={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};Z9={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=aJ(Z.join(" "));Q.heatmap={...Q.heatmap,...J,enabled:!0}}return e6(Q)}}});function Z1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function Y9($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function X9($){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 B5($,Z={}){let{gfm:Y=!0,breaks:X=!1}=Z,Q=$,J=[];if(Q=Q.replace(/```(\w*)\n([\s\S]*?)```/g,(U,z,B)=>{let _=J.length,j=z?` class="language-${Z1(z)}"`:"";return J.push(`<pre><code${j}>${Z1(B.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,B)=>{return`<img src="${Y9(B)?Z1(B):""}" alt="${Z1(z)}" />`}),Q=Q.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(U,z,B)=>{return`<a href="${Y9(B)?Z1(B):""}">${z}</a>`}),Q=Q.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Q=Q.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Q=Q.replace(/<\/blockquote>\n<blockquote>/g,`
1815
- `),Q=Q.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),Q=Q.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),Q=Q.replace(/<\/ul>\n<ul>/g,""),Q=Q.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),Q=Q.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),Q=Q.replace(/<\/ol>\n<ol>/g,""),Q=Q.replace(/<li data-ul>/g,"<li>"),Q=Q.replace(/<li data-ol>/g,"<li>"),Y)Q=Q.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(U,z,B)=>{let j=`<tr>${z.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<th>${Z1(L)}</th>`).join("")}</tr>`,H=B.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 Z9($,Z){let Y=$9(Z);if(!Y)return $;let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Y+$.slice(X);return $+Y}function eJ($){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 tJ,Y9;var l$=b(()=>{tJ={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};Y9={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=eJ(Z.join(" "));Q.heatmap={...Q.heatmap,...J,enabled:!0}}return $9(Q)}}});function Y1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function X9($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function J9($){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 U=K.slice(0,q).trim(),W=K.slice(q+1).trim();if(typeof W==="string"){if(W.startsWith('"')&&W.endsWith('"')||W.startsWith("'")&&W.endsWith("'"))W=W.slice(1,-1);else if(W.startsWith("[")&&W.endsWith("]"))try{W=JSON.parse(W)}catch{}else if(W==="true")W=!0;else if(W==="false")W=!1;else if(/^-?\d+(?:\.\d+)?$/.test(W))W=Number(W)}J[U]=W}return{data:J,content:Q.trim()}}function j5($,Z={}){let{gfm:Y=!0,breaks:X=!1}=Z,Q=$,J=[];if(Q=Q.replace(/```(\w*)\n([\s\S]*?)```/g,(W,z,B)=>{let _=J.length,j=z?` class="language-${Y1(z)}"`:"";return J.push(`<pre><code${j}>${Y1(B.trim())}</code></pre>`),`\x00CODEBLOCK${_}\x00`}),Q=Q.replace(/`([^`]*)`/g,(W,z)=>`<code>${Y1(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,(W,z,B)=>{return`<img src="${X9(B)?Y1(B):""}" alt="${Y1(z)}" />`}),Q=Q.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(W,z,B)=>{return`<a href="${X9(B)?Y1(B):""}">${z}</a>`}),Q=Q.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Q=Q.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Q=Q.replace(/<\/blockquote>\n<blockquote>/g,`
1815
+ `),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,(W,z,B)=>{let j=`<tr>${z.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<th>${Y1(L)}</th>`).join("")}</tr>`,H=B.trim().split(`
1816
+ `).map((L)=>{return`<tr>${L.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<td>${Y1(O)}</td>`).join("")}</tr>`}).join(`
1817
1817
  `);return`<table>
1818
1818
  <thead>
1819
1819
  ${j}
@@ -1822,28 +1822,28 @@ ${j}
1822
1822
  ${H}
1823
1823
  </tbody>
1824
1824
  </table>`});if(Y)Q=Q.replace(/<li>\s*\[\s*\]\s*/g,'<li><input type="checkbox" disabled /> '),Q=Q.replace(/<li>\s*\[x\]\s*/gi,'<li><input type="checkbox" checked disabled /> ');let G=Q.split(`
1825
- `),K=[],q=!1,W=[];for(let U of G){let z=U.trim();if(/^<(?:h[1-6]|ul|ol|li|blockquote|pre|table|thead|tbody|tr|th|td|hr|div|p)/.test(z)||/^\0CODEBLOCK\d+\0$/.test(z)||z===""){if(q&&W.length>0)K.push(`<p>${W.join(X?`<br />
1825
+ `),K=[],q=!1,U=[];for(let W of G){let z=W.trim();if(/^<(?:h[1-6]|ul|ol|li|blockquote|pre|table|thead|tbody|tr|th|td|hr|div|p)/.test(z)||/^\0CODEBLOCK\d+\0$/.test(z)||z===""){if(q&&U.length>0)K.push(`<p>${U.join(X?`<br />
1826
1826
  `:`
1827
- `)}</p>`),W=[],q=!1;K.push(U)}else q=!0,W.push(z)}if(q&&W.length>0)K.push(`<p>${W.join(X?`<br />
1827
+ `)}</p>`),U=[],q=!1;K.push(W)}else q=!0,U.push(z)}if(q&&U.length>0)K.push(`<p>${U.join(X?`<br />
1828
1828
  `:`
1829
1829
  `)}</p>`);if(Q=K.join(`
1830
1830
  `),X)Q=Q.replace(/\n/g,`<br />
1831
- `);for(let U=0;U<J.length;U++)Q=Q.replace(`\x00CODEBLOCK${U}\x00`,J[U]);return Q=Q.replace(/<p>\s*<\/p>/g,""),Q.trim()}function a0($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(X,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
1831
+ `);for(let W=0;W<J.length;W++)Q=Q.replace(`\x00CODEBLOCK${W}\x00`,J[W]);return Q=Q.replace(/<p>\s*<\/p>/g,""),Q.trim()}function t0($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(X,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
1832
1832
  `});let Y=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(Y,(X,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
1833
- `}),$}import tJ from"process";function l0($="STX_PUBLIC_"){let Z={},Y={};for(let[X,Q]of Object.entries(tJ.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 h1=()=>{};var $4={};o($4,{hasUserImports:()=>eJ,bundleClientScript:()=>ZQ});import j0 from"path";import x0 from"fs";function eJ($){let Z=/^\s*import\s+(?!type\s)/gm;if(!$.match(Z))return!1;let X=/^\s*import\s+(?!type\s).*?\s+from\s+['"]([^'"]+)['"]/gm,Q;while((Q=X.exec($))!==null){let G=Q[1];if(!J9.some((q)=>q.test(G)))return console.log("[stx:bundler] detected user import:",G),!0}let J=/^\s*import\s+['"]([^'"]+)['"]/gm;while((Q=J.exec($))!==null){let G=Q[1];if(/\.css(?:\?.*)?$/.test(G))continue;if(!J9.some((q)=>q.test(G)))return console.log("[stx:bundler] detected side-effect import:",G),!0}return!1}function $Q($,Z,Y,X){let Q=(J,G)=>{let K=J===Y?Z:j0.dirname(J),q=j0.resolve(K,G),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,j0.join(q,"index.ts"),j0.join(q,"index.tsx"),j0.join(q,"index.js"),j0.join(q,"index.mjs")];for(let U of W)try{if(x0.existsSync(U)&&x0.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)=>{let K=Q(G.importer,G.path);return X.add(K),{path:K}}),J.onResolve({filter:/^[@~]\//},(G)=>{let K=j0.resolve($,G.path.slice(2)),q=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,j0.join(K,"index.ts"),j0.join(K,"index.tsx"),j0.join(K,"index.js"),j0.join(K,"index.mjs")];for(let W of q)if(x0.existsSync(W)&&x0.statSync(W,{throwIfNoEntry:!1})?.isFile())return console.log(`[stx:bundler] resolved ${G.path[0]}/ import:`,G.path,"\u2192",W),X.add(W),{path:W};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}})}}}async function ZQ($,Z,Y={}){let X=Y.projectRoot||process.cwd(),Q=Y.minify??!1,J=Y.cacheDir||W5(X,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update($+Z);let K=G.digest("hex").slice(0,12),q=j0.join(J,`${K}.js`),W=j0.join(J,`${K}.deps.json`),U=Bun.file(q);if(await U.exists()){let A=Bun.file(W),N=!0;if(await A.exists())try{let w=JSON.parse(await A.text());for(let T of w.files)try{if(x0.statSync(T.path).mtimeMs!==T.mtimeMs){N=!1;break}}catch{N=!1;break}}catch{N=!1}if(N)return console.log("[stx:bundler] cache hit:",K),await U.text();console.log("[stx:bundler] cache invalidated by dep change:",K)}let z=W5(X,"bundle-tmp"),B=j0.join(z,`${K}.ts`),_=j0.join(z,"out",K);x0.mkdirSync(z,{recursive:!0}),x0.mkdirSync(_,{recursive:!0});let j=j0.dirname(Z),H=[],L=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,F=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,O;while((O=L.exec($))!==null){if(O[1])continue;if(O[2])O[2].split(",").forEach((A)=>{let N=A.split(":")[0].trim();if(N)H.push(N)});else if(O[3])H.push(O[3])}while((O=F.exec($))!==null){if(O[1])continue;H.push(O[2])}let V=H.length>0?`
1834
- export { ${H.join(", ")} }`:"";await Bun.write(B,$+V),console.log("[stx:bundler] bundling:",K,"from:",j0.basename(Z));let R=new Set;try{let A=await Bun.build({entrypoints:[B],outdir:_,target:"browser",format:"esm",minify:Q,plugins:[$Q(X,j,B,R)],define:{"process.env.NODE_ENV":Q?'"production"':'"development"',...l0()},root:X});if(!A.success){let M=A.logs.filter((I)=>I.level==="error").map((I)=>I.message).join(", ");return console.warn("[stx:bundler] build failed:",M),$}let N="";for(let M of A.outputs){N=await M.text();break}let w=[];for(let M of N.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let I of M[1].split(",")){let D=I.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(D&&D[1]!==D[2])w.push([D[2],D[1]])}if(N=N.replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),w.length>0){let M=w.map(([I,D])=>`${JSON.stringify(I)}: ${D}`).join(", ");N+=`
1835
- var __stxScopeRenames = { ${M} };`}console.log("[stx:bundler] bundled:",K,"output:",N.length,"bytes"),x0.mkdirSync(J,{recursive:!0}),await Bun.write(q,N);let T=Array.from(R).map((M)=>{try{return{path:M,mtimeMs:x0.statSync(M).mtimeMs}}catch{return null}}).filter((M)=>M!==null);return await Bun.write(W,JSON.stringify({files:T})),N}catch(A){let N=A instanceof Error?A.message:String(A),w=A?.errors,T=Array.isArray(w)&&w.length>0?`
1833
+ `}),$}import $Q from"process";function l0($="STX_PUBLIC_"){let Z={},Y={};for(let[X,Q]of Object.entries($Q.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 h1=()=>{};var $4={};o($4,{hasUserImports:()=>ZQ,bundleClientScript:()=>XQ});import j0 from"path";import v0 from"fs";function ZQ($){let Z=/^\s*import\s+(?!type\s)/gm;if(!$.match(Z))return!1;let X=/^\s*import\s+(?!type\s).*?\s+from\s+['"]([^'"]+)['"]/gm,Q;while((Q=X.exec($))!==null){let G=Q[1];if(!Q9.some((q)=>q.test(G)))return console.log("[stx:bundler] detected user import:",G),!0}let J=/^\s*import\s+['"]([^'"]+)['"]/gm;while((Q=J.exec($))!==null){let G=Q[1];if(/\.css(?:\?.*)?$/.test(G))continue;if(!Q9.some((q)=>q.test(G)))return console.log("[stx:bundler] detected side-effect import:",G),!0}return!1}function YQ($,Z,Y,X){let Q=(J,G)=>{let K=J===Y?Z:j0.dirname(J),q=j0.resolve(K,G),U=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,j0.join(q,"index.ts"),j0.join(q,"index.tsx"),j0.join(q,"index.js"),j0.join(q,"index.mjs")];for(let W of U)try{if(v0.existsSync(W)&&v0.statSync(W,{throwIfNoEntry:!1})?.isFile())return W}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)=>{let K=Q(G.importer,G.path);return X.add(K),{path:K}}),J.onResolve({filter:/^[@~]\//},(G)=>{let K=j0.resolve($,G.path.slice(2)),q=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,j0.join(K,"index.ts"),j0.join(K,"index.tsx"),j0.join(K,"index.js"),j0.join(K,"index.mjs")];for(let U of q)if(v0.existsSync(U)&&v0.statSync(U,{throwIfNoEntry:!1})?.isFile())return console.log(`[stx:bundler] resolved ${G.path[0]}/ import:`,G.path,"\u2192",U),X.add(U),{path:U};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}})}}}async function XQ($,Z,Y={}){let X=Y.projectRoot||process.cwd(),Q=Y.minify??!1,J=Y.cacheDir||B5(X,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update($+Z);let K=G.digest("hex").slice(0,12),q=j0.join(J,`${K}.js`),U=j0.join(J,`${K}.deps.json`),W=Bun.file(q);if(await W.exists()){let N=Bun.file(U),A=!0;if(await N.exists())try{let w=JSON.parse(await N.text());for(let T of w.files)try{if(v0.statSync(T.path).mtimeMs!==T.mtimeMs){A=!1;break}}catch{A=!1;break}}catch{A=!1}if(A)return console.log("[stx:bundler] cache hit:",K),await W.text();console.log("[stx:bundler] cache invalidated by dep change:",K)}let z=B5(X,"bundle-tmp"),B=j0.join(z,`${K}.ts`),_=j0.join(z,"out",K);v0.mkdirSync(z,{recursive:!0}),v0.mkdirSync(_,{recursive:!0});let j=j0.dirname(Z),H=[],L=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,F=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,O;while((O=L.exec($))!==null){if(O[1])continue;if(O[2])O[2].split(",").forEach((N)=>{let A=N.split(":")[0].trim();if(A)H.push(A)});else if(O[3])H.push(O[3])}while((O=F.exec($))!==null){if(O[1])continue;H.push(O[2])}let V=H.length>0?`
1834
+ export { ${H.join(", ")} }`:"";await Bun.write(B,$+V),console.log("[stx:bundler] bundling:",K,"from:",j0.basename(Z));let R=new Set;try{let N=await Bun.build({entrypoints:[B],outdir:_,target:"browser",format:"esm",minify:Q,plugins:[YQ(X,j,B,R)],define:{"process.env.NODE_ENV":Q?'"production"':'"development"',...l0()},root:X});if(!N.success){let M=N.logs.filter((I)=>I.level==="error").map((I)=>I.message).join(", ");return console.warn("[stx:bundler] build failed:",M),$}let A="";for(let M of N.outputs){A=await M.text();break}let w=[];for(let M of A.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let I of M[1].split(",")){let D=I.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(D&&D[1]!==D[2])w.push([D[2],D[1]])}if(A=A.replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),w.length>0){let M=w.map(([I,D])=>`${JSON.stringify(I)}: ${D}`).join(", ");A+=`
1835
+ var __stxScopeRenames = { ${M} };`}console.log("[stx:bundler] bundled:",K,"output:",A.length,"bytes"),v0.mkdirSync(J,{recursive:!0}),await Bun.write(q,A);let T=Array.from(R).map((M)=>{try{return{path:M,mtimeMs:v0.statSync(M).mtimeMs}}catch{return null}}).filter((M)=>M!==null);return await Bun.write(U,JSON.stringify({files:T})),A}catch(N){let A=N instanceof Error?N.message:String(N),w=N?.errors,T=Array.isArray(w)&&w.length>0?`
1836
1836
  ${w.map((M)=>`- ${M?.message??M}`).join(`
1837
- `)}`:"";return console.warn(`[stx:bundler] error: ${N}${T}`),$}finally{try{x0.rmSync(B,{force:!0}),x0.rmSync(_,{recursive:!0,force:!0})}catch{}}}var J9;var Z4=b(()=>{h1();e5();J9=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/]});var U9={};o(U9,{renderVendorStyleTags:()=>K9,processClientScript:()=>H5,generateServerDataBridge:()=>Y4,generateAutoImportDestructuring:()=>q9,extractBridgeData:()=>j5,extractAndStripCssImports:()=>G9});import O1 from"path";import _5 from"fs";function XQ($){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 JQ($,Z){let Y=Z;while(!0){let X=O1.join(Y,"node_modules",$,"package.json");if(_5.existsSync(X))return O1.dirname(X);let Q=O1.dirname(Y);if(Q===Y)return null;Y=Q}}function QQ($,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 GQ($,Z){let Y=XQ($);if(!Y||!Y.subpath)return null;let X=JQ(Y.pkg,Z);if(!X)return null;let Q;try{Q=JSON.parse(_5.readFileSync(O1.join(X,"package.json"),"utf8"))}catch{return null}let J=`.${Y.subpath}`,G=QQ(Q.exports,J);if(!G)return null;let K=O1.resolve(X,G);return _5.existsSync(K)?K:null}function G9($,Z){let Y=Z.filePath?O1.dirname(Z.filePath):Z.projectRoot||process.cwd(),X=Z.projectRoot||process.cwd(),Q=new Set,J=[];return{code:$.replace(YQ,(K,q)=>{let W;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(W=q.startsWith("/")?q:O1.resolve(Y,q),!_5.existsSync(W))throw Error(`file not found: ${W}`)}else{let U=null;try{U=Bun.resolveSync(q,X)}catch{U=GQ(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=_5.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 KQ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function K9($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${KQ(Z.source)}" data-stx-layer="vendor">
1837
+ `)}`:"";return console.warn(`[stx:bundler] error: ${A}${T}`),$}finally{try{v0.rmSync(B,{force:!0}),v0.rmSync(_,{recursive:!0,force:!0})}catch{}}}var Q9;var Z4=b(()=>{h1();e5();Q9=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/]});var W9={};o(W9,{renderVendorStyleTags:()=>q9,processClientScript:()=>L5,generateServerDataBridge:()=>Y4,generateAutoImportDestructuring:()=>U9,extractBridgeData:()=>O5,extractAndStripCssImports:()=>K9});import O1 from"path";import H5 from"fs";function QQ($){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 GQ($,Z){let Y=Z;while(!0){let X=O1.join(Y,"node_modules",$,"package.json");if(H5.existsSync(X))return O1.dirname(X);let Q=O1.dirname(Y);if(Q===Y)return null;Y=Q}}function KQ($,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 qQ($,Z){let Y=QQ($);if(!Y||!Y.subpath)return null;let X=GQ(Y.pkg,Z);if(!X)return null;let Q;try{Q=JSON.parse(H5.readFileSync(O1.join(X,"package.json"),"utf8"))}catch{return null}let J=`.${Y.subpath}`,G=KQ(Q.exports,J);if(!G)return null;let K=O1.resolve(X,G);return H5.existsSync(K)?K:null}function K9($,Z){let Y=Z.filePath?O1.dirname(Z.filePath):Z.projectRoot||process.cwd(),X=Z.projectRoot||process.cwd(),Q=new Set,J=[];return{code:$.replace(JQ,(K,q)=>{let U;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(U=q.startsWith("/")?q:O1.resolve(Y,q),!H5.existsSync(U))throw Error(`file not found: ${U}`)}else{let W=null;try{W=Bun.resolveSync(q,X)}catch{W=qQ(q,X)}if(!W)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);U=W}}catch(W){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${Z.filePath||"<unknown>"}): ${W?.message||W}`),""}if(Q.has(U))return"";Q.add(U);try{let W=H5.readFileSync(U,"utf8");J.push({source:q,resolvedPath:U,contents:W})}catch(W){console.warn(`[stx:vendor-css] could not read ${U}: ${W?.message||W}`)}return""}),styles:J}}function UQ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function q9($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${UQ(Z.source)}" data-stx-layer="vendor">
1838
1838
  @layer vendor {
1839
1839
  ${Z.contents}
1840
1840
  }
1841
1841
  </style>`}).join(`
1842
1842
  `)}
1843
- `}function zQ($){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(!WQ.has(X[1]))Z.add(X[1]);return Array.from(Z)}function BQ($){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|stx)['"]\s*;?\s*$/gm,G;while((G=J.exec($))!==null){let q=G[1],W=G[2];if(G[0].includes("import type"))continue;q.split(",").map((z)=>z.trim().split(/\s+as\s+/)[0]).filter((z)=>z.length>0).forEach((z)=>{if(Q.add(z),W==="stx")Z.add(z);else Y.add(z)}),X=X.replace(G[0],"// [auto-import processed]")}for(let q of qQ){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\s*\\(`,"g").test(X))Z.add(q)}for(let q of UQ){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(X))Y.add(q)}let K=zQ(X);for(let q of K)if(!Q.has(q))Y.add(q);return{code:X,stxImports:Array.from(Z),browserImports:Array.from(Y)}}function q9($,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
1843
+ `}function _Q($){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(!BQ.has(X[1]))Z.add(X[1]);return Array.from(Z)}function jQ($){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|stx)['"]\s*;?\s*$/gm,G;while((G=J.exec($))!==null){let q=G[1],U=G[2];if(G[0].includes("import type"))continue;q.split(",").map((z)=>z.trim().split(/\s+as\s+/)[0]).filter((z)=>z.length>0).forEach((z)=>{if(Q.add(z),U==="stx")Z.add(z);else Y.add(z)}),X=X.replace(G[0],"// [auto-import processed]")}for(let q of WQ){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\s*\\(`,"g").test(X))Z.add(q)}for(let q of zQ){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(X))Y.add(q)}let K=_Q(X);for(let q of K)if(!Q.has(q))Y.add(q);return{code:X,stxImports:Array.from(Z),browserImports:Array.from(Y)}}function U9($,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
1844
1844
  ${Y.join(`
1845
1845
  `)}
1846
- ${_Q($,Z)}`;return""}function _Q($,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
1846
+ ${HQ($,Z)}`;return""}function HQ($,Z){let Y=[...$.map((X)=>`['${X}', typeof ${X}, 'stx']`),...Z.map((X)=>`['${X}', typeof ${X}, '@stacksjs/browser']`)];if(Y.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
1847
1847
  [${Y.join(", ")}].forEach(function (e) {
1848
1848
  if (e[1] !== 'undefined') return;
1849
1849
  console.error(
@@ -1852,12 +1852,12 @@ ${_Q($,Z)}`;return""}function _Q($,Z){let Y=[...$.map((X)=>`['${X}', typeof ${X}
1852
1852
  + 'or it should be imported from a relative path so the bundler includes it.'
1853
1853
  );
1854
1854
  });
1855
- `}function j5($){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 Y4($,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(new RegExp(`(?:const|let|var|function|class)\\s+${X}\\b`).test($))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)
1855
+ `}function O5($){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 Y4($,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(new RegExp(`(?:const|let|var|function|class)\\s+${X}\\b`).test($))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)
1856
1856
  ${Y.join(`
1857
1857
  `)}
1858
- `}function HQ($){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=jQ[$.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function OQ($,Z){let{elementId:Y,event:X,handler:Q,modifiers:J}=$,G=HQ(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,"\\'");function z(B){return`var scope = $el.closest('[data-stx-scope]');
1858
+ `}function LQ($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let Y of $.systemKeys)Z.push(`if (!$event.${Y}Key) return`);if($.keys.length>0){let Y=$.keys.map((X)=>`$event.key === '${X}'`).join(" || ");Z.push(`if (!(${Y})) return`)}if($.mouse!==null){let Y=OQ[$.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function FQ($,Z){let{elementId:Y,event:X,handler:Q,modifiers:J}=$,G=LQ(J),K=[];if(J.once)K.push("once: true");if(J.capture)K.push("capture: true");if(J.passive)K.push("passive: true");let q=K.length>0?`, { ${K.join(", ")} }`:"",U="";if(G)U+=`${G}; `;let W=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'");function z(B){return`var scope = $el.closest('[data-stx-scope]');
1859
1859
  if (scope && scope.__stx_execute) {
1860
- scope.__stx_execute('${U}', $event, $el);
1860
+ scope.__stx_execute('${W}', $event, $el);
1861
1861
  }
1862
1862
  else {
1863
1863
  ${B}
@@ -1884,32 +1884,32 @@ else {
1884
1884
  }${q})
1885
1885
  })()`;return` var $el = document.getElementById('${Y}')
1886
1886
  if ($el) $el.addEventListener('${X}', function($event) {
1887
- ${W}var scope = $el.closest('[data-stx-scope]');
1887
+ ${U}var scope = $el.closest('[data-stx-scope]');
1888
1888
  if (scope && scope.__stx_execute) {
1889
- scope.__stx_execute('${U}', $event, $el);
1889
+ scope.__stx_execute('${W}', $event, $el);
1890
1890
  }
1891
1891
  else {
1892
1892
  ${Q}
1893
1893
  }
1894
- }${q})`}function LQ($){if($.length===0)return"";return`
1894
+ }${q})`}function VQ($){if($.length===0)return"";return`
1895
1895
  // STX: auto-generated event bindings
1896
- ${$.map((Y,X)=>OQ(Y,X)).join(`
1897
- `)}`}function Q9($){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]!==`
1898
- `)G++;continue}if(K==="/"&&X[G+1]==="*"){G+=2;while(G<J-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(K==="{"){Q++,G++;continue}if(K==="}"){Q--,G++;continue}if(Q===0){let q=X.slice(G),W=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let B=W[1];if(!B.startsWith("_")&&!Y.has(B))Z.push(B),Y.add(B);G+=W[0].length;continue}let U=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[1].split(",").forEach((B)=>{let _=B.trim(),j=_.indexOf(":"),H=j>=0?_.slice(j+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 B=z[1];if(!B.startsWith("_")&&!Y.has(B))Z.push(B),Y.add(B);G+=z[0].length;continue}}G++}return Z}function VQ($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(B){let _;while((_=Y.exec(B))!==null){let j=_[0];if(!FQ.has(j))Z.add(j)}}let Q=/\{\{([\s\S]*?)\}\}/g,J;while((J=Q.exec($))!==null)X(J[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((J=G.exec($))!==null)X(J[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((J=K.exec($))!==null)X(J[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((J=q.exec($))!==null)X(J[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((J=W.exec($))!==null)X(J[1]);let U=/@model\s*=\s*["']([^"']*)["']/gi;while((J=U.exec($))!==null)X(J[1]);let z=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((J=z.exec($))!==null)X(J[1]);return Z}async function H5($,Z={}){let Y=$,X="",Q=!1,J=G9(Y,{filePath:Z.filePath,projectRoot:Z.projectRoot});Y=J.code;let G=K9(J.styles),{hasUserImports:K,bundleClientScript:q}=await Promise.resolve().then(() => (Z4(),$4));if(K(Y))console.log("[stx:bundler] user imports detected, bundling..."),Y=await q(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Q=!0;if(Z.autoImports!==!1){let L=BQ(Y);Y=L.code,X=q9(L.stxImports,L.browserImports)}if(X=`${Y4(Y,Z.serverData)}${X}`,Y=a0(Y),!Q&&L1(Z.attrs||""))Y=F1(Y);let W=LQ(Z.eventBindings||[]),U=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(U)){let L=U.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${L?` ${L}`:""}`;return`${G}<script ${F}>
1896
+ ${$.map((Y,X)=>FQ(Y,X)).join(`
1897
+ `)}`}function G9($){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 U=0;while(G<J){if(X[G]==="\\"){G+=2;continue}if(X[G]==="`"&&U===0){G++;break}if(X[G]==="$"&&X[G+1]==="{"){U++,G+=2;continue}if(X[G]==="}"&&U>0){U--,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]!==`
1898
+ `)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),U=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(U){let B=U[1];if(!B.startsWith("_")&&!Y.has(B))Z.push(B),Y.add(B);G+=U[0].length;continue}let W=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(W){W[1].split(",").forEach((B)=>{let _=B.trim(),j=_.indexOf(":"),H=j>=0?_.slice(j+1).trim().split(/[\s=]/)[0]:_.split(/[\s=]/)[0];if(H&&!H.startsWith("_")&&!Y.has(H))Z.push(H),Y.add(H)}),G+=W[0].length;continue}let z=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(z){let B=z[1];if(!B.startsWith("_")&&!Y.has(B))Z.push(B),Y.add(B);G+=z[0].length;continue}}G++}return Z}function NQ($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(B){let _;while((_=Y.exec(B))!==null){let j=_[0];if(!RQ.has(j))Z.add(j)}}let Q=/\{\{([\s\S]*?)\}\}/g,J;while((J=Q.exec($))!==null)X(J[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((J=G.exec($))!==null)X(J[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((J=K.exec($))!==null)X(J[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((J=q.exec($))!==null)X(J[1]);let U=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((J=U.exec($))!==null)X(J[1]);let W=/@model\s*=\s*["']([^"']*)["']/gi;while((J=W.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 L5($,Z={}){let Y=$,X="",Q=!1,J=K9(Y,{filePath:Z.filePath,projectRoot:Z.projectRoot});Y=J.code;let G=q9(J.styles),{hasUserImports:K,bundleClientScript:q}=await Promise.resolve().then(() => (Z4(),$4));if(K(Y))console.log("[stx:bundler] user imports detected, bundling..."),Y=await q(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Q=!0;if(Z.autoImports!==!1){let L=jQ(Y);Y=L.code,X=U9(L.stxImports,L.browserImports)}if(X=`${Y4(Y,Z.serverData)}${X}`,Y=t0(Y),!Q&&L1(Z.attrs||""))Y=F1(Y);let U=VQ(Z.eventBindings||[]),W=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(W)){let L=W.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${L?` ${L}`:""}`;return`${G}<script ${F}>
1899
1899
  ${X}${Y}
1900
- ${W}
1900
+ ${U}
1901
1901
  </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|batch|untrack|peek)\s*(?:<[^>]*>)?\s*\(/.test($),_=/function __stx_setup_/.test(Y),j=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function H(L){let F=L.length>0?`
1902
1902
  return { ${L.join(", ")} };`:"";return`${G}<script data-stx-scoped>
1903
1903
  window.stx.mount(function() {
1904
1904
  'use strict';
1905
1905
  ${X}${Y}
1906
- ${W}${F}
1907
- })</script>`}if(!j&&!_){if(B)return H(Q9($));if(Z.templateContent){let L=Q9($);if(L.length>0){let F=VQ(Z.templateContent);if(L.some((V)=>F.has(V)))return H(L)}}}return`${G}<script data-stx-scoped>
1906
+ ${U}${F}
1907
+ })</script>`}if(!j&&!_){if(B)return H(G9($));if(Z.templateContent){let L=G9($);if(L.length>0){let F=NQ(Z.templateContent);if(L.some((V)=>F.has(V)))return H(L)}}}return`${G}<script data-stx-scoped>
1908
1908
  ;(function() {
1909
1909
  'use strict';
1910
1910
  ${X}${Y}
1911
- ${W}
1912
- })()</script>`}var YQ,qQ,UQ,WQ,jQ,FQ;var O5=b(()=>{H0();YQ=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;qQ=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useFetch","useQuery","useMutation","useOptimistic","useReactiveProp","useLocalStorage","useSessionStorage","useCookie","useWebSocket","useHead","useSeoMeta","definePageMeta","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","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","useStore","action","createSelector","h","Fragment"],UQ=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser"],WQ=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"]);jQ={left:0,middle:1,right:2};FQ=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"])});function wQ($){let Z="",Y=null,X=!1;for(let Q=0;Q<$.length;Q++){let J=$[Q];if(X){X=!1;continue}if(J==="\\"&&Y){X=!0;continue}if(Y){if(Y==="`"&&J==="$"&&Q+1<$.length&&$[Q+1]==="{"){let G=1;Q+=2;while(Q<$.length&&G>0){if($[Q]==="{")G++;else if($[Q]==="}")G--;if(G>0)Z+=$[Q],Q++}continue}if(J===Y)Y=null;continue}if(J==='"'||J==="'"||J==="`"){Y=J;continue}Z+=J}return Z}function TQ($,Z){let Y=/[$A-Z_a-z][$\w]*/g,X;while((X=Y.exec($))!==null){let Q=X[0],J=$[X.index-1];if(AQ.has(Q))throw Error(`Potentially unsafe expression (matched /\\b${Q}\\b/; identifier ${Q}): ${Z}`);if(J==="."&&_9.has(Q))throw Error(`Potentially unsafe expression (matched /.${Q}/; property ${Q}): ${Z}`)}}function MQ($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let X=Y[2];if(!_9.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 X4($){let Z=$.trim(),Y=wQ(Z);TQ(Y,Z),MQ(Z);for(let X of B9)if(X.test(Y))throw Error(`Potentially unsafe expression (matched /${X.source}/): ${Z}`);if(!z9.allowBracketNotation&&NQ.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function IQ($){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("__")||B9.some((Q)=>Q.test(Y)))continue;if(X&&typeof X==="object"&&!Array.isArray(X))Z[Y]=p$(X);else Z[Y]=X}return Z}function p$($,Z=0){if(Z>=z9.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((X)=>p$(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]=p$(Q,Z+1);else Y[X]=Q}return Y}function $0($,Z){try{let Y=IQ(Z),X=Object.keys(Y),Q=Object.values(Y);return J0($,X)(...Q)}catch{return}}function X0($){try{return X4($),!0}catch{return!1}}function O0($,Z){try{let Y=$0($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function J0($,Z){let Y=X4($),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(j9.has(U))continue;Q.push(W),J.push(U)}let G=(W)=>Function(...J,...W,`
1911
+ ${U}
1912
+ })()</script>`}var JQ,WQ,zQ,BQ,OQ,RQ;var F5=b(()=>{H0();JQ=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;WQ=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useFetch","useQuery","useMutation","useOptimistic","useReactiveProp","useLocalStorage","useSessionStorage","useCookie","useWebSocket","useHead","useSeoMeta","definePageMeta","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","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","useStore","action","createSelector","h","Fragment"],zQ=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser"],BQ=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"]);OQ={left:0,middle:1,right:2};RQ=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"])});function MQ($){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 IQ($,Z){let Y=/[$A-Z_a-z][$\w]*/g,X;while((X=Y.exec($))!==null){let Q=X[0],J=$[X.index-1];if(wQ.has(Q))throw Error(`Potentially unsafe expression (matched /\\b${Q}\\b/; identifier ${Q}): ${Z}`);if(J==="."&&j9.has(Q))throw Error(`Potentially unsafe expression (matched /.${Q}/; property ${Q}): ${Z}`)}}function DQ($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let X=Y[2];if(!j9.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 X4($){let Z=$.trim(),Y=MQ(Z);IQ(Y,Z),DQ(Z);for(let X of _9)if(X.test(Y))throw Error(`Potentially unsafe expression (matched /${X.source}/): ${Z}`);if(!B9.allowBracketNotation&&TQ.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function EQ($){let Z={};Z.Math=Math,Z.JSON=JSON,Z.Date=Date,Z.String=String,Z.Number=Number,Z.Boolean=Boolean,Z.Array=Array,Z.parseInt=Number.parseInt,Z.parseFloat=Number.parseFloat,Z.isNaN=Number.isNaN,Z.isFinite=Number.isFinite,Z.encodeURIComponent=encodeURIComponent,Z.decodeURIComponent=decodeURIComponent;for(let[Y,X]of Object.entries($)){if(Y.startsWith("__")||_9.some((Q)=>Q.test(Y)))continue;if(X&&typeof X==="object"&&!Array.isArray(X))Z[Y]=p$(X);else Z[Y]=X}return Z}function p$($,Z=0){if(Z>=B9.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((X)=>p$(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]=p$(Q,Z+1);else Y[X]=Q}return Y}function $0($,Z){try{let Y=EQ(Z),X=Object.keys(Y),Q=Object.values(Y);return J0($,X)(...Q)}catch{return}}function X0($){try{return X4($),!0}catch{return!1}}function O0($,Z){try{let Y=$0($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function J0($,Z){let Y=X4($),X=/^[A-Za-z_$][\w$]*$/,Q=[],J=[];for(let U=0;U<Z.length;U++){let W=Z[U];if(!X.test(W))continue;if(H9.has(W))continue;Q.push(U),J.push(W)}let G=(U)=>Function(...J,...U,`
1913
1913
  'use strict';
1914
1914
  try {
1915
1915
  return ${Y};
@@ -1920,7 +1920,7 @@ catch (e) {
1920
1920
  }
1921
1921
  throw e;
1922
1922
  }
1923
- `),K=G([]);if(J.length===Z.length)return W9(K,J,G);return W9((...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 W9($,Z,Y,X){let J=/^(\w+) is not defined$/,G=$,K=[],q=new Set(Z);return(...W)=>{for(let U=0;U<=8;U++)try{return G(...W)}catch(z){let B=z instanceof Error?z.message:"",_=J.exec(B);if(!(z instanceof ReferenceError)||!_)return;let j=_[1];if(q.has(j)||j9.has(j))return;q.add(j),K.push(j),G=Y(K),X?.(K)}return}}function J4($){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 RQ,z9,B9,AQ,_9,NQ,j9;var L0=b(()=>{RQ={maxSanitizeDepth:10,allowBracketNotation:!1},z9={...RQ},B9=[/\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/],AQ=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"]),_9=new Set(["__proto__","constructor","prototype"]),NQ=/[\w)\]]\s*\[\s*['"]/;j9=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 Q4($,Z){let Y=DQ++,X=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return EQ.set(X,{type:$,expression:Z}),X}var DQ=0,EQ;var H9=b(()=>{EQ=new Map});function O9($,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 G4($,Z){return O9($,Z,kQ,bQ)}function L9($,Z){return O9($,Z,SQ,yQ)}function F9($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function L5($,Z,Y){let X=[],Q="",J=0,G=$.length,K=!1,q=null;while(J<G){let W=$[J];if(K){if(Q+=W,q){if(W===q)q=null}else if(W==='"'||W==="'")q=W;else if(W===">")K=!1;J++;continue}if(W==="<"){let U=Z($,J);if(U>J){Q+=Y($.slice(J,U),X.length),X.push($.slice(J,U)),J=U;continue}if(/^<\/?[a-zA-Z]/.test($.slice(J,J+2)))K=!0;Q+=W,J++;continue}Q+=W,J++}return{output:Q,tokens:X}}function c$($){let{output:Z,tokens:Y}=L5($,G4,(X,Q)=>`\x00STX_SCRIPT_${Q}\x00`);return{output:Z,scripts:Y}}function i$($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,X)=>Z[+X]??"")}var kQ,bQ,SQ,yQ;var K4=b(()=>{kQ=/<script\b[^>]*>/iy,bQ=/<\/script\s*>/ig,SQ=/<style\b[^>]*>/iy,yQ=/<\/style\s*>/ig});var M9={};o(M9,{usesSignalsInScript:()=>d1,unescapeHtml:()=>n$,registerFilters:()=>CQ,registerFilter:()=>A9,processExpressions:()=>p0,interpolateScriptsInTemplate:()=>xQ,interpolateScriptExpressions:()=>w9,getAllFilters:()=>N9,evaluateExpression:()=>f0,escapeHtml:()=>h0,defaultFilters:()=>V5,clearCustomFilters:()=>vQ,applyFilters:()=>T9});function PQ($){let Z=V9.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),V9.set($,Z)}return Z.lastIndex=0,Z}function A9($,Z){if($ in V5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);F5[$]=Z}function CQ($){for(let[Z,Y]of Object.entries($))A9(Z,Y)}function N9(){return{...V5,...F5}}function vQ(){for(let $ of Object.keys(F5))delete F5[$]}function h0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function d1($){let Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=Z.exec($))!==null){let X=Y[1];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(X))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function R9($,Z){let Y=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],X=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Q="",J=!1,G=0;for(let W=0;W<X.length;W++){let U=X[W];if(!J&&U==="`"){J=!0,G=0;continue}if(J){if(U==="`"&&G===0){J=!1;continue}if(U==="$"&&X[W+1]==="{"){G++,W++,Q+=" ";continue}if(U==="}"&&G>0){G--;continue}if(G>0){Q+=U;continue}continue}Q+=U}X=Q;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,q;while((q=K.exec(X))!==null){let W=q[1];if(!X.substring(0,q.index).trimEnd().endsWith(".")){if(!Y.includes(W)&&!(W in Z))return!1}}return!0}function w9($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=f0(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=f0(Q,Z);if(G===void 0)return X;return JSON.stringify(G)}catch{return X}}),Y}function xQ($,Z,Y={}){return $.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(X,Q,J)=>{if(/\bsrc\s*=/.test(Q))return X;if(/\bdata-raw\b/.test(Q))return X;if(/\btype\s*=\s*["']application\/json["']/.test(Q))return X;if(Y.skipServer&&/\bserver\b/.test(Q))return X;let G=w9(J,Z);return`<script${Q}>${G}</script>`})}function p0($,Z,Y,X){let Q=$,J=(U,z)=>{let B=L9(U,z);if(B===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(U.slice(z,B))?-1:B},G=(U,z,B,_)=>{let j=B.length,{output:H,tokens:L}=L5(U,z,(F,O)=>_(j+O));return B.push(...L),H},K=[];Q=G(Q,J,K,(U)=>`<!--__STX_STYLE_${U}__-->`);let q=[];Q=G(Q,G4,q,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`);let W=X?.forceSignals===!0||Z?.__stx_force_signals===!0||d1($);Q=Q.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(U,z,B)=>{try{let _=f0(z,Z);return _!==void 0&&_!==null?String(_):""}catch(_){let j=_ instanceof Error?_.message:String(_);return G0("Expression",`Error evaluating: {{{ ${z.trim()}}}}: ${j}`,Y,$,B,U)}}),Q=Q.replace(/\{!!([\s\S]*?)!!\}/g,(U,z,B)=>{try{let _=f0(z,Z);if(_===void 0&&Z.__stx_buildMode==="compile")return Q4("raw",z.trim());return _!==void 0&&_!==null?String(_):""}catch(_){if(Z.__stx_buildMode==="compile")return Q4("raw",z.trim());let j=_ instanceof Error?_.message:String(_);return G0("Expression",`Error evaluating: {!! ${z.trim()} !!}: ${j}`,Y,$,B,U)}}),Q=G(Q,G4,q,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`),Q=G(Q,J,K,(U)=>`<!--__STX_STYLE_${U}__-->`),Q=Q.replace(/\{\{([\s\S]*?)\}\}/g,(U,z,B)=>{let _=z.trim(),j=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],H=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,F=_.match(H)?.[1],O=F&&((F in Z)||j.includes(F)),V=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=_.match(V),A=R&&!j.includes(R[1])&&!(R[1]in Z);if(/^__[A-Z_]+__$/.test(_))return"";try{let N=f0(z,Z);if(W&&!R9(_,Z))return U;if(N===void 0&&Z.__stx_buildMode==="compile"&&!W)return Q4("expr",_);return N!==void 0&&N!==null?h0(String(N)):""}catch(N){if(W&&!R9(_,Z))return U;if(A)return U;let w=N instanceof Error?N.message:String(N);return G0("Expression",`Error evaluating: {{ ${_} }}: ${w}`,Y,$,B,U)}});for(let U=0;U<q.length;U++)Q=Q.replace(`<!--__STX_SCRIPT_EXPR_${U}__-->`,()=>q[U]);for(let U=0;U<K.length;U++)Q=Q.replace(`<!--__STX_STYLE_${U}__-->`,()=>K[U]);return Q}function T9($,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=F5[G]||V5[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(N9()).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=[f0(`(${z})`,Y,!0)];else{let B=[],_="",j=null,H=0,L=0,F=0,O=!1;for(let V=0;V<z.length;V++){let R=z[V];if(O){_+=R,O=!1;continue}if(R==="\\"){_+=R,O=!0;continue}if(j){if(_+=R,R===j)j=null;continue}if(R==='"'||R==="'"||R==="`"){j=R,_+=R;continue}if(R==="(")H++;else if(R===")")H--;else if(R==="[")L++;else if(R==="]")L--;else if(R==="{")F++;else if(R==="}")F--;if(R===","&&H===0&&L===0&&F===0){B.push(_),_="";continue}_+=R}if(_)B.push(_);q=B.map((V)=>{let R=V.trim();return f0(R,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 fQ($){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 f0($,Z,Y=!1){try{let X=$.trim(),Q=fQ(X);if(Q>0){let J=X.substring(0,Q).trim(),G=X.substring(Q+1).trim(),K=f0(J,Z,!0);return T9(K,G,Z)}if(!X0(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 J0(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=gQ(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 gQ($,Z){let Y=null;for(let Q of Z){if(Q===$)continue;let J=hQ($,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 hQ($,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 n$($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var F5,V9,V5;var c0=b(()=>{L0();H0();H9();K4();F5={},V9=new Map;V5={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let Y=String($);return Y.charAt(0).toUpperCase()+Y.slice(1)},number:($,Z,Y=0)=>{if($===void 0||$===null)return"";try{let X=Number($);return Number.isNaN(X)?"":X.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:($,Z,Y="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return X.toLocaleString(Y)}catch{return String($)}},join:($,Z,Y=",")=>{if(!Array.isArray($))return"";return $.join(String(Y))},escape:($,Z)=>{if($===void 0||$===null)return"";return h0(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(PQ(q),String(W))}),K},t:($,Z,Y={})=>{return V5.translate($,Z,Y)},truncate:($,Z,Y=50,X="...")=>{if($===void 0||$===null)return"";let Q=String($);if(Q.length<=Y)return Q;if(Y<=X.length)return X.substring(0,Y);return Q.substring(0,Y-X.length)+X},date:($,Z,Y="short",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=$ instanceof Date?$:new Date($);if(Number.isNaN(Q.getTime()))return String($);let J={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Y==="iso")return Q.toISOString();return new Intl.DateTimeFormat(X,J[Y]||J.short).format(Q)}catch{return String($)}},currency:($,Z,Y="USD",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=Number($);if(Number.isNaN(Q))return String($);return new Intl.NumberFormat(X,{style:"currency",currency:Y}).format(Q)}catch{return String($)}},pluralize:($,Z,Y,X)=>{let Q=Number($);if(Number.isNaN(Q))return Y;let J=X||`${Y}s`;return Q===1?Y:J},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Y=String($);return Y.charAt(Y.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,Y=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Y?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,Y="")=>{return $===void 0||$===null||$===""?Y:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,Y=0,X)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,X);return $},replace:($,Z,Y,X="")=>{if($===void 0||$===null)return"";let Q=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Q,"g"),()=>X)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let Y=Number($);return Number.isNaN(Y)?0:Math.abs(Y)},round:($,Z,Y=0)=>{let X=Number($);if(Number.isNaN(X))return 0;let Q=10**Y;return Math.round(X*Q)/Q}}});class R5{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 u1($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!m1.has(Y)){if(m1.size>=dQ){let X=m1.keys().next().value;if(X)m1.delete(X)}m1.set(Y,new RegExp($,Z))}return m1.get(Y)}class I9{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,`
1923
+ `),K=G([]);if(J.length===Z.length)return z9(K,J,G);return z9((...U)=>{let W=Array(Q.length);for(let z=0;z<Q.length;z++)W[z]=U[Q[z]];return K(...W)},J,G,(U)=>{K=G(U)})}function z9($,Z,Y,X){let J=/^(\w+) is not defined$/,G=$,K=[],q=new Set(Z);return(...U)=>{for(let W=0;W<=8;W++)try{return G(...U)}catch(z){let B=z instanceof Error?z.message:"",_=J.exec(B);if(!(z instanceof ReferenceError)||!_)return;let j=_[1];if(q.has(j)||H9.has(j))return;q.add(j),K.push(j),G=Y(K),X?.(K)}return}}function J4($){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 AQ,B9,_9,wQ,j9,TQ,H9;var L0=b(()=>{AQ={maxSanitizeDepth:10,allowBracketNotation:!1},B9={...AQ},_9=[/\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/],wQ=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"]),j9=new Set(["__proto__","constructor","prototype"]),TQ=/[\w)\]]\s*\[\s*['"]/;H9=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 Q4($,Z){let Y=kQ++,X=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return bQ.set(X,{type:$,expression:Z}),X}var kQ=0,bQ;var O9=b(()=>{bQ=new Map});function L9($,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 G4($,Z){return L9($,Z,SQ,yQ)}function F9($,Z){return L9($,Z,PQ,CQ)}function V9($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function V5($,Z,Y){let X=[],Q="",J=0,G=$.length,K=!1,q=null;while(J<G){let U=$[J];if(K){if(Q+=U,q){if(U===q)q=null}else if(U==='"'||U==="'")q=U;else if(U===">")K=!1;J++;continue}if(U==="<"){let W=Z($,J);if(W>J){Q+=Y($.slice(J,W),X.length),X.push($.slice(J,W)),J=W;continue}if(/^<\/?[a-zA-Z]/.test($.slice(J,J+2)))K=!0;Q+=U,J++;continue}Q+=U,J++}return{output:Q,tokens:X}}function c$($){let{output:Z,tokens:Y}=V5($,G4,(X,Q)=>`\x00STX_SCRIPT_${Q}\x00`);return{output:Z,scripts:Y}}function i$($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,X)=>Z[+X]??"")}var SQ,yQ,PQ,CQ;var K4=b(()=>{SQ=/<script\b[^>]*>/iy,yQ=/<\/script\s*>/ig,PQ=/<style\b[^>]*>/iy,CQ=/<\/style\s*>/ig});var I9={};o(I9,{usesSignalsInScript:()=>d1,unescapeHtml:()=>n$,registerFilters:()=>xQ,registerFilter:()=>A9,processExpressions:()=>p0,interpolateScriptsInTemplate:()=>gQ,interpolateScriptExpressions:()=>T9,getAllFilters:()=>w9,evaluateExpression:()=>x0,escapeHtml:()=>h0,defaultFilters:()=>N5,clearCustomFilters:()=>fQ,applyFilters:()=>M9});function vQ($){let Z=R9.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),R9.set($,Z)}return Z.lastIndex=0,Z}function A9($,Z){if($ in N5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);R5[$]=Z}function xQ($){for(let[Z,Y]of Object.entries($))A9(Z,Y)}function w9(){return{...N5,...R5}}function fQ(){for(let $ of Object.keys(R5))delete R5[$]}function h0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function d1($){let Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=Z.exec($))!==null){let X=Y[1];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(X))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function N9($,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 U=0;U<X.length;U++){let W=X[U];if(!J&&W==="`"){J=!0,G=0;continue}if(J){if(W==="`"&&G===0){J=!1;continue}if(W==="$"&&X[U+1]==="{"){G++,U++,Q+=" ";continue}if(W==="}"&&G>0){G--;continue}if(G>0){Q+=W;continue}continue}Q+=W}X=Q;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,q;while((q=K.exec(X))!==null){let U=q[1];if(!X.substring(0,q.index).trimEnd().endsWith(".")){if(!Y.includes(U)&&!(U in Z))return!1}}return!0}function T9($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=x0(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=x0(Q,Z);if(G===void 0)return X;return JSON.stringify(G)}catch{return X}}),Y}function gQ($,Z,Y={}){return $.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(X,Q,J)=>{if(/\bsrc\s*=/.test(Q))return X;if(/\bdata-raw\b/.test(Q))return X;if(/\btype\s*=\s*["']application\/json["']/.test(Q))return X;if(Y.skipServer&&/\bserver\b/.test(Q))return X;let G=T9(J,Z);return`<script${Q}>${G}</script>`})}function p0($,Z,Y,X){let Q=$,J=(W,z)=>{let B=F9(W,z);if(B===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(W.slice(z,B))?-1:B},G=(W,z,B,_)=>{let j=B.length,{output:H,tokens:L}=V5(W,z,(F,O)=>_(j+O));return B.push(...L),H},K=[];Q=G(Q,J,K,(W)=>`<!--__STX_STYLE_${W}__-->`);let q=[];Q=G(Q,G4,q,(W)=>`<!--__STX_SCRIPT_EXPR_${W}__-->`);let U=X?.forceSignals===!0||Z?.__stx_force_signals===!0||d1($);Q=Q.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(W,z,B)=>{try{let _=x0(z,Z);return _!==void 0&&_!==null?String(_):""}catch(_){let j=_ instanceof Error?_.message:String(_);return G0("Expression",`Error evaluating: {{{ ${z.trim()}}}}: ${j}`,Y,$,B,W)}}),Q=Q.replace(/\{!!([\s\S]*?)!!\}/g,(W,z,B)=>{try{let _=x0(z,Z);if(_===void 0&&Z.__stx_buildMode==="compile")return Q4("raw",z.trim());return _!==void 0&&_!==null?String(_):""}catch(_){if(Z.__stx_buildMode==="compile")return Q4("raw",z.trim());let j=_ instanceof Error?_.message:String(_);return G0("Expression",`Error evaluating: {!! ${z.trim()} !!}: ${j}`,Y,$,B,W)}}),Q=G(Q,G4,q,(W)=>`<!--__STX_SCRIPT_EXPR_${W}__-->`),Q=G(Q,J,K,(W)=>`<!--__STX_STYLE_${W}__-->`),Q=Q.replace(/\{\{([\s\S]*?)\}\}/g,(W,z,B)=>{let _=z.trim(),j=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],H=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,F=_.match(H)?.[1],O=F&&((F in Z)||j.includes(F)),V=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=_.match(V),N=R&&!j.includes(R[1])&&!(R[1]in Z);if(/^__[A-Z_]+__$/.test(_))return"";try{let A=x0(z,Z);if(U&&!N9(_,Z))return W;if(A===void 0&&Z.__stx_buildMode==="compile"&&!U)return Q4("expr",_);return A!==void 0&&A!==null?h0(String(A)):""}catch(A){if(U&&!N9(_,Z))return W;if(N)return W;let w=A instanceof Error?A.message:String(A);return G0("Expression",`Error evaluating: {{ ${_} }}: ${w}`,Y,$,B,W)}});for(let W=0;W<q.length;W++)Q=Q.replace(`<!--__STX_SCRIPT_EXPR_${W}__-->`,()=>q[W]);for(let W=0;W<K.length;W++)Q=Q.replace(`<!--__STX_STYLE_${W}__-->`,()=>K[W]);return Q}function M9($,Z,Y){if(!Z.trim())return $;let X=$,Q=Z.trim();while(Q.length>0){let J=Q.match(/^(\w+)/);if(!J)break;let G=J[1];Q=Q.substring(G.length).trim();let K=R5[G]||N5[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(w9()).join(", ")}`);let q=[];if(Q.startsWith(":")){let U=Q.match(/^:([^|\s]+)/);if(U){let W=U[1].trim();try{let z=Number(W);q=[Number.isNaN(z)?W:z]}catch{q=[W]}Q=Q.substring(U[0].length).trim()}}else if(Q.startsWith("(")){let U=1,W=1;while(U>0&&W<Q.length){if(Q[W]==="(")U++;if(Q[W]===")")U--;W++}if(U===0){let z=Q.substring(1,W-1).trim();if(z)try{if(z.startsWith("{")&&z.endsWith("}"))q=[x0(`(${z})`,Y,!0)];else{let B=[],_="",j=null,H=0,L=0,F=0,O=!1;for(let V=0;V<z.length;V++){let R=z[V];if(O){_+=R,O=!1;continue}if(R==="\\"){_+=R,O=!0;continue}if(j){if(_+=R,R===j)j=null;continue}if(R==='"'||R==="'"||R==="`"){j=R,_+=R;continue}if(R==="(")H++;else if(R===")")H--;else if(R==="[")L++;else if(R==="]")L--;else if(R==="{")F++;else if(R==="}")F--;if(R===","&&H===0&&L===0&&F===0){B.push(_),_="";continue}_+=R}if(_)B.push(_);q=B.map((V)=>{let R=V.trim();return x0(R,Y,!0)})}}catch{q=[z]}Q=Q.substring(W).trim()}}try{X=K(X,Y,...q)}catch(U){let W=U instanceof Error?U.message:String(U);throw Error(`Error applying filter '${G}': ${W}`)}if(Q.startsWith("|"))Q=Q.substring(1).trim();else break}return X}function hQ($){let Z=!1,Y="",X=0,Q=0,J=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],U=$[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==="$"&&U==="{"){let W=1;K+=2;while(K<$.length&&W>0){if($[K]==="{")W++;else if($[K]==="}")W--;if(W>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(U==="|"){K++;continue}if(U==="="){K++;continue}return K}}return-1}function x0($,Z,Y=!1){try{let X=$.trim(),Q=hQ(X);if(Q>0){let J=X.substring(0,Q).trim(),G=X.substring(Q+1).trim(),K=x0(J,Z,!0);return M9(K,G,Z)}if(!X0(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 J0(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=dQ(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 dQ($,Z){let Y=null;for(let Q of Z){if(Q===$)continue;let J=mQ($,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 mQ($,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 n$($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var R5,R9,N5;var c0=b(()=>{L0();H0();O9();K4();R5={},R9=new Map;N5={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 h0(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,U])=>{K=K.replace(vQ(q),String(U))}),K},t:($,Z,Y={})=>{return N5.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}}});class A5{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 u1($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!m1.has(Y)){if(m1.size>=uQ){let X=m1.keys().next().value;if(X)m1.delete(X)}m1.set(Y,new RegExp($,Z))}return m1.get(Y)}class D9{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 U=`${Y}:${q}`,W=Q.get(U);if(!W){if(Q.size>=J){let z=Q.keys().next().value;if(z)Q.delete(z)}W=Function(...Z,`
1924
1924
  'use strict';
1925
1925
  try {
1926
1926
  return ${q};
@@ -1931,38 +1931,38 @@ catch (e) {
1931
1931
  }
1932
1932
  throw e;
1933
1933
  }
1934
- `),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 D9{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 mQ(){if(!o$)o$=new D9;return o$}var m1,dQ=500,r_,o$=null,E9;var l1=b(()=>{m1=new Map;r_=new I9;E9=new Proxy({},{get($,Z){return mQ()[Z]}})});function k9($,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 b9($,Z,Y={}){let{prefix:X="",preserveHost:Q=!0,scopeKeyframes:J=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=s$($),q=[],W=new Map;if(J)for(let U of K){let z=U.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(z){let B=z[1],_=`${Z}_${B}`;W.set(B,_)}}for(let U of K){let z=S9(U,Z,X,Q,W,G);q.push(z)}return q.join(`
1934
+ `),Q.set(U,W)}return W(...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 E9{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 lQ(){if(!o$)o$=new E9;return o$}var m1,uQ=500,$j,o$=null,k9;var l1=b(()=>{m1=new Map;$j=new D9;k9=new Proxy({},{get($,Z){return lQ()[Z]}})});function b9($,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 S9($,Z,Y={}){let{prefix:X="",preserveHost:Q=!0,scopeKeyframes:J=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=s$($),q=[],U=new Map;if(J)for(let W of K){let z=W.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(z){let B=z[1],_=`${Z}_${B}`;U.set(B,_)}}for(let W of K){let z=y9(W,Z,X,Q,U,G);q.push(z)}return q.join(`
1935
1935
 
1936
- `)}function s$($){let Z=[],Y=$.replace(/\/\*[\s\S]*?\*\//g,""),X=0,Q="",J=!1,G="";for(let K=0;K<Y.length;K++){let q=Y[K];if(q==="@"&&X===0)J=!0;if(q==="{")X++;else if(q==="}"){if(X--,X===0){if(J){G+=q;let W=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(W){let[,U,z,B]=W;if(U==="keyframes")Z.push({selector:`@keyframes ${z.trim()}`,declarations:B.trim()});else if(U==="media"||U==="supports"||U==="container"){let _=s$(B);Z.push({selector:`@${U} ${z.trim()}`,declarations:_.map((j)=>`${j.selector} { ${j.declarations} }`).join(`
1937
- `)})}else Z.push({selector:`@${U} ${z.trim()}`,declarations:B.trim()})}G="",J=!1}else if(Q.trim()){Q+=q;let W=Q.match(/([^{]+)\{([^}]*)\}/);if(W)Z.push({selector:W[1].trim(),declarations:W[2].trim()});Q=""}continue}}if(J)G+=q;else Q+=q}return Z}function S9($,Z,Y,X,Q,J){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let U=G.replace("@keyframes ","").trim();return`@keyframes ${Q.get(U)||U} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let z=s$(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((B)=>S9(B,Z,Y,X,Q,J)).join(`
1936
+ `)}function s$($){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 U=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(U){let[,W,z,B]=U;if(W==="keyframes")Z.push({selector:`@keyframes ${z.trim()}`,declarations:B.trim()});else if(W==="media"||W==="supports"||W==="container"){let _=s$(B);Z.push({selector:`@${W} ${z.trim()}`,declarations:_.map((j)=>`${j.selector} { ${j.declarations} }`).join(`
1937
+ `)})}else Z.push({selector:`@${W} ${z.trim()}`,declarations:B.trim()})}G="",J=!1}else if(Q.trim()){Q+=q;let U=Q.match(/([^{]+)\{([^}]*)\}/);if(U)Z.push({selector:U[1].trim(),declarations:U[2].trim()});Q=""}continue}}if(J)G+=q;else Q+=q}return Z}function y9($,Z,Y,X,Q,J){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let W=G.replace("@keyframes ","").trim();return`@keyframes ${Q.get(W)||W} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let z=s$(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((B)=>y9(B,Z,Y,X,Q,J)).join(`
1938
1938
  `);return`${G} {
1939
1939
  ${z}
1940
- }`}return`${G} { ${K} }`}let q=uQ(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 uQ($,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 q=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);J.push(q)}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}`)}return J.join(", ")}function q4($,Z){if(!/<style\s+[^>]*\bscoped\b/i.test($))return{html:$,hasScoped:!1};let Y=k9(Z),X=`data-v-${Y}`,Q=$,J=/<style\s+([^>]*\bscoped\b[^>]*)>([\s\S]*?)<\/style>/gi,G=!1;if(Q=Q.replace(J,(K,q,W)=>{G=!0;let U=lQ(W,X),z=q.replace(/\bscoped\b/gi,"").trim(),B=z?` ${z}`:"";return`<style data-stx-scoped="${Y}"${B}>${U}</style>`}),!G)return{html:$,hasScoped:!1};return Q=pQ(Q,X),{html:Q,hasScoped:!0}}function lQ($,Z){return b9($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function pQ($,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 r$=()=>{};var y9=()=>{};function D0($,Z,Y,X=0){let Q=0,J=X,G=null,K=0,q=!1;while(J<$.length){let W=$[J];if(G&&q){q=!1,J++;continue}if(G&&W==="\\"){q=!0,J++;continue}if(q=!1,(W==='"'||W==="'"||W==="`")&&!G){G=W,J++;continue}if(W===G&&G!=="`"){G=null,J++;continue}if(G==="`"&&W==="$"&&$[J+1]==="{"){K++,J+=2;continue}if(K>0&&W==="}"){K--,J++;continue}if(W==="`"&&G==="`"&&K===0){G=null,J++;continue}if(G){J++;continue}if(W===Z)Q++;else if(W===Y){if(Q--,Q===0)return J}J++}return-1}var a$={};o(a$,{useTitle:()=>rQ,useSeoMeta:()=>W4,usePageTitle:()=>rQ,useHead:()=>R1,resetHead:()=>nQ,renderHtmlAttrs:()=>tQ,renderHead:()=>aQ,renderBodyAttrs:()=>eQ,processTitleDirective:()=>YG,processMetaDirective:()=>XG,processHeadDirective:()=>ZG,getPageMeta:()=>iQ,getHead:()=>A5,definePageMeta:()=>sQ,applyHead:()=>$G});function A5(){return Y1}function iQ(){return U4}function nQ(){Y1={},cQ.length=0,U4={}}function R1($){Y1=oQ(Y1,$)}function oQ($,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 W4($){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});R1({title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K})}function sQ($){if(U4={...U4,...$},$.title||$.description)W4({title:$.title,description:$.description})}function rQ($){let Z=typeof $==="function"?$():$;R1({title:Z})}function aQ($=Y1){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${V1(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([X,Q])=>`${X}="${V1(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}="${V1(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}="${V1(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}="${V1(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(`
1941
- `)}function tQ($=Y1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${V1(Y)}"`).join(" ")}function eQ($=Y1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${V1(Y)}"`).join(" ")}function V1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function $G($=Y1){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 ZG($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(X,Q)=>{return Z+=Q.trim()+`
1942
- `,""}),headContent:Z.trim()}}function YG($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,X,Q,J)=>{let G=X?Q:Z[(J||"").trim()]??J;return R1({title:G}),""})}function XG($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Y,X,Q,J,G,K)=>{let q=J?G:K,W=J?q:Z[(q||"").trim()]??q,z=Q.includes(":")?{property:Q,content:W}:{name:Q,content:W};return R1({meta:[z]}),""})}var Y1,cQ,U4;var N5=b(()=>{Y1={},cQ=[],U4={}});var z4={};o(z4,{stripTypeScript:()=>f9,hasVariables:()=>u9,extractVariables:()=>A1,extractScriptFromTemplate:()=>m9,convertToCommonJS:()=>e$});import p1 from"path";import w5 from"process";function JG($){let Z=[],Y=0,X=$.split(`
1943
- `);for(let Q of X){let J=Y,G=null,K=!1;for(let q=0;q<Q.length;q++){let W=Q[q];if(K){K=!1;continue}if(W==="\\"){K=!0;continue}if(G){if(W===G)G=null;continue}if(W==="'"||W==='"'||W==="`"){G=W;continue}if(W==="/"&&q+1<Q.length&&Q[q+1]==="/")break;if(W==="{")Y++;else if(W==="}")Y--}if(J===0){let q=Q.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)Z.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Q)){let W=Q.match(/(?:const|let|var)\s+(\w+)/);if(W)Z.push(W[1])}else{let W=Q.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let z=W[1].slice(1,-1).split(",").map((B)=>{let _=B.split(":");return(_.length>1?_[1]:_[0]).trim()}).filter((B)=>/^\w+$/.test(B));Z.push(...z)}}}}return[...new Set(Z)]}function f9($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Y(X){if(!X.includes(":"))return X;let Q=[],J="",G=0,K=0,q=null;for(let W=0;W<X.length;W++){let U=X[W];if(q){if(J+=U,U===q)q=null;continue}if(U==='"'||U==="'"||U==="`"){q=U,J+=U;continue}if(U==="<")G++;else if(U===">"&&G>0)G--;else if(U==="(")K++;else if(U===")")K--;if(U===","&&G===0&&K===0){Q.push(J),J="";continue}J+=U}if(J)Q.push(J);return Q.map((W)=>{let U=W.trim(),z=U.startsWith("..."),B=z?U.slice(3):U,_=-1,j=0;for(let A=0;A<B.length;A++)if(B[A]==="<")j++;else if(B[A]===">")j--;else if(B[A]===":"&&j===0){_=A;break}if(_===-1)return W;let L=B.substring(0,_).trim().replace(/\?$/,""),F=B.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 R=z?"...":"";if(O!==-1)return`${R}${L} = ${F.substring(O+1).trim()}`;return`${R}${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 B=Y(z);J.push({start:G+1,end:q,replacement:B})}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];Z=Z.substring(0,K)+W+Z.substring(q)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(X,Q)=>{if(!Q.includes(":"))return X;if(Q.includes("{")||Q.includes("}"))return X;return`(${Q.split(",").map((G)=>{let[K,...q]=G.split("="),W=K.split(":")[0].trim();if(q.length>0)return`${W} = ${q.join("=").trim()}`;return W}).join(", ")}) =>`}),Z=Z.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
1940
+ }`}return`${G} { ${K} }`}let q=pQ(G,Z,Y,X),U=K;for(let[W,z]of Q)U=U.replace(new RegExp(`\\b${W}\\b`,"g"),z);if(J)U=U.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${q} { ${U} }`}function pQ($,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 U=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);J.push(U)}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=cQ(G,Z);if(q)J.push(Y?`${Y} ${q}`:q)}return J.join(", ")}function cQ($,Z){let Y=0,X=$.length;for(let q=0;q<$.length;q++){let U=$[q];if(U==="["||U==="(")Y++;else if(U==="]"||U===")")Y--;else if(Y===0&&(U===" "||U===">"||U==="+"||U==="~")){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 U=Q[q];if(U==="["||U==="(")K++;else if(U==="]"||U===")")K--;else if(Y===0&&K===0&&U===":"){G=q;break}}return`${Q.slice(0,G)}.${Z}${Q.slice(G)}${J}`}function q4($,Z){if(!iQ.test($))return{html:$,hasScoped:!1};let Y=b9(Z),X=`data-v-${Y}`,Q=$,J=new RegExp(`<style\\s+([^>]*${r$}[^>]*)>([\\s\\S]*?)</style>`,"gi"),G=!1;if(Q=Q.replace(J,(K,q,U)=>{G=!0;let W=nQ(U,X),z=q.replace(new RegExp(r$,"gi"),"").trim(),B=z?` ${z}`:"";return`<style data-stx-scoped="${Y}"${B}>${W}</style>`}),!G)return{html:$,hasScoped:!1};return Q=oQ(Q,X),{html:Q,hasScoped:!0}}function nQ($,Z){return S9($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function oQ($,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 r$,iQ;var a$=b(()=>{r$=String.raw`(?<![\w-])scoped(?![\w-])`,iQ=new RegExp(`<style\\s+[^>]*${r$}`,"i")});var P9=()=>{};function I0($,Z,Y,X=0){let Q=0,J=X,G=null,K=0,q=!1;while(J<$.length){let U=$[J];if(G&&q){q=!1,J++;continue}if(G&&U==="\\"){q=!0,J++;continue}if(q=!1,(U==='"'||U==="'"||U==="`")&&!G){G=U,J++;continue}if(U===G&&G!=="`"){G=null,J++;continue}if(G==="`"&&U==="$"&&$[J+1]==="{"){K++,J+=2;continue}if(K>0&&U==="}"){K--,J++;continue}if(U==="`"&&G==="`"&&K===0){G=null,J++;continue}if(G){J++;continue}if(U===Z)Q++;else if(U===Y){if(Q--,Q===0)return J}J++}return-1}var t$={};o(t$,{useTitle:()=>$G,useSeoMeta:()=>W4,usePageTitle:()=>$G,useHead:()=>R1,resetHead:()=>aQ,renderHtmlAttrs:()=>YG,renderHead:()=>ZG,renderBodyAttrs:()=>XG,processTitleDirective:()=>GG,processMetaDirective:()=>KG,processHeadDirective:()=>QG,getPageMeta:()=>rQ,getHead:()=>w5,definePageMeta:()=>eQ,applyHead:()=>JG});function w5(){return X1}function rQ(){return U4}function aQ(){X1={},sQ.length=0,U4={}}function R1($){X1=tQ(X1,$)}function tQ($,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 W4($){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});R1({title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K})}function eQ($){if(U4={...U4,...$},$.title||$.description)W4({title:$.title,description:$.description})}function $G($){let Z=typeof $==="function"?$():$;R1({title:Z})}function ZG($=X1){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${V1(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([X,Q])=>`${X}="${V1(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}="${V1(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}="${V1(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}="${V1(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(`
1941
+ `)}function YG($=X1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${V1(Y)}"`).join(" ")}function XG($=X1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${V1(Y)}"`).join(" ")}function V1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function JG($=X1){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 QG($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(X,Q)=>{return Z+=Q.trim()+`
1942
+ `,""}),headContent:Z.trim()}}function GG($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,X,Q,J)=>{let G=X?Q:Z[(J||"").trim()]??J;return R1({title:G}),""})}function KG($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Y,X,Q,J,G,K)=>{let q=J?G:K,U=J?q:Z[(q||"").trim()]??q,z=Q.includes(":")?{property:Q,content:U}:{name:Q,content:U};return R1({meta:[z]}),""})}var X1,sQ,U4;var T5=b(()=>{X1={},sQ=[],U4={}});var z4={};o(z4,{stripTypeScript:()=>g9,hasVariables:()=>l9,extractVariables:()=>N1,extractScriptFromTemplate:()=>u9,convertToCommonJS:()=>$7});import p1 from"path";import M5 from"process";function qG($){let Z=[],Y=0,X=$.split(`
1943
+ `);for(let Q of X){let J=Y,G=null,K=!1;for(let q=0;q<Q.length;q++){let U=Q[q];if(K){K=!1;continue}if(U==="\\"){K=!0;continue}if(G){if(U===G)G=null;continue}if(U==="'"||U==='"'||U==="`"){G=U;continue}if(U==="/"&&q+1<Q.length&&Q[q+1]==="/")break;if(U==="{")Y++;else if(U==="}")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 U=Q.match(/(?:const|let|var)\s+(\w+)/);if(U)Z.push(U[1])}else{let U=Q.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(U){let z=U[1].slice(1,-1).split(",").map((B)=>{let _=B.split(":");return(_.length>1?_[1]:_[0]).trim()}).filter((B)=>/^\w+$/.test(B));Z.push(...z)}}}}return[...new Set(Z)]}function g9($){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 U=0;U<X.length;U++){let W=X[U];if(q){if(J+=W,W===q)q=null;continue}if(W==='"'||W==="'"||W==="`"){q=W,J+=W;continue}if(W==="<")G++;else if(W===">"&&G>0)G--;else if(W==="(")K++;else if(W===")")K--;if(W===","&&G===0&&K===0){Q.push(J),J="";continue}J+=W}if(J)Q.push(J);return Q.map((U)=>{let W=U.trim(),z=W.startsWith("..."),B=z?W.slice(3):W,_=-1,j=0;for(let N=0;N<B.length;N++)if(B[N]==="<")j++;else if(B[N]===">")j--;else if(B[N]===":"&&j===0){_=N;break}if(_===-1)return U;let L=B.substring(0,_).trim().replace(/\?$/,""),F=B.substring(_+1),O=-1,V=0;for(let N=0;N<F.length;N++)if(F[N]==="<")V++;else if(F[N]===">")V--;else if(F[N]==="="&&V===0){O=N;break}let R=z?"...":"";if(O!==-1)return`${R}${L} = ${F.substring(O+1).trim()}`;return`${R}${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,U=0,W=null;while(q<Z.length&&K>0){let _=Z[q];if(W){if(_===W)W=null;q++;continue}if(_==='"'||_==="'"||_==="`"){W=_,q++;continue}if(_==="<")U++;else if(_===">"&&U>0)U--;else if(U===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 B=Y(z);J.push({start:G+1,end:q,replacement:B})}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:U}=J[G];Z=Z.substring(0,K)+U+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("="),U=K.split(":")[0].trim();if(q.length>0)return`${U} = ${q.join("=").trim()}`;return U}).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,`
1944
1944
 
1945
- `),Z}async function A1($,Z,Y,X={}){if(!$.trim())return;let Q;try{let v=new Bun.Transpiler({loader:"ts",target:"browser",define:l0()}),f=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");f=f.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),Q=v.transformSync(f)}catch{Q=f9($)}let J={exports:{}},G=J.exports,K=w5.cwd(),q={},W=[...Q.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((v)=>v[1]).filter((v)=>!v.startsWith("node:")&&!v.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(v));for(let v of W)try{let f=p1.resolve(K,"node_modules",v),y=p1.join(f,"package.json"),x=JSON.parse(Q0("fs").readFileSync(y,"utf8")),u=x.main||"index.js";if(x.exports){let l=typeof x.exports==="string"?x.exports:x.exports["."];if(typeof l==="string")u=l;else if(l?.bun)u=l.bun;else if(l?.import)u=l.import;else if(l?.default)u=l.default}q[v]=await import(p1.resolve(f,u))}catch{}let U=(v)=>{if(q[v])return q[v];return Q0(v)},z=Z.props||{},B=(v)=>{if(!v)return z;let f={};for(let[y,x]of Object.entries(v)){let u=z[y];if(u!==void 0)f[y]=u;else if(typeof x==="function")f[y]=x();else f[y]=x}return f};for(let[v,f]of Object.entries(z))Object.defineProperty(B,v,{value:f,enumerable:!0,configurable:!0,writable:!0});let _=(v)=>{if(!v)return z;let f={...z};for(let[y,x]of Object.entries(v)){let u=x&&typeof x==="object"&&!Array.isArray(x)?x:{type:x};if(f[y]===void 0&&u.default!==void 0)f[y]=typeof u.default==="function"?u.default():u.default}return f},j=()=>Z.slots||{},H=(v,f)=>{let y={...v};for(let[x,u]of Object.entries(f))if(y[x]===void 0)if(typeof u==="function")y[x]=u();else y[x]=u;return y},L=(v)=>{let f=()=>v;return f.set=(y)=>{},f.update=(y)=>{},f},F=(v)=>{let f,y=!1;return()=>{if(!y)try{f=v(),y=!0}catch{f=void 0}return f}},O=(v)=>{},V=(v)=>v(),R=(v)=>{},A=(v)=>{},N=(v)=>{},w=()=>{let v=Z.__stxServeContext,f=Z.__stxServeSearch??v?.search??"",y=v?.path??"";return{params:Z.params??{},query:Object.fromEntries(new URLSearchParams(f)),path:y,name:"",fullPath:y+f,hash:"",matched:[]}},T=()=>({push:(v)=>{},replace:(v)=>{},back:()=>{},forward:()=>{},go:(v)=>{}}),M=(v)=>{R1(v);let f=Z.__stx_runtime_head||{},y=v||{};Z.__stx_runtime_head={...f,...y.title&&{title:y.title},meta:[...f.meta||[],...y.meta||[]],link:[...f.link||[],...y.link||[]],script:[...f.script||[],...y.script||[]],htmlAttrs:{...f.htmlAttrs||{},...y.htmlAttrs||{}},bodyAttrs:{...f.bodyAttrs||{},...y.bodyAttrs||{}}}},I=(v)=>{W4(v);let f=A5();Z.__stx_runtime_head={...Z.__stx_runtime_head||{},...f.title&&{title:f.title},meta:f.meta?[...f.meta]:[]}},D=(v)=>({value:v}),E=(v)=>v,C=(v)=>({value:typeof v==="function"?v():v}),S=(v,f)=>{},k=(v)=>{},P=(v)=>{},d=(v)=>v?v():Promise.resolve(),g=(v)=>(f,...y)=>{},m=(v)=>{},s=(v,f)=>{},Z0=(v,f)=>f,o0=()=>({value:"light"}),P0=()=>({value:!1}),T0={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:{}},e=new Proxy(T0,{get(v,f){if(f in v)return v[f];return},set(v,f,y){return v[f]=y,!0}}),M0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},C0=console;try{let v=e$(Q,Y),f=new Set(Object.keys(z)),y=Object.keys(Z).filter((r)=>!f.has(r)&&r!=="props"),x=y.map((r)=>Z[r]),u=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"]),l=[],Y0=[];for(let[r,j1]of Object.entries(z)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(r))continue;if(u.has(r))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${r}\\b`).test(v))continue;l.push(r),Y0.push(j1)}let I0=JG(v).map((r)=>`module.exports.${r} = typeof ${r} !== 'undefined' ? ${r} : module.exports.${r};`).join(`
1946
- `),x1=Z.params??{},v0=[],$1=[];for(let r=0;r<y.length;r++){if(y[r]==="params")continue;v0.push(y[r]),$1.push(x[r])}let _1=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","window","document","console","confirm","alert","fetch","params",...l,...v0,`return (async () => {
1945
+ `),Z}async function N1($,Z,Y,X={}){if(!$.trim())return;let Q;try{let v=new Bun.Transpiler({loader:"ts",target:"browser",define:l0()}),f=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");f=f.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),Q=v.transformSync(f)}catch{Q=g9($)}let J={exports:{}},G=J.exports,K=M5.cwd(),q={},U=[...Q.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((v)=>v[1]).filter((v)=>!v.startsWith("node:")&&!v.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(v));for(let v of U)try{let f=p1.resolve(K,"node_modules",v),P=p1.join(f,"package.json"),x=JSON.parse(Q0("fs").readFileSync(P,"utf8")),u=x.main||"index.js";if(x.exports){let l=typeof x.exports==="string"?x.exports:x.exports["."];if(typeof l==="string")u=l;else if(l?.bun)u=l.bun;else if(l?.import)u=l.import;else if(l?.default)u=l.default}q[v]=await import(p1.resolve(f,u))}catch{}let W=(v)=>{if(q[v])return q[v];return Q0(v)},z=Z.props||{},B=(v)=>{if(!v)return z;let f={};for(let[P,x]of Object.entries(v)){let u=z[P];if(u!==void 0)f[P]=u;else if(typeof x==="function")f[P]=x();else f[P]=x}return f};for(let[v,f]of Object.entries(z))Object.defineProperty(B,v,{value:f,enumerable:!0,configurable:!0,writable:!0});let _=(v)=>{if(!v)return z;let f={...z};for(let[P,x]of Object.entries(v)){let u=x&&typeof x==="object"&&!Array.isArray(x)?x:{type:x};if(f[P]===void 0&&u.default!==void 0)f[P]=typeof u.default==="function"?u.default():u.default}return f},j=()=>Z.slots||{},H=(v,f)=>{let P={...v};for(let[x,u]of Object.entries(f))if(P[x]===void 0)if(typeof u==="function")P[x]=u();else P[x]=u;return P},L=(v)=>{let f=()=>v;return f.set=(P)=>{},f.update=(P)=>{},f},F=(v)=>{let f,P=!1;return()=>{if(!P)try{f=v(),P=!0}catch{f=void 0}return f}},O=(v)=>{},V=(v)=>v(),R=(v)=>{},N=(v)=>{},A=(v)=>{},w=()=>{let v=Z.__stxServeContext,f=Z.__stxServeSearch??v?.search??"",P=v?.path??"";return{params:Z.params??{},query:Object.fromEntries(new URLSearchParams(f)),path:P,name:"",fullPath:P+f,hash:"",matched:[]}},T=()=>({push:(v)=>{},replace:(v)=>{},back:()=>{},forward:()=>{},go:(v)=>{}}),M=(v)=>{R1(v);let f=Z.__stx_runtime_head||{},P=v||{};Z.__stx_runtime_head={...f,...P.title&&{title:P.title},meta:[...f.meta||[],...P.meta||[]],link:[...f.link||[],...P.link||[]],script:[...f.script||[],...P.script||[]],htmlAttrs:{...f.htmlAttrs||{},...P.htmlAttrs||{}},bodyAttrs:{...f.bodyAttrs||{},...P.bodyAttrs||{}}}},I=(v)=>{W4(v);let f=w5();Z.__stx_runtime_head={...Z.__stx_runtime_head||{},...f.title&&{title:f.title},meta:f.meta?[...f.meta]:[]}},D=(v)=>({value:v}),E=(v)=>v,C=(v)=>({value:typeof v==="function"?v():v}),S=(v,f)=>{},k=(v)=>{},y=(v)=>{},d=(v)=>v?v():Promise.resolve(),g=(v)=>(f,...P)=>{},m=(v)=>{},s=(v,f)=>{},Z0=(v,f)=>f,o0=()=>({value:"light"}),P0=()=>({value:!1}),M0={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:{}},e=new Proxy(M0,{get(v,f){if(f in v)return v[f];return},set(v,f,P){return v[f]=P,!0}}),N0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},C0=console;try{let v=$7(Q,Y),f=new Set(Object.keys(z)),P=(r)=>/^[a-z_$][\w$]*$/i.test(r),x=Object.keys(Z).filter((r)=>!f.has(r)&&r!=="props"&&P(r)),u=x.map((r)=>Z[r]),l=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"]),Y0=[],q0=[];for(let[r,s0]of Object.entries(z)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(r))continue;if(l.has(r))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${r}\\b`).test(v))continue;Y0.push(r),q0.push(s0)}let x1=qG(v).map((r)=>`module.exports.${r} = typeof ${r} !== 'undefined' ? ${r} : module.exports.${r};`).join(`
1946
+ `),g0=Z.params??{},Z1=[],W0=[];for(let r=0;r<x.length;r++){if(x[r]==="params")continue;Z1.push(x[r]),W0.push(u[r])}let j1=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","window","document","console","confirm","alert","fetch","params",...Y0,...Z1,`return (async () => {
1947
1947
  ${v}
1948
- ${I0}
1948
+ ${x1}
1949
1949
  return module.exports
1950
- })()`)(J,G,U,z,B,_,H,L,F,O,V,R,A,N,w,T,M,I,D,E,C,S,k,P,d,g,m,j,s,Z0,o0,P0,e,M0,C0,T0.confirm,T0.alert,T0.fetch,x1,...Y0,...$1);if(X.preserveExisting){for(let[r,j1]of Object.entries(_1))if(!(r in Z)||Z[r]===void 0)Z[r]=j1}else Object.assign(Z,_1);for(let[r,j1]of Object.entries(z))if(!(r in Z))Z[r]=j1}catch(v){if(w5.env.STX_DEBUG){let f=v instanceof Error?v.message:String(v);console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${f}`)}try{await UG(Q,Z,Y)}catch(f){if(w5.env.STX_DEBUG){let y=f instanceof Error?f.message:String(f);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${y}`)}}}}function e$($,Z){let Y=Z?p1.dirname(Z):w5.cwd(),X=$.split(`
1951
- `),Q=[],J=0;while(J<X.length){let G=X[J].trim();if(G.startsWith("interface ")||G.startsWith("export interface ")||G.startsWith("type ")||G.startsWith("export type ")){if(G.includes("{")&&!G.includes("}")){let K=0;for(;J<X.length;J++){for(let q of X[J])if(q==="{")K++;else if(q==="}")K--;if(K<=0)break}}J++;continue}if(G.startsWith("definePageMeta(")){let K=0,q=!1;for(let W=J;W<X.length&&!q;W++){let U=null,z=!1,B=X[W];for(let _=0;_<B.length;_++){let j=B[_];if(z){z=!1;continue}if(j==="\\"){z=!0;continue}if(U){if(j===U)U=null;continue}if(j==='"'||j==="'"||j==="`"){U=j;continue}if(j==="(")K++;else if(j===")"){if(K--,K===0){J=W+1,q=!0;break}}}}if(!q)J=X.length;continue}if(G.startsWith("import ")){let K=G.match(/^import\s+(\w+)\s+from\s+['"](.+)['"]/),q=G.match(/^import\s+\{([^}]+)\}\s+from\s+['"](.+)['"]/),W=G.match(/^import\s+['"](.+)['"]/),U=(z)=>{if(z.startsWith("."))return p1.resolve(Y,z);return z};if(K){let[,z,B]=K,_=U(B);Q.push(`const ${z} = await import('${_}')`),Q.push(`module.exports.${z} = ${z};`)}else if(q){let[,z,B]=q,_=z.trim(),j=U(B);Q.push(`const { ${_} } = await import('${j}')`);for(let H of _.split(",")){let L=H.trim().split(/\s+as\s+/).pop()?.trim();if(L)Q.push(`module.exports.${L} = ${L};`)}}else if(W){let z=U(W[1]);Q.push(`await import('${z}')`)}else Q.push(G);J++;continue}if((G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")||G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var "))&&!G.includes("="))Q.push(X[J]),J++;else if(G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var ")){let K=P9(X,J),{type:q,name:W,value:U}=K;Q.push(`${q} ${W} = ${U};`),Q.push(`module.exports.${W} = ${W};`),J=K.nextIndex}else if(G.startsWith("export function ")||G.startsWith("export async function ")){let K=t$(X,J);Q.push(K.functionCode),Q.push(`module.exports.${K.name} = ${K.name};`),J=K.nextIndex}else if(G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")){let K=P9(X,J),{type:q,name:W,value:U}=K;Q.push(`${q} ${W} = ${U};`),Q.push(`module.exports.${W} = ${W};`),J=K.nextIndex}else if(G.startsWith("function ")||G.startsWith("async function ")){let K=t$(X,J);Q.push(K.functionCode),Q.push(`module.exports.${K.name} = ${K.name};`),J=K.nextIndex}else if(G.startsWith("export default function ")||G.startsWith("export default async function ")){let K=X[J].replace(/^(\s*)export\s+default\s+/,"$1"),q=[...X];q[J]=K;let W=t$(q,J);if(Q.push(W.functionCode),W.name)Q.push(`module.exports.default = ${W.name};`);J=W.nextIndex}else if(G.startsWith("export default ")){let K=G.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${K};`),J++}else if(G.startsWith("class ")||G.startsWith("export class ")){let K=G.match(/(?:export\s+)?class\s+(\w+)/);if(K){let q=K[1],W=X[J].replace(/^export\s+/,""),U=0,z=J;for(;z<X.length;z++){let B=X[z];for(let _ of B)if(_==="{")U++;else if(_==="}")U--;if(z>J)W+=`
1952
- `+B;if(U<=0&&z>=J)break}Q.push(W),Q.push(`module.exports.${q} = ${q};`),J=z+1}else Q.push(G),J++}else if(G.includes("module.exports"))Q.push(G),J++;else if(G.trim()&&!G.startsWith("//"))Q.push(G),J++;else J++}return QG(Q.join(`
1953
- `),Y)}function QG($,Z){let Y=$.length,X="",Q=0,J=null,G=!1,K=!1,q=0;while(Q<Y){let W=$[Q],U=$[Q+1];if(G){if(X+=W,W===`
1954
- `)G=!1;Q++;continue}if(K){if(X+=W,W==="*"&&U==="/"){X+=U,Q+=2,K=!1;continue}Q++;continue}if(!J&&W==="/"&&U==="/"){G=!0,X+=W,Q++;continue}if(!J&&W==="/"&&U==="*"){K=!0,X+=W,Q++;continue}if(J){if(X+=W,W==="\\"){X+=U,Q+=2;continue}if(W===J&&J!=="`"){J=null,Q++;continue}if(J==="`"){if(W==="$"&&U==="{"){q++,X+=U,Q+=2;continue}if(W==="`"){J=null,Q++;continue}}Q++;continue}if(q>0){if(W==="{")q++;else if(W==="}")q--}if(W==='"'||W==="'"||W==="`"){J=W,X+=W,Q++;continue}if(W==="a"&&$.startsWith("await",Q)){let z=GG($,Q);if(z){let{quote:B,path:_,end:j}=z;if(_.startsWith(".")){let H=p1.resolve(Z,_);X+=`await import(${B}${H}${B})`,Q=j;continue}}}X+=W,Q++}return X}function GG($,Z){let Y=Z+5;if(Y>=$.length)return null;if(!/\s/.test($[Y]))return null;while(Y<$.length&&/\s/.test($[Y]))Y++;if(!$.startsWith("import",Y))return null;Y+=6;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return null;Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;let X=$[Y];if(X!=="'"&&X!=='"')return null;Y++;let Q=Y;while(Y<$.length&&$[Y]!==X)if($[Y]==="\\")Y+=2;else Y++;if(Y>=$.length)return null;let J=$.slice(Q,Y);Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!==")")return null;return{quote:X,path:J,end:Y+1}}function g9($,Z){let Y=$[Z];if(Y!=="{"&&Y!=="[")return null;let Q=D0($,Y,Y==="{"?"}":"]",Z);if(Q===-1)return null;return{pattern:$.slice(Z,Q+1),endPos:Q+1}}function h9($){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=g9(Y,X);if(K){let q=h9(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 P9($,Z){let Y=$[Z].trim(),X=Y.match(/^(?:export\s+)?(const|let|var)\s+(\w+)\s*=\s*(.*)$/);if(!X){let W=Y.match(/^(?:export\s+)?(const|let|var)\s+/);if(W){let U=Y.slice(W[0].length),z=Z;if((U.startsWith("{")||U.startsWith("["))&&!U.includes(U.startsWith("{")?"}":"]")){let _=U.startsWith("{")?"}":"]",j=U;for(let H=Z+1;H<$.length;H++)if(j+=" "+$[H].trim(),z=H,$[H].includes(_))break;U=j}let B=g9(U,0);if(B){let _=W[1],j=B.pattern,H=U.slice(B.endPos).trim();if(H.startsWith("=")){let L=H.slice(1).trim(),F=L,O=Math.max(z,Z);if(C9(L)){let N=v9($,O,L);F=N.value,O=N.nextIndex}else O=O+1;F=F.trim().replace(/;$/,"");let V=h9(j),R=`__stx_src_${Z}`,A=V.map((N)=>`module.exports.${N} = ${N};`).join(`
1950
+ })()`)(J,G,W,z,B,_,H,L,F,O,V,R,N,A,w,T,M,I,D,E,C,S,k,y,d,g,m,j,s,Z0,o0,P0,e,N0,C0,M0.confirm,M0.alert,M0.fetch,g0,...q0,...W0);if(X.preserveExisting){for(let[r,s0]of Object.entries(j1))if(!(r in Z)||Z[r]===void 0)Z[r]=s0}else Object.assign(Z,j1);for(let[r,s0]of Object.entries(z))if(!(r in Z))Z[r]=s0}catch(v){if(M5.env.STX_DEBUG){let f=v instanceof Error?v.message:String(v);console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${f}`)}try{await _G(Q,Z,Y)}catch(f){if(M5.env.STX_DEBUG){let P=f instanceof Error?f.message:String(f);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${P}`)}}}}function $7($,Z){let Y=Z?p1.dirname(Z):M5.cwd(),X=$.split(`
1951
+ `),Q=[],J=0;while(J<X.length){let G=X[J].trim();if(G.startsWith("interface ")||G.startsWith("export interface ")||G.startsWith("type ")||G.startsWith("export type ")){if(G.includes("{")&&!G.includes("}")){let K=0;for(;J<X.length;J++){for(let q of X[J])if(q==="{")K++;else if(q==="}")K--;if(K<=0)break}}J++;continue}if(G.startsWith("definePageMeta(")){let K=0,q=!1;for(let U=J;U<X.length&&!q;U++){let W=null,z=!1,B=X[U];for(let _=0;_<B.length;_++){let j=B[_];if(z){z=!1;continue}if(j==="\\"){z=!0;continue}if(W){if(j===W)W=null;continue}if(j==='"'||j==="'"||j==="`"){W=j;continue}if(j==="(")K++;else if(j===")"){if(K--,K===0){J=U+1,q=!0;break}}}}if(!q)J=X.length;continue}if(G.startsWith("import ")){let K=G.match(/^import\s+(\w+)\s+from\s+['"](.+)['"]/),q=G.match(/^import\s+\{([^}]+)\}\s+from\s+['"](.+)['"]/),U=G.match(/^import\s+['"](.+)['"]/),W=(z)=>{if(z.startsWith("."))return p1.resolve(Y,z);return z};if(K){let[,z,B]=K,_=W(B);Q.push(`const ${z} = await import('${_}')`),Q.push(`module.exports.${z} = ${z};`)}else if(q){let[,z,B]=q,_=z.trim(),j=W(B);Q.push(`const { ${_} } = await import('${j}')`);for(let H of _.split(",")){let L=H.trim().split(/\s+as\s+/).pop()?.trim();if(L)Q.push(`module.exports.${L} = ${L};`)}}else if(U){let z=W(U[1]);Q.push(`await import('${z}')`)}else Q.push(G);J++;continue}if((G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")||G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var "))&&!G.includes("="))Q.push(X[J]),J++;else if(G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var ")){let K=C9(X,J),{type:q,name:U,value:W}=K;Q.push(`${q} ${U} = ${W};`),Q.push(`module.exports.${U} = ${U};`),J=K.nextIndex}else if(G.startsWith("export function ")||G.startsWith("export async function ")){let K=e$(X,J);Q.push(K.functionCode),Q.push(`module.exports.${K.name} = ${K.name};`),J=K.nextIndex}else if(G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")){let K=C9(X,J),{type:q,name:U,value:W}=K;Q.push(`${q} ${U} = ${W};`),Q.push(`module.exports.${U} = ${U};`),J=K.nextIndex}else if(G.startsWith("function ")||G.startsWith("async function ")){let K=e$(X,J);Q.push(K.functionCode),Q.push(`module.exports.${K.name} = ${K.name};`),J=K.nextIndex}else if(G.startsWith("export default function ")||G.startsWith("export default async function ")){let K=X[J].replace(/^(\s*)export\s+default\s+/,"$1"),q=[...X];q[J]=K;let U=e$(q,J);if(Q.push(U.functionCode),U.name)Q.push(`module.exports.default = ${U.name};`);J=U.nextIndex}else if(G.startsWith("export default ")){let K=G.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${K};`),J++}else if(G.startsWith("class ")||G.startsWith("export class ")){let K=G.match(/(?:export\s+)?class\s+(\w+)/);if(K){let q=K[1],U=X[J].replace(/^export\s+/,""),W=0,z=J;for(;z<X.length;z++){let B=X[z];for(let _ of B)if(_==="{")W++;else if(_==="}")W--;if(z>J)U+=`
1952
+ `+B;if(W<=0&&z>=J)break}Q.push(U),Q.push(`module.exports.${q} = ${q};`),J=z+1}else Q.push(G),J++}else if(G.includes("module.exports"))Q.push(G),J++;else if(G.trim()&&!G.startsWith("//"))Q.push(G),J++;else J++}return UG(Q.join(`
1953
+ `),Y)}function UG($,Z){let Y=$.length,X="",Q=0,J=null,G=!1,K=!1,q=0;while(Q<Y){let U=$[Q],W=$[Q+1];if(G){if(X+=U,U===`
1954
+ `)G=!1;Q++;continue}if(K){if(X+=U,U==="*"&&W==="/"){X+=W,Q+=2,K=!1;continue}Q++;continue}if(!J&&U==="/"&&W==="/"){G=!0,X+=U,Q++;continue}if(!J&&U==="/"&&W==="*"){K=!0,X+=U,Q++;continue}if(J){if(X+=U,U==="\\"){X+=W,Q+=2;continue}if(U===J&&J!=="`"){J=null,Q++;continue}if(J==="`"){if(U==="$"&&W==="{"){q++,X+=W,Q+=2;continue}if(U==="`"){J=null,Q++;continue}}Q++;continue}if(q>0){if(U==="{")q++;else if(U==="}")q--}if(U==='"'||U==="'"||U==="`"){J=U,X+=U,Q++;continue}if(U==="a"&&$.startsWith("await",Q)){let z=WG($,Q);if(z){let{quote:B,path:_,end:j}=z;if(_.startsWith(".")){let H=p1.resolve(Z,_);X+=`await import(${B}${H}${B})`,Q=j;continue}}}X+=U,Q++}return X}function WG($,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 h9($,Z){let Y=$[Z];if(Y!=="{"&&Y!=="[")return null;let Q=I0($,Y,Y==="{"?"}":"]",Z);if(Q===-1)return null;return{pattern:$.slice(Z,Q+1),endPos:Q+1}}function d9($){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=h9(Y,X);if(K){let q=d9(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 C9($,Z){let Y=$[Z].trim(),X=Y.match(/^(?:export\s+)?(const|let|var)\s+(\w+)\s*=\s*(.*)$/);if(!X){let U=Y.match(/^(?:export\s+)?(const|let|var)\s+/);if(U){let W=Y.slice(U[0].length),z=Z;if((W.startsWith("{")||W.startsWith("["))&&!W.includes(W.startsWith("{")?"}":"]")){let _=W.startsWith("{")?"}":"]",j=W;for(let H=Z+1;H<$.length;H++)if(j+=" "+$[H].trim(),z=H,$[H].includes(_))break;W=j}let B=h9(W,0);if(B){let _=U[1],j=B.pattern,H=W.slice(B.endPos).trim();if(H.startsWith("=")){let L=H.slice(1).trim(),F=L,O=Math.max(z,Z);if(v9(L)){let A=x9($,O,L);F=A.value,O=A.nextIndex}else O=O+1;F=F.trim().replace(/;$/,"");let V=d9(j),R=`__stx_src_${Z}`,N=V.map((A)=>`module.exports.${A} = ${A};`).join(`
1955
1955
  `);return{type:_,name:R,value:`${F}; ${_} ${j} = ${R};
1956
- ${A}`,nextIndex:O}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}let[,Q,J,G]=X,K=G,q=Z;if(C9(G)){let W=v9($,Z,G);K=W.value,q=W.nextIndex}else q=Z+1;while(q<$.length){let W=$[q].trim();if(W.startsWith(".")||W.startsWith("?."))K+=`
1957
- ${$[q]}`,q++;else break}return K=K.trim().replace(/;$/,""),{type:Q,name:J,value:K,nextIndex:q}}function t$($,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(KG(Y)){let K=qG($,Z,J);J=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:Q,functionCode:J,nextIndex:G}}function C9($){let Z=$.trim();if(Z.startsWith("{"))return D0(Z,"{","}",0)===-1;if(Z.startsWith("["))return D0(Z,"[","]",0)===-1;return!d9(Z)}function d9($){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 KG($){let Z=$.indexOf("{");if(Z===-1)return!0;return D0($,"{","}",Z)===-1}function v9($,Z,Y){let X=Y,Q=Z+1;while(Q<$.length&&!d9(X)){let J=$[Q];X+=`
1956
+ ${N}`,nextIndex:O}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}let[,Q,J,G]=X,K=G,q=Z;if(v9(G)){let U=x9($,Z,G);K=U.value,q=U.nextIndex}else q=Z+1;while(q<$.length){let U=$[q].trim();if(U.startsWith(".")||U.startsWith("?."))K+=`
1957
+ ${$[q]}`,q++;else break}return K=K.trim().replace(/;$/,""),{type:Q,name:J,value:K,nextIndex:q}}function e$($,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(zG(Y)){let K=BG($,Z,J);J=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:Q,functionCode:J,nextIndex:G}}function v9($){let Z=$.trim();if(Z.startsWith("{"))return I0(Z,"{","}",0)===-1;if(Z.startsWith("["))return I0(Z,"[","]",0)===-1;return!m9(Z)}function m9($){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 zG($){let Z=$.indexOf("{");if(Z===-1)return!0;return I0($,"{","}",Z)===-1}function x9($,Z,Y){let X=Y,Q=Z+1;while(Q<$.length&&!m9(X)){let J=$[Q];X+=`
1958
1958
  ${J}`,Q++}while(Q<$.length){let J=$[Q].trim();if(J.startsWith(".")||J.startsWith("?."))X+=`
1959
- ${$[Q]}`,Q++;else break}return{value:X,nextIndex:Q}}function qG($,Z,Y){let X=Y,Q=Z+1;while(Q<$.length){let J=X.indexOf("{");if(J!==-1){if(D0(X,"{","}",J)!==-1)break}let G=$[Q];X+=`
1960
- ${G}`,Q++}return{functionCode:X,nextIndex:Q}}function x9($,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:{...w5.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 UG($,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=x9(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=x9(q,Z);if(W!==void 0)Z[G]=W}catch{}}}function m9($){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 u9($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var T5=b(()=>{N5();h1();L0()});var $7={};o($7,{renderSlot:()=>p9,processSlots:()=>i9,parseSlots:()=>l9,parseSlotElement:()=>zG,extractSlotContent:()=>jG,applySlots:()=>HG});function WG($,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 l9($){let Z={default:"",named:new Map},Y=$,X=/<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>/gi,Q=[],J;while((J=X.exec($))!==null){let[U,z,B,_,j]=J,H=z||B||_,L=J.index+U.length,F=WG($,L);if(F!==-1){let O=$.slice(L,F-11).trim();Q.push({start:J.index,end:F,slotName:H,content:O,propsBinding:j||void 0}),Z.named.set(H,{name:H,content:O,propsBinding:j||void 0})}}Q.sort((U,z)=>z.start-U.start);for(let U of Q)Y=Y.slice(0,U.start)+Y.slice(U.end);let G=[],K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,q;while((q=K.exec(Y))!==null){let[U,z,B,_,j,H]=q,L=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),O=(L+F).trim(),V=`<${z}${O?" "+O:""}>${H}</${z}>`;G.push({start:q.index,end:q.index+U.length,slotName:_,element:V})}let W=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((q=W.exec(Y))!==null){let[U,z,B,_,j]=q,H=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=(H+L).trim(),O=`<${z}${F?" "+F:""} />`;G.push({start:q.index,end:q.index+U.length,slotName:_,element:O})}G.sort((U,z)=>z.start-U.start);for(let U of G){let z=Z.named.get(U.slotName);if(z)z.content+=U.element;else Z.named.set(U.slotName,{name:U.slotName,content:U.element});Y=Y.slice(0,U.start)+Y.slice(U.end)}return Z.default=Y.trim(),Z}function zG($){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 p9($,Z,Y,X){if(!$)return Y;let Q=$.content;if($.propsBinding&&Object.keys(Z).length>0){let J=$.propsBinding.trim(),G={...X};if(J.startsWith("{")&&J.endsWith("}")){let K=J.slice(1,-1).split(",").map((q)=>q.trim()).filter(Boolean);for(let q of K){let[W,U]=q.split(":").map((B)=>B.trim()),z=U||W;if(Z[W]!==void 0)G[z]=Z[W]}}else G[J]=Z;Q=BG(Q,G)}return Q}function BG($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,X)=>{try{let Q=X.trim(),J=c9(Q,Z);return h0(String(J??""))}catch{return`{{ ${X} }}`}})}function c9($,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(!X0($))return;return J0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function i9($,Z,Y){let X=$;X=await _G(X,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,W)=>{let U=Z.named.get(K),z=W?.trim()||"",B=q||"",_={},j=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=j.exec(B))!==null){let L=H[1],F=H[2];_[L]=c9(F,Y)}return await p9(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 _G($,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 jG($){let Z=l9($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function HG($,Z,Y,X){return await i9($,{default:Z,named:Y},X)}var Z7=b(()=>{c0();L0()});import OG from"fs";import h from"path";function n9($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function FG($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function L1($){return!FG($)}function F1($){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 VG($){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]!==`
1961
- `)Q++;return!0}if($[Q]==="/"&&$[Q+1]==="*"){Q+=2;while(Q<J-1&&!($[Q]==="*"&&$[Q+1]==="/"))Q++;return Q+=2,!0}return!1},W=()=>{if(X!==0)return;let U=$.slice(Q).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let j=U[2].split(",").map((H)=>{let L=H.trim().split(":");return L[L.length-1].trim()});for(let H of j)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!Y.has(H))Z.push(H),Y.add(H);return}let z=$.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let j=z[2];if(!Y.has(j))Z.push(j),Y.add(j);return}let B=$.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!Y.has(j))Z.push(j),Y.add(j);return}let _=$.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let j=_[1];if(!Y.has(j))Z.push(j),Y.add(j)}};while(Q<J){if(q())continue;if($[Q]==="'"||$[Q]==='"'){G($[Q]);continue}if($[Q]==="`"){K();continue}if($[Q]==="{"){X++,Q++;continue}if($[Q]==="}"){X--,Q++;continue}if(X===0&&/[a-z]/i.test($[Q])&&(Q===0||/\s|[;{}()]/.test($[Q-1])))W();Q++}return Z}function RG($){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 AG($){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 NG($,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 RG(K)){let W=q.trim();if(!W||W.startsWith("..."))continue;let U=AG(W);if(U===-1)continue;let z=W.slice(0,U).trim();if(!/^[A-Z_$][\w$]*$/i.test(z))continue;if(Z[z]!==void 0)continue;let B=W.slice(U+1).trim();if(!B)continue;try{let _=Object.keys(Z),j=Function(..._,`"use strict"; return (${B});`);Z[z]=j(..._.map((H)=>Z[H]))}catch{}}}catch{}}async function B4($,Z,Y,X,Q){let J=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""),K=(L)=>L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=Y.__importedComponents;if(q){for(let L of[J,J.toLowerCase(),G(J),K(J)])if(q.has(L))return!0}let W=[...new Set([`${J}.stx`,`${G(J)}.stx`,`${K(J)}.stx`])],U=typeof Q.root==="string"?h.resolve(Q.root):void 0,z=U??h.dirname(X),B=[],_=(L)=>{if(L&&!B.includes(L))B.push(L)},j=Y.__originalFilePath;if(j)_(h.join(h.dirname(j),"components"));_(Z),_(h.join(h.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)_(h.resolve(U,"resources/views/components")),_(h.resolve(U,"resources/components")),_(h.resolve(U,"src/components")),_(h.resolve(U,"components"));if(J.startsWith("./")||J.startsWith("../"))return i(h.resolve(h.dirname(X),`${J}.stx`));for(let L of B){let F=h.isAbsolute(L)?L:h.resolve(z,L);for(let O of W)if(await i(h.join(F,O)))return!0}return!1}function wG($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function TG($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}async function N1($,Z,Y,X,Q,J,G,K=new Set,q){let{extractVariables:W}=await Promise.resolve().then(() => (T5(),z4)),U=K??new Set;if(U.has($))return`[Circular component reference: ${$}]`;let z=new Set(U);z.add($);let B=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let _=B&&B!=="load"&&wG(B)?B:"";try{let j=(y)=>y.split("-").map((x)=>x.charAt(0).toUpperCase()+x.slice(1)).join(""),H=(y)=>y.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=$.endsWith(".stx")?$.slice(0,-4):$,F=null,O=Q.__importedComponents;if(O){let y=[L,L.toLowerCase(),j(L),H(L)];for(let x of y)if(O.has(x)){F=O.get(x);break}}let V=[];if(!F){let y=[`${L}.stx`,`${j(L)}.stx`,`${H(L)}.stx`],x=[...new Set(y)],u=Q.__originalFilePath,l=[];if(u){let W0=h.join(h.dirname(u),"components");l.push(W0)}if(X)l.push(X);let Y0=h.join(h.dirname(J),"components");if(!l.includes(Y0))l.push(Y0);if(G.componentsDir&&G.componentsDir!==X&&!l.includes(G.componentsDir))l.push(G.componentsDir);let q0=G._pluginComponentDirs;if(Array.isArray(q0)){for(let W0 of q0)if(typeof W0==="string"&&!l.includes(W0))l.push(W0)}let I0=typeof G.root==="string"?h.resolve(G.root):void 0,x1=I0??h.dirname(J),v0=[];if(I0)v0.push(h.resolve(I0,"resources/views/components")),v0.push(h.resolve(I0,"resources/components")),v0.push(h.resolve(I0,"src/components")),v0.push(h.resolve(I0,"components"));v0.push(h.resolve(import.meta.dir,"components"));for(let W0 of v0)if(!l.includes(W0))l.push(W0);let $1=[...new Set(l.map((W0)=>{if(!W0)return W0;return h.isAbsolute(W0)?W0:h.resolve(x1,W0)}))];if(l.length=0,l.push(...$1),L.startsWith("./")||L.startsWith("../"))F=h.resolve(h.dirname(J),`${L}.stx`),V.push(F);else for(let W0 of l){if(!W0)continue;for(let _1 of x){let r=h.join(W0,_1);if(V.push(r),await i(r)){F=r;break}}if(F)break;if(!F)try{let _1=await import("fs");if(!_1.statSync(W0,{throwIfNoEntry:!1})?.isDirectory())continue;let j1=8,p5=[{path:W0,depth:0}];while(p5.length>0&&!F){let c5=p5.pop();if(c5.depth>=j1)continue;let F6;try{F6=_1.readdirSync(c5.path,{withFileTypes:!0})}catch{continue}for(let i5 of F6){if(!i5.isDirectory())continue;if(i5.name==="node_modules"||i5.name.startsWith("."))continue;let V6=h.join(c5.path,i5.name);for(let qJ of x){let v$=h.join(V6,qJ);if(V.push(v$),await i(v$)){F=v$;break}}if(F)break;p5.push({path:V6,depth:c5.depth+1})}}}catch{}if(F)break}}if(!F||!await i(F)){let y=V.length>0?`
1959
+ ${$[Q]}`,Q++;else break}return{value:X,nextIndex:Q}}function BG($,Z,Y){let X=Y,Q=Z+1;while(Q<$.length){let J=X.indexOf("{");if(J!==-1){if(I0(X,"{","}",J)!==-1)break}let G=$[Q];X+=`
1960
+ ${G}`,Q++}return{functionCode:X,nextIndex:Q}}function f9($,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:{...M5.env}})};try{return Function(...Object.keys(X),`'use strict'; return (${$});`)(...Object.values(X))}catch{try{return Function(...Object.keys(X),`'use strict'; return ${$};`)(...Object.values(X))}catch{return}}}async function _G($,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(/;$/,""),U=f9(q,Z);if(U!==void 0)Z[G]=U}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(/;$/,""),U=f9(q,Z);if(U!==void 0)Z[G]=U}catch{}}}function u9($){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 l9($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var I5=b(()=>{T5();h1();L0()});var Z7={};o(Z7,{renderSlot:()=>c9,processSlots:()=>n9,parseSlots:()=>p9,parseSlotElement:()=>HG,extractSlotContent:()=>FG,applySlots:()=>VG});function jG($,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 p9($){let Z={default:"",named:new Map},Y=$,X=/<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>/gi,Q=[],J;while((J=X.exec($))!==null){let[W,z,B,_,j]=J,H=z||B||_,L=J.index+W.length,F=jG($,L);if(F!==-1){let O=$.slice(L,F-11).trim();Q.push({start:J.index,end:F,slotName:H,content:O,propsBinding:j||void 0}),Z.named.set(H,{name:H,content:O,propsBinding:j||void 0})}}Q.sort((W,z)=>z.start-W.start);for(let W of Q)Y=Y.slice(0,W.start)+Y.slice(W.end);let G=[],K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,q;while((q=K.exec(Y))!==null){let[W,z,B,_,j,H]=q,L=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),O=(L+F).trim(),V=`<${z}${O?" "+O:""}>${H}</${z}>`;G.push({start:q.index,end:q.index+W.length,slotName:_,element:V})}let U=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((q=U.exec(Y))!==null){let[W,z,B,_,j]=q,H=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=(H+L).trim(),O=`<${z}${F?" "+F:""} />`;G.push({start:q.index,end:q.index+W.length,slotName:_,element:O})}G.sort((W,z)=>z.start-W.start);for(let W of G){let z=Z.named.get(W.slotName);if(z)z.content+=W.element;else Z.named.set(W.slotName,{name:W.slotName,content:W.element});Y=Y.slice(0,W.start)+Y.slice(W.end)}return Z.default=Y.trim(),Z}function HG($){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 c9($,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[U,W]=q.split(":").map((B)=>B.trim()),z=W||U;if(Z[U]!==void 0)G[z]=Z[U]}}else G[J]=Z;Q=OG(Q,G)}return Q}function OG($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,X)=>{try{let Q=X.trim(),J=i9(Q,Z);return h0(String(J??""))}catch{return`{{ ${X} }}`}})}function i9($,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(!X0($))return;return J0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function n9($,Z,Y){let X=$;X=await LG(X,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,U)=>{let W=Z.named.get(K),z=U?.trim()||"",B=q||"",_={},j=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=j.exec(B))!==null){let L=H[1],F=H[2];_[L]=i9(F,Y)}return await c9(W,_,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 LG($,Z,Y){let X=[],Q=[];$.replace(Z,(K,...q)=>{let U=q[q.length-2];return Q.push({match:K,index:U}),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:U}=Q[K];G=G.slice(0,U)+J[K]+G.slice(U+q.length)}return G}function FG($){let Z=p9($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function VG($,Z,Y,X){return await n9($,{default:Z,named:Y},X)}var Y7=b(()=>{c0();L0()});import RG from"fs";import h from"path";function o9($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function AG($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function L1($){return!AG($)}function F1($){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 wG($){let Z=[],Y=new Set,X=0,Q=0,J=$.length,G=(W)=>{Q++;while(Q<J){if($[Q]==="\\"){Q+=2;continue}if($[Q]===W){Q++;return}Q++}},K=()=>{Q++;while(Q<J){if($[Q]==="\\"){Q+=2;continue}if($[Q]==="`"){Q++;return}if($[Q]==="$"&&$[Q+1]==="{"){Q+=2;let W=1;while(Q<J&&W>0)if($[Q]==="{")W++,Q++;else if($[Q]==="}")W--,Q++;else if($[Q]==="'"||$[Q]==='"')G($[Q]);else if($[Q]==="`")K();else Q++;continue}Q++}},q=()=>{if($[Q]==="/"&&$[Q+1]==="/"){while(Q<J&&$[Q]!==`
1961
+ `)Q++;return!0}if($[Q]==="/"&&$[Q+1]==="*"){Q+=2;while(Q<J-1&&!($[Q]==="*"&&$[Q+1]==="/"))Q++;return Q+=2,!0}return!1},U=()=>{if(X!==0)return;let W=$.slice(Q).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(W){let j=W[2].split(",").map((H)=>{let L=H.trim().split(":");return L[L.length-1].trim()});for(let H of j)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!Y.has(H))Z.push(H),Y.add(H);return}let z=$.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let j=z[2];if(!Y.has(j))Z.push(j),Y.add(j);return}let B=$.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!Y.has(j))Z.push(j),Y.add(j);return}let _=$.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let j=_[1];if(!Y.has(j))Z.push(j),Y.add(j)}};while(Q<J){if(q())continue;if($[Q]==="'"||$[Q]==='"'){G($[Q]);continue}if($[Q]==="`"){K();continue}if($[Q]==="{"){X++,Q++;continue}if($[Q]==="}"){X--,Q++;continue}if(X===0&&/[a-z]/i.test($[Q])&&(Q===0||/\s|[;{}()]/.test($[Q-1])))U();Q++}return Z}function TG($){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 MG($){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 IG($,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 TG(K)){let U=q.trim();if(!U||U.startsWith("..."))continue;let W=MG(U);if(W===-1)continue;let z=U.slice(0,W).trim();if(!/^[A-Z_$][\w$]*$/i.test(z))continue;if(Z[z]!==void 0)continue;let B=U.slice(W+1).trim();if(!B)continue;try{let _=Object.keys(Z),j=Function(..._,`"use strict"; return (${B});`);Z[z]=j(..._.map((H)=>Z[H]))}catch{}}}catch{}}async function B4($,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 U=[...new Set([`${J}.stx`,`${G(J)}.stx`,`${K(J)}.stx`])],W=typeof Q.root==="string"?h.resolve(Q.root):void 0,z=W??h.dirname(X),B=[],_=(L)=>{if(L&&!B.includes(L))B.push(L)},j=Y.__originalFilePath;if(j)_(h.join(h.dirname(j),"components"));_(Z),_(h.join(h.dirname(X),"components")),_(Q.componentsDir);let H=Q._pluginComponentDirs;if(Array.isArray(H))for(let L of H)_(typeof L==="string"?L:null);if(W)_(h.resolve(W,"resources/views/components")),_(h.resolve(W,"resources/components")),_(h.resolve(W,"src/components")),_(h.resolve(W,"components"));if(J.startsWith("./")||J.startsWith("../"))return i(h.resolve(h.dirname(X),`${J}.stx`));for(let L of B){let F=h.isAbsolute(L)?L:h.resolve(z,L);for(let O of U)if(await i(h.join(F,O)))return!0}return!1}function DG($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function EG($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}async function A1($,Z,Y,X,Q,J,G,K=new Set,q){let{extractVariables:U}=await Promise.resolve().then(() => (I5(),z4)),W=K??new Set;if(W.has($))return`[Circular component reference: ${$}]`;let z=new Set(W);z.add($);let B=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let _=B&&B!=="load"&&DG(B)?B:"";try{let j=(P)=>P.split("-").map((x)=>x.charAt(0).toUpperCase()+x.slice(1)).join(""),H=(P)=>P.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=$.endsWith(".stx")?$.slice(0,-4):$,F=null,O=Q.__importedComponents;if(O){let P=[L,L.toLowerCase(),j(L),H(L)];for(let x of P)if(O.has(x)){F=O.get(x);break}}let V=[];if(!F){let P=[`${L}.stx`,`${j(L)}.stx`,`${H(L)}.stx`],x=[...new Set(P)],u=Q.__originalFilePath,l=[];if(u){let W0=h.join(h.dirname(u),"components");l.push(W0)}if(X)l.push(X);let Y0=h.join(h.dirname(J),"components");if(!l.includes(Y0))l.push(Y0);if(G.componentsDir&&G.componentsDir!==X&&!l.includes(G.componentsDir))l.push(G.componentsDir);let q0=G._pluginComponentDirs;if(Array.isArray(q0)){for(let W0 of q0)if(typeof W0==="string"&&!l.includes(W0))l.push(W0)}let k0=typeof G.root==="string"?h.resolve(G.root):void 0,x1=k0??h.dirname(J),g0=[];if(k0)g0.push(h.resolve(k0,"resources/views/components")),g0.push(h.resolve(k0,"resources/components")),g0.push(h.resolve(k0,"src/components")),g0.push(h.resolve(k0,"components"));g0.push(h.resolve(import.meta.dir,"components"));for(let W0 of g0)if(!l.includes(W0))l.push(W0);let Z1=[...new Set(l.map((W0)=>{if(!W0)return W0;return h.isAbsolute(W0)?W0:h.resolve(x1,W0)}))];if(l.length=0,l.push(...Z1),L.startsWith("./")||L.startsWith("../"))F=h.resolve(h.dirname(J),`${L}.stx`),V.push(F);else for(let W0 of l){if(!W0)continue;for(let G5 of x){let j1=h.join(W0,G5);if(V.push(j1),await i(j1)){F=j1;break}}if(F)break;if(!F)try{let G5=await import("fs");if(!G5.statSync(W0,{throwIfNoEntry:!1})?.isDirectory())continue;let r=8,s0=[{path:W0,depth:0}];while(s0.length>0&&!F){let K5=s0.pop();if(K5.depth>=r)continue;let V6;try{V6=G5.readdirSync(K5.path,{withFileTypes:!0})}catch{continue}for(let i5 of V6){if(!i5.isDirectory())continue;if(i5.name==="node_modules"||i5.name.startsWith("."))continue;let R6=h.join(K5.path,i5.name);for(let WJ of x){let v$=h.join(R6,WJ);if(V.push(v$),await i(v$)){F=v$;break}}if(F)break;s0.push({path:R6,depth:K5.depth+1})}}}catch{}if(F)break}}if(!F||!await i(F)){let P=V.length>0?`
1962
1962
  Searched paths:
1963
1963
  ${V.map((x)=>` - ${x}`).join(`
1964
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${y}`}q.add(F);let R;if(Y7.has(F))R=Y7.get(F);else try{R=await Bun.file(F).text(),Y7.set(F,R)}catch(y){return`[Error loading component: ${y instanceof Error?y.message:String(y)}]`}let A=new Set(["__originalFilePath","__importedComponents"]),N={};for(let[y,x]of Object.entries(Q))if(!y.startsWith("__")||A.has(y))N[y]=x;let{extractSlotContent:w}=await Promise.resolve().then(() => (Z7(),$7)),T=w(Y),M={};if(T.defaultSlot?.trim())M.default=T.defaultSlot;for(let[y,x]of T.namedSlots)M[y]=x.content;let I={...N,...Z,props:Z,slot:Y,$slots:M,__processedComponents:z,__sections:{},...TG(Y)&&{__stx_force_signals:!0}};NG(R,I);let D=R,E=D.match(/<template\b(?![^>]*(?:\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=|\s#[\w-]|\bv-slot|\bslot\s*=))[^>]*>([\s\S]*?)<\/template>/i);if(E)D=E[1].trim();let C=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...R.matchAll(C)],k=[];for(let y of S){let x=y[1]||"",u=y[2]||"",l=x.includes("server");if(L1(x)&&u.trim())u=F1(u);if(l&&u)try{await W(u,I,F)}catch(q0){}if(!l){let q0=u.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,"");if(q0.includes("{{")&&q0.includes("}}"))q0=p0(q0,I,F);let I0=x.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");k.push(`<script${I0}>${q0}</script>`)}}let P=R.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),d=P?P[1]:"",g=P?P[2]:"",m="",s=d&&/\bscoped\b/i.test(d);if(P)m=`<style${d}>${g}</style>`;let Z0=D;if(Z0=Z0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),P)Z0=Z0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let y=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,x=[];if(Z0=Z0.replace(y,(u,l)=>{let Y0=l.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Y0)x.push(`<style${Y0[1]}>${Y0[2]}</style>`);return""}),Z0=Z0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),x.length>0)m=`${m}${x.join(`
1965
- `)}`}if(Y&&Z0.includes("{{ text || slot }}"))Z0=Z0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:o0}=await Promise.resolve().then(() => (Z7(),$7)),{defaultSlot:P0,namedSlots:T0}=T;Z0=await o0(Z0,P0||Y,T0,I);for(let[y,x]of Object.entries(I))if(typeof x==="string"){if(x.includes("<")&&x.includes(">")||x.includes("&lt;")||x.includes("&quot;")){let u=n$(x);I[y]=u}}let e=k.some((y)=>/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(y)),M0={...G,componentsDir:h.dirname(F),skipSignalsRuntime:!0,skipEventDirectives:e,defaultLayout:void 0};I.__stxProcessingDepth=(Q.__stxProcessingDepth||0)+1;let C0=await F0(Z0,I,F,M0,q),v=`stx_${L.replace(/[^a-zA-Z0-9]/g,"_")}_${++LG}_${Math.random().toString(36).slice(2,8)}`,f=C0;if(e){let y="";if(Object.keys(Z).length>0)try{y=` data-stx-props="${n9(JSON.stringify(Z))}"`}catch{}let x=_?` stx-hydrate="${n9(_)}"`:"";if(f=`<div data-stx-scope="${v}"${y}${x}>${C0}</div>`,f=k.map((l)=>{let Y0=l.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Y0)return l;let[,q0,I0]=Y0,x1=a0(I0),v0=`
1964
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${P}`}q.add(F);let R;if(X7.has(F))R=X7.get(F);else try{R=await Bun.file(F).text(),X7.set(F,R)}catch(P){return`[Error loading component: ${P instanceof Error?P.message:String(P)}]`}let N=new Set(["__originalFilePath","__importedComponents"]),A={};for(let[P,x]of Object.entries(Q))if(!P.startsWith("__")||N.has(P))A[P]=x;let{extractSlotContent:w}=await Promise.resolve().then(() => (Y7(),Z7)),T=w(Y),M={};if(T.defaultSlot?.trim())M.default=T.defaultSlot;for(let[P,x]of T.namedSlots)M[P]=x.content;let I={...A,...Z,props:Z,slot:Y,$slots:M,__processedComponents:z,__sections:{},...EG(Y)&&{__stx_force_signals:!0}};IG(R,I);let D=R,E=D.match(/<template\b(?![^>]*(?:\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=|\s#[\w-]|\bv-slot|\bslot\s*=))[^>]*>([\s\S]*?)<\/template>/i);if(E)D=E[1].trim();let C=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...R.matchAll(C)],k=[];for(let P of S){let x=P[1]||"",u=P[2]||"",l=x.includes("server");if(L1(x)&&u.trim())u=F1(u);if(l&&u)try{await U(u,I,F)}catch(q0){}if(!l){let q0=u.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,"");if(q0.includes("{{")&&q0.includes("}}"))q0=p0(q0,I,F);let k0=x.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");k.push(`<script${k0}>${q0}</script>`)}}let y=R.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),d=y?y[1]:"",g=y?y[2]:"",m="",s=d&&/\bscoped\b/i.test(d);if(y)m=`<style${d}>${g}</style>`;let Z0=D;if(Z0=Z0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),y)Z0=Z0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let P=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,x=[];if(Z0=Z0.replace(P,(u,l)=>{let Y0=l.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Y0)x.push(`<style${Y0[1]}>${Y0[2]}</style>`);return""}),Z0=Z0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),x.length>0)m=`${m}${x.join(`
1965
+ `)}`}if(Y&&Z0.includes("{{ text || slot }}"))Z0=Z0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:o0}=await Promise.resolve().then(() => (Y7(),Z7)),{defaultSlot:P0,namedSlots:M0}=T;Z0=await o0(Z0,P0||Y,M0,I);for(let[P,x]of Object.entries(I))if(typeof x==="string"){if(x.includes("<")&&x.includes(">")||x.includes("&lt;")||x.includes("&quot;")){let u=n$(x);I[P]=u}}let e=k.some((P)=>/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(P)),N0={...G,componentsDir:h.dirname(F),skipSignalsRuntime:!0,skipEventDirectives:e,defaultLayout:void 0};I.__stxProcessingDepth=(Q.__stxProcessingDepth||0)+1;let C0=await F0(Z0,I,F,N0,q),v=`stx_${L.replace(/[^a-zA-Z0-9]/g,"_")}_${++NG}_${Math.random().toString(36).slice(2,8)}`,f=C0;if(e){let P="";if(Object.keys(Z).length>0)try{P=` data-stx-props="${o9(JSON.stringify(Z))}"`}catch{}let x=_?` stx-hydrate="${o9(_)}"`:"";if(f=`<div data-stx-scope="${v}"${P}${x}>${C0}</div>`,f=k.map((l)=>{let Y0=l.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Y0)return l;let[,q0,k0]=Y0,x1=t0(k0),g0=`
1966
1966
  (function() {
1967
1967
  const { state, derived, effect, batch, defineEmits, defineExpose, defineSlots, defineProps, withDefaults, useStore, useFetch, useRef, useQuery, useMutation, useOptimistic, useDebounce, useDebouncedValue, useThrottle, useInterval, useTimeout, useToggle, useCounter, useClickOutside, useFocus, useAsync, useLocalStorage, useSessionStorage, useCookie, useReactiveProp, useEventListener, useWebSocket, useColorMode, useDark, useHead, useSeoMeta, definePageMeta, useRoute, useSearchParams, navigate, goBack, goForward, provide, inject, ref, reactive, computed, watch, watchEffect, nextTick } = window.stx;
1968
1968
  const __scope = window.stx._scopes = window.stx._scopes || {};
@@ -1979,34 +1979,34 @@ ${x1}
1979
1979
  // Register all defined signals and functions in this scope
1980
1980
  const __localVars = {};
1981
1981
  try {
1982
- ${VG(x1).map(($1)=>`if (typeof ${$1} !== 'undefined') __localVars['${$1}'] = ${$1};`).join(`
1982
+ ${wG(x1).map((Z1)=>`if (typeof ${Z1} !== 'undefined') __localVars['${Z1}'] = ${Z1};`).join(`
1983
1983
  `)}
1984
1984
  }
1985
1985
  catch (e) {}
1986
1986
  Object.assign(__scopeVars, __localVars);
1987
- })();`;if(_)return`<script type="stx/island" data-stx-island="${v}" data-stx-scoped${q0}>${v0}</script>`;return`<script data-stx-scoped${q0}>${v0}</script>`}).join(`
1987
+ })();`;if(_)return`<script type="stx/island" data-stx-island="${v}" data-stx-scoped${q0}>${g0}</script>`;return`<script data-stx-scoped${q0}>${g0}</script>`}).join(`
1988
1988
  `)+`
1989
1989
  `+f,m)f+=`
1990
1990
  `+m}else{if(m)f+=`
1991
- `+m;if(k.length>0){let y=I.__stx_event_bindings||[],x=j5(I),u=await Promise.all(k.map(async(l)=>{let Y0=l.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!Y0)return l;return await H5(Y0[1],{eventBindings:y,templateContent:f,filePath:F,projectRoot:process.cwd(),serverData:x})}));f+=`
1991
+ `+m;if(k.length>0){let P=I.__stx_event_bindings||[],x=O5(I),u=await Promise.all(k.map(async(l)=>{let Y0=l.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!Y0)return l;return await L5(Y0[1],{eventBindings:P,templateContent:f,filePath:F,projectRoot:process.cwd(),serverData:x})}));f+=`
1992
1992
  `+u.join(`
1993
- `),I.__stx_event_bindings=[]}}if(s){let y=q4(f,F);if(y.hasScoped)f=y.html}return f}catch(j){return`[Error processing component: ${j instanceof Error?j.message:String(j)}]`}finally{U.delete($)}}async function i($){return Bun.file($).exists()}function X7($,Z){let Y=h.resolve(Z),X=h.resolve($),Q=Y.endsWith(h.sep)?Y:Y+h.sep;if(X===Y||X.startsWith(Q))return X;return null}async function J7($,Z,Y,X){let Q=await MG($,Z,Y,X);if(Q===null)return null;let J=X7(Q,process.cwd());if(J)return J;let G=[Y.root,Y.layoutsDir,Y.componentsDir,Y.partialsDir,Y.pagesDir].filter((K)=>typeof K==="string"&&K.length>0);for(let K of G){let q=h.isAbsolute(K)?K:h.resolve(process.cwd(),K);if(X7(Q,q))return h.resolve(Q)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Q} (template: ${$}, from: ${Z})`),null}async function MG($,Z,Y,X){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Q=h.dirname(Z),J=process.cwd();if($.startsWith("/")){let B=h.join(J,$),_=X7(B,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 i(_)&&X)X.add(_);return _}let G=h.join(Q,$);if(await i(G)){if(Y.debug)console.log(`Found direct path: ${G}`);if(X)X.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let B of[".stx",".tsx",".jsx"]){let _=`${G}${B}`;if(await i(_)){if(Y.debug)console.log(`Found direct path with extension: ${_}`);if(X)X.add(_);return _}}let K="",q=h.resolve(Q),W=process.cwd();for(let B=0;B<10;B++){let _=h.join(q,"layouts"),j=!1;try{j=OG.statSync(_,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){K=_;break}let H=h.dirname(q);if(H===q||H.length<W.length)break;q=H}if(K){let B=$.startsWith("layouts/")?$.slice(8):$,_=h.join(K,B);if(await i(_)){if(Y.debug)console.log(`Found in current layouts dir: ${_}`);if(X)X.add(_);return _}if(!B.endsWith(".stx")){let j=`${_}.stx`;if(await i(j)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${j}`);if(X)X.add(j);return j}}}if(Y.layoutsDir){let B=h.isAbsolute(Y.layoutsDir)?Y.layoutsDir:h.resolve(process.cwd(),Y.layoutsDir),_=$.startsWith("layouts/")?$.slice(8):$,j=h.join(B,_);if(await i(j)){if(Y.debug)console.log(`Found in options.layoutsDir: ${j}`);if(X)X.add(j);return j}if(!$.endsWith(".stx")){let H=`${j}.stx`;if(await i(H)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${H}`);if(X)X.add(H);return H}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let B=$.split("layouts/"),_=h.join(Y.partialsDir||Q,"layouts",B[1]);if(await i(_)){if(Y.debug)console.log(`Found in layouts path: ${_}`);if(X)X.add(_);return _}if(!_.endsWith(".stx")){let j=`${_}.stx`;if(await i(j)){if(Y.debug)console.log(`Found in layouts path with extension: ${j}`);if(X)X.add(j);return j}}}if(Y.partialsDir){if(K=h.join(Y.partialsDir,"layouts"),await i(K)){let B=h.join(K,$);if(await i(B)){if(Y.debug)console.log(`Found in partials layouts dir: ${B}`);if(X)X.add(B);return B}if(!$.endsWith(".stx")){let _=`${B}.stx`;if(await i(_)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${_}`);if(X)X.add(_);return _}}}}let U=Y.partialsDir||h.join(process.cwd(),"views"),z=h.join(U,$);if(await i(z)){if(Y.debug)console.log(`Found in views path: ${z}`);if(X)X.add(z);return z}if(!$.endsWith(".stx")){let B=`${z}.stx`;if(await i(B)){if(Y.debug)console.log(`Found in views path with extension: ${B}`);if(X)X.add(B);return B}}if(Q.includes("temp")){let B=h.join(h.dirname(Q),"layouts",$);if(await i(B)){if(Y.debug)console.log(`Found in temp layouts dir: ${B}`);if(X)X.add(B);return B}if(!$.endsWith(".stx")){let _=`${B}.stx`;if(await i(_)){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 o9($,Z,Y){let X=0,Q="",J="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
1994
- `),K=0;for(let q=0;q<G.length;q++)if(K+=G[q].length+1,K>=Z){X=q+1,Q=G[q].trim();let W=Math.max(0,q-2),U=Math.min(G.length,q+3);J=G.slice(W,U).map((z,B)=>{let _=W+B+1;return`${_===X?"> ":" "}${_}: ${z}`}).join(`
1995
- `);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return o9($,G)}}catch{}return{lineNumber:X,lineContent:Q,context:J}}function G0($,Z,Y,X,Q,J){let{lineNumber:G,context:K}=o9(X,Q,J),q=Y.split("/").pop(),W=0;if(typeof Q==="number"&&Q>=0&&X){let z=X.lastIndexOf(`
1996
- `,Math.max(0,Q-1));W=Q-(z+1)+1}let U="";if(G>0)U+=`
1997
- ${Y}:${G}${W>0?`:${W}`:""}: ${$.toLowerCase()} error: ${Z}
1998
- `;if(U+=`
1993
+ `),I.__stx_event_bindings=[]}}if(s){let P=q4(f,F);if(P.hasScoped)f=P.html}return f}catch(j){return`[Error processing component: ${j instanceof Error?j.message:String(j)}]`}finally{W.delete($)}}async function i($){return Bun.file($).exists()}function J7($,Z){let Y=h.resolve(Z),X=h.resolve($),Q=Y.endsWith(h.sep)?Y:Y+h.sep;if(X===Y||X.startsWith(Q))return X;return null}async function Q7($,Z,Y,X){let Q=await kG($,Z,Y,X);if(Q===null)return null;let J=J7(Q,process.cwd());if(J)return J;let G=[Y.root,Y.layoutsDir,Y.componentsDir,Y.partialsDir,Y.pagesDir].filter((K)=>typeof K==="string"&&K.length>0);for(let K of G){let q=h.isAbsolute(K)?K:h.resolve(process.cwd(),K);if(J7(Q,q))return h.resolve(Q)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Q} (template: ${$}, from: ${Z})`),null}async function kG($,Z,Y,X){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Q=h.dirname(Z),J=process.cwd();if($.startsWith("/")){let B=h.join(J,$),_=J7(B,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 i(_)&&X)X.add(_);return _}let G=h.join(Q,$);if(await i(G)){if(Y.debug)console.log(`Found direct path: ${G}`);if(X)X.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let B of[".stx",".tsx",".jsx"]){let _=`${G}${B}`;if(await i(_)){if(Y.debug)console.log(`Found direct path with extension: ${_}`);if(X)X.add(_);return _}}let K="",q=h.resolve(Q),U=process.cwd();for(let B=0;B<10;B++){let _=h.join(q,"layouts"),j=!1;try{j=RG.statSync(_,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){K=_;break}let H=h.dirname(q);if(H===q||H.length<U.length)break;q=H}if(K){let B=$.startsWith("layouts/")?$.slice(8):$,_=h.join(K,B);if(await i(_)){if(Y.debug)console.log(`Found in current layouts dir: ${_}`);if(X)X.add(_);return _}if(!B.endsWith(".stx")){let j=`${_}.stx`;if(await i(j)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${j}`);if(X)X.add(j);return j}}}if(Y.layoutsDir){let B=h.isAbsolute(Y.layoutsDir)?Y.layoutsDir:h.resolve(process.cwd(),Y.layoutsDir),_=$.startsWith("layouts/")?$.slice(8):$,j=h.join(B,_);if(await i(j)){if(Y.debug)console.log(`Found in options.layoutsDir: ${j}`);if(X)X.add(j);return j}if(!$.endsWith(".stx")){let H=`${j}.stx`;if(await i(H)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${H}`);if(X)X.add(H);return H}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let B=$.split("layouts/"),_=h.join(Y.partialsDir||Q,"layouts",B[1]);if(await i(_)){if(Y.debug)console.log(`Found in layouts path: ${_}`);if(X)X.add(_);return _}if(!_.endsWith(".stx")){let j=`${_}.stx`;if(await i(j)){if(Y.debug)console.log(`Found in layouts path with extension: ${j}`);if(X)X.add(j);return j}}}if(Y.partialsDir){if(K=h.join(Y.partialsDir,"layouts"),await i(K)){let B=h.join(K,$);if(await i(B)){if(Y.debug)console.log(`Found in partials layouts dir: ${B}`);if(X)X.add(B);return B}if(!$.endsWith(".stx")){let _=`${B}.stx`;if(await i(_)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${_}`);if(X)X.add(_);return _}}}}let W=Y.partialsDir||h.join(process.cwd(),"views"),z=h.join(W,$);if(await i(z)){if(Y.debug)console.log(`Found in views path: ${z}`);if(X)X.add(z);return z}if(!$.endsWith(".stx")){let B=`${z}.stx`;if(await i(B)){if(Y.debug)console.log(`Found in views path with extension: ${B}`);if(X)X.add(B);return B}}if(Q.includes("temp")){let B=h.join(h.dirname(Q),"layouts",$);if(await i(B)){if(Y.debug)console.log(`Found in temp layouts dir: ${B}`);if(X)X.add(B);return B}if(!$.endsWith(".stx")){let _=`${B}.stx`;if(await i(_)){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 s9($,Z,Y){let X=0,Q="",J="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
1994
+ `),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 U=Math.max(0,q-2),W=Math.min(G.length,q+3);J=G.slice(U,W).map((z,B)=>{let _=U+B+1;return`${_===X?"> ":" "}${_}: ${z}`}).join(`
1995
+ `);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return s9($,G)}}catch{}return{lineNumber:X,lineContent:Q,context:J}}function G0($,Z,Y,X,Q,J){let{lineNumber:G,context:K}=s9(X,Q,J),q=Y.split("/").pop(),U=0;if(typeof Q==="number"&&Q>=0&&X){let z=X.lastIndexOf(`
1996
+ `,Math.max(0,Q-1));U=Q-(z+1)+1}let W="";if(G>0)W+=`
1997
+ ${Y}:${G}${U>0?`:${U}`:""}: ${$.toLowerCase()} error: ${Z}
1998
+ `;if(W+=`
1999
1999
  ${a.bold}${a.red}\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E${a.reset}
2000
- `,U+=`${a.bold}${a.red}\u2502${a.reset} ${a.bold}${a.bgRed} ERROR ${a.reset} ${a.red}${$} Error${a.reset}${" ".repeat(Math.max(0,43-$.length))}${a.bold}${a.red}\u2502${a.reset}
2001
- `,U+=`${a.bold}${a.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${a.reset}
2002
- `,U+=`
2003
- ${a.cyan}${a.bold}File:${a.reset} ${a.dim}${q}${a.reset}`,G>0)U+=` ${a.gray}(line ${G}${W>0?`, col ${W}`:""})${a.reset}`;if(U+=`
2000
+ `,W+=`${a.bold}${a.red}\u2502${a.reset} ${a.bold}${a.bgRed} ERROR ${a.reset} ${a.red}${$} Error${a.reset}${" ".repeat(Math.max(0,43-$.length))}${a.bold}${a.red}\u2502${a.reset}
2001
+ `,W+=`${a.bold}${a.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${a.reset}
2002
+ `,W+=`
2003
+ ${a.cyan}${a.bold}File:${a.reset} ${a.dim}${q}${a.reset}`,G>0)W+=` ${a.gray}(line ${G}${U>0?`, col ${U}`:""})${a.reset}`;if(W+=`
2004
2004
  ${a.yellow}${a.bold}Message:${a.reset} ${Z}
2005
- `,K)U+=`
2005
+ `,K)W+=`
2006
2006
  ${a.blue}${a.bold}Context:${a.reset}
2007
2007
  ${a.dim}${K}${a.reset}
2008
- `;return U}var Y7,LG=0,a;var H0=b(()=>{O5();c0();l1();_4();h1();r$();y9();T5();Y7=new R5(500);a={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 s9($,Z,Y=""){let X=$,Q=[],J=/@markdown(?:\([^)]*\))?/g,G;while((G=J.exec($))!==null){let K=G.index,q=G[0].match(/@markdown\(([^)]*)\)/),W=q?q[1]:"",U=K+G[0].length,z=1,B=U,_=-1;while(z>0&&B<$.length){let L=$.indexOf("@markdown",B),F=$.indexOf("@endmarkdown",B);if(F===-1)break;if(L!==-1&&L<F&&L!==K){let O=$[L+9];if(O==="("||O===`
2009
- `||O==="\r"||O===" "||O===void 0)z++;B=L+9}else{if(z--,z===0){_=F;break}B=F+12}}if(_===-1)continue;let j=$.slice(U,_),H=$.slice(K,_+12);Q.push({fullMatch:H,options:W,content:j,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((j)=>{let H=j.trim();if(H)z[H]=!0});let B={gfm:z.gfm??!0,breaks:z.breaks??!1},_=B5(W.trim(),B);X=X.split(K).join(_)}catch(z){let B=z instanceof Error?z.message:String(z),_=G0("Markdown Directive",`Error processing markdown: ${B}`,Y,$,U,K);X=X.split(K).join(_)}return X}async function r9($,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}),B5($.trim(),Q)}var Q7=b(()=>{H0()});function EG($){if(IG.set($.name,$),$.client)DG.set($.name,$.client)}function j4($){return EG($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,X,Q,J)=>{let G=kG(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 kG($,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 IG,DG;var G7=b(()=>{IG=new Map,DG=new Map});function K7($,Z=c1,Y={},X){return Z.sort((Q,J)=>Q-J).map((Q)=>{return`${I5($,{...Y,w:Q,fm:X})} ${Q}w`}).join(", ")}function a9($,Z,Y=bG,X={},Q){return Y.sort((J,G)=>J-G).map((J)=>{let G=Math.round(Z*J);return`${I5($,{...X,w:G,dpr:J,fm:Q})} ${J}x`}).join(", ")}function q7($,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 I5($,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 U7($){return SG[$]||"application/octet-stream"}var c1,bG,M5,SG;var W7=b(()=>{c1=[320,480,640,768,1024,1280,1536,1920,2560],bG=[1,1.5,2,3],M5=["avif","webp","jpeg"],SG={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function PG(){try{return await import("ts-images")}catch{return null}}async function CG($,Z={}){let Y={...yG,...Z},X=await PG();if(X)try{return await vG($,Y,X)}catch(Q){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Q}`)}return xG($,Y)}async function vG($,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 xG($,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 t9($,Z,Y={}){let X=Y.transitionDuration||300,Q=Y.easing||"ease-out";return`
2008
+ `;return W}var X7,NG=0,a;var H0=b(()=>{F5();c0();l1();_4();h1();a$();P9();I5();X7=new A5(500);a={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 r9($,Z,Y=""){let X=$,Q=[],J=/@markdown(?:\([^)]*\))?/g,G;while((G=J.exec($))!==null){let K=G.index,q=G[0].match(/@markdown\(([^)]*)\)/),U=q?q[1]:"",W=K+G[0].length,z=1,B=W,_=-1;while(z>0&&B<$.length){let L=$.indexOf("@markdown",B),F=$.indexOf("@endmarkdown",B);if(F===-1)break;if(L!==-1&&L<F&&L!==K){let O=$[L+9];if(O==="("||O===`
2009
+ `||O==="\r"||O===" "||O===void 0)z++;B=L+9}else{if(z--,z===0){_=F;break}B=F+12}}if(_===-1)continue;let j=$.slice(W,_),H=$.slice(K,_+12);Q.push({fullMatch:H,options:U,content:j,index:K}),J.lastIndex=_+12}for(let{fullMatch:K,options:q,content:U,index:W}of Q)try{let z={};if(q)q.split(",").forEach((j)=>{let H=j.trim();if(H)z[H]=!0});let B={gfm:z.gfm??!0,breaks:z.breaks??!1},_=j5(U.trim(),B);X=X.split(K).join(_)}catch(z){let B=z instanceof Error?z.message:String(z),_=G0("Markdown Directive",`Error processing markdown: ${B}`,Y,$,W,K);X=X.split(K).join(_)}return X}async function a9($,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}),j5($.trim(),Q)}var G7=b(()=>{H0()});function yG($){if(bG.set($.name,$),$.client)SG.set($.name,$.client)}function j4($){return yG($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,X,Q,J)=>{let G=PG(X,$.defaults);if($.validate){let q=$.validate(G);if(q!==!0){let U=typeof q==="string"?q:`Invalid parameters for @${$.name}`;throw Error(U)}}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 PG($,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 bG,SG;var K7=b(()=>{bG=new Map,SG=new Map});function q7($,Z=c1,Y={},X){return Z.sort((Q,J)=>Q-J).map((Q)=>{return`${E5($,{...Y,w:Q,fm:X})} ${Q}w`}).join(", ")}function t9($,Z,Y=CG,X={},Q){return Y.sort((J,G)=>J-G).map((J)=>{let G=Math.round(Z*J);return`${E5($,{...X,w:G,dpr:J,fm:Q})} ${J}x`}).join(", ")}function U7($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let X=Object.entries($).map(([Q,J])=>{let G=/^\d+$/.test(Q)?`${Q}px`:Q;return{bp:G,size:J,numericBp:Number.parseInt(G)||0}}).sort((Q,J)=>Q.numericBp-J.numericBp).map(({bp:Q,size:J})=>`(max-width: ${Q}) ${J}`);return X.push(Z),X.join(", ")}function E5($,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 W7($){return vG[$]||"application/octet-stream"}var c1,CG,D5,vG;var z7=b(()=>{c1=[320,480,640,768,1024,1280,1536,1920,2560],CG=[1,1.5,2,3],D5=["avif","webp","jpeg"],vG={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function fG(){try{return await import("ts-images")}catch{return null}}async function gG($,Z={}){let Y={...xG,...Z},X=await fG();if(X)try{return await hG($,Y,X)}catch(Q){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Q}`)}return dG($,Y)}async function hG($,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 dG($,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 e9($,Z,Y={}){let X=Y.transitionDuration||300,Q=Y.easing||"ease-out";return`
2010
2010
  #${$} {
2011
2011
  --stx-img-transition-duration: ${X}ms;
2012
2012
  --stx-img-transition-easing: ${Q};
@@ -2023,7 +2023,7 @@ ${a.dim}${K}${a.reset}
2023
2023
  #${$}.stx-img-loaded img {
2024
2024
  opacity: 1;
2025
2025
  }
2026
- `.trim()}async function e9($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if(z7.has(Y))return z7.get(Y);let X=await CG($,Z);return z7.set(Y,X),X}var yG,B7,z7;var $8=b(()=>{yG={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},B7=`
2026
+ `.trim()}async function $8($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if(B7.has(Y))return B7.get(Y);let X=await gG($,Z);return B7.set(Y,X),X}var xG,_7,B7;var Z8=b(()=>{xG={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},_7=`
2027
2027
  .stx-img-placeholder {
2028
2028
  position: relative;
2029
2029
  overflow: hidden;
@@ -2052,8 +2052,8 @@ ${a.dim}${K}${a.reset}
2052
2052
  filter: blur(0);
2053
2053
  transform: scale(1);
2054
2054
  }
2055
- `.trim();z7=new Map});import{createHash as Y8}from"crypto";import{readFile as fG,stat as X8}from"fs/promises";async function A0($){try{let Z=await fG($);return Y8("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function Z8($){return Y8("sha256").update($).digest("hex").slice(0,16)}function H4($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${Z8($)}-${Z8(Y)}`}async function _7($){try{return(await X8($)).mtimeMs}catch{return 0}}async function R0($){try{return await X8($),!0}catch{return!1}}var w1=()=>{};import{mkdir as gG,readFile as hG,writeFile as dG,readdir as hj,rm as mG,stat as dj}from"fs/promises";import{join as Q8,dirname as uG}from"path";async function lG($){try{await gG($,{recursive:!0})}catch{}}function G8($,Z,Y){return Q8($,Y,`${Z}.json`)}async function J8($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await _7(Z)!==$.srcMtime)return!1;return!0}async function O4($,Z,Y,X=j7){if(!X.enabled)return null;let Q=H4($,Z),J=i1.get(Q);if(J){if(await J8(J,$,X.maxAge))return J.lastAccessedAt=Date.now(),J.data;i1.delete(Q)}let G=G8(X.directory,Q,Y);if(await R0(G))try{let K=await hG(G,"utf-8"),q=JSON.parse(K);if(await J8(q,$,X.maxAge))return q.lastAccessedAt=Date.now(),i1.set(Q,q),q.data}catch{}return null}async function L4($,Z,Y,X,Q=j7){if(!Q.enabled)return;let J=H4($,Z),G=await A0($),K=await _7($),q={key:J,src:$,srcHash:G,srcMtime:K,optionsHash:H4("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};i1.set(J,q);let W=G8(Q.directory,J,X);try{await lG(uG(W)),await dG(W,JSON.stringify(q,null,2))}catch(U){console.warn(`[stx-media] Failed to write cache: ${U}`)}}async function F4($,Z=j7){if($==="all")i1.clear();else i1.clear();let Y=$==="all"?["image","video"]:[$];for(let X of Y){let Q=Q8(Z.directory,X);try{await mG(Q,{recursive:!0,force:!0})}catch{}}}var i1,j7;var H7=b(()=>{w1();i1=new Map,j7={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class R4{config;constructor($={}){this.config={...pG,...$}}async get($,Z){return O4($,Z,"image",this.config)}async set($,Z,Y){return L4($,Z,Y,"image",this.config)}async clear(){return F4("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function O7($){if(!V4)V4=new R4($);else if($)V4.updateConfig($);return V4}async function A4($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return O7(X).get($,Z)}async function N4($,Z,Y,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return O7(Q).set($,Z,Y)}async function K8(){return O7().clear()}var pG,V4=null;var L7=b(()=>{H7();pG={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as cG,basename as iG,extname as nG,join as oG}from"path";import{mkdir as sG}from"fs/promises";async function F7(){try{return await import("ts-images")}catch{return null}}function q8($){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 rG($,Z){let Y=Z?q8(Z):q8("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 U8($,Z,Y){let X=await F7();if(!X)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Q=await A4($,Z,Y);if(Q)return Q;try{let J=cG($);if(!await R0(J))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=rG(Y,Z.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await sG(K,{recursive:!0});let W=await A0(J),U=iG($,nG($)),z=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],B={src:$,processed:!0,variants:[],hash:W},_=null;if(Z.transformations&&Z.transformations.length>0)_=await V7(J,Z.transformations,X);for(let j of z){let H=G[j]||{},L=`${U}-${W}.${j}`,F=oG(K,L);try{let O=await X.optimizeImage({input:_||J,output:F,format:j,quality:H.quality,progressive:H.progressive});if(O){if(B.variants.push({path:F,url:`${q}/${L}`,width:O.width||0,height:O.height||0,format:j,size:O.outputSize||0}),!B.originalWidth&&O.width)B.originalWidth=O.width,B.originalHeight=O.height}}catch(O){B.errors=B.errors||[],B.errors.push(`Failed to optimize ${j}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let j=await X.generateThumbHash(J);B.placeholder=j.dataUrl}catch(j){B.errors=B.errors||[],B.errors.push(`Failed to generate thumbhash: ${j}`)}if(Z.useDominantColor)try{let j=await X.generatePlaceholder(J,{strategy:"dominant-color"});B.dominantColor=j.dominantColor}catch(j){B.errors=B.errors||[],B.errors.push(`Failed to extract dominant color: ${j}`)}return await N4($,Z,B,Y),B}catch(J){return{src:$,processed:!1,errors:[`Processing failed: ${J}`]}}}async function W8($,Z,Y,X){let Q=await F7();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 V7($,Z,Y){let X=Y||await F7();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 z8=b(()=>{w1();L7()});import{resolve as aG,basename as tG,extname as eG,join as $K}from"path";import{mkdir as ZK}from"fs/promises";async function YK(){try{return await import("ts-images")}catch{return null}}async function B8($,Z,Y){let X=await YK();if(!X)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Q=aG($);if(!await R0(Q))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let J=Z.responsiveWidths||Y.breakpoints||XK,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await ZK(K,{recursive:!0});let W=await A0(Q),U=tG($,eG($)),z=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},B={src:$,byFormat:{},srcsets:{}};for(let j of G){B.byFormat[j]=[];let H=[];for(let L of J){let F=`${U}-${L}w-${W}.${j}`,O=$K(K,F),V=`${q}/${F}`;try{let R=z[j]?.quality||80;if(await R0(O)){B.byFormat[j].push({path:O,url:V,width:L,height:0,format:j,size:0}),H.push(`${V} ${L}w`);continue}let A=await X.processImage({input:Q,output:O,format:j,quality:R,resize:{width:L}});if(A)B.byFormat[j].push({path:O,url:V,width:L,height:A.height||Math.round(L*(A.height||1)/(A.width||1)),format:j,size:A.outputSize||0}),H.push(`${V} ${L}w`)}catch(R){console.warn(`[stx-media] Failed to generate ${j} at ${L}w: ${R}`)}}B.srcsets[j]=H.join(", ")}let _=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(_!=="none")try{if(_==="thumbhash"){let j=await X.generateThumbHash(Q);B.placeholder={dataURL:j.dataUrl,width:j.width||32,height:j.height||32,strategy:"thumbhash"}}else{let j=await X.generatePlaceholder(Q,{strategy:_,width:20});B.placeholder={dataURL:j.dataURL,width:j.width,height:j.height,strategy:_}}}catch(j){console.warn(`[stx-media] Failed to generate placeholder: ${j}`)}return B.sizes=Z.sizes||JK(J),B}catch(J){return console.error(`[stx-media] Responsive generation failed: ${J}`),null}}function JK($){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 _8($,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 XK;var j8=b(()=>{w1();XK=[320,480,640,768,1024,1280,1536,1920]});var H8={};o(H8,{setCachedImageResult:()=>N4,processImage:()=>U8,optimizeImage:()=>W8,getCachedImageResult:()=>A4,generateSrcset:()=>_8,generateResponsiveVariants:()=>B8,clearImageCache:()=>K8,applyTransformations:()=>V7,ImageProcessorCache:()=>R4});var O8=b(()=>{z8();j8();L7()});async function QK(){try{return await Promise.resolve().then(() => (O8(),H8))}catch($){if(!L8)console.warn("[stx-media] Image processor not available, some features disabled:",$),L8=!0;return null}}async function w4($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return UK(X,Y)}if(Y.processedResult?.processed)return w7($,Y.processedResult,Z);if(Y.responsiveVariants)return A8($,Y.responsiveVariants,Z);let{src:Q,alt:J,width:G,height:K,sizes:q,widths:W=c1,dpr:U,formats:z=M5,quality:B=R7,params:_={},placeholder:j="none",placeholderOptions:H={},lazy:L=!0,priority:F=!1,loading:O=F?"eager":M4,decoding:V=T4,fetchpriority:R,objectFit:A,objectPosition:N,crossorigin:w,referrerpolicy:T}=$,M=$.class,I=$.style,D=$.id,E=$.data||{},{isDev:C=!1,baseUrl:S=""}=Z;if(C&&!Z.optimize)return qK($);let k,P,d=D||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!F)try{k=await e9(Q,{strategy:j,...H}),P=t9(d,k,H)}catch{}let g=U!==void 0&&G!==void 0,m;if(g)m=KK($,d,k,Z);else m=await GK($,d,k,Z);let s;if(F){let P0=z.includes("webp")?"webp":z[0],T0=K7(Q,W,{..._,q:B},P0),e=typeof q==="object"?q7(q):q||"100vw";s=`<link rel="preload" as="image" imagesrcset="${T0}" imagesizes="${e}" />`}let Z0=[];if(!F8&&j!=="none")Z0.push(B7),F8=!0;if(P)Z0.push(P);let o0=L?R8(d):void 0;return{html:m,preloadLink:s,css:Z0.length>0?Z0.join(`
2056
- `):void 0,script:o0}}async function GK($,Z,Y,X){let{src:Q,alt:J,width:G,height:K,sizes:q,widths:W=c1,formats:U=M5,quality:z=R7,params:B={},lazy:_=!0,priority:j=!1,loading:H=j?"eager":M4,decoding:L=T4,fetchpriority:F,objectFit:O,objectPosition:V,crossorigin:R,referrerpolicy:A}=$,N=$.class,w=$.style,T=$.data||{},M=typeof q==="object"?q7(q):q||"100vw",I=[];for(let C of U){let S=K7(Q,W,{...B,q:z},C),k=U7(C);if(_&&!j)I.push(` <source type="${k}" data-srcset="${S}" data-sizes="${M}" />`);else I.push(` <source type="${k}" srcset="${S}" sizes="${M}" />`)}let D=A7({src:I5(Q,{...B,q:z}),alt:J,width:G,height:K,loading:j?void 0:H,decoding:L,fetchpriority:j?"high":F,objectFit:O,objectPosition:V,crossorigin:R,referrerpolicy:A,className:V8(N,Y),style:N7(w,O,V,Y),lazy:_&&!j,data:T}),E;if(Y){let C=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;E=`<div id="${Z}" class="stx-img-placeholder" style="${C}">
2055
+ `.trim();B7=new Map});import{createHash as X8}from"crypto";import{readFile as mG,stat as J8}from"fs/promises";async function A0($){try{let Z=await mG($);return X8("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function Y8($){return X8("sha256").update($).digest("hex").slice(0,16)}function H4($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${Y8($)}-${Y8(Y)}`}async function j7($){try{return(await J8($)).mtimeMs}catch{return 0}}async function R0($){try{return await J8($),!0}catch{return!1}}var w1=()=>{};import{mkdir as uG,readFile as lG,writeFile as pG,readdir as lj,rm as cG,stat as pj}from"fs/promises";import{join as G8,dirname as iG}from"path";async function nG($){try{await uG($,{recursive:!0})}catch{}}function K8($,Z,Y){return G8($,Y,`${Z}.json`)}async function Q8($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await j7(Z)!==$.srcMtime)return!1;return!0}async function O4($,Z,Y,X=H7){if(!X.enabled)return null;let Q=H4($,Z),J=i1.get(Q);if(J){if(await Q8(J,$,X.maxAge))return J.lastAccessedAt=Date.now(),J.data;i1.delete(Q)}let G=K8(X.directory,Q,Y);if(await R0(G))try{let K=await lG(G,"utf-8"),q=JSON.parse(K);if(await Q8(q,$,X.maxAge))return q.lastAccessedAt=Date.now(),i1.set(Q,q),q.data}catch{}return null}async function L4($,Z,Y,X,Q=H7){if(!Q.enabled)return;let J=H4($,Z),G=await A0($),K=await j7($),q={key:J,src:$,srcHash:G,srcMtime:K,optionsHash:H4("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};i1.set(J,q);let U=K8(Q.directory,J,X);try{await nG(iG(U)),await pG(U,JSON.stringify(q,null,2))}catch(W){console.warn(`[stx-media] Failed to write cache: ${W}`)}}async function F4($,Z=H7){if($==="all")i1.clear();else i1.clear();let Y=$==="all"?["image","video"]:[$];for(let X of Y){let Q=G8(Z.directory,X);try{await cG(Q,{recursive:!0,force:!0})}catch{}}}var i1,H7;var O7=b(()=>{w1();i1=new Map,H7={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class R4{config;constructor($={}){this.config={...oG,...$}}async get($,Z){return O4($,Z,"image",this.config)}async set($,Z,Y){return L4($,Z,Y,"image",this.config)}async clear(){return F4("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function L7($){if(!V4)V4=new R4($);else if($)V4.updateConfig($);return V4}async function N4($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return L7(X).get($,Z)}async function A4($,Z,Y,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return L7(Q).set($,Z,Y)}async function q8(){return L7().clear()}var oG,V4=null;var F7=b(()=>{O7();oG={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as sG,basename as rG,extname as aG,join as tG}from"path";import{mkdir as eG}from"fs/promises";async function V7(){try{return await import("ts-images")}catch{return null}}function U8($){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 $K($,Z){let Y=Z?U8(Z):U8("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 W8($,Z,Y){let X=await V7();if(!X)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Q=await N4($,Z,Y);if(Q)return Q;try{let J=sG($);if(!await R0(J))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=$K(Y,Z.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await eG(K,{recursive:!0});let U=await A0(J),W=rG($,aG($)),z=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],B={src:$,processed:!0,variants:[],hash:U},_=null;if(Z.transformations&&Z.transformations.length>0)_=await R7(J,Z.transformations,X);for(let j of z){let H=G[j]||{},L=`${W}-${U}.${j}`,F=tG(K,L);try{let O=await X.optimizeImage({input:_||J,output:F,format:j,quality:H.quality,progressive:H.progressive});if(O){if(B.variants.push({path:F,url:`${q}/${L}`,width:O.width||0,height:O.height||0,format:j,size:O.outputSize||0}),!B.originalWidth&&O.width)B.originalWidth=O.width,B.originalHeight=O.height}}catch(O){B.errors=B.errors||[],B.errors.push(`Failed to optimize ${j}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let j=await X.generateThumbHash(J);B.placeholder=j.dataUrl}catch(j){B.errors=B.errors||[],B.errors.push(`Failed to generate thumbhash: ${j}`)}if(Z.useDominantColor)try{let j=await X.generatePlaceholder(J,{strategy:"dominant-color"});B.dominantColor=j.dominantColor}catch(j){B.errors=B.errors||[],B.errors.push(`Failed to extract dominant color: ${j}`)}return await A4($,Z,B,Y),B}catch(J){return{src:$,processed:!1,errors:[`Processing failed: ${J}`]}}}async function z8($,Z,Y,X){let Q=await V7();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 R7($,Z,Y){let X=Y||await V7();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 B8=b(()=>{w1();F7()});import{resolve as ZK,basename as YK,extname as XK,join as JK}from"path";import{mkdir as QK}from"fs/promises";async function GK(){try{return await import("ts-images")}catch{return null}}async function _8($,Z,Y){let X=await GK();if(!X)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Q=ZK($);if(!await R0(Q))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let J=Z.responsiveWidths||Y.breakpoints||KK,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await QK(K,{recursive:!0});let U=await A0(Q),W=YK($,XK($)),z=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},B={src:$,byFormat:{},srcsets:{}};for(let j of G){B.byFormat[j]=[];let H=[];for(let L of J){let F=`${W}-${L}w-${U}.${j}`,O=JK(K,F),V=`${q}/${F}`;try{let R=z[j]?.quality||80;if(await R0(O)){B.byFormat[j].push({path:O,url:V,width:L,height:0,format:j,size:0}),H.push(`${V} ${L}w`);continue}let N=await X.processImage({input:Q,output:O,format:j,quality:R,resize:{width:L}});if(N)B.byFormat[j].push({path:O,url:V,width:L,height:N.height||Math.round(L*(N.height||1)/(N.width||1)),format:j,size:N.outputSize||0}),H.push(`${V} ${L}w`)}catch(R){console.warn(`[stx-media] Failed to generate ${j} at ${L}w: ${R}`)}}B.srcsets[j]=H.join(", ")}let _=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(_!=="none")try{if(_==="thumbhash"){let j=await X.generateThumbHash(Q);B.placeholder={dataURL:j.dataUrl,width:j.width||32,height:j.height||32,strategy:"thumbhash"}}else{let j=await X.generatePlaceholder(Q,{strategy:_,width:20});B.placeholder={dataURL:j.dataURL,width:j.width,height:j.height,strategy:_}}}catch(j){console.warn(`[stx-media] Failed to generate placeholder: ${j}`)}return B.sizes=Z.sizes||qK(J),B}catch(J){return console.error(`[stx-media] Responsive generation failed: ${J}`),null}}function qK($){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 j8($,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 KK;var H8=b(()=>{w1();KK=[320,480,640,768,1024,1280,1536,1920]});var O8={};o(O8,{setCachedImageResult:()=>A4,processImage:()=>W8,optimizeImage:()=>z8,getCachedImageResult:()=>N4,generateSrcset:()=>j8,generateResponsiveVariants:()=>_8,clearImageCache:()=>q8,applyTransformations:()=>R7,ImageProcessorCache:()=>R4});var L8=b(()=>{B8();H8();F7()});async function UK(){try{return await Promise.resolve().then(() => (L8(),O8))}catch($){if(!F8)console.warn("[stx-media] Image processor not available, some features disabled:",$),F8=!0;return null}}async function w4($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return _K(X,Y)}if(Y.processedResult?.processed)return T7($,Y.processedResult,Z);if(Y.responsiveVariants)return A8($,Y.responsiveVariants,Z);let{src:Q,alt:J,width:G,height:K,sizes:q,widths:U=c1,dpr:W,formats:z=D5,quality:B=N7,params:_={},placeholder:j="none",placeholderOptions:H={},lazy:L=!0,priority:F=!1,loading:O=F?"eager":M4,decoding:V=T4,fetchpriority:R,objectFit:N,objectPosition:A,crossorigin:w,referrerpolicy:T}=$,M=$.class,I=$.style,D=$.id,E=$.data||{},{isDev:C=!1,baseUrl:S=""}=Z;if(C&&!Z.optimize)return BK($);let k,y,d=D||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!F)try{k=await $8(Q,{strategy:j,...H}),y=e9(d,k,H)}catch{}let g=W!==void 0&&G!==void 0,m;if(g)m=zK($,d,k,Z);else m=await WK($,d,k,Z);let s;if(F){let P0=z.includes("webp")?"webp":z[0],M0=q7(Q,U,{..._,q:B},P0),e=typeof q==="object"?U7(q):q||"100vw";s=`<link rel="preload" as="image" imagesrcset="${M0}" imagesizes="${e}" />`}let Z0=[];if(!V8&&j!=="none")Z0.push(_7),V8=!0;if(y)Z0.push(y);let o0=L?N8(d):void 0;return{html:m,preloadLink:s,css:Z0.length>0?Z0.join(`
2056
+ `):void 0,script:o0}}async function WK($,Z,Y,X){let{src:Q,alt:J,width:G,height:K,sizes:q,widths:U=c1,formats:W=D5,quality:z=N7,params:B={},lazy:_=!0,priority:j=!1,loading:H=j?"eager":M4,decoding:L=T4,fetchpriority:F,objectFit:O,objectPosition:V,crossorigin:R,referrerpolicy:N}=$,A=$.class,w=$.style,T=$.data||{},M=typeof q==="object"?U7(q):q||"100vw",I=[];for(let C of W){let S=q7(Q,U,{...B,q:z},C),k=W7(C);if(_&&!j)I.push(` <source type="${k}" data-srcset="${S}" data-sizes="${M}" />`);else I.push(` <source type="${k}" srcset="${S}" sizes="${M}" />`)}let D=A7({src:E5(Q,{...B,q:z}),alt:J,width:G,height:K,loading:j?void 0:H,decoding:L,fetchpriority:j?"high":F,objectFit:O,objectPosition:V,crossorigin:R,referrerpolicy:N,className:R8(A,Y),style:w7(w,O,V,Y),lazy:_&&!j,data:T}),E;if(Y){let C=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;E=`<div id="${Z}" class="stx-img-placeholder" style="${C}">
2057
2057
  <picture>
2058
2058
  ${I.join(`
2059
2059
  `)}
@@ -2063,9 +2063,9 @@ ${I.join(`
2063
2063
  ${I.join(`
2064
2064
  `)}
2065
2065
  <img ${D} />
2066
- </picture>`;return E}function KK($,Z,Y,X){let{src:Q,alt:J,width:G,height:K,dpr:q=[1,2,3],quality:W=R7,params:U={},lazy:z=!0,priority:B=!1,loading:_=B?"eager":M4,decoding:j=T4,fetchpriority:H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V}=$,R=$.class,A=$.style,N=$.data||{},w=typeof G==="number"?G:Number.parseInt(String(G),10),T=a9(Q,w,q,{...U,q:W}),M=A7({src:I5(Q,{...U,w,q:W}),alt:J,width:G,height:K,loading:B?void 0:_,decoding:j,fetchpriority:B?"high":H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V,className:V8(R,Y),style:N7(A,L,F,Y),lazy:z&&!B,data:N}),I=z&&!B?`data-srcset="${T}"`:`srcset="${T}"`;if(Y){let D=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${D}">
2066
+ </picture>`;return E}function zK($,Z,Y,X){let{src:Q,alt:J,width:G,height:K,dpr:q=[1,2,3],quality:U=N7,params:W={},lazy:z=!0,priority:B=!1,loading:_=B?"eager":M4,decoding:j=T4,fetchpriority:H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V}=$,R=$.class,N=$.style,A=$.data||{},w=typeof G==="number"?G:Number.parseInt(String(G),10),T=t9(Q,w,q,{...W,q:U}),M=A7({src:E5(Q,{...W,w,q:U}),alt:J,width:G,height:K,loading:B?void 0:_,decoding:j,fetchpriority:B?"high":H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V,className:R8(R,Y),style:w7(N,L,F,Y),lazy:z&&!B,data:A}),I=z&&!B?`data-srcset="${T}"`:`srcset="${T}"`;if(Y){let D=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${D}">
2067
2067
  <img ${M} ${I} />
2068
- </div>`}return`<img ${Z?`id="${Z}" `:""}${M} ${I} />`}function qK($){let{src:Z,alt:Y,width:X,height:Q,loading:J=M4,decoding:G=T4,fetchpriority:K,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:z,priority:B=!1}=$,_=$.class,j=$.style,H=$.id,L=$.data||{};return{html:`<img ${A7({src:Z,alt:Y,width:X,height:Q,loading:B?"eager":J,decoding:G,fetchpriority:B?"high":K,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:z,className:_,style:N7(j,q,W),id:H,data:L})} />`}}function A7($){let Z=[];if($.lazy)Z.push(`data-src="${d0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${d0($.src)}"`);if(Z.push(`alt="${d0($.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="${d0($.className)}"`);if($.style)Z.push(`style="${d0($.style)}"`);if($.id)Z.push(`id="${d0($.id)}"`);if($.data)for(let[Y,X]of Object.entries($.data))Z.push(`data-${Y}="${d0(X)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function V8($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function N7($,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 d0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function R8($){return`
2068
+ </div>`}return`<img ${Z?`id="${Z}" `:""}${M} ${I} />`}function BK($){let{src:Z,alt:Y,width:X,height:Q,loading:J=M4,decoding:G=T4,fetchpriority:K,objectFit:q,objectPosition:U,crossorigin:W,referrerpolicy:z,priority:B=!1}=$,_=$.class,j=$.style,H=$.id,L=$.data||{};return{html:`<img ${A7({src:Z,alt:Y,width:X,height:Q,loading:B?"eager":J,decoding:G,fetchpriority:B?"high":K,objectFit:q,objectPosition:U,crossorigin:W,referrerpolicy:z,className:_,style:w7(j,q,U),id:H,data:L})} />`}}function A7($){let Z=[];if($.lazy)Z.push(`data-src="${d0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${d0($.src)}"`);if(Z.push(`alt="${d0($.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="${d0($.className)}"`);if($.style)Z.push(`style="${d0($.style)}"`);if($.id)Z.push(`id="${d0($.id)}"`);if($.data)for(let[Y,X]of Object.entries($.data))Z.push(`data-${Y}="${d0(X)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function R8($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function w7($,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 d0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function N8($){return`
2069
2069
  (function() {
2070
2070
  const container = document.getElementById('${$}');
2071
2071
  if (!container) return;
@@ -2102,22 +2102,22 @@ ${I.join(`
2102
2102
 
2103
2103
  observer.observe(container);
2104
2104
  })();
2105
- `.trim()}async function UK($,Z){let Y=await QK();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 A8($,J,Z)}else{let J=await Y.processImage($.src,$,X);if(J.processed)return w7($,J,Z)}return w4({...$,process:!1},Z)}async function w7($,Z,Y){let{alt:X,width:Q,height:J,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:z}=$,B=$.class,_=$.style,j=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=$.data||{},L=Z.variants||[],F=L.find((P)=>P.format==="jpeg")||L.find((P)=>P.format==="webp")||L[0],O=F?.url||$.src,V=L.filter((P)=>P.format===(F?.format||"jpeg")).map((P)=>`${P.url} ${P.width}w`).join(", "),R=new Map;for(let P of L){if(!R.has(P.format))R.set(P.format,[]);R.get(P.format).push(P)}let A=[],N=["avif","webp","jpeg","png"];for(let P of N){let d=R.get(P);if(d&&d.length>0){let g=d.map((s)=>`${s.url} ${s.width}w`).join(", "),m=U7(P);if(G&&!K)A.push(` <source type="${m}" data-srcset="${g}" />`);else A.push(` <source type="${m}" srcset="${g}" />`)}}let w=[];if(G&&!K){if(w.push(`data-src="${d0(O)}"`),w.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)w.push(`data-srcset="${V}"`)}else if(w.push(`src="${d0(O)}"`),V)w.push(`srcset="${V}"`);w.push(`alt="${d0(X)}"`);let T=Q||Z.originalWidth,M=J||Z.originalHeight;if(T)w.push(`width="${T}"`);if(M)w.push(`height="${M}"`);if(!K)w.push(`loading="${G?"lazy":"eager"}"`);if(w.push('decoding="async"'),K)w.push('fetchpriority="high"');if(U)w.push(`crossorigin="${U}"`);if(z)w.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)w.push(`style="${I.join("; ")}"`);let D=[];if(B)D.push(B);if(Z.placeholder)D.push("stx-img-blur");if(D.length>0)w.push(`class="${D.join(" ")}"`);if(G&&!K)w.push("data-stx-lazy");for(let[P,d]of Object.entries(H))w.push(`data-${P}="${d0(d)}"`);let E;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let P=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;E=`<div id="${j}" class="stx-img-placeholder" style="${P}">
2105
+ `.trim()}async function _K($,Z){let Y=await UK();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 A8($,J,Z)}else{let J=await Y.processImage($.src,$,X);if(J.processed)return T7($,J,Z)}return w4({...$,process:!1},Z)}async function T7($,Z,Y){let{alt:X,width:Q,height:J,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:U,crossorigin:W,referrerpolicy:z}=$,B=$.class,_=$.style,j=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=$.data||{},L=Z.variants||[],F=L.find((y)=>y.format==="jpeg")||L.find((y)=>y.format==="webp")||L[0],O=F?.url||$.src,V=L.filter((y)=>y.format===(F?.format||"jpeg")).map((y)=>`${y.url} ${y.width}w`).join(", "),R=new Map;for(let y of L){if(!R.has(y.format))R.set(y.format,[]);R.get(y.format).push(y)}let N=[],A=["avif","webp","jpeg","png"];for(let y of A){let d=R.get(y);if(d&&d.length>0){let g=d.map((s)=>`${s.url} ${s.width}w`).join(", "),m=W7(y);if(G&&!K)N.push(` <source type="${m}" data-srcset="${g}" />`);else N.push(` <source type="${m}" srcset="${g}" />`)}}let w=[];if(G&&!K){if(w.push(`data-src="${d0(O)}"`),w.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)w.push(`data-srcset="${V}"`)}else if(w.push(`src="${d0(O)}"`),V)w.push(`srcset="${V}"`);w.push(`alt="${d0(X)}"`);let T=Q||Z.originalWidth,M=J||Z.originalHeight;if(T)w.push(`width="${T}"`);if(M)w.push(`height="${M}"`);if(!K)w.push(`loading="${G?"lazy":"eager"}"`);if(w.push('decoding="async"'),K)w.push('fetchpriority="high"');if(W)w.push(`crossorigin="${W}"`);if(z)w.push(`referrerpolicy="${z}"`);let I=[];if(q)I.push(`object-fit: ${q}`);if(U)I.push(`object-position: ${U}`);if(Z.placeholder&&G)I.push("opacity: 0; transition: opacity 300ms ease-out");if(_)I.push(_);if(I.length>0)w.push(`style="${I.join("; ")}"`);let D=[];if(B)D.push(B);if(Z.placeholder)D.push("stx-img-blur");if(D.length>0)w.push(`class="${D.join(" ")}"`);if(G&&!K)w.push("data-stx-lazy");for(let[y,d]of Object.entries(H))w.push(`data-${y}="${d0(d)}"`);let E;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let y=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;E=`<div id="${j}" class="stx-img-placeholder" style="${y}">
2106
2106
  <picture>
2107
- ${A.join(`
2107
+ ${N.join(`
2108
2108
  `)}
2109
2109
  <img ${w.join(" ")} />
2110
2110
  </picture>
2111
2111
  </div>`}else E=`<picture${j?` id="${j}"`:""}>
2112
- ${A.join(`
2112
+ ${N.join(`
2113
2113
  `)}
2114
2114
  <img ${w.join(" ")} />
2115
- </picture>`;let C=[];if(Z.placeholder)C.push(B7);let S=G?R8(j):void 0,k;if(K&&V)k=`<link rel="preload" as="image" imagesrcset="${V}" />`;return{html:E,preloadLink:k,css:C.length>0?C.join(`
2116
- `):void 0,script:S}}async function A8($,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 w7($,X,Y)}var L8=!1,R7=80,T4="async",M4="lazy",F8=!1;var N8=b(()=>{W7();$8()});function WK(){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}=zK($,Z,Y);if(!Q)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:Q,alt:J||"",widths:G.widths||c1,formats:G.formats||M5,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+`
2117
- `+U;if(W.css)U+=`
2118
- <style>${W.css}</style>`;if(W.script)U+=`
2119
- <script>${W.script}</script>`;return U},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function zK($,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=BK(X),J=T7(Q[0],Y)||"",G=T7(Q[1],Y)||"",K={};if(Q[2]){let q=T7(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 BK($){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 T7($,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 w8;var T8=b(()=>{G7();N8();W7();w8=WK()});class D4{config;constructor($={}){this.config={..._K,...$}}async get($,Z){return O4($,Z,"video",this.config)}async set($,Z,Y){return L4($,Z,Y,"video",this.config)}async clear(){return F4("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function M7($){if(!I4)I4=new D4($);else if($)I4.updateConfig($);return I4}async function E4($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return M7(X).get($,Z)}async function k4($,Z,Y,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return M7(Q).set($,Z,Y)}async function M8(){return M7().clear()}var _K,I4=null;var I7=b(()=>{H7();_K={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as D7,basename as E7,extname as k7,join as b4}from"path";import{mkdir as b7}from"fs/promises";async function S7(){try{return await import("ts-videos")}catch{return null}}async function S4($,Z,Y,X){let Q=await S7();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let J=D7($);if(!await R0(J))return null;await b7(Y,{recursive:!0});let G=await A0(J),K=E7($,k7($)),q=Z.format||"webp",W=Z.timestamp||0,U=`${K}-poster-${G}.${q}`,z=b4(Y,U),B=await Q.extractThumbnails(J,{timestamps:[W],width:Z.width||1280,height:Z.height,format:q,quality:Z.quality||85,outputDir:Y,outputPattern:U.replace(`.${q}`,"")});if(B&&B.length>0){let _=B[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 y4($,Z,Y,X){let Q=await S7();if(!Q)return[];try{let J=D7($);if(!await R0(J))return[];await b7(Y,{recursive:!0});let G=await A0(J),K=E7($,k7($)),q=Z.format||"webp",z=(await new Q.Input(J).getInfo()).duration||60,B=Z.count||10,_=Z.interval||z/B,j=[];for(let L=0;L<B&&L*_<z;L++)j.push(L*_);let H=await Q.extractThumbnails(J,{timestamps:j,width:Z.width||320,format:q,quality:Z.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${G}`});if(H&&H.length>0)return H.map((L,F)=>({path:L.path||b4(Y,`${K}-thumb-${G}-${F}.${q}`),url:`${X}/${K}-thumb-${G}-${F}.${q}`,width:L.width||Z.width||320,height:L.height||180,timestamp:j[F],size:L.size||0}));return[]}catch(J){return console.warn(`[stx-media] Failed to generate thumbnails: ${J}`),[]}}async function I8($,Z,Y,X){let Q=await S7();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let J=D7($);if(!await R0(J))return null;await b7(Y,{recursive:!0});let G=await A0(J),K=E7($,k7($)),U=(await new Q.Input(J).getInfo()).duration||60,z=Z.columns||10,B=Z.interval||5,_=Z.thumbnailWidth||160,j=Z.thumbnailHeight||90,H=Z.format||"jpeg",L=Math.ceil(U/B),F=Math.ceil(L/z),O=`${K}-sprite-${G}.${H}`,V=b4(Y,O),R=[];for(let N=0;N<L;N++)R.push(N*B);let A=await Q.extractThumbnails(J,{timestamps:R,width:_,height:j,format:H,quality:Z.quality||70,outputDir:b4(Y,".temp")});if(!A||A.length===0)return null;try{let N=await import("ts-images"),w=z*_,T=F*j,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:j,interval:B,totalFrames:L}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(J){return console.warn(`[stx-media] Failed to generate sprite sheet: ${J}`),null}}var y7=b(()=>{w1()});import{resolve as E8,basename as k8,extname as b8,join as T1}from"path";import{mkdir as P4,writeFile as S8}from"fs/promises";async function y8(){try{return await import("ts-videos")}catch{return null}}async function C4($,Z,Y,X,Q){let J=await y8();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=E8($);if(!await R0(G))return null;let K=await A0(G),q=k8($,b8($)),W=T1(Y,`${q}-${K}-hls`);await P4(W,{recursive:!0});let U=Z.length>0?Z:P8,z=Q?.segmentDuration||6,j=(await new J.Input(G).getInfo()).duration||0,H=[],L=0;for(let V of U){let R=T1(W,V.label);await P4(R,{recursive:!0});let A=`${V.label}.m3u8`,N=T1(R,A);try{let w=await J.generateHLS(G,{outputDir:R,segmentDuration:z,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(w)H.push({quality:V,url:`${X}/${q}-${K}-hls/${V.label}/${A}`,path:N}),L+=w.segmentCount||Math.ceil(j/z)}catch(w){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${w}`)}}if(H.length===0)return null;let F=T1(W,"master.m3u8"),O=jK(H,X,q,K);return await S8(F,O),{manifestUrl:`${X}/${q}-${K}-hls/master.m3u8`,manifestPath:F,playlists:H,segmentCount:L,duration:j}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function jK($,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(`
2120
- `)}async function v4($,Z,Y,X,Q){let J=await y8();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=E8($);if(!await R0(G))return null;let K=await A0(G),q=k8($,b8($)),W=T1(Y,`${q}-${K}-dash`);await P4(W,{recursive:!0});let U=Z.length>0?Z:P8,z=Q?.segmentDuration||4,B=Q?.minBufferTime||2,H=(await new J.Input(G).getInfo()).duration||0,L=[],F=[];for(let A of U){let N=T1(W,A.label);await P4(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(w){console.warn(`[stx-media] Failed to generate DASH for ${A.label}: ${w}`)}}if(L.length===0)return null;let O=T1(W,"manifest.mpd"),V=HK(L,F,H,z,B);await S8(O,V);let R=[{type:"video",representations:L}];if(F.length>0)R.push({type:"audio",representations:F});return{manifestUrl:`${X}/${q}-${K}-dash/manifest.mpd`,manifestPath:O,adaptationSets:R,duration:H}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function HK($,Z,Y,X,Q){let J=D8(Y),G=D8(Q),K=`<?xml version="1.0" encoding="UTF-8"?>
2115
+ </picture>`;let C=[];if(Z.placeholder)C.push(_7);let S=G?N8(j):void 0,k;if(K&&V)k=`<link rel="preload" as="image" imagesrcset="${V}" />`;return{html:E,preloadLink:k,css:C.length>0?C.join(`
2116
+ `):void 0,script:S}}async function A8($,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 T7($,X,Y)}var F8=!1,N7=80,T4="async",M4="lazy",V8=!1;var w8=b(()=>{z7();Z8()});function jK(){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}=HK($,Z,Y);if(!Q)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:Q,alt:J||"",widths:G.widths||c1,formats:G.formats||D5,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,U=await w4(K,{isDev:q}),W=U.html;if(U.preloadLink)W=U.preloadLink+`
2117
+ `+W;if(U.css)W+=`
2118
+ <style>${U.css}</style>`;if(U.script)W+=`
2119
+ <script>${U.script}</script>`;return W},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function HK($,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=OK(X),J=M7(Q[0],Y)||"",G=M7(Q[1],Y)||"",K={};if(Q[2]){let q=M7(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 OK($){let Z=[],Y="",X=!1,Q="",J=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],U=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&U!=="\\"){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 M7($,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 T8;var M8=b(()=>{K7();w8();z7();T8=jK()});class D4{config;constructor($={}){this.config={...LK,...$}}async get($,Z){return O4($,Z,"video",this.config)}async set($,Z,Y){return L4($,Z,Y,"video",this.config)}async clear(){return F4("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function I7($){if(!I4)I4=new D4($);else if($)I4.updateConfig($);return I4}async function E4($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return I7(X).get($,Z)}async function k4($,Z,Y,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return I7(Q).set($,Z,Y)}async function I8(){return I7().clear()}var LK,I4=null;var D7=b(()=>{O7();LK={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as E7,basename as k7,extname as b7,join as b4}from"path";import{mkdir as S7}from"fs/promises";async function y7(){try{return await import("ts-videos")}catch{return null}}async function S4($,Z,Y,X){let Q=await y7();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let J=E7($);if(!await R0(J))return null;await S7(Y,{recursive:!0});let G=await A0(J),K=k7($,b7($)),q=Z.format||"webp",U=Z.timestamp||0,W=`${K}-poster-${G}.${q}`,z=b4(Y,W),B=await Q.extractThumbnails(J,{timestamps:[U],width:Z.width||1280,height:Z.height,format:q,quality:Z.quality||85,outputDir:Y,outputPattern:W.replace(`.${q}`,"")});if(B&&B.length>0){let _=B[0];return{path:z,url:`${X}/${W}`,width:_.width||Z.width||1280,height:_.height||720,timestamp:U,size:_.size||0}}return null}catch(J){return console.warn(`[stx-media] Failed to generate poster: ${J}`),null}}async function y4($,Z,Y,X){let Q=await y7();if(!Q)return[];try{let J=E7($);if(!await R0(J))return[];await S7(Y,{recursive:!0});let G=await A0(J),K=k7($,b7($)),q=Z.format||"webp",z=(await new Q.Input(J).getInfo()).duration||60,B=Z.count||10,_=Z.interval||z/B,j=[];for(let L=0;L<B&&L*_<z;L++)j.push(L*_);let H=await Q.extractThumbnails(J,{timestamps:j,width:Z.width||320,format:q,quality:Z.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${G}`});if(H&&H.length>0)return H.map((L,F)=>({path:L.path||b4(Y,`${K}-thumb-${G}-${F}.${q}`),url:`${X}/${K}-thumb-${G}-${F}.${q}`,width:L.width||Z.width||320,height:L.height||180,timestamp:j[F],size:L.size||0}));return[]}catch(J){return console.warn(`[stx-media] Failed to generate thumbnails: ${J}`),[]}}async function D8($,Z,Y,X){let Q=await y7();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let J=E7($);if(!await R0(J))return null;await S7(Y,{recursive:!0});let G=await A0(J),K=k7($,b7($)),W=(await new Q.Input(J).getInfo()).duration||60,z=Z.columns||10,B=Z.interval||5,_=Z.thumbnailWidth||160,j=Z.thumbnailHeight||90,H=Z.format||"jpeg",L=Math.ceil(W/B),F=Math.ceil(L/z),O=`${K}-sprite-${G}.${H}`,V=b4(Y,O),R=[];for(let A=0;A<L;A++)R.push(A*B);let N=await Q.extractThumbnails(J,{timestamps:R,width:_,height:j,format:H,quality:Z.quality||70,outputDir:b4(Y,".temp")});if(!N||N.length===0)return null;try{let A=await import("ts-images"),w=z*_,T=F*j,M=await A.createSprite({images:N.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:j,interval:B,totalFrames:L}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(J){return console.warn(`[stx-media] Failed to generate sprite sheet: ${J}`),null}}var P7=b(()=>{w1()});import{resolve as k8,basename as b8,extname as S8,join as T1}from"path";import{mkdir as P4,writeFile as y8}from"fs/promises";async function P8(){try{return await import("ts-videos")}catch{return null}}async function C4($,Z,Y,X,Q){let J=await P8();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=k8($);if(!await R0(G))return null;let K=await A0(G),q=b8($,S8($)),U=T1(Y,`${q}-${K}-hls`);await P4(U,{recursive:!0});let W=Z.length>0?Z:C8,z=Q?.segmentDuration||6,j=(await new J.Input(G).getInfo()).duration||0,H=[],L=0;for(let V of W){let R=T1(U,V.label);await P4(R,{recursive:!0});let N=`${V.label}.m3u8`,A=T1(R,N);try{let w=await J.generateHLS(G,{outputDir:R,segmentDuration:z,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(w)H.push({quality:V,url:`${X}/${q}-${K}-hls/${V.label}/${N}`,path:A}),L+=w.segmentCount||Math.ceil(j/z)}catch(w){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${w}`)}}if(H.length===0)return null;let F=T1(U,"master.m3u8"),O=FK(H,X,q,K);return await y8(F,O),{manifestUrl:`${X}/${q}-${K}-hls/master.m3u8`,manifestPath:F,playlists:H,segmentCount:L,duration:j}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function FK($,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(`
2120
+ `)}async function v4($,Z,Y,X,Q){let J=await P8();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=k8($);if(!await R0(G))return null;let K=await A0(G),q=b8($,S8($)),U=T1(Y,`${q}-${K}-dash`);await P4(U,{recursive:!0});let W=Z.length>0?Z:C8,z=Q?.segmentDuration||4,B=Q?.minBufferTime||2,H=(await new J.Input(G).getInfo()).duration||0,L=[],F=[];for(let N of W){let A=T1(U,N.label);await P4(A,{recursive:!0});try{if(await J.generateDASH(G,{outputDir:A,segmentDuration:z,width:N.width,height:N.height,videoBitrate:N.bitrate,audioBitrate:N.audioBitrate})){if(L.push({bandwidth:N.bitrate,width:N.width,height:N.height||Math.round(N.width*9/16),url:`${X}/${q}-${K}-dash/${N.label}/video`}),N.audioBitrate)F.push({bandwidth:N.audioBitrate,url:`${X}/${q}-${K}-dash/${N.label}/audio`})}}catch(w){console.warn(`[stx-media] Failed to generate DASH for ${N.label}: ${w}`)}}if(L.length===0)return null;let O=T1(U,"manifest.mpd"),V=VK(L,F,H,z,B);await y8(O,V);let R=[{type:"video",representations:L}];if(F.length>0)R.push({type:"audio",representations:F});return{manifestUrl:`${X}/${q}-${K}-dash/manifest.mpd`,manifestPath:O,adaptationSets:R,duration:H}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function VK($,Z,Y,X,Q){let J=E8(Y),G=E8(Q),K=`<?xml version="1.0" encoding="UTF-8"?>
2121
2121
  <MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
2122
2122
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2123
2123
  xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
@@ -2127,23 +2127,23 @@ ${A.join(`
2127
2127
  profiles="urn:mpeg:dash:profile:isoff-on-demand:2011">
2128
2128
  <Period>
2129
2129
  <AdaptationSet mimeType="video/mp4" codecs="avc1.64001f" segmentAlignment="true" startWithSAP="1">
2130
- `;for(let q=0;q<$.length;q++){let W=$[q];K+=` <Representation id="video${q}" bandwidth="${W.bandwidth}" width="${W.width}" height="${W.height}">
2131
- <BaseURL>${W.url}/</BaseURL>
2130
+ `;for(let q=0;q<$.length;q++){let U=$[q];K+=` <Representation id="video${q}" bandwidth="${U.bandwidth}" width="${U.width}" height="${U.height}">
2131
+ <BaseURL>${U.url}/</BaseURL>
2132
2132
  <SegmentBase indexRange="0-999">
2133
2133
  <Initialization range="0-999"/>
2134
2134
  </SegmentBase>
2135
2135
  </Representation>
2136
2136
  `}if(K+=` </AdaptationSet>
2137
2137
  `,Z.length>0){K+=` <AdaptationSet mimeType="audio/mp4" codecs="mp4a.40.2" segmentAlignment="true" startWithSAP="1">
2138
- `;for(let q=0;q<Z.length;q++){let W=Z[q];K+=` <Representation id="audio${q}" bandwidth="${W.bandwidth}">
2139
- <BaseURL>${W.url}/</BaseURL>
2138
+ `;for(let q=0;q<Z.length;q++){let U=Z[q];K+=` <Representation id="audio${q}" bandwidth="${U.bandwidth}">
2139
+ <BaseURL>${U.url}/</BaseURL>
2140
2140
  <SegmentBase indexRange="0-999">
2141
2141
  <Initialization range="0-999"/>
2142
2142
  </SegmentBase>
2143
2143
  </Representation>
2144
2144
  `}K+=` </AdaptationSet>
2145
2145
  `}return K+=` </Period>
2146
- </MPD>`,K}function D8($){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 P8;var P7=b(()=>{w1();P8=[{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 C8,basename as OK,extname as LK,join as FK}from"path";import{mkdir as VK}from"fs/promises";async function v8(){try{return await import("ts-videos")}catch{return null}}function RK($){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 AK($){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 C7($){let Z=await v8();if(!Z)return null;try{let Y=C8($),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 x8($,Z,Y,X){let Q=await v8();if(!Q)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let J=await E4($,Z,Y);if(J)return J;try{let G=C8($);if(!await R0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",q=Y.baseUrl||"/videos";await VK(K,{recursive:!0});let W=await A0(G),U=OK($,LK($)),z={src:$,processed:!0,hash:W};X?.({percentage:5,stage:"analyzing"}),z.metadata=await C7(G)||void 0;let B={};if(Z.quality)B.bitrate=RK(Z.quality);if(Z.platform)Object.assign(B,AK(Z.platform));if(Z.transcode)Object.assign(B,Z.transcode);if(Object.keys(B).length>0||Z.process){X?.({percentage:10,stage:"transcoding"});let _=`${U}-${W}.mp4`,j=FK(K,_);try{let H=await NK(G,j,B,Q,(L)=>X?.({percentage:10+L*0.5,stage:"transcoding"}));if(H)z.transcoded={path:j,url:`${q}/${_}`,duration:H.duration,size:H.size,video:{codec:B.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:B.audioCodec||"aac",bitrate:B.audioBitrate||128000,sampleRate:B.sampleRate||48000,channels:B.channels||2}:void 0}}catch(H){z.errors=z.errors||[],z.errors.push(`Transcoding failed: ${H}`)}}if(Z.generatePoster){X?.({percentage:65,stage:"generating-poster"});let _=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},j=await S4(G,_,K,q);if(j)z.poster=j}if(Y.thumbnails?.enabled){X?.({percentage:70,stage:"generating-thumbnails"});let _=await y4(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 j=await C4(G,_.qualities||Y.streaming?.defaultQualities||[],K,q);if(j)z.streaming={...z.streaming,hls:j}}if(_.format==="dash"){let j=await v4(G,_.qualities||Y.streaming?.defaultQualities||[],K,q);if(j)z.streaming={...z.streaming,dash:j}}}if(Z.spriteSheet)X?.({percentage:90,stage:"generating-sprite-sheet"});return X?.({percentage:100,stage:"complete"}),await k4($,Z,z,Y),z}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function NK($,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 f8=b(()=>{w1();I7();y7();P7()});var g8={};o(g8,{setCachedVideoResult:()=>k4,processVideo:()=>x8,getCachedVideoResult:()=>E4,generateThumbnails:()=>y4,generateSpriteSheet:()=>I8,generatePoster:()=>S4,generateHLSManifest:()=>C4,generateDASHManifest:()=>v4,clearVideoCache:()=>M8,analyzeVideo:()=>C7,VideoProcessorCache:()=>D4});var h8=b(()=>{f8();y7();P7();I7()});async function m8(){try{return await Promise.resolve().then(() => (h8(),g8))}catch($){if(!d8)console.warn("[stx-media] Video processor not available, some features disabled:",$),d8=!0;return null}}async function x4($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return EK(X,Y)}if(Y.processedResult?.processed)return c8($,Y.processedResult,Z);let Q;if(X.generatePoster&&X.src&&!$.poster)Q=await kK(X,Y);let{src:J,sources:G=[],poster:K,posterPlaceholder:q,controls:W=u8,autoplay:U=!1,muted:z=!1,loop:B=!1,preload:_=l8,playsinline:j=!0,lazy:H=!0,player:L="native",type:F,width:O,height:V,crossorigin:R,disablePictureInPicture:A=!1,disableRemotePlayback:N=!1}=$,w=Q||K,T=$.class,M=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(L==="ts-video")return MK($,Z);if(F&&F!=="video")return TK(J||"",F,$);let D=G.length>0?G:J?[{src:J,type:p8(J)}]:[],E=[`id="${I}"`];if(W)E.push("controls");if(U)E.push("autoplay");if(z)E.push("muted");if(B)E.push("loop");if(j)E.push("playsinline");if(A)E.push("disablepictureinpicture");if(N)E.push("disableremoteplayback");if(R)E.push(`crossorigin="${R}"`);if(H){if(E.push(`data-preload="${_}"`),E.push('preload="none"'),w)E.push(`data-poster="${B0(w)}"`);E.push("data-stx-lazy")}else if(E.push(`preload="${_}"`),w)E.push(`poster="${B0(w)}"`);if(O)E.push(`width="${O}"`);if(V)E.push(`height="${V}"`);if(T)E.push(`class="${B0(T)}"`);if(M)E.push(`style="${B0(M)}"`);let C=D.map((P)=>{return` <source ${H?`data-src="${B0(P.src)}"`:`src="${B0(P.src)}"`} type="${P.type}"${P.media?` media="${P.media}"`:""} />`}).join(`
2146
+ </MPD>`,K}function E8($){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 C8;var C7=b(()=>{w1();C8=[{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 v8,basename as RK,extname as NK,join as AK}from"path";import{mkdir as wK}from"fs/promises";async function x8(){try{return await import("ts-videos")}catch{return null}}function TK($){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 MK($){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 v7($){let Z=await x8();if(!Z)return null;try{let Y=v8($),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 f8($,Z,Y,X){let Q=await x8();if(!Q)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let J=await E4($,Z,Y);if(J)return J;try{let G=v8($);if(!await R0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",q=Y.baseUrl||"/videos";await wK(K,{recursive:!0});let U=await A0(G),W=RK($,NK($)),z={src:$,processed:!0,hash:U};X?.({percentage:5,stage:"analyzing"}),z.metadata=await v7(G)||void 0;let B={};if(Z.quality)B.bitrate=TK(Z.quality);if(Z.platform)Object.assign(B,MK(Z.platform));if(Z.transcode)Object.assign(B,Z.transcode);if(Object.keys(B).length>0||Z.process){X?.({percentage:10,stage:"transcoding"});let _=`${W}-${U}.mp4`,j=AK(K,_);try{let H=await IK(G,j,B,Q,(L)=>X?.({percentage:10+L*0.5,stage:"transcoding"}));if(H)z.transcoded={path:j,url:`${q}/${_}`,duration:H.duration,size:H.size,video:{codec:B.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:B.audioCodec||"aac",bitrate:B.audioBitrate||128000,sampleRate:B.sampleRate||48000,channels:B.channels||2}:void 0}}catch(H){z.errors=z.errors||[],z.errors.push(`Transcoding failed: ${H}`)}}if(Z.generatePoster){X?.({percentage:65,stage:"generating-poster"});let _=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},j=await S4(G,_,K,q);if(j)z.poster=j}if(Y.thumbnails?.enabled){X?.({percentage:70,stage:"generating-thumbnails"});let _=await y4(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 j=await C4(G,_.qualities||Y.streaming?.defaultQualities||[],K,q);if(j)z.streaming={...z.streaming,hls:j}}if(_.format==="dash"){let j=await v4(G,_.qualities||Y.streaming?.defaultQualities||[],K,q);if(j)z.streaming={...z.streaming,dash:j}}}if(Z.spriteSheet)X?.({percentage:90,stage:"generating-sprite-sheet"});return X?.({percentage:100,stage:"complete"}),await k4($,Z,z,Y),z}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function IK($,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 g8=b(()=>{w1();D7();P7();C7()});var h8={};o(h8,{setCachedVideoResult:()=>k4,processVideo:()=>f8,getCachedVideoResult:()=>E4,generateThumbnails:()=>y4,generateSpriteSheet:()=>D8,generatePoster:()=>S4,generateHLSManifest:()=>C4,generateDASHManifest:()=>v4,clearVideoCache:()=>I8,analyzeVideo:()=>v7,VideoProcessorCache:()=>D4});var d8=b(()=>{g8();P7();C7();D7()});async function u8(){try{return await Promise.resolve().then(() => (d8(),h8))}catch($){if(!m8)console.warn("[stx-media] Video processor not available, some features disabled:",$),m8=!0;return null}}async function x4($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return yK(X,Y)}if(Y.processedResult?.processed)return i8($,Y.processedResult,Z);let Q;if(X.generatePoster&&X.src&&!$.poster)Q=await PK(X,Y);let{src:J,sources:G=[],poster:K,posterPlaceholder:q,controls:U=l8,autoplay:W=!1,muted:z=!1,loop:B=!1,preload:_=p8,playsinline:j=!0,lazy:H=!0,player:L="native",type:F,width:O,height:V,crossorigin:R,disablePictureInPicture:N=!1,disableRemotePlayback:A=!1}=$,w=Q||K,T=$.class,M=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(L==="ts-video")return kK($,Z);if(F&&F!=="video")return EK(J||"",F,$);let D=G.length>0?G:J?[{src:J,type:c8(J)}]:[],E=[`id="${I}"`];if(U)E.push("controls");if(W)E.push("autoplay");if(z)E.push("muted");if(B)E.push("loop");if(j)E.push("playsinline");if(N)E.push("disablepictureinpicture");if(A)E.push("disableremoteplayback");if(R)E.push(`crossorigin="${R}"`);if(H){if(E.push(`data-preload="${_}"`),E.push('preload="none"'),w)E.push(`data-poster="${B0(w)}"`);E.push("data-stx-lazy")}else if(E.push(`preload="${_}"`),w)E.push(`poster="${B0(w)}"`);if(O)E.push(`width="${O}"`);if(V)E.push(`height="${V}"`);if(T)E.push(`class="${B0(T)}"`);if(M)E.push(`style="${B0(M)}"`);let C=D.map((y)=>{return` <source ${H?`data-src="${B0(y.src)}"`:`src="${B0(y.src)}"`} type="${y.type}"${y.media?` media="${y.media}"`:""} />`}).join(`
2147
2147
  `),S=`<video ${E.join(" ")}>
2148
2148
  ${C}
2149
2149
  Your browser does not support the video tag.
@@ -2182,9 +2182,9 @@ ${C}
2182
2182
 
2183
2183
  observer.observe(video);
2184
2184
  })();
2185
- `.trim();return{html:S,script:k}}function TK($,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=IK($),q=W?`https://www.youtube-nocookie.com/embed/${W}`:$;break;case"vimeo":W=DK($),q=W?`https://player.vimeo.com/video/${W}`:$;break;case"dailymotion":W=$.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${W}`;break;case"twitch":W=$.split("/").pop()||"",q=`https://player.twitch.tv/?video=${W}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=$}let U=[`id="${K}"`,`src="${B0(q)}"`,`width="${X}"`,`height="${Q}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(J)U.push(`class="${B0(J)}"`);if(G)U.push(`style="${B0(G)}"`);if(Y.lazy)U.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
2186
- <iframe ${U.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
2187
- </div>`}}function MK($,Z={}){let{src:Y,sources:X=[],poster:Q,controls:J=!0,autoplay:G=!1,muted:K=!1,loop:q=!1,preload:W="metadata",playsinline:U=!0,lazy:z=!0,width:B,height:_}=$,j=$.class,H=$.style,L=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,F={src:X.length>0?X:Y,autoplay:G,loop:q,muted:K,playsinline:U,preload:W,poster:Q,controls:J,title:$.title},O=["position: relative",B?`width: ${typeof B==="number"?B+"px":B}`:"width: 100%",_?`height: ${typeof _==="number"?_+"px":_}`:"",H||""].filter(Boolean).join("; "),V=`
2185
+ `.trim();return{html:S,script:k}}function EK($,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,U=null;switch(Z){case"youtube":U=bK($),q=U?`https://www.youtube-nocookie.com/embed/${U}`:$;break;case"vimeo":U=SK($),q=U?`https://player.vimeo.com/video/${U}`:$;break;case"dailymotion":U=$.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${U}`;break;case"twitch":U=$.split("/").pop()||"",q=`https://player.twitch.tv/?video=${U}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=$}let W=[`id="${K}"`,`src="${B0(q)}"`,`width="${X}"`,`height="${Q}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(J)W.push(`class="${B0(J)}"`);if(G)W.push(`style="${B0(G)}"`);if(Y.lazy)W.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
2186
+ <iframe ${W.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
2187
+ </div>`}}function kK($,Z={}){let{src:Y,sources:X=[],poster:Q,controls:J=!0,autoplay:G=!1,muted:K=!1,loop:q=!1,preload:U="metadata",playsinline:W=!0,lazy:z=!0,width:B,height:_}=$,j=$.class,H=$.style,L=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,F={src:X.length>0?X:Y,autoplay:G,loop:q,muted:K,playsinline:W,preload:U,poster:Q,controls:J,title:$.title},O=["position: relative",B?`width: ${typeof B==="number"?B+"px":B}`:"width: 100%",_?`height: ${typeof _==="number"?_+"px":_}`:"",H||""].filter(Boolean).join("; "),V=`
2188
2188
  <div
2189
2189
  id="${L}"
2190
2190
  class="ts-video-player${j?" "+B0(j):""}"
@@ -2221,7 +2221,7 @@ ${C}
2221
2221
 
2222
2222
  // Load ts-video-player from CDN
2223
2223
  var script = document.createElement('script');
2224
- script.src = '${wK}';
2224
+ script.src = '${DK}';
2225
2225
  script.onload = initPlayer;
2226
2226
  script.onerror = function() {
2227
2227
  console.error('[stx] Failed to load ts-video-player');
@@ -2299,7 +2299,7 @@ else {
2299
2299
  });
2300
2300
  }
2301
2301
  })();
2302
- `.trim(),A=`
2302
+ `.trim(),N=`
2303
2303
  .ts-video-player {
2304
2304
  position: relative;
2305
2305
  background: #000;
@@ -2351,12 +2351,12 @@ else {
2351
2351
  .ts-video-player__play-button svg {
2352
2352
  margin-left: 4px;
2353
2353
  }
2354
- `.trim();return{html:V,script:R,css:A}}function p8($){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 IK($){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 DK($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function B0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function EK($,Z){let Y=await m8();if(!Y)return x4({...$,process:!1},Z);let X=Z.tsVideosConfig,Q=await Y.processVideo($.src,$,X,$.onProcessProgress);if(Q.processed)return c8($,Q,Z);return x4({...$,process:!1},Z)}async function kK($,Z){let Y=await m8();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 c8($,Z,Y){let{controls:X=u8,autoplay:Q=!1,muted:J=!1,loop:G=!1,preload:K=l8,playsinline:q=!0,lazy:W=!0,width:U,height:z,crossorigin:B,disablePictureInPicture:_=!1,disableRemotePlayback:j=!1}=$,H=$.class,L=$.style,F=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=$.src,V=p8(O);if(Z.transcoded)O=Z.transcoded.url,V="video/mp4";let R=Z.streaming?.hls||Z.streaming?.dash;if(R){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(j)N.push("disableremoteplayback");if(B)N.push(`crossorigin="${B}"`);if(W){if(N.push(`data-preload="${K}"`),N.push('preload="none"'),A)N.push(`data-poster="${B0(A)}"`);N.push("data-stx-lazy")}else if(N.push(`preload="${K}"`),A)N.push(`poster="${B0(A)}"`);let w=U||Z.metadata?.width,T=z||Z.metadata?.height;if(w)N.push(`width="${w}"`);if(T)N.push(`height="${T}"`);if(H)N.push(`class="${B0(H)}"`);if(L)N.push(`style="${B0(L)}"`);let I=` <source ${W?`data-src="${B0(O)}"`:`src="${B0(O)}"`} type="${V}" />`,D=`<video ${N.join(" ")}>
2354
+ `.trim();return{html:V,script:R,css:N}}function c8($){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 bK($){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 SK($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function B0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function yK($,Z){let Y=await u8();if(!Y)return x4({...$,process:!1},Z);let X=Z.tsVideosConfig,Q=await Y.processVideo($.src,$,X,$.onProcessProgress);if(Q.processed)return i8($,Q,Z);return x4({...$,process:!1},Z)}async function PK($,Z){let Y=await u8();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 i8($,Z,Y){let{controls:X=l8,autoplay:Q=!1,muted:J=!1,loop:G=!1,preload:K=p8,playsinline:q=!0,lazy:U=!0,width:W,height:z,crossorigin:B,disablePictureInPicture:_=!1,disableRemotePlayback:j=!1}=$,H=$.class,L=$.style,F=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=$.src,V=c8(O);if(Z.transcoded)O=Z.transcoded.url,V="video/mp4";let R=Z.streaming?.hls||Z.streaming?.dash;if(R){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 N=Z.poster?.url||$.poster,A=[`id="${F}"`];if(X)A.push("controls");if(Q)A.push("autoplay");if(J)A.push("muted");if(G)A.push("loop");if(q)A.push("playsinline");if(_)A.push("disablepictureinpicture");if(j)A.push("disableremoteplayback");if(B)A.push(`crossorigin="${B}"`);if(U){if(A.push(`data-preload="${K}"`),A.push('preload="none"'),N)A.push(`data-poster="${B0(N)}"`);A.push("data-stx-lazy")}else if(A.push(`preload="${K}"`),N)A.push(`poster="${B0(N)}"`);let w=W||Z.metadata?.width,T=z||Z.metadata?.height;if(w)A.push(`width="${w}"`);if(T)A.push(`height="${T}"`);if(H)A.push(`class="${B0(H)}"`);if(L)A.push(`style="${B0(L)}"`);let I=` <source ${U?`data-src="${B0(O)}"`:`src="${B0(O)}"`} type="${V}" />`,D=`<video ${A.join(" ")}>
2355
2355
  ${I}
2356
2356
  Your browser does not support the video tag.
2357
2357
  </video>`;if(Z.spriteSheet)D=`<div class="stx-video-wrapper" data-sprite-sheet="${B0(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
2358
2358
  ${D}
2359
- </div>`;let E;if(W)E=`
2359
+ </div>`;let E;if(U)E=`
2360
2360
  (function() {
2361
2361
  var video = document.getElementById('${F}');
2362
2362
  if (!video) return;
@@ -2400,9 +2400,9 @@ ${D}
2400
2400
  width: 100%;
2401
2401
  height: auto;
2402
2402
  }
2403
- `.trim();return{html:D,script:E,css:C}}var d8=!1,u8=!0,l8="metadata",wK="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var i8=b(()=>{x7()});function n8(){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}=bK($,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 x4(G,q),U=W.html;if(W.css)U+=`
2404
- <style>${W.css}</style>`;if(W.script)U+=`
2405
- <script>${W.script}</script>`;return U},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function bK($,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=SK(X),J=o8(Q[0],Y)||"",G={};if(Q[1]){let K=o8(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 SK($){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 o8($,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 v7;var x7=b(()=>{G7();i8();v7=n8()});function yK($,Z){let Y=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
2403
+ `.trim();return{html:D,script:E,css:C}}var m8=!1,l8=!0,p8="metadata",DK="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var n8=b(()=>{f7()});function o8(){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}=CK($,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},U=await x4(G,q),W=U.html;if(U.css)W+=`
2404
+ <style>${U.css}</style>`;if(U.script)W+=`
2405
+ <script>${U.script}</script>`;return W},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function CK($,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=vK(X),J=s8(Q[0],Y)||"",G={};if(Q[1]){let K=s8(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 vK($){let Z=[],Y="",X=!1,Q="",J=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],U=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&U!=="\\"){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 s8($,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 x7;var f7=b(()=>{K7();n8();x7=o8()});function xK($,Z){let Y=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
2406
2406
  ${$}
2407
2407
  </div>
2408
2408
  <script>
@@ -2447,7 +2447,7 @@ ${D}
2447
2447
  }
2448
2448
  }
2449
2449
  })();
2450
- </script>`}function PK($,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=`
2450
+ </script>`}function fK($,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=`
2451
2451
  <div class="stx-pwa-update-banner" style="
2452
2452
  position: fixed;
2453
2453
  bottom: 0;
@@ -2558,7 +2558,7 @@ else {
2558
2558
  // Also listen for custom event
2559
2559
  window.addEventListener('pwa-update-available', showUpdate);
2560
2560
  })();
2561
- </script>`}function CK($,Z){let Y=$.trim().length>0,X=`
2561
+ </script>`}function gK($,Z){let Y=$.trim().length>0,X=`
2562
2562
  <div class="stx-offline-indicator" style="
2563
2563
  position: fixed;
2564
2564
  top: 16px;
@@ -2619,7 +2619,7 @@ else {
2619
2619
  window.addEventListener('offline', updateStatus);
2620
2620
  updateStatus();
2621
2621
  })();
2622
- </script>`}function vK($,Z){let Y=Z.pwa?.push,X=Y?.vapidPublicKey||"",Q=Y?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
2622
+ </script>`}function hK($,Z){let Y=Z.pwa?.push,X=Y?.vapidPublicKey||"",Q=Y?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
2623
2623
  ${$}
2624
2624
  </div>
2625
2625
  <script>
@@ -2701,55 +2701,55 @@ catch (error) {
2701
2701
  init();
2702
2702
  }
2703
2703
  })();
2704
- </script>`}function hH($){return[...$,...f7]}var xK,fK,gK,hK,f7;var g7=b(()=>{xK={name:"pwa.installButton",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return yK($,Q)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},fK={name:"pwa.updatePrompt",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return PK($,Q)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},gK={name:"pwa.offlineIndicator",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return CK($,Q)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},hK={name:"pwa.pushSubscribe",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return vK($,Q)},hasEndTag:!0,description:"Renders a push notification subscription button"},f7=[xK,fK,gK,hK]});function h7($){for(let[Z,Y]of Object.entries(n))if(Y===$)return Z;return}var n;var f4=b(()=>{n={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});function D5(){return!1}function E5(){return!D5()||process.env.STX_DEBUG==="true"}function g4(){return!1}import dK from"path";function h4(){return{...d7}}function d4($){if(!d7.showRelativePaths||!$)return $;let Z=d7.baseDir||process.cwd();try{let Y=dK.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var mK,d7,m4,M1,u4;var l4=b(()=>{f4();mK={showRelativePaths:!1,enableAutoRecovery:E5(),logRecoveryWarnings:!0},d7={...mK};m4=class m4 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,X,Q,J,G){super($);this.code=Z;this.filePath=Y;this.line=X;this.column=Q;this.context=J;if(this.name="StxError",this.numericCode=G||n.EVALUATION_ERROR,this.filePath)this.filePath=d4(this.filePath)}};M1=class M1 extends m4{constructor($,Z,Y,X,Q,J){super($,"stx_RUNTIME_ERROR",Z,Y,X,Q,J||n.EVALUATION_ERROR);this.name="StxRuntimeError"}};u4=class u4 extends m4{isFatal=!0;constructor($,Z,Y,X,Q,J){super($,"stx_VALIDATION_ERROR",Z,Y,X,Q,J||n.DOM_API_VIOLATION);this.name="StxValidationError"}}});function r8($){let{type:Z,message:Y,code:X,filePath:Q,line:J,column:G,template:K,offset:q,snippet:W,suggestion:U,format:z="text"}=$,B=J,_=G;if(!B&&K&&q!==void 0){let O=nK(K,q);B=O.line,_=O.column}let j=Q?d4(Q):void 0,H=X?h7(X):void 0,L={type:Z,code:X,codeName:H,message:Y,filePath:j,line:B,column:_,snippet:W,suggestion:U,timestamp:new Date().toISOString()},F;switch(z){case"html":F=lK(L);break;case"json":F=JSON.stringify(L,null,2);break;case"console":F=pK(L,K,q);break;case"text":default:F=uK(L,K,q);break}return{formatted:F,data:L}}function uK($,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(`
2705
- ${$.message}`),Z&&$.line){let J=cK(Z,$.line,2);if(J)X.push(`
2704
+ </script>`}function lH($){return[...$,...g7]}var dK,mK,uK,lK,g7;var h7=b(()=>{dK={name:"pwa.installButton",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return xK($,Q)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},mK={name:"pwa.updatePrompt",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return fK($,Q)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},uK={name:"pwa.offlineIndicator",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return gK($,Q)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},lK={name:"pwa.pushSubscribe",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return hK($,Q)},hasEndTag:!0,description:"Renders a push notification subscription button"},g7=[dK,mK,uK,lK]});function d7($){for(let[Z,Y]of Object.entries(n))if(Y===$)return Z;return}var n;var f4=b(()=>{n={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});function k5(){return!1}function b5(){return!k5()||process.env.STX_DEBUG==="true"}function g4(){return!1}import pK from"path";function h4(){return{...m7}}function d4($){if(!m7.showRelativePaths||!$)return $;let Z=m7.baseDir||process.cwd();try{let Y=pK.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var cK,m7,m4,M1,u4;var l4=b(()=>{f4();cK={showRelativePaths:!1,enableAutoRecovery:b5(),logRecoveryWarnings:!0},m7={...cK};m4=class m4 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,X,Q,J,G){super($);this.code=Z;this.filePath=Y;this.line=X;this.column=Q;this.context=J;if(this.name="StxError",this.numericCode=G||n.EVALUATION_ERROR,this.filePath)this.filePath=d4(this.filePath)}};M1=class M1 extends m4{constructor($,Z,Y,X,Q,J){super($,"stx_RUNTIME_ERROR",Z,Y,X,Q,J||n.EVALUATION_ERROR);this.name="StxRuntimeError"}};u4=class u4 extends m4{isFatal=!0;constructor($,Z,Y,X,Q,J){super($,"stx_VALIDATION_ERROR",Z,Y,X,Q,J||n.DOM_API_VIOLATION);this.name="StxValidationError"}}});function a8($){let{type:Z,message:Y,code:X,filePath:Q,line:J,column:G,template:K,offset:q,snippet:U,suggestion:W,format:z="text"}=$,B=J,_=G;if(!B&&K&&q!==void 0){let O=aK(K,q);B=O.line,_=O.column}let j=Q?d4(Q):void 0,H=X?d7(X):void 0,L={type:Z,code:X,codeName:H,message:Y,filePath:j,line:B,column:_,snippet:U,suggestion:W,timestamp:new Date().toISOString()},F;switch(z){case"html":F=nK(L);break;case"json":F=JSON.stringify(L,null,2);break;case"console":F=oK(L,K,q);break;case"text":default:F=iK(L,K,q);break}return{formatted:F,data:L}}function iK($,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(`
2705
+ ${$.message}`),Z&&$.line){let J=sK(Z,$.line,2);if(J)X.push(`
2706
2706
  ${J}`)}if($.snippet)X.push(`
2707
2707
  Snippet: ${$.snippet}`);if($.suggestion)X.push(`
2708
- Suggestion: ${$.suggestion}`);return X.join(" ")}function lK($){let Z=$.code?` [${$.code}]`:"",Y=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",X=`<!-- [${$.type} Error${Z}]${Y}: ${s8($.message)}`;if($.suggestion)X+=` | Suggestion: ${s8($.suggestion)}`;return X+=" -->",X}function pK($,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(`
2709
- \x1B[90mat\x1B[0m ${z}`)}if(W.push(`
2708
+ Suggestion: ${$.suggestion}`);return X.join(" ")}function nK($){let Z=$.code?` [${$.code}]`:"",Y=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",X=`<!-- [${$.type} Error${Z}]${Y}: ${r8($.message)}`;if($.suggestion)X+=` | Suggestion: ${r8($.suggestion)}`;return X+=" -->",X}function oK($,Z,Y){let U=[],W=$.code?` [${$.codeName||$.code}]`:"";if(U.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${W} \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`}U.push(`
2709
+ \x1B[90mat\x1B[0m ${z}`)}if(U.push(`
2710
2710
 
2711
- ${$.message}`),Z&&$.line){let z=iK(Z,$.line,2);if(z)W.push(`
2711
+ ${$.message}`),Z&&$.line){let z=rK(Z,$.line,2);if(z)U.push(`
2712
2712
 
2713
2713
  \x1B[90mContext:\x1B[0m
2714
- ${z}`)}if($.suggestion)W.push(`
2715
-
2716
- \x1B[33mSuggestion:\x1B[0m ${$.suggestion}`);return W.push(`
2717
- ${"\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 cK($,Z,Y){let X=$.split(`
2718
- `),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(`
2719
- `)}function iK($,Z,Y){let X=$.split(`
2720
- `),Q=Math.max(0,Z-Y-1),J=Math.min(X.length-1,Z+Y-1),G="\x1B[90m",K="\x1B[31m",q="\x1B[0m",W=[];for(let U=Q;U<=J;U++){let z=(U+1).toString().padStart(4),B=U===Z-1,_=B?"\x1B[31m>\x1B[0m":" ",j=B?`\x1B[31m${X[U]}\x1B[0m`:`\x1B[90m${X[U]}\x1B[0m`;W.push(`${_}\x1B[90m${z}\x1B[0m | ${j}`)}return W.join(`
2721
- `)}function s8($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function nK($,Z){let X=$.substring(0,Z).split(`
2722
- `);return{line:X.length,column:X[X.length-1].length}}function t($,Z,Y){return r8({type:$,message:Z,code:Y,format:"html"}).formatted}async function n1($,Z,Y){try{return await $()}catch(X){if(Y&&X instanceof Error)Y(X);return Z}}var a8=b(()=>{f4();l4()});class u7{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(`
2714
+ ${z}`)}if($.suggestion)U.push(`
2715
+
2716
+ \x1B[33mSuggestion:\x1B[0m ${$.suggestion}`);return U.push(`
2717
+ ${"\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"}`),U.join("")}function sK($,Z,Y){let X=$.split(`
2718
+ `),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),U=K===Z-1?">":" ";G.push(`${U}${q} | ${X[K]}`)}return G.join(`
2719
+ `)}function rK($,Z,Y){let X=$.split(`
2720
+ `),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",U=[];for(let W=Q;W<=J;W++){let z=(W+1).toString().padStart(4),B=W===Z-1,_=B?"\x1B[31m>\x1B[0m":" ",j=B?`\x1B[31m${X[W]}\x1B[0m`:`\x1B[90m${X[W]}\x1B[0m`;U.push(`${_}\x1B[90m${z}\x1B[0m | ${j}`)}return U.join(`
2721
+ `)}function r8($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function aK($,Z){let X=$.substring(0,Z).split(`
2722
+ `);return{line:X.length,column:X[X.length-1].length}}function t($,Z,Y){return a8({type:$,message:Z,code:Y,format:"html"}).formatted}async function n1($,Z,Y){try{return await $()}catch(X){if(Y&&X instanceof Error)Y(X);return Z}}var t8=b(()=>{f4();l4()});class l7{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(`
2723
2723
  `).slice(1).join(`
2724
2724
  `)}`);if($.context)Z.push(` Context: ${JSON.stringify($.context)}`);return Z.join(`
2725
2725
  `)}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($)}
2726
2726
  `;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(`
2727
2727
 
2728
- `),"utf-8")}}async flush(){await this.writeQueue}}var m7,m0,l7;var t8=b(()=>{l4();m7={isEnabled(){return h4().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=h4();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+=`
2729
- @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(E5())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};m0=new u7,l7={isDevelopment(){return E5()},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(`
2730
- `)}}});var e8=()=>{};var $Z=b(()=>{f4();a8();t8();e8();l4()});var t0=b(()=>{$Z()});function ZZ($,Z,Y,X){let Q=$;Q=Q.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,q,W)=>{if(!W&&q.includes(":")){let U=q.split(":"),z=q,B=U.length>1?U[1]:"";if(B&&Z[B])W=Z[B];else if(z.startsWith("og:")&&Z.openGraph&&Z.openGraph[U[1]])W=Z.openGraph[U[1]];else W="";return W?`<meta property="${p(z)}" content="${p(W)}">`:""}return W?`<meta name="${p(q)}" content="${p(W)}">`:""});let J=/@metaTag\s*\(/g,G;while((G=J.exec(Q))!==null){let K=G.index,q=K+G[0].length-1,W=1,U=q+1;while(U<Q.length&&W>0){if(Q[U]==="(")W++;else if(Q[U]===")"){if(W--,W===0)break}U++}if(W!==0)break;let z=Q.substring(q+1,U).trim(),B=U+1,_=(()=>{try{let j=O0(z,Z);if(!j)return"";let H="<meta";if(j.name)H+=` name="${p(String(j.name))}"`;if(j.property)H+=` property="${p(String(j.property))}"`;if(j.httpEquiv)H+=` http-equiv="${p(String(j.httpEquiv))}"`;if(j.content)H+=` content="${p(String(j.content))}"`;return H+=">",H}catch(j){let H=j instanceof Error?j.message:String(j);return t("MetaTag",H,n.EVALUATION_ERROR)}})();Q=Q.substring(0,K)+_+Q.substring(B),J.lastIndex=0}return Q}function YZ($,Z,Y){let X=$,Q=/@structuredData\s*\(/g,J;while((J=Q.exec(X))!==null){let G=J.index,K=G+J[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")"){if(q--,q===0)break}W++}if(q!==0)break;let U=X.substring(K+1,W).trim(),z=W+1,B=(()=>{try{let _=O0(U,Z);if(!_)return"";if(!_["@context"])_["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(_).replace(/<\//g,"<\\/")}</script>`}catch(_){let j=_ instanceof Error?_.message:String(_);return t("StructuredData",j,n.EVALUATION_ERROR)}})();X=X.substring(0,G)+B+X.substring(z),Q.lastIndex=0}return X}function XZ($,Z,Y,X){let Q=$,J=/@seo\s*\(\s*\{/g,G;while((G=J.exec(Q))!==null){let K=Q.indexOf("{",G.index+4),q=1,W=K+1,U=null,z=!1;while(W<Q.length&&q>0){let F=Q[W];if(z){z=!1,W++;continue}if(F==="\\"&&U){z=!0,W++;continue}if(U){if(F===U)U=null;W++;continue}if(F==='"'||F==="'"||F==="`"){U=F,W++;continue}if(F==="{")q++;else if(F==="}")q--;W++}if(q!==0)break;let B=Q.substring(W).match(/^\s*\)/);if(!B)break;let _=W+B[0].length,j=Q.substring(K,W),H=Q.substring(G.index,_),L=((F)=>{try{let O=O0(F,Z);if(!O)return"";let V="";if(O.title)V+=`<title>${p(O.title)}</title>
2728
+ `),"utf-8")}}async flush(){await this.writeQueue}}var u7,m0,p7;var e8=b(()=>{l4();u7={isEnabled(){return h4().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=h4();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,U=(Y.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(q>U){let W=q-U;for(let z=0;z<W;z++)Y+=`
2729
+ @end${K}`;X.push(`Added ${W} 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(b5())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};m0=new l7,p7={isDevelopment(){return b5()},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(`
2730
+ `)}}});var $Z=()=>{};var ZZ=b(()=>{f4();t8();e8();$Z();l4()});var e0=b(()=>{ZZ()});function YZ($,Z,Y,X){let Q=$;Q=Q.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,q,U)=>{if(!U&&q.includes(":")){let W=q.split(":"),z=q,B=W.length>1?W[1]:"";if(B&&Z[B])U=Z[B];else if(z.startsWith("og:")&&Z.openGraph&&Z.openGraph[W[1]])U=Z.openGraph[W[1]];else U="";return U?`<meta property="${p(z)}" content="${p(U)}">`:""}return U?`<meta name="${p(q)}" content="${p(U)}">`:""});let J=/@metaTag\s*\(/g,G;while((G=J.exec(Q))!==null){let K=G.index,q=K+G[0].length-1,U=1,W=q+1;while(W<Q.length&&U>0){if(Q[W]==="(")U++;else if(Q[W]===")"){if(U--,U===0)break}W++}if(U!==0)break;let z=Q.substring(q+1,W).trim(),B=W+1,_=(()=>{try{let j=O0(z,Z);if(!j)return"";let H="<meta";if(j.name)H+=` name="${p(String(j.name))}"`;if(j.property)H+=` property="${p(String(j.property))}"`;if(j.httpEquiv)H+=` http-equiv="${p(String(j.httpEquiv))}"`;if(j.content)H+=` content="${p(String(j.content))}"`;return H+=">",H}catch(j){let H=j instanceof Error?j.message:String(j);return t("MetaTag",H,n.EVALUATION_ERROR)}})();Q=Q.substring(0,K)+_+Q.substring(B),J.lastIndex=0}return Q}function XZ($,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,U=K+1;while(U<X.length&&q>0){if(X[U]==="(")q++;else if(X[U]===")"){if(q--,q===0)break}U++}if(q!==0)break;let W=X.substring(K+1,U).trim(),z=U+1,B=(()=>{try{let _=O0(W,Z);if(!_)return"";if(!_["@context"])_["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(_).replace(/<\//g,"<\\/")}</script>`}catch(_){let j=_ instanceof Error?_.message:String(_);return t("StructuredData",j,n.EVALUATION_ERROR)}})();X=X.substring(0,G)+B+X.substring(z),Q.lastIndex=0}return X}function JZ($,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,U=K+1,W=null,z=!1;while(U<Q.length&&q>0){let F=Q[U];if(z){z=!1,U++;continue}if(F==="\\"&&W){z=!0,U++;continue}if(W){if(F===W)W=null;U++;continue}if(F==='"'||F==="'"||F==="`"){W=F,U++;continue}if(F==="{")q++;else if(F==="}")q--;U++}if(q!==0)break;let B=Q.substring(U).match(/^\s*\)/);if(!B)break;let _=U+B[0].length,j=Q.substring(K,U),H=Q.substring(G.index,_),L=((F)=>{try{let O=O0(F,Z);if(!O)return"";let V="";if(O.title)V+=`<title>${p(O.title)}</title>
2731
2731
  `,V+=`<meta name="title" content="${p(O.title)}">
2732
2732
  `;if(O.description)V+=`<meta name="description" content="${p(O.description)}">
2733
2733
  `;if(O.keywords){let R=Array.isArray(O.keywords)?O.keywords.join(", "):O.keywords;V+=`<meta name="keywords" content="${p(R)}">
2734
2734
  `}if(O.robots)V+=`<meta name="robots" content="${p(O.robots)}">
2735
2735
  `;if(O.canonical)V+=`<link rel="canonical" href="${p(O.canonical)}">
2736
2736
  `;if(O.openGraph){let R=O.openGraph;if(V+=`<meta property="og:type" content="${p(R.type||"website")}">
2737
- `,R.title||O.title){let A=R.title||O.title||"";V+=`<meta property="og:title" content="${p(A)}">
2738
- `}if(R.description||O.description){let A=R.description||O.description||"";V+=`<meta property="og:description" content="${p(A)}">
2739
- `}if(R.url||O.canonical){let A=R.url||O.canonical||"";V+=`<meta property="og:url" content="${p(A)}">
2737
+ `,R.title||O.title){let N=R.title||O.title||"";V+=`<meta property="og:title" content="${p(N)}">
2738
+ `}if(R.description||O.description){let N=R.description||O.description||"";V+=`<meta property="og:description" content="${p(N)}">
2739
+ `}if(R.url||O.canonical){let N=R.url||O.canonical||"";V+=`<meta property="og:url" content="${p(N)}">
2740
2740
  `}if(R.image){if(V+=`<meta property="og:image" content="${p(R.image)}">
2741
2741
  `,R.imageAlt)V+=`<meta property="og:image:alt" content="${p(R.imageAlt)}">
2742
2742
  `;if(R.imageWidth)V+=`<meta property="og:image:width" content="${p(String(R.imageWidth))}">
2743
2743
  `;if(R.imageHeight)V+=`<meta property="og:image:height" content="${p(String(R.imageHeight))}">
2744
2744
  `}if(R.siteName)V+=`<meta property="og:site_name" content="${p(R.siteName)}">
2745
2745
  `}if(O.twitter){let R=O.twitter;if(V+=`<meta name="twitter:card" content="${p(R.card||"summary_large_image")}">
2746
- `,R.title||O.title){let A=R.title||O.title||"";V+=`<meta name="twitter:title" content="${p(A)}">
2747
- `}if(R.description||O.description){let A=R.description||O.description||"";V+=`<meta name="twitter:description" content="${p(A)}">
2748
- `}if(R.image||O.openGraph&&O.openGraph.image){let A=R.image||(O.openGraph?O.openGraph.image:"")||"";V+=`<meta name="twitter:image" content="${p(A)}">
2746
+ `,R.title||O.title){let N=R.title||O.title||"";V+=`<meta name="twitter:title" content="${p(N)}">
2747
+ `}if(R.description||O.description){let N=R.description||O.description||"";V+=`<meta name="twitter:description" content="${p(N)}">
2748
+ `}if(R.image||O.openGraph&&O.openGraph.image){let N=R.image||(O.openGraph?O.openGraph.image:"")||"";V+=`<meta name="twitter:image" content="${p(N)}">
2749
2749
  `}if(R.site)V+=`<meta name="twitter:site" content="${p(R.site)}">
2750
2750
  `;if(R.creator)V+=`<meta name="twitter:creator" content="${p(R.creator)}">
2751
2751
  `}if(O.structuredData){let R=JSON.stringify(O.structuredData).replace(/<\//g,"<\\/");V+=`<script type="application/ld+json">${R}</script>
2752
- `}return V.trim()}catch(O){let V=O instanceof Error?O.message:String(O);return t("SEO",`Error processing @seo directive: ${V}`,n.EVALUATION_ERROR)}})(j);Q=Q.substring(0,G.index)+L+Q.substring(_),J.lastIndex=G.index+L.length}return Q}function JZ($,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=`
2752
+ `}return V.trim()}catch(O){let V=O instanceof Error?O.message:String(O);return t("SEO",`Error processing @seo directive: ${V}`,n.EVALUATION_ERROR)}})(j);Q=Q.substring(0,G.index)+L+Q.substring(_),J.lastIndex=G.index+L.length}return Q}function QZ($,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 U=`
2753
2753
  <!-- stx SEO Tags -->
2754
2754
  <meta name="title" content="${p(G)}">
2755
2755
  <meta name="description" content="${p(K)}">
@@ -2759,13 +2759,13 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
2759
2759
  <meta name="twitter:card" content="summary_large_image">
2760
2760
  <meta name="twitter:title" content="${p(G)}">
2761
2761
  <meta name="twitter:description" content="${p(K)}">
2762
- `;if(q)W+=`
2762
+ `;if(q)U+=`
2763
2763
  <meta property="og:image" content="${p(q)}">
2764
2764
  <meta name="twitter:image" content="${p(q)}">
2765
- `;let U=$;if(!J)U=U.replace(/<head[^>]*>/,`$&
2766
- <title>${p(G)}</title>`);return U.replace(/<head[^>]*>/,`$&
2767
- ${W}
2768
- `)}function p($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var QZ,GZ;var p7=b(()=>{t0();L0();QZ={name:"meta",handler:($,Z,Y,X)=>{if(Z.length<1)return t("Meta","meta directive requires at least the meta name",n.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),J=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${p(Q)}" content="${p(J)}">`},hasEndTag:!1},GZ={name:"structuredData",handler:($,Z,Y,X)=>{if($.trim()==="")return t("StructuredData","structuredData directive requires JSON-LD content",n.INVALID_DIRECTIVE_SYNTAX);try{let Q=JSON.parse($);if(!Q["@context"])Q["@context"]="https://schema.org";if(!Q["@type"])return t("StructuredData","structuredData requires @type property",n.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(Q)}</script>`}catch(Q){let J=Q instanceof Error?Q.message:String(Q);return t("StructuredData",J,n.EVALUATION_ERROR)}},hasEndTag:!0}});import k5 from"path";function oK($,Z){let Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=Y?Y[1].trim():"",Q=Z,J=[],G=!0;if(X){let z=X.match(/export\s+default\s+({[\s\S]*})/);if(z)try{let B=z[1],_=B.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(_)Q=_[1];let j=B.match(/props\s*:\s*\[([\s\S]*?)\]/);if(j)J=j[1].split(",").map((L)=>L.trim().replace(/['"`]/g,"")).filter((L)=>L.length>0);let H=B.match(/shadowDOM\s*:\s*(true|false)/);if(H)G=H[1]==="true"}catch{}}let K=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=K?K[1].trim():"",W=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),U=W?W[1].trim():"";return{tag:Q,props:J,template:q,styles:U,script:X,shadowDOM:G}}function sK($){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)=>`
2765
+ `;let W=$;if(!J)W=W.replace(/<head[^>]*>/,`$&
2766
+ <title>${p(G)}</title>`);return W.replace(/<head[^>]*>/,`$&
2767
+ ${U}
2768
+ `)}function p($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var GZ,KZ;var c7=b(()=>{e0();L0();GZ={name:"meta",handler:($,Z,Y,X)=>{if(Z.length<1)return t("Meta","meta directive requires at least the meta name",n.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),J=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${p(Q)}" content="${p(J)}">`},hasEndTag:!1},KZ={name:"structuredData",handler:($,Z,Y,X)=>{if($.trim()==="")return t("StructuredData","structuredData directive requires JSON-LD content",n.INVALID_DIRECTIVE_SYNTAX);try{let Q=JSON.parse($);if(!Q["@context"])Q["@context"]="https://schema.org";if(!Q["@type"])return t("StructuredData","structuredData requires @type property",n.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(Q)}</script>`}catch(Q){let J=Q instanceof Error?Q.message:String(Q);return t("StructuredData",J,n.EVALUATION_ERROR)}},hasEndTag:!0}});import S5 from"path";function tK($,Z){let Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=Y?Y[1].trim():"",Q=Z,J=[],G=!0;if(X){let z=X.match(/export\s+default\s+({[\s\S]*})/);if(z)try{let B=z[1],_=B.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(_)Q=_[1];let j=B.match(/props\s*:\s*\[([\s\S]*?)\]/);if(j)J=j[1].split(",").map((L)=>L.trim().replace(/['"`]/g,"")).filter((L)=>L.length>0);let H=B.match(/shadowDOM\s*:\s*(true|false)/);if(H)G=H[1]==="true"}catch{}}let K=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=K?K[1].trim():"",U=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),W=U?U[1].trim():"";return{tag:Q,props:J,template:q,styles:W,script:X,shadowDOM:G}}function eK($){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,"\\`"),U=Y.map((z)=>`'${z}'`).join(", "),W=Y.map((z)=>`
2769
2769
  get ${z}() {
2770
2770
  return this.getAttribute('${z}') || '';
2771
2771
  }
@@ -2789,7 +2789,7 @@ class ${G} extends HTMLElement {
2789
2789
  }
2790
2790
 
2791
2791
  static get observedAttributes() {
2792
- return [${W}];
2792
+ return [${U}];
2793
2793
  }
2794
2794
 
2795
2795
  attributeChangedCallback(name, oldValue, newValue) {
@@ -2797,7 +2797,7 @@ class ${G} extends HTMLElement {
2797
2797
  this._render();
2798
2798
  }
2799
2799
  }
2800
- ${U}
2800
+ ${W}
2801
2801
 
2802
2802
  _render() {
2803
2803
  const template = \`${q?`<style>${q}</style>`:""}${K}\`;
@@ -2816,16 +2816,16 @@ ${U}
2816
2816
  }
2817
2817
 
2818
2818
  customElements.define('${Z}', ${G});
2819
- `}async function KZ($,Z,Y,X){if(Z.length<1)return t("WebComponent","@webcomponent directive requires at least the tag name parameter",n.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[k5.join(k5.dirname(X),G,`${Q}.stx`),k5.join(process.cwd(),G,`${Q}.stx`),k5.join(k5.dirname(X),`${Q}.stx`)],q=null;for(let z of K)if(await i(z)){q=await Bun.file(z).text();break}if(!q)return t("WebComponent",`Component file not found: ${Q}.stx`,n.FILE_NOT_FOUND);let W=oK(q,Q);return`<script type="module">
2820
- ${sK(W)}
2821
- </script>`}var qZ=b(()=>{t0();H0()});var UZ={};o(UZ,{timingPlugin:()=>$q,pluginManager:()=>rK,definePlugin:()=>p4,debugPlugin:()=>eK,createVariablesPlugin:()=>Zq,createFilterPlugin:()=>tK,createDirectivePlugin:()=>aK,PluginManager:()=>c7});function p4($){return $}class c7{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 aK($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function tK($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function Zq($){return p4({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var rK,eK,$q;var WZ=b(()=>{rK=new c7;eK=p4({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)}}),$q=p4({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 BZ={};o(BZ,{validateConfig:()=>Gq,loadStxConfig:()=>i4,defineStxConfig:()=>Qq,defaultConfig:()=>I1,config:()=>n7});import i7 from"fs";import N0 from"path";import{loadConfigWithResult as Yq}from"bunfig";function Xq($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let X=N0.join(process.cwd(),"resources","views"),Q=N0.join(process.cwd(),"resources","layouts");if(i7.existsSync(X)&&i7.existsSync(Q))return{root:"resources",pagesDir:"views"};let J=N0.join(process.cwd(),"resources","views","pages");if(i7.existsSync(J))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function Jq($){if(d6($.stateDir),$.stateDir=U5(),$.cachePath=z5($.cachePath),$.build)$.build.cacheDir=z5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=z5($.media.cache.directory);if($.story)$.story.outDir=z5($.story.outDir)}async function i4($){if(!$){if(o1)return o1;if(c4)return c4}let Z=$?N0.resolve($):process.cwd(),Y=zZ.get(Z);if(Y)return Y;let X=(async()=>{let J=(await Yq({name:"stx",alias:"ui",cwd:Z,defaultConfig:I1,verbose:!1})).config;Jq(J);let G=Xq(J.root,J.pagesDir);if(J.root=G.root,J.pagesDir=G.pagesDir,J.root&&J.root!=="."){let K=J.root;if(J.partialsDir&&!N0.isAbsolute(J.partialsDir))J.partialsDir=N0.join(K,J.partialsDir);if(J.componentsDir&&!N0.isAbsolute(J.componentsDir))J.componentsDir=N0.join(K,J.componentsDir);if(J.layoutsDir&&!N0.isAbsolute(J.layoutsDir))J.layoutsDir=N0.join(K,J.layoutsDir)}if(J.plugins&&J.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (WZ(),UZ)),q=[],W=[];for(let U of J.plugins){let z=typeof U==="string"?U:U[0],B=typeof U==="string"?{}:U[1]||{};try{let _,j;try{_=await import(z),j=N0.dirname(Q0.resolve(z))}catch{let L=N0.resolve(process.cwd(),z);_=await import(L),j=N0.dirname(L)}let H=_.default||_;if(K.register(H,J),H.components){let L=N0.resolve(j,H.components);q.push(L)}if(H.pages){let L=N0.resolve(j,H.pages),F=B.path||"/";W.push({dir:L,prefix:F})}if(H.setup){let L={addDirective:(F)=>{J.customDirectives=J.customDirectives||[],J.customDirectives.push(F)},addRoute:(F,O)=>{J.apiRoutes=J.apiRoutes||{},J.apiRoutes[F]=O},addMiddleware:(F)=>{J.middleware=J.middleware||[],J.middleware.push(F)},pluginDir:j,config:J};await H.setup(B,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(zZ.set(Z,X),!$)c4=X,X.then((Q)=>{o1=Q}).catch(()=>{});return X}function Qq($){return $}function Gq($){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 I1,o1=null,zZ,c4=null,n7;var b5=b(()=>{d$();m$();u$();l$();Q7();T8();x7();g7();p7();e5();qZ();I1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:g1,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:r9,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:KZ,hasEndTag:!1,description:"Include a web component in the template"},l6,p6,QZ,GZ,c6,n6,o6,i6,t6,Z9,w8,v7,...f7],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}};zZ=new Map;n7=new Proxy(I1,{get($,Z){if(o1&&Z in o1)return o1[Z];if(!c4)i4().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});import K0 from"path";import{hasLocalConfig as Kq}from"bunfig/discovery";function r7($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function s7($,Z){if(D1.has($))D1.delete($);else if(D1.size>=qq)D1.delete(D1.keys().next().value);D1.set($,Z)}async function Uq($){if(!X1)return null;try{let Z=Bun.file(K0.join(X1,`cw-${r7($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function Wq($,Z){if(!X1)return;try{if(!fs.existsSync(X1))fs.mkdirSync(X1,{recursive:!0});await Bun.write(K0.join(X1,`cw-${r7($)}.css`),Z)}catch{}}async function jZ($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig}}catch{}return null}function zq(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"",Y=process.cwd();while(Y!==K0.dirname(Y))$.push(K0.join(Y,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(K0.join(Y,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(K0.join(Y,"pantry","@cwcss","crosswind","dist","index.js")),$.push(K0.join(Y,"pantry","@cwcss","crosswind","src","index.ts")),$.push(K0.join(Y,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(K0.join(Y,"pantry","@stacksjs","crosswind","dist","index.js")),Y=K0.dirname(Y);if(Z){let X=[K0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),K0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),K0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),K0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),K0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),K0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...X)}return $.push(K0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(K0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function Bq(){if(_Z)return S5;_Z=!0;try{let $=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Y of $){let X=await jZ(Y);if(X){if(S5=X,!process.env.STACKS_DEV_QUIET)console.log(`${_0.green}[Crosswind]${_0.reset} CSS engine loaded`);return S5}}let Z=zq();for(let Y of Z)if(await Bun.file(Y).exists()){let X=await jZ(Y);if(X){if(S5=X,!process.env.STACKS_DEV_QUIET)console.log(`${_0.green}[Crosswind]${_0.reset} CSS engine loaded from ${K0.dirname(K0.dirname(Y))}`);return S5}}throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${_0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${_0.reset}`),console.warn(`${_0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${_0.reset}`),null}}async function _q($){try{if(!Kq({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=K0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${_0.green}[Crosswind]${_0.reset} Loaded config from ${X||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${_0.yellow}[Crosswind]${_0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}function jq($){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 Hq($,Z){try{let Y=await Bq();if(!Y)return"";let X=jq($);if(X.size===0)return"";let Q=Z?K0.resolve(Z):process.cwd();if(!X1)X1=W5(Q,"cache");let J=[...X].sort().join(" "),G=`${o7||"default"}::${J}`,K=D1.get(G);if(K!==void 0)return s7(G,K),K;let q=await Uq(G);if(q!==null)return s7(G,q),q;if(!n4){let A=null;try{let{loadStxConfig:N}=await Promise.resolve().then(() => (b5(),BZ)),w=await N(Q);if(w.css)if(typeof w.css==="string"){let T=K0.isAbsolute(w.css)?w.css:K0.resolve(Q,w.css);if(await Bun.file(T).exists()){let M=await import(T);A=M.default||M,console.log(`${_0.green}[Crosswind]${_0.reset} Loaded config from stx.config.ts \u2192 ${w.css}`)}}else{if(A={...w.css,content:w.css.content||[],preflight:w.css.preflight??!0,minify:w.css.minify??!1},w.css.config){let T=K0.isAbsolute(w.css.config)?w.css.config:K0.resolve(Q,w.css.config);if(await Bun.file(T).exists()){let M=await import(T);A={...M.default||M,...A}}}console.log(`${_0.green}[Crosswind]${_0.reset} Using inline CSS config from stx.config.ts`)}}catch{}n4=A||await _q(Q);try{o7=r7(JSON.stringify(n4??{}))}catch{o7="unhashable"}}let W=Y.defaultConfig||Y.config,U=n4||{},z=W.theme||{},_=(U.theme||{}).extend||{},j={...z};if(Object.keys(_).length>0)j.extend=_;let H=[...W.safelist||[],...U.safelist||[]],L={...W,...U,content:[],output:"",preflight:!0,minify:!1,theme:j,safelist:H},F=new Y.CSSGenerator(L);for(let A of H)F.generate(A);for(let A of X)F.generate(A);let O=F.toCSS(!0,!1),V=L.shortcuts||U.shortcuts||{};for(let[A,N]of Object.entries(V)){if(!X.has(A)&&!H.includes(A))continue;let w=N.split(/\s+/).filter(Boolean);for(let T of w)F.generate(T)}O=F.toCSS(!0,!1);let R=O.split(`
2822
- `);for(let[A,N]of Object.entries(V)){if(!X.has(A)&&!H.includes(A))continue;let w=N.split(/\s+/).filter(Boolean),T=[],M=[];for(let I of w){let D=I.startsWith("dark:"),S=`.${(D?I.slice(5):I).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let k=0;k<R.length;k++){let P=R[k].trim();if(P===`${S} {`||P.startsWith(`${S} {`)){let d=k,g="";while(d<R.length){if(g+=R[d],R[d].includes("}"))break;d++}let m=g.match(/\{([^}]+)\}/);if(m)if(D)M.push(m[1].trim());else T.push(m[1].trim());break}}}if(T.length)O+=`
2823
- .${A} { ${T.join(" ")} }`;if(M.length)O+=`
2824
- @media (prefers-color-scheme: dark) { .dark .${A} { ${M.join(" ")} } }`}return s7(G,O),Wq(G,O),O}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function HZ($,Z){let Y=await Hq($,Z);if(!Y)return $;let X=`<style data-crosswind="generated">
2819
+ `}async function qZ($,Z,Y,X){if(Z.length<1)return t("WebComponent","@webcomponent directive requires at least the tag name parameter",n.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[S5.join(S5.dirname(X),G,`${Q}.stx`),S5.join(process.cwd(),G,`${Q}.stx`),S5.join(S5.dirname(X),`${Q}.stx`)],q=null;for(let z of K)if(await i(z)){q=await Bun.file(z).text();break}if(!q)return t("WebComponent",`Component file not found: ${Q}.stx`,n.FILE_NOT_FOUND);let U=tK(q,Q);return`<script type="module">
2820
+ ${eK(U)}
2821
+ </script>`}var UZ=b(()=>{e0();H0()});var WZ={};o(WZ,{timingPlugin:()=>Jq,pluginManager:()=>$q,definePlugin:()=>p4,debugPlugin:()=>Xq,createVariablesPlugin:()=>Qq,createFilterPlugin:()=>Yq,createDirectivePlugin:()=>Zq,PluginManager:()=>i7});function p4($){return $}class i7{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 Zq($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function Yq($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function Qq($){return p4({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var $q,Xq,Jq;var zZ=b(()=>{$q=new i7;Xq=p4({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)}}),Jq=p4({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 _Z={};o(_Z,{validateConfig:()=>Wq,loadStxConfig:()=>i4,defineStxConfig:()=>Uq,defaultConfig:()=>I1,config:()=>o7});import n7 from"fs";import w0 from"path";import{loadConfigWithResult as Gq}from"bunfig";function Kq($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let X=w0.join(process.cwd(),"resources","views"),Q=w0.join(process.cwd(),"resources","layouts");if(n7.existsSync(X)&&n7.existsSync(Q))return{root:"resources",pagesDir:"views"};let J=w0.join(process.cwd(),"resources","views","pages");if(n7.existsSync(J))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function qq($){if(m6($.stateDir),$.stateDir=z5(),$.cachePath=_5($.cachePath),$.build)$.build.cacheDir=_5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=_5($.media.cache.directory);if($.story)$.story.outDir=_5($.story.outDir)}async function i4($){if(!$){if(o1)return o1;if(c4)return c4}let Z=$?w0.resolve($):process.cwd(),Y=BZ.get(Z);if(Y)return Y;let X=(async()=>{let J=(await Gq({name:"stx",alias:"ui",cwd:Z,defaultConfig:I1,verbose:!1})).config;qq(J);let G=Kq(J.root,J.pagesDir);if(J.root=G.root,J.pagesDir=G.pagesDir,J.root&&J.root!=="."){let K=J.root;if(J.partialsDir&&!w0.isAbsolute(J.partialsDir))J.partialsDir=w0.join(K,J.partialsDir);if(J.componentsDir&&!w0.isAbsolute(J.componentsDir))J.componentsDir=w0.join(K,J.componentsDir);if(J.layoutsDir&&!w0.isAbsolute(J.layoutsDir))J.layoutsDir=w0.join(K,J.layoutsDir)}if(J.plugins&&J.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (zZ(),WZ)),q=[],U=[];for(let W of J.plugins){let z=typeof W==="string"?W:W[0],B=typeof W==="string"?{}:W[1]||{};try{let _,j;try{_=await import(z),j=w0.dirname(Q0.resolve(z))}catch{let L=w0.resolve(process.cwd(),z);_=await import(L),j=w0.dirname(L)}let H=_.default||_;if(K.register(H,J),H.components){let L=w0.resolve(j,H.components);q.push(L)}if(H.pages){let L=w0.resolve(j,H.pages),F=B.path||"/";U.push({dir:L,prefix:F})}if(H.setup){let L={addDirective:(F)=>{J.customDirectives=J.customDirectives||[],J.customDirectives.push(F)},addRoute:(F,O)=>{J.apiRoutes=J.apiRoutes||{},J.apiRoutes[F]=O},addMiddleware:(F)=>{J.middleware=J.middleware||[],J.middleware.push(F)},pluginDir:j,config:J};await H.setup(B,L)}console.log(`[stx] Plugin loaded: ${H.name||z}`)}catch(_){console.warn(`[stx] Failed to load plugin ${z}:`,_.message)}}J._pluginComponentDirs=q,J._pluginPageDirs=U}return J})();if(BZ.set(Z,X),!$)c4=X,X.then((Q)=>{o1=Q}).catch(()=>{});return X}function Uq($){return $}function Wq($){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 I1,o1=null,BZ,c4=null,o7;var y5=b(()=>{d$();m$();u$();l$();G7();M8();f7();h7();c7();e5();UZ();I1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:g1,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:a9,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:qZ,hasEndTag:!1,description:"Include a web component in the template"},p6,c6,GZ,KZ,i6,o6,s6,n6,e6,Y9,T8,x7,...g7],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}};BZ=new Map;o7=new Proxy(I1,{get($,Z){if(o1&&Z in o1)return o1[Z];if(!c4)i4().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});import K0 from"path";import{hasLocalConfig as zq}from"bunfig/discovery";function a7($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function r7($,Z){if(D1.has($))D1.delete($);else if(D1.size>=Bq)D1.delete(D1.keys().next().value);D1.set($,Z)}async function _q($){if(!J1)return null;try{let Z=Bun.file(K0.join(J1,`cw-${a7($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function jq($,Z){if(!J1)return;try{if(!fs.existsSync(J1))fs.mkdirSync(J1,{recursive:!0});await Bun.write(K0.join(J1,`cw-${a7($)}.css`),Z)}catch{}}async function HZ($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig}}catch{}return null}function Hq(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"",Y=process.cwd();while(Y!==K0.dirname(Y))$.push(K0.join(Y,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(K0.join(Y,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(K0.join(Y,"pantry","@cwcss","crosswind","dist","index.js")),$.push(K0.join(Y,"pantry","@cwcss","crosswind","src","index.ts")),$.push(K0.join(Y,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(K0.join(Y,"pantry","@stacksjs","crosswind","dist","index.js")),Y=K0.dirname(Y);if(Z){let X=[K0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),K0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),K0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),K0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),K0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),K0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...X)}return $.push(K0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(K0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function Oq(){if(jZ)return P5;jZ=!0;try{let $=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Y of $){let X=await HZ(Y);if(X){if(P5=X,!process.env.STACKS_DEV_QUIET)console.log(`${_0.green}[Crosswind]${_0.reset} CSS engine loaded`);return P5}}let Z=Hq();for(let Y of Z)if(await Bun.file(Y).exists()){let X=await HZ(Y);if(X){if(P5=X,!process.env.STACKS_DEV_QUIET)console.log(`${_0.green}[Crosswind]${_0.reset} CSS engine loaded from ${K0.dirname(K0.dirname(Y))}`);return P5}}throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${_0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${_0.reset}`),console.warn(`${_0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${_0.reset}`),null}}async function Lq($){try{if(!zq({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=K0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${_0.green}[Crosswind]${_0.reset} Loaded config from ${X||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${_0.yellow}[Crosswind]${_0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}function Fq($){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 Vq($,Z){try{let Y=await Oq();if(!Y)return"";let X=Fq($);if(X.size===0)return"";let Q=Z?K0.resolve(Z):process.cwd();if(!J1)J1=B5(Q,"cache");let J=[...X].sort().join(" "),G=`${s7||"default"}::${J}`,K=D1.get(G);if(K!==void 0)return r7(G,K),K;let q=await _q(G);if(q!==null)return r7(G,q),q;if(!n4){let N=null;try{let{loadStxConfig:A}=await Promise.resolve().then(() => (y5(),_Z)),w=await A(Q);if(w.css)if(typeof w.css==="string"){let T=K0.isAbsolute(w.css)?w.css:K0.resolve(Q,w.css);if(await Bun.file(T).exists()){let M=await import(T);N=M.default||M,console.log(`${_0.green}[Crosswind]${_0.reset} Loaded config from stx.config.ts \u2192 ${w.css}`)}}else{if(N={...w.css,content:w.css.content||[],preflight:w.css.preflight??!0,minify:w.css.minify??!1},w.css.config){let T=K0.isAbsolute(w.css.config)?w.css.config:K0.resolve(Q,w.css.config);if(await Bun.file(T).exists()){let M=await import(T);N={...M.default||M,...N}}}console.log(`${_0.green}[Crosswind]${_0.reset} Using inline CSS config from stx.config.ts`)}}catch{}n4=N||await Lq(Q);try{s7=a7(JSON.stringify(n4??{}))}catch{s7="unhashable"}}let U=Y.defaultConfig||Y.config,W=n4||{},z=U.theme||{},_=(W.theme||{}).extend||{},j={...z};if(Object.keys(_).length>0)j.extend=_;let H=[...U.safelist||[],...W.safelist||[]],L={...U,...W,content:[],output:"",preflight:!0,minify:!1,theme:j,safelist:H},F=new Y.CSSGenerator(L);for(let N of H)F.generate(N);for(let N of X)F.generate(N);let O=F.toCSS(!0,!1),V=L.shortcuts||W.shortcuts||{};for(let[N,A]of Object.entries(V)){if(!X.has(N)&&!H.includes(N))continue;let w=A.split(/\s+/).filter(Boolean);for(let T of w)F.generate(T)}O=F.toCSS(!0,!1);let R=O.split(`
2822
+ `);for(let[N,A]of Object.entries(V)){if(!X.has(N)&&!H.includes(N))continue;let w=A.split(/\s+/).filter(Boolean),T=[],M=[];for(let I of w){let D=I.startsWith("dark:"),S=`.${(D?I.slice(5):I).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let k=0;k<R.length;k++){let y=R[k].trim();if(y===`${S} {`||y.startsWith(`${S} {`)){let d=k,g="";while(d<R.length){if(g+=R[d],R[d].includes("}"))break;d++}let m=g.match(/\{([^}]+)\}/);if(m)if(D)M.push(m[1].trim());else T.push(m[1].trim());break}}}if(T.length)O+=`
2823
+ .${N} { ${T.join(" ")} }`;if(M.length)O+=`
2824
+ @media (prefers-color-scheme: dark) { .dark .${N} { ${M.join(" ")} } }`}return r7(G,O),jq(G,O),O}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function OZ($,Z){let Y=await Vq($,Z);if(!Y)return $;let X=`<style data-crosswind="generated">
2825
2825
  ${Y}
2826
2826
  </style>`,Q=/<style data-crosswind="generated">[\s\S]*?<\/style>/g;if(Q.test($)){let J=!1;return $.replace(Q,()=>{if(J)return"";return J=!0,X})}if($.includes("</head>"))return $.replace("</head>",`${X}
2827
2827
  </head>`);if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
2828
- ${X}`);return X+$}var S5=null,_Z=!1,n4=null,qq=256,D1,X1=null,o7=null;var OZ=b(()=>{e5();m6();D1=new Map});function LZ(){return`
2828
+ ${X}`);return X+$}var P5=null,jZ=!1,n4=null,Bq=256,D1,J1=null,s7=null;var LZ=b(()=>{e5();u6();D1=new Map});function FZ(){return`
2829
2829
  // STX Lifecycle Runtime
2830
2830
  (function() {
2831
2831
  if (typeof window === 'undefined') return;
@@ -3170,7 +3170,7 @@ else {
3170
3170
 
3171
3171
  console.log('[stx] Lifecycle runtime initialized');
3172
3172
  })();
3173
- `}function a7($){return Symbol($)}var ZL,YL,XL;var FZ=b(()=>{ZL=a7("theme"),YL=a7("router"),XL=a7("i18n")});import*as RZ from"crypto";function VZ($){let Z=/\$(\w+)\./g,Y=[],X;while((X=Z.exec($))!==null)if(!Y.includes(X[1]))Y.push(X[1]);return Y}function Oq(){return`stx-${RZ.randomBytes(4).toString("hex")}`}function Lq($){return/\$\w+\./.test($)}function Fq($){let Z=[],Y=new Set,X=/<(\w+)([^>]*?)(\s*\/?>)/g,Q=$;return Q=Q.replace(X,(J,G,K,q)=>{if(["script","style","template"].includes(G.toLowerCase()))return J;let W=[],U=!1,z=K,B=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,_=[...K.matchAll(B)];for(let L of _){let F=L[0],O=L[1],V=L[2];if(Lq(V)){U=!0;let R=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(R){let A=R[1];if(W.push({attr:O,expr:A,fullMatch:F,originalAttr:O}),VZ(A).forEach((w)=>Y.add(w)),O==="text")z=z.replace(F,"");else if(O==="class")z=z.replace(F,'class=""');else if(O==="disabled"||O==="hidden")z=z.replace(F,"");else z=z.replace(F,`${O}=""`)}}}if(!U)return J;let j=z.match(/\bid\s*=\s*"([^"]+)"/),H;if(j)H=j[1];else H=Oq(),z=` id="${H}"${z}`;for(let L of W)Z.push({elementId:H,attribute:L.attr,expression:L.expr,stores:VZ(L.expr)});return`<${G}${z}${q}`}),{html:Q,bindings:Z,stores:Y}}function Vq($,Z){if($.length===0)return"";let Y=Array.from(Z),X=`
3173
+ `}function t7($){return Symbol($)}var QL,GL,KL;var VZ=b(()=>{QL=t7("theme"),GL=t7("router"),KL=t7("i18n")});import*as NZ from"crypto";function RZ($){let Z=/\$(\w+)\./g,Y=[],X;while((X=Z.exec($))!==null)if(!Y.includes(X[1]))Y.push(X[1]);return Y}function Rq(){return`stx-${NZ.randomBytes(4).toString("hex")}`}function Nq($){return/\$\w+\./.test($)}function Aq($){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 U=[],W=!1,z=K,B=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,_=[...K.matchAll(B)];for(let L of _){let F=L[0],O=L[1],V=L[2];if(Nq(V)){W=!0;let R=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(R){let N=R[1];if(U.push({attr:O,expr:N,fullMatch:F,originalAttr:O}),RZ(N).forEach((w)=>Y.add(w)),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(!W)return J;let j=z.match(/\bid\s*=\s*"([^"]+)"/),H;if(j)H=j[1];else H=Rq(),z=` id="${H}"${z}`;for(let L of U)Z.push({elementId:H,attribute:L.attr,expression:L.expr,stores:RZ(L.expr)});return`<${G}${z}${q}`}),{html:Q,bindings:Z,stores:Y}}function wq($,Z){if($.length===0)return"";let Y=Array.from(Z),X=`
3174
3174
  <script>
3175
3175
  (function() {
3176
3176
  'use strict';
@@ -3328,10 +3328,10 @@ else {
3328
3328
  }
3329
3329
  })();
3330
3330
  </script>
3331
- `,X}function AZ($){let{html:Z,bindings:Y,stores:X}=Fq($);if(Y.length===0)return $;let Q=Vq(Y,X),J=Z.lastIndexOf("</body>");if(J!==-1)return Z.slice(0,J)+Q+Z.slice(J);return Z+Q}var NZ=()=>{};function Rq($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return Aq(Z);case"google-analytics":return Nq(Z);case"plausible":return wq(Z);case"self-hosted":return Tq(Z);case"custom":return Mq(Z);default:return""}}function Aq($){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="${b0(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="${b0(Z.canonical)}"`);if(Z.auto===!1)Q.push('data-auto="false"');return`
3331
+ `,X}function AZ($){let{html:Z,bindings:Y,stores:X}=Aq($);if(Y.length===0)return $;let Q=wq(Y,X),J=Z.lastIndexOf("</body>");if(J!==-1)return Z.slice(0,J)+Q+Z.slice(J);return Z+Q}var wZ=()=>{};function Tq($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return Mq(Z);case"google-analytics":return Iq(Z);case"plausible":return Dq(Z);case"self-hosted":return Eq(Z);case"custom":return kq(Z);default:return""}}function Mq($){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="${b0(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="${b0(Z.canonical)}"`);if(Z.auto===!1)Q.push('data-auto="false"');return`
3332
3332
  <!-- Fathom Analytics -->
3333
3333
  <script src="${b0(Y)}" ${Q.join(" ")}${X}></script>
3334
- `}function Nq($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let Y=b0(Z.measurementId),X=Z.debug?`gtag('config', '${Y}', { 'debug_mode': true });`:"";return`
3334
+ `}function Iq($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let Y=b0(Z.measurementId),X=Z.debug?`gtag('config', '${Y}', { 'debug_mode': true });`:"";return`
3335
3335
  <!-- Google Analytics -->
3336
3336
  <script async src="https://www.googletagmanager.com/gtag/js?id=${Y}"></script>
3337
3337
  <script>
@@ -3341,10 +3341,10 @@ else {
3341
3341
  gtag('config', '${Y}');
3342
3342
  ${X}
3343
3343
  </script>
3344
- `}function wq($){let Z=$.plausible;if(!Z?.domain)return"";let Y=Z.scriptUrl||"https://plausible.io/js/script.js",X=[`data-domain="${b0(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`
3344
+ `}function Dq($){let Z=$.plausible;if(!Z?.domain)return"";let Y=Z.scriptUrl||"https://plausible.io/js/script.js",X=[`data-domain="${b0(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`
3345
3345
  <!-- Plausible Analytics -->
3346
3346
  <script defer data-domain="${b0(Z.domain)}" src="${b0(Q)}"></script>
3347
- `}function Tq($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let Y=b0(Z.siteId),X=b0(Z.apiEndpoint),Q=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",J=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
3347
+ `}function Eq($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let Y=b0(Z.siteId),X=b0(Z.apiEndpoint),Q=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",J=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
3348
3348
  d.addEventListener('click',function(e){
3349
3349
  var a=e.target.closest('a');
3350
3350
  if(a&&a.hostname!==location.hostname){
@@ -3377,7 +3377,7 @@ else {
3377
3377
  w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
3378
3378
  })();
3379
3379
  </script>
3380
- `}function Mq($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
3380
+ `}function kq($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
3381
3381
  <!-- Custom Analytics -->
3382
3382
  <script>
3383
3383
  ${Z.inlineScript}
@@ -3385,7 +3385,7 @@ ${Z.inlineScript}
3385
3385
  `;if(!Z.scriptUrl)return"";let Y=[];if(Z.scriptId)Y.push(`id="${b0(Z.scriptId)}"`);if(Z.attributes)for(let[Q,J]of Object.entries(Z.attributes))Y.push(`${b0(Q)}="${b0(J)}"`);return`
3386
3386
  <!-- Custom Analytics -->
3387
3387
  <script${Y.length>0?` ${Y.join(" ")}`:""} src="${b0(Z.scriptUrl)}" defer></script>
3388
- `}function wZ($,Z){let Y=Rq(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 b0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var TZ=()=>{};function DZ($){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(Iq.has(X))Z.systemKeys.push(X);else if(X in EZ)Z.mouse=X;else if(X in IZ||/^[a-z]$/.test(X))Z.keys.push(IZ[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 kZ($){let Z=[],Y=0,X=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Q;while((Q=X.exec($))!==null){let[J,G,K]=Q,q=Q.index,W=q+J.length,U=`__stx_evt_${Y++}`,z=[],B=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,_;while((_=B.exec(K))!==null){let[,H,L]=_,F=H.split("."),O=F[0];if(!MZ.has(O))continue;z.push({attribute:`@${H}`,event:O,handler:L,modifiers:DZ(F.slice(1)),elementId:U})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((_=j.exec(K))!==null){let[,H,L]=_,F=H.split("."),O=F[0];if(!MZ.has(O))continue;z.push({attribute:`@${H}`,event:O,handler:L,modifiers:DZ(F.slice(1)),elementId:U})}if(z.length>0)Z.push({originalTag:J,elementId:U,events:z,startIndex:q,endIndex:W})}return Z}function Dq($){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=EZ[Y.mouse];Z.push(`if ($event.button !== ${X}) return`)}if(Y.prevent)Z.push("$event.preventDefault()");if(Y.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function Eq($,Z){let Y=$;if(Z.debounce!==null)Y=`__stx_debounce(() => { ${Y} }, ${Z.debounce})`;else if(Z.throttle!==null)Y=`__stx_throttle(() => { ${Y} }, ${Z.throttle})`;return Y}function kq($){let{modifiers:Z}=$,Y=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=Dq($),Q=Eq($.handler,Z),J=[];if(Z.once)J.push("once: true");if(Z.capture)J.push("capture: true");if(Z.passive)J.push("passive: true");let G=J.length>0?`, { ${J.join(", ")} }`:"",K=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
3388
+ `}function TZ($,Z){let Y=Tq(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 b0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var MZ=()=>{};function EZ($){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(bq.has(X))Z.systemKeys.push(X);else if(X in kZ)Z.mouse=X;else if(X in DZ||/^[a-z]$/.test(X))Z.keys.push(DZ[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 bZ($){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,U=q+J.length,W=`__stx_evt_${Y++}`,z=[],B=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,_;while((_=B.exec(K))!==null){let[,H,L]=_,F=H.split("."),O=F[0];if(!IZ.has(O))continue;z.push({attribute:`@${H}`,event:O,handler:L,modifiers:EZ(F.slice(1)),elementId:W})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((_=j.exec(K))!==null){let[,H,L]=_,F=H.split("."),O=F[0];if(!IZ.has(O))continue;z.push({attribute:`@${H}`,event:O,handler:L,modifiers:EZ(F.slice(1)),elementId:W})}if(z.length>0)Z.push({originalTag:J,elementId:W,events:z,startIndex:q,endIndex:U})}return Z}function Sq($){let Z=[],{modifiers:Y}=$;if(Y.self)Z.push("if ($event.target !== $el) return");for(let X of Y.systemKeys)Z.push(`if (!$event.${X}Key) return`);if(Y.keys.length>0){let X=Y.keys.map((Q)=>`$event.key === '${Q}'`).join(" || ");Z.push(`if (!(${X})) return`)}if(Y.mouse!==null){let X=kZ[Y.mouse];Z.push(`if ($event.button !== ${X}) return`)}if(Y.prevent)Z.push("$event.preventDefault()");if(Y.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function yq($,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 Pq($){let{modifiers:Z}=$,Y=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=Sq($),Q=yq($.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`
3389
3389
  (function() {
3390
3390
  var $el = document.getElementById('${Y}');
3391
3391
  if (!$el) return;
@@ -3439,7 +3439,7 @@ else {
3439
3439
  __stx_runHandler('${K}', $event, $el);
3440
3440
  }
3441
3441
  }${G});
3442
- })();`}function bq($){if($.length===0)return"";return`
3442
+ })();`}function Cq($){if($.length===0)return"";return`
3443
3443
  <script data-stx-events>
3444
3444
  (function() {
3445
3445
  'use strict';
@@ -3487,11 +3487,11 @@ else {
3487
3487
  }
3488
3488
 
3489
3489
  // Event listeners
3490
- ${$.flatMap((Y)=>Y.events).map(kq).join(`
3490
+ ${$.flatMap((Y)=>Y.events).map(Pq).join(`
3491
3491
  `)}
3492
3492
  })();
3493
- </script>`}function Sq($){let Z=kZ($);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 bZ($,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}=Sq($),U=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...U,...W],q}let Q=kZ($);if(Q.length===0)return $;let J=$;for(let q=Q.length-1;q>=0;q--){let W=Q[q],U=W.originalTag;if(!U.includes(" id="))U=U.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${W.elementId}"`);else{let z=U.match(/id=["']([^"']+)["']/);if(z)for(let B of W.events)B.elementId=z[1]}for(let z of W.events){let B=z.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),_=new RegExp(`\\s*${B}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${B}\\s*=\\s*'[^']*'`,"g");U=U.replace(_,""),U=U.replace(j,"")}J=J.slice(0,W.startIndex)+U+J.slice(W.endIndex)}let G=bq(Q),K=J.lastIndexOf("</body>");if(K!==-1)J=J.slice(0,K)+G+`
3494
- `+J.slice(K);else J+=G;return J}var MZ,IZ,Iq,EZ;var SZ=b(()=>{MZ=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"]),IZ={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"},Iq=new Set(["ctrl","alt","shift","meta"]),EZ={left:0,middle:1,right:2}});function o4($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function yZ($,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 Pq($){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=yZ(G,"x-data");if(!q)continue;let W=`__stx_scope_${CZ++}`,U=yZ(G,"x-init"),z=Cq($,J,K+Q.length),B=$.slice(K,z.endIndex),_=vq(B);Z.push({id:W,selector:`[data-stx-scope="${W}"]`,stateExpr:q,initExpr:U,bindings:[],refs:_})}return Z}function Cq($,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 vq($){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=xq(J);Z.set(G,K)}return Z}function xq($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${yq++}`}function fq(){return`
3493
+ </script>`}function vq($){let Z=bZ($);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,"\\$&"),U=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),W=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");G=G.replace(U,""),G=G.replace(W,"")}Y=Y.slice(0,J.startIndex)+G+Y.slice(J.endIndex),X.push(...J.events)}return{template:Y,bindings:X}}function SZ($,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:U}=vq($),W=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...W,...U],q}let Q=bZ($);if(Q.length===0)return $;let J=$;for(let q=Q.length-1;q>=0;q--){let U=Q[q],W=U.originalTag;if(!W.includes(" id="))W=W.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${U.elementId}"`);else{let z=W.match(/id=["']([^"']+)["']/);if(z)for(let B of U.events)B.elementId=z[1]}for(let z of U.events){let B=z.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),_=new RegExp(`\\s*${B}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${B}\\s*=\\s*'[^']*'`,"g");W=W.replace(_,""),W=W.replace(j,"")}J=J.slice(0,U.startIndex)+W+J.slice(U.endIndex)}let G=Cq(Q),K=J.lastIndexOf("</body>");if(K!==-1)J=J.slice(0,K)+G+`
3494
+ `+J.slice(K);else J+=G;return J}var IZ,DZ,bq,kZ;var yZ=b(()=>{IZ=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"]),DZ={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"},bq=new Set(["ctrl","alt","shift","meta"]),kZ={left:0,middle:1,right:2}});function o4($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function PZ($,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 fq($){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=PZ(G,"x-data");if(!q)continue;let U=`__stx_scope_${vZ++}`,W=PZ(G,"x-init"),z=gq($,J,K+Q.length),B=$.slice(K,z.endIndex),_=hq(B);Z.push({id:U,selector:`[data-stx-scope="${U}"]`,stateExpr:q,initExpr:W,bindings:[],refs:_})}return Z}function gq($,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($),U=G.exec($),W=K.exec($);if(W&&W.index<(q?.index??1/0)){Q=W.index+W[0].length;continue}if(!U)return{endIndex:$.length};if(q&&q.index<U.index)X++,Q=q.index+q[0].length;else{if(X--,X===0)return{endIndex:U.index+U[0].length};Q=U.index+U[0].length}}return{endIndex:$.length}}function hq($){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=dq(J);Z.set(G,K)}return Z}function dq($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${xq++}`}function mq(){return`
3495
3495
  // STX Reactive Runtime - x-cloak and transition CSS
3496
3496
  (function() {
3497
3497
  var style = document.createElement('style');
@@ -3698,7 +3698,7 @@ window.__stx_reactive = (function() {
3698
3698
 
3699
3699
  return { initScope: initScope, reactive: reactive };
3700
3700
  })();
3701
- `}function PZ($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=f0(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=f0(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 gq($,Z){if($.length===0)return"";let Y=$.map((X)=>{let Q=JSON.stringify(Object.fromEntries(X.refs)),J=PZ(X.stateExpr,Z),G=X.initExpr?PZ(X.initExpr,Z):null,K=JSON.stringify(J),q=G?JSON.stringify(G):"null";return`
3701
+ `}function CZ($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=x0(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=x0(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 uq($,Z){if($.length===0)return"";let Y=$.map((X)=>{let Q=JSON.stringify(Object.fromEntries(X.refs)),J=CZ(X.stateExpr,Z),G=X.initExpr?CZ(X.initExpr,Z):null,K=JSON.stringify(J),q=G?JSON.stringify(G):"null";return`
3702
3702
  (function() {
3703
3703
  var scopeEl = document.querySelector('${X.selector}');
3704
3704
  if (!scopeEl) return;
@@ -3707,16 +3707,16 @@ window.__stx_reactive = (function() {
3707
3707
  })();`}).join(`
3708
3708
  `);return`
3709
3709
  <script data-stx-scoped data-stx-reactive>
3710
- ${fq()}
3710
+ ${mq()}
3711
3711
  ${Y}
3712
- </script>`}function vZ($,Z,Y){if(CZ=0,!dq($))return $;let X=Pq($);if(X.length===0)return $;let Q=hq($,X),J=gq(X,Z),G=Q.lastIndexOf("</body>");if(G!==-1)Q=Q.slice(0,G)+J+`
3713
- `+Q.slice(G);else Q+=J;return Q}function hq($,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*["']${o4(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*["']${o4(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*"${o4(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*'${o4(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 dq($){return/x-data\s*=\s*["']/.test($)}var CZ=0,yq=0;var xZ=b(()=>{c0()});import mq from"fs";import t7 from"path";import{createHighlighter as uq}from"ts-syntax-highlighter";async function lq($,Z={}){try{if(!await i($))throw Error(`Markdown file not found: ${$}`);let X=(await mq.promises.stat($)).mtime.getTime();if(Z.cache&&e7.has($)){let z=e7.get($);if(z.updatedAt>=X)return{content:z.content,data:z.data}}let Q=await Bun.file($).text(),{data:J,content:G}=X9(Q),K=Z.markdown||n7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=B5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)W=await pq(W,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let U={content:W,data:J||{}};if(Z.cache)e7.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:G0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}async function pq($,Z,Y){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!s4)try{s4=await uq({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let Q=async(K,q,W,U)=>{let z=U.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),B=W||(Y?"text":"");if(!B)return K;try{if(!s4.getSupportedLanguages().includes(B))return K;return(await s4.highlight(z,B,{theme:Z})).html}catch(_){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,B=await Q(q,W,U,z);J=J.replace(q,B)}return J}async function fZ($,Z,Y="",X={}){return await cq($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,W)=>{try{let U=K;if(!t7.isAbsolute(K))U=t7.resolve(t7.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 R=V.indexOf(":");if(R>0){let A=V.substring(0,R).trim(),N=V.substring(R+1).trim(),w=N.startsWith('"')&&N.endsWith('"'),T=N.startsWith("'")&&N.endsWith("'");if(w||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:B,data:_}=await lq(U,X),j={...Z,..._,...z},H=B,L=/\{\{([^}]+)\}\}/g;return H=H.replace(L,(F,O)=>{let V=O.trim();return j[V]!==void 0?String(j[V]):F}),H}catch(U){let z=U instanceof Error?U.message:String(U);return G0("Markdown File",`Error including markdown file: ${z}`,Y,$,W,G)}})}async function cq($,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 e7,s4=null;var gZ=b(()=>{b5();H0();e7=new Map});function J1($,Z){try{let Y=$.trim();if(X0(Y))return J0(Y,Object.keys(Z))(...Object.values(Z));else return $0(Y,Z)}catch{return!1}}var hZ=b(()=>{L0()});function Q1($,Z){let Y=iq($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function iq($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let X=D0($,"(",")",Y);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,X),endPos:X+1}}function nq($,Z){let Y=$.lastIndexOf("<",Z);if(Y===-1)return!1;return Y>$.lastIndexOf(">",Z)}function E1($,Z,Y,X){let Q=1,J=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(J<$.length&&Q>0){G.lastIndex=J,K.lastIndex=J;let q=G.exec($),W=K.exec($),U=q?q.index:1/0,z=W?W.index:1/0;if(U<z)Q++,J=U+q[0].length;else if(z<1/0){if(Q--,Q===0)return z;J=z+W[0].length}else break}return-1}function dZ($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let X=Z+Y[0].length,Q=Q1($,X);if(!Q)return null;let J=Q.endPos,G=E1($,"if","endif",J);if(G===-1)return null;let K=$.slice(J,G),q=[],W=0,U="if",z=Q.expression,B=0,_=0;while(W<K.length){let j=K.indexOf("@",W);if(j===-1)break;W=j;let H=K.substring(j);if(nq(K,j)){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(B,W),start:J+B,end:J+W});let F=W+L[0].length,O=Q1(K,F);if(!O){W++;continue}U="elseif",z=O.expression,W=O.endPos,B=W;continue}else if(/^@else(?![a-z])/.test(H)){q.push({type:U,condition:z,content:K.substring(B,W),start:J+B,end:J+W}),U="else",z=void 0,W+=5,B=W;continue}}W++}return q.push({type:U,condition:z,content:K.slice(B),start:J+B,end:J+K.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function y5($){let Z=[],Y=/@if\s*\(/g,X=Y.exec($);while(X!==null){if(Z.some((G)=>X.index>G.start&&X.index<G.end)){X=Y.exec($);continue}let J=dZ($,X.index);if(J)Z.push(J),Y.lastIndex=J.end;X=Y.exec($)}return Z}function r4($,Z,Y){let X=[],Q=new RegExp(`@${Z}\\s*\\(`,"g"),J=Q.exec($);while(J!==null){if(X.some((H)=>J.index>H.start&&J.index<H.end)){J=Q.exec($);continue}let K=J.index,q=K+J[0].length-1,W=D0($,"(",")",q);if(W===-1){J=Q.exec($);continue}let U=$.slice(q+1,W),z=W+1,B=E1($,Z,Y,z);if(B===-1){J=Q.exec($);continue}let _=$.slice(z,B),j=B+`@${Y}`.length;X.push({fullMatch:$.slice(K,j),name:Z,params:U,content:_,start:K,end:j}),Q.lastIndex=j,J=Q.exec($)}return X}function $3($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let X=Z+Y[0].length,Q=Q1($,X);if(!Q)return null;let J=Q.endPos,G=E1($,"switch","endswitch",J);if(G===-1)return null;let K=$.slice(J,G),q=[],W=0,U=null,z=0;while(W<K.length){let B=K.slice(W),_=B.match(/^@switch\s*\(/),j=B.match(/^@endswitch(?![a-z])/);if(_){if(z++,U)U.content+=_[0];W+=_[0].length;continue}if(j){if(z--,U)U.content+=j[0];W+=j[0].length;continue}if(z>0){if(U)U.content+=K[W];W++;continue}let H=B.match(/^@case\s*/),L=B.match(/^@default(?![a-z])/),F=B.match(/^@break(?![a-z])/);if(H&&B.startsWith("@case")){if(U)q.push(U);let O=W+H[0].length,V=Q1(K,O);if(!V){W++;continue}U={type:"case",value:V.expression,content:""},W=V.endPos}else if(L&&B.startsWith("@default")){if(U)q.push(U);U={type:"default",content:""},W+=L[0].length}else if(F&&B.startsWith("@break"))W+=F[0].length;else{if(U)U.content+=K[W];W++}}if(U)q.push(U);return{fullMatch:$.slice(Z,G+10),expression:Q.expression,cases:q,start:Z,end:G+10}}var mZ=()=>{};var uZ=()=>{};var a4=b(()=>{mZ();uZ()});function aq($,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=$3(X,G);if(!K)break;try{let q;if(X0(K.expression))q=J0(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 B;if(z.value&&X0(z.value))B=J0(z.value,Object.keys(Z))(...Object.values(Z));else if(z.value)B=$0(z.value,Z);if(q===B){W=z.content.trim(),U=!0;break}}catch{continue}X=X.substring(0,G)+W+X.substring(K.end),Q=!0}catch(q){let W=q instanceof Error?q.message:String(q),U=t("Switch",`Error evaluating @switch expression: ${W}`,n.EVALUATION_ERROR);X=X.substring(0,G)+U+X.substring(K.end);break}}return X}function k1($,Z,Y){let X=$;X=aq(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=Q1(X,K+7);if(!q)break;let W=q.endPos,U=E1(X,"unless","endunless",W);if(U===-1){console.warn(`[stx] @unless directive at position ${K} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let z=X.slice(W,U),B=q.expression,_=-1;{let H=0,L=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,V=[],R;while((R=L.exec(z))!==null)V.push({pos:R.index,type:"open"});while((R=F.exec(z))!==null)V.push({pos:R.index,type:"close"});while((R=O.exec(z))!==null)V.push({pos:R.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 j;if(_!==-1){let H=z.slice(0,_),L=z.slice(_+5);j=`@if (${B})${L}@else ${H}@endif`}else j=`@if (!(${B}))${z}@endif`;X=X.substring(0,K)+j+X.substring(U+10),J=!0}}X=Y3(X,Z,Y),X=X3(X,Z,Y),X=Z3(X,Z);let Q=()=>{let J=y5(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&&X0(U.condition))z=J0(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=t(U.type==="if"?"If":"Elseif",`Error in @${U.type}(${U.condition}): ${z instanceof Error?z.message:String(z)}`,n.EVALUATION_ERROR),W=!0}}X=X.substring(0,K.start)+q+X.substring(K.end)}catch(q){let W=q instanceof Error?q.message:String(q),U=t("If",`Error processing @if block: ${W}`,n.EVALUATION_ERROR);X=X.substring(0,K.start)+U+X.substring(K.end)}}return!0};while(!0){let J=X;if(!Q())break;if(X===J)break}return X}function lZ($){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 Z3($,Z){let Y=$;function X(K,q,W,U){let z=1,B=U,_=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${W}(?![a-z])`,"g");while(B<K.length&&z>0){_.lastIndex=B,j.lastIndex=B;let H=_.exec(K),L=j.exec(K),F=H?H.index:1/0,O=L?L.index:1/0;if(F<O)z++,B=F+H[0].length;else if(O<1/0){if(z--,z===0)return O;B=O+L[0].length}else break}return-1}function Q(K,q,W){let U=0,z=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${W}(?![a-z])`,"g"),_=/@else(?![a-z])/g,j=[],H;while((H=z.exec(K))!==null)j.push({pos:H.index,type:"open"});while((H=B.exec(K))!==null)j.push({pos:H.index,type:"close"});while((H=_.exec(K))!==null)j.push({pos:H.index,type:"else"});j.sort((L,F)=>L.pos-F.pos);for(let L of j)if(L.type==="open")U++;else if(L.type==="close")U--;else if(L.type==="else"&&U===0)return L.pos;return-1}{let K=!0;while(K){K=!1;let q=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,U,z,B=Y.slice(W+5),_=lZ(B);if(_)U=_.value,z=W+5+_.consumed;else z=W+5;let j=X(Y,"auth","endauth",z);if(j===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(z,j),L=Q(H,"auth","endauth"),F;if(!Z.auth)F=!1;else F=U?J1(`auth?.check && auth?.user?.[${U}]`,Z):J1("auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),R=H.slice(L+5);O=F?V:R}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(j+8),K=!0}}{let K=!0;while(K){K=!1;let q=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,U,z,B=Y.slice(W+6),_=lZ(B);if(_)U=_.value,z=W+6+_.consumed;else z=W+6;let j=X(Y,"guest","endguest",z);if(j===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(z,j),L=Q(H,"guest","endguest"),F;if(!Z.auth)F=!0;else F=U?J1(`!auth?.check || !auth?.user?.[${U}]`,Z):J1("!auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),R=H.slice(L+5);O=F?V:R}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(j+9),K=!0}}function J(K,q,W){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let U=[K];if(q)U.push(q);if(W){let z=J1(W,Z);U.push(z)}return Z.permissions.check(...U)}catch{return!1}return!1}function G(K){let q=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let K of["can","cannot"]){let q=`end${K}`,W=K==="can"?"elsecan":"elsecannot",U=!0;while(U){U=!1;let z=Y.match(new RegExp(`@${K}\\s*\\(`));if(!z||z.index===void 0)break;let B=z.index,_=Y.slice(B+`@${K}`.length),j=G(_);if(!j)break;let H=B+`@${K}`.length+j.paramsEnd,L=X(Y,K,q,H);if(L===-1){console.warn(`[stx] @${K} directive at position ${B} has no matching @${q} \u2014 the block was skipped.`);break}let F=Y.slice(H,L),O=[],V=0,R=new RegExp(`@${K}\\s*\\(`,"g"),A=new RegExp(`@${q}(?![a-z])`,"g"),N=new RegExp(`@${W}\\s*\\(`,"g"),w=/@else(?![a-z])/g,T=[],M;while((M=R.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=w.exec(F))!==null)T.push({pos:M.index,type:"else"});T.sort((k,P)=>k.pos-P.pos);for(let k of T){if(k.type==="open"){V++;continue}if(k.type==="close"){V--;continue}if(V===0)O.push(k)}let I=[],D=0;for(let k=0;k<O.length;k++){let P=O[k];if(I.push({content:F.slice(D,P.pos),ability:void 0}),P.type==="elseDirective"){let d=F.slice(P.pos+`@${W}`.length),g=G(d);if(g){I[I.length-1]={content:F.slice(D,P.pos)},D=P.pos+`@${W}`.length+g.paramsEnd,I.push({content:"",ability:g.ability,type:g.type,id:g.id}),I.pop();let m=O[k+1],s=m?m.pos:F.length;I.push({content:F.slice(D,s),ability:g.ability,type:g.type,id:g.id}),D=s}}else D=P.pos+5}if(D<F.length){let k=I[I.length-1];if(O.length>0&&O[O.length-1].type==="else")I.push({content:F.slice(D),isFinalElse:!0});else if(I.length===0)I.push({content:F.slice(D)})}let E=J(j.ability,j.type,j.id),C=K==="can"?E:!E,S="";if(C)S=I[0]?.content||"";else{let k=!1;for(let P=1;P<I.length;P++){let d=I[P];if(d.isFinalElse){S=d.content,k=!0;break}if(d.ability){let g=J(d.ability,d.type,d.id);if(K==="can"?g:!g){S=d.content,k=!0;break}}}if(!k&&I.length>0){let P=I[I.length-1];if(P.isFinalElse)S=P.content}}Y=Y.substring(0,B)+S+Y.substring(L+`@${q}`.length),U=!0}}return Y}function Y3($,Z,Y){let X=$;function Q(J,G,K,q,W){let U=!0;while(U){U=!1;let z=new RegExp(`@${G}\\s*\\(`),B=J.match(z);if(!B||B.index===void 0)break;let _=B.index,j=Q1(J,_+`@${G}`.length);if(!j)break;let H=j.endPos,L=E1(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=j.expression,V=-1,R=0,A=0;while(A<F.length){let N=F.indexOf("@",A);if(N===-1)break;let w=F.substring(N);if(/^@(?:if|unless|isset|empty)\s*\(/.test(w)){R++,A=N+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(w)){R--,A=N+1;continue}if(R===0&&/^@else(?![a-z])/.test(w)){V=N;break}A=N+1}try{let N=q(O.trim()),w;if(V!==-1){let T=F.slice(0,V),M=F.slice(V+5);w=N?T:M}else w=N?F:"";J=J.substring(0,_)+w+J.substring(L+`@${K}`.length),U=!0}catch(N){let w=N instanceof Error?N.message:String(N),T=t(W,`Error processing @${G} directive: ${w}`,n.EVALUATION_ERROR);J=J.substring(0,_)+T+J.substring(L+`@${K}`.length);break}}return J}return X=Q(X,"isset","endisset",(J)=>{let G=J1(J,Z);return G!==void 0&&G!==null},"Isset"),X=Q(X,"empty","endempty",(J)=>{let G=J1(J,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),X}function X3($,Z,Y){let X=$,Q="development";function J(G,K,q,W){let U=new RegExp(`@${K}(?![a-z])`,"g"),z=new RegExp(`@${q}(?![a-z])`,"g"),B=new RegExp(`^@${K}(?![a-z])`),_=new RegExp(`^@${q}(?![a-z])`),j=G,H=!0;while(H){H=!1,U.lastIndex=0;let L=U.exec(j);if(!L)break;let F=L.index,O=F+L[0].length;if(K==="env"){let E=j.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!E)break;O+=E[0].length,W=Q===E[2]}let V=1,R=O,A=-1;while(V>0&&R<j.length){U.lastIndex=R,z.lastIndex=R;let E=U.exec(j),C=z.exec(j),S=E?E.index:1/0,k=C?C.index:1/0;if(S<k)V++,R=S+E[0].length;else if(k<1/0){if(V--,V===0){A=k;break}R=k+C[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=j.substring(O,A),w=-1,T=0,M=0;while(M<N.length){let E=N.indexOf("@",M);if(E===-1)break;let C=N.substring(E);if(B.test(C)){T++,M=E+1;continue}if(_.test(C)){T--,M=E+1;continue}if(T===0&&/^@else(?![a-z])/.test(C)){w=E;break}M=E+1}let I;if(w!==-1){let E=N.slice(0,w),C=N.slice(w+5);I=W?E:C}else I=W?N:"";let D=`@${q}`.length;j=j.substring(0,F)+I+j.substring(A+D),H=!0}return j}return X=J(X,"env","endenv",!1),X=J(X,"production","endproduction",Q==="production"),X=J(X,"development","enddevelopment",Q==="development"),X=J(X,"staging","endstaging",Q==="staging"),X=J(X,"testing","endtesting",Q==="testing"),X}var t4=b(()=>{hZ();t0();a4();L0()});function cZ($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function e4($,Z){if(!$)return Z?.nonceGenerator?.()??cZ();let Y=pZ.get($);if(!Y)Y=Z?.nonceGenerator?.()??cZ(),pZ.set($,Y);return Y}function tq($,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 iZ($,Z){return`<meta http-equiv="Content-Security-Policy" content="${tq($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function nZ($,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?e4(Y,Z):void 0,Q=iZ(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
3714
- ${Q}`)}function oZ($,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?e4(Z,J):void 0;return iZ(J.directives,G)}),Q=Q.replace(/@cspNonce\b/g,()=>{if(!J?.enabled||!J.useNonce)return"";return e4(Z,J)}),J?.enabled&&J.useNonce)Z.cspNonce=e4(Z,J);return Q}var pZ;var sZ=b(()=>{pZ=new WeakMap});import eq from"crypto";function ZU($=$U){let Z=eq.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return J3=Z,Z}function YU(){if(!J3)ZU();return J3}function XU($=rZ){let Z=YU();return`<input type="hidden" name="${$}" value="${Z}">`}function aZ($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,X)=>{return XU(X||rZ)})}var $U=40,rZ="_token",J3=null;var tZ=()=>{};async function eZ($,Z,Y,X){if(!X.customDirectives||X.customDirectives.length===0)return $;let Q=$;for(let J of X.customDirectives){if(!J.name||typeof J.handler!=="function"){if(X.debug)console.warn("Invalid custom directive:",J);continue}if(J.hasEndTag)Q=await JU(Q,J,Z,Y,X);else Q=await QU(Q,J,Z,Y,X)}return Q}async function JU($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=`@${J}`,q=`@end${J}`,W=$,U=u1(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),z=[],B=U.exec(W);while(B!==null){let[_,j="",H=""]=B,L=B.index||0;try{let F=j?$Y(j):[],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:t("CustomDirective",`Error in @${J}${j?`(${j})`:""}: ${O}`,n.EVALUATION_ERROR),startIndex:L})}B=U.exec(W)}for(let _=z.length-1;_>=0;_--){let{original:j,processed:H}=z[_];W=W.replace(j,H)}return W}async function QU($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=$,q=u1(`@${J}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],U=q.exec(K);while(U!==null){let[_,j=""]=U,H=U.index||0;try{let L=$Y(j),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:t("CustomDirective",`Error in @${J}(${j}): ${F}`,n.EVALUATION_ERROR),startIndex:H})}U=q.exec(K)}let z=u1(`@${J}(?!\\w)(?!\\s*\\()`,"g"),B=z.exec(K);while(B!==null){let[_]=B,j=B.index||0;try{let H=await G("",[],Y,X);W.push({original:_,processed:H,startIndex:j})}catch(H){let L=H instanceof Error?H.message:String(H);if(Q.debug)console.error(`Error processing custom directive @${J}:`,H);W.push({original:_,processed:t("CustomDirective",`Error in @${J}: ${L}`,n.EVALUATION_ERROR),startIndex:j})}B=z.exec(K)}for(let _=W.length-1;_>=0;_--){let{original:j,processed:H}=W[_];K=K.replace(j,H)}return K}function $Y($){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 ZY=b(()=>{t0();l1()});import GU from"crypto";function V0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function $$($,Z,Y,X){let Q=$||Z;return Y?`${Q} ${X}`:Q}function KU(){return GU.randomUUID()}function Z$($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=KU();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${V0(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="${V0(J)}">`;return X}),Y}function JY($,Z,Y=XY){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Q,J,G,K,q,W="")=>{let U=J||G||"POST",z=K||q||"",B=G1(W),_=U.toUpperCase(),j=["GET","POST"].includes(_)?_:"POST",H=`<form method="${V0(j)}" action="${V0(z)}"${B?` ${B}`:""}>`;if(H+=`
3712
+ </script>`}function xZ($,Z,Y){if(vZ=0,!pq($))return $;let X=fq($);if(X.length===0)return $;let Q=lq($,X),J=uq(X,Z),G=Q.lastIndexOf("</body>");if(G!==-1)Q=Q.slice(0,G)+J+`
3713
+ `+Q.slice(G);else Q+=J;return Q}function lq($,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*["']${o4(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*["']${o4(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*"${o4(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*'${o4(X.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`)}}return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Y=Y.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Y}function pq($){return/x-data\s*=\s*["']/.test($)}var vZ=0,xq=0;var fZ=b(()=>{c0()});import cq from"fs";import e7 from"path";import{createHighlighter as iq}from"ts-syntax-highlighter";async function nq($,Z={}){try{if(!await i($))throw Error(`Markdown file not found: ${$}`);let X=(await cq.promises.stat($)).mtime.getTime();if(Z.cache&&$3.has($)){let z=$3.get($);if(z.updatedAt>=X)return{content:z.content,data:z.data}}let Q=await Bun.file($).text(),{data:J,content:G}=J9(Q),K=Z.markdown||o7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},U=j5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)U=await oq(U,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let W={content:U,data:J||{}};if(Z.cache)$3.set($,{...W,updatedAt:X});return W}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let X=Y instanceof Error?Y.message:String(Y);return{content:G0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}async function oq($,Z,Y){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!s4)try{s4=await iq({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let Q=async(K,q,U,W)=>{let z=W.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),B=U||(Y?"text":"");if(!B)return K;try{if(!s4.getSupportedLanguages().includes(B))return K;return(await s4.highlight(z,B,{theme:Z})).html}catch(_){console.error(`Error highlighting code block with language ${U}:`,_)}return K},J=$,G=$.matchAll(X);for(let K of G){let[q,U,W,z]=K,B=await Q(q,U,W,z);J=J.replace(q,B)}return J}async function gZ($,Z,Y="",X={}){return await sq($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,U)=>{try{let W=K;if(!e7.isAbsolute(K))W=e7.resolve(e7.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 R=V.indexOf(":");if(R>0){let N=V.substring(0,R).trim(),A=V.substring(R+1).trim(),w=A.startsWith('"')&&A.endsWith('"'),T=A.startsWith("'")&&A.endsWith("'");if(w||T)A=A.substring(1,A.length-1);z[N]=A}}}}catch(F){if(X.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:B,data:_}=await nq(W,X),j={...Z,..._,...z},H=B,L=/\{\{([^}]+)\}\}/g;return H=H.replace(L,(F,O)=>{let V=O.trim();return j[V]!==void 0?String(j[V]):F}),H}catch(W){let z=W instanceof Error?W.message:String(W);return G0("Markdown File",`Error including markdown file: ${z}`,Y,$,U,G)}})}async function sq($,Z,Y){let X=[],Q;while((Q=Z.exec($))!==null){let K=Q[0],q=Q.index,U=Q;X.push(Y(...U).then((W)=>({match:K,replacement:W,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 $3,s4=null;var hZ=b(()=>{y5();H0();$3=new Map});function Q1($,Z){try{let Y=$.trim();if(X0(Y))return J0(Y,Object.keys(Z))(...Object.values(Z));else return $0(Y,Z)}catch{return!1}}var dZ=b(()=>{L0()});function G1($,Z){let Y=rq($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function rq($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let X=I0($,"(",")",Y);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,X),endPos:X+1}}function aq($,Z){let Y=$.lastIndexOf("<",Z);if(Y===-1)return!1;return Y>$.lastIndexOf(">",Z)}function E1($,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($),U=K.exec($),W=q?q.index:1/0,z=U?U.index:1/0;if(W<z)Q++,J=W+q[0].length;else if(z<1/0){if(Q--,Q===0)return z;J=z+U[0].length}else break}return-1}function mZ($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let X=Z+Y[0].length,Q=G1($,X);if(!Q)return null;let J=Q.endPos,G=E1($,"if","endif",J);if(G===-1)return null;let K=$.slice(J,G),q=[],U=0,W="if",z=Q.expression,B=0,_=0;while(U<K.length){let j=K.indexOf("@",U);if(j===-1)break;U=j;let H=K.substring(j);if(aq(K,j)){U++;continue}if(/^@if\s*\(/.test(H)){_++,U++;continue}if(/^@endif(?![a-z])/.test(H)){_--,U+=6;continue}if(_===0){let L=H.match(/^@elseif\s*/);if(L){q.push({type:W,condition:z,content:K.substring(B,U),start:J+B,end:J+U});let F=U+L[0].length,O=G1(K,F);if(!O){U++;continue}W="elseif",z=O.expression,U=O.endPos,B=U;continue}else if(/^@else(?![a-z])/.test(H)){q.push({type:W,condition:z,content:K.substring(B,U),start:J+B,end:J+U}),W="else",z=void 0,U+=5,B=U;continue}}U++}return q.push({type:W,condition:z,content:K.slice(B),start:J+B,end:J+K.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function C5($){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=mZ($,X.index);if(J)Z.push(J),Y.lastIndex=J.end;X=Y.exec($)}return Z}function r4($,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,U=I0($,"(",")",q);if(U===-1){J=Q.exec($);continue}let W=$.slice(q+1,U),z=U+1,B=E1($,Z,Y,z);if(B===-1){J=Q.exec($);continue}let _=$.slice(z,B),j=B+`@${Y}`.length;X.push({fullMatch:$.slice(K,j),name:Z,params:W,content:_,start:K,end:j}),Q.lastIndex=j,J=Q.exec($)}return X}function Z3($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let X=Z+Y[0].length,Q=G1($,X);if(!Q)return null;let J=Q.endPos,G=E1($,"switch","endswitch",J);if(G===-1)return null;let K=$.slice(J,G),q=[],U=0,W=null,z=0;while(U<K.length){let B=K.slice(U),_=B.match(/^@switch\s*\(/),j=B.match(/^@endswitch(?![a-z])/);if(_){if(z++,W)W.content+=_[0];U+=_[0].length;continue}if(j){if(z--,W)W.content+=j[0];U+=j[0].length;continue}if(z>0){if(W)W.content+=K[U];U++;continue}let H=B.match(/^@case\s*/),L=B.match(/^@default(?![a-z])/),F=B.match(/^@break(?![a-z])/);if(H&&B.startsWith("@case")){if(W)q.push(W);let O=U+H[0].length,V=G1(K,O);if(!V){U++;continue}W={type:"case",value:V.expression,content:""},U=V.endPos}else if(L&&B.startsWith("@default")){if(W)q.push(W);W={type:"default",content:""},U+=L[0].length}else if(F&&B.startsWith("@break"))U+=F[0].length;else{if(W)W.content+=K[U];U++}}if(W)q.push(W);return{fullMatch:$.slice(Z,G+10),expression:Q.expression,cases:q,start:Z,end:G+10}}var uZ=()=>{};var lZ=()=>{};var a4=b(()=>{uZ();lZ()});function ZU($,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=Z3(X,G);if(!K)break;try{let q;if(X0(K.expression))q=J0(K.expression,Object.keys(Z))(...Object.values(Z));else q=$0(K.expression,Z);let U="",W=!1;for(let z of K.cases)if(z.type==="default"){if(!W)U=z.content.trim()}else try{let B;if(z.value&&X0(z.value))B=J0(z.value,Object.keys(Z))(...Object.values(Z));else if(z.value)B=$0(z.value,Z);if(q===B){U=z.content.trim(),W=!0;break}}catch{continue}X=X.substring(0,G)+U+X.substring(K.end),Q=!0}catch(q){let U=q instanceof Error?q.message:String(q),W=t("Switch",`Error evaluating @switch expression: ${U}`,n.EVALUATION_ERROR);X=X.substring(0,G)+W+X.substring(K.end);break}}return X}function k1($,Z,Y){let X=$;X=ZU(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=G1(X,K+7);if(!q)break;let U=q.endPos,W=E1(X,"unless","endunless",U);if(W===-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(U,W),B=q.expression,_=-1;{let H=0,L=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,V=[],R;while((R=L.exec(z))!==null)V.push({pos:R.index,type:"open"});while((R=F.exec(z))!==null)V.push({pos:R.index,type:"close"});while((R=O.exec(z))!==null)V.push({pos:R.index,type:"else"});V.sort((N,A)=>N.pos-A.pos);for(let N of V)if(N.type==="open")H++;else if(N.type==="close")H--;else if(N.type==="else"&&H===0){_=N.pos;break}}let j;if(_!==-1){let H=z.slice(0,_),L=z.slice(_+5);j=`@if (${B})${L}@else ${H}@endif`}else j=`@if (!(${B}))${z}@endif`;X=X.substring(0,K)+j+X.substring(W+10),J=!0}}X=X3(X,Z,Y),X=J3(X,Z,Y),X=Y3(X,Z);let Q=()=>{let J=C5(X);if(J.length===0)return!1;for(let G=J.length-1;G>=0;G--){let K=J[G];try{let q="",U=!1;for(let W of K.branches){if(U)break;if(W.type==="else")q=W.content,U=!0;else try{let z;if(W.condition&&X0(W.condition))z=J0(W.condition,Object.keys(Z))(...Object.values(Z));else if(W.condition)z=$0(W.condition,Z);if(z)q=W.content,U=!0}catch(z){q=t(W.type==="if"?"If":"Elseif",`Error in @${W.type}(${W.condition}): ${z instanceof Error?z.message:String(z)}`,n.EVALUATION_ERROR),U=!0}}X=X.substring(0,K.start)+q+X.substring(K.end)}catch(q){let U=q instanceof Error?q.message:String(q),W=t("If",`Error processing @if block: ${U}`,n.EVALUATION_ERROR);X=X.substring(0,K.start)+W+X.substring(K.end)}}return!0};while(!0){let J=X;if(!Q())break;if(X===J)break}return X}function pZ($){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 Y3($,Z){let Y=$;function X(K,q,U,W){let z=1,B=W,_=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${U}(?![a-z])`,"g");while(B<K.length&&z>0){_.lastIndex=B,j.lastIndex=B;let H=_.exec(K),L=j.exec(K),F=H?H.index:1/0,O=L?L.index:1/0;if(F<O)z++,B=F+H[0].length;else if(O<1/0){if(z--,z===0)return O;B=O+L[0].length}else break}return-1}function Q(K,q,U){let W=0,z=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${U}(?![a-z])`,"g"),_=/@else(?![a-z])/g,j=[],H;while((H=z.exec(K))!==null)j.push({pos:H.index,type:"open"});while((H=B.exec(K))!==null)j.push({pos:H.index,type:"close"});while((H=_.exec(K))!==null)j.push({pos:H.index,type:"else"});j.sort((L,F)=>L.pos-F.pos);for(let L of j)if(L.type==="open")W++;else if(L.type==="close")W--;else if(L.type==="else"&&W===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 U=q.index,W,z,B=Y.slice(U+5),_=pZ(B);if(_)W=_.value,z=U+5+_.consumed;else z=U+5;let j=X(Y,"auth","endauth",z);if(j===-1){console.warn(`[stx] @auth directive at position ${U} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(z,j),L=Q(H,"auth","endauth"),F;if(!Z.auth)F=!1;else F=W?Q1(`auth?.check && auth?.user?.[${W}]`,Z):Q1("auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),R=H.slice(L+5);O=F?V:R}else O=F?H:"";Y=Y.substring(0,U)+O+Y.substring(j+8),K=!0}}{let K=!0;while(K){K=!1;let q=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let U=q.index,W,z,B=Y.slice(U+6),_=pZ(B);if(_)W=_.value,z=U+6+_.consumed;else z=U+6;let j=X(Y,"guest","endguest",z);if(j===-1){console.warn(`[stx] @guest directive at position ${U} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(z,j),L=Q(H,"guest","endguest"),F;if(!Z.auth)F=!0;else F=W?Q1(`!auth?.check || !auth?.user?.[${W}]`,Z):Q1("!auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),R=H.slice(L+5);O=F?V:R}else O=F?H:"";Y=Y.substring(0,U)+O+Y.substring(j+9),K=!0}}function J(K,q,U){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let W=[K];if(q)W.push(q);if(U){let z=Q1(U,Z);W.push(z)}return Z.permissions.check(...W)}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}`,U=K==="can"?"elsecan":"elsecannot",W=!0;while(W){W=!1;let z=Y.match(new RegExp(`@${K}\\s*\\(`));if(!z||z.index===void 0)break;let B=z.index,_=Y.slice(B+`@${K}`.length),j=G(_);if(!j)break;let H=B+`@${K}`.length+j.paramsEnd,L=X(Y,K,q,H);if(L===-1){console.warn(`[stx] @${K} directive at position ${B} has no matching @${q} \u2014 the block was skipped.`);break}let F=Y.slice(H,L),O=[],V=0,R=new RegExp(`@${K}\\s*\\(`,"g"),N=new RegExp(`@${q}(?![a-z])`,"g"),A=new RegExp(`@${U}\\s*\\(`,"g"),w=/@else(?![a-z])/g,T=[],M;while((M=R.exec(F))!==null)T.push({pos:M.index,type:"open"});while((M=N.exec(F))!==null)T.push({pos:M.index,type:"close"});while((M=A.exec(F))!==null)T.push({pos:M.index,type:"elseDirective"});while((M=w.exec(F))!==null)T.push({pos:M.index,type:"else"});T.sort((k,y)=>k.pos-y.pos);for(let k of T){if(k.type==="open"){V++;continue}if(k.type==="close"){V--;continue}if(V===0)O.push(k)}let I=[],D=0;for(let k=0;k<O.length;k++){let y=O[k];if(I.push({content:F.slice(D,y.pos),ability:void 0}),y.type==="elseDirective"){let d=F.slice(y.pos+`@${U}`.length),g=G(d);if(g){I[I.length-1]={content:F.slice(D,y.pos)},D=y.pos+`@${U}`.length+g.paramsEnd,I.push({content:"",ability:g.ability,type:g.type,id:g.id}),I.pop();let m=O[k+1],s=m?m.pos:F.length;I.push({content:F.slice(D,s),ability:g.ability,type:g.type,id:g.id}),D=s}}else D=y.pos+5}if(D<F.length){let k=I[I.length-1];if(O.length>0&&O[O.length-1].type==="else")I.push({content:F.slice(D),isFinalElse:!0});else if(I.length===0)I.push({content:F.slice(D)})}let E=J(j.ability,j.type,j.id),C=K==="can"?E:!E,S="";if(C)S=I[0]?.content||"";else{let k=!1;for(let y=1;y<I.length;y++){let d=I[y];if(d.isFinalElse){S=d.content,k=!0;break}if(d.ability){let g=J(d.ability,d.type,d.id);if(K==="can"?g:!g){S=d.content,k=!0;break}}}if(!k&&I.length>0){let y=I[I.length-1];if(y.isFinalElse)S=y.content}}Y=Y.substring(0,B)+S+Y.substring(L+`@${q}`.length),W=!0}}return Y}function X3($,Z,Y){let X=$;function Q(J,G,K,q,U){let W=!0;while(W){W=!1;let z=new RegExp(`@${G}\\s*\\(`),B=J.match(z);if(!B||B.index===void 0)break;let _=B.index,j=G1(J,_+`@${G}`.length);if(!j)break;let H=j.endPos,L=E1(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=j.expression,V=-1,R=0,N=0;while(N<F.length){let A=F.indexOf("@",N);if(A===-1)break;let w=F.substring(A);if(/^@(?:if|unless|isset|empty)\s*\(/.test(w)){R++,N=A+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(w)){R--,N=A+1;continue}if(R===0&&/^@else(?![a-z])/.test(w)){V=A;break}N=A+1}try{let A=q(O.trim()),w;if(V!==-1){let T=F.slice(0,V),M=F.slice(V+5);w=A?T:M}else w=A?F:"";J=J.substring(0,_)+w+J.substring(L+`@${K}`.length),W=!0}catch(A){let w=A instanceof Error?A.message:String(A),T=t(U,`Error processing @${G} directive: ${w}`,n.EVALUATION_ERROR);J=J.substring(0,_)+T+J.substring(L+`@${K}`.length);break}}return J}return X=Q(X,"isset","endisset",(J)=>{let G=Q1(J,Z);return G!==void 0&&G!==null},"Isset"),X=Q(X,"empty","endempty",(J)=>{let G=Q1(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 J3($,Z,Y){let X=$,Q="development";function J(G,K,q,U){let W=new RegExp(`@${K}(?![a-z])`,"g"),z=new RegExp(`@${q}(?![a-z])`,"g"),B=new RegExp(`^@${K}(?![a-z])`),_=new RegExp(`^@${q}(?![a-z])`),j=G,H=!0;while(H){H=!1,W.lastIndex=0;let L=W.exec(j);if(!L)break;let F=L.index,O=F+L[0].length;if(K==="env"){let E=j.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!E)break;O+=E[0].length,U=Q===E[2]}let V=1,R=O,N=-1;while(V>0&&R<j.length){W.lastIndex=R,z.lastIndex=R;let E=W.exec(j),C=z.exec(j),S=E?E.index:1/0,k=C?C.index:1/0;if(S<k)V++,R=S+E[0].length;else if(k<1/0){if(V--,V===0){N=k;break}R=k+C[0].length}else break}if(N===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${q} \u2014 the block was skipped.`);break}let A=j.substring(O,N),w=-1,T=0,M=0;while(M<A.length){let E=A.indexOf("@",M);if(E===-1)break;let C=A.substring(E);if(B.test(C)){T++,M=E+1;continue}if(_.test(C)){T--,M=E+1;continue}if(T===0&&/^@else(?![a-z])/.test(C)){w=E;break}M=E+1}let I;if(w!==-1){let E=A.slice(0,w),C=A.slice(w+5);I=U?E:C}else I=U?A:"";let D=`@${q}`.length;j=j.substring(0,F)+I+j.substring(N+D),H=!0}return j}return X=J(X,"env","endenv",!1),X=J(X,"production","endproduction",Q==="production"),X=J(X,"development","enddevelopment",Q==="development"),X=J(X,"staging","endstaging",Q==="staging"),X=J(X,"testing","endtesting",Q==="testing"),X}var t4=b(()=>{dZ();e0();a4();L0()});function iZ($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function e4($,Z){if(!$)return Z?.nonceGenerator?.()??iZ();let Y=cZ.get($);if(!Y)Y=Z?.nonceGenerator?.()??iZ(),cZ.set($,Y);return Y}function YU($,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 nZ($,Z){return`<meta http-equiv="Content-Security-Policy" content="${YU($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function oZ($,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?e4(Y,Z):void 0,Q=nZ(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
3714
+ ${Q}`)}function sZ($,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?e4(Z,J):void 0;return nZ(J.directives,G)}),Q=Q.replace(/@cspNonce\b/g,()=>{if(!J?.enabled||!J.useNonce)return"";return e4(Z,J)}),J?.enabled&&J.useNonce)Z.cspNonce=e4(Z,J);return Q}var cZ;var rZ=b(()=>{cZ=new WeakMap});import XU from"crypto";function QU($=JU){let Z=XU.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return Q3=Z,Z}function GU(){if(!Q3)QU();return Q3}function KU($=aZ){let Z=GU();return`<input type="hidden" name="${$}" value="${Z}">`}function tZ($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,X)=>{return KU(X||aZ)})}var JU=40,aZ="_token",Q3=null;var eZ=()=>{};async function $2($,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 qU(Q,J,Z,Y,X);else Q=await UU(Q,J,Z,Y,X)}return Q}async function qU($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=`@${J}`,q=`@end${J}`,U=$,W=u1(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),z=[],B=W.exec(U);while(B!==null){let[_,j="",H=""]=B,L=B.index||0;try{let F=j?Z2(j):[],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:t("CustomDirective",`Error in @${J}${j?`(${j})`:""}: ${O}`,n.EVALUATION_ERROR),startIndex:L})}B=W.exec(U)}for(let _=z.length-1;_>=0;_--){let{original:j,processed:H}=z[_];U=U.replace(j,H)}return U}async function UU($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=$,q=u1(`@${J}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),U=[],W=q.exec(K);while(W!==null){let[_,j=""]=W,H=W.index||0;try{let L=Z2(j),F=await G("",L,Y,X);U.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);U.push({original:_,processed:t("CustomDirective",`Error in @${J}(${j}): ${F}`,n.EVALUATION_ERROR),startIndex:H})}W=q.exec(K)}let z=u1(`@${J}(?!\\w)(?!\\s*\\()`,"g"),B=z.exec(K);while(B!==null){let[_]=B,j=B.index||0;try{let H=await G("",[],Y,X);U.push({original:_,processed:H,startIndex:j})}catch(H){let L=H instanceof Error?H.message:String(H);if(Q.debug)console.error(`Error processing custom directive @${J}:`,H);U.push({original:_,processed:t("CustomDirective",`Error in @${J}: ${L}`,n.EVALUATION_ERROR),startIndex:j})}B=z.exec(K)}for(let _=U.length-1;_>=0;_--){let{original:j,processed:H}=U[_];K=K.replace(j,H)}return K}function Z2($){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 Y2=b(()=>{e0();l1()});import WU from"crypto";function V0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function $$($,Z,Y,X){let Q=$||Z;return Y?`${Q} ${X}`:Q}function zU(){return WU.randomUUID()}function Z$($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=zU();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${V0(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="${V0(J)}">`;return X}),Y}function Q2($,Z,Y=J2){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Q,J,G,K,q,U="")=>{let W=J||G||"POST",z=K||q||"",B=K1(U),_=W.toUpperCase(),j=["GET","POST"].includes(_)?_:"POST",H=`<form method="${V0(j)}" action="${V0(z)}"${B?` ${B}`:""}>`;if(H+=`
3715
3715
  ${Z$("@csrf",Z)}`,!["GET","POST"].includes(_))H+=`
3716
- ${Z$(`@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||"",B=G1(W),_=P5(U,Z),j=_!==void 0&&_!==null?_:z||"",H=B.match(/type=['"]([^'"]+)['"]/i),L=H?H[1]:"text",F=C5(U,Z),O=B.match(/class=['"]([^'"]+)['"]/i),V=$$(O?O[1]:"",Y.input,F,Y.inputError),R=B.replace(/class=['"][^'"]+['"]/i,"");return R=R.replace(/type=['"][^'"]+['"]/i,""),`<input type="${V0(L)}" name="${V0(U)}" value="${V0(j)}" class="${V}"${R?` ${R}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Q,J,G="",K="")=>{let q=G1(G),W=P5(J,Z)||K.trim(),U=C5(J,Z),z=q.match(/class=['"]([^'"]+)['"]/i),B=$$(z?z[1]:"",Y.input,U,Y.inputError),_=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${V0(J)}" class="${B}"${_?` ${_}`:""}>${V0(W)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Q,J,G="",K)=>{let q=G1(G),W=P5(J,Z),U=C5(J,Z),z=q.match(/class=['"]([^'"]+)['"]/i),B=$$(z?z[1]:"",Y.input,U,Y.inputError),_=q.replace(/class=['"][^'"]+['"]/i,""),j=K;if(W!==void 0)j=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,L,F)=>{if((Array.isArray(W)?W.some((V)=>String(V)===F):String(W)===F)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return H});return`<select name="${V0(J)}" class="${B}"${_?` ${_}`:""}>${j}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="1",K="")=>{let q=G1(K),W=P5(J,Z),U=W!==void 0&&(Array.isArray(W)?W.some((j)=>String(j)===G):W===!0||String(W)===G),z=q.match(/class=['"]([^'"]+)['"]/i),B=z?z[1]:Y.checkInput,_=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${V0(J)}" value="${V0(G)}" class="${B}"${U?" checked":""}${_?` ${_}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G,K="")=>{let q=G1(K),W=P5(J,Z),U=W!==void 0&&W===G,z=q.match(/class=['"]([^'"]+)['"]/i),B=z?z[1]:Y.checkInput,_=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${V0(J)}" value="${V0(G)}" class="${B}"${U?" checked":""}${_?` ${_}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="")=>{let K=G1(G),q=K.match(/accept=['"]([^'"]+)['"]/i),W=q?q[1]:"",U=K.includes("multiple"),z=C5(J,Z),B=K.match(/class=['"]([^'"]+)['"]/i),_=$$(B?B[1]:"",Y.input,z,Y.inputError),j=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${V0(J)}"`,`class="${_}"`];if(W)H.push(`accept="${V0(W)}"`);if(U)H.push("multiple");if(j)H.push(j);return`${H.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Q,J,G="",K)=>{let q=G1(G),W=q.match(/class=['"]([^'"]+)['"]/i),U=W?W[1]:Y.label,z=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${V0(J)}" class="${U}"${z?` ${z}`:""}>${K}</label>`}),X}function QY($,Z,Y=XY){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,Q,J)=>{try{if(C5(Q,Z))return J.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return YY(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 YY(Q,Z)}let q=K.trim();if(X0(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 C5($,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 YY($,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 P5($,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 G1($){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 XY;var GY=b(()=>{L0();XY={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import K3 from"path";async function qU(){if(v5!==void 0)return v5;try{v5=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{v5=null}return v5}function UU($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function WU($,Z){if({...W3,...Z.i18n}.cache&&q3[$]){let Q=q3[$],J=Z.i18n?.cacheMaxAge??0;if(!UU(Q,J))return Q.translations}if(x5[$]?.state==="loading")return x5[$].promise;Q3[$]="loading";let X=U3($,Z).then((Q)=>{return Q3[$]="loaded",delete x5[$],Q}).catch((Q)=>{throw Q3[$]="error",x5[$]={promise:X,state:"error",error:Q instanceof Error?Q:Error(String(Q))},Q});return x5[$]={promise:X,state:"loading"},X}async function U3($,Z){let Y={...W3,...Z.i18n},X=K3.isAbsolute(Y.translationsDir)?Y.translationsDir:K3.resolve(Z.root||process.cwd(),Y.translationsDir);try{let Q=await qU(),J=Q?await Q($,{translationsDir:X,defaultLocale:Y.defaultLocale,sources:HU(Y.format)}):await zU($,Y,X);if(J===void 0){if($!==Y.defaultLocale)return U3(Y.defaultLocale,Z);return{}}let G=J;if(Y.cache)q3[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(Q){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,Q);if($!==Y.defaultLocale)return U3(Y.defaultLocale,Z);return{}}}async function zU($,Z,Y){let X=K3.join(Y,`${$}${BU(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 _U(J);if(Z.format==="json")return JSON.parse(J);throw Q}catch{return}}}function BU($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function _U($){let Z={},Y=$.split(`
3717
- `),X=[{obj:Z,indent:-1}];for(let Q of Y){let J=Q.replace(/#.*$/,"").trimEnd();if(!J.trim())continue;let G=J.search(/\S/);if(G===-1)continue;while(X.length>1&&X[X.length-1].indent>=G)X.pop();let K=X[X.length-1].obj,q=J.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,W,U]=q,z=W.trim(),B=U.trim();if(B==="")K[z]={},X.push({obj:K[z],indent:G});else K[z]=jU(B)}}return Z}function jU($){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 HU($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function OU($,Z){return WU($,Z)}function LU($,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 FU($,Z={}){return UY($,Z)}function UY($,Z){let Y="",X=0;while(X<$.length)if($[X]==="{"){let Q=VU($,X);if(Q===-1){Y+=$[X],X++;continue}let J=$.slice(X+1,Q);Y+=RU(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 VU($,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 RU($,Z){let Y=AU($);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 NU(Q,Y.slice(2).join(","),Z);case"select":return TU(Q,Y.slice(2).join(","));case"selectordinal":return MU(Q,Y.slice(2).join(","));case"number":return DU(Q,Y[2]?.trim());case"date":return EU(Q,Y[2]?.trim());case"time":return kU(Q,Y[2]?.trim());default:return Q!==void 0?String(Q):`{${$}}`}}function AU($){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 NU($,Z,Y){let X=Number($)||0,Q=z3(Z),J=`=${X}`;if(Q[J])return G3(Q[J],X,Y);let G=wU(X);if(Q[G])return G3(Q[G],X,Y);if(Q.other)return G3(Q.other,X,Y);return String(X)}function G3($,Z,Y){let X=$.replace(/#/g,String(Z));return UY(X,Y)}function wU($){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 TU($,Z){let Y=String($||""),X=z3(Z);if(X[Y])return X[Y];return X.other||String($)}function MU($,Z){let Y=Number($)||0,X=z3(Z),Q=IU(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 IU($){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 z3($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,X=Y.exec($);while(X!==null)Z[X[1]]=X[2],X=Y.exec($);return Z}function DU($,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 EU($,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 kU($,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 bU($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function KY($,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(bU(G))return FU(G,X);if(G.includes("|")&&"count"in X){let K=Number(X.count),q=G.split("|");G=LU(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 WY($,Z,Y,X){let Q=$,J=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...W3,...X.i18n},K=await OU(G.locale,X);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,Q=await qY(Q,J,async(U,z,B,_,j)=>{try{let H={};if(B)try{let F=[()=>JSON.parse(B),()=>{let O=`{"data":${B}}`,V=JSON.parse(O);return typeof V.data==="object"?V.data:{}},()=>{return O0(B,Z)}];for(let O of F)try{if(H=O(),Object.keys(H).length>0)break}catch{}}catch(F){if(X.debug)console.error("Error parsing parameters for @translate directive:",F)}return KY(z,K,G.fallbackToKey,H)||_.trim()}catch(H){if(X.debug)console.error("Error processing @translate directive:",H);return t("Translate",`Error in @translate('${z}'): ${H instanceof Error?H.message:String(H)}`,n.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(X.debug){console.warn(`Processing translations in template. Sections: ${Q.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let U=[...Q.matchAll(q)];console.warn(`Found ${U.length} @translate matches`),U.forEach((z,B)=>console.warn(`Match ${B}: ${z[0]}, Key: ${z[1]}, Params: ${z[2]||"none"}`))}return Q=await qY(Q,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(U,z,B,_)=>{try{let j={};if(B)try{let H=[()=>JSON.parse(B),()=>{let L=`{"data":${B}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return O0(B,Z)}];for(let L of H)try{if(j=L(),Object.keys(j).length>0)break}catch{}}catch(H){if(X.debug)console.error("Error parsing parameters for @translate directive:",H)}return KY(z,K,G.fallbackToKey,j)}catch(j){if(X.debug)console.error("Error processing @translate directive:",j);return t("Translate",`Error in @translate('${z}'): ${j instanceof Error?j.message:String(j)}`,n.EVALUATION_ERROR)}}),Q}async function qY($,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 v5,W3,q3,x5,Q3;var zY=b(()=>{t0();L0();W3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},q3={},x5={},Q3={}});var j3={};o(j3,{streamingSuspenseDirective:()=>jY,streamToResponse:()=>uU,streamTemplateSimple:()=>gU,streamTemplate:()=>yU,renderStreamingPage:()=>CU,registerStreamingDirectives:()=>dU,processStreamDirectives:()=>xU,processSectionDirectives:()=>mU,islandDirective:()=>HY,generateHydrationRuntime:()=>lU,extractStreamBoundaries:()=>fU,createStreamRenderer:()=>hU,buildSuspenseResolveScript:()=>_3,SUSPENSE_RESOLVER_RUNTIME:()=>_Y});import Y$ from"path";function SU($){let Z=[],Y=0,X;BY.lastIndex=0;while((X=BY.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 yU($,Z={},Y={}){let X={...I1,...Y,streaming:{...B3,...Y.streaming}},Q=X.streaming?.bufferSize||16384;return new ReadableStream({async start(J){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...Z,__filename:$,__dirname:Y$.dirname($)};if(q.trim())await A1(q,U,$);let z=SU(W),B=new Set;if(!z.some((j)=>j.type==="suspense")){let j=X.streaming?.strategy||"auto",H=new RegExp(b1.source,"g");if(!(j!=="manual"&&H.test(W))){let F=await F0(W,U,$,X,B);for(let O=0;O<F.length;O+=Q)J.enqueue(F.slice(O,O+Q)),await new Promise((V)=>setTimeout(V,0))}else{let F=[],O=new RegExp(b1.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 R=0;for(let A of F){if(A.start>R){let w=W.slice(R,A.start);if(w.trim()){let T=await F0(w,U,$,X,B);J.enqueue(T),await new Promise((M)=>setTimeout(M,0))}}let N=await F0(A.content,U,$,X,B);J.enqueue(N),await new Promise((w)=>setTimeout(w,0)),R=A.end}if(R<W.length){let A=W.slice(R);if(A.trim()){let N=await F0(A,U,$,X,B);J.enqueue(N)}}}}else{let j=new Map;for(let L of z)if(L.type==="shell"||L.type==="content"){let F=await F0(L.content,U,$,X,B);J.enqueue(F)}else if(L.type==="suspense"&&L.name){let F=`stx-suspense-${L.name}`;J.enqueue(`<div id="${F}" data-suspense="${L.name}" style="display:contents;">
3716
+ ${Z$(`@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,U="")=>{let W=J||G||"",z=K||q||"",B=K1(U),_=v5(W,Z),j=_!==void 0&&_!==null?_:z||"",H=B.match(/type=['"]([^'"]+)['"]/i),L=H?H[1]:"text",F=x5(W,Z),O=B.match(/class=['"]([^'"]+)['"]/i),V=$$(O?O[1]:"",Y.input,F,Y.inputError),R=B.replace(/class=['"][^'"]+['"]/i,"");return R=R.replace(/type=['"][^'"]+['"]/i,""),`<input type="${V0(L)}" name="${V0(W)}" value="${V0(j)}" class="${V}"${R?` ${R}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Q,J,G="",K="")=>{let q=K1(G),U=v5(J,Z)||K.trim(),W=x5(J,Z),z=q.match(/class=['"]([^'"]+)['"]/i),B=$$(z?z[1]:"",Y.input,W,Y.inputError),_=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${V0(J)}" class="${B}"${_?` ${_}`:""}>${V0(U)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Q,J,G="",K)=>{let q=K1(G),U=v5(J,Z),W=x5(J,Z),z=q.match(/class=['"]([^'"]+)['"]/i),B=$$(z?z[1]:"",Y.input,W,Y.inputError),_=q.replace(/class=['"][^'"]+['"]/i,""),j=K;if(U!==void 0)j=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,L,F)=>{if((Array.isArray(U)?U.some((V)=>String(V)===F):String(U)===F)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return H});return`<select name="${V0(J)}" class="${B}"${_?` ${_}`:""}>${j}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="1",K="")=>{let q=K1(K),U=v5(J,Z),W=U!==void 0&&(Array.isArray(U)?U.some((j)=>String(j)===G):U===!0||String(U)===G),z=q.match(/class=['"]([^'"]+)['"]/i),B=z?z[1]:Y.checkInput,_=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${V0(J)}" value="${V0(G)}" class="${B}"${W?" checked":""}${_?` ${_}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G,K="")=>{let q=K1(K),U=v5(J,Z),W=U!==void 0&&U===G,z=q.match(/class=['"]([^'"]+)['"]/i),B=z?z[1]:Y.checkInput,_=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${V0(J)}" value="${V0(G)}" class="${B}"${W?" checked":""}${_?` ${_}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="")=>{let K=K1(G),q=K.match(/accept=['"]([^'"]+)['"]/i),U=q?q[1]:"",W=K.includes("multiple"),z=x5(J,Z),B=K.match(/class=['"]([^'"]+)['"]/i),_=$$(B?B[1]:"",Y.input,z,Y.inputError),j=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${V0(J)}"`,`class="${_}"`];if(U)H.push(`accept="${V0(U)}"`);if(W)H.push("multiple");if(j)H.push(j);return`${H.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Q,J,G="",K)=>{let q=K1(G),U=q.match(/class=['"]([^'"]+)['"]/i),W=U?U[1]:Y.label,z=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${V0(J)}" class="${W}"${z?` ${z}`:""}>${K}</label>`}),X}function G2($,Z,Y=J2){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,Q,J)=>{try{if(x5(Q,Z))return J.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return X2(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 X2(Q,Z)}let q=K.trim();if(X0(q)){let U=$0(q,Z);return U!==void 0?String(U):q}return q}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function x5($,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 X2($,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 v5($,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 K1($){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 J2;var K2=b(()=>{L0();J2={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import q3 from"path";async function BU(){if(f5!==void 0)return f5;try{f5=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{f5=null}return f5}function _U($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function jU($,Z){if({...z3,...Z.i18n}.cache&&U3[$]){let Q=U3[$],J=Z.i18n?.cacheMaxAge??0;if(!_U(Q,J))return Q.translations}if(g5[$]?.state==="loading")return g5[$].promise;G3[$]="loading";let X=W3($,Z).then((Q)=>{return G3[$]="loaded",delete g5[$],Q}).catch((Q)=>{throw G3[$]="error",g5[$]={promise:X,state:"error",error:Q instanceof Error?Q:Error(String(Q))},Q});return g5[$]={promise:X,state:"loading"},X}async function W3($,Z){let Y={...z3,...Z.i18n},X=q3.isAbsolute(Y.translationsDir)?Y.translationsDir:q3.resolve(Z.root||process.cwd(),Y.translationsDir);try{let Q=await BU(),J=Q?await Q($,{translationsDir:X,defaultLocale:Y.defaultLocale,sources:VU(Y.format)}):await HU($,Y,X);if(J===void 0){if($!==Y.defaultLocale)return W3(Y.defaultLocale,Z);return{}}let G=J;if(Y.cache)U3[$]={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 W3(Y.defaultLocale,Z);return{}}}async function HU($,Z,Y){let X=q3.join(Y,`${$}${OU(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 LU(J);if(Z.format==="json")return JSON.parse(J);throw Q}catch{return}}}function OU($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function LU($){let Z={},Y=$.split(`
3717
+ `),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[,,U,W]=q,z=U.trim(),B=W.trim();if(B==="")K[z]={},X.push({obj:K[z],indent:G});else K[z]=FU(B)}}return Z}function FU($){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 VU($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function RU($,Z){return jU($,Z)}function NU($,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 AU($,Z={}){return W2($,Z)}function W2($,Z){let Y="",X=0;while(X<$.length)if($[X]==="{"){let Q=wU($,X);if(Q===-1){Y+=$[X],X++;continue}let J=$.slice(X+1,Q);Y+=TU(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 wU($,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 TU($,Z){let Y=MU($);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 IU(Q,Y.slice(2).join(","),Z);case"select":return EU(Q,Y.slice(2).join(","));case"selectordinal":return kU(Q,Y.slice(2).join(","));case"number":return SU(Q,Y[2]?.trim());case"date":return yU(Q,Y[2]?.trim());case"time":return PU(Q,Y[2]?.trim());default:return Q!==void 0?String(Q):`{${$}}`}}function MU($){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 IU($,Z,Y){let X=Number($)||0,Q=B3(Z),J=`=${X}`;if(Q[J])return K3(Q[J],X,Y);let G=DU(X);if(Q[G])return K3(Q[G],X,Y);if(Q.other)return K3(Q.other,X,Y);return String(X)}function K3($,Z,Y){let X=$.replace(/#/g,String(Z));return W2(X,Y)}function DU($){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 EU($,Z){let Y=String($||""),X=B3(Z);if(X[Y])return X[Y];return X.other||String($)}function kU($,Z){let Y=Number($)||0,X=B3(Z),Q=bU(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 bU($){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 B3($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,X=Y.exec($);while(X!==null)Z[X[1]]=X[2],X=Y.exec($);return Z}function SU($,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 yU($,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 PU($,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 CU($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function q2($,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(CU(G))return AU(G,X);if(G.includes("|")&&"count"in X){let K=Number(X.count),q=G.split("|");G=NU(q,K)}for(let[K,q]of Object.entries(X)){let U=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${U}`,"g"),String(q))}return G}async function z2($,Z,Y,X){let Q=$,J=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...z3,...X.i18n},K=await RU(G.locale,X);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,Q=await U2(Q,J,async(W,z,B,_,j)=>{try{let H={};if(B)try{let F=[()=>JSON.parse(B),()=>{let O=`{"data":${B}}`,V=JSON.parse(O);return typeof V.data==="object"?V.data:{}},()=>{return O0(B,Z)}];for(let O of F)try{if(H=O(),Object.keys(H).length>0)break}catch{}}catch(F){if(X.debug)console.error("Error parsing parameters for @translate directive:",F)}return q2(z,K,G.fallbackToKey,H)||_.trim()}catch(H){if(X.debug)console.error("Error processing @translate directive:",H);return t("Translate",`Error in @translate('${z}'): ${H instanceof Error?H.message:String(H)}`,n.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(X.debug){console.warn(`Processing translations in template. Sections: ${Q.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let W=[...Q.matchAll(q)];console.warn(`Found ${W.length} @translate matches`),W.forEach((z,B)=>console.warn(`Match ${B}: ${z[0]}, Key: ${z[1]}, Params: ${z[2]||"none"}`))}return Q=await U2(Q,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(W,z,B,_)=>{try{let j={};if(B)try{let H=[()=>JSON.parse(B),()=>{let L=`{"data":${B}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return O0(B,Z)}];for(let L of H)try{if(j=L(),Object.keys(j).length>0)break}catch{}}catch(H){if(X.debug)console.error("Error parsing parameters for @translate directive:",H)}return q2(z,K,G.fallbackToKey,j)}catch(j){if(X.debug)console.error("Error processing @translate directive:",j);return t("Translate",`Error in @translate('${z}'): ${j instanceof Error?j.message:String(j)}`,n.EVALUATION_ERROR)}}),Q}async function U2($,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 f5,z3,U3,g5,G3;var B2=b(()=>{e0();L0();z3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},U3={},g5={},G3={}});var H3={};o(H3,{streamingSuspenseDirective:()=>H2,streamToResponse:()=>iU,streamTemplateSimple:()=>uU,streamTemplate:()=>xU,renderStreamingPage:()=>gU,registerStreamingDirectives:()=>pU,processStreamDirectives:()=>dU,processSectionDirectives:()=>cU,islandDirective:()=>O2,generateHydrationRuntime:()=>nU,extractStreamBoundaries:()=>mU,createStreamRenderer:()=>lU,buildSuspenseResolveScript:()=>j3,SUSPENSE_RESOLVER_RUNTIME:()=>j2});import Y$ from"path";function vU($){let Z=[],Y=0,X;_2.lastIndex=0;while((X=_2.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 xU($,Z={},Y={}){let X={...I1,...Y,streaming:{..._3,...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]:"",U=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),W={...Z,__filename:$,__dirname:Y$.dirname($)};if(q.trim())await N1(q,W,$);let z=vU(U),B=new Set;if(!z.some((j)=>j.type==="suspense")){let j=X.streaming?.strategy||"auto",H=new RegExp(b1.source,"g");if(!(j!=="manual"&&H.test(U))){let F=await F0(U,W,$,X,B);for(let O=0;O<F.length;O+=Q)J.enqueue(F.slice(O,O+Q)),await new Promise((V)=>setTimeout(V,0))}else{let F=[],O=new RegExp(b1.source,"g"),V;while((V=O.exec(U))!==null)F.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let R=0;for(let N of F){if(N.start>R){let w=U.slice(R,N.start);if(w.trim()){let T=await F0(w,W,$,X,B);J.enqueue(T),await new Promise((M)=>setTimeout(M,0))}}let A=await F0(N.content,W,$,X,B);J.enqueue(A),await new Promise((w)=>setTimeout(w,0)),R=N.end}if(R<U.length){let N=U.slice(R);if(N.trim()){let A=await F0(N,W,$,X,B);J.enqueue(A)}}}}else{let j=new Map;for(let L of z)if(L.type==="shell"||L.type==="content"){let F=await F0(L.content,W,$,X,B);J.enqueue(F)}else if(L.type==="suspense"&&L.name){let F=`stx-suspense-${L.name}`;J.enqueue(`<div id="${F}" data-suspense="${L.name}" style="display:contents;">
3718
3718
  <template data-suspense-fallback>Loading...</template>
3719
- </div>`),j.set(L.name,F0(L.content,U,$,X,B))}J.enqueue(`
3719
+ </div>`),j.set(L.name,F0(L.content,W,$,X,B))}J.enqueue(`
3720
3720
  <script>
3721
3721
  (function() {
3722
3722
  window.__stxSuspense = window.__stxSuspense || {
@@ -3732,13 +3732,13 @@ ${Q}`)}function oZ($,Z,Y,X){let Q=$,J=X.csp;if(Q=Q.replace(/@csp\b/g,()=>{if(!J?
3732
3732
  }
3733
3733
  };
3734
3734
  })();
3735
- </script>`);let H=Array.from(j.entries()).map(async([L,F])=>{J.enqueue(await _3(L,F))});await Promise.all(H)}J.close()}catch(G){J.error(G)}}})}async function _3($,Z){try{let X=(await Z).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
3735
+ </script>`);let H=Array.from(j.entries()).map(async([L,F])=>{J.enqueue(await j3(L,F))});await Promise.all(H)}J.close()}catch(G){J.error(G)}}})}async function j3($,Z){try{let X=(await Z).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
3736
3736
  <script>
3737
3737
  window.__stxSuspense.resolve('${$}', \`${X}\`);
3738
3738
  </script>`}catch(Y){let X=Y instanceof Error?Y.message:String(Y);return`
3739
3739
  <script>
3740
3740
  window.__stxSuspense.resolve('${$}', '<div class="stx-error">Error loading content: ${h0(X)}</div>');
3741
- </script>`}}function PU($,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 CU($,Z=[],Y={}){let X=Y.timeoutMs??0;return new ReadableStream({async start(Q){try{if(Q.enqueue($),Z.length>0)Q.enqueue(_Y),await Promise.all(Z.map(async(J)=>{let G=PU(J.render(),X,J.id);Q.enqueue(await _3(J.id,G))}));Q.close()}catch(J){Q.error(J)}}})}function xU($,Z){return $.replace(vU,(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 fU($){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 gU($,Z={},Y={}){let X={...I1,...Y,streaming:{...B3,...Y.streaming}},Q=X.streaming?.bufferSize||16384;return new ReadableStream({async start(J){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...Z,__filename:$,__dirname:Y$.dirname($)};if(q.trim())await A1(q,U,$);let z=new Set,B=X.streaming?.strategy||"auto",_=new RegExp(b1.source,"g");if(!(B!=="manual"&&_.test(W))){let H=await F0(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(b1.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 F0(A,U,$,X,z);J.enqueue(N)}}let R=await F0(V.content,U,$,X,z);J.enqueue(R),O=V.end}if(O<W.length){let V=W.slice(O);if(V.trim()){let R=await F0(V,U,$,X,z);J.enqueue(R)}}}J.close()}catch(G){J.error(G)}}})}async function hU($,Z={}){let Y={...I1,...Z,streaming:{...B3,...Z.streaming}},X=await Bun.file($).text(),Q=X.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),J=Q?Q[1]:"",G=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K=G,q={},W;b1.lastIndex=0;while((W=b1.exec(G))!==null){let B=W[1],_=W[2];q[B]=_}let U=G.replace(b1,"");return{renderShell:async(B={})=>{let _={...B,__filename:$,__dirname:Y$.dirname($)};return await A1(J,_,$),F0(U,_,$,Y,new Set)},renderSection:async(B,_={})=>{try{if(!q[B])return`<div class="error-message">Section "${h0(B)}" not found in template "${h0($)}"</div>`;let j={..._,__filename:$,__dirname:Y$.dirname($)};await A1(J,j,$);let H=new Set;return await F0(q[B],j,$,Y,H)}catch(j){let H=j instanceof Error?j.message:String(j);return G0("Expression",H,$,q[B]||"",0,q[B]||"")}},getSections:()=>{return Object.keys(q)},getTemplate:()=>{return K}}}function dU($={}){let Z=[];if($.streaming?.enabled)Z.push(jY);if($.hydration?.enabled)Z.push(HY);return Z}async function mU($,Z,Y,X={}){return $}function uU($,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 lU($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:X=!0}=$,Q=Object.entries(Y).map(([J,G])=>`'${J}': ${X?`() => import('${G}')`:`require('${G}')`}`).join(`,
3741
+ </script>`}}function fU($,Z,Y){if(!Z||Z<=0)return $;let X,Q=new Promise((J,G)=>{X=setTimeout(()=>G(Error(`streaming boundary "${Y}" timed out after ${Z}ms`)),Z)});return Promise.race([$,Q]).finally(()=>clearTimeout(X))}function gU($,Z=[],Y={}){let X=Y.timeoutMs??0;return new ReadableStream({async start(Q){try{if(Q.enqueue($),Z.length>0)Q.enqueue(j2),await Promise.all(Z.map(async(J)=>{let G=fU(J.render(),X,J.id);Q.enqueue(await j3(J.id,G))}));Q.close()}catch(J){Q.error(J)}}})}function dU($,Z){return $.replace(hU,(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 mU($){let Z=$?.streamBoundaries;if(!Z||typeof Z!=="object")return;let Y=Object.entries(Z).filter(([,X])=>typeof X==="function");return Y.length>0?Y.map(([X,Q])=>({id:X,render:Q})):void 0}async function uU($,Z={},Y={}){let X={...I1,...Y,streaming:{..._3,...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]:"",U=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),W={...Z,__filename:$,__dirname:Y$.dirname($)};if(q.trim())await N1(q,W,$);let z=new Set,B=X.streaming?.strategy||"auto",_=new RegExp(b1.source,"g");if(!(B!=="manual"&&_.test(U))){let H=await F0(U,W,$,X,z);for(let L=0;L<H.length;L+=Q)J.enqueue(H.slice(L,L+Q))}else{let H=[],L=new RegExp(b1.source,"g"),F;while((F=L.exec(U))!==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 N=U.slice(O,V.start);if(N.trim()){let A=await F0(N,W,$,X,z);J.enqueue(A)}}let R=await F0(V.content,W,$,X,z);J.enqueue(R),O=V.end}if(O<U.length){let V=U.slice(O);if(V.trim()){let R=await F0(V,W,$,X,z);J.enqueue(R)}}}J.close()}catch(G){J.error(G)}}})}async function lU($,Z={}){let Y={...I1,...Z,streaming:{..._3,...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={},U;b1.lastIndex=0;while((U=b1.exec(G))!==null){let B=U[1],_=U[2];q[B]=_}let W=G.replace(b1,"");return{renderShell:async(B={})=>{let _={...B,__filename:$,__dirname:Y$.dirname($)};return await N1(J,_,$),F0(W,_,$,Y,new Set)},renderSection:async(B,_={})=>{try{if(!q[B])return`<div class="error-message">Section "${h0(B)}" not found in template "${h0($)}"</div>`;let j={..._,__filename:$,__dirname:Y$.dirname($)};await N1(J,j,$);let H=new Set;return await F0(q[B],j,$,Y,H)}catch(j){let H=j instanceof Error?j.message:String(j);return G0("Expression",H,$,q[B]||"",0,q[B]||"")}},getSections:()=>{return Object.keys(q)},getTemplate:()=>{return K}}}function pU($={}){let Z=[];if($.streaming?.enabled)Z.push(H2);if($.hydration?.enabled)Z.push(O2);return Z}async function cU($,Z,Y,X={}){return $}function iU($,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 nU($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:X=!0}=$,Q=Object.entries(Y).map(([J,G])=>`'${J}': ${X?`() => import('${G}')`:`require('${G}')`}`).join(`,
3742
3742
  `);if(Z==="loader")return`
3743
3743
  (function() {
3744
3744
  window.__stx = window.__stx || {};
@@ -3880,7 +3880,7 @@ else {
3880
3880
  else {
3881
3881
  stx.hydrate();
3882
3882
  }
3883
- })();`}var B3,b1,BY,_Y=`
3883
+ })();`}var _3,b1,_2,j2=`
3884
3884
  <script>
3885
3885
  (function(){
3886
3886
  window.__stxSuspense = window.__stxSuspense || {
@@ -3900,25 +3900,25 @@ else {
3900
3900
  }
3901
3901
  };
3902
3902
  })();
3903
- </script>`,vU,jY,HY;var H3=b(()=>{b5();c0();_4();H0();B3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},b1=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,BY=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;vU=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;jY={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} -->`}},HY={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}">
3904
- ${W}
3903
+ </script>`,hU,H2,O2;var O3=b(()=>{y5();c0();_4();H0();_3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},b1=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,_2=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;hU=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;H2={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} -->`}},O2={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():"",U=K?$.replace(K[0],""):$;return`<div data-island="${Q}" data-island-id="${G}" data-priority="${J}">
3904
+ ${U}
3905
3905
  <script type="application/json" data-island-props="${G}">
3906
3906
  ${q?`{${q}}`:"{}"}
3907
3907
  </script>
3908
- </div>`}}});var FY={};o(FY,{warnUnbalancedTags:()=>O3,findUnbalancedTags:()=>LY});function s1($){return $.replace(/[^\n]/g," ")}function LY($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,s1).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,s1).replace(/<!--[\s\S]*?-->/g,s1).replace(/\{\{\{[\s\S]*?\}\}\}/g,s1).replace(/\{\{[\s\S]*?\}\}/g,s1).replace(/\{!![\s\S]*?!!\}/g,s1),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(pU.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(`
3909
- `).length;Y.set(q,{count:1,firstLine:z})}}}let G=[];for(let K of new Set([...Y.keys(),...X.keys()])){if(cU.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 O3($,Z){let Y;try{Y=LY($)}catch{return}if(Y.length===0)return;let X=`${Z}:${$.length}`;if(OY.has(X))return;OY.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 pU,cU,OY;var L3=b(()=>{pU=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),cU=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);OY=new Set});import g0 from"path";import F3 from"fs";function VY($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function RY($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class AY{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(),VY(Q),RY(Q)];for(let j of _)if(J.has(j))return J.get(j)}let G=[...new Set([`${Q}.stx`,`${VY(Q)}.stx`,`${RY(Q)}.stx`])];if(Q.startsWith("./")||Q.startsWith("../")){let _=g0.resolve(g0.dirname(Z),`${Q}.stx`);if(await i(_))return _;return null}let K=[],q=Y.componentsDir||"",W=X?.__originalFilePath;if(W)K.push(g0.join(g0.dirname(W),"components"));if(q)K.push(q);let U=g0.join(g0.dirname(Z),"components");if(!K.includes(U))K.push(U);let z=process.cwd(),B=[g0.resolve(z,"src/components"),g0.resolve(z,"components"),g0.resolve(import.meta.dir,"components")];for(let _ of B)if(!K.includes(_))K.push(_);for(let _ of K){if(!_)continue;for(let j of G){let H=g0.join(_,j);if(await i(H))return H}try{if(!F3.statSync(_,{throwIfNoEntry:!1})?.isDirectory())continue;let H=F3.readdirSync(_,{withFileTypes:!0});for(let L of H)if(L.isDirectory()){let F=g0.join(_,L.name);for(let O of G){let V=g0.join(F,O);if(await i(V))return V}}}catch{}}return null}}var E0;var V3=b(()=>{H0();E0=new AY});function K1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function iU($){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 R3;var A3=b(()=>{R3={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let X=iU($),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="${K1(X.value)}"`);else q.push(`href="${K1(X.value)}"`);if(Q)q.push(`class="${K1(Q)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${K1(J)}"`),q.push(`data-stx-exact-active-class="${K1(G)}"`),K)q.push("data-stx-prefetch");let W=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);for(let[U,z]of Object.entries($.static)){if(W.has(U))continue;if(typeof z==="boolean"){if(z)q.push(K1(U))}else q.push(`${K1(U)}="${K1(z)}"`)}return`<a ${q.join(" ")}>${Z}</a>`}}});function z0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function w0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function w3($,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 NY($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let X of Z)if(X.includes(":")){let[Q,J]=X.split(":"),G=nU[Q];if(G)Y.push(`(max-width: ${G}px) ${J}`);else{let K=Number.parseInt(Q);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${J}`)}}else Y.push(X);return Y.join(", ")}function T3($,Z,Y,X){return Z.map((Q)=>`${f5($,Q,void 0,Y,X)} ${Q}w`).join(", ")}function oU($,Z,Y,X,Q){return Z.map((J)=>{let G=Y?Y*J:void 0;return`${f5($,G,void 0,X,Q)} ${J}x`}).join(", ")}function f5($,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 sU($,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 nU,N3,M3;var I3=b(()=>{nU={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},N3=[320,640,768,1024,1280,1536,1920];M3={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let X=w0($,"src")||"",Q=w0($,"alt")||"",J=w0($,"width"),G=w0($,"height"),K=w0($,"sizes"),q=w0($,"srcset"),W=w0($,"densities"),U=w0($,"format"),z=w0($,"placeholder"),B=w0($,"placeholderColor")||"#e5e7eb",_=w0($,"provider"),j=w0($,"class")||w0($,"className")||"",H=w0($,"style")||"",L=w0($,"quality"),F=w3($,"lazy",!0),O=w3($,"preload",!1),V=w3($,"picture",!1)||!!U,R=J?Number.parseInt(J):void 0,A=G?Number.parseInt(G):void 0,N=q||"",w="";if(!N&&K)N=T3(X,N3,_,U),w=NY(K);else if(!N&&W){let S=W.split(/\s+/).map((k)=>Number.parseFloat(k.replace("x","")));N=oU(X,S,R,_,U)}else if(K)w=NY(K);let T=[];if(H)T.push(H);if(R&&A)T.push(`aspect-ratio:${R}/${A}`);if(z==="blur"||z==="color"||z==="thumbhash"){let S=sU(R||16,A||9,B);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(${z0(z)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let M=f5(X,R,A,_,U),I=[];if(I.push(`src="${z0(M)}"`),I.push(`alt="${z0(Q)}"`),J)I.push(`width="${z0(J)}"`);if(G)I.push(`height="${z0(G)}"`);if(F)I.push('loading="lazy"');if(I.push('decoding="async"'),j)I.push(`class="${z0(j)}"`);if(T.length>0)I.push(`style="${z0(T.join(";"))}"`);if(N)I.push(`srcset="${z0(N)}"`);if(w)I.push(`sizes="${z0(w)}"`);let D=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);for(let[S,k]of Object.entries($.static)){if(D.has(S))continue;if(typeof k==="boolean"){if(k)I.push(z0(S))}else I.push(`${z0(S)}="${z0(k)}"`)}let E=`<img ${I.join(" ")} />`,C="";if(O){let k=U==="webp"?"image/webp":U==="avif"?"image/avif":"";C=`<link rel="preload" as="image" href="${z0(M)}"${k?` type="${k}"`:""}${N?` imagesrcset="${z0(N)}"`:""}${w?` imagesizes="${z0(w)}"`:""} />
3910
- `}if(V){let S=[];if(U==="avif"||U==="auto"){let k=f5(X,R,A,_,"avif"),P=N?T3(X,N3,_,"avif"):`${k}`;S.push(`<source type="image/avif" srcset="${z0(P)}"${w?` sizes="${z0(w)}"`:""} />`)}if(U==="webp"||U==="auto"){let k=f5(X,R,A,_,"webp"),P=N?T3(X,N3,_,"webp"):`${k}`;S.push(`<source type="image/webp" srcset="${z0(P)}"${w?` sizes="${z0(w)}"`:""} />`)}return`${C}<picture>
3908
+ </div>`}}});var V2={};o(V2,{warnUnbalancedTags:()=>L3,findUnbalancedTags:()=>F2});function s1($){return $.replace(/[^\n]/g," ")}function F2($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,s1).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,s1).replace(/<!--[\s\S]*?-->/g,s1).replace(/\{\{\{[\s\S]*?\}\}\}/g,s1).replace(/\{\{[\s\S]*?\}\}/g,s1).replace(/\{!![\s\S]*?!!\}/g,s1),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],U=J[3]==="/";if(oU.has(q.toLowerCase()))continue;if(U)continue;if(K)X.set(q,(X.get(q)??0)+1);else{let W=Y.get(q);if(W)W.count++;else{let z=Z.slice(0,J.index).split(`
3909
+ `).length;Y.set(q,{count:1,firstLine:z})}}}let G=[];for(let K of new Set([...Y.keys(),...X.keys()])){if(sU.has(K.toLowerCase()))continue;let q=Y.get(K)?.count??0,U=X.get(K)??0;if(q!==U)G.push({tag:K,opened:q,closed:U,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function L3($,Z){let Y;try{Y=F2($)}catch{return}if(Y.length===0)return;let X=`${Z}:${$.length}`;if(L2.has(X))return;L2.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 U=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${Q}: <${J}> ${G} opened, ${K} closed \u2014 an unclosed <${J}>${U} may swallow the content that follows it.`)}else console.warn(`[stx] ${Q}: <${J}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${J}>.`)}var oU,sU,L2;var F3=b(()=>{oU=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),sU=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);L2=new Set});import f0 from"path";import V3 from"fs";function R2($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function N2($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class A2{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(),R2(Q),N2(Q)];for(let j of _)if(J.has(j))return J.get(j)}let G=[...new Set([`${Q}.stx`,`${R2(Q)}.stx`,`${N2(Q)}.stx`])];if(Q.startsWith("./")||Q.startsWith("../")){let _=f0.resolve(f0.dirname(Z),`${Q}.stx`);if(await i(_))return _;return null}let K=[],q=Y.componentsDir||"",U=X?.__originalFilePath;if(U)K.push(f0.join(f0.dirname(U),"components"));if(q)K.push(q);let W=f0.join(f0.dirname(Z),"components");if(!K.includes(W))K.push(W);let z=process.cwd(),B=[f0.resolve(z,"src/components"),f0.resolve(z,"components"),f0.resolve(import.meta.dir,"components")];for(let _ of B)if(!K.includes(_))K.push(_);for(let _ of K){if(!_)continue;for(let j of G){let H=f0.join(_,j);if(await i(H))return H}try{if(!V3.statSync(_,{throwIfNoEntry:!1})?.isDirectory())continue;let H=V3.readdirSync(_,{withFileTypes:!0});for(let L of H)if(L.isDirectory()){let F=f0.join(_,L.name);for(let O of G){let V=f0.join(F,O);if(await i(V))return V}}}catch{}}return null}}var D0;var R3=b(()=>{H0();D0=new A2});function q1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function rU($){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 N3;var A3=b(()=>{N3={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let X=rU($),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="${q1(X.value)}"`);else q.push(`href="${q1(X.value)}"`);if(Q)q.push(`class="${q1(Q)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${q1(J)}"`),q.push(`data-stx-exact-active-class="${q1(G)}"`),K)q.push("data-stx-prefetch");let U=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);for(let[W,z]of Object.entries($.static)){if(U.has(W))continue;if(typeof z==="boolean"){if(z)q.push(q1(W))}else q.push(`${q1(W)}="${q1(z)}"`)}return`<a ${q.join(" ")}>${Z}</a>`}}});function z0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function T0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function T3($,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 w2($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let X of Z)if(X.includes(":")){let[Q,J]=X.split(":"),G=aU[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 M3($,Z,Y,X){return Z.map((Q)=>`${h5($,Q,void 0,Y,X)} ${Q}w`).join(", ")}function tU($,Z,Y,X,Q){return Z.map((J)=>{let G=Y?Y*J:void 0;return`${h5($,G,void 0,X,Q)} ${J}x`}).join(", ")}function h5($,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 eU($,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 aU,w3,I3;var D3=b(()=>{aU={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},w3=[320,640,768,1024,1280,1536,1920];I3={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let X=T0($,"src")||"",Q=T0($,"alt")||"",J=T0($,"width"),G=T0($,"height"),K=T0($,"sizes"),q=T0($,"srcset"),U=T0($,"densities"),W=T0($,"format"),z=T0($,"placeholder"),B=T0($,"placeholderColor")||"#e5e7eb",_=T0($,"provider"),j=T0($,"class")||T0($,"className")||"",H=T0($,"style")||"",L=T0($,"quality"),F=T3($,"lazy",!0),O=T3($,"preload",!1),V=T3($,"picture",!1)||!!W,R=J?Number.parseInt(J):void 0,N=G?Number.parseInt(G):void 0,A=q||"",w="";if(!A&&K)A=M3(X,w3,_,W),w=w2(K);else if(!A&&U){let S=U.split(/\s+/).map((k)=>Number.parseFloat(k.replace("x","")));A=tU(X,S,R,_,W)}else if(K)w=w2(K);let T=[];if(H)T.push(H);if(R&&N)T.push(`aspect-ratio:${R}/${N}`);if(z==="blur"||z==="color"||z==="thumbhash"){let S=eU(R||16,N||9,B);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(${z0(z)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let M=h5(X,R,N,_,W),I=[];if(I.push(`src="${z0(M)}"`),I.push(`alt="${z0(Q)}"`),J)I.push(`width="${z0(J)}"`);if(G)I.push(`height="${z0(G)}"`);if(F)I.push('loading="lazy"');if(I.push('decoding="async"'),j)I.push(`class="${z0(j)}"`);if(T.length>0)I.push(`style="${z0(T.join(";"))}"`);if(A)I.push(`srcset="${z0(A)}"`);if(w)I.push(`sizes="${z0(w)}"`);let D=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);for(let[S,k]of Object.entries($.static)){if(D.has(S))continue;if(typeof k==="boolean"){if(k)I.push(z0(S))}else I.push(`${z0(S)}="${z0(k)}"`)}let E=`<img ${I.join(" ")} />`,C="";if(O){let k=W==="webp"?"image/webp":W==="avif"?"image/avif":"";C=`<link rel="preload" as="image" href="${z0(M)}"${k?` type="${k}"`:""}${A?` imagesrcset="${z0(A)}"`:""}${w?` imagesizes="${z0(w)}"`:""} />
3910
+ `}if(V){let S=[];if(W==="avif"||W==="auto"){let k=h5(X,R,N,_,"avif"),y=A?M3(X,w3,_,"avif"):`${k}`;S.push(`<source type="image/avif" srcset="${z0(y)}"${w?` sizes="${z0(w)}"`:""} />`)}if(W==="webp"||W==="auto"){let k=h5(X,R,N,_,"webp"),y=A?M3(X,w3,_,"webp"):`${k}`;S.push(`<source type="image/webp" srcset="${z0(y)}"${w?` sizes="${z0(w)}"`:""} />`)}return`${C}<picture>
3911
3911
  ${S.join(`
3912
3912
  `)}
3913
3913
  ${E}
3914
- </picture>`}return`${C}${E}`}}});function q1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function r1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var rU="<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'/images/safe-image-default.svg';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>",D3;var E3=b(()=>{D3={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,Y){let X=r1($,"src")||"",Q=r1($,"alt")||"",J=r1($,"fallback")||"/images/safe-image-default.svg",G=r1($,"class")||r1($,"className")||"",K=r1($,"fallbackClassName")||"",q=[];if(q.push(`src="${q1(X)}"`),q.push(`alt="${q1(Q)}"`),G)q.push(`class="${q1(G)}"`);if(q.push(`data-fallback="${q1(J)}"`),K)q.push(`data-fallback-class="${q1(K)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let W=new Set(["src","alt","fallback","class","className","fallbackClassName"]);for(let[B,_]of Object.entries($.static)){if(W.has(B))continue;if(typeof _==="boolean"){if(_)q.push(q1(B))}else q.push(`${q1(B)}="${q1(_)}"`)}let U=`<img ${q.join(" ")} />`,z=Y.context;if(!z.__safeImageHandlerEmitted)return z.__safeImageHandlerEmitted=!0,`${rU}${U}`;return U}}});function k3($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function g5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function X$($,Z,Y){let X=g5($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Y}var b3;var S3=b(()=>{b3={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,Y){let X=k3(g5($,"color")||"#6366f1"),Q=k3(g5($,"initialColor")||g5($,"initial-color")||""),J=k3(g5($,"height")||"3px"),G=X$($,"duration",2000),K=X$($,"throttle",200),q=X$($,"zIndex",999999)||X$($,"z-index",999999),W=Q?`linear-gradient(to right, ${Q}, ${X})`:X;return`
3915
- <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">
3914
+ </picture>`}return`${C}${E}`}}});function U1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function r1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var $W="<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'/images/safe-image-default.svg';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>",E3;var k3=b(()=>{E3={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,Y){let X=r1($,"src")||"",Q=r1($,"alt")||"",J=r1($,"fallback")||"/images/safe-image-default.svg",G=r1($,"class")||r1($,"className")||"",K=r1($,"fallbackClassName")||"",q=[];if(q.push(`src="${U1(X)}"`),q.push(`alt="${U1(Q)}"`),G)q.push(`class="${U1(G)}"`);if(q.push(`data-fallback="${U1(J)}"`),K)q.push(`data-fallback-class="${U1(K)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let U=new Set(["src","alt","fallback","class","className","fallbackClassName"]);for(let[B,_]of Object.entries($.static)){if(U.has(B))continue;if(typeof _==="boolean"){if(_)q.push(U1(B))}else q.push(`${U1(B)}="${U1(_)}"`)}let W=`<img ${q.join(" ")} />`,z=Y.context;if(!z.__safeImageHandlerEmitted)return z.__safeImageHandlerEmitted=!0,`${$W}${W}`;return W}}});function b3($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function d5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function X$($,Z,Y){let X=d5($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Y}var S3;var y3=b(()=>{S3={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,Y){let X=b3(d5($,"color")||"#6366f1"),Q=b3(d5($,"initialColor")||d5($,"initial-color")||""),J=b3(d5($,"height")||"3px"),G=X$($,"duration",2000),K=X$($,"throttle",200),q=X$($,"zIndex",999999)||X$($,"z-index",999999),U=Q?`linear-gradient(to right, ${Q}, ${X})`:X;return`
3915
+ <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${J};background:${U};z-index:${q};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
3916
3916
  <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>
3917
3917
  </div>
3918
3918
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
3919
3919
  <script>
3920
3920
  (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()})})();
3921
- </script>`}}});function u0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function TY($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function aU($,Z,Y){let X=TY($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Y}var wY,y3;var P3=b(()=>{wY={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},y3={name:"StxToast",aliases:["stx-toast"],render($,Z,Y){let X=u0(TY($,"position")||"top-right"),Q=aU($,"max",5),J=wY[X]||wY["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${X}" data-stx-toast-max="${Q}" style="position:fixed;${J};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
3921
+ </script>`}}});function u0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function M2($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function ZW($,Z,Y){let X=M2($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Y}var T2,P3;var C3=b(()=>{T2={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},P3={name:"StxToast",aliases:["stx-toast"],render($,Z,Y){let X=u0(M2($,"position")||"top-right"),Q=ZW($,"max",5),J=T2[X]||T2["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>
3922
3922
  <style>
3923
3923
  @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
3924
3924
  @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
@@ -3926,7 +3926,7 @@ ${E}
3926
3926
  @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
3927
3927
  @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
3928
3928
  @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
3929
- </style>`}}});function J$($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var MY,C3;var v3=b(()=>{MY={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)"},C3={name:"StxModal",aliases:["stx-modal"],render($,Z,Y){let X=J$($,"id");if(!X)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Q=u0(X),J=J$($,"size")||"md",G=J$($,"closeOnBackdrop")!=="false",K=J$($,"closeOnEscape")!=="false",q=MY[J]||MY.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">
3929
+ </style>`}}});function J$($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var I2,v3;var x3=b(()=>{I2={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},v3={name:"StxModal",aliases:["stx-modal"],render($,Z,Y){let X=J$($,"id");if(!X)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Q=u0(X),J=J$($,"size")||"md",G=J$($,"closeOnBackdrop")!=="false",K=J$($,"closeOnEscape")!=="false",q=I2[J]||I2.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">
3930
3930
  <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)">
3931
3931
  <div style="padding:1.5rem">${Z}</div>
3932
3932
  </div>
@@ -3935,8 +3935,8 @@ ${E}
3935
3935
  @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
3936
3936
  .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
3937
3937
  .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
3938
- </style>`}}});function a1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var IY,x3;var f3=b(()=>{IY={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},x3={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,Y){let X=a1($,"id");if(!X)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Q=u0(X),J=a1($,"side")||"right",G=a1($,"size")||"md",K=a1($,"closeOnBackdrop")!=="false",q=a1($,"closeOnEscape")!=="false",W=a1($,"overlay")!=="false",U=IY[G]||IY.md,z=J==="left",B=z?"left:0":"right:0",_=z?"translateX(-100%)":"translateX(100%)",j=z?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${Q}" class="stx-drawer-backdrop" data-stx-drawer="${Q}" data-close-backdrop="${K}" data-close-escape="${q}" style="display:none;position:fixed;inset:0;z-index:99999;${W?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
3939
- <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${B};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">
3938
+ </style>`}}});function a1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var D2,f3;var g3=b(()=>{D2={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},f3={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,Y){let X=a1($,"id");if(!X)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Q=u0(X),J=a1($,"side")||"right",G=a1($,"size")||"md",K=a1($,"closeOnBackdrop")!=="false",q=a1($,"closeOnEscape")!=="false",U=a1($,"overlay")!=="false",W=D2[G]||D2.md,z=J==="left",B=z?"left:0":"right:0",_=z?"translateX(-100%)":"translateX(100%)",j=z?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${Q}" class="stx-drawer-backdrop" data-stx-drawer="${Q}" data-close-backdrop="${K}" data-close-escape="${q}" style="display:none;position:fixed;inset:0;z-index:99999;${U?"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">
3939
+ <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${B};width:${W};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">
3940
3940
  <div style="padding:1.5rem">${Z}</div>
3941
3941
  </div>
3942
3942
  </div>
@@ -3944,22 +3944,22 @@ ${E}
3944
3944
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
3945
3945
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
3946
3946
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
3947
- </style>`}}});import{existsSync as tU,readFileSync as eU}from"fs";function $W($){if(DY.has($))return;DY.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function ZW($){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(tU(Y))return Y;for(let Y of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return Q0.resolve(Y)}catch{}return null}function YW($){if(Q$.has($))return Q$.get($);let Z=ZW($);if(!Z)return $W($),null;try{let Y=JSON.parse(eU(Z,"utf8"));return Q$.set($,Y.icons),Y.icons}catch{return null}}function t1($,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 Q$,DY,g3;var h3=b(()=>{Q$=new Map,DY=new Set;g3={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let X=t1($,"name")??t1($,"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=u0(t1($,"size")||"24"),K=u0(t1($,"color")||"currentColor"),q=u0(t1($,"class")||""),W=u0(t1($,"style")||""),U=Q$.get(Q)??YW(Q);if(!U)return`<!-- Icon: collection "${Q}" not loaded -->`;let z=U[J];if(!z)return`<!-- Icon: "${J}" not found in ${Q} -->`;let B=z.width||24,_=z.height||24,j=`0 0 ${B} ${_}`,H=z.body;if(K!=="currentColor")H=H.replace(/currentColor/g,K);let L=q?` class="${q}"`:"",F=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${j}" fill="none"${L}${F}>${H}</svg>`}}});function EY($,...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 kY($,Z){let Y=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),X=$.match(Y);if(!X)return{region:null,rest:$};return{region:X[2],rest:$.replace(X[0],"")}}var d3;var m3=b(()=>{d3={name:"Suspense",aliases:["suspense"],render($,Z,Y){let X=kY(Z,"fallback"),Q=X.rest,J=kY(Q,"error"),G=J.rest,K=X.region??EY($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=J.region??EY($,"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 G$($,...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 u3;var l3=b(()=>{u3={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let X=(G$($,"name")||"v").replace(/["'<>]/g,""),Q=(G$($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",J=G$($,"class"),G=G$($,"id"),K=[`data-stx-transition-group="${X}"`,J?`class="${J}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Q} ${K}>${Z}</${Q}>`}}});function bY(){E0.registerBuiltin(R3),E0.registerBuiltin(M3),E0.registerBuiltin(D3),E0.registerBuiltin(b3),E0.registerBuiltin(y3),E0.registerBuiltin(C3),E0.registerBuiltin(x3),E0.registerBuiltin(g3),E0.registerBuiltin(d3),E0.registerBuiltin(u3)}var SY=b(()=>{A3();I3();E3();S3();P3();v3();f3();h3();m3();l3();V3();A3();I3();E3();S3();P3();v3();f3();h3();m3();l3()});function yY($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function PY($,Z,Y){let X=[],Q=0;while(Q<$.length){let J=$.indexOf("<",Q);if(J===-1)break;let K=$.slice(J+1).match(new RegExp(`^(${Z.source})`));if(!K){Q=J+1;continue}let q=K[1];if(Y&&Y.has(q.toLowerCase())){let H=J+1+q.length;while(H<$.length&&$[H]!==">")H++;Q=H+1;continue}let W=J+1+q.length,U=null,z=W,B=-1,_=!1;while(W<$.length){let H=$[W];if(U){if(H==="\\"&&W+1<$.length){W+=2;continue}if(H===U)U=null;W++;continue}if(H==='"'||H==="'"){U=H,W++;continue}if(H==="/"&&W+1<$.length&&$[W+1]===">"){B=W+2,_=!0;break}if(H===">"){B=W+1;break}W++}if(B===-1){Q=J+1;continue}let j=$.slice(z,_?B-2:B-1).trim();if(_)X.push({fullMatch:$.slice(J,B),tagName:q,attributes:j,content:"",startIndex:J,endIndex:B,isSelfClosing:!0}),Q=B;else{let H=`<${q}`,L=`</${q}>`,F=1,O=B,V=-1;while(F>0&&O<$.length){let N=$.indexOf(H,O),w=$.indexOf(L,O);if(w===-1)break;if(N!==-1&&N<w){let T=$[N+H.length];if(T===" "||T===">"||T==="/"||T===`
3948
- `||T==="\t")F++;O=N+H.length}else{if(F--,F===0){V=w;break}O=w+L.length}}if(V===-1){Q=B;continue}let R=$.slice(B,V),A=V+L.length;X.push({fullMatch:$.slice(J,A),tagName:q,attributes:j,content:R,startIndex:J,endIndex:A,isSelfClosing:!1}),Q=A}}return X}function CY($,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 vY=b(()=>{L0();H0();K4()});var mY={};o(mY,{processESImports:()=>dY,processComponents:()=>q$});import K$ from"fs";import S0 from"path";function JW($,Z,Y){let X={static:{},serverDynamic:{},clientReactive:{},events:{}},Q=new Set(["x-cloak","x-show","x-if","x-for","x-data","x-init","x-transition","x-ref","x-effect","x-model","x-text","x-html","x-class","x-style","x-on","x-bind"]),J=(G)=>{if(!G.includes("-")||G.startsWith("@")||G.startsWith(":")||G.startsWith("x-")||G.startsWith("__"))return G;return G.replace(/-([a-z0-9])/g,(K,q)=>q.toUpperCase())};for(let[G,K]of Object.entries($)){let q=G.startsWith("x-")&&!Q.has(G)&&!G.startsWith("x-bind:")&&!G.startsWith("x-on:")?`:${G.slice(2)}`:G;if(q.startsWith("@")){X.events[q]=K;continue}if(q.startsWith("__stx_")){let W=J(q.slice(6));X.serverDynamic[W]=CY(K,Y);continue}if(q.startsWith(":")){let W=J(q.slice(1)),U=K==="true"?W:K;try{if(!X0(U)){if(Y.debug)console.error(`Unsafe expression in :${W} binding: ${U}`);X.clientReactive[W]=U;continue}let z=Object.keys(Z),_=J0(U,z)(...Object.values(Z));if(_===void 0){let j=U.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],H=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(j.some((F)=>!H.has(F)&&!z.includes(F))){X.clientReactive[W]=U;continue}}X.serverDynamic[W]=_}catch{X.clientReactive[W]=U}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let W=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(W)try{let U=W[1];if(X0(U)){let B=J0(U,Object.keys(Z))(...Object.values(Z));X.static[q]=B!=null?String(B):""}else{if(Y.debug)console.error(`Unsafe expression in ${q}: ${U}`);X.static[q]=K}}catch(U){if(Y.debug)console.error(`Error evaluating expression for ${q}:`,U);X.static[q]=K}else{let U=K,z=/\{\{\s*([\s\S]+?)\s*\}\}/g,B;while((B=z.exec(K))!==null)try{let _=B[1];if(!X0(_)){if(Y.debug)console.error(`Unsafe expression in ${q}: ${_}`);continue}let H=J0(_,Object.keys(Z))(...Object.values(Z));U=U.replace(B[0],String(H??""))}catch(_){if(Y.debug)console.error(`Error evaluating expression in ${q}:`,_)}X.static[q]=U}continue}X.static[q]=K}return X}function QW($){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]="true"}return Z}function fY($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function GW($){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(E0.isBuiltin(Q))Z.add(Q)}return[...Z].sort()}function KW($){let Z=gY.get($);if(Z)return Z;let Y=new Map,X=[S0.join($,"src"),S0.join($,"dist"),$];function Q(J,G){if(G>6)return;let K;try{K=K$.readdirSync(J,{withFileTypes:!0})}catch{return}for(let q of K){let W=S0.join(J,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;Q(W,G+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let U=q.name.slice(0,-4);if(!Y.has(U))Y.set(U,W);let z=U.toLowerCase();if(!Y.has(z))Y.set(z,W);let B=U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(B))Y.set(B,W)}}}for(let J of X)if(Q(J,0),Y.size>0)break;return gY.set($,Y),Y}function qW($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let X=S0.join(Y,"node_modules",$);try{if(K$.statSync(X).isDirectory())return X}catch{}let Q=S0.dirname(Y);if(Q===Y)return null;Y=Q}}async function dY($,Z,Y,X,Q){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let J=Z.__importedComponents,G=S0.dirname(Y),K=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(q,(W,U,z)=>{let B=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,_=z,j,H=[];while((j=B.exec(z))!==null){let[L,F,O,V]=j,R=null,A=null;if(V.startsWith(".")||V.startsWith("/")){let T=S0.resolve(G,V);if(T.endsWith(".stx"))A=T;else{let M=`${T}.stx`;try{if(K$.statSync(M).isFile())A=M}catch{try{if(K$.statSync(T).isDirectory())R=T}catch{}}}}else R=qW(V,G);if(!R&&!A)continue;let N=!1,w=(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)w(O,A),N=!0;else if(F){let T=F.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let D=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(D)return{source:D[1],local:D[2]};return{source:I,local:I}}),M=R?KW(R):null;for(let{source:I,local:D}of T){let E=null;if(A)E=A;else if(M)E=M.get(I)??M.get(I.toLowerCase())??M.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(E)w(D,E),N=!0}}if(N)H.push({start:j.index,end:j.index+L.length})}if(H.length===0)return W;for(let L=H.length-1;L>=0;L--)_=_.slice(0,H[L].start)+_.slice(H[L].end);return`<script${U}>${_}</script>`}),K}async function UW($,Z,Y,X,Q){let J=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(J))!==null){let[W,U]=q,z=U.split(",").map((B)=>B.trim().replace(/^['"]|['"]$/g,"")).filter((B)=>B.length>0);for(let B of z){let _=B.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=[S0.resolve(S0.dirname(Y),`${B}.stx`),S0.resolve(S0.dirname(Y),B),S0.resolve(X.componentsDir||"components",`${B}.stx`),S0.resolve(X.componentsDir||"components",B),B.endsWith(".stx")?B:`${B}.stx`];for(let V of O)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(L,F),G.set(H,F),G.set(H.toLowerCase(),F);let V=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),Q.add(F),X.debug)console.log(`Imported component: ${L} -> ${F}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${B}`)}J=J.replace(W,""),K.lastIndex=0}return J}async function WW($,Z,Y,X,Q){let J=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=/@component\s*\(/g,W;while((W=q.exec(J))!==null){let U=W.index,z=U+W[0].length-1,B=1,_=z+1;while(_<J.length&&B>0){if(J[_]==="(")B++;else if(J[_]===")"){if(B--,B===0)break}_++}if(B!==0)break;let j=J.substring(z+1,_),H=_+1,L=j.match(/^\s*['"]([^'"]+)['"]/);if(!L){q.lastIndex=0;continue}let F=L[1],O,V=j.slice(L[0].length),R=V.match(/^\s*,\s*/);if(R)O=V.slice(R[0].length).trim();let A={};if(O)try{A=O0(O,Z)}catch(D){let E=D instanceof Error?D.message:String(D);J=J.replace(J.substring(U,H),`[Error parsing component props: ${E}]`);continue}let N="",w=H,M=J.substring(H).match(/^([\s\S]*?)@endcomponent/);if(M)N=M[1].trim(),w=H+M[0].length;let I=await N1(F,A,N,G,Z,Y,X,K,Q);J=J.substring(0,U)+I+J.substring(w),q.lastIndex=0}return J}async function zW($,Z,Y,X,Q){if(!$)return $;let J=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=c$(J);return J=q.output,J=await B(J,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),J=await B(J,/[A-Z][a-zA-Z0-9]*/,!0),J=await B(J,/[a-z][a-z0-9]*/,!1,XW),J=i$(J,q.scripts),J;async function B(_,j,H,L){if(!_)return _;let F=_,O=PY(F,j,L);for(let V=O.length-1;V>=0;V--){let R=O[V],A=H?yY(R.tagName):R.tagName,N=QW(R.attributes),w=JW(N,Z,X),T=E0.getBuiltin(R.tagName),M=T?await B4(A,G,Z,Y,X):!1;if(T&&!M){let C={context:Z,filePath:Y,options:X,dependencies:Q},S=T.render(w,R.content,C);if(Object.keys(w.clientReactive).length>0)S=hY(S,w.clientReactive);if(Object.keys(w.events).length>0){let k=Object.entries(w.events).map(([P,d])=>`${P}="${fY(d)}"`).join(" ");S=S.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${k}`)}F=F.substring(0,R.startIndex)+S+F.substring(R.endIndex);continue}if(!H&&R.tagName.includes("-")&&!await B4(A,G,Z,Y,X))continue;let I={};for(let[C,S]of Object.entries(w.static))I[C]=S;for(let[C,S]of Object.entries(w.serverDynamic))I[C]=S;let E=await N1(A,I,R.content,G,Z,Y,X,K,Q);if(Object.keys(w.clientReactive).length>0)E=hY(E,w.clientReactive);if(Object.keys(w.events).length>0){let C=E.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(C){let S=Object.entries(w.events).map(([P,d])=>`${P}="${fY(d)}"`).join(" "),k=C[1].length+C[2].length;E=E.substring(0,k)+" "+S+E.substring(k)}}F=F.substring(0,R.startIndex)+E+F.substring(R.endIndex)}return F}}function hY($,Z){let Y=$.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(!Y)return $;let X=Object.entries(Z).map(([J,G])=>`:${J}="${G.replace(/"/g,"&quot;")}"`).join(" "),Q=Y[1].length+Y[2].length;return $.substring(0,Q)+" "+X+$.substring(Q)}async function q$($,Z,Y,X,Q){if(!xY)bY(),xY=!0;let J=await dY($,Z,Y,X,Q);J=await UW(J,Z,Y,X,Q),J=await WW(J,Z,Y,X,Q);for(let G=0;G<3;G++){let K=J;if(J=await zW(J,Z,Y,X,Q),J===K)break}if(X.debug){let G=GW(J);if(G.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${G.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return J}var xY=!1,XW,gY;var p3=b(()=>{V3();SY();vY();H0();L0();XW=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"]);gY=new Map});var oY={};o(oY,{processLoops:()=>c3});function jW($,Z){let Y=/@component\s*\(/g,X=$,Q,J=[];while((Q=Y.exec(X))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")"){if(q--,q===0)break}W++}if(q!==0)continue;let U=X.substring(K+1,W),z=W+1,B=U.match(/^\s*['"]([^'"]+)['"]/);if(!B)continue;let _=B[1],j=U.slice(B[0].length),H=j.match(/^\s*,\s*/);if(!H)continue;let L=j.slice(H[0].length).trim();if(!L)continue;try{let F=O0(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 U$($,Z,Y){let X=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),J;while((J=Q.exec(X))!==null){let G=J.index,K=G+J[0].length-1,q=1,W=K+1,U=null,z=!1;while(W<X.length&&q>0){let j=X[W];if(z){z=!1,W++;continue}if(j==="\\"&&U){z=!0,W++;continue}if(U){if(j===U)U=null;W++;continue}if(j==='"'||j==="'"||j==="`"){U=j,W++;continue}if(j==="(")q++;else if(j===")"){if(q--,q===0)break}W++}if(q!==0)break;let B=X.substring(K+1,W),_=Y(B);X=X.substring(0,G)+_+X.substring(W+1)}return X}function HW($,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);X4(J);let W=J0(J,G)(...K),U=JSON.stringify(W),z=Buffer.from(U,"utf8").toString("base64");return`__stx_${Q}="${z}"`}catch(G){return X}}),Y}function OW($,Z){let Y=$;return Y=U$(Y,"@break",(X)=>{try{let J=`!!(${X.trim()})`,G;if(X0(J)){let K=J0(J,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean($0(J,Z));return G?W$:""}catch{return""}}),Y=U$(Y,"@continue",(X)=>{try{let J=`!!(${X.trim()})`,G;if(X0(J)){let K=J0(J,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean($0(J,Z));return G?z$:""}catch{return""}}),Y}function LW($){let Z=$;return Z=Z.replace(/@break(?!\()/g,W$),Z=Z.replace(/@continue(?!\()/g,z$),Z}function uY($){let Z=$.includes(W$),Y=Z?$.substring(0,$.indexOf(W$)):$;return{hasBreak:Z,content:Y}}function lY($){let Z=$.includes(z$),Y=Z?$.substring(0,$.indexOf(z$)):$;return{hasContinue:Z,content:Y}}function cY($){let Z=$;return Z=U$(Z,"@break",(Y)=>{let X=Y.trim();if(!J4(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=U$(Z,"@continue",(Y)=>{let X=Y.trim();if(!J4(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function FW($){let Z=/@forelse\s*\(/g,Y,X=[],Q=/@foreach\s*\(/g,J=/@endforeach/g,G;while((G=Q.exec($))!==null)X.push({pos:G.index,delta:1});while((G=J.exec($))!==null)X.push({pos:G.index,delta:-1});X.sort((U,z)=>U.pos-z.pos);let K=[],q=0;for(let U of X)q+=U.delta,K.push({pos:U.pos,depth:q});function W(U){let z=0,B=K.length-1,_=0;while(z<=B){let j=z+B>>1;if(K[j].pos<=U)_=K[j].depth,z=j+1;else B=j-1}return _}while((Y=Z.exec($))!==null){if(W(Y.index)>0)continue;let U=Y.index,z=Y.index+Y[0].length-1,B=1,_=z+1,j=-1;while(_<$.length&&B>0){if($[_]==="(")B++;else if($[_]===")"){if(B--,B===0){j=_;break}}_++}if(j===-1)continue;let H=$.substring(z+1,j),L=H.indexOf(" as ");if(L===-1)continue;let F=H.substring(0,L).trim(),O=H.substring(L+4).trim(),V=j+1,R=1,A=V,N=/@forelse\s*\(/g,w=/@endforelse/g,T=-1;while(R>0&&A<$.length){N.lastIndex=A,w.lastIndex=A;let S=N.exec($),k=w.exec($);if(!k)break;if(S&&S.index<k.index)R++,A=S.index+S[0].length;else{if(R--,R===0){T=k.index;break}A=k.index+11}}if(T===-1)continue;let M=$.substring(V,T),I=T+11,D=-1,E=0,C=0;while(C<M.length){let S=M.indexOf("@",C);if(S===-1)break;let k=M.substring(S);if(/^@forelse\s*\(/.test(k))E++,C=S+1;else if(k.startsWith("@endforelse"))E--,C=S+11;else if(E===0&&k.startsWith("@empty")){if(M.length<=S+6||!/[a-z]/i.test(M[S+6])){D=S;break}C=S+1}else C=S+1}if(D===-1)continue;return{start:U,end:I,arrayExpr:F,itemVar:O,foreachContent:M.substring(0,D),emptyContent:M.substring(D+6)}}return null}function pY($,Z){let Y=$;while(!0){let X=FW(Y);if(!X)break;let{start:Q,end:J,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:W}=X;try{let U;if(X0(G))U=J0(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),B=t("Forelse",`Error in @forelse(${G} as ${K}): ${z}`,n.EVALUATION_ERROR);Y=Y.substring(0,Q)+B+Y.substring(J)}}return Y}function c3($,Z,Y,X){let Q=$;Q=pY(Q,Z);function J(q){let W=/@foreach\s*\(/g,U;while((U=W.exec(q))!==null){let z=U.index,B=U.index+U[0].length-1,_=1,j=B+1,H=-1;while(j<q.length&&_>0){if(q[j]==="(")_++;else if(q[j]===")"){if(_--,_===0){H=j;break}}j++}if(H===-1)continue;let L=q.substring(B+1,H),F=L.indexOf(" as ");if(F===-1)continue;let O=z,V=L.substring(0,F),R=L.substring(F+4),A=H+1,N=1,w=A,T=/@foreach\s*\(/g,M=/@endforeach/g;while(N>0&&w<q.length){T.lastIndex=w,M.lastIndex=w;let I=T.exec(q),D=M.exec(q);if(!D)break;if(I&&I.index<D.index)N++,w=I.index+I[0].length;else{if(N--,N===0){let E=q.substring(A,D.index),C=D.index+11;return{start:O,end:C,arrayExpr:V,itemVar:R,content:E}}w=D.index+11}}}return null}function G(q,W){let U=q;while(!0){let z=J(U);if(!z)break;let{start:B,end:_,arrayExpr:j,itemVar:H,content:L}=z;try{let F=j.trim(),O;if(X0(F))O=J0(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 D=t("Foreach",`Error in @foreach: ${F} is not iterable`,n.TYPE_ERROR);U=U.substring(0,B)+D+U.substring(_);continue}let R=X?.loops?.useAltLoopVariable??_W,A=H.trim(),N=null,w,T=!1;if(A.includes("=>")){let D=A.split("=>").map((E)=>E.trim());if(D.length===2&&D[0]&&D[1])N=D[0],w=D[1];else w=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let D=A.split(",").map((E)=>E.trim());if(D.length===2&&D[0]&&D[1])w=D[0],N=D[1],T=!0;else w=A}else w=A;let M="",I=O;for(let D=0;D<I.length;D++){let E=I[D],C={index:D,iteration:D+1,first:D===0,last:D===I.length-1,count:I.length},S={...W,loop:C,$loop:C};if(w.startsWith("[")&&w.endsWith("]")){let g=w.slice(1,-1).split(",").map((m)=>m.trim());if(Array.isArray(E))g.forEach((m,s)=>{if(m)S[m]=E[s]});else S[w]=E}else S[w]=E;if(N)if(!T&&V&&Array.isArray(E)&&E.length===2)S[N]=E[0],S[w]=E[1];else S[N]=D;let k=OW(L,S),P=lY(k);if(P.hasContinue){M+=P.content;continue}let d=uY(k);if(d.hasBreak){M+=d.content;break}if(k=pY(k,S),k=G(k,S),k=k1(k,S,Y),k=LW(k),d=uY(k),d.hasBreak){M+=d.content;break}if(P=lY(k),P.hasContinue){M+=P.content;continue}k=p0(k,S,Y),k=HW(k,S),k=jW(k,S),M+=k}U=U.substring(0,B)+M+U.substring(_)}catch(F){let O=t("Foreach",`Error in @foreach(${j.trim()} as ${H.trim()}): ${F instanceof Error?F.message:String(F)}`,n.EVALUATION_ERROR);U=U.substring(0,B)+O+U.substring(_)}}return U}Q=G(Q,Z),Q=nY(Q,Z,Y,X);let K=X?.loops?.maxWhileIterations??BW;return Q=AW(Q,Z,K),Q}function iY($){return J4($)}function nY($,Z,Y,X){let Q=$,J=!0;while(J){J=!1;let G=Q.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=K+G[0].length-1,W=D0(Q,"(",")",q);if(W===-1)break;let U=Q.slice(q+1,W),z=W+1,B=r4(Q.slice(K),"for","endfor");if(B.length===0)break;let _=B[0].content,j=K+B[0].end;if(!iY(U)){let H=t("For",`Unsafe expression in @for: ${U}`,n.UNSAFE_EXPRESSION);Q=Q.substring(0,K)+H+Q.substring(j),J=!0;continue}try{let H=VW(U),L=/@(?:for|foreach|if|unless)\s*\(/.test(_);if(H.length>0&&L){let N=RW({forExpr:U,content:_,iterVarNames:H,context:Z,filePath:Y,options:X});Q=Q.substring(0,K)+N+Q.substring(j),J=!0;continue}let F=Object.keys(Z),O=Object.values(Z),V=_.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(N,w)=>{return`\${${w}}`});V=cY(V);let A=Function(...F,`
3947
+ </style>`}}});import{existsSync as YW,readFileSync as XW}from"fs";function JW($){if(E2.has($))return;E2.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function QW($){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(YW(Y))return Y;for(let Y of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return Q0.resolve(Y)}catch{}return null}function GW($){if(Q$.has($))return Q$.get($);let Z=QW($);if(!Z)return JW($),null;try{let Y=JSON.parse(XW(Z,"utf8"));return Q$.set($,Y.icons),Y.icons}catch{return null}}function t1($,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 Q$,E2,h3;var d3=b(()=>{Q$=new Map,E2=new Set;h3={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let X=t1($,"name")??t1($,"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=u0(t1($,"size")||"24"),K=u0(t1($,"color")||"currentColor"),q=u0(t1($,"class")||""),U=u0(t1($,"style")||""),W=Q$.get(Q)??GW(Q);if(!W)return`<!-- Icon: collection "${Q}" not loaded -->`;let z=W[J];if(!z)return`<!-- Icon: "${J}" not found in ${Q} -->`;let B=z.width||24,_=z.height||24,j=`0 0 ${B} ${_}`,H=z.body;if(K!=="currentColor")H=H.replace(/currentColor/g,K);let L=q?` class="${q}"`:"",F=U?` style="${U}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${j}" fill="none"${L}${F}>${H}</svg>`}}});function k2($,...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 b2($,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 m3;var u3=b(()=>{m3={name:"Suspense",aliases:["suspense"],render($,Z,Y){let X=b2(Z,"fallback"),Q=X.rest,J=b2(Q,"error"),G=J.rest,K=X.region??k2($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=J.region??k2($,"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 G$($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let X=$.static[Y];if(typeof X==="string")return X}return}var l3;var p3=b(()=>{l3={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let X=(G$($,"name")||"v").replace(/["'<>]/g,""),Q=(G$($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",J=G$($,"class"),G=G$($,"id"),K=[`data-stx-transition-group="${X}"`,J?`class="${J}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Q} ${K}>${Z}</${Q}>`}}});function S2(){D0.registerBuiltin(N3),D0.registerBuiltin(I3),D0.registerBuiltin(E3),D0.registerBuiltin(S3),D0.registerBuiltin(P3),D0.registerBuiltin(v3),D0.registerBuiltin(f3),D0.registerBuiltin(h3),D0.registerBuiltin(m3),D0.registerBuiltin(l3)}var y2=b(()=>{A3();D3();k3();y3();C3();x3();g3();d3();u3();p3();R3();A3();D3();k3();y3();C3();x3();g3();d3();u3();p3()});function P2($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function C2($,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 U=J+1+q.length,W=null,z=U,B=-1,_=!1;while(U<$.length){let H=$[U];if(W){if(H==="\\"&&U+1<$.length){U+=2;continue}if(H===W)W=null;U++;continue}if(H==='"'||H==="'"){W=H,U++;continue}if(H==="/"&&U+1<$.length&&$[U+1]===">"){B=U+2,_=!0;break}if(H===">"){B=U+1;break}U++}if(B===-1){Q=J+1;continue}let j=$.slice(z,_?B-2:B-1).trim();if(_)X.push({fullMatch:$.slice(J,B),tagName:q,attributes:j,content:"",startIndex:J,endIndex:B,isSelfClosing:!0}),Q=B;else{let H=`<${q}`,L=`</${q}>`,F=1,O=B,V=-1;while(F>0&&O<$.length){let A=$.indexOf(H,O),w=$.indexOf(L,O);if(w===-1)break;if(A!==-1&&A<w){let T=$[A+H.length];if(T===" "||T===">"||T==="/"||T===`
3948
+ `||T==="\t")F++;O=A+H.length}else{if(F--,F===0){V=w;break}O=w+L.length}}if(V===-1){Q=B;continue}let R=$.slice(B,V),N=V+L.length;X.push({fullMatch:$.slice(J,N),tagName:q,attributes:j,content:R,startIndex:J,endIndex:N,isSelfClosing:!1}),Q=N}}return X}function v2($,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 x2=b(()=>{L0();H0();K4()});var u2={};o(u2,{processESImports:()=>m2,processComponents:()=>q$});import K$ from"fs";import S0 from"path";function qW($,Z,Y){let X={static:{},serverDynamic:{},clientReactive:{},events:{}},Q=new Set(["x-cloak","x-show","x-if","x-for","x-data","x-init","x-transition","x-ref","x-effect","x-model","x-text","x-html","x-class","x-style","x-on","x-bind"]),J=(G)=>{if(!G.includes("-")||G.startsWith("@")||G.startsWith(":")||G.startsWith("x-")||G.startsWith("__"))return G;return G.replace(/-([a-z0-9])/g,(K,q)=>q.toUpperCase())};for(let[G,K]of Object.entries($)){let q=G.startsWith("x-")&&!Q.has(G)&&!G.startsWith("x-bind:")&&!G.startsWith("x-on:")?`:${G.slice(2)}`:G;if(q.startsWith("@")){X.events[q]=K;continue}if(q.startsWith("__stx_")){let U=J(q.slice(6));X.serverDynamic[U]=v2(K,Y);continue}if(q.startsWith(":")){let U=J(q.slice(1)),W=K==="true"?U:K;try{if(!X0(W)){if(Y.debug)console.error(`Unsafe expression in :${U} binding: ${W}`);X.clientReactive[U]=W;continue}let z=Object.keys(Z),_=J0(W,z)(...Object.values(Z));if(_===void 0){let j=W.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],H=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(j.some((F)=>!H.has(F)&&!z.includes(F))){X.clientReactive[U]=W;continue}}X.serverDynamic[U]=_}catch{X.clientReactive[U]=W}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let U=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(U)try{let W=U[1];if(X0(W)){let B=J0(W,Object.keys(Z))(...Object.values(Z));X.static[q]=B!=null?String(B):""}else{if(Y.debug)console.error(`Unsafe expression in ${q}: ${W}`);X.static[q]=K}}catch(W){if(Y.debug)console.error(`Error evaluating expression for ${q}:`,W);X.static[q]=K}else{let W=K,z=/\{\{\s*([\s\S]+?)\s*\}\}/g,B;while((B=z.exec(K))!==null)try{let _=B[1];if(!X0(_)){if(Y.debug)console.error(`Unsafe expression in ${q}: ${_}`);continue}let H=J0(_,Object.keys(Z))(...Object.values(Z));W=W.replace(B[0],String(H??""))}catch(_){if(Y.debug)console.error(`Error evaluating expression in ${q}:`,_)}X.static[q]=W}continue}X.static[q]=K}return X}function UW($){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]="true"}return Z}function g2($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function WW($){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(D0.isBuiltin(Q))Z.add(Q)}return[...Z].sort()}function zW($){let Z=h2.get($);if(Z)return Z;let Y=new Map,X=[S0.join($,"src"),S0.join($,"dist"),$];function Q(J,G){if(G>6)return;let K;try{K=K$.readdirSync(J,{withFileTypes:!0})}catch{return}for(let q of K){let U=S0.join(J,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;Q(U,G+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let W=q.name.slice(0,-4);if(!Y.has(W))Y.set(W,U);let z=W.toLowerCase();if(!Y.has(z))Y.set(z,U);let B=W.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(B))Y.set(B,U)}}}for(let J of X)if(Q(J,0),Y.size>0)break;return h2.set($,Y),Y}function BW($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let X=S0.join(Y,"node_modules",$);try{if(K$.statSync(X).isDirectory())return X}catch{}let Q=S0.dirname(Y);if(Q===Y)return null;Y=Q}}async function m2($,Z,Y,X,Q){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let J=Z.__importedComponents,G=S0.dirname(Y),K=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(q,(U,W,z)=>{let B=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,_=z,j,H=[];while((j=B.exec(z))!==null){let[L,F,O,V]=j,R=null,N=null;if(V.startsWith(".")||V.startsWith("/")){let T=S0.resolve(G,V);if(T.endsWith(".stx"))N=T;else{let M=`${T}.stx`;try{if(K$.statSync(M).isFile())N=M}catch{try{if(K$.statSync(T).isDirectory())R=T}catch{}}}}else R=BW(V,G);if(!R&&!N)continue;let A=!1,w=(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&&N)w(O,N),A=!0;else if(F){let T=F.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let D=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(D)return{source:D[1],local:D[2]};return{source:I,local:I}}),M=R?zW(R):null;for(let{source:I,local:D}of T){let E=null;if(N)E=N;else if(M)E=M.get(I)??M.get(I.toLowerCase())??M.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(E)w(D,E),A=!0}}if(A)H.push({start:j.index,end:j.index+L.length})}if(H.length===0)return U;for(let L=H.length-1;L>=0;L--)_=_.slice(0,H[L].start)+_.slice(H[L].end);return`<script${W}>${_}</script>`}),K}async function _W($,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[U,W]=q,z=W.split(",").map((B)=>B.trim().replace(/^['"]|['"]$/g,"")).filter((B)=>B.length>0);for(let B of z){let _=B.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=[S0.resolve(S0.dirname(Y),`${B}.stx`),S0.resolve(S0.dirname(Y),B),S0.resolve(X.componentsDir||"components",`${B}.stx`),S0.resolve(X.componentsDir||"components",B),B.endsWith(".stx")?B:`${B}.stx`];for(let V of O)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(L,F),G.set(H,F),G.set(H.toLowerCase(),F);let V=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),Q.add(F),X.debug)console.log(`Imported component: ${L} -> ${F}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${B}`)}J=J.replace(U,""),K.lastIndex=0}return J}async function jW($,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,U;while((U=q.exec(J))!==null){let W=U.index,z=W+U[0].length-1,B=1,_=z+1;while(_<J.length&&B>0){if(J[_]==="(")B++;else if(J[_]===")"){if(B--,B===0)break}_++}if(B!==0)break;let j=J.substring(z+1,_),H=_+1,L=j.match(/^\s*['"]([^'"]+)['"]/);if(!L){q.lastIndex=0;continue}let F=L[1],O,V=j.slice(L[0].length),R=V.match(/^\s*,\s*/);if(R)O=V.slice(R[0].length).trim();let N={};if(O)try{N=O0(O,Z)}catch(D){let E=D instanceof Error?D.message:String(D);J=J.replace(J.substring(W,H),`[Error parsing component props: ${E}]`);continue}let A="",w=H,M=J.substring(H).match(/^([\s\S]*?)@endcomponent/);if(M)A=M[1].trim(),w=H+M[0].length;let I=await A1(F,N,A,G,Z,Y,X,K,Q);J=J.substring(0,W)+I+J.substring(w),q.lastIndex=0}return J}async function HW($,Z,Y,X,Q){if(!$)return $;let J=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=c$(J);return J=q.output,J=await B(J,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),J=await B(J,/[A-Z][a-zA-Z0-9]*/,!0),J=await B(J,/[a-z][a-z0-9]*/,!1,KW),J=i$(J,q.scripts),J;async function B(_,j,H,L){if(!_)return _;let F=_,O=C2(F,j,L);for(let V=O.length-1;V>=0;V--){let R=O[V],N=H?P2(R.tagName):R.tagName,A=UW(R.attributes),w=qW(A,Z,X),T=D0.getBuiltin(R.tagName),M=T?await B4(N,G,Z,Y,X):!1;if(T&&!M){let C={context:Z,filePath:Y,options:X,dependencies:Q},S=T.render(w,R.content,C);if(Object.keys(w.clientReactive).length>0)S=d2(S,w.clientReactive);if(Object.keys(w.events).length>0){let k=Object.entries(w.events).map(([y,d])=>`${y}="${g2(d)}"`).join(" ");S=S.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${k}`)}F=F.substring(0,R.startIndex)+S+F.substring(R.endIndex);continue}if(!H&&R.tagName.includes("-")&&!await B4(N,G,Z,Y,X))continue;let I={};for(let[C,S]of Object.entries(w.static))I[C]=S;for(let[C,S]of Object.entries(w.serverDynamic))I[C]=S;let E=await A1(N,I,R.content,G,Z,Y,X,K,Q);if(Object.keys(w.clientReactive).length>0)E=d2(E,w.clientReactive);if(Object.keys(w.events).length>0){let C=E.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(C){let S=Object.entries(w.events).map(([y,d])=>`${y}="${g2(d)}"`).join(" "),k=C[1].length+C[2].length;E=E.substring(0,k)+" "+S+E.substring(k)}}F=F.substring(0,R.startIndex)+E+F.substring(R.endIndex)}return F}}function d2($,Z){let Y=$.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(!Y)return $;let X=Object.entries(Z).map(([J,G])=>`:${J}="${G.replace(/"/g,"&quot;")}"`).join(" "),Q=Y[1].length+Y[2].length;return $.substring(0,Q)+" "+X+$.substring(Q)}async function q$($,Z,Y,X,Q){if(!f2)S2(),f2=!0;let J=await m2($,Z,Y,X,Q);J=await _W(J,Z,Y,X,Q),J=await jW(J,Z,Y,X,Q);for(let G=0;G<3;G++){let K=J;if(J=await HW(J,Z,Y,X,Q),J===K)break}if(X.debug){let G=WW(J);if(G.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${G.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return J}var f2=!1,KW,h2;var c3=b(()=>{R3();y2();x2();H0();L0();KW=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"]);h2=new Map});var s2={};o(s2,{processLoops:()=>i3});function FW($,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,U=K+1;while(U<X.length&&q>0){if(X[U]==="(")q++;else if(X[U]===")"){if(q--,q===0)break}U++}if(q!==0)continue;let W=X.substring(K+1,U),z=U+1,B=W.match(/^\s*['"]([^'"]+)['"]/);if(!B)continue;let _=B[1],j=W.slice(B[0].length),H=j.match(/^\s*,\s*/);if(!H)continue;let L=j.slice(H[0].length).trim();if(!L)continue;try{let F=O0(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:U}=J[G];X=X.substring(0,K)+U+X.substring(q)}return X}function U$($,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,U=K+1,W=null,z=!1;while(U<X.length&&q>0){let j=X[U];if(z){z=!1,U++;continue}if(j==="\\"&&W){z=!0,U++;continue}if(W){if(j===W)W=null;U++;continue}if(j==='"'||j==="'"||j==="`"){W=j,U++;continue}if(j==="(")q++;else if(j===")"){if(q--,q===0)break}U++}if(q!==0)break;let B=X.substring(K+1,U),_=Y(B);X=X.substring(0,G)+_+X.substring(U+1)}return X}function VW($,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);X4(J);let U=J0(J,G)(...K),W=JSON.stringify(U),z=Buffer.from(W,"utf8").toString("base64");return`__stx_${Q}="${z}"`}catch(G){return X}}),Y}function RW($,Z){let Y=$;return Y=U$(Y,"@break",(X)=>{try{let J=`!!(${X.trim()})`,G;if(X0(J)){let K=J0(J,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean($0(J,Z));return G?W$:""}catch{return""}}),Y=U$(Y,"@continue",(X)=>{try{let J=`!!(${X.trim()})`,G;if(X0(J)){let K=J0(J,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean($0(J,Z));return G?z$:""}catch{return""}}),Y}function NW($){let Z=$;return Z=Z.replace(/@break(?!\()/g,W$),Z=Z.replace(/@continue(?!\()/g,z$),Z}function l2($){let Z=$.includes(W$),Y=Z?$.substring(0,$.indexOf(W$)):$;return{hasBreak:Z,content:Y}}function p2($){let Z=$.includes(z$),Y=Z?$.substring(0,$.indexOf(z$)):$;return{hasContinue:Z,content:Y}}function i2($){let Z=$;return Z=U$(Z,"@break",(Y)=>{let X=Y.trim();if(!J4(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=U$(Z,"@continue",(Y)=>{let X=Y.trim();if(!J4(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function AW($){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((W,z)=>W.pos-z.pos);let K=[],q=0;for(let W of X)q+=W.delta,K.push({pos:W.pos,depth:q});function U(W){let z=0,B=K.length-1,_=0;while(z<=B){let j=z+B>>1;if(K[j].pos<=W)_=K[j].depth,z=j+1;else B=j-1}return _}while((Y=Z.exec($))!==null){if(U(Y.index)>0)continue;let W=Y.index,z=Y.index+Y[0].length-1,B=1,_=z+1,j=-1;while(_<$.length&&B>0){if($[_]==="(")B++;else if($[_]===")"){if(B--,B===0){j=_;break}}_++}if(j===-1)continue;let H=$.substring(z+1,j),L=H.indexOf(" as ");if(L===-1)continue;let F=H.substring(0,L).trim(),O=H.substring(L+4).trim(),V=j+1,R=1,N=V,A=/@forelse\s*\(/g,w=/@endforelse/g,T=-1;while(R>0&&N<$.length){A.lastIndex=N,w.lastIndex=N;let S=A.exec($),k=w.exec($);if(!k)break;if(S&&S.index<k.index)R++,N=S.index+S[0].length;else{if(R--,R===0){T=k.index;break}N=k.index+11}}if(T===-1)continue;let M=$.substring(V,T),I=T+11,D=-1,E=0,C=0;while(C<M.length){let S=M.indexOf("@",C);if(S===-1)break;let k=M.substring(S);if(/^@forelse\s*\(/.test(k))E++,C=S+1;else if(k.startsWith("@endforelse"))E--,C=S+11;else if(E===0&&k.startsWith("@empty")){if(M.length<=S+6||!/[a-z]/i.test(M[S+6])){D=S;break}C=S+1}else C=S+1}if(D===-1)continue;return{start:W,end:I,arrayExpr:F,itemVar:O,foreachContent:M.substring(0,D),emptyContent:M.substring(D+6)}}return null}function c2($,Z){let Y=$;while(!0){let X=AW(Y);if(!X)break;let{start:Q,end:J,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:U}=X;try{let W;if(X0(G))W=J0(G,Object.keys(Z))(...Object.values(Z));else W=$0(G,Z);let z;if(!Array.isArray(W)||W.length===0)z=U;else z=`@foreach (${G} as ${K})${q}@endforeach`;Y=Y.substring(0,Q)+z+Y.substring(J)}catch(W){let z=W instanceof Error?W.message:String(W),B=t("Forelse",`Error in @forelse(${G} as ${K}): ${z}`,n.EVALUATION_ERROR);Y=Y.substring(0,Q)+B+Y.substring(J)}}return Y}function i3($,Z,Y,X){let Q=$;Q=c2(Q,Z);function J(q){let U=/@foreach\s*\(/g,W;while((W=U.exec(q))!==null){let z=W.index,B=W.index+W[0].length-1,_=1,j=B+1,H=-1;while(j<q.length&&_>0){if(q[j]==="(")_++;else if(q[j]===")"){if(_--,_===0){H=j;break}}j++}if(H===-1)continue;let L=q.substring(B+1,H),F=L.indexOf(" as ");if(F===-1)continue;let O=z,V=L.substring(0,F),R=L.substring(F+4),N=H+1,A=1,w=N,T=/@foreach\s*\(/g,M=/@endforeach/g;while(A>0&&w<q.length){T.lastIndex=w,M.lastIndex=w;let I=T.exec(q),D=M.exec(q);if(!D)break;if(I&&I.index<D.index)A++,w=I.index+I[0].length;else{if(A--,A===0){let E=q.substring(N,D.index),C=D.index+11;return{start:O,end:C,arrayExpr:V,itemVar:R,content:E}}w=D.index+11}}}return null}function G(q,U){let W=q;while(!0){let z=J(W);if(!z)break;let{start:B,end:_,arrayExpr:j,itemVar:H,content:L}=z;try{let F=j.trim(),O;if(X0(F))O=J0(F,Object.keys(U))(...Object.values(U));else O=$0(F,U);let V=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),V=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),V=!0;else{let D=t("Foreach",`Error in @foreach: ${F} is not iterable`,n.TYPE_ERROR);W=W.substring(0,B)+D+W.substring(_);continue}let R=X?.loops?.useAltLoopVariable??LW,N=H.trim(),A=null,w,T=!1;if(N.includes("=>")){let D=N.split("=>").map((E)=>E.trim());if(D.length===2&&D[0]&&D[1])A=D[0],w=D[1];else w=N}else if(!N.startsWith("[")&&!N.startsWith("{")&&N.includes(",")){let D=N.split(",").map((E)=>E.trim());if(D.length===2&&D[0]&&D[1])w=D[0],A=D[1],T=!0;else w=N}else w=N;let M="",I=O;for(let D=0;D<I.length;D++){let E=I[D],C={index:D,iteration:D+1,first:D===0,last:D===I.length-1,count:I.length},S={...U,loop:C,$loop:C};if(w.startsWith("[")&&w.endsWith("]")){let g=w.slice(1,-1).split(",").map((m)=>m.trim());if(Array.isArray(E))g.forEach((m,s)=>{if(m)S[m]=E[s]});else S[w]=E}else S[w]=E;if(A)if(!T&&V&&Array.isArray(E)&&E.length===2)S[A]=E[0],S[w]=E[1];else S[A]=D;let k=RW(L,S),y=p2(k);if(y.hasContinue){M+=y.content;continue}let d=l2(k);if(d.hasBreak){M+=d.content;break}if(k=c2(k,S),k=G(k,S),k=k1(k,S,Y),k=NW(k),d=l2(k),d.hasBreak){M+=d.content;break}if(y=p2(k),y.hasContinue){M+=y.content;continue}k=p0(k,S,Y),k=VW(k,S),k=FW(k,S),M+=k}W=W.substring(0,B)+M+W.substring(_)}catch(F){let O=t("Foreach",`Error in @foreach(${j.trim()} as ${H.trim()}): ${F instanceof Error?F.message:String(F)}`,n.EVALUATION_ERROR);W=W.substring(0,B)+O+W.substring(_)}}return W}Q=G(Q,Z),Q=o2(Q,Z,Y,X);let K=X?.loops?.maxWhileIterations??OW;return Q=MW(Q,Z,K),Q}function n2($){return J4($)}function o2($,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,U=I0(Q,"(",")",q);if(U===-1)break;let W=Q.slice(q+1,U),z=U+1,B=r4(Q.slice(K),"for","endfor");if(B.length===0)break;let _=B[0].content,j=K+B[0].end;if(!n2(W)){let H=t("For",`Unsafe expression in @for: ${W}`,n.UNSAFE_EXPRESSION);Q=Q.substring(0,K)+H+Q.substring(j),J=!0;continue}try{let H=wW(W),L=/@(?:for|foreach|if|unless)\s*\(/.test(_);if(H.length>0&&L){let A=TW({forExpr:W,content:_,iterVarNames:H,context:Z,filePath:Y,options:X});Q=Q.substring(0,K)+A+Q.substring(j),J=!0;continue}let F=Object.keys(Z),O=Object.values(Z),V=_.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(A,w)=>{return`\${${w}}`});V=i2(V);let N=Function(...F,`
3949
3949
  let result = '';
3950
- for (${U}) {
3950
+ for (${W}) {
3951
3951
  result += \`${V}\`;
3952
3952
  }
3953
3953
  return result;
3954
- `)(...O);Q=Q.substring(0,K)+A+Q.substring(j),J=!0}catch(H){let L=t("For",`Error in @for(${U}): ${H instanceof Error?H.message:String(H)}`,n.EVALUATION_ERROR);Q=Q.substring(0,K)+L+Q.substring(j),J=!0}}return Q}function VW($){let Z=$.trim(),Y=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Y){let J=Y[1];return J.slice(1,-1).split(",").map((K)=>{let q=K.trim();if(!q)return"";let W=q.indexOf(":");if(W>=0&&J.startsWith("{")){let B=q.slice(W+1).trim(),_=B.indexOf("=");return(_>=0?B.slice(0,_):B).trim()}let U=q.indexOf("="),z=(U>=0?q.slice(0,U):q).trim();return/^[A-Za-z_$][\w$]*$/.test(z)?z:""}).filter(Boolean)}let X=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(X)return[X[1]];let Q=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(Q)return[Q[1]];return[]}function RW($){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",`
3954
+ `)(...O);Q=Q.substring(0,K)+N+Q.substring(j),J=!0}catch(H){let L=t("For",`Error in @for(${W}): ${H instanceof Error?H.message:String(H)}`,n.EVALUATION_ERROR);Q=Q.substring(0,K)+L+Q.substring(j),J=!0}}return Q}function wW($){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 U=q.indexOf(":");if(U>=0&&J.startsWith("{")){let B=q.slice(U+1).trim(),_=B.indexOf("=");return(_>=0?B.slice(0,_):B).trim()}let W=q.indexOf("="),z=(W>=0?q.slice(0,W):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 TW($){let{forExpr:Z,content:Y,iterVarNames:X,context:Q,filePath:J,options:G}=$,K=Object.keys(Q),q=Object.values(Q),U=Function(...K,"__pushIter",`
3955
3955
  for (${Z}) {
3956
3956
  __pushIter([${X.join(", ")}])
3957
3957
  }
3958
- `),U=[];W(...q,(_)=>{U.push(_)});let z=J??"inline.stx",B="";for(let _ of U){let j={...Q};X.forEach((L,F)=>{j[L]=_[F]});let H=nY(Y,j,J,G);H=k1(H,j,z),H=p0(H,j,z),B+=H}return B}function AW($,Z,Y){let X=$,Q=!0;while(Q){Q=!1;let J=X.match(/@while\s*\(/);if(!J||J.index===void 0)break;let G=J.index,K=G+J[0].length-1,q=D0(X,"(",")",K);if(q===-1)break;let W=X.slice(K+1,q),U=r4(X.slice(G),"while","endwhile");if(U.length===0)break;let z=U[0].content,B=G+U[0].end;if(!iY(W)){let _=t("While",`Unsafe expression in @while: ${W}`,n.UNSAFE_EXPRESSION);X=X.substring(0,G)+_+X.substring(B),Q=!0;continue}try{let _=Object.keys(Z),j=Object.values(Z),H=z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,V)=>{return`\${${V}}`});H=cY(H);let F=Function(..._,`
3958
+ `),W=[];U(...q,(_)=>{W.push(_)});let z=J??"inline.stx",B="";for(let _ of W){let j={...Q};X.forEach((L,F)=>{j[L]=_[F]});let H=o2(Y,j,J,G);H=k1(H,j,z),H=p0(H,j,z),B+=H}return B}function MW($,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=I0(X,"(",")",K);if(q===-1)break;let U=X.slice(K+1,q),W=r4(X.slice(G),"while","endwhile");if(W.length===0)break;let z=W[0].content,B=G+W[0].end;if(!n2(U)){let _=t("While",`Unsafe expression in @while: ${U}`,n.UNSAFE_EXPRESSION);X=X.substring(0,G)+_+X.substring(B),Q=!0;continue}try{let _=Object.keys(Z),j=Object.values(Z),H=z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,V)=>{return`\${${V}}`});H=i2(H);let F=Function(..._,`
3959
3959
  let result = '';
3960
3960
  let maxIterations = ${Y}; // Configurable safety limit
3961
3961
  let counter = 0;
3962
- while (${W} && counter < maxIterations) {
3962
+ while (${U} && counter < maxIterations) {
3963
3963
  counter++;
3964
3964
  result += \`${H}\`;
3965
3965
  }
@@ -3967,8 +3967,8 @@ ${E}
3967
3967
  result += '<!-- [While Error [1104]]: Maximum iterations (${Y}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
3968
3968
  }
3969
3969
  return result;
3970
- `)(...j);X=X.substring(0,G)+F+X.substring(B),Q=!0}catch(_){let j=t("While",`Error in @while(${W}): ${_ instanceof Error?_.message:String(_)}`,n.EVALUATION_ERROR);X=X.substring(0,G)+j+X.substring(B),Q=!0}}return X}var BW=1000,_W=!1,W$="<!--__STX_BREAK__-->",z$="<!--__STX_CONTINUE__-->";var i3=b(()=>{t4();t0();c0();a4();L0()});import U0 from"path";function n3($,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 NW($,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 wW($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function TW($){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]!==`
3971
- `)J++;return!0}if(Z[J]==="/"&&Z[J+1]==="*"){J+=2;while(J<G-1&&!(Z[J]==="*"&&Z[J+1]==="/"))J++;return J+=2,!0}return!1},U=()=>{if(Q!==0)return;let z=Z.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let j=z[2];if(!X.has(j))Y.push(j),X.add(j);return}let B=Z.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!X.has(j))Y.push(j),X.add(j);return}let _=Z.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let j=_[1];if(!X.has(j))Y.push(j),X.add(j)}};while(J<G){if(W())continue;if(Z[J]==="'"||Z[J]==='"'){K(Z[J]);continue}if(Z[J]==="`"){q();continue}if(Z[J]==="{"){Q++,J++;continue}if(Z[J]==="}"){Q--,J++;continue}if(Q===0&&/[a-z]/i.test(Z[J])&&(J===0||/\s|[;{}()]/.test(Z[J-1])))U();J++}return Y.join(", ")}function rY($,Z=""){return`
3970
+ `)(...j);X=X.substring(0,G)+F+X.substring(B),Q=!0}catch(_){let j=t("While",`Error in @while(${U}): ${_ instanceof Error?_.message:String(_)}`,n.EVALUATION_ERROR);X=X.substring(0,G)+j+X.substring(B),Q=!0}}return X}var OW=1000,LW=!1,W$="<!--__STX_BREAK__-->",z$="<!--__STX_CONTINUE__-->";var n3=b(()=>{t4();e0();c0();a4();L0()});import U0 from"path";function o3($,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 IW($,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,U=K+1;while(U<X.length&&q>0){if(X[U]==="(")q++;else if(X[U]===")")q--;U++}if(q!==0)break;let W=X.substring(K+1,U-1),z=`${Y}(${W})`;X=X.substring(0,G)+z+X.substring(U),Q.lastIndex=G+z.length,J=Q.exec(X)}return X}function DW($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function EW($){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++}},U=()=>{if(Z[J]==="/"&&Z[J+1]==="/"){while(J<G&&Z[J]!==`
3971
+ `)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},W=()=>{if(Q!==0)return;let z=Z.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let j=z[2];if(!X.has(j))Y.push(j),X.add(j);return}let B=Z.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!X.has(j))Y.push(j),X.add(j);return}let _=Z.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let j=_[1];if(!X.has(j))Y.push(j),X.add(j)}};while(J<G){if(U())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])))W();J++}return Y.join(", ")}function a2($,Z=""){return`
3972
3972
  (function() {
3973
3973
  var { state, derived, effect, batch, onMount, onDestroy, defineStore, useStore, useFetch, useRef, useQuery, useMutation, useOptimistic, useDebounce, useDebouncedValue, useThrottle, useInterval, useTimeout, useToggle, useCounter, useClickOutside, useFocus, useAsync, useLocalStorage, useSessionStorage, useCookie, useReactiveProp, useEventListener, useWebSocket, useColorMode, useDark, useHead, useSeoMeta, definePageMeta, useRoute, useSearchParams, navigate, goBack, goForward, provide, ref, reactive, computed, watch, watchEffect, defineProps, withDefaults, defineEmits, defineExpose, defineSlots } = window.stx;
3974
3974
  var __destroyHooks = [];
@@ -3977,11 +3977,11 @@ ${E}
3977
3977
 
3978
3978
  ${$}
3979
3979
  ${Z}})();
3980
- `}function MW($,Z){let J=`
3980
+ `}function t2($,Z){return`
3981
3981
  // Register scope variables for STX runtime
3982
3982
  if (!window.stx._scopes) window.stx._scopes = {};
3983
3983
  var __scopeRegistration = { __destroyCallbacks: __destroyHooks };
3984
- ${TW($).split(",").map((q)=>q.trim()).filter(Boolean).map((q)=>` try { __scopeRegistration[${JSON.stringify(q)}] = ${q}; } catch (e) { /* not actually top-level */ }`).join(`
3984
+ ${EW($).split(",").map((J)=>J.trim()).filter(Boolean).map((J)=>` try { __scopeRegistration[${JSON.stringify(J)}] = ${J}; } catch (e) { /* not actually top-level */ }`).join(`
3985
3985
  `)}
3986
3986
  // #1767: when the bundler renamed a component const that collided with an
3987
3987
  // inlined import (foo -> foo2), rebind the ORIGINAL template name to the
@@ -3989,45 +3989,42 @@ ${TW($).split(",").map((q)=>q.trim()).filter(Boolean).map((q)=>` try { __scopeR
3989
3989
  // shadowing import. __stxScopeRenames is emitted by bundleClientScript.
3990
3990
  try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
3991
3991
  window.stx._scopes['${Z}'] = __scopeRegistration;
3992
- `,G=`
3992
+ `}function kW($,Z){let Y=t2($,Z),X=`
3993
3993
  (function() {
3994
3994
  var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${Z}"]') : null;
3995
3995
  var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
3996
3996
  if (__stxScopeEl && typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxScopeEl;
3997
- try {`,K=`
3997
+ try {`,Q=`
3998
3998
  } finally {
3999
3999
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
4000
4000
  }
4001
- })();`;return G+rY($,J)+`
4001
+ })();`;return X+a2($,Y)+`
4002
4002
  } finally {
4003
4003
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
4004
4004
  }
4005
- })();`}function IW($,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 EW($){if($.__onceStore instanceof Set)return $.__onceStore;return DW}async function o3($,Z,Y,X,Q,J=new Set){let G=X.partialsDir||U0.join(U0.dirname(Y),"partials");if(G&&!U0.isAbsolute(G))G=U0.resolve(process.cwd(),G);let K=NW($,"@partial","@include"),q=EW(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(j,H,L)=>{let F=H.trim(),O=`${Y}:${F}`;if(q.has(O))return"";return q.add(O),H});{let j=/@includeIf\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")")O--;V++}if(O!==0)break;let R=K.substring(F+1,V-1),A=R.match(/^\s*['"]([^'"]+)['"]/);if(!A){j.lastIndex=V;continue}let N=A[1],w=W(N,G,Y),T="";if(w&&await Bun.file(w).exists())Q.add(w),T=`@include(${R})`;K=K.substring(0,L)+T+K.substring(V),j.lastIndex=0}}for(let[j,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=L.exec(K))!==null){let O=F.index,V=O+F[0].length-1,R=1,A=V+1;while(A<K.length&&R>0){if(K[A]==="(")R++;else if(K[A]===")")R--;A++}if(R!==0)break;let N=K.substring(V+1,A-1),w=n3(N,0);if(w===-1){L.lastIndex=A;continue}let T=N.substring(0,w).trim(),M=N.substring(w+1).trim(),I=M.match(/^\s*['"]([^'"]+)['"]/);if(!I){L.lastIndex=A;continue}let D=I[1],E=M.substring(I[0].length),C,S=n3(E,0);if(S!==-1)C=E.substring(S+1).trim();try{let k=`Boolean(${T})`,P;if(X0(k)){let m=J0(k,Object.keys(Z));P=Boolean(m(...Object.values(Z)))}else P=Boolean($0(k,Z));let d=H?!P:P,g="";if(d){let m=W(D,G,Y);if(m&&await Bun.file(m).exists())Q.add(m);g=`@include('${D}'${C?`, ${C}`:""})`}K=K.substring(0,O)+g+K.substring(A),L.lastIndex=0}catch(k){let P=k instanceof Error?k.message:String(k),d=G0("Include",`Error evaluating ${j} condition: ${P}`,Y,$,O);K=K.substring(0,O)+d+K.substring(A),L.lastIndex=0}}}{let j=/@each\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let R=K.substring(F+1,V),A=K.substring(L,V+1),N=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){j.lastIndex=0,K=K.replace(A,"");continue}let[,w,T,M,I]=N;try{let D,E=T.trim();if(X0(E))D=J0(E,Object.keys(Z))(...Object.values(Z));else D=$0(E,Z);let C="";if(Array.isArray(D)&&D.length>0)for(let S of D){let k={...Z,[M]:S},P=await z(w,k,$,L);C+=P}else if(I)C=await z(I,{},$,L);K=K.substring(0,L)+C+K.substring(V+1),j.lastIndex=0}catch(D){let E=D instanceof Error?D.message:String(D);K=K.substring(0,L)+G0("Each",`Error in @each: ${E}`,Y,$,L)+K.substring(V+1),j.lastIndex=0}}}{let j=/@includeFirst\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let R=K.substring(F+1,V),A=K.substring(L,V+1),N=R.match(/^\s*(\[[^\]]+\])/);if(!N){j.lastIndex=0,K=K.replace(A,"");continue}let w=N[1],T=R.slice(N[0].length),M,I=T.match(/^\s*,\s*\{/);if(I){T=T.slice(I[0].length-1);let C=1,S=1;while(S<T.length&&C>0){if(T[S]==="{")C++;else if(T[S]==="}"){if(C--,C===0)break}S++}M=T.substring(0,S+1),T=T.slice(S+1)}let D,E=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(E)D=E[1];try{let C=JSON.parse(w.replace(/'/g,'"')),S={};if(M)try{S=O0(M,Z)}catch(P){let d=P instanceof Error?P.message:String(P);if(X.debug){let g=G0("Include",`Error parsing includeFirst variables: ${d}`,Y,$,L,A);K=K.replace(A,()=>g)}else K=K.replace(A,()=>D||"");continue}let k=!1;for(let P of C){let d=W(P,G,Y);if(!d)continue;if(await i(d)){let g=await z(P,S,$,L);K=K.replace(A,()=>g),k=!0;break}}if(!k)if(D!==void 0)K=K.replace(A,()=>D);else if(X.debug){let P=G0("Include",`None of the includeFirst paths exist: ${w}`,Y,$,L,A);K=K.replace(A,()=>P)}else K=K.replace(A,"")}catch(C){let S=C instanceof Error?C.message:String(C),k=G0("Include",`Error processing @includeFirst: ${S}`,Y,$,L,A);K=K.replace(A,()=>k)}j.lastIndex=0}}function W(j,H,L){try{let F=j;if(!j.endsWith(".stx"))F=`${j}.stx`;let O=U0.resolve(H),V=U0.resolve(U0.dirname(L)),R;if(!F.startsWith("./")&&!F.startsWith("../"))R=U0.resolve(H,F);else R=U0.resolve(V,F);let A=U0.normalize(R),N=A.startsWith(O+U0.sep)||A===O,w=A.startsWith(V+U0.sep)||A===V,T=!1,M=U0.dirname(V);if(A.startsWith(M+U0.sep)){if(!U0.relative(M,A).split(U0.sep).some((C)=>C.startsWith(".")&&C!=="."&&C!==".."))T=!0}if(!N&&!w&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${j}`),console.error(` Resolved to: ${A}`),console.error(` Allowed dirs: ${O}, ${V}`),null;return A}catch(F){return console.error(`Error resolving path ${j}: ${F}`),null}}let U=U0.resolve(Y);J.add(U);async function z(j,H={},L,F){let O=W(j,G,Y);if(!O)return G0("Include",`Could not resolve path for include: ${j}`,Y,L,F);let V=U0.resolve(O);if(J.has(V)){let R=[...J,V].map((A)=>U0.basename(A)).join(" -> ");return G0("Include",`Circular include detected: ${R}`,Y,L,F)}try{Q.add(O);let R;if(!R)try{R=await Bun.file(O).text()}catch(g){let m=g instanceof Error?g.message:String(g);return G0("Include",`Error loading include file ${j}: ${m}`,Y,L,F)}if(R&&R.includes("@stream")){let{processStreamDirectives:g}=await Promise.resolve().then(() => (H3(),j3));R=g(R,Z)}if(R&&(X.debug||!D5()&&!g4()))try{let{warnUnbalancedTags:g}=await Promise.resolve().then(() => (L3(),FY));g(R,O)}catch{}let A=R;try{let{processESImports:g}=await Promise.resolve().then(() => (p3(),mY));await g(R,Z,O,X,Q)}catch(g){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${O}:`,g instanceof Error?g.message:g)}let N=A.match(/<template\b(?![^>]*(?:\b(?:id|x-for|x-if|x-else|@for|@if|@else|:for|:if|:else)\s*=|\s#[\w-]|\bv-slot|\bslot\s*=))[^>]*>([\s\S]*?)<\/template>/i);if(N)A=N[1].trim();let T=R.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[g,m]of Object.entries(H))I[g]=m;let D=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,E=[...R.matchAll(D)],C="",S=null;for(let g of E){let m=g[1]||"",s=g[2]||"",Z0=m.includes("server"),o0=L1(m),P0="";try{let{extractAndStripCssImports:e,renderVendorStyleTags:M0}=await Promise.resolve().then(() => (O5(),U9)),C0=e(s,{filePath:O,projectRoot:process.cwd()});s=C0.code,P0=M0(C0.styles)}catch(e){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${O}:`,e instanceof Error?e.message:e)}if(o0&&s.trim())s=F1(s);if(!Z0)try{let{hasUserImports:e,bundleClientScript:M0}=await Promise.resolve().then(() => (Z4(),$4));if(e(s))s=await M0(s,O,{projectRoot:process.cwd()})}catch(e){if(X.debug)console.warn(`[stx] bundler skipped for ${O}:`,e instanceof Error?e.message:e)}let T0=wW(s);if(T0&&!Z0){S=`stx_scope_${U0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++sY}`;let e=a0(s),M0=MW(e,S);C+=`${P0}<script data-stx-scoped>${M0}</script>
4006
- `;continue}if(Z0)try{let{extractVariables:e}=await Promise.resolve().then(() => (T5(),z4));await e(s,I,O)}catch(e){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,e)}if(!Z0&&!T0){let e=m.replace(/\bclient\b/i,"").trim();S=`stx_scope_${U0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++sY}`;let M0=a0(s),C0=`
4007
- if (!window.stx._scopes) window.stx._scopes = {};
4008
- window.stx._scopes['${S}'] = { __destroyCallbacks: __destroyHooks };
4009
- `,v=rY(M0,C0);C+=`${P0}<script data-stx-scoped${e?` ${e}`:""}>${v}</script>
4010
- `}}if(S){let g=IW(A,S);if(A=g.html,g.mergedIntoExisting)C=C.replace(`window.stx._scopes['${S}']`,`window.stx._scopes['${g.mergedIntoExisting}']`),S=g.mergedIntoExisting}if(A.includes("@include")||A.includes("@partial"))A=await o3(A,I,O,X,Q,J);let{processLoops:k}=await Promise.resolve().then(() => (i3(),oY)),P=k(A,I,O);P=k1(P,I,O);let d=d1(R);if(P=p0(P,I,O,{forceSignals:d}),M)P+=`
4011
- `+M;if(C)P+=`
4012
- `+C;return P}catch(R){let A=R instanceof Error?R.message:String(R);return G0("Include",`Error processing include ${j}: ${A}`,Y,L,F)}}let B=/@include\s*\(/g,_;while((_=B.exec(K))!==null){let j=_.index,H=j+_[0].length-1,L=1,F=H+1;while(F<K.length&&L>0){if(K[F]==="(")L++;else if(K[F]===")")L--;F++}if(L!==0)break;let O=K.substring(j,F),V=K.substring(H+1,F-1),R=V.match(/^\s*['"]([^'"]+)['"]/);if(!R){B.lastIndex=F;continue}let A=R[1],N,w=V.substring(R[0].length),T=n3(w,0);if(T!==-1)N=w.substring(T+1).trim();let M={};if(N)try{M=O0(N,Z)}catch(D){let E=D instanceof Error?D.message:String(D);K=K.replace(O,G0("Include",`Error parsing include variables for ${A}: ${E}`,Y,$,j)),B.lastIndex=0;continue}let I=await z(A,M,$,j);K=K.substring(0,j)+I+K.substring(F),B.lastIndex=0}return K}function s3($,Z){let Y=$;function X(Q,J,G,K){let q=Q,W=!0;while(W){W=!1;let U=new RegExp(`@${J}\\(['"]([^'"]+)['"]\\)`),z=q.match(U);if(!z||z.index===void 0)break;let B=z.index,_=z[1],j=B+z[0].length,H=new RegExp(`@${J}\\(`),L=new RegExp(`@${G}(?![a-z])`),F=1,O=j,V=-1;while(F>0&&O<q.length){let A=q.slice(O),N=A.match(H),w=A.match(L),T=N?O+N.index:1/0,M=w?O+w.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 R=q.slice(j,V);if(!Z[_])Z[_]=[];if(K)Z[_].unshift(R);else Z[_].push(R);q=q.substring(0,B)+q.substring(V+`@${G}`.length),W=!0}return q}return Y=X(Y,"push","endpush",!1),Y=X(Y,"prepend","endprepend",!0),Y}function r3($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
4013
- `)})}var sY=0,RV,DW;var aY=b(()=>{t4();c0();l1();L0();H0();RV=new R5(500),DW=new Set});import*as a3 from"path";async function tY($,Z,Y=""){if(a3.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 $2($,Z,Y,"@js","@endjs")}async function eY($,Z,Y=""){if(a3.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 $2($,Z,Y,"@ts","@endts")}async function $2($,Z,Y,X,Q){let J=$,G=u1(`${X}([\\s\\S]*?)${Q}`,"g"),K=[],q;while((q=G.exec($))!==null)K.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:W,content:U,index:z}of K)try{let B=Object.keys(Z),_=Object.values(Z),j=U.trim();if(X==="@ts")j=j.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let L=(j.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((A)=>A.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=L.length>0?`return { ${L.join(", ")} };`:"return {};",O=`
4005
+ })();`}function bW($,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 yW($){if($.__onceStore instanceof Set)return $.__onceStore;return SW}async function s3($,Z,Y,X,Q,J=new Set){let G=X.partialsDir||U0.join(U0.dirname(Y),"partials");if(G&&!U0.isAbsolute(G))G=U0.resolve(process.cwd(),G);let K=IW($,"@partial","@include"),q=yW(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(j,H,L)=>{let F=H.trim(),O=`${Y}:${F}`;if(q.has(O))return"";return q.add(O),H});{let j=/@includeIf\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")")O--;V++}if(O!==0)break;let R=K.substring(F+1,V-1),N=R.match(/^\s*['"]([^'"]+)['"]/);if(!N){j.lastIndex=V;continue}let A=N[1],w=U(A,G,Y),T="";if(w&&await Bun.file(w).exists())Q.add(w),T=`@include(${R})`;K=K.substring(0,L)+T+K.substring(V),j.lastIndex=0}}for(let[j,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=L.exec(K))!==null){let O=F.index,V=O+F[0].length-1,R=1,N=V+1;while(N<K.length&&R>0){if(K[N]==="(")R++;else if(K[N]===")")R--;N++}if(R!==0)break;let A=K.substring(V+1,N-1),w=o3(A,0);if(w===-1){L.lastIndex=N;continue}let T=A.substring(0,w).trim(),M=A.substring(w+1).trim(),I=M.match(/^\s*['"]([^'"]+)['"]/);if(!I){L.lastIndex=N;continue}let D=I[1],E=M.substring(I[0].length),C,S=o3(E,0);if(S!==-1)C=E.substring(S+1).trim();try{let k=`Boolean(${T})`,y;if(X0(k)){let m=J0(k,Object.keys(Z));y=Boolean(m(...Object.values(Z)))}else y=Boolean($0(k,Z));let d=H?!y:y,g="";if(d){let m=U(D,G,Y);if(m&&await Bun.file(m).exists())Q.add(m);g=`@include('${D}'${C?`, ${C}`:""})`}K=K.substring(0,O)+g+K.substring(N),L.lastIndex=0}catch(k){let y=k instanceof Error?k.message:String(k),d=G0("Include",`Error evaluating ${j} condition: ${y}`,Y,$,O);K=K.substring(0,O)+d+K.substring(N),L.lastIndex=0}}}{let j=/@each\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let R=K.substring(F+1,V),N=K.substring(L,V+1),A=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!A){j.lastIndex=0,K=K.replace(N,"");continue}let[,w,T,M,I]=A;try{let D,E=T.trim();if(X0(E))D=J0(E,Object.keys(Z))(...Object.values(Z));else D=$0(E,Z);let C="";if(Array.isArray(D)&&D.length>0)for(let S of D){let k={...Z,[M]:S},y=await z(w,k,$,L);C+=y}else if(I)C=await z(I,{},$,L);K=K.substring(0,L)+C+K.substring(V+1),j.lastIndex=0}catch(D){let E=D instanceof Error?D.message:String(D);K=K.substring(0,L)+G0("Each",`Error in @each: ${E}`,Y,$,L)+K.substring(V+1),j.lastIndex=0}}}{let j=/@includeFirst\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let R=K.substring(F+1,V),N=K.substring(L,V+1),A=R.match(/^\s*(\[[^\]]+\])/);if(!A){j.lastIndex=0,K=K.replace(N,"");continue}let w=A[1],T=R.slice(A[0].length),M,I=T.match(/^\s*,\s*\{/);if(I){T=T.slice(I[0].length-1);let C=1,S=1;while(S<T.length&&C>0){if(T[S]==="{")C++;else if(T[S]==="}"){if(C--,C===0)break}S++}M=T.substring(0,S+1),T=T.slice(S+1)}let D,E=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(E)D=E[1];try{let C=JSON.parse(w.replace(/'/g,'"')),S={};if(M)try{S=O0(M,Z)}catch(y){let d=y instanceof Error?y.message:String(y);if(X.debug){let g=G0("Include",`Error parsing includeFirst variables: ${d}`,Y,$,L,N);K=K.replace(N,()=>g)}else K=K.replace(N,()=>D||"");continue}let k=!1;for(let y of C){let d=U(y,G,Y);if(!d)continue;if(await i(d)){let g=await z(y,S,$,L);K=K.replace(N,()=>g),k=!0;break}}if(!k)if(D!==void 0)K=K.replace(N,()=>D);else if(X.debug){let y=G0("Include",`None of the includeFirst paths exist: ${w}`,Y,$,L,N);K=K.replace(N,()=>y)}else K=K.replace(N,"")}catch(C){let S=C instanceof Error?C.message:String(C),k=G0("Include",`Error processing @includeFirst: ${S}`,Y,$,L,N);K=K.replace(N,()=>k)}j.lastIndex=0}}function U(j,H,L){try{let F=j;if(!j.endsWith(".stx"))F=`${j}.stx`;let O=U0.resolve(H),V=U0.resolve(U0.dirname(L)),R;if(!F.startsWith("./")&&!F.startsWith("../"))R=U0.resolve(H,F);else R=U0.resolve(V,F);let N=U0.normalize(R),A=N.startsWith(O+U0.sep)||N===O,w=N.startsWith(V+U0.sep)||N===V,T=!1,M=U0.dirname(V);if(N.startsWith(M+U0.sep)){if(!U0.relative(M,N).split(U0.sep).some((C)=>C.startsWith(".")&&C!=="."&&C!==".."))T=!0}if(!A&&!w&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${j}`),console.error(` Resolved to: ${N}`),console.error(` Allowed dirs: ${O}, ${V}`),null;return N}catch(F){return console.error(`Error resolving path ${j}: ${F}`),null}}let W=U0.resolve(Y);J.add(W);async function z(j,H={},L,F){let O=U(j,G,Y);if(!O)return G0("Include",`Could not resolve path for include: ${j}`,Y,L,F);let V=U0.resolve(O);if(J.has(V)){let R=[...J,V].map((N)=>U0.basename(N)).join(" -> ");return G0("Include",`Circular include detected: ${R}`,Y,L,F)}try{Q.add(O);let R;if(!R)try{R=await Bun.file(O).text()}catch(g){let m=g instanceof Error?g.message:String(g);return G0("Include",`Error loading include file ${j}: ${m}`,Y,L,F)}if(R&&R.includes("@stream")){let{processStreamDirectives:g}=await Promise.resolve().then(() => (O3(),H3));R=g(R,Z)}if(R&&(X.debug||!k5()&&!g4()))try{let{warnUnbalancedTags:g}=await Promise.resolve().then(() => (F3(),V2));g(R,O)}catch{}let N=R;try{let{processESImports:g}=await Promise.resolve().then(() => (c3(),u2));await g(R,Z,O,X,Q)}catch(g){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${O}:`,g instanceof Error?g.message:g)}let A=N.match(/<template\b(?![^>]*(?:\b(?:id|x-for|x-if|x-else|@for|@if|@else|:for|:if|:else)\s*=|\s#[\w-]|\bv-slot|\bslot\s*=))[^>]*>([\s\S]*?)<\/template>/i);if(A)N=A[1].trim();let T=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(T)M=`<style${T[1]}>${T[2]}</style>`;N=N.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),N=N.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};for(let[g,m]of Object.entries(H))I[g]=m;let D=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,E=[...R.matchAll(D)],C="",S=null;for(let g of E){let m=g[1]||"",s=g[2]||"",Z0=m.includes("server"),o0=L1(m),P0="";try{let{extractAndStripCssImports:e,renderVendorStyleTags:N0}=await Promise.resolve().then(() => (F5(),W9)),C0=e(s,{filePath:O,projectRoot:process.cwd()});s=C0.code,P0=N0(C0.styles)}catch(e){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${O}:`,e instanceof Error?e.message:e)}if(o0&&s.trim())s=F1(s);if(!Z0)try{let{hasUserImports:e,bundleClientScript:N0}=await Promise.resolve().then(() => (Z4(),$4));if(e(s))s=await N0(s,O,{projectRoot:process.cwd()})}catch(e){if(X.debug)console.warn(`[stx] bundler skipped for ${O}:`,e instanceof Error?e.message:e)}let M0=DW(s);if(M0&&!Z0){S=`stx_scope_${U0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++r2}`;let e=t0(s),N0=kW(e,S);C+=`${P0}<script data-stx-scoped>${N0}</script>
4006
+ `;continue}if(Z0)try{let{extractVariables:e}=await Promise.resolve().then(() => (I5(),z4));await e(s,I,O)}catch(e){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,e)}if(!Z0&&!M0){let e=m.replace(/\bclient\b/i,"").trim();S=`stx_scope_${U0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++r2}`;let N0=t0(s),C0=t2(N0,S),v=a2(N0,C0);C+=`${P0}<script data-stx-scoped${e?` ${e}`:""}>${v}</script>
4007
+ `}}if(S){let g=bW(N,S);if(N=g.html,g.mergedIntoExisting)C=C.replace(`window.stx._scopes['${S}']`,`window.stx._scopes['${g.mergedIntoExisting}']`),S=g.mergedIntoExisting}if(N.includes("@include")||N.includes("@partial"))N=await s3(N,I,O,X,Q,J);let{processLoops:k}=await Promise.resolve().then(() => (n3(),s2)),y=k(N,I,O);y=k1(y,I,O);let d=d1(R);if(y=p0(y,I,O,{forceSignals:d}),M)y+=`
4008
+ `+M;if(C)y+=`
4009
+ `+C;return y}catch(R){let N=R instanceof Error?R.message:String(R);return G0("Include",`Error processing include ${j}: ${N}`,Y,L,F)}}let B=/@include\s*\(/g,_;while((_=B.exec(K))!==null){let j=_.index,H=j+_[0].length-1,L=1,F=H+1;while(F<K.length&&L>0){if(K[F]==="(")L++;else if(K[F]===")")L--;F++}if(L!==0)break;let O=K.substring(j,F),V=K.substring(H+1,F-1),R=V.match(/^\s*['"]([^'"]+)['"]/);if(!R){B.lastIndex=F;continue}let N=R[1],A,w=V.substring(R[0].length),T=o3(w,0);if(T!==-1)A=w.substring(T+1).trim();let M={};if(A)try{M=O0(A,Z)}catch(D){let E=D instanceof Error?D.message:String(D);K=K.replace(O,G0("Include",`Error parsing include variables for ${N}: ${E}`,Y,$,j)),B.lastIndex=0;continue}let I=await z(N,M,$,j);K=K.substring(0,j)+I+K.substring(F),B.lastIndex=0}return K}function r3($,Z){let Y=$;function X(Q,J,G,K){let q=Q,U=!0;while(U){U=!1;let W=new RegExp(`@${J}\\(['"]([^'"]+)['"]\\)`),z=q.match(W);if(!z||z.index===void 0)break;let B=z.index,_=z[1],j=B+z[0].length,H=new RegExp(`@${J}\\(`),L=new RegExp(`@${G}(?![a-z])`),F=1,O=j,V=-1;while(F>0&&O<q.length){let N=q.slice(O),A=N.match(H),w=N.match(L),T=A?O+A.index:1/0,M=w?O+w.index:1/0;if(T<M)F++,O=T+(A[0].length||1);else if(M<1/0){if(F--,F===0){V=M;break}O=M+G.length+1}else break}if(V===-1)break;let R=q.slice(j,V);if(!Z[_])Z[_]=[];if(K)Z[_].unshift(R);else Z[_].push(R);q=q.substring(0,B)+q.substring(V+`@${G}`.length),U=!0}return q}return Y=X(Y,"push","endpush",!1),Y=X(Y,"prepend","endprepend",!0),Y}function a3($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
4010
+ `)})}var r2=0,TV,SW;var e2=b(()=>{t4();c0();l1();L0();H0();TV=new A5(500),SW=new Set});import*as t3 from"path";async function $Y($,Z,Y=""){if(t3.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 YY($,Z,Y,"@js","@endjs")}async function ZY($,Z,Y=""){if(t3.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 YY($,Z,Y,"@ts","@endts")}async function YY($,Z,Y,X,Q){let J=$,G=u1(`${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:U,content:W,index:z}of K)try{let B=Object.keys(Z),_=Object.values(Z),j=W.trim();if(X==="@ts")j=j.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let L=(j.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((N)=>N.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=L.length>0?`return { ${L.join(", ")} };`:"return {};",O=`
4014
4011
  ${j}
4015
4012
  ${F}
4016
- `,R=Function(...B,O)(..._);if(R&&typeof R==="object")Object.assign(Z,R);J=J.replace(W,"")}catch(B){console.error(`Error executing ${X} code block in ${Y}:`,B);let _=B instanceof Error?B.message:String(B),j=G0(`${X} Directive`,`Error executing code: ${_}`,Y,$,z,W);console.error(j),J=J.replace(W,"")}return J}var Z2=b(()=>{l1();H0()});function kW($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function Y2($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,X,Q,J)=>{return kW(X,J||"_method")})}async function X2($,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=G0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Y,$);J=J.replace(/<body[^>]*>/,`$&
4017
- <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${h0(W)}</div>
4018
- `)}}}return J}async function J2($,Z,Y,X){return X2($,Z,Y,X,"before")}async function Q2($,Z,Y,X){return X2($,Z,Y,X,"after")}var G2=b(()=>{c0();H0()});import{defineRoute as PV,defineRoutes as CV,resetRoutes as vV,route as xV,setAppUrl as fV}from"stx-router";import{route as bW}from"stx-router";function K2($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,X,Q,J)=>{try{let G=Q?O0(Q,{}):{};return bW(X,G,J==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var q2=b(()=>{L0()});async function U2($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(h5.exact[$])for(let X of h5.exact[$])await Promise.resolve(X(Z,$));if(h5.exact[Y])for(let X of h5.exact[Y])await Promise.resolve(X(Z,$));for(let{pattern:X,callback:Q}of h5.patterns)if(X.test($)||X.test(Y))await Promise.resolve(Q(Z,$))}var h5;var W2=b(()=>{h5={patterns:[],exact:{}}});function z2($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>z2(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function B2($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Q=[],J;while((J=X.exec($))!==null)Q.push([J.index,J.index+J[0].length]);function G(W){return Q.some(([U,z])=>W>=U&&W<z)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((J=K.exec(Y))!==null){if(G(J.index))continue;let W=J[0],U=J[2];if(!U||!U.includes(":"))continue;let z=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,B,_=U,j=!1;while((B=z.exec(U))!==null){let H=B[1],L=B[2];if(L.includes("()")&&!L.includes(".get(")||L.includes("$store")||L.includes("$ref"))continue;try{let F=Object.keys(Z),O=Object.values(Z),V=L.match(/^([a-zA-Z_$][\w$]*)/);if(V&&!F.includes(V[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(V[1]))continue;let A=Function(...F,`return (${L})`)(...O);if(H==="class"){let N=z2(A);if(N){let w=_.match(/\sclass="([^"]*)"/);if(w)_=_.replace(w[0],` class="${w[1]} ${N}"`);else _=_.replace(B[0],` class="${N}"`)}else _=_.replace(B[0],"");j=!0;continue}if(SW.has(H)){if(A)_=_.replace(B[0],` ${H}`);else _=_.replace(B[0],"");j=!0;continue}if(A===null||A===void 0||A===!1)_=_.replace(B[0],"");else{let N=String(A).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");_=_.replace(B[0],` ${H}="${N}"`)}j=!0}catch{continue}}if(j){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:B}=q[W];Y=Y.slice(0,U)+B+Y.slice(z)}return Y}var SW;var _2=b(()=>{SW=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function S1($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let X=Y.exec($);if(!X)return null;return{full:X[0],tag:X[1],attrs:X[2],selfClosing:X[3].includes("/")||yW.has(X[1].toLowerCase()),start:X.index,end:X.index+X[0].length}}function CW($,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 i0($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=CW($,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 j2($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function e1($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return X?X[1]:null}function U1($,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 W1($,Z,Y){let X=Z.selfClosing?" /":"",Q=`<${Z.tag}${Y}${X}>`;return $.slice(0,Z.start)+Q+$.slice(Z.end)}function vW($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function xW($){let Z=$,Y=0;while(Y<Z.length){let X=S1(Z,Y);if(!X)break;let Q=e1(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=U1(X.attrs,"v-for"),U=U1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=i0(Z,X),B=Z.slice(z.outerStart,z.outerEnd),_=W1(B,{...X,start:0,end:X.end-X.start},U),j=`@foreach(${q})
4013
+ `,R=Function(...B,O)(..._);if(R&&typeof R==="object")Object.assign(Z,R);J=J.replace(U,"")}catch(B){console.error(`Error executing ${X} code block in ${Y}:`,B);let _=B instanceof Error?B.message:String(B),j=G0(`${X} Directive`,`Error executing code: ${_}`,Y,$,z,U);console.error(j),J=J.replace(U,"")}return J}var XY=b(()=>{l1();H0()});function PW($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function JY($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,X,Q,J)=>{return PW(X,J||"_method")})}async function QY($,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 U=G0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Y,$);J=J.replace(/<body[^>]*>/,`$&
4014
+ <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${h0(U)}</div>
4015
+ `)}}}return J}async function GY($,Z,Y,X){return QY($,Z,Y,X,"before")}async function KY($,Z,Y,X){return QY($,Z,Y,X,"after")}var qY=b(()=>{c0();H0()});import{defineRoute as fV,defineRoutes as gV,resetRoutes as hV,route as dV,setAppUrl as mV}from"stx-router";import{route as CW}from"stx-router";function UY($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,X,Q,J)=>{try{let G=Q?O0(Q,{}):{};return CW(X,G,J==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var WY=b(()=>{L0()});async function zY($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(m5.exact[$])for(let X of m5.exact[$])await Promise.resolve(X(Z,$));if(m5.exact[Y])for(let X of m5.exact[Y])await Promise.resolve(X(Z,$));for(let{pattern:X,callback:Q}of m5.patterns)if(X.test($)||X.test(Y))await Promise.resolve(Q(Z,$))}var m5;var BY=b(()=>{m5={patterns:[],exact:{}}});function _Y($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>_Y(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function jY($,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(U){return Q.some(([W,z])=>U>=W&&U<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 U=J[0],W=J[2];if(!W||!W.includes(":"))continue;let z=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,B,_=W,j=!1;while((B=z.exec(W))!==null){let H=B[1],L=B[2];if(L.includes("()")&&!L.includes(".get(")||L.includes("$store")||L.includes("$ref"))continue;try{let F=Object.keys(Z),O=Object.values(Z),V=L.match(/^([a-zA-Z_$][\w$]*)/);if(V&&!F.includes(V[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(V[1]))continue;let N=Function(...F,`return (${L})`)(...O);if(H==="class"){let A=_Y(N);if(A){let w=_.match(/\sclass="([^"]*)"/);if(w)_=_.replace(w[0],` class="${w[1]} ${A}"`);else _=_.replace(B[0],` class="${A}"`)}else _=_.replace(B[0],"");j=!0;continue}if(vW.has(H)){if(N)_=_.replace(B[0],` ${H}`);else _=_.replace(B[0],"");j=!0;continue}if(N===null||N===void 0||N===!1)_=_.replace(B[0],"");else{let A=String(N).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");_=_.replace(B[0],` ${H}="${A}"`)}j=!0}catch{continue}}if(j){let H=U.endsWith("/>")?" /":"",F=`<${J[1]}${_}${H}>`;q.push({start:J.index,end:J.index+U.length,replacement:F})}}for(let U=q.length-1;U>=0;U--){let{start:W,end:z,replacement:B}=q[U];Y=Y.slice(0,W)+B+Y.slice(z)}return Y}var vW;var HY=b(()=>{vW=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function S1($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let X=Y.exec($);if(!X)return null;return{full:X[0],tag:X[1],attrs:X[2],selfClosing:X[3].includes("/")||xW.has(X[1].toLowerCase()),start:X.index,end:X.index+X[0].length}}function gW($,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 i0($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=gW($,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 OY($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function e1($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return X?X[1]:null}function W1($,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 z1($,Z,Y){let X=Z.selfClosing?" /":"",Q=`<${Z.tag}${Y}${X}>`;return $.slice(0,Z.start)+Q+$.slice(Z.end)}function hW($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function dW($){let Z=$,Y=0;while(Y<Z.length){let X=S1(Z,Y);if(!X)break;let Q=e1(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 U=W1(X.attrs,"v-for"),W=W1(U,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=i0(Z,X),B=Z.slice(z.outerStart,z.outerEnd),_=z1(B,{...X,start:0,end:X.end-X.start},W),j=`@foreach(${q})
4019
4016
  `,H=`${j}${_}
4020
- @endforeach`;Z=Z.slice(0,z.outerStart)+H+Z.slice(z.outerEnd),Y=z.outerStart+j.length}return Z}function fW($){let Z=$,Y=0;while(Y<Z.length){let X=S1(Z,Y);if(!X)break;let Q=e1(X.attrs,"v-if");if(Q===null){Y=X.end;continue}let J=[],G=i0(Z,X),K=U1(X.attrs,"v-if"),q=W1(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=S1(Z,W+L);if(!F){U=!1;break}let O=e1(F.attrs,"v-else-if"),V=j2(F.attrs,"v-else");if(O!==null){let R=i0(Z,F),A=U1(F.attrs,"v-else-if"),N=W1(Z.slice(R.outerStart,R.outerEnd),{...F,start:0,end:F.end-F.start},A);J.push({type:"else-if",expr:O,outerStart:W,outerEnd:R.outerEnd,element:N,parsedTag:F}),W=R.outerEnd}else if(V){let R=i0(Z,F),A=U1(F.attrs,"v-else"),N=W1(Z.slice(R.outerStart,R.outerEnd),{...F,start:0,end:F.end-F.start},A);J.push({type:"else",outerStart:W,outerEnd:R.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})
4017
+ @endforeach`;Z=Z.slice(0,z.outerStart)+H+Z.slice(z.outerEnd),Y=z.outerStart+j.length}return Z}function mW($){let Z=$,Y=0;while(Y<Z.length){let X=S1(Z,Y);if(!X)break;let Q=e1(X.attrs,"v-if");if(Q===null){Y=X.end;continue}let J=[],G=i0(Z,X),K=W1(X.attrs,"v-if"),q=z1(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 U=G.outerEnd,W=!0;while(W){let H=Z.slice(U).match(/^\s*/),L=H?H[0].length:0,F=S1(Z,U+L);if(!F){W=!1;break}let O=e1(F.attrs,"v-else-if"),V=OY(F.attrs,"v-else");if(O!==null){let R=i0(Z,F),N=W1(F.attrs,"v-else-if"),A=z1(Z.slice(R.outerStart,R.outerEnd),{...F,start:0,end:F.end-F.start},N);J.push({type:"else-if",expr:O,outerStart:U,outerEnd:R.outerEnd,element:A,parsedTag:F}),U=R.outerEnd}else if(V){let R=i0(Z,F),N=W1(F.attrs,"v-else"),A=z1(Z.slice(R.outerStart,R.outerEnd),{...F,start:0,end:F.end-F.start},N);J.push({type:"else",outerStart:U,outerEnd:R.outerEnd,element:A,parsedTag:F}),W=!1}else W=!1}let z=[];for(let H of J)if(H.type==="if")z.push(`@if(${H.expr})
4021
4018
  ${H.element}`);else if(H.type==="else-if")z.push(`@elseif(${H.expr})
4022
4019
  ${H.element}`);else z.push(`@else
4023
4020
  ${H.element}`);z.push("@endif");let B=z.join(`
4024
- `),_=J[0].outerStart,j=J[J.length-1].outerEnd;Z=Z.slice(0,_)+B+Z.slice(j),Y=_+B.length}return Z}function gW($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function hW($){let Z=$,Y=0;while(Y<Z.length){let X=S1(Z,Y);if(!X)break;let Q=X.attrs,J=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=Q.match(G);while(K){J=!0;let U=K[1],z=K[2],B=K[3];Q=Q.replace(K[0],""),Q+=` :${U}="${B}" @update:${U}="${B} = $event"`,K=Q.match(G)}if(J){let U=i0(Z,X),z=Z.slice(U.outerStart,U.outerEnd),B=W1(z,{...X,start:0,end:X.end-X.start},Q);Z=Z.slice(0,U.outerStart)+B+Z.slice(U.outerEnd),Y=U.outerStart+B.length;continue}let q=e1(X.attrs,"v-model");if(q===null){Y=X.end;continue}if(PW.has(X.tag.toLowerCase())){let U=X.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,z=i0(Z,X),B=Z.slice(z.outerStart,z.outerEnd),_=W1(B,{...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=i0(Z,X),B=Z.slice(z.outerStart,z.outerEnd),_=W1(B,{...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 dW($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function mW($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function uW($){let Z=$,Y=0;while(Y<Z.length){let X=S1(Z,Y);if(!X)break;let Q=e1(X.attrs,"v-html");if(Q===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let J=i0(Z,X),G=U1(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 lW($){let Z=$,Y=0;while(Y<Z.length){let X=S1(Z,Y);if(!X)break;let Q=e1(X.attrs,"v-text");if(Q===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let J=i0(Z,X),G=U1(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 pW($){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 cW($){let Z=$,Y=0;while(Y<Z.length){let X=S1(Z,Y);if(!X)break;if(!j2(X.attrs,"v-once")){Y=X.end;continue}let Q=U1(X.attrs,"v-once"),J=i0(Z,X),G=Z.slice(J.outerStart,J.outerEnd),q=`@once
4025
- ${W1(G,{...X,start:0,end:X.end-X.start},Q)}
4026
- @endonce`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function iW($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function nW($){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 H2($){if(!vW($))return $;let Z=$;return Z=xW(Z),Z=fW(Z),Z=cW(Z),Z=dW(Z),Z=mW(Z),Z=hW(Z),Z=gW(Z),Z=nW(Z),Z=uW(Z),Z=lW(Z),Z=pW(Z),Z=iW(Z),Z}var yW,PW;var O2=b(()=>{yW=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),PW=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 B$($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}async function L2($,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 "${B$(U.expr)}" -->`;J=J.slice(0,U.index)+O+J.slice(U.index+U.full.length);continue}let B=U.attrs.trim(),_={},j=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=j.exec(B))!==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 N1(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 B=z instanceof Error?z.message:String(z),_=`<!-- dynamic component error: ${B$(B)} -->`;J=J.slice(0,U.index)+_+J.slice(U.index+U.full.length)}}return J=await oW(J,Z,Y,X,Q),J}async function oW($,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 j=`<!-- dynamic component: could not resolve "${B$(U.expr)}" -->`;J=J.slice(0,U.index)+j+J.slice(U.index+U.full.length);continue}let B=X.componentsDir||"components",_=await N1(z,{},"",B,Z,Y,X,new Set,Q??new Set);J=J.slice(0,U.index)+_+J.slice(U.index+U.full.length)}catch(z){let B=z instanceof Error?z.message:String(z),_=`<!-- dynamic component error: ${B$(B)} -->`;J=J.slice(0,U.index)+_+J.slice(U.index+U.full.length)}}return J}var F2=b(()=>{H0();L0()});function V2($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}<style data-stx-cloak>[x-cloak]{display:none !important}</style>
4027
- ${$.slice(Z)}`}function sW($,Z={},Y={}){let{title:X="stx App",lang:Q="en",meta:J=[],link:G=[],script:K=[],headRaw:q="",bodyClass:W="",bodyAttrs:U={}}=Z,z=Y.title||X,j=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...J].map((A)=>{return` <meta ${Object.entries(A).map(([w,T])=>`${w}="${T}"`).join(" ")}>`}).join(`
4028
- `),H=G.map((A)=>{return` <link ${Object.entries(A).map(([w,T])=>`${w}="${T}"`).join(" ")}>`}).join(`
4029
- `),L=K.map((A)=>{if(A.src)return` <script ${Object.entries(A).filter(([w])=>w!=="content").map(([w,T])=>`${w}="${T}"`).join(" ")}></script>`;if(A.content)return` <script>${A.content}</script>`;return""}).filter(Boolean).join(`
4030
- `),F=Object.entries(U).map(([A,N])=>` ${A}="${N}"`).join(""),O=W?` class="${W}"`:"",V=[j,` <title>${z}</title>`," <style data-stx-cloak>[x-cloak]{display:none !important}</style>",H,L,q?` ${q}`:"",...(Y.styles||[]).map((A)=>` ${A}`),...(Y.headScripts||[]).map((A)=>` ${A}`),Y.headStack||""].filter(Boolean),R=[$,...(Y.bodyScripts||[]).map((A)=>A),Y.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
4021
+ `),_=J[0].outerStart,j=J[J.length-1].outerEnd;Z=Z.slice(0,_)+B+Z.slice(j),Y=_+B.length}return Z}function uW($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function lW($){let Z=$,Y=0;while(Y<Z.length){let X=S1(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 W=K[1],z=K[2],B=K[3];Q=Q.replace(K[0],""),Q+=` :${W}="${B}" @update:${W}="${B} = $event"`,K=Q.match(G)}if(J){let W=i0(Z,X),z=Z.slice(W.outerStart,W.outerEnd),B=z1(z,{...X,start:0,end:X.end-X.start},Q);Z=Z.slice(0,W.outerStart)+B+Z.slice(W.outerEnd),Y=W.outerStart+B.length;continue}let q=e1(X.attrs,"v-model");if(q===null){Y=X.end;continue}if(fW.has(X.tag.toLowerCase())){let W=X.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,z=i0(Z,X),B=Z.slice(z.outerStart,z.outerEnd),_=z1(B,{...X,start:0,end:X.end-X.start},W);Z=Z.slice(0,z.outerStart)+_+Z.slice(z.outerEnd),Y=z.outerStart+_.length}else{let W=X.attrs.replace(/\s*v-model="[^"]*"/g,"");W+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let z=i0(Z,X),B=Z.slice(z.outerStart,z.outerEnd),_=z1(B,{...X,start:0,end:X.end-X.start},W);Z=Z.slice(0,z.outerStart)+_+Z.slice(z.outerEnd),Y=z.outerStart+_.length}}return Z}function pW($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function cW($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function iW($){let Z=$,Y=0;while(Y<Z.length){let X=S1(Z,Y);if(!X)break;let Q=e1(X.attrs,"v-html");if(Q===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let J=i0(Z,X),G=W1(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 nW($){let Z=$,Y=0;while(Y<Z.length){let X=S1(Z,Y);if(!X)break;let Q=e1(X.attrs,"v-text");if(Q===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let J=i0(Z,X),G=W1(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 oW($){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 sW($){let Z=$,Y=0;while(Y<Z.length){let X=S1(Z,Y);if(!X)break;if(!OY(X.attrs,"v-once")){Y=X.end;continue}let Q=W1(X.attrs,"v-once"),J=i0(Z,X),G=Z.slice(J.outerStart,J.outerEnd),q=`@once
4022
+ ${z1(G,{...X,start:0,end:X.end-X.start},Q)}
4023
+ @endonce`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function rW($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function aW($){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 LY($){if(!hW($))return $;let Z=$;return Z=dW(Z),Z=mW(Z),Z=sW(Z),Z=pW(Z),Z=cW(Z),Z=lW(Z),Z=uW(Z),Z=aW(Z),Z=iW(Z),Z=nW(Z),Z=oW(Z),Z=rW(Z),Z}var xW,fW;var FY=b(()=>{xW=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),fW=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 B$($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}async function VY($,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 U=K.length-1;U>=0;U--){let W=K[U];try{let z=$0(W.expr,Z);if(!z||typeof z!=="string"){let O=`<!-- dynamic component: could not resolve "${B$(W.expr)}" -->`;J=J.slice(0,W.index)+O+J.slice(W.index+W.full.length);continue}let B=W.attrs.trim(),_={},j=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=j.exec(B))!==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 A1(z,_,W.slotContent,L,Z,Y,X,new Set,Q??new Set);J=J.slice(0,W.index)+F+J.slice(W.index+W.full.length)}catch(z){let B=z instanceof Error?z.message:String(z),_=`<!-- dynamic component error: ${B$(B)} -->`;J=J.slice(0,W.index)+_+J.slice(W.index+W.full.length)}}return J=await tW(J,Z,Y,X,Q),J}async function tW($,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 U=K.length-1;U>=0;U--){let W=K[U];try{let z=$0(W.expr,Z);if(!z||typeof z!=="string"){let j=`<!-- dynamic component: could not resolve "${B$(W.expr)}" -->`;J=J.slice(0,W.index)+j+J.slice(W.index+W.full.length);continue}let B=X.componentsDir||"components",_=await A1(z,{},"",B,Z,Y,X,new Set,Q??new Set);J=J.slice(0,W.index)+_+J.slice(W.index+W.full.length)}catch(z){let B=z instanceof Error?z.message:String(z),_=`<!-- dynamic component error: ${B$(B)} -->`;J=J.slice(0,W.index)+_+J.slice(W.index+W.full.length)}}return J}var RY=b(()=>{H0();L0()});function NY($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}<style data-stx-cloak>[x-cloak]{display:none !important}</style>
4024
+ ${$.slice(Z)}`}function eW($,Z={},Y={}){let{title:X="stx App",lang:Q="en",meta:J=[],link:G=[],script:K=[],headRaw:q="",bodyClass:U="",bodyAttrs:W={}}=Z,z=Y.title||X,j=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...J].map((N)=>{return` <meta ${Object.entries(N).map(([w,T])=>`${w}="${T}"`).join(" ")}>`}).join(`
4025
+ `),H=G.map((N)=>{return` <link ${Object.entries(N).map(([w,T])=>`${w}="${T}"`).join(" ")}>`}).join(`
4026
+ `),L=K.map((N)=>{if(N.src)return` <script ${Object.entries(N).filter(([w])=>w!=="content").map(([w,T])=>`${w}="${T}"`).join(" ")}></script>`;if(N.content)return` <script>${N.content}</script>`;return""}).filter(Boolean).join(`
4027
+ `),F=Object.entries(W).map(([N,A])=>` ${N}="${A}"`).join(""),O=U?` class="${U}"`:"",V=[j,` <title>${z}</title>`," <style data-stx-cloak>[x-cloak]{display:none !important}</style>",H,L,q?` ${q}`:"",...(Y.styles||[]).map((N)=>` ${N}`),...(Y.headScripts||[]).map((N)=>` ${N}`),Y.headStack||""].filter(Boolean),R=[$,...(Y.bodyScripts||[]).map((N)=>N),Y.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
4031
4028
  <html lang="${Q}">
4032
4029
  <head>
4033
4030
  ${V.join(`
@@ -4037,9 +4034,9 @@ ${V.join(`
4037
4034
  ${R.join(`
4038
4035
  `)}
4039
4036
  </body>
4040
- </html>`}function t3($){return/<!DOCTYPE\b/i.test($)||/<html[\s>]/i.test($)}function R2($,Z={}){let Y=$.lastIndexOf("</head>");if(Y===-1)return $;let{meta:X=[],link:Q=[],script:J=[],headRaw:G=""}=Z,K=$.slice(0,Y),q=[];for(let W of X){let U=W.name?`name="${W.name}"`:W.property?`property="${W.property}"`:W.charset!=null?"charset=":W["http-equiv"]?`http-equiv="${W["http-equiv"]}"`:"";if(U&&K.includes(U))continue;q.push(` <meta ${Object.entries(W).map(([z,B])=>`${z}="${B}"`).join(" ")}>`)}for(let W of Q){if(W.href&&K.includes(`href="${W.href}"`))continue;q.push(` <link ${Object.entries(W).map(([U,z])=>`${U}="${z}"`).join(" ")}>`)}for(let W of J)if(W.src){if(K.includes(`src="${W.src}"`))continue;q.push(` <script ${Object.entries(W).filter(([U])=>U!=="content").map(([U,z])=>`${U}="${z}"`).join(" ")}></script>`)}else if(W.content){if(K.includes(W.content))continue;q.push(` <script>${W.content}</script>`)}if(G&&!K.includes(G))q.push(` ${G}`);if(q.length===0)return $;return`${$.slice(0,Y)}${q.join(`
4037
+ </html>`}function e3($){return/<!DOCTYPE\b/i.test($)||/<html[\s>]/i.test($)}function AY($,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 U of X){let W=U.name?`name="${U.name}"`:U.property?`property="${U.property}"`:U.charset!=null?"charset=":U["http-equiv"]?`http-equiv="${U["http-equiv"]}"`:"";if(W&&K.includes(W))continue;q.push(` <meta ${Object.entries(U).map(([z,B])=>`${z}="${B}"`).join(" ")}>`)}for(let U of Q){if(U.href&&K.includes(`href="${U.href}"`))continue;q.push(` <link ${Object.entries(U).map(([W,z])=>`${W}="${z}"`).join(" ")}>`)}for(let U of J)if(U.src){if(K.includes(`src="${U.src}"`))continue;q.push(` <script ${Object.entries(U).filter(([W])=>W!=="content").map(([W,z])=>`${W}="${z}"`).join(" ")}></script>`)}else if(U.content){if(K.includes(U.content))continue;q.push(` <script>${U.content}</script>`)}if(G&&!K.includes(G))q.push(` ${G}`);if(q.length===0)return $;return`${$.slice(0,Y)}${q.join(`
4041
4038
  `)}
4042
- ${$.slice(Y)}`}function A2($,Z={},Y={}){if(t3($))return $;return sW($,Z,Y)}function H$($){let Z=$,Y=new Set,X=new Set,Q=()=>{if(y0)X.add(y0);return Z};return Q.set=(J)=>{if(!Object.is(J,Z)){let G=Z;if(Z=J,Y.forEach((K)=>K(Z,G)),d5)X.forEach((K)=>j$.add(K));else X.forEach((K)=>K())}},Q.update=(J)=>{Q.set(J(Z))},Q.subscribe=(J)=>{return Y.add(J),()=>Y.delete(J)},Object.defineProperty(Q,"_isSignal",{value:!0,writable:!1}),Q}function O$($){let Z,Y=!0,X=new Set,Q=()=>{if(!Y)if(Y=!0,d5)X.forEach((G)=>j$.add(G));else X.forEach((G)=>G())},J=()=>{if(y0)X.add(y0);if(Y){let G=y0;y0=Q,_$.push(Q);try{Z=$()}finally{_$.pop(),y0=G}Y=!1}return Z};return Object.defineProperty(J,"_isDerived",{value:!0,writable:!1}),J}function L$($,Z={}){let Y,X=!1,Q=()=>{if(X)return;if(Y)Y(),Y=void 0;let J=y0;y0=Q,_$.push(Q);try{Y=$()}finally{_$.pop(),y0=J}};if(Z.immediate!==!1)Q();return()=>{if(X=!0,Y)Y()}}function e3($){if(d5){$();return}d5=!0;try{$()}finally{d5=!1,j$.forEach((Z)=>Z()),j$.clear()}}function $6($){rW.push($)}function Z6($){aW.push($)}function F$($){return typeof $==="function"&&$._isSignal===!0}function V$($){return typeof $==="function"&&$._isDerived===!0}function Y6($){if(F$($)||V$($))return $();return $}function R$($){let Z=y0;y0=null;try{return $()}finally{y0=Z}}function tW($,Z){let Y=typeof $==="function"?$:()=>$,X=H$([]),Q=O$(()=>X().reduce((K,q)=>Z(K,q.action),Y())),J=!1;return L$(()=>{if(Y(),!J){J=!0;return}if(R$(()=>X().length))X.set([])}),[Q,(K,q)=>{let W={action:K};X.set([...X(),W]);let U=()=>{let z=X().filter((B)=>B!==W);if(z.length!==X().length)X.set(z)};if(q&&typeof q.then==="function")Promise.resolve(q).then(U,U);return U}]}var y0=null,_$,d5=!1,j$,rW,aW;var X6=b(()=>{_$=[],j$=new Set,rW=[],aW=[]});var w2={};o(w2,{useOptimistic:()=>tW,untrack:()=>Y6,state:()=>H$,peek:()=>R$,onMount:()=>$6,onDestroy:()=>Z6,isSignal:()=>F$,isDerived:()=>V$,generateSignalsRuntimeDev:()=>A$,generateSignalsRuntime:()=>N2,effect:()=>L$,derived:()=>O$,default:()=>$z,batch:()=>e3});function N2(){try{let $=eW(A$()),Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return A$()}}function eW($){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 A$(){return`
4039
+ ${$.slice(Y)}`}function wY($,Z={},Y={}){if(e3($))return $;return eW($,Z,Y)}function H$($){let Z=$,Y=new Set,X=new Set,Q=()=>{if(y0)X.add(y0);return Z};return Q.set=(J)=>{if(!Object.is(J,Z)){let G=Z;if(Z=J,Y.forEach((K)=>K(Z,G)),u5)X.forEach((K)=>j$.add(K));else X.forEach((K)=>K())}},Q.update=(J)=>{Q.set(J(Z))},Q.subscribe=(J)=>{return Y.add(J),()=>Y.delete(J)},Object.defineProperty(Q,"_isSignal",{value:!0,writable:!1}),Q}function O$($){let Z,Y=!0,X=new Set,Q=()=>{if(!Y)if(Y=!0,u5)X.forEach((G)=>j$.add(G));else X.forEach((G)=>G())},J=()=>{if(y0)X.add(y0);if(Y){let G=y0;y0=Q,_$.push(Q);try{Z=$()}finally{_$.pop(),y0=G}Y=!1}return Z};return Object.defineProperty(J,"_isDerived",{value:!0,writable:!1}),J}function L$($,Z={}){let Y,X=!1,Q=()=>{if(X)return;if(Y)Y(),Y=void 0;let J=y0;y0=Q,_$.push(Q);try{Y=$()}finally{_$.pop(),y0=J}};if(Z.immediate!==!1)Q();return()=>{if(X=!0,Y)Y()}}function $6($){if(u5){$();return}u5=!0;try{$()}finally{u5=!1,j$.forEach((Z)=>Z()),j$.clear()}}function Z6($){$z.push($)}function Y6($){Zz.push($)}function F$($){return typeof $==="function"&&$._isSignal===!0}function V$($){return typeof $==="function"&&$._isDerived===!0}function X6($){if(F$($)||V$($))return $();return $}function R$($){let Z=y0;y0=null;try{return $()}finally{y0=Z}}function Yz($,Z){let Y=typeof $==="function"?$:()=>$,X=H$([]),Q=O$(()=>X().reduce((K,q)=>Z(K,q.action),Y())),J=!1;return L$(()=>{if(Y(),!J){J=!0;return}if(R$(()=>X().length))X.set([])}),[Q,(K,q)=>{let U={action:K};X.set([...X(),U]);let W=()=>{let z=X().filter((B)=>B!==U);if(z.length!==X().length)X.set(z)};if(q&&typeof q.then==="function")Promise.resolve(q).then(W,W);return W}]}var y0=null,_$,u5=!1,j$,$z,Zz;var J6=b(()=>{_$=[],j$=new Set,$z=[],Zz=[]});var MY={};o(MY,{useOptimistic:()=>Yz,untrack:()=>X6,state:()=>H$,peek:()=>R$,onMount:()=>Z6,onDestroy:()=>Y6,isSignal:()=>F$,isDerived:()=>V$,generateSignalsRuntimeDev:()=>N$,generateSignalsRuntime:()=>TY,effect:()=>L$,derived:()=>O$,default:()=>Jz,batch:()=>$6});function TY(){try{let $=Xz(N$()),Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return N$()}}function Xz($){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 N$(){return`
4043
4040
  // STX Signals Runtime (Development Build)
4044
4041
  console.log('[stx] signals runtime loading');
4045
4042
  // Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
@@ -6379,6 +6376,13 @@ else {
6379
6376
  }
6380
6377
 
6381
6378
  let currentElements = [];
6379
+ // One entry per list item, each holding EVERY node that item rendered.
6380
+ // currentElements stays flat for transition snapshots, but the keyed
6381
+ // diff below must pair a key with all of its nodes: a template row
6382
+ // routinely yields several (an element plus its surrounding text nodes),
6383
+ // and indexing a flat list by key position then paired the wrong node
6384
+ // with each key, leaving the list rotated after an update.
6385
+ let currentGroups = [];
6382
6386
  let currentKeys = [];
6383
6387
  let loadingElement = null;
6384
6388
  let emptyElement = null;
@@ -6520,6 +6524,7 @@ catch (e) {
6520
6524
  // Dispose scopes registered by items before they leave the DOM (#1727).
6521
6525
  currentElements.forEach(e => { disposeSubtreeScopes(e); e.remove(); });
6522
6526
  currentElements = [];
6527
+ currentGroups = [];
6523
6528
  currentKeys = [];
6524
6529
  showLoading();
6525
6530
  return;
@@ -6568,6 +6573,7 @@ catch (e) {
6568
6573
  // Dispose scopes registered by items before they leave the DOM (#1727).
6569
6574
  currentElements.forEach(e => { disposeSubtreeScopes(e); e.remove(); });
6570
6575
  currentElements = [];
6576
+ currentGroups = [];
6571
6577
  currentKeys = [];
6572
6578
  hideEmpty();
6573
6579
  return;
@@ -6608,6 +6614,7 @@ catch (e) {
6608
6614
  // Dispose scopes registered by items before they leave the DOM (#1727).
6609
6615
  currentElements.forEach(e => { disposeSubtreeScopes(e); e.remove(); });
6610
6616
  currentElements = [];
6617
+ currentGroups = [];
6611
6618
  currentKeys = [];
6612
6619
  if (emptyExpr) {
6613
6620
  const emptyContent = evalLazy(emptyExpr);
@@ -6642,11 +6649,12 @@ catch (e) {
6642
6649
  for (let i = 0; i < currentKeys.length; i++) {
6643
6650
  const k = currentKeys[i];
6644
6651
  if (!oldKeyMap.has(k)) oldKeyMap.set(k, []);
6645
- oldKeyMap.get(k).push(currentElements[i]);
6652
+ oldKeyMap.get(k).push(currentGroups[i] || []);
6646
6653
  }
6647
6654
 
6648
6655
  // Build new element list, reusing existing DOM nodes by key
6649
6656
  const newElements = [];
6657
+ const newGroups = [];
6650
6658
  const usedKeys = new Set();
6651
6659
 
6652
6660
  for (let i = 0; i < list.length; i++) {
@@ -6654,10 +6662,12 @@ catch (e) {
6654
6662
  const existing = oldKeyMap.get(key);
6655
6663
 
6656
6664
  if (existing && existing.length > 0 && !usedKeys.has(key)) {
6657
- // Reuse existing element \u2014 move to correct position
6658
- const el = existing.shift();
6659
- parent.insertBefore(el, placeholder);
6660
- newElements.push(el);
6665
+ // Reuse this item's nodes \u2014 move the whole group into position, in
6666
+ // order, so a multi-node row stays contiguous and correctly ordered.
6667
+ const group = existing.shift();
6668
+ group.forEach(el => parent.insertBefore(el, placeholder));
6669
+ newElements.push(...group);
6670
+ newGroups.push(group);
6661
6671
  usedKeys.add(key);
6662
6672
  // Update the item signal so bindings re-evaluate with new data.
6663
6673
  // This is the fix for #1669 \u2014 without this, reused elements show
@@ -6672,14 +6682,16 @@ catch (e) {
6672
6682
  const elements = createItemElements(list[i], i, key);
6673
6683
  elements.forEach(el => { parent.insertBefore(el, placeholder); if (tgReady) tgEnter(el, tgName); });
6674
6684
  newElements.push(...elements);
6685
+ newGroups.push(elements);
6675
6686
  }
6676
6687
  }
6677
6688
 
6678
6689
  // Remove old elements whose keys are no longer in the list.
6679
6690
  // Dispose any scopes registered inside removed items before the
6680
6691
  // remove() call (#1727).
6681
- for (const [key, elements] of oldKeyMap) {
6692
+ for (const [key, groups] of oldKeyMap) {
6682
6693
  if (!usedKeys.has(key)) {
6694
+ const elements = groups.flat();
6683
6695
  // In a transition group, run the leave animation and let it remove the
6684
6696
  // node; otherwise remove immediately. Scopes are disposed up-front
6685
6697
  // either way (their destroy hooks shouldn't wait on a CSS transition).
@@ -6689,6 +6701,7 @@ catch (e) {
6689
6701
  }
6690
6702
 
6691
6703
  currentElements = newElements;
6704
+ currentGroups = newGroups;
6692
6705
  currentKeys = newKeys;
6693
6706
 
6694
6707
  // \u2500\u2500 <TransitionGroup> play (#1742) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
@@ -8856,6 +8869,10 @@ else {
8856
8869
  processedScopes.add(el);
8857
8870
 
8858
8871
  const scopeVars = window.stx._scopes && window.stx._scopes[scopeId];
8872
+ // Record the element this scope is bound to so cleanupContainer can tell a
8873
+ // dead registry entry (element replaced by an SPA swap) from a live one.
8874
+ // See sweepOrphanedScopes / #1775.
8875
+ if (scopeVars) scopeVars.__el = el;
8859
8876
 
8860
8877
  // Deferred island (#1746): its setup script (type="stx/island") hasn't run
8861
8878
  // yet, so the scope isn't registered. Arm the hydration trigger anyway \u2014
@@ -9015,6 +9032,54 @@ catch (e) {
9015
9032
  }
9016
9033
  }
9017
9034
 
9035
+ // Reclaim registry entries whose element is gone from the document.
9036
+ //
9037
+ // disposeSubtreeScopes only deletes scopes found UNDER the cleanup container,
9038
+ // so two shapes leaked forever across SPA navigation (#1775): components
9039
+ // rendered outside the swap container (an @include in the layout, above
9040
+ // <main>), and elements already detached by the time cleanup ran its
9041
+ // querySelectorAll. Each round-trip re-ran the include scripts under fresh
9042
+ // scope ids while the previous ids stayed in window.stx._scopes \u2014 ~4 orphans
9043
+ // per hop, unbounded, each retaining that scope's vars, signals and closures.
9044
+ //
9045
+ // The sweep is deliberately CONSERVATIVE \u2014 an over-eager delete is the #1737
9046
+ // failure (a scope removed from the registry cannot be recreated: its setup
9047
+ // IIFE ran once at page load), which is strictly worse than a leak. An entry
9048
+ // is dropped only when all three hold:
9049
+ // 1. the runtime actually bound it to an element (__el recorded),
9050
+ // 2. that element is no longer connected to the document, and
9051
+ // 3. neither it nor any ancestor is retained by a live conditional.
9052
+ // Entries with no __el (e.g. a scope whose element still sits inside untouched
9053
+ // <template> content, never inserted) are left alone \u2014 we can't prove they're
9054
+ // dead, and a later clone re-uses that registration.
9055
+ function sweepOrphanedScopes() {
9056
+ if (!window.stx || !window.stx._scopes) return;
9057
+ var scopes = window.stx._scopes;
9058
+ for (var id in scopes) {
9059
+ if (!Object.prototype.hasOwnProperty.call(scopes, id)) continue;
9060
+ var entry = scopes[id];
9061
+ if (!entry) continue;
9062
+ var el = entry.__el;
9063
+ if (!el || el.isConnected) continue;
9064
+ // Detached but RETAINED: :if toggles keep their element (bindIf re-inserts
9065
+ // the SAME node) and :if/:else chains keep their branches. Parent links
9066
+ // inside a detached subtree stay intact, so walking up from the scope
9067
+ // element still finds the conditional that owns it.
9068
+ var retained = false;
9069
+ for (var p = el; p; p = p.parentNode) {
9070
+ if (p.__stx_if_bound || p.__stx_chain_member) { retained = true; break; }
9071
+ }
9072
+ if (retained) continue;
9073
+ if (entry.__destroyCallbacks && Array.isArray(entry.__destroyCallbacks)) {
9074
+ for (var k = 0; k < entry.__destroyCallbacks.length; k++) {
9075
+ try { entry.__destroyCallbacks[k](); }
9076
+ catch (e) { console.warn('[stx] scope destroy error:', e); }
9077
+ }
9078
+ }
9079
+ delete scopes[id];
9080
+ }
9081
+ }
9082
+
9018
9083
  // ==========================================================================
9019
9084
  // Container Cleanup (for SPA navigation)
9020
9085
  // ==========================================================================
@@ -9082,6 +9147,11 @@ catch (e) { console.warn('[stx] destroy hook error:', e); }
9082
9147
  // through disposeSubtreeScopes so the same walk runs for SPA
9083
9148
  // navigation and for :if/:for-driven unmount (see #1727).
9084
9149
  disposeSubtreeScopes(container);
9150
+
9151
+ // 4. Reclaim entries the container walk can't see \u2014 components rendered
9152
+ // outside the swap container, or already detached before step 3 ran its
9153
+ // querySelectorAll. Without this the registry grew every navigation (#1775).
9154
+ sweepOrphanedScopes();
9085
9155
  }
9086
9156
 
9087
9157
  // Re-initialize components after SPA content swap.
@@ -9177,6 +9247,9 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
9177
9247
  document.body.querySelectorAll('[data-stx-scope]').forEach(function(el) {
9178
9248
  var scopeId = el.getAttribute('data-stx-scope');
9179
9249
  var scopeVars = window.stx._scopes && window.stx._scopes[scopeId];
9250
+ // Record the bound element for the orphan sweep (#1775) \u2014 see the
9251
+ // DOMContentLoaded walk above for the rationale.
9252
+ if (scopeVars) scopeVars.__el = el;
9180
9253
  // Deferred island reached via SPA navigation (#1746): its setup script is
9181
9254
  // inert (type="stx/island"), so the scope isn't registered yet. Arm the
9182
9255
  // hydration trigger (deferHydration) instead of skipping it \u2014 mirrors the
@@ -9278,60 +9351,60 @@ catch (e) { console.warn('[stx] mount callback error:', e); }
9278
9351
  }
9279
9352
  }
9280
9353
  })();
9281
- `}var $z;var T2=b(()=>{X6();X6();$z={state:H$,derived:O$,effect:L$,batch:e3,onMount:$6,onDestroy:Z6,isSignal:F$,isDerived:V$,untrack:Y6,peek:R$,generateSignalsRuntime:N2,generateSignalsRuntimeDev:A$}});var J6={};o(J6,{templateCache:()=>M2,readFileCached:()=>Zz,invalidateFileCacheByDir:()=>Xz,invalidateFileCache:()=>Yz,hashFilePath:()=>m5,getCachedSignalsRuntime:()=>Gz,getCachedRouterScript:()=>Kz,clearDevCaches:()=>qz,checkCache:()=>Uz,cacheTemplate:()=>Wz,__setSignalsGeneratorsForTest:()=>Qz});import z1 from"fs";import $5 from"path";async function Zz($){let Y;for(let X=0;X<3;X++)try{let J=(await z1.promises.stat($)).mtime.getTime(),G=y1.get($);if(G&&G.mtime===J)return G.content;let K=await Bun.file($).text(),W=(await z1.promises.stat($)).mtime.getTime();if(W!==J)continue;return y1.set($,{content:K,mtime:W}),K}catch(Q){Y=Q;break}throw y1.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function Yz($){y1.delete($)}function Xz($){for(let Z of y1.keys())if(Z.startsWith($))y1.delete(Z)}function Qz($){I2=$}async function Gz($=!1){let Z=I2??await Promise.resolve().then(() => (T2(),w2));if($)return Z.generateSignalsRuntimeDev();if(N$===null)N$=Z.generateSignalsRuntime();return N$}async function Kz(){if(w$===null){let{getRouterScript:$}=await import("stx-router");w$=$()}return w$}function qz(){y1.clear(),N$=null,Jz=null,w$=null}function D2($){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 Uz($,Z){try{if(!Z.cachePath)return null;let Y=$5.resolve(Z.cachePath),X=$5.join(Y,`${m5($)}.html`),Q=$5.join(Y,`${m5($)}.meta.json`);if(!await i(X)||!await i(Q))return null;let J=await Bun.file(Q).text(),G=JSON.parse(J);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==D2(Z))return null;if((await z1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await i(q)){if((await z1.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 Wz($,Z,Y,X){try{if(!X.cachePath)return;let Q=$5.resolve(X.cachePath);await z1.promises.mkdir(Q,{recursive:!0});let J=$5.join(Q,`${m5($)}.html`),G=$5.join(Q,`${m5($)}.meta.json`),K=await z1.promises.stat($);await Bun.write(J,Z);let q={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:X.cacheVersion,optionsSignature:D2(X),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),M2.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(Q){console.warn(`Failed to cache template ${$}:`,Q)}}function m5($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,zz)}var M2,y1,N$=null,Jz=null,I2=null,w$=null,zz=16;var Q6=b(()=>{H0();M2=new Map,y1=new Map});function E2($){if($.includes("window.StacksBrowser")||$.includes("StacksBrowser ="))return $;let Z=/<script\b(?![^>]*\bserver\b)[^>]*>([\s\S]*?)<\/script>/gi,Y="",X;while((X=Z.exec($))!==null)Y+=X[1]+`
9354
+ `}var Jz;var IY=b(()=>{J6();J6();Jz={state:H$,derived:O$,effect:L$,batch:$6,onMount:Z6,onDestroy:Y6,isSignal:F$,isDerived:V$,untrack:X6,peek:R$,generateSignalsRuntime:TY,generateSignalsRuntimeDev:N$}});var Q6={};o(Q6,{templateCache:()=>DY,readFileCached:()=>Qz,invalidateFileCacheByDir:()=>Kz,invalidateFileCache:()=>Gz,hashFilePath:()=>l5,getCachedSignalsRuntime:()=>Wz,getCachedRouterScript:()=>zz,clearDevCaches:()=>Bz,checkCache:()=>_z,cacheTemplate:()=>jz,__setSignalsGeneratorsForTest:()=>Uz});import B1 from"fs";import $5 from"path";async function Qz($){let Y;for(let X=0;X<3;X++)try{let J=(await B1.promises.stat($)).mtime.getTime(),G=y1.get($);if(G&&G.mtime===J)return G.content;let K=await Bun.file($).text(),U=(await B1.promises.stat($)).mtime.getTime();if(U!==J)continue;return y1.set($,{content:K,mtime:U}),K}catch(Q){Y=Q;break}throw y1.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function Gz($){y1.delete($)}function Kz($){for(let Z of y1.keys())if(Z.startsWith($))y1.delete(Z)}function Uz($){EY=$}async function Wz($=!1){let Z=EY??await Promise.resolve().then(() => (IY(),MY));if($)return Z.generateSignalsRuntimeDev();if(A$===null)A$=Z.generateSignalsRuntime();return A$}async function zz(){if(w$===null){let{getRouterScript:$}=await import("stx-router");w$=$()}return w$}function Bz(){y1.clear(),A$=null,qz=null,w$=null}function kY($){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 _z($,Z){try{if(!Z.cachePath)return null;let Y=$5.resolve(Z.cachePath),X=$5.join(Y,`${l5($)}.html`),Q=$5.join(Y,`${l5($)}.meta.json`);if(!await i(X)||!await i(Q))return null;let J=await Bun.file(Q).text(),G=JSON.parse(J);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==kY(Z))return null;if((await B1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await i(q)){if((await B1.promises.stat(q)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(X).text()}catch(Y){return console.warn(`Cache error for ${$}:`,Y),null}}async function jz($,Z,Y,X){try{if(!X.cachePath)return;let Q=$5.resolve(X.cachePath);await B1.promises.mkdir(Q,{recursive:!0});let J=$5.join(Q,`${l5($)}.html`),G=$5.join(Q,`${l5($)}.meta.json`),K=await B1.promises.stat($);await Bun.write(J,Z);let q={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:X.cacheVersion,optionsSignature:kY(X),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),DY.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(Q){console.warn(`Failed to cache template ${$}:`,Q)}}function l5($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,Hz)}var DY,y1,A$=null,qz=null,EY=null,w$=null,Hz=16;var G6=b(()=>{H0();DY=new Map,y1=new Map});function bY($){if($.includes("window.StacksBrowser")||$.includes("StacksBrowser ="))return $;let Z=/<script\b(?![^>]*\bserver\b)[^>]*>([\s\S]*?)<\/script>/gi,Y="",X;while((X=Z.exec($))!==null)Y+=X[1]+`
9282
9355
  `;let Q=/\{\{([\s\S]*?)\}\}/g;while((X=Q.exec($))!==null)Y+=X[1]+`
9283
- `;if(!Y.trim())return $;let G=["browserQuery","BrowserQueryBuilder","configureBrowser","createBrowserModel"].some((B)=>{return new RegExp(`\\b${B}\\b`).test(Y)}),K=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process"]),q=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,W,U=!1;while((W=q.exec(Y))!==null)if(!K.has(W[1])){U=!0;break}if(!G&&!U)return $;let z=`<script type="module">
9356
+ `;if(!Y.trim())return $;let G=["browserQuery","BrowserQueryBuilder","configureBrowser","createBrowserModel"].some((B)=>{return new RegExp(`\\b${B}\\b`).test(Y)}),K=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process"]),q=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,U,W=!1;while((U=q.exec(Y))!==null)if(!K.has(U[1])){W=!0;break}if(!G&&!W)return $;let z=`<script type="module">
9284
9357
  // STX: Auto-load @stacksjs/browser (auto-initializes API and loads models)
9285
9358
  import '@stacksjs/browser'
9286
9359
  </script>`;if($.includes("</head>")){let B=$.indexOf("</head>"),j=$.slice(0,B).indexOf("<script");if(j!==-1)return $.slice(0,j)+z+`
9287
9360
  `+$.slice(j);return $.replace("</head>",`${z}
9288
9361
  </head>`)}if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
9289
9362
  ${z}`);return z+`
9290
- `+$}async function k2($,Z){if($.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="compile"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script src="/__stx/runtime.__STX_HASH__.js"></script>
9363
+ `+$}async function SY($,Z){if($.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="compile"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script src="/__stx/runtime.__STX_HASH__.js"></script>
9291
9364
  `+$.slice(K);if($.includes("</head>")){let q=$.indexOf("</head>");return $.slice(0,q)+`<script src="/__stx/runtime.__STX_HASH__.js"></script>
9292
9365
  `+$.slice(q)}return`<script src="/__stx/runtime.__STX_HASH__.js"></script>
9293
- `+$}let{getCachedSignalsRuntime:Y}=await Promise.resolve().then(() => (Q6(),J6)),Q=`<script data-stx-scoped>${await Y(Z.debug)}</script>`,J=$.indexOf("<script");if(J!==-1)return $.slice(0,J)+Q+`
9366
+ `+$}let{getCachedSignalsRuntime:Y}=await Promise.resolve().then(() => (G6(),Q6)),Q=`<script data-stx-scoped>${await Y(Z.debug)}</script>`,J=$.indexOf("<script");if(J!==-1)return $.slice(0,J)+Q+`
9294
9367
  `+$.slice(J);if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Q+`
9295
9368
  `+$.slice(G)}if($.includes("<body")){let G=$.indexOf("<body"),K=$.indexOf(">",G);return $.slice(0,K+1)+`
9296
9369
  `+Q+$.slice(K+1)}return Q+`
9297
- `+$}async function b2($,Z){if(!$.includes("</body>"))return $;if($.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Y=Z?.router,X="";if(Y){let K={};if(Y.container)K.container=Y.container;if(Y.interceptAllLinks!==void 0)K.interceptAllLinks=Y.interceptAllLinks;if(Y.progress!==void 0)K.progress=Y.progress;if(Y.viewTransitions!==void 0)K.viewTransitions=Y.viewTransitions;if(Y.viewTransitionDuration!==void 0)K.viewTransitionDuration=Y.viewTransitionDuration;if(Y.viewTransitionEasing!==void 0)K.viewTransitionEasing=Y.viewTransitionEasing;if(Y.scrollToTop!==void 0)K.scrollToTop=Y.scrollToTop;if(Y.prefetch!==void 0)K.prefetch=Y.prefetch;if(Y.cache!==void 0)K.cache=Y.cache;if(Y.progressColor!==void 0)K.progressColor=Y.progressColor;if(Y.progressHeight!==void 0)K.progressHeight=Y.progressHeight;if(Object.keys(K).length>0)X=`<script>window.__stxRouterConfig=${JSON.stringify(K)};</script>
9298
- `}let{getCachedRouterScript:Q}=await Promise.resolve().then(() => (Q6(),J6)),J=Z?.buildMode==="compile"?'<script src="/__stx/router.__STX_HASH__.js"></script>':`<script>${await Q()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+X+J+`
9299
- </body>`+$.slice(G+7)}var m2={};o(m2,{scanScriptTags:()=>x2,rewriteStxImportSpecifiers:()=>d2,processSignals:()=>W6,processScriptSetup:()=>g2,preEvalLiteralReactiveIfs:()=>q6,parseLoopExpression:()=>f2,hasSignalsSyntax:()=>D$,findMarkupIndexOutsideScripts:()=>I$,extractExports:()=>h2,convertSignalLoopsToAttributes:()=>U6,convertSignalDirectivesToAttributes:()=>K6});function x2($,Z={}){let Y=[];T$.lastIndex=0;let X;while((X=T$.exec($))!==null){let Q=X[1],J=X.index+X[0].length,G=$.toLowerCase().indexOf("</script>",J);if(G===-1)break;let K=G+9;if(Z.skipAttrs&&Z.skipAttrs.test(Q)){T$.lastIndex=K;continue}Y.push({fullMatch:$.slice(X.index,K),attrs:Q,body:$.slice(J,G),start:X.index,end:K}),T$.lastIndex=K}return Y}function f2($){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}=S2(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}=S2(Q);if(G)return{style:"in",iterable:J,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function S2($){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 D$($){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*\(/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/].some((Y)=>Y.test($))}function _z($){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 jz($){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 Hz($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function P2($,Z,Y){if(!$)return!1;let X=Hz($),Q=!1,J=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,q;while((q=K.exec(X))!==null){let B=q[1];if(X.slice(0,q.index).trimEnd().endsWith("."))continue;if(y2.has(B))continue;if(Z.has(B))Q=!0;else if(Y&&B in Y)J=!0}let W=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,U;while((U=W.exec(X))!==null){let B=U[1];if(X.slice(0,U.index).trimEnd().endsWith("."))continue;if(y2.has(B)||Y&&B in Y)continue;G=!0}return(Q||G)&&!J}function M$($,Z,Y){let X=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,"&quot;")}"`,Q=$.trim(),J=Q.match(v2);if(J&&Oz(J[3],J[1])){let[,G,K,q]=J;return`<${G}${K}${X}>${q}</${G}>`}return`<template${X}>${Q}</template>`}function Oz($,Z){let Y=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),X=0,Q;while((Q=Y.exec($))!==null)if(Q[1]){if(X--,X<0)return!1}else X++;return!0}function K6($,Z){let Y=jz($);function X(Q){let J=Q,G=/@if\s*\(/g,K,q=[];while((K=G.exec(J))!==null){let W=K.index,U=W+K[0].length,z=1,B=U;while(B<J.length&&z>0){if(J[B]==="(")z++;else if(J[B]===")")z--;B++}if(z!==0)continue;let _=J.substring(U,B-1).trim(),j=B,H=1,L=j,F=/@(if\s*\(|endif)/g;F.lastIndex=j;let O;while((O=F.exec(J))!==null)if(O[1].startsWith("if"))H++;else if(O[1]==="endif"){if(H--,H===0){L=O.index+O[0].length;break}}if(H!==0)continue;let V=J.substring(j,L-6).trim(),R;if(_z(V)){let A=y5(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)=>P2(M.condition,Y,Z))))continue;R=A[0].branches.map((M)=>{let I=X(M.content);if(M.type==="elseif")return M$(I,"@else-if",M.condition??"");if(M.type==="else")return M$(I,"@else");return M$(I,"@if",M.condition??"")}).join(`
9300
- `)}else{if(!P2(_,Y,Z))continue;R=M$(X(V),"@if",_)}q.push({start:W,end:L,replacement:R}),G.lastIndex=L}for(let W=q.length-1;W>=0;W--){let{start:U,end:z,replacement:B}=q[W];J=J.substring(0,U)+B+J.substring(z)}return J}return X($)}function Lz($){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 Fz($,Z,Y,X){if(G6.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 j=J.indexOf(`</${U[1].toLowerCase()}`,q);if(j===-1)return-1;let H=$.indexOf(">",j);if(H===-1)return-1;q=H+1;continue}if($[q+1]==="/"){let _=/^<\/([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 B=$.indexOf(">",q);if(B===-1)return-1;if(z[1].toLowerCase()===Q){let _=$.slice(q,B+1);if(!(/\/\s*>$/.test(_)||G6.has(Q)))K++}q=B+1}return-1}function Rz($,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 Vz.test(J)}function q6($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,X;while((X=Y.exec($))!==null)Z.push([X.index,X.index+X[0].length]);let Q=(z)=>Z.some(([B,_])=>z>=B&&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,B,_,j,H,L,F]=K,O=Lz(H);if(O===void 0)continue;let V=K.index,R=V+z.length,w=!!F||/\/\s*>$/.test(z)||G6.has(B.toLowerCase())?R:Fz($,V,B,R);if(w===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&Rz($,w)){J.lastIndex=R;continue}if(O===!0){let M=`<${B}${_}${L}${F}>`;G.push({start:V,end:R,replacement:M});continue}G.push({start:V,end:w,replacement:""}),J.lastIndex=w}if(G.length===0)return $;G.sort((z,B)=>z.start-B.start);let q=[],W=-1;for(let z of G){if(z.start<W)continue;q.push(z),W=z.end}let U=$;for(let z=q.length-1;z>=0;z--){let{start:B,end:_,replacement:j}=q[z];U=U.substring(0,B)+j+U.substring(_)}return U}function U6($,Z){let Y=$,X=/@(for|foreach)\s*\(/g,Q,J=[];while((Q=X.exec(Y))!==null){let G=Q[1],K=Q.index,q=K+Q[0].length,W=1,U=q;while(U<Y.length&&W>0){if(Y[U]==="(")W++;else if(Y[U]===")")W--;U++}if(W!==0)continue;let z=Y.substring(q,U-1).trim(),B=U,_=f2(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 w=N.split(/[.[(]/)[0].trim();if(w&&w in Z)continue}}if(_.style==="as")z=_.indexVar?`(${_.itemVar}, ${_.indexVar}) in ${_.iterable}`:`${_.itemVar} in ${_.iterable}`;let j=G==="for"?"@endfor":"@endforeach",H=1,L=B,F=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");F.lastIndex=B;let O;while((O=F.exec(Y))!==null)if(O[1].startsWith(G))H++;else if(H--,H===0){L=O.index+O[0].length;break}if(H!==0)continue;let V=Y.substring(B,L-j.length).trim(),R=V.match(v2),A;if(R){let[,N,w,T]=R;A=`<${N}${w} @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 Az($){let Z=new Set,Y=[],X=0,Q=0,J=$.length,G=(U)=>{let z=X+1;while(z<J){let B=$[z];if(B==="\\"){z+=2;continue}if(B===U)return z+1;z++}return J},K=()=>{let U=X+2;while(U<J&&$[U]!==`
9301
- `)U++;return U},q=()=>{let U=X+2;while(U<J-1){if($[U]==="*"&&$[U+1]==="/")return U+2;U++}return J},W=(U)=>{let z=U,B=0;while(z<J){let _=$[z];if(_==="/"&&$[z+1]==="/"){let j=z+2;while(j<J&&$[j]!==`
9302
- `)j++;z=j;continue}if(_==="/"&&$[z+1]==="*"){let j=z+2;while(j<J-1&&!($[j]==="*"&&$[j+1]==="/"))j++;z=j+2;continue}if(_==='"'||_==="'"||_==="`"){let j=z+1;while(j<J){if($[j]==="\\"){j+=2;continue}if($[j]===_){j++;break}j++}z=j;continue}if(_==="("||_==="["||_==="{"){B++,z++;continue}if(_===")"||_==="]"||_==="}"){B--,z++;continue}if(_===";"&&B===0)return z+1;z++}return J};while(X<J){let U=$[X];if(U==="/"&&$[X+1]==="/"){let z=K();Y.push($.slice(X,z)),X=z;continue}if(U==="/"&&$[X+1]==="*"){let z=q();Y.push($.slice(X,z)),X=z;continue}if(U==='"'||U==="'"||U==="`"){let z=G(U);Y.push($.slice(X,z)),X=z;continue}if(U==="{"){Q++,Y.push(U),X++;continue}if(U==="}"){Q--,Y.push(U),X++;continue}if(Q===0){let z=X>0?$[X-1]:"";if(z===""||/\s/.test(z)||z===";"||z==="}"||z==="{"){let _=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(_){let j=_[2],H=W(X+_[0].length);if(Z.has(j)){Y.push(`/* stx: deduped const ${j} */`),X=H;continue}Z.add(j),Y.push($.slice(X,H)),X=H;continue}}}Y.push(U),X++}return Y.join("")}async function g2($,Z,Y){let X=x2($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Q=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,J=[];for(let H of X){let L=H.body;if(L1(H.attrs))L=F1(L);if(Q.test(L))J.push({fullMatch:H.fullMatch,attrs:H.attrs,content:L})}if(J.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${Bz++}`,{hasUserImports:K,bundleClientScript:q}=await Promise.resolve().then(() => (Z4(),$4)),W=[];for(let H=0;H<J.length;H++){let L=J[H].content;if(K(L))console.log("[stx:bundler] bundling signal script imports"),L=await q(L,Z||"",{projectRoot:process.cwd()});L=L.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(O,V)=>d2(V));let F=a0(L);W.push(`// \u2500\u2500 merged signal script #${H+1} \u2500\u2500
9303
- ${F}`)}let U=W.join(`
9304
-
9305
- `);U=Az(U);let z=h2(U),B=Y4(U,Y),_=`
9370
+ `+$}async function yY($,Z){if(!$.includes("</body>"))return $;if($.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Y=Z?.router,X="";if(Y){let K={};if(Y.container)K.container=Y.container;if(Y.interceptAllLinks!==void 0)K.interceptAllLinks=Y.interceptAllLinks;if(Y.progress!==void 0)K.progress=Y.progress;if(Y.viewTransitions!==void 0)K.viewTransitions=Y.viewTransitions;if(Y.viewTransitionDuration!==void 0)K.viewTransitionDuration=Y.viewTransitionDuration;if(Y.viewTransitionEasing!==void 0)K.viewTransitionEasing=Y.viewTransitionEasing;if(Y.scrollToTop!==void 0)K.scrollToTop=Y.scrollToTop;if(Y.prefetch!==void 0)K.prefetch=Y.prefetch;if(Y.cache!==void 0)K.cache=Y.cache;if(Y.progressColor!==void 0)K.progressColor=Y.progressColor;if(Y.progressHeight!==void 0)K.progressHeight=Y.progressHeight;if(Object.keys(K).length>0)X=`<script>window.__stxRouterConfig=${JSON.stringify(K)};</script>
9371
+ `}let{getCachedRouterScript:Q}=await Promise.resolve().then(() => (G6(),Q6)),J=Z?.buildMode==="compile"?'<script src="/__stx/router.__STX_HASH__.js"></script>':`<script>${await Q()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+X+J+`
9372
+ </body>`+$.slice(G+7)}var lY={};o(lY,{scanScriptTags:()=>gY,rewriteStxImportSpecifiers:()=>uY,processSignals:()=>z6,processScriptSetup:()=>dY,preEvalLiteralReactiveIfs:()=>U6,parseLoopExpression:()=>hY,hasSignalsSyntax:()=>D$,findMarkupIndexOutsideScripts:()=>I$,extractExports:()=>mY,convertSignalLoopsToAttributes:()=>W6,convertSignalDirectivesToAttributes:()=>q6});function gY($,Z={}){let Y=[];T$.lastIndex=0;let X;while((X=T$.exec($))!==null){let Q=X[1],J=X.index+X[0].length,G=$.toLowerCase().indexOf("</script>",J);if(G===-1)break;let K=G+9;if(Z.skipAttrs&&Z.skipAttrs.test(Q)){T$.lastIndex=K;continue}Y.push({fullMatch:$.slice(X.index,K),attrs:Q,body:$.slice(J,G),start:X.index,end:K}),T$.lastIndex=K}return Y}function hY($){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}=PY(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}=PY(Q);if(G)return{style:"in",iterable:J,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function PY($){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 D$($){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*\(/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/].some((Y)=>Y.test($))}function Lz($){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 Fz($){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 Vz($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function vY($,Z,Y){if(!$)return!1;let X=Vz($),Q=!1,J=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,q;while((q=K.exec(X))!==null){let B=q[1];if(X.slice(0,q.index).trimEnd().endsWith("."))continue;if(CY.has(B))continue;if(Z.has(B))Q=!0;else if(Y&&B in Y)J=!0}let U=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,W;while((W=U.exec(X))!==null){let B=W[1];if(X.slice(0,W.index).trimEnd().endsWith("."))continue;if(CY.has(B)||Y&&B in Y)continue;G=!0}return(Q||G)&&!J}function M$($,Z,Y){let X=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,"&quot;")}"`,Q=$.trim(),J=Q.match(fY);if(J&&Rz(J[3],J[1])){let[,G,K,q]=J;return`<${G}${K}${X}>${q}</${G}>`}return`<template${X}>${Q}</template>`}function Rz($,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 q6($,Z){let Y=Fz($);function X(Q){let J=Q,G=/@if\s*\(/g,K,q=[];while((K=G.exec(J))!==null){let U=K.index,W=U+K[0].length,z=1,B=W;while(B<J.length&&z>0){if(J[B]==="(")z++;else if(J[B]===")")z--;B++}if(z!==0)continue;let _=J.substring(W,B-1).trim(),j=B,H=1,L=j,F=/@(if\s*\(|endif)/g;F.lastIndex=j;let O;while((O=F.exec(J))!==null)if(O[1].startsWith("if"))H++;else if(O[1]==="endif"){if(H--,H===0){L=O.index+O[0].length;break}}if(H!==0)continue;let V=J.substring(j,L-6).trim(),R;if(Lz(V)){let N=C5(J.substring(U,L));if(N.length===0)continue;let A=N[0].branches.filter((M)=>M.type!=="else");if(!(A.length>0&&A.every((M)=>vY(M.condition,Y,Z))))continue;R=N[0].branches.map((M)=>{let I=X(M.content);if(M.type==="elseif")return M$(I,"@else-if",M.condition??"");if(M.type==="else")return M$(I,"@else");return M$(I,"@if",M.condition??"")}).join(`
9373
+ `)}else{if(!vY(_,Y,Z))continue;R=M$(X(V),"@if",_)}q.push({start:U,end:L,replacement:R}),G.lastIndex=L}for(let U=q.length-1;U>=0;U--){let{start:W,end:z,replacement:B}=q[U];J=J.substring(0,W)+B+J.substring(z)}return J}return X($)}function Nz($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let Q=Number(Z);return Q!==0&&!Number.isNaN(Q)}let Y=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(Y)return Y[1].length>0;let X=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(X)return X[1].length>0;return}function Az($,Z,Y,X){if(K6.has(Y.toLowerCase()))return X;let Q=Y.toLowerCase(),J=$.toLowerCase(),G=$.length,K=1,q=X;while(q<G){let U=$.indexOf("<",q);if(U===-1)return-1;if(q=U,$.startsWith("<!--",q)){let _=$.indexOf("-->",q+4);if(_===-1)return-1;q=_+3;continue}let W=/^<(script|style)\b/i.exec($.slice(q,q+8));if(W){let _=$.indexOf(">",q);if(_===-1)return-1;if($[_-1]==="/"){q=_+1;continue}let j=J.indexOf(`</${W[1].toLowerCase()}`,q);if(j===-1)return-1;let H=$.indexOf(">",j);if(H===-1)return-1;q=H+1;continue}if($[q+1]==="/"){let _=/^<\/([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 B=$.indexOf(">",q);if(B===-1)return-1;if(z[1].toLowerCase()===Q){let _=$.slice(q,B+1);if(!(/\/\s*>$/.test(_)||K6.has(Q)))K++}q=B+1}return-1}function Tz($,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 wz.test(J)}function U6($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,X;while((X=Y.exec($))!==null)Z.push([X.index,X.index+X[0].length]);let Q=(z)=>Z.some(([B,_])=>z>=B&&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,B,_,j,H,L,F]=K,O=Nz(H);if(O===void 0)continue;let V=K.index,R=V+z.length,w=!!F||/\/\s*>$/.test(z)||K6.has(B.toLowerCase())?R:Az($,V,B,R);if(w===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&Tz($,w)){J.lastIndex=R;continue}if(O===!0){let M=`<${B}${_}${L}${F}>`;G.push({start:V,end:R,replacement:M});continue}G.push({start:V,end:w,replacement:""}),J.lastIndex=w}if(G.length===0)return $;G.sort((z,B)=>z.start-B.start);let q=[],U=-1;for(let z of G){if(z.start<U)continue;q.push(z),U=z.end}let W=$;for(let z=q.length-1;z>=0;z--){let{start:B,end:_,replacement:j}=q[z];W=W.substring(0,B)+j+W.substring(_)}return W}function W6($,Z){let Y=$,X=/@(for|foreach)\s*\(/g,Q,J=[];while((Q=X.exec(Y))!==null){let G=Q[1],K=Q.index,q=K+Q[0].length,U=1,W=q;while(W<Y.length&&U>0){if(Y[W]==="(")U++;else if(Y[W]===")")U--;W++}if(U!==0)continue;let z=Y.substring(q,W-1).trim(),B=W,_=hY(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 w=A.split(/[.[(]/)[0].trim();if(w&&w in Z)continue}}if(_.style==="as")z=_.indexVar?`(${_.itemVar}, ${_.indexVar}) in ${_.iterable}`:`${_.itemVar} in ${_.iterable}`;let j=G==="for"?"@endfor":"@endforeach",H=1,L=B,F=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");F.lastIndex=B;let O;while((O=F.exec(Y))!==null)if(O[1].startsWith(G))H++;else if(H--,H===0){L=O.index+O[0].length;break}if(H!==0)continue;let V=Y.substring(B,L-j.length).trim(),R=V.match(fY),N;if(R){let[,A,w,T]=R;N=`<${A}${w} @for="${z}">${T}</${A}>`}else N=`<template @for="${z}">${V}</template>`;J.push({start:K,end:L,replacement:N})}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:U}=J[G];Y=Y.substring(0,K)+U+Y.substring(q)}return Y}function Mz($){let Z=new Set,Y=[],X=0,Q=0,J=$.length,G=(W)=>{let z=X+1;while(z<J){let B=$[z];if(B==="\\"){z+=2;continue}if(B===W)return z+1;z++}return J},K=()=>{let W=X+2;while(W<J&&$[W]!==`
9374
+ `)W++;return W},q=()=>{let W=X+2;while(W<J-1){if($[W]==="*"&&$[W+1]==="/")return W+2;W++}return J},U=(W)=>{let z=W,B=0;while(z<J){let _=$[z];if(_==="/"&&$[z+1]==="/"){let j=z+2;while(j<J&&$[j]!==`
9375
+ `)j++;z=j;continue}if(_==="/"&&$[z+1]==="*"){let j=z+2;while(j<J-1&&!($[j]==="*"&&$[j+1]==="/"))j++;z=j+2;continue}if(_==='"'||_==="'"||_==="`"){let j=z+1;while(j<J){if($[j]==="\\"){j+=2;continue}if($[j]===_){j++;break}j++}z=j;continue}if(_==="("||_==="["||_==="{"){B++,z++;continue}if(_===")"||_==="]"||_==="}"){B--,z++;continue}if(_===";"&&B===0)return z+1;z++}return J};while(X<J){let W=$[X];if(W==="/"&&$[X+1]==="/"){let z=K();Y.push($.slice(X,z)),X=z;continue}if(W==="/"&&$[X+1]==="*"){let z=q();Y.push($.slice(X,z)),X=z;continue}if(W==='"'||W==="'"||W==="`"){let z=G(W);Y.push($.slice(X,z)),X=z;continue}if(W==="{"){Q++,Y.push(W),X++;continue}if(W==="}"){Q--,Y.push(W),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 j=_[2],H=U(X+_[0].length);if(Z.has(j)){Y.push(`/* stx: deduped const ${j} */`),X=H;continue}Z.add(j),Y.push($.slice(X,H)),X=H;continue}}}Y.push(W),X++}return Y.join("")}async function dY($,Z,Y){let X=gY($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Q=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,J=[];for(let H of X){let L=H.body;if(L1(H.attrs))L=F1(L);if(Q.test(L))J.push({fullMatch:H.fullMatch,attrs:H.attrs,content:L})}if(J.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${Oz++}`,{hasUserImports:K,bundleClientScript:q}=await Promise.resolve().then(() => (Z4(),$4)),U=[];for(let H=0;H<J.length;H++){let L=J[H].content;if(K(L))console.log("[stx:bundler] bundling signal script imports"),L=await q(L,Z||"",{projectRoot:process.cwd()});L=L.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(O,V)=>uY(V));let F=t0(L);U.push(`// \u2500\u2500 merged signal script #${H+1} \u2500\u2500
9376
+ ${F}`)}let W=U.join(`
9377
+
9378
+ `);W=Mz(W);let z=mY(W),B=Y4(W,Y),_=`
9306
9379
  <script data-stx-scoped>
9307
9380
  function ${G}() {
9308
9381
  const { state, derived, effect, batch, onMount, onDestroy, defineStore, useStore, useFetch, useRef, useQuery, useMutation, useOptimistic, useDebounce, useDebouncedValue, useThrottle, useInterval, useTimeout, useToggle, useCounter, useClickOutside, useFocus, useAsync, useLocalStorage, useSessionStorage, useCookie, useReactiveProp, useEventListener, useWebSocket, useColorMode, useDark, useHead, useSeoMeta, definePageMeta, useRoute, useSearchParams, navigate, goBack, goForward, provide, ref, reactive, computed, watch, watchEffect, defineProps, withDefaults, defineEmits, defineExpose, defineSlots } = window.stx;
9309
- ${B}${U}
9382
+ ${B}${W}
9310
9383
  return { ${z} };
9311
9384
  }
9312
9385
  if(window.stx)window.stx._latestSetup=${G};
9313
- </script>`,j=$;for(let H of J)j=j.split(H.fullMatch).join("");if(j.includes("<body"))j=j.replace(/<body([^>]*)>/,`<body$1 data-stx="${G}">`);else{let H=["script","style","html","head","meta","link","title","!doctype"],L=!1;j=j.replace(/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>/gi,(F,O,V)=>{if(L||H.includes(O.toLowerCase()))return F;return L=!0,`<${O}${V} data-stx="${G}">`})}return{output:j,setupCode:_}}function h2($){let Z=$,Y=[],X=new Set,Q=0,J=0,G=Z.length,K="",q=()=>{J++;let j=!1;while(J<G){let H=Z[J];if(H==="\\"){J+=2;continue}if(H==="["&&!j){j=!0,J++;continue}if(H==="]"&&j){j=!1,J++;continue}if(H==="/"&&!j){J++;while(J<G&&/[gimsuyd]/.test(Z[J]))J++;return}if(H===`
9314
- `)return;J++}},W=()=>{if(!K)return!0;if(/[\w)\]]/.test(K))return!1;return!0},U=(j)=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]===j){J++;return}J++}},z=()=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]==="`"){J++;return}if(Z[J]==="$"&&Z[J+1]==="{"){J+=2;let j=1;while(J<G&&j>0)if(Z[J]==="{")j++,J++;else if(Z[J]==="}")j--,J++;else if(Z[J]==="'"||Z[J]==='"')U(Z[J]);else if(Z[J]==="`")z();else J++;continue}J++}},B=()=>{if(Z[J]==="/"&&Z[J+1]==="/"){while(J<G&&Z[J]!==`
9315
- `)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 j=Z.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(j){let V=j[2];if(!X.has(V))Y.push(V),X.add(V);return}let H=Z.slice(J).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((V)=>{let R=V.trim();if(!R)return;let A=R.indexOf(":"),w=(A>=0?R.slice(A+1).trim():R).split(/[\s=]/)[0];if(w&&!X.has(w))Y.push(w),X.add(w)});return}let L=Z.slice(J).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(L){L[1].split(",").forEach((V)=>{let R=V.trim().replace(/^\.\.\./,"");if(!R)return;let A=R.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(B())continue;if(Z[J]==="'"||Z[J]==='"'){U(Z[J]),K=Z[J-1];continue}if(Z[J]==="`"){z(),K="`";continue}if(Z[J]==="/"&&Z[J+1]!=="/"&&Z[J+1]!=="*"&&W()){q(),K="/";continue}if(Z[J]==="{"){Q++,K="{",J++;continue}if(Z[J]==="}"){Q--,K="}",J++;continue}if(Q===0&&/[a-z]/i.test(Z[J])&&(J===0||/\s|[;{}()]/.test(Z[J-1])))_();if(!/\s/.test(Z[J]))K=Z[J];J++}return Y.join(", ")}async function W6($,Z,Y,X){if(!D$($))return $;let Q=$;if(Z.skipSignalsRuntime)return Q;let{output:J,setupCode:G}=await g2(Q,Y,X);if(Q=J,Q=await k2(Q,Z),Q=E2(Q),G){let U=I$(Q,/<\/head>/i),z=U===-1?I$(Q,/<body[^>]*>/i):-1;if(U!==-1)Q=`${Q.slice(0,U)}${G}
9316
- ${Q.slice(U)}`;else if(z!==-1){let B=/<body[^>]*>/i.exec(Q.slice(z))[0],_=z+B.length;Q=`${Q.slice(0,_)}
9386
+ </script>`,j=$;for(let H of J)j=j.split(H.fullMatch).join("");if(j.includes("<body"))j=j.replace(/<body([^>]*)>/,`<body$1 data-stx="${G}">`);else{let H=["script","style","html","head","meta","link","title","!doctype"],L=!1;j=j.replace(/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>/gi,(F,O,V)=>{if(L||H.includes(O.toLowerCase()))return F;return L=!0,`<${O}${V} data-stx="${G}">`})}return{output:j,setupCode:_}}function mY($){let Z=$,Y=[],X=new Set,Q=0,J=0,G=Z.length,K="",q=()=>{J++;let j=!1;while(J<G){let H=Z[J];if(H==="\\"){J+=2;continue}if(H==="["&&!j){j=!0,J++;continue}if(H==="]"&&j){j=!1,J++;continue}if(H==="/"&&!j){J++;while(J<G&&/[gimsuyd]/.test(Z[J]))J++;return}if(H===`
9387
+ `)return;J++}},U=()=>{if(!K)return!0;if(/[\w)\]]/.test(K))return!1;return!0},W=(j)=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]===j){J++;return}J++}},z=()=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]==="`"){J++;return}if(Z[J]==="$"&&Z[J+1]==="{"){J+=2;let j=1;while(J<G&&j>0)if(Z[J]==="{")j++,J++;else if(Z[J]==="}")j--,J++;else if(Z[J]==="'"||Z[J]==='"')W(Z[J]);else if(Z[J]==="`")z();else J++;continue}J++}},B=()=>{if(Z[J]==="/"&&Z[J+1]==="/"){while(J<G&&Z[J]!==`
9388
+ `)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 j=Z.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(j){let V=j[2];if(!X.has(V))Y.push(V),X.add(V);return}let H=Z.slice(J).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((V)=>{let R=V.trim();if(!R)return;let N=R.indexOf(":"),w=(N>=0?R.slice(N+1).trim():R).split(/[\s=]/)[0];if(w&&!X.has(w))Y.push(w),X.add(w)});return}let L=Z.slice(J).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(L){L[1].split(",").forEach((V)=>{let R=V.trim().replace(/^\.\.\./,"");if(!R)return;let N=R.split(/[\s=]/)[0];if(N&&!X.has(N))Y.push(N),X.add(N)});return}let F=Z.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let V=F[1];if(!X.has(V))Y.push(V),X.add(V);return}let O=Z.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let V=O[1];if(!X.has(V))Y.push(V),X.add(V)}};while(J<G){if(B())continue;if(Z[J]==="'"||Z[J]==='"'){W(Z[J]),K=Z[J-1];continue}if(Z[J]==="`"){z(),K="`";continue}if(Z[J]==="/"&&Z[J+1]!=="/"&&Z[J+1]!=="*"&&U()){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 z6($,Z,Y,X){if(!D$($))return $;let Q=$;if(Z.skipSignalsRuntime)return Q;let{output:J,setupCode:G}=await dY(Q,Y,X);if(Q=J,Q=await SY(Q,Z),Q=bY(Q),G){let W=I$(Q,/<\/head>/i),z=W===-1?I$(Q,/<body[^>]*>/i):-1;if(W!==-1)Q=`${Q.slice(0,W)}${G}
9389
+ ${Q.slice(W)}`;else if(z!==-1){let B=/<body[^>]*>/i.exec(Q.slice(z))[0],_=z+B.length;Q=`${Q.slice(0,_)}
9317
9390
  ${G}${Q.slice(_)}`}else Q=`${Q}
9318
- ${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=I$(Q,U);if(z!==-1){let B=Q.slice(0,z),_=Q.slice(z).replace(U,(j)=>j.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));Q=B+_}}return Q}function I$($,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 d2($){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 C2;return`const ${Z.join(", ")}; ${C2}`}var Bz=0,T$,v2,y2,G6,Vz,C2="// [stx import stripped \u2014 resolved via window.stx in __stx_setup]";var z6=b(()=>{O5();a4();H0();T$=/<script\b([^>]*)>/gi,v2=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;y2=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"]);G6=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);Vz=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import Z5 from"path";function u2($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function l2($,Z,Y){try{let X;if($.startsWith("/")){let Q=Z;for(let J=0;J<5;J++){let G=Z5.join(Q,$);if(await Bun.file(G).exists())return G;Q=Z5.dirname(Q)}X=Z5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))X=Z5.resolve(Z,$);else X=Z5.resolve(Z,$);if(await Bun.file(X).exists())return X;return null}catch{return null}}async function p2($,Z,Y){let X=$,Q=Z5.dirname(Z),J=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=J.exec(X))!==null){let[W,U,z,B]=G;if(u2(z))continue;let _=await l2(z,Q,Z);if(_)try{let j=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)j=await L.outputs[0].text()}let H=`<script>
9391
+ ${G}`}let q=Q.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),U=q&&/data-stx/.test(q[1]);if(!G&&!U&&q&&!/data-stx-auto/.test(q[1])){let W=/<body[^>]*>/i,z=I$(Q,W);if(z!==-1){let B=Q.slice(0,z),_=Q.slice(z).replace(W,(j)=>j.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));Q=B+_}}return Q}function I$($,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(([W,z])=>q>=W&&q<z))return q;G=q+Math.max(K[0].length,1)}return-1}function uY($){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 xY;return`const ${Z.join(", ")}; ${xY}`}var Oz=0,T$,fY,CY,K6,wz,xY="// [stx import stripped \u2014 resolved via window.stx in __stx_setup]";var B6=b(()=>{F5();a4();H0();T$=/<script\b([^>]*)>/gi,fY=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;CY=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"]);K6=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);wz=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import Z5 from"path";function pY($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function cY($,Z,Y){try{let X;if($.startsWith("/")){let Q=Z;for(let J=0;J<5;J++){let G=Z5.join(Q,$);if(await Bun.file(G).exists())return G;Q=Z5.dirname(Q)}X=Z5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))X=Z5.resolve(Z,$);else X=Z5.resolve(Z,$);if(await Bun.file(X).exists())return X;return null}catch{return null}}async function iY($,Z,Y){let X=$,Q=Z5.dirname(Z),J=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=J.exec(X))!==null){let[U,W,z,B]=G;if(pY(z))continue;let _=await cY(z,Q,Z);if(_)try{let j=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)j=await L.outputs[0].text()}let H=`<script>
9319
9392
  // Source: ${z}
9320
9393
  ${j}
9321
- </script>`;X=X.replace(W,H),J.lastIndex=0}catch(j){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(X))!==null){let[W,U,z,B]=q,_=U+B;if(u2(z))continue;if(/rel=["']stylesheet["']/.test(_)||z.endsWith(".css")){let H=await l2(z,Q,Z);if(H)try{let L=await Bun.file(H).text();Y.add(H);let F=`<style>
9394
+ </script>`;X=X.replace(U,H),J.lastIndex=0}catch(j){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(X))!==null){let[U,W,z,B]=q,_=W+B;if(pY(z))continue;if(/rel=["']stylesheet["']/.test(_)||z.endsWith(".css")){let H=await cY(z,Q,Z);if(H)try{let L=await Bun.file(H).text();Y.add(H);let F=`<style>
9322
9395
  /* Source: ${z} */
9323
9396
  ${L}
9324
- </style>`;X=X.replace(W,F),K.lastIndex=0}catch(L){}}}return X}var c2=b(()=>{h1()});function E$($,Z){let Y=$,X=/@json\s*\(/g,Q;while((Q=X.exec(Y))!==null){let J=Q.index,G=J+Q[0].length-1,K=1,q=G+1,W=null,U=!1;while(q<Y.length&&K>0){let V=Y[q];if(U){U=!1,q++;continue}if(V==="\\"&&W){U=!0,q++;continue}if(W){if(V===W)W=null;q++;continue}if(V==='"'||V==="'"||V==="`"){W=V,q++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}q++}if(K!==0)break;let z=Y.substring(G+1,q).trim(),B=Y.substring(J,q+1),_=-1,j=0,H=null,L=!1;for(let V=0;V<z.length;V++){let R=z[V];if(L){L=!1;continue}if(R==="\\"&&H){L=!0;continue}if(H){if(R===H)H=null;continue}if(R==='"'||R==="'"||R==="`"){H=R;continue}if(R==="("||R==="["||R==="{")j++;else if(R===")"||R==="]"||R==="}")j--;if(R===","&&j===0){_=V;break}}let F=_>=0?z.substring(0,_).trim():z,O=_>=0?z.substring(_+1).trim():void 0;try{let V=F.trim(),R;if(X0(V))R=J0(V,Object.keys(Z))(...Object.values(Z));else R=void 0;let A;if(O==="true")A=JSON.stringify(R,null,2);else A=JSON.stringify(R);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){m0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),X.lastIndex=J+B.length}}return Y}function k$($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function i2($){let Z=$,Y=/@memo\s*\(/g,X,Q=[];while((X=Y.exec(Z))!==null){let J=X.index,G=J+X[0].length,K=1,q=G;while(q<Z.length&&K>0){if(Z[q]==="(")K++;else if(Z[q]===")")K--;q++}if(K!==0)continue;let W=Z.slice(G,q-1).trim(),U=q,z=Z.slice(U),B=z.indexOf("@endmemo");if(B===-1)continue;let _=z.slice(0,B),j=U+B+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,R=F.slice(0,F.length-V),A=R.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),N;if(A){let[w,T,M="",I]=A,D=`<${T}${M} data-stx-memo="${W}"${I}>`;N=_.slice(0,L)+D+R.slice(w.length)+_.slice(L+R.length)}else N=`${_.slice(0,L)}<div data-stx-memo="${W}">${R}</div>${_.slice(L+R.length)}`;Q.push({start:J,end:j,replacement:N}),Y.lastIndex=j}for(let J=Q.length-1;J>=0;J--){let G=Q[J];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function B6($){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 n2($){let Y=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),X="",Q=0,J;while((J=Y.exec($))!==null){let G=J.index,K=G+J[0].length,q=!1,W=!1,U=-1;while(K<$.length){let H=$[K];if(q){if(H==="'")q=!1}else if(W){if(H==='"')W=!1}else if(H==="'")q=!0;else if(H==='"')W=!0;else if(H===">"){U=K;break}K++}if(U===-1)continue;if($.slice(G,U+1).includes("x-cloak"))continue;let B=$.slice(U+1),_=B.indexOf("</"),j=_>=0?B.slice(0,_):B.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(j))X+=$.slice(Q,U)+" x-cloak>",Q=U+1}return X+=$.slice(Q),X}function o2($){let Z=/<[a-z][\w-]*/gi,Y="",X=0,Q;while((Q=Z.exec($))!==null){let J=Q.index,G=Q[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let j=`</${G}>`,H=$.toLowerCase().indexOf(j,J);if(H!==-1)Z.lastIndex=H+j.length;continue}let K=J+Q[0].length,q=!1,W=!1,U=-1;while(K<$.length){let j=$[K];if(q){if(j==="'")q=!1}else if(W){if(j==='"')W=!1}else if(j==="'")q=!0;else if(j==='"')W=!0;else if(j===">"){U=K;break}K++}if(U===-1)continue;let z=$.slice(J+Q[0].length,U);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(z))continue;if(!Nz.test(z))continue;let B=$[U-1]==="/",_=B?U-1:U;Y+=`${$.slice(X,_)} x-cloak${B?" ":""}`,X=_}return Y+=$.slice(X),Y}var Nz;var _6=b(()=>{t0();L0();Nz=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function b$($,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 wz){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(`
9325
- `),z=[];U.forEach((_,j)=>{if(G.lastIndex=0,G.test(_))z.push(j+1)});let B=z.length>0?` (line${z.length>1?"s":""}: ${z.join(", ")})`:"";J.push(` \u2717 ${K}${B}
9397
+ </style>`;X=X.replace(U,F),K.lastIndex=0}catch(L){}}}return X}var nY=b(()=>{h1()});function E$($,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,U=null,W=!1;while(q<Y.length&&K>0){let V=Y[q];if(W){W=!1,q++;continue}if(V==="\\"&&U){W=!0,q++;continue}if(U){if(V===U)U=null;q++;continue}if(V==='"'||V==="'"||V==="`"){U=V,q++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}q++}if(K!==0)break;let z=Y.substring(G+1,q).trim(),B=Y.substring(J,q+1),_=-1,j=0,H=null,L=!1;for(let V=0;V<z.length;V++){let R=z[V];if(L){L=!1;continue}if(R==="\\"&&H){L=!0;continue}if(H){if(R===H)H=null;continue}if(R==='"'||R==="'"||R==="`"){H=R;continue}if(R==="("||R==="["||R==="{")j++;else if(R===")"||R==="]"||R==="}")j--;if(R===","&&j===0){_=V;break}}let F=_>=0?z.substring(0,_).trim():z,O=_>=0?z.substring(_+1).trim():void 0;try{let V=F.trim(),R;if(X0(V))R=J0(V,Object.keys(Z))(...Object.values(Z));else R=void 0;let N;if(O==="true")N=JSON.stringify(R,null,2);else N=JSON.stringify(R);let A=N.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){m0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),X.lastIndex=J+B.length}}return Y}function k$($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function oY($){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 U=Z.slice(G,q-1).trim(),W=q,z=Z.slice(W),B=z.indexOf("@endmemo");if(B===-1)continue;let _=z.slice(0,B),j=W+B+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,R=F.slice(0,F.length-V),N=R.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),A;if(N){let[w,T,M="",I]=N,D=`<${T}${M} data-stx-memo="${U}"${I}>`;A=_.slice(0,L)+D+R.slice(w.length)+_.slice(L+R.length)}else A=`${_.slice(0,L)}<div data-stx-memo="${U}">${R}</div>${_.slice(L+R.length)}`;Q.push({start:J,end:j,replacement:A}),Y.lastIndex=j}for(let J=Q.length-1;J>=0;J--){let G=Q[J];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function _6($){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 sY($){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,U=!1,W=-1;while(K<$.length){let H=$[K];if(q){if(H==="'")q=!1}else if(U){if(H==='"')U=!1}else if(H==="'")q=!0;else if(H==='"')U=!0;else if(H===">"){W=K;break}K++}if(W===-1)continue;if($.slice(G,W+1).includes("x-cloak"))continue;let B=$.slice(W+1),_=B.indexOf("</"),j=_>=0?B.slice(0,_):B.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(j))X+=$.slice(Q,W)+" x-cloak>",Q=W+1}return X+=$.slice(Q),X}function rY($){let Z=/<[a-z][\w-]*/gi,Y="",X=0,Q;while((Q=Z.exec($))!==null){let J=Q.index,G=Q[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let j=`</${G}>`,H=$.toLowerCase().indexOf(j,J);if(H!==-1)Z.lastIndex=H+j.length;continue}let K=J+Q[0].length,q=!1,U=!1,W=-1;while(K<$.length){let j=$[K];if(q){if(j==="'")q=!1}else if(U){if(j==='"')U=!1}else if(j==="'")q=!0;else if(j==='"')U=!0;else if(j===">"){W=K;break}K++}if(W===-1)continue;let z=$.slice(J+Q[0].length,W);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(z))continue;if(!Iz.test(z))continue;let B=$[W-1]==="/",_=B?W-1:W;Y+=`${$.slice(X,_)} x-cloak${B?" ":""}`,X=_}return Y+=$.slice(X),Y}var Iz;var j6=b(()=>{e0();L0();Iz=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function b$($,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 Dz){if(Q.some((W)=>K.includes(W)||G.source.includes(W)))continue;G.lastIndex=0;let U=$.match(G);if(U&&U.length>0){let W=$.split(`
9398
+ `),z=[];W.forEach((_,j)=>{if(G.lastIndex=0,G.test(_))z.push(j+1)});let B=z.length>0?` (line${z.length>1?"s":""}: ${z.join(", ")})`:"";J.push(` \u2717 ${K}${B}
9326
9399
  \u2192 ${q}`)}}if(J.length>0&&X.enabled){let K=`[STX] DOM API violation in ${Z.split("/").pop()||Z}:
9327
9400
  ${J.join(`
9328
9401
  `)}
9329
- Tip: prefer useRef(), navigate(), and composables for component code`;if(X.failOnViolation)throw Error(K);else console.warn(K)}}var wz;var j6=b(()=>{wz=[{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 s2={};o(s2,{getStoreScript:()=>Tz,clearStoreCache:()=>Mz});import S$ from"path";async function Tz($){let Z;if($)Z=S$.resolve($);else{let U=await i4();Z=S$.resolve(U.root||process.cwd(),U.storesDir||"stores")}let Y=Y5.get(Z);if(Y!==void 0)return Y||null;let X=new Bun.Glob("*.ts"),Q=[];try{for await(let U of X.scan({cwd:Z,absolute:!0})){let z=S$.basename(U,".ts");if(["index","types"].includes(z))continue;if(U.includes(".d.ts"))continue;Q.push(U)}}catch{return Y5.set(Z,""),null}if(Q.length===0)return Y5.set(Z,""),null;let J=[];for(let U of Q){let z=await Bun.file(U).text();J.push({file:U,hasUseStore:/useStore\s*\(/.test(z)})}J.sort((U,z)=>{if(U.hasUseStore===z.hasUseStore)return 0;return U.hasUseStore?1:-1});let G=J.map((U)=>U.file),K=[],q=new Bun.Transpiler({loader:"ts",target:"browser",define:l0()});for(let U of G)try{let z=await Bun.file(U).text(),B=S$.basename(U,".ts");z=z.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),z=z.replace(/^export\s+(default\s+)?/gm,""),z=q.transformSync(z),K.push(`// Store: ${B}
9330
- ${z.trim()}`)}catch(z){console.warn(`[stx] Failed to load store ${U}:`,z)}if(K.length===0)return Y5.set(Z,""),null;let W=`;(function(){
9402
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(X.failOnViolation)throw Error(K);else console.warn(K)}}var Dz;var H6=b(()=>{Dz=[{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 aY={};o(aY,{getStoreScript:()=>Ez,clearStoreCache:()=>kz});import S$ from"path";async function Ez($){let Z;if($)Z=S$.resolve($);else{let W=await i4();Z=S$.resolve(W.root||process.cwd(),W.storesDir||"stores")}let Y=Y5.get(Z);if(Y!==void 0)return Y||null;let X=new Bun.Glob("*.ts"),Q=[];try{for await(let W of X.scan({cwd:Z,absolute:!0})){let z=S$.basename(W,".ts");if(["index","types"].includes(z))continue;if(W.includes(".d.ts"))continue;Q.push(W)}}catch{return Y5.set(Z,""),null}if(Q.length===0)return Y5.set(Z,""),null;let J=[];for(let W of Q){let z=await Bun.file(W).text();J.push({file:W,hasUseStore:/useStore\s*\(/.test(z)})}J.sort((W,z)=>{if(W.hasUseStore===z.hasUseStore)return 0;return W.hasUseStore?1:-1});let G=J.map((W)=>W.file),K=[],q=new Bun.Transpiler({loader:"ts",target:"browser",define:l0()});for(let W of G)try{let z=await Bun.file(W).text(),B=S$.basename(W,".ts");z=z.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),z=z.replace(/^export\s+(default\s+)?/gm,""),z=q.transformSync(z),K.push(`// Store: ${B}
9403
+ ${z.trim()}`)}catch(z){console.warn(`[stx] Failed to load store ${W}:`,z)}if(K.length===0)return Y5.set(Z,""),null;let U=`;(function(){
9331
9404
  ${K.join(`
9332
9405
 
9333
9406
  `)}
9334
- })();`;return Y5.set(Z,W),W}function Mz(){Y5.clear()}var Y5;var r2=b(()=>{b5();h1();Y5=new Map});var t2={};o(t2,{processDeferDirectives:()=>bz});function Iz(){return`stx-defer-${++a2}`}function Dz($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function Ez($,Z,Y){let{trigger:X,value:Q}=Dz(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 kz($,Z){let{trigger:Y,triggerValue:X}=Z,Q;switch(Y){case"visible":Q=`
9407
+ })();`;return Y5.set(Z,U),U}function kz(){Y5.clear()}var Y5;var tY=b(()=>{y5();h1();Y5=new Map});var $X={};o($X,{processDeferDirectives:()=>Cz});function bz(){return`stx-defer-${++eY}`}function Sz($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function yz($,Z,Y){let{trigger:X,value:Q}=Sz(Z),J=Y,G,K,q,U=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(U)G=U[1].trim(),J=J.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let W=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(W)K=W[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 Pz($,Z){let{trigger:Y,triggerValue:X}=Z,Q;switch(Y){case"visible":Q=`
9335
9408
  const observer = new IntersectionObserver((entries) => {
9336
9409
  if (entries[0].isIntersecting) {
9337
9410
  observer.disconnect();
@@ -9404,15 +9477,15 @@ else {
9404
9477
  ${Q}
9405
9478
  })();
9406
9479
  </script>
9407
- `}function bz($,Z,Y){a2=0;let X=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(X,(Q,J,G)=>{let K=Iz(),q=Ez(Q,J,G),W=q.placeholder?`<div data-defer-placeholder>${q.placeholder}</div>`:"",U=q.loading?`<div data-defer-loading style="display: none;">${q.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',z=q.error?`<div data-defer-error style="display: none;">${q.error}</div>`:"",B=`<div data-defer-content style="display: none;">${q.content}</div>`,_=kz(K,q);return`
9480
+ `}function Cz($,Z,Y){eY=0;let X=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(X,(Q,J,G)=>{let K=bz(),q=yz(Q,J,G),U=q.placeholder?`<div data-defer-placeholder>${q.placeholder}</div>`:"",W=q.loading?`<div data-defer-loading style="display: none;">${q.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',z=q.error?`<div data-defer-error style="display: none;">${q.error}</div>`:"",B=`<div data-defer-content style="display: none;">${q.content}</div>`,_=Pz(K,q);return`
9408
9481
  <div id="${K}" class="stx-defer" data-defer-trigger="${q.trigger}">
9409
- ${W}
9410
9482
  ${U}
9483
+ ${W}
9411
9484
  ${B}
9412
9485
  ${z}
9413
9486
  </div>
9414
9487
  ${_}
9415
- `})}var a2=0;var $X={};o($X,{processTeleportDirectives:()=>Cz,ensureTeleportTargets:()=>vz});function Sz(){return`stx-teleport-${++e2}`}function yz($){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 Pz($,Z){return`
9488
+ `})}var eY=0;var YX={};o(YX,{processTeleportDirectives:()=>gz,ensureTeleportTargets:()=>hz});function vz(){return`stx-teleport-${++ZX}`}function xz($){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 fz($,Z){return`
9416
9489
  <script>
9417
9490
  (function() {
9418
9491
  const source = document.getElementById('${$}');
@@ -9458,12 +9531,12 @@ else {
9458
9531
  });
9459
9532
  })();
9460
9533
  </script>
9461
- `}function Cz($,Z,Y){e2=0;let X=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(X,(Q,J,G)=>{let K=Sz(),{target:q,disabled:W}=yz(J),U=G.trim();if(W)try{let B=!1;if(W==="true")B=!0;else if(W==="false")B=!1;else if(W in Z)B=Boolean(Z[W]);if(B)return`<div class="stx-teleport-inline" data-teleport-disabled>${U}</div>`}catch{}let z=Pz(K,q);return`
9534
+ `}function gz($,Z,Y){ZX=0;let X=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(X,(Q,J,G)=>{let K=vz(),{target:q,disabled:U}=xz(J),W=G.trim();if(U)try{let B=!1;if(U==="true")B=!0;else if(U==="false")B=!1;else if(U in Z)B=Boolean(Z[U]);if(B)return`<div class="stx-teleport-inline" data-teleport-disabled>${W}</div>`}catch{}let z=fz(K,q);return`
9462
9535
  <div id="${K}" class="stx-teleport-source" style="display: none;">
9463
- <template>${U}</template>
9536
+ <template>${W}</template>
9464
9537
  </div>
9465
9538
  ${z}
9466
- `})}function vz(){return`
9539
+ `})}function hz(){return`
9467
9540
  <script>
9468
9541
  (function() {
9469
9542
  // Common teleport targets
@@ -9480,23 +9553,23 @@ else {
9480
9553
  });
9481
9554
  })();
9482
9555
  </script>
9483
- `}var e2=0;var JX={};o(JX,{processTransitionDirectives:()=>hz,processTransitionAttributes:()=>lz,performLeave:()=>gz,performEnter:()=>fz,generateTransitionRuntime:()=>uz,generateTransitionCSS:()=>mz});function ZX($,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 xz($){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 YX($,Z){return new Promise((Y)=>{let X=Z??xz($);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 XX($){$.offsetHeight}async function fz($,Z={}){let Y=Z.name||"stx",X=ZX(Y,Z),Q=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(X.enterFrom),$.classList.add(X.enterActive),XX($),$.classList.remove(X.enterFrom),$.classList.add(X.enterTo),Z.onEnter)await new Promise((J)=>{Z.onEnter($,J)});else await YX($,Q);$.classList.remove(X.enterActive),$.classList.remove(X.enterTo),Z.onAfterEnter?.($)}async function gz($,Z={}){let Y=Z.name||"stx",X=ZX(Y,Z),Q=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(X.leaveFrom),$.classList.add(X.leaveActive),XX($),$.classList.remove(X.leaveFrom),$.classList.add(X.leaveTo),Z.onLeave)await new Promise((J)=>{Z.onLeave($,J)});else await YX($,Q);$.classList.remove(X.leaveActive),$.classList.remove(X.leaveTo),Z.onAfterLeave?.($)}function hz($,Z={},Y){let X=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(X,(Q,J,G)=>{let K=dz(J),q=K.name||"stx",W=K.duration||300,U=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
9556
+ `}var ZX=0;var GX={};o(GX,{processTransitionDirectives:()=>lz,processTransitionAttributes:()=>nz,performLeave:()=>uz,performEnter:()=>mz,generateTransitionRuntime:()=>iz,generateTransitionCSS:()=>cz});function XX($,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 dz($){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 JX($,Z){return new Promise((Y)=>{let X=Z??dz($);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 QX($){$.offsetHeight}async function mz($,Z={}){let Y=Z.name||"stx",X=XX(Y,Z),Q=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(X.enterFrom),$.classList.add(X.enterActive),QX($),$.classList.remove(X.enterFrom),$.classList.add(X.enterTo),Z.onEnter)await new Promise((J)=>{Z.onEnter($,J)});else await JX($,Q);$.classList.remove(X.enterActive),$.classList.remove(X.enterTo),Z.onAfterEnter?.($)}async function uz($,Z={}){let Y=Z.name||"stx",X=XX(Y,Z),Q=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(X.leaveFrom),$.classList.add(X.leaveActive),QX($),$.classList.remove(X.leaveFrom),$.classList.add(X.leaveTo),Z.onLeave)await new Promise((J)=>{Z.onLeave($,J)});else await JX($,Q);$.classList.remove(X.leaveActive),$.classList.remove(X.leaveTo),Z.onAfterLeave?.($)}function lz($,Z={},Y){let X=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(X,(Q,J,G)=>{let K=pz(J),q=K.name||"stx",U=K.duration||300,W=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
9484
9557
  <div
9485
9558
  class="stx-transition-wrapper"
9486
9559
  data-transition="${q}"
9487
- data-transition-id="${U}"
9488
- data-transition-duration="${W}"
9560
+ data-transition-id="${W}"
9561
+ data-transition-duration="${U}"
9489
9562
  ${K.mode?`data-transition-mode="${K.mode}"`:""}
9490
9563
  >
9491
9564
  ${G.trim()}
9492
9565
  </div>
9493
9566
  <script>
9494
9567
  (function() {
9495
- const wrapper = document.querySelector('[data-transition-id="${U}"]');
9568
+ const wrapper = document.querySelector('[data-transition-id="${W}"]');
9496
9569
  if (!wrapper) return;
9497
9570
 
9498
9571
  const name = '${q}';
9499
- const duration = ${W};
9572
+ const duration = ${U};
9500
9573
 
9501
9574
  // Observe for child changes to trigger transitions
9502
9575
  const observer = new MutationObserver(function(mutations) {
@@ -9522,7 +9595,7 @@ else {
9522
9595
  });
9523
9596
  })();
9524
9597
  </script>
9525
- `})}function dz($){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 mz(){return`
9598
+ `})}function pz($){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 cz(){return`
9526
9599
  /* STX Transition Presets */
9527
9600
 
9528
9601
  /* Fade */
@@ -9709,7 +9782,7 @@ else {
9709
9782
  opacity: 1;
9710
9783
  max-height: 1000px;
9711
9784
  }
9712
- `}function uz(){return`
9785
+ `}function iz(){return`
9713
9786
  // STX Transition Runtime
9714
9787
  (function() {
9715
9788
  if (typeof window === 'undefined') return;
@@ -9798,7 +9871,7 @@ else {
9798
9871
 
9799
9872
  console.log('[stx] Transition runtime initialized');
9800
9873
  })();
9801
- `}function lz($){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 GX={};o(GX,{withErrorBoundary:()=>QX,processErrorBoundaryDirectives:()=>iz,generateErrorBoundaryRuntime:()=>az,generateErrorBoundaryCSS:()=>rz,createErrorBoundary:()=>sz});function cz(){return`eb-${++pz}-${Date.now().toString(36)}`}function iz($,Z={},Y){let X=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(X,(Q,J,G,K)=>{let q=cz(),W=nz(J||"");return oz(q,G.trim(),K.trim(),W)})}function nz($){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 oz($,Z,Y,X){let Q=X.logErrors!==!1;return`
9874
+ `}function nz($){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 qX={};o(qX,{withErrorBoundary:()=>KX,processErrorBoundaryDirectives:()=>rz,generateErrorBoundaryRuntime:()=>ZB,generateErrorBoundaryCSS:()=>$B,createErrorBoundary:()=>ez});function sz(){return`eb-${++oz}-${Date.now().toString(36)}`}function rz($,Z={},Y){let X=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(X,(Q,J,G,K)=>{let q=sz(),U=az(J||"");return tz(q,G.trim(),K.trim(),U)})}function az($){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 tz($,Z,Y,X){let Q=X.logErrors!==!1;return`
9802
9875
  <div class="stx-error-boundary" data-boundary-id="${$}" data-has-error="false">
9803
9876
  <div class="stx-error-boundary-content" data-boundary-content="${$}">
9804
9877
  ${Z}
@@ -9918,7 +9991,7 @@ else {
9918
9991
  };
9919
9992
  })();
9920
9993
  </script>
9921
- `}async function QX($,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 sz($,Z={}){let Y=Z.onError?(X)=>Z.onError(X,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(X)=>QX(X,$,Y)}function rz(){return`
9994
+ `}async function KX($,Z,Y){try{return await $()}catch(X){if(Y)Y(X instanceof Error?X:Error(String(X)));else console.error("[stx:errorBoundary] SSR Error:",X);return Z}}function ez($,Z={}){let Y=Z.onError?(X)=>Z.onError(X,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(X)=>KX(X,$,Y)}function $B(){return`
9922
9995
  /* STX Error Boundary Styles */
9923
9996
  .stx-error-boundary {
9924
9997
  position: relative;
@@ -9962,7 +10035,7 @@ else {
9962
10035
  color: #fecaca;
9963
10036
  }
9964
10037
  }
9965
- `}function az(){return`
10038
+ `}function ZB(){return`
9966
10039
  // STX Error Boundary Runtime
9967
10040
  (function() {
9968
10041
  if (typeof window === 'undefined') return;
@@ -10027,7 +10100,7 @@ else {
10027
10100
 
10028
10101
  console.log('[stx] Error boundary runtime initialized');
10029
10102
  })();
10030
- `}var pz=0;var KX={};o(KX,{renderSSRSuspense:()=>JB,processSuspenseDirectives:()=>$B,generateSuspenseRuntime:()=>GB,generateSuspenseCSS:()=>QB,createSSRSuspense:()=>XB});function ez(){return`suspense-${++tz}-${Date.now().toString(36)}`}function $B($,Z={},Y){let X=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(X,(Q,J,G,K)=>{let q=ez(),W=ZB(J||"");return YB(q,G.trim(),K.trim(),W)})}function ZB($){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 YB($,Z,Y,X){let Q=X.timeout||30000,J=X.id||$;return`
10103
+ `}var oz=0;var UX={};o(UX,{renderSSRSuspense:()=>qB,processSuspenseDirectives:()=>JB,generateSuspenseRuntime:()=>WB,generateSuspenseCSS:()=>UB,createSSRSuspense:()=>KB});function XB(){return`suspense-${++YB}-${Date.now().toString(36)}`}function JB($,Z={},Y){let X=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(X,(Q,J,G,K)=>{let q=XB(),U=QB(J||"");return GB(q,G.trim(),K.trim(),U)})}function QB($){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 GB($,Z,Y,X){let Q=X.timeout||30000,J=X.id||$;return`
10031
10104
  <div class="stx-suspense" data-suspense-id="${$}" data-custom-id="${J}" data-status="pending">
10032
10105
  <div class="stx-suspense-fallback" data-suspense-fallback="${$}">
10033
10106
  ${Y}
@@ -10217,7 +10290,7 @@ else {
10217
10290
  }, 0);
10218
10291
  })();
10219
10292
  </script>
10220
- `}function XB($,Z,Y){return{id:$,fallback:Y,content:Z}}async function JB($){let Z=$.map((X)=>`
10293
+ `}function KB($,Z,Y){return{id:$,fallback:Y,content:Z}}async function qB($){let Z=$.map((X)=>`
10221
10294
  <div id="stx-ssr-suspense-${X.id}" class="stx-ssr-suspense">
10222
10295
  ${X.fallback}
10223
10296
  </div>
@@ -10242,7 +10315,7 @@ else {
10242
10315
  }
10243
10316
  })();
10244
10317
  </script>
10245
- `}}return{initial:Z,streaming:Y()}}function QB(){return`
10318
+ `}}return{initial:Z,streaming:Y()}}function UB(){return`
10246
10319
  /* STX Suspense Styles */
10247
10320
  .stx-suspense {
10248
10321
  position: relative;
@@ -10298,7 +10371,7 @@ else {
10298
10371
  background-size: 200% 100%;
10299
10372
  }
10300
10373
  }
10301
- `}function GB(){return`
10374
+ `}function WB(){return`
10302
10375
  // STX Suspense Runtime
10303
10376
  (function() {
10304
10377
  if (typeof window === 'undefined') return;
@@ -10365,7 +10438,7 @@ else {
10365
10438
 
10366
10439
  console.log('[stx] Suspense runtime initialized');
10367
10440
  })();
10368
- `}var tz=0;var zX={};o(zX,{processAsyncDirectives:()=>qB,isAsyncComponent:()=>WB,generateAsyncComponentRuntime:()=>BB,generateAsyncComponentCSS:()=>zB,defineAsyncComponent:()=>UB});function qX(){return`async-${++KB}-${Date.now().toString(36)}`}function qB($,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=qX(),z=UX(K);return WX(U,z,q.trim(),W.trim())}),J=J.replace(Q,(G,K,q)=>{let W=qX(),U=UX(K);return WX(W,U,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),J}function UX($){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 WX($,Z,Y,X){let{component:Q,timeout:J,delay:G,suspensible:K,retries:q}=Z;return`
10441
+ `}var YB=0;var _X={};o(_X,{processAsyncDirectives:()=>BB,isAsyncComponent:()=>jB,generateAsyncComponentRuntime:()=>OB,generateAsyncComponentCSS:()=>HB,defineAsyncComponent:()=>_B});function WX(){return`async-${++zB}-${Date.now().toString(36)}`}function BB($,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,U)=>{let W=WX(),z=zX(K);return BX(W,z,q.trim(),U.trim())}),J=J.replace(Q,(G,K,q)=>{let U=WX(),W=zX(K);return BX(U,W,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),J}function zX($){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 BX($,Z,Y,X){let{component:Q,timeout:J,delay:G,suspensible:K,retries:q}=Z;return`
10369
10442
  <div class="stx-async-component" data-async-id="${$}" data-component="${Q}" data-status="pending">
10370
10443
  <div class="stx-async-loading" data-async-loading="${$}">
10371
10444
  ${Y}
@@ -10592,7 +10665,7 @@ catch (error) {
10592
10665
  loadComponent();
10593
10666
  })();
10594
10667
  </script>
10595
- `}function UB($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function WB($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function zB(){return`
10668
+ `}function _B($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function jB($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function HB(){return`
10596
10669
  /* STX Async Component Styles */
10597
10670
  .stx-async-component {
10598
10671
  position: relative;
@@ -10666,7 +10739,7 @@ catch (error) {
10666
10739
  background-size: 200% 100%;
10667
10740
  }
10668
10741
  }
10669
- `}function BB(){return`
10742
+ `}function OB(){return`
10670
10743
  // STX Async Component Runtime
10671
10744
  (function() {
10672
10745
  if (typeof window === 'undefined') return;
@@ -10720,7 +10793,7 @@ catch (error) {
10720
10793
 
10721
10794
  console.log('[stx] Async component runtime initialized');
10722
10795
  })();
10723
- `}var KB=0;var _X={};o(_X,{shouldCacheComponent:()=>FB,processKeepAliveDirectives:()=>jB,onDeactivated:()=>NB,onActivated:()=>AB,generateKeepAliveRuntime:()=>RB,generateKeepAliveCSS:()=>VB,createKeepAliveCache:()=>LB});function BX(){return`keep-alive-${++_B}-${Date.now().toString(36)}`}function jB($,Z={},Y){let X=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(X,(Q,J,G)=>{let K=BX(),q=HB(J||"");return OB(K,G.trim(),q)})}function HB($){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 OB($,Z,Y){let{max:X,include:Q,exclude:J}=Y,G=Y.id||$;return`
10796
+ `}var zB=0;var HX={};o(HX,{shouldCacheComponent:()=>AB,processKeepAliveDirectives:()=>FB,onDeactivated:()=>IB,onActivated:()=>MB,generateKeepAliveRuntime:()=>TB,generateKeepAliveCSS:()=>wB,createKeepAliveCache:()=>NB});function jX(){return`keep-alive-${++LB}-${Date.now().toString(36)}`}function FB($,Z={},Y){let X=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(X,(Q,J,G)=>{let K=jX(),q=VB(J||"");return RB(K,G.trim(),q)})}function VB($){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 RB($,Z,Y){let{max:X,include:Q,exclude:J}=Y,G=Y.id||$;return`
10724
10797
  <div class="stx-keep-alive" data-keep-alive-id="${$}" data-custom-id="${G}">
10725
10798
  <div class="stx-keep-alive-content" data-keep-alive-content="${$}">
10726
10799
  ${Z}
@@ -11007,7 +11080,7 @@ else {
11007
11080
  });
11008
11081
  })();
11009
11082
  </script>
11010
- `}function LB($={}){return{id:$.id||BX(),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 FB($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function VB(){return`
11083
+ `}function NB($={}){return{id:$.id||jX(),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 AB($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function wB(){return`
11011
11084
  /* STX Keep-Alive Styles */
11012
11085
  .stx-keep-alive {
11013
11086
  position: relative;
@@ -11032,7 +11105,7 @@ else {
11032
11105
  .stx-keep-alive-content > [data-activated] {
11033
11106
  opacity: 1;
11034
11107
  }
11035
- `}function RB(){return`
11108
+ `}function TB(){return`
11036
11109
  // STX Keep-Alive Runtime
11037
11110
  (function() {
11038
11111
  if (typeof window === 'undefined') return;
@@ -11068,19 +11141,19 @@ else {
11068
11141
 
11069
11142
  console.log('[stx] Keep-alive runtime initialized');
11070
11143
  })();
11071
- `}function AB($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function NB($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var _B=0;var FX={};o(FX,{useVirtualList:()=>HX,processVirtualListDirectives:()=>O6,processVirtualGridDirectives:()=>LX,processInfiniteListDirectives:()=>OX,generateVirtualListCSS:()=>jX,default:()=>wB,createVirtualList:()=>H6});function H6($,Z){let{itemHeight:Y,containerHeight:X,overscan:Q=3,keyProperty:J="id",dynamicHeight:G=!1,estimatedItemHeight:K=Y,direction:q="vertical"}=Z,W=[...$],U=0,z=new Map;function B(){if(G)return _();let N=Math.max(0,Math.floor(U/Y)-Q),w=Math.ceil(X/Y),T=Math.min(W.length-1,N+w+Q*2);return{startIndex:N,endIndex:T}}function _(){let N=0,w=0,T=W.length-1;for(let M=0;M<W.length;M++){let I=z.get(M)||K;if(N+I>U){w=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:w,endIndex:T}}function j(){if(G){let N=0;for(let w=0;w<W.length;w++)N+=z.get(w)||K;return N}return W.length*Y}function H(N){if(G){let w=0;for(let T=0;T<N;T++)w+=z.get(T)||K;return w}return N*Y}function L(){let{startIndex:N,endIndex:w}=B();return{startIndex:N,endIndex:w,scrollTop:U,totalHeight:j(),visibleItems:W.slice(N,w+1),itemHeights:new Map(z)}}function F(N,w="auto"){let T=H(N);O(T,w)}function O(N,w="auto"){U=Math.max(0,Math.min(N,j()-X))}function V(){B()}function R(N){W=[...N],z.clear(),V()}function A(){W=[],z.clear()}return{scrollToIndex:F,scrollToOffset:O,getState:L,refresh:V,setItems:R,destroy:A}}function O6($,Z={},Y){let X=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(X,(Q,J,G,K)=>{let q=J.trim(),W=Z[q];if(!W||!Array.isArray(W))return`<!-- virtualList: items "${q}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let O=G.trim(),V=Function(`return ${O}`)();U={...U,...V}}catch{}let z=`vlist-${Math.random().toString(36).substring(2,9)}`,B=Math.ceil(U.containerHeight/U.itemHeight),_=U.overscan||3,j=0,H=Math.min(W.length-1,B+_),L="";for(let O=j;O<=H&&O<W.length;O++){let V=W[O],R=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+=`
11072
- <div class="virtual-item ${U.itemClass||""}"
11073
- style="position: absolute; top: ${O*U.itemHeight}px; height: ${U.itemHeight}px; width: 100%;"
11144
+ `}function MB($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function IB($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var LB=0;var RX={};o(RX,{useVirtualList:()=>LX,processVirtualListDirectives:()=>L6,processVirtualGridDirectives:()=>VX,processInfiniteListDirectives:()=>FX,generateVirtualListCSS:()=>OX,default:()=>DB,createVirtualList:()=>O6});function O6($,Z){let{itemHeight:Y,containerHeight:X,overscan:Q=3,keyProperty:J="id",dynamicHeight:G=!1,estimatedItemHeight:K=Y,direction:q="vertical"}=Z,U=[...$],W=0,z=new Map;function B(){if(G)return _();let A=Math.max(0,Math.floor(W/Y)-Q),w=Math.ceil(X/Y),T=Math.min(U.length-1,A+w+Q*2);return{startIndex:A,endIndex:T}}function _(){let A=0,w=0,T=U.length-1;for(let M=0;M<U.length;M++){let I=z.get(M)||K;if(A+I>W){w=Math.max(0,M-Q);break}A+=I}A=0;for(let M=0;M<U.length;M++){let I=z.get(M)||K;if(A+=I,A>W+X){T=Math.min(U.length-1,M+Q);break}}return{startIndex:w,endIndex:T}}function j(){if(G){let A=0;for(let w=0;w<U.length;w++)A+=z.get(w)||K;return A}return U.length*Y}function H(A){if(G){let w=0;for(let T=0;T<A;T++)w+=z.get(T)||K;return w}return A*Y}function L(){let{startIndex:A,endIndex:w}=B();return{startIndex:A,endIndex:w,scrollTop:W,totalHeight:j(),visibleItems:U.slice(A,w+1),itemHeights:new Map(z)}}function F(A,w="auto"){let T=H(A);O(T,w)}function O(A,w="auto"){W=Math.max(0,Math.min(A,j()-X))}function V(){B()}function R(A){U=[...A],z.clear(),V()}function N(){U=[],z.clear()}return{scrollToIndex:F,scrollToOffset:O,getState:L,refresh:V,setItems:R,destroy:N}}function L6($,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(),U=Z[q];if(!U||!Array.isArray(U))return`<!-- virtualList: items "${q}" not found or not an array -->`;let W={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let O=G.trim(),V=Function(`return ${O}`)();W={...W,...V}}catch{}let z=`vlist-${Math.random().toString(36).substring(2,9)}`,B=Math.ceil(W.containerHeight/W.itemHeight),_=W.overscan||3,j=0,H=Math.min(U.length-1,B+_),L="";for(let O=j;O<=H&&O<U.length;O++){let V=U[O],R=K.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(N,A)=>{if(typeof V==="object"&&V!==null)return String(V[A]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(O));L+=`
11145
+ <div class="virtual-item ${W.itemClass||""}"
11146
+ style="position: absolute; top: ${O*W.itemHeight}px; height: ${W.itemHeight}px; width: 100%;"
11074
11147
  data-index="${O}">
11075
11148
  ${R}
11076
- </div>`}let F=W.length*U.itemHeight;return`
11149
+ </div>`}let F=U.length*W.itemHeight;return`
11077
11150
  <div id="${z}"
11078
- class="virtual-list-container ${U.containerClass||""}"
11079
- style="position: relative; height: ${U.containerHeight}px; overflow-y: auto;"
11080
- data-item-height="${U.itemHeight}"
11081
- data-total-items="${W.length}"
11151
+ class="virtual-list-container ${W.containerClass||""}"
11152
+ style="position: relative; height: ${W.containerHeight}px; overflow-y: auto;"
11153
+ data-item-height="${W.itemHeight}"
11154
+ data-total-items="${U.length}"
11082
11155
  data-overscan="${_}">
11083
- <div class="virtual-list-viewport ${U.viewportClass||""}"
11156
+ <div class="virtual-list-viewport ${W.viewportClass||""}"
11084
11157
  style="position: relative; height: ${F}px; width: 100%;">
11085
11158
  ${L}
11086
11159
  </div>
@@ -11091,11 +11164,11 @@ else {
11091
11164
  if (!container) return;
11092
11165
 
11093
11166
  const viewport = container.querySelector('.virtual-list-viewport');
11094
- const itemHeight = ${U.itemHeight};
11095
- const totalItems = ${W.length};
11167
+ const itemHeight = ${W.itemHeight};
11168
+ const totalItems = ${U.length};
11096
11169
  const overscan = ${_};
11097
- const containerHeight = ${U.containerHeight};
11098
- const items = ${JSON.stringify(W)};
11170
+ const containerHeight = ${W.containerHeight};
11171
+ const items = ${JSON.stringify(U)};
11099
11172
  const template = ${JSON.stringify(K.trim())};
11100
11173
 
11101
11174
  let lastStartIndex = 0;
@@ -11114,7 +11187,7 @@ else {
11114
11187
  for (let i = startIndex; i <= endIndex; i++) {
11115
11188
  const item = items[i];
11116
11189
  const div = document.createElement('div');
11117
- div.className = 'virtual-item ${U.itemClass||""}';
11190
+ div.className = 'virtual-item ${W.itemClass||""}';
11118
11191
  div.style.cssText = 'position: absolute; top: ' + (i * itemHeight) + 'px; height: ' + itemHeight + 'px; width: 100%;';
11119
11192
  div.dataset.index = i;
11120
11193
 
@@ -11145,7 +11218,7 @@ else {
11145
11218
  };
11146
11219
  })();
11147
11220
  </script>
11148
- `})}function jX(){return`
11221
+ `})}function OX(){return`
11149
11222
  .virtual-list-container {
11150
11223
  position: relative;
11151
11224
  overflow-y: auto;
@@ -11193,7 +11266,7 @@ else {
11193
11266
  0% { background-position: 200% 0; }
11194
11267
  100% { background-position: -200% 0; }
11195
11268
  }
11196
- `}function HX($,Z){let Y=null,X=()=>{if(!Y)Y=H6($(),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 OX($,Z={},Y){let X=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(X,(Q,J,G,K,q)=>{let W=J.trim(),U=Z[W];if(!U||!Array.isArray(U))return`<!-- infiniteList: items "${W}" not found or not an array -->`;let z={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(G)try{let j=Function(`return ${G.trim()}`)();z={...z,...j}}catch{}let B=`ilist-${Math.random().toString(36).substring(2,9)}`,_=O6(`@virtualList(${W}, ${JSON.stringify({itemHeight:z.itemHeight,containerHeight:z.containerHeight,overscan:z.overscan,containerClass:z.containerClass})})${K}@endvirtualList`,Z);return _=_.replace("</script>",`
11269
+ `}function LX($,Z){let Y=null,X=()=>{if(!Y)Y=O6($(),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 FX($,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 U=J.trim(),W=Z[U];if(!W||!Array.isArray(W))return`<!-- infiniteList: items "${U}" not found or not an array -->`;let z={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(G)try{let j=Function(`return ${G.trim()}`)();z={...z,...j}}catch{}let B=`ilist-${Math.random().toString(36).substring(2,9)}`,_=L6(`@virtualList(${U}, ${JSON.stringify({itemHeight:z.itemHeight,containerHeight:z.containerHeight,overscan:z.overscan,containerClass:z.containerClass})})${K}@endvirtualList`,Z);return _=_.replace("</script>",`
11197
11270
  // Infinite scroll detection
11198
11271
  container.addEventListener('scroll', function() {
11199
11272
  const scrollBottom = container.scrollTop + container.clientHeight;
@@ -11211,15 +11284,15 @@ else {
11211
11284
  ${q}
11212
11285
  </div>
11213
11286
  </div>
11214
- `})}function LX($,Z={},Y){let X=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(X,(Q,J,G,K)=>{let q=J.trim(),W=Z[q];if(!W||!Array.isArray(W))return`<!-- virtualGrid: items "${q}" not found or not an array -->`;let U={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(G)try{let V=Function(`return ${G.trim()}`)();U={...U,...V}}catch{}let z=`vgrid-${Math.random().toString(36).substring(2,9)}`,B=Math.ceil(W.length/U.columns),_=B*(U.rowHeight+(U.gap||0)),j=Math.ceil(U.containerHeight/(U.rowHeight+(U.gap||0))),H=U.overscan||2,L=0,F=Math.min(B-1,j+H),O="";for(let V=L;V<=F;V++)for(let R=0;R<U.columns;R++){let A=V*U.columns+R;if(A>=W.length)break;let N=W[A],w=R*(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,D)=>{if(typeof N==="object"&&N!==null)return String(N[D]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(A));O+=`
11287
+ `})}function VX($,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(),U=Z[q];if(!U||!Array.isArray(U))return`<!-- virtualGrid: items "${q}" not found or not an array -->`;let W={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(G)try{let V=Function(`return ${G.trim()}`)();W={...W,...V}}catch{}let z=`vgrid-${Math.random().toString(36).substring(2,9)}`,B=Math.ceil(U.length/W.columns),_=B*(W.rowHeight+(W.gap||0)),j=Math.ceil(W.containerHeight/(W.rowHeight+(W.gap||0))),H=W.overscan||2,L=0,F=Math.min(B-1,j+H),O="";for(let V=L;V<=F;V++)for(let R=0;R<W.columns;R++){let N=V*W.columns+R;if(N>=U.length)break;let A=U[N],w=R*(100/W.columns),T=V*(W.rowHeight+(W.gap||0)),M=K.replace(/\{\{\s*item\s*\}\}/g,typeof A==="object"?JSON.stringify(A):String(A)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(I,D)=>{if(typeof A==="object"&&A!==null)return String(A[D]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(N));O+=`
11215
11288
  <div class="virtual-grid-item"
11216
- style="position: absolute; top: ${T}px; left: ${w}%; width: calc(${100/U.columns}% - ${U.gap||0}px); height: ${U.rowHeight}px;"
11217
- data-index="${A}">
11289
+ style="position: absolute; top: ${T}px; left: ${w}%; width: calc(${100/W.columns}% - ${W.gap||0}px); height: ${W.rowHeight}px;"
11290
+ data-index="${N}">
11218
11291
  ${M}
11219
11292
  </div>`}return`
11220
11293
  <div id="${z}"
11221
11294
  class="virtual-grid-container"
11222
- style="position: relative; height: ${U.containerHeight}px; overflow-y: auto;">
11295
+ style="position: relative; height: ${W.containerHeight}px; overflow-y: auto;">
11223
11296
  <div class="virtual-grid-viewport"
11224
11297
  style="position: relative; height: ${_}px; width: 100%;">
11225
11298
  ${O}
@@ -11231,13 +11304,13 @@ else {
11231
11304
  if (!container) return;
11232
11305
 
11233
11306
  const viewport = container.querySelector('.virtual-grid-viewport');
11234
- const columns = ${U.columns};
11235
- const rowHeight = ${U.rowHeight};
11236
- const gap = ${U.gap||0};
11237
- const totalItems = ${W.length};
11307
+ const columns = ${W.columns};
11308
+ const rowHeight = ${W.rowHeight};
11309
+ const gap = ${W.gap||0};
11310
+ const totalItems = ${U.length};
11238
11311
  const overscan = ${H};
11239
- const containerHeight = ${U.containerHeight};
11240
- const items = ${JSON.stringify(W)};
11312
+ const containerHeight = ${W.containerHeight};
11313
+ const items = ${JSON.stringify(U)};
11241
11314
  const template = ${JSON.stringify(K.trim())};
11242
11315
 
11243
11316
  let lastStartRow = 0;
@@ -11281,7 +11354,7 @@ else {
11281
11354
  });
11282
11355
  })();
11283
11356
  </script>
11284
- `})}var wB;var VX=b(()=>{wB={createVirtualList:H6,processVirtualListDirectives:O6,processInfiniteListDirectives:OX,processVirtualGridDirectives:LX,generateVirtualListCSS:jX,useVirtualList:HX}});function RX(){return`<script data-stx-hydration-runtime>
11357
+ `})}var DB;var NX=b(()=>{DB={createVirtualList:O6,processVirtualListDirectives:L6,processInfiniteListDirectives:FX,processVirtualGridDirectives:VX,generateVirtualListCSS:OX,useVirtualList:LX}});function AX(){return`<script data-stx-hydration-runtime>
11285
11358
  (function() {
11286
11359
  'use strict';
11287
11360
 
@@ -11441,7 +11514,7 @@ else {
11441
11514
  stxIslands.initIslands();
11442
11515
  }
11443
11516
  })();
11444
- </script>`}function AX($){let Z=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Z)return Z[1];let Y=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Y)return Y[1];return null}function NX($,Z){let Y={},X=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,Q;while((Q=X.exec($))!==null){let J=Q[1],G=Q[2];if(G in Z)Y[J]=Z[G];else Y[J]=G}return Y}var PX={};o(PX,{processStaticDirectives:()=>SX,processPartialHydrationDirectives:()=>TX,onHydrated:()=>bX,isHydrated:()=>kX,hydrateIsland:()=>IX,hydrateByStrategy:()=>DX,hydrateAll:()=>EX,generatePartialHydrationCSS:()=>MX,generateIslandManifest:()=>yX,default:()=>SB,createIslandRegistry:()=>wX});function wX(){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 TB($){return`
11517
+ </script>`}function wX($){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 TX($,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 vX={};o(vX,{processStaticDirectives:()=>PX,processPartialHydrationDirectives:()=>IX,onHydrated:()=>yX,isHydrated:()=>SX,hydrateIsland:()=>EX,hydrateByStrategy:()=>kX,hydrateAll:()=>bX,generatePartialHydrationCSS:()=>DX,generateIslandManifest:()=>CX,default:()=>vB,createIslandRegistry:()=>MX});function MX(){let $=new Map;return{islands:$,register(Z){$.set(Z.id,Z)},get(Z){return $.get(Z)},async hydrate(Z){let Y=$.get(Z);if(!Y||Y.hydrated)return;if(Y.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:Z,component:Y.component}}))},async hydrateAll(){let Z=Array.from($.values()).filter((Y)=>!Y.hydrated).map((Y)=>this.hydrate(Y.id));await Promise.all(Z)}}}function EB($){return`
11445
11518
  <script data-hydrate="${$}">
11446
11519
  (function() {
11447
11520
  const island = document.querySelector('[data-island="${$}"]');
@@ -11452,7 +11525,7 @@ else {
11452
11525
  island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
11453
11526
  })();
11454
11527
  </script>
11455
- `}function MB($,Z){let Y=Z.timeout||2000,X=Z.priority||"low";return`
11528
+ `}function kB($,Z){let Y=Z.timeout||2000,X=Z.priority||"low";return`
11456
11529
  <script data-hydrate="${$}">
11457
11530
  (function() {
11458
11531
  const island = document.querySelector('[data-island="${$}"]');
@@ -11488,7 +11561,7 @@ else {
11488
11561
  }
11489
11562
  })();
11490
11563
  </script>
11491
- `}function IB($,Z){let Y=Z.rootMargin||"0px",X=Z.threshold||0;return`
11564
+ `}function bB($,Z){let Y=Z.rootMargin||"0px",X=Z.threshold||0;return`
11492
11565
  <script data-hydrate="${$}">
11493
11566
  (function() {
11494
11567
  const island = document.querySelector('[data-island="${$}"]');
@@ -11521,7 +11594,7 @@ else {
11521
11594
  }
11522
11595
  })();
11523
11596
  </script>
11524
- `}function DB($,Z){let Y=Z.media||"(min-width: 768px)";return`
11597
+ `}function SB($,Z){let Y=Z.media||"(min-width: 768px)";return`
11525
11598
  <script data-hydrate="${$}">
11526
11599
  (function() {
11527
11600
  const island = document.querySelector('[data-island="${$}"]');
@@ -11550,7 +11623,7 @@ else {
11550
11623
  }
11551
11624
  })();
11552
11625
  </script>
11553
- `}function EB($){return`
11626
+ `}function yB($){return`
11554
11627
  <script data-hydrate="${$}">
11555
11628
  (function() {
11556
11629
  const island = document.querySelector('[data-island="${$}"]');
@@ -11572,7 +11645,7 @@ else {
11572
11645
  events.forEach(e => island.addEventListener(e, handler, { once: true, passive: true }));
11573
11646
  })();
11574
11647
  </script>
11575
- `}function kB($,Z){let Y=Z.event||"stx:activate";return`
11648
+ `}function PB($,Z){let Y=Z.event||"stx:activate";return`
11576
11649
  <script data-hydrate="${$}">
11577
11650
  (function() {
11578
11651
  const island = document.querySelector('[data-island="${$}"]');
@@ -11593,9 +11666,9 @@ else {
11593
11666
  });
11594
11667
  })();
11595
11668
  </script>
11596
- `}function TX($,Z={},Y){let X=$,Q=!1,J=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(X=X5(X,"load",Z),X=X5(X,"idle",Z),X=X5(X,"visible",Z),X=X5(X,"media",Z),X=bB(X),X=X5(X,"hover",Z),X=X5(X,"event",Z),Q=J&&X!==$,Q)X+=`
11597
- `+RX();return X}function X5($,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=AX(G.trim()),U=NX(G.trim(),Y),z=[];if(K.rootMargin)z.push(`data-root-margin="${K.rootMargin}"`);if(K.threshold!==void 0)z.push(`data-threshold="${K.threshold}"`);if(K.media)z.push(`data-media="${K.media}"`);if(K.event)z.push(`data-event="${K.event}"`);if(W)z.push(`data-component="${W}"`);let _=Object.keys(U).length>0?`
11598
- <script type="application/json" data-island-props="${q}">${JSON.stringify(U)}</script>`:"",j="";switch(Z){case"load":j=TB(q);break;case"idle":j=MB(q,K);break;case"visible":j=IB(q,K);break;case"media":j=DB(q,K);break;case"hover":j=EB(q);break;case"event":j=kB(q,K);break}return`
11669
+ `}function IX($,Z={},Y){let X=$,Q=!1,J=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(X=X5(X,"load",Z),X=X5(X,"idle",Z),X=X5(X,"visible",Z),X=X5(X,"media",Z),X=CB(X),X=X5(X,"hover",Z),X=X5(X,"event",Z),Q=J&&X!==$,Q)X+=`
11670
+ `+AX();return X}function X5($,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)}`,U=wX(G.trim()),W=TX(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(U)z.push(`data-component="${U}"`);let _=Object.keys(W).length>0?`
11671
+ <script type="application/json" data-island-props="${q}">${JSON.stringify(W)}</script>`:"",j="";switch(Z){case"load":j=EB(q);break;case"idle":j=kB(q,K);break;case"visible":j=bB(q,K);break;case"media":j=SB(q,K);break;case"hover":j=yB(q);break;case"event":j=PB(q,K);break}return`
11599
11672
  <div data-island="${q}"
11600
11673
  data-strategy="${Z}"
11601
11674
  ${z.join(`
@@ -11605,7 +11678,7 @@ else {
11605
11678
  ${G.trim()}${_}
11606
11679
  </div>
11607
11680
  ${j}
11608
- `})}function bB($){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`
11681
+ `})}function CB($){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`
11609
11682
  <div data-island="${Q}"
11610
11683
  data-strategy="only"
11611
11684
  class="stx-island stx-client-only">
@@ -11624,7 +11697,7 @@ else {
11624
11697
  }
11625
11698
  })();
11626
11699
  </script>
11627
- `})}function MX(){return`
11700
+ `})}function DX(){return`
11628
11701
  /* Island base styles */
11629
11702
  .stx-island {
11630
11703
  display: contents;
@@ -11665,11 +11738,11 @@ else {
11665
11738
  .stx-island.hydrated {
11666
11739
  opacity: 1;
11667
11740
  }
11668
- `}function IX($){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 DX($){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${$}"]:not(.hydrated)`).forEach((Y)=>{Y.classList.add("hydrated"),Y.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function EX(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach((Z)=>{Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function kX($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function bX($){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 SX($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,Y)=>{return`<div class="stx-static">${Y.trim()}</div>`})}function yX($){let Z=$.map((Y)=>({id:Y.id,component:Y.component,strategy:Y.options.strategy,props:Y.props}));return`
11741
+ `}function EX($){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 kX($){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 bX(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach((Z)=>{Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function SX($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function yX($){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 PX($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,Y)=>{return`<div class="stx-static">${Y.trim()}</div>`})}function CX($){let Z=$.map((Y)=>({id:Y.id,component:Y.component,strategy:Y.options.strategy,props:Y.props}));return`
11669
11742
  <script type="application/json" id="stx-island-manifest">
11670
11743
  ${JSON.stringify(Z)}
11671
11744
  </script>
11672
- `}var SB;var CX=b(()=>{SB={processPartialHydrationDirectives:TX,processStaticDirectives:SX,generatePartialHydrationCSS:MX,generateIslandManifest:yX,createIslandRegistry:wX,hydrateIsland:IX,hydrateByStrategy:DX,hydrateAll:EX,isHydrated:kX,onHydrated:bX}});var cX={};o(cX,{watchMultiple:()=>hX,watchEffect:()=>dX,watch:()=>gX,unref:()=>vX,toRefs:()=>xX,throttledComputed:()=>pX,stxWatchMultiple:()=>hX,stxWatchEffect:()=>dX,stxWatch:()=>gX,stxUnref:()=>vX,stxToRefs:()=>xX,stxThrottledComputed:()=>pX,stxShallowRef:()=>fX,stxRef:()=>J5,stxIsRef:()=>B1,stxDebouncedComputed:()=>lX,stxComputed:()=>l5,shallowRef:()=>fX,ref:()=>J5,processWatchDirectives:()=>uX,processComputedDirectives:()=>mX,isRef:()=>B1,default:()=>yB,debouncedComputed:()=>lX,computed:()=>l5});function J5($){let Z=$,Y=new Set,X={get value(){if(n0){let Q=u5.get(X);if(!Q)Q=new Set,u5.set(X,Q);Q.add(n0)}return Z},set value(Q){if(!Object.is(Z,Q)){Z=Q,Y.forEach((G)=>G(Q));let J=u5.get(X);if(J)J.forEach((G)=>G())}},subscribe(Q){return Y.add(Q),()=>Y.delete(Q)},peek(){return Z}};return X}function B1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function vX($){return B1($)?$.value:$}function xX($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=J5($[Y]);return Z}function fX($){return J5($)}function l5($){let Z=typeof $==="function",Y=Z?$:$.get,X=Z?void 0:$.set,Q=Z?Object.is:$.equals||Object.is,J,G=!0,K=new Set,q=new Set,W=()=>{if(G=!0,q.size>0){let B=z.value;q.forEach((_)=>_(B))}};function U(){K.clear();let B=n0;n0=W,y$.push(W);try{return Y()}finally{y$.pop(),n0=B}}let z={get value(){if(n0){let B=u5.get(z);if(!B)B=new Set,u5.set(z,B);B.add(n0)}if(G){let B=U();if(!Q(J,B))J=B;G=!1}return J},set value(B){if(X)X(B);else console.warn("Computed property is readonly")},subscribe(B){return q.add(B),()=>q.delete(B)},peek(){if(G)J=Y(),G=!1;return J},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return z}function gX($,Z,Y={}){let{immediate:X=!1,deep:Q=!1,flush:J="pre",once:G=!1}=Y,K,q=!0,W=!1,U=()=>{if(B1($))return Q?P1($.value):$.value;return $()},z=()=>{if(!q||W)return;let j=U();if(K!==void 0&&Object.is(K,j)&&!Q)return;let H=()=>{if(Z(j,K),K=Q?P1(j):j,G)_()};if(J==="sync")H();else if(J==="post")queueMicrotask(H);else Promise.resolve().then(H)},B=null;if(B1($))B=$.subscribe(()=>z());else B=l5($).subscribe(()=>z());if(X)K=void 0,z();else K=U();let _=()=>{if(q=!1,B)B(),B=null};return _.pause=()=>{W=!0},_.resume=()=>{W=!1},_}function hX($,Z,Y={}){let{immediate:X=!1,once:Q=!1}=Y,J=$.map((z)=>B1(z)?z.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let z=$.map((B)=>B1(B)?B.value:void 0);if(Z(z,J),J=[...z],Q)U()},W=$.map((z)=>{if(B1(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 dX($,Z={}){let{flush:Y="pre"}=Z,X,Q=!0,J=!1,G=()=>{if(!Q||J)return;if(X)X();let q=n0;n0=G,y$.push(G);try{X=$()}finally{y$.pop(),n0=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 mX($,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 uX($,Z={},Y){let X=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(X,(Q,J,G)=>{return`
11745
+ `}var vB;var xX=b(()=>{vB={processPartialHydrationDirectives:IX,processStaticDirectives:PX,generatePartialHydrationCSS:DX,generateIslandManifest:CX,createIslandRegistry:MX,hydrateIsland:EX,hydrateByStrategy:kX,hydrateAll:bX,isHydrated:SX,onHydrated:yX}});var nX={};o(nX,{watchMultiple:()=>mX,watchEffect:()=>uX,watch:()=>dX,unref:()=>fX,toRefs:()=>gX,throttledComputed:()=>iX,stxWatchMultiple:()=>mX,stxWatchEffect:()=>uX,stxWatch:()=>dX,stxUnref:()=>fX,stxToRefs:()=>gX,stxThrottledComputed:()=>iX,stxShallowRef:()=>hX,stxRef:()=>J5,stxIsRef:()=>_1,stxDebouncedComputed:()=>cX,stxComputed:()=>c5,shallowRef:()=>hX,ref:()=>J5,processWatchDirectives:()=>pX,processComputedDirectives:()=>lX,isRef:()=>_1,default:()=>xB,debouncedComputed:()=>cX,computed:()=>c5});function J5($){let Z=$,Y=new Set,X={get value(){if(n0){let Q=p5.get(X);if(!Q)Q=new Set,p5.set(X,Q);Q.add(n0)}return Z},set value(Q){if(!Object.is(Z,Q)){Z=Q,Y.forEach((G)=>G(Q));let J=p5.get(X);if(J)J.forEach((G)=>G())}},subscribe(Q){return Y.add(Q),()=>Y.delete(Q)},peek(){return Z}};return X}function _1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function fX($){return _1($)?$.value:$}function gX($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=J5($[Y]);return Z}function hX($){return J5($)}function c5($){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,U=()=>{if(G=!0,q.size>0){let B=z.value;q.forEach((_)=>_(B))}};function W(){K.clear();let B=n0;n0=U,y$.push(U);try{return Y()}finally{y$.pop(),n0=B}}let z={get value(){if(n0){let B=p5.get(z);if(!B)B=new Set,p5.set(z,B);B.add(n0)}if(G){let B=W();if(!Q(J,B))J=B;G=!1}return J},set value(B){if(X)X(B);else console.warn("Computed property is readonly")},subscribe(B){return q.add(B),()=>q.delete(B)},peek(){if(G)J=Y(),G=!1;return J},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return z}function dX($,Z,Y={}){let{immediate:X=!1,deep:Q=!1,flush:J="pre",once:G=!1}=Y,K,q=!0,U=!1,W=()=>{if(_1($))return Q?P1($.value):$.value;return $()},z=()=>{if(!q||U)return;let j=W();if(K!==void 0&&Object.is(K,j)&&!Q)return;let H=()=>{if(Z(j,K),K=Q?P1(j):j,G)_()};if(J==="sync")H();else if(J==="post")queueMicrotask(H);else Promise.resolve().then(H)},B=null;if(_1($))B=$.subscribe(()=>z());else B=c5($).subscribe(()=>z());if(X)K=void 0,z();else K=W();let _=()=>{if(q=!1,B)B(),B=null};return _.pause=()=>{U=!0},_.resume=()=>{U=!1},_}function mX($,Z,Y={}){let{immediate:X=!1,once:Q=!1}=Y,J=$.map((z)=>_1(z)?z.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let z=$.map((B)=>_1(B)?B.value:void 0);if(Z(z,J),J=[...z],Q)W()},U=$.map((z)=>{if(_1(z))return z.subscribe(()=>q());return()=>{}});if(X)q();let W=()=>{G=!1,U.forEach((z)=>z())};return W.pause=()=>{K=!0},W.resume=()=>{K=!1},W}function uX($,Z={}){let{flush:Y="pre"}=Z,X,Q=!0,J=!1,G=()=>{if(!Q||J)return;if(X)X();let q=n0;n0=G,y$.push(G);try{X=$()}finally{y$.pop(),n0=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 lX($,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 pX($,Z={},Y){let X=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(X,(Q,J,G)=>{return`
11673
11746
  <script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
11674
11747
  (function() {
11675
11748
  // Watch implementation for ${J}
@@ -11681,9 +11754,9 @@ else {
11681
11754
  }
11682
11755
  })();
11683
11756
  </script>
11684
- `})}function P1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>P1(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((X,Q)=>Y.set(P1(Q),P1(X))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((X)=>Y.add(P1(X))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=P1($[Y]);return Z}function lX($,Z=100){let Y=J5($()),X=null,Q=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{Y.value=$()},Z)};return l5($).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 pX($,Z=100){let Y=J5($()),X=0,Q=()=>{let G=Date.now();if(G-X>=Z)X=G,Y.value=$()};return l5($).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 n0=null,y$,u5,yB;var iX=b(()=>{y$=[],u5=new WeakMap;yB={ref:J5,computed:l5,watch:gX,watchMultiple:hX,watchEffect:dX,isRef:B1,unref:vX,toRefs:xX,shallowRef:fX,debouncedComputed:lX,throttledComputed:pX,processComputedDirectives:mX,processWatchDirectives:uX}});var rX={};o(rX,{v:()=>PB,processHasErrorsDirective:()=>sX,processFormValidationDirectives:()=>vB,processErrorsDirective:()=>oX,processErrorDirective:()=>nX,defineForm:()=>CB,Validator:()=>Q5});class Q5{rules=[];defaultValue="";addRule($){let Z=new Q5;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 Q5;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 Q5;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 CB($,Z){let Y=Object.keys($),X={},Q={},J={},G={},K={};for(let O of Y)X[O]=Z?.[O]??$[O].getDefaultValue(),Q[O]=[],J[O]=!1,G[O]=!1,K[O]=!1;let q=!1;async function W(O){K[O]=!0;let V=await $[O].validate(X[O],X);return Q[O]=V,K[O]=!1,V.length===0}async function U(){q=!0;let O=await Promise.all(Y.map(W));return q=!1,O.every(Boolean)}function z(){for(let O of Y)X[O]=Z?.[O]??$[O].getDefaultValue(),Q[O]=[],J[O]=!1,G[O]=!1}function B(O){for(let V of Y)if(V in O)X[V]=O[V],G[V]=!0}function _(O,V){X[O]=V,G[O]=!0}function j(O,V=!0){if(J[O]=V,V)W(O)}function H(O){return{value:X[O],errors:Q[O],touched:J[O],dirty:G[O],valid:Q[O].length===0,validating:K[O]}}function L(O){return async(V)=>{V?.preventDefault?.();for(let A of Y)J[A]=!0;if(await U())await O(X)}}return{values:X,errors:Q,touched:J,dirty:G,get isValid(){return Y.every((O)=>Q[O].length===0)},get isValidating(){return q||Y.some((O)=>K[O])},get isDirty(){return Y.some((O)=>G[O])},validate:U,validateField:W,reset:z,setValues:B,setFieldValue:_,setFieldTouched:j,getFieldState:H,handleSubmit:L}}function nX($,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(`
11685
- `)}catch{return""}})}function oX($,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(`
11686
- `)}catch{return""}})}function sX($,Z,Y){let X=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return G}catch{return""}})}function vB($,Z,Y){let X=$;return X=nX(X,Z,Y),X=oX(X,Z,Y),X=sX(X,Z,Y),X}var PB;var aX=b(()=>{PB=new Q5});var $J={};o($J,{processXElementDirectives:()=>xB,hasXElementDirectives:()=>eX,generateXElementRuntime:()=>tX});function tX(){return`<script data-stx-scoped>
11757
+ `})}function P1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>P1(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((X,Q)=>Y.set(P1(Q),P1(X))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((X)=>Y.add(P1(X))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=P1($[Y]);return Z}function cX($,Z=100){let Y=J5($()),X=null,Q=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{Y.value=$()},Z)};return c5($).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 iX($,Z=100){let Y=J5($()),X=0,Q=()=>{let G=Date.now();if(G-X>=Z)X=G,Y.value=$()};return c5($).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 n0=null,y$,p5,xB;var oX=b(()=>{y$=[],p5=new WeakMap;xB={ref:J5,computed:c5,watch:dX,watchMultiple:mX,watchEffect:uX,isRef:_1,unref:fX,toRefs:gX,shallowRef:hX,debouncedComputed:cX,throttledComputed:iX,processComputedDirectives:lX,processWatchDirectives:pX}});var tX={};o(tX,{v:()=>fB,processHasErrorsDirective:()=>aX,processFormValidationDirectives:()=>hB,processErrorsDirective:()=>rX,processErrorDirective:()=>sX,defineForm:()=>gB,Validator:()=>Q5});class Q5{rules=[];defaultValue="";addRule($){let Z=new Q5;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 Q5;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 Q5;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 gB($,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 U(O){K[O]=!0;let V=await $[O].validate(X[O],X);return Q[O]=V,K[O]=!1,V.length===0}async function W(){q=!0;let O=await Promise.all(Y.map(U));return q=!1,O.every(Boolean)}function z(){for(let O of Y)X[O]=Z?.[O]??$[O].getDefaultValue(),Q[O]=[],J[O]=!1,G[O]=!1}function B(O){for(let V of Y)if(V in O)X[V]=O[V],G[V]=!0}function _(O,V){X[O]=V,G[O]=!0}function j(O,V=!0){if(J[O]=V,V)U(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 N of Y)J[N]=!0;if(await W())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:W,validateField:U,reset:z,setValues:B,setFieldValue:_,setFieldTouched:j,getFieldState:H,handleSubmit:L}}function sX($,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 W of K)if(q&&typeof q==="object"&&W in q)q=q[W];else return"";let U=q;if(!U||!Array.isArray(U)||U.length===0)return"";return U.map((W)=>{return G.replace(/\{\{\s*message\s*\}\}/g,W)}).join(`
11758
+ `)}catch{return""}})}function rX($,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 W of K)if(q&&typeof q==="object"&&W in q)q=q[W];else return"";let U=q;if(!U||!Array.isArray(U)||U.length===0)return"";return U.map((W)=>G.replace(/\{\{\s*message\s*\}\}/g,W)).join(`
11759
+ `)}catch{return""}})}function aX($,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 W of K)if(q&&typeof q==="object"&&W in q)q=q[W];else return"";let U=q;if(!U||!Array.isArray(U)||U.length===0)return"";return G}catch{return""}})}function hB($,Z,Y){let X=$;return X=sX(X,Z,Y),X=rX(X,Z,Y),X=aX(X,Z,Y),X}var fB;var eX=b(()=>{fB=new Q5});var YJ={};o(YJ,{processXElementDirectives:()=>dB,hasXElementDirectives:()=>ZJ,generateXElementRuntime:()=>$J});function $J(){return`<script data-stx-scoped>
11687
11760
  (function() {
11688
11761
  'use strict';
11689
11762
 
@@ -11967,36 +12040,36 @@ else {
11967
12040
  // Expose for manual initialization
11968
12041
  window.XElement = XElement;
11969
12042
  })();
11970
- </script>`}function eX($){return/\bx-(data|model|text|show|init|html)\b/.test($)||/\s:[a-z]/.test($)}function xB($){if(!eX($))return $;let Z=tX(),Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+Z+`
12043
+ </script>`}function ZJ($){return/\bx-(data|model|text|show|init|html)\b/.test($)||/\s:[a-z]/.test($)}function dB($){if(!ZJ($))return $;let Z=$J(),Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+Z+`
11971
12044
  `+$.slice(Y);return $+`
11972
- `+Z}var ZJ={};o(ZJ,{rewriteImagesWithSiblings:()=>hB});import e0 from"path";async function hB($,Z){let Y=Z.formats??gB;if(!Z.publicDir)return $;let X=uB($),Q=[],J=/<img\b[^>]*?>/gi,G=[],K;while((K=J.exec($))!==null){let z=K[0],B=z.match(/\bsrc=["']([^"']+)["']/i);if(!B)continue;if(lB(K.index,X))continue;G.push({idx:K.index,length:z.length,src:B[1],raw:z})}if(G.length===0)return $;let q=await Promise.all(G.map(async(z)=>{let B=await dB(z.src,Z.publicDir,Y);return{match:z,sources:B}}));for(let{match:z,sources:B}of q){if(B.length===0)continue;let j=`<picture>${B.map((H)=>`<source type="${H.mime}" srcset="${pB(H.url)}">`).join("")}${z.raw}</picture>`;Q.push({start:z.idx,end:z.idx+z.length,replacement:j})}if(Q.length===0)return $;let W="",U=0;for(let z of Q)W+=$.slice(U,z.start),W+=z.replacement,U=z.end;return W+=$.slice(U),W}async function dB($,Z,Y){if(!mB($))return[];let X=e0.extname($).toLowerCase();if(!fB.has(X))return[];if(!$.startsWith("/"))return[];let Q=e0.join(Z,$.slice(1)),J=e0.dirname(Q),G=e0.basename(Q,X),K=e0.resolve(J),q=e0.resolve(Z);if(!K.startsWith(q))return[];let W=e0.posix.dirname($),U=Y.map(async(B)=>{let _=e0.join(J,`${G}${B.ext}`);if(!await Bun.file(_).exists())return null;return{url:e0.posix.join(W,`${G}${B.ext}`),mime:B.mime}});return(await Promise.all(U)).filter((B)=>B!==null)}function mB($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function uB($){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 lB($,Z){for(let[Y,X]of Z)if($>=Y&&$<X)return!0;return!1}function pB($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var fB,gB;var YJ=b(()=>{fB=new Set([".jpg",".jpeg",".png",".gif"]),gB=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var QJ={};o(QJ,{validateClientScript:()=>b$,processOnceDirective:()=>k$,processJsonDirective:()=>E$,processDirectives:()=>F0,injectRouterScript:()=>b2});import k0 from"path";import{deriveLayoutGroup as cB}from"stx-router/layout-metadata";function XJ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function iB($,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(`
11973
- `,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===`
12045
+ `+Z}var XJ={};o(XJ,{rewriteImagesWithSiblings:()=>lB});import $1 from"path";async function lB($,Z){let Y=Z.formats??uB;if(!Z.publicDir)return $;let X=iB($),Q=[],J=/<img\b[^>]*?>/gi,G=[],K;while((K=J.exec($))!==null){let z=K[0],B=z.match(/\bsrc=["']([^"']+)["']/i);if(!B)continue;if(nB(K.index,X))continue;G.push({idx:K.index,length:z.length,src:B[1],raw:z})}if(G.length===0)return $;let q=await Promise.all(G.map(async(z)=>{let B=await pB(z.src,Z.publicDir,Y);return{match:z,sources:B}}));for(let{match:z,sources:B}of q){if(B.length===0)continue;let j=`<picture>${B.map((H)=>`<source type="${H.mime}" srcset="${oB(H.url)}">`).join("")}${z.raw}</picture>`;Q.push({start:z.idx,end:z.idx+z.length,replacement:j})}if(Q.length===0)return $;let U="",W=0;for(let z of Q)U+=$.slice(W,z.start),U+=z.replacement,W=z.end;return U+=$.slice(W),U}async function pB($,Z,Y){if(!cB($))return[];let X=$1.extname($).toLowerCase();if(!mB.has(X))return[];if(!$.startsWith("/"))return[];let Q=$1.join(Z,$.slice(1)),J=$1.dirname(Q),G=$1.basename(Q,X),K=$1.resolve(J),q=$1.resolve(Z);if(!K.startsWith(q))return[];let U=$1.posix.dirname($),W=Y.map(async(B)=>{let _=$1.join(J,`${G}${B.ext}`);if(!await Bun.file(_).exists())return null;return{url:$1.posix.join(U,`${G}${B.ext}`),mime:B.mime}});return(await Promise.all(W)).filter((B)=>B!==null)}function cB($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function iB($){let Z=[],Y=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,X;while((X=Y.exec($))!==null)Z.push([X.index,X.index+X[0].length]);return Z}function nB($,Z){for(let[Y,X]of Z)if($>=Y&&$<X)return!0;return!1}function oB($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var mB,uB;var JJ=b(()=>{mB=new Set([".jpg",".jpeg",".png",".gif"]),uB=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var KJ={};o(KJ,{validateClientScript:()=>b$,processOnceDirective:()=>k$,processJsonDirective:()=>E$,processDirectives:()=>F0,injectRouterScript:()=>yY});import E0 from"path";import{deriveLayoutGroup as sB}from"stx-router/layout-metadata";function QJ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function rB($,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(`
12046
+ `,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,U=!1;while(q<Y){let W=$[q];if(W==="\\"){q+=2;continue}if(W==="[")U=!0;else if(W==="]")U=!1;else if(W==="/"&&!U){q++;break}else if(W===`
11974
12047
  `){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]===`
11975
- `)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}async function F0($,Z,Y,X,Q){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;let J=!Z.__stxProcessingDepth;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((X.debug||!D5()&&!g4())&&Y&&Y.endsWith(".stx"))O3($,Y);try{return await E9.timeAsync("template-processing",async()=>{let G=await nB($,Z,Y,X,Q);if(J)G=B6(G);if(J&&X.autoShell&&X.buildMode!=="compile"){let K=X.app?.head||{},W=(Z.__stx_runtime_head||null)??A5(),U=(Z.__stx_head_raw||"").trim(),z,B=U.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(B)z=B[1].trim(),U=U.replace(B[0],"").trim();let _=Z.__sections?.title,j=W.title||z||_,H={...K,...j&&{title:j},meta:[...K.meta||[],...W.meta||[]],link:[...K.link||[],...W.link||[]],script:[...K.script||[],...W.script||[]],headRaw:[K.headRaw,U].filter(Boolean).join(`
11976
- `),...W.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},...W.htmlAttrs}},...W.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...W.bodyAttrs}}},L=t3(G);if(G=A2(G,H),L)G=R2(G,K);let F=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(F&&G.includes("<head")){let V=F[1],R=cB(V);G=G.replace("<head>",`<head>
11977
- <meta name="stx-layout" content="${XJ(V)}">
11978
- <meta name="stx-layout-group" content="${XJ(R)}">`)}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=V2(G);if(J)try{let{getStoreScript:K}=await Promise.resolve().then(() => (r2(),s2)),q=X.storesDir,W=await K(q);if(W){let U=`<script data-stx-stores>${W}</script>`,z=G.indexOf("<script data-stx-scoped>");if(z!==-1){let B=G.indexOf("</script>",z+24);if(B!==-1){let _=B+9;G=G.slice(0,_)+`
11979
- `+U+G.slice(_)}}}}catch{}if(J&&Z.__stx_inject_css!==!1)G=await HZ(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof u4)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(m0.log(q,{filePath:Y,context:Z}),l7.logDetailedError(q,{filePath:Y,template:$.substring(0,500)}),X.debug)throw q;return m7.createFallbackContent("Template Processing",q)}}async function nB($,Z,Y,X,Q){let J=process.cwd(),G={...X,partialsDir:X.partialsDir&&!k0.isAbsolute(X.partialsDir)?k0.resolve(J,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!k0.isAbsolute(X.componentsDir)?k0.resolve(J,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!k0.isAbsolute(X.layoutsDir)?k0.resolve(J,X.layoutsDir):X.layoutsDir},K=G,q=$;await rB(Y,Z),sB(Z,K),q=await n1(()=>J2(q,Z,Y,K),q,(O)=>{m0.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=L5(q,F9,(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,R)=>U[Number(R)]??""),B="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,B),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(O,V)=>{return`{{ ${V} }}`}),q=H2(q),q=await p2(q,Y,Q);let _={};q=s3(q,_);let j={...Z.__sections||{}},H="",L=/@nolayout\b/.test(q);if(L)q=q.replace(/@nolayout\b\s*/g,"");let F=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)H=F[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!H&&!L&&K.defaultLayout){let O=/<!DOCTYPE\s/i.test(q),V=/@section\s*\(/.test(q);if(!O||V){let R="",A=k0.dirname(Y),N=K.layoutsDir?k0.dirname(K.layoutsDir):process.cwd();for(let w=0;w<20;w++){let T=k0.join(A,"_layout.stx");if(await i(T)){R=T;break}let M=k0.dirname(A);if(M===A||M.length<N.length)break;A=M}if(R)H=R;else if(K.layoutsDir){let w=k0.isAbsolute(K.layoutsDir)?K.layoutsDir:k0.resolve(process.cwd(),K.layoutsDir),T=k0.join(w,`${K.defaultLayout}.stx`);if(await i(T))H=T}if(H&&!V)q=`@section('content')
12048
+ `)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}async function F0($,Z,Y,X,Q){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;let J=!Z.__stxProcessingDepth;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((X.debug||!k5()&&!g4())&&Y&&Y.endsWith(".stx"))L3($,Y);try{return await k9.timeAsync("template-processing",async()=>{let G=await aB($,Z,Y,X,Q);if(J)G=_6(G);if(J&&X.autoShell&&X.buildMode!=="compile"){let K=X.app?.head||{},U=(Z.__stx_runtime_head||null)??w5(),W=(Z.__stx_head_raw||"").trim(),z,B=W.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(B)z=B[1].trim(),W=W.replace(B[0],"").trim();let _=Z.__sections?.title,j=U.title||z||_,H={...K,...j&&{title:j},meta:[...K.meta||[],...U.meta||[]],link:[...K.link||[],...U.link||[]],script:[...K.script||[],...U.script||[]],headRaw:[K.headRaw,W].filter(Boolean).join(`
12049
+ `),...U.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},...U.htmlAttrs}},...U.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...U.bodyAttrs}}},L=e3(G);if(G=wY(G,H),L)G=AY(G,K);let F=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(F&&G.includes("<head")){let V=F[1],R=sB(V);G=G.replace("<head>",`<head>
12050
+ <meta name="stx-layout" content="${QJ(V)}">
12051
+ <meta name="stx-layout-group" content="${QJ(R)}">`)}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=NY(G);if(J)try{let{getStoreScript:K}=await Promise.resolve().then(() => (tY(),aY)),q=X.storesDir,U=await K(q);if(U){let W=`<script data-stx-stores>${U}</script>`,z=G.indexOf("<script data-stx-scoped>");if(z!==-1){let B=G.indexOf("</script>",z+24);if(B!==-1){let _=B+9;G=G.slice(0,_)+`
12052
+ `+W+G.slice(_)}}}}catch{}if(J&&Z.__stx_inject_css!==!1)G=await OZ(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof u4)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(m0.log(q,{filePath:Y,context:Z}),p7.logDetailedError(q,{filePath:Y,template:$.substring(0,500)}),X.debug)throw q;return u7.createFallbackContent("Template Processing",q)}}async function aB($,Z,Y,X,Q){let J=process.cwd(),G={...X,partialsDir:X.partialsDir&&!E0.isAbsolute(X.partialsDir)?E0.resolve(J,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!E0.isAbsolute(X.componentsDir)?E0.resolve(J,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!E0.isAbsolute(X.layoutsDir)?E0.resolve(J,X.layoutsDir):X.layoutsDir},K=G,q=$;await $_(Y,Z),eB(Z,K),q=await n1(()=>GY(q,Z,Y,K),q,(O)=>{m0.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 U=V5(q,V9,(O,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);q=U.output;let W=U.tokens,z=(O)=>W.length===0?O:O.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(V,R)=>W[Number(R)]??""),B="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,B),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(O,V)=>{return`{{ ${V} }}`}),q=LY(q),q=await iY(q,Y,Q);let _={};q=r3(q,_);let j={...Z.__sections||{}},H="",L=/@nolayout\b/.test(q);if(L)q=q.replace(/@nolayout\b\s*/g,"");let F=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)H=F[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!H&&!L&&K.defaultLayout){let O=/<!DOCTYPE\s/i.test(q),V=/@section\s*\(/.test(q);if(!O||V){let R="",N=E0.dirname(Y),A=K.layoutsDir?E0.dirname(K.layoutsDir):process.cwd();for(let w=0;w<20;w++){let T=E0.join(N,"_layout.stx");if(await i(T)){R=T;break}let M=E0.dirname(N);if(M===N||M.length<A.length)break;N=M}if(R)H=R;else if(K.layoutsDir){let w=E0.isAbsolute(K.layoutsDir)?K.layoutsDir:E0.resolve(process.cwd(),K.layoutsDir),T=E0.join(w,`${K.defaultLayout}.stx`);if(await i(T))H=T}if(H&&!V)q=`@section('content')
11980
12053
  ${q.trim()}
11981
- @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,V,R)=>{return j[V]=R,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,V,R)=>{if(/^(['"]).*\1$/.test(R.trim()))return O;try{let A=$0(R.trim(),Z);if(A===void 0)return O;return j[V]=String(A??""),""}catch{return O}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,V,R)=>{if(R.includes("@parent"))j[V]=R.replace("@parent",C1);else j[V]=R.trim();return""}),Z.__sections=j,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,V,R)=>{return j[V]||R||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""});if(q=r3(q,_),H){let O=[];if(q=q.replace(/<(script|style)\b[\s\S]*?<\/\1>/gi,(V)=>{return O.push(V),""}),O.length>0){let V=O.join(`
12054
+ @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,V,R)=>{return j[V]=R,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,V,R)=>{if(/^(['"]).*\1$/.test(R.trim()))return O;try{let N=$0(R.trim(),Z);if(N===void 0)return O;return j[V]=String(N??""),""}catch{return O}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,V,R)=>{if(R.includes("@parent"))j[V]=R.replace("@parent",C1);else j[V]=R.trim();return""}),Z.__sections=j,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,V,R)=>{return j[V]||R||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""});if(q=a3(q,_),H){let O=[];if(q=q.replace(/<(script|style)\b[\s\S]*?<\/\1>/gi,(V)=>{return O.push(V),""}),O.length>0){let V=O.join(`
11982
12055
  `);j.content=j.content?`${j.content}
11983
- ${V}`:V,Z.__sections=j}}if(H)try{let O;if(k0.isAbsolute(H))O=H,Q.add(H);else O=await n1(()=>J7(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(m0.log(Error(T),{layoutPath:H,filePath:Y},"warning"),G.debug)throw new M1(T,Y);return q}let V=await n1(()=>Bun.file(O).text(),"",()=>{throw new M1(`Failed to read layout file: ${O}`,Y,void 0,void 0,"Layout content could not be loaded")}),R=V.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(R){if(G.debug)console.log(`Found nested layout: ${R[1]} in ${O}`);let T={},M=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(E,C,S)=>{return T[C]=S.trim(),""});for(let[E,C]of Object.entries(T))if(j[E]&&j[E].includes(C1)){let S=j[E].indexOf(C1);j[E]=j[E].slice(0,S)+C+j[E].slice(S+C1.length)}else if(!j[E])j[E]=C;let I={...Z,__sections:j},D=`@layout('${R[1]}')${M}`;return await F0(D,I,O,G,Q)}let A=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=s3(A,_),w={};return N=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(T,M,I)=>{return w[M]=I.trim(),`@slot('${M}')`}),N=N.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(T,M,I)=>{if(j[M]){let D=j[M];if(D.includes(C1)){let E=w[M]||"",C=D.indexOf(C1);D=D.slice(0,C)+E+D.slice(C+C1.length)}return D}return I||""}),N=oB(N,j),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),N=r3(N,_),Z.__originalFilePath=Y,q=await JJ(N,Z,O,G,Q),q=`<!-- stx-layout: ${H} -->
11984
- ${q}`,z(q)}catch(O){return m0.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 JJ(q,Z,Y,G,Q))}function oB($,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 sB($,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 rB($,Z){await n1(()=>U2($,Z),void 0,(Y)=>{m0.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function aB($,Z,Y){let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Q;while((Q=X.exec($))!==null){let J=Q[1],G=Q[2];if(!/\bserver\b/.test(J)||!G.trim())continue;try{let{extractVariables:q}=await Promise.resolve().then(() => (T5(),z4));await q(G,Z,Y,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));m0.log(W,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${W.message}`)}}}async function tB($,Z,Y){try{let{interpolateScriptsInTemplate:X}=await Promise.resolve().then(() => (c0(),M9));return X($,Z,{skipServer:!0})}catch(X){let Q=X instanceof Error?X:Error(String(X));return m0.log(Q,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${Q.message}`),$}}async function JJ($,Z,Y,X,Q){let J=$,G=X;if(await aB(J,Z,Y),J=await tB(J,Z,Y),J=await tY(J,Z,Y),J=await eY(J,Z,Y),J=await eZ(J,Z,Y,G),d1(J))J=K6(J,Z),J=U6(J,Z);J=q6(J);let{processStreamDirectives:K}=await Promise.resolve().then(() => (H3(),j3));J=K(J,Z),J=c3(J,Z,Y,G),J=await q$(J,Z,Y,G,Q),J=await L2(J,Z,Y,G,Q),J=s6(J,Z,Y,G);let{processDeferDirectives:q}=await Promise.resolve().then(() => t2);J=q(J,Z,Y);let{processTeleportDirectives:W}=await Promise.resolve().then(() => $X);J=W(J,Z,Y);let{processTransitionDirectives:U,processTransitionAttributes:z}=await Promise.resolve().then(() => JX);J=U(J,Z,Y),J=z(J);let{processErrorBoundaryDirectives:B}=await Promise.resolve().then(() => GX);J=B(J,Z,Y);let{processSuspenseDirectives:_}=await Promise.resolve().then(() => KX);J=_(J,Z,Y);let{processAsyncDirectives:j}=await Promise.resolve().then(() => zX);J=j(J,Z,Y);let{processKeepAliveDirectives:H}=await Promise.resolve().then(() => _X);J=H(J,Z,Y);let{processVirtualListDirectives:L,processVirtualGridDirectives:F,processInfiniteListDirectives:O}=await Promise.resolve().then(() => (VX(),FX));J=L(J,Z,Y),J=F(J,Z,Y),J=O(J,Z,Y);let{processPartialHydrationDirectives:V,processStaticDirectives:R}=await Promise.resolve().then(() => (CX(),PX));J=V(J,Z,Y),J=R(J);let{processComputedDirectives:A,processWatchDirectives:N}=await Promise.resolve().then(() => (iX(),cX));J=A(J,Z,Y),J=N(J,Z,Y);let{processFormValidationDirectives:w}=await Promise.resolve().then(() => (aX(),rX));J=w(J,Z,Y);let{processHeadDirective:T,processTitleDirective:M,processMetaDirective:I,resetHead:D}=await Promise.resolve().then(() => (N5(),a$));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)D();let E=T(J);if(J=E.content,E.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${E.headContent}
11985
- `;if(J=M(J,Z),J=I(J,Z),J=K2(J),J=Z3(J,Z),J=aZ(J),J=Y2(J),J=await o3(J,Z,Y,G,Q),J=await q$(J,Z,Y,G,Q),J=J.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),J=B6(J),J=k1(J,Z,Y),J=Y3(J,Z),J=X3(J,Z),J=Z$(J,Z),J=JY(J,Z),J=QY(J,Z),J=await fZ(J,Z,Y,G),J=await s9(J,Z,Y),J=await WY(J,Z,Y,G),J=u6(J,Z,Y,G),J=ZZ(J,Z,Y,G),J=YZ(J,Z,Y),J=XZ(J,Z,Y,G),J=oZ(J,Z,Y,G),J=E$(J,Z),J=k$(J),J=i2(J),!G.skipEventDirectives)J=bZ(J,Z,Y);if(J=vZ(J,Z,Y),G.debug){let y=/\bx-data\s*=/.test(J),x=D$($);if(y&&x)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
12056
+ ${V}`:V,Z.__sections=j}}if(H)try{let O;if(E0.isAbsolute(H))O=H,Q.add(H);else O=await n1(()=>Q7(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(m0.log(Error(T),{layoutPath:H,filePath:Y},"warning"),G.debug)throw new M1(T,Y);return q}let V=await n1(()=>Bun.file(O).text(),"",()=>{throw new M1(`Failed to read layout file: ${O}`,Y,void 0,void 0,"Layout content could not be loaded")}),R=V.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(R){if(G.debug)console.log(`Found nested layout: ${R[1]} in ${O}`);let T={},M=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(E,C,S)=>{return T[C]=S.trim(),""});for(let[E,C]of Object.entries(T))if(j[E]&&j[E].includes(C1)){let S=j[E].indexOf(C1);j[E]=j[E].slice(0,S)+C+j[E].slice(S+C1.length)}else if(!j[E])j[E]=C;let I={...Z,__sections:j},D=`@layout('${R[1]}')${M}`;return await F0(D,I,O,G,Q)}let N=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),A=r3(N,_),w={};return A=A.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(T,M,I)=>{return w[M]=I.trim(),`@slot('${M}')`}),A=A.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(T,M,I)=>{if(j[M]){let D=j[M];if(D.includes(C1)){let E=w[M]||"",C=D.indexOf(C1);D=D.slice(0,C)+E+D.slice(C+C1.length)}return D}return I||""}),A=tB(A,j),A=A.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),A=a3(A,_),Z.__originalFilePath=Y,q=await GJ(A,Z,O,G,Q),q=`<!-- stx-layout: ${H} -->
12057
+ ${q}`,z(q)}catch(O){return m0.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 GJ(q,Z,Y,G,Q))}function tB($,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 eB($,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 $_($,Z){await n1(()=>zY($,Z),void 0,(Y)=>{m0.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function Z_($,Z,Y){let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Q;while((Q=X.exec($))!==null){let J=Q[1],G=Q[2];if(!/\bserver\b/.test(J)||!G.trim())continue;try{let{extractVariables:q}=await Promise.resolve().then(() => (I5(),z4));await q(G,Z,Y,{preserveExisting:!0})}catch(q){let U=q instanceof Error?q:Error(String(q));m0.log(U,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${U.message}`)}}}async function Y_($,Z,Y){try{let{interpolateScriptsInTemplate:X}=await Promise.resolve().then(() => (c0(),I9));return X($,Z,{skipServer:!0})}catch(X){let Q=X instanceof Error?X:Error(String(X));return m0.log(Q,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${Q.message}`),$}}async function GJ($,Z,Y,X,Q){let J=$,G=X;if(await Z_(J,Z,Y),J=await Y_(J,Z,Y),J=await $Y(J,Z,Y),J=await ZY(J,Z,Y),J=await $2(J,Z,Y,G),d1(J))J=q6(J,Z),J=W6(J,Z);J=U6(J);let{processStreamDirectives:K}=await Promise.resolve().then(() => (O3(),H3));J=K(J,Z),J=i3(J,Z,Y,G),J=await q$(J,Z,Y,G,Q),J=await VY(J,Z,Y,G,Q),J=r6(J,Z,Y,G);let{processDeferDirectives:q}=await Promise.resolve().then(() => $X);J=q(J,Z,Y);let{processTeleportDirectives:U}=await Promise.resolve().then(() => YX);J=U(J,Z,Y);let{processTransitionDirectives:W,processTransitionAttributes:z}=await Promise.resolve().then(() => GX);J=W(J,Z,Y),J=z(J);let{processErrorBoundaryDirectives:B}=await Promise.resolve().then(() => qX);J=B(J,Z,Y);let{processSuspenseDirectives:_}=await Promise.resolve().then(() => UX);J=_(J,Z,Y);let{processAsyncDirectives:j}=await Promise.resolve().then(() => _X);J=j(J,Z,Y);let{processKeepAliveDirectives:H}=await Promise.resolve().then(() => HX);J=H(J,Z,Y);let{processVirtualListDirectives:L,processVirtualGridDirectives:F,processInfiniteListDirectives:O}=await Promise.resolve().then(() => (NX(),RX));J=L(J,Z,Y),J=F(J,Z,Y),J=O(J,Z,Y);let{processPartialHydrationDirectives:V,processStaticDirectives:R}=await Promise.resolve().then(() => (xX(),vX));J=V(J,Z,Y),J=R(J);let{processComputedDirectives:N,processWatchDirectives:A}=await Promise.resolve().then(() => (oX(),nX));J=N(J,Z,Y),J=A(J,Z,Y);let{processFormValidationDirectives:w}=await Promise.resolve().then(() => (eX(),tX));J=w(J,Z,Y);let{processHeadDirective:T,processTitleDirective:M,processMetaDirective:I,resetHead:D}=await Promise.resolve().then(() => (T5(),t$));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)D();let E=T(J);if(J=E.content,E.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${E.headContent}
12058
+ `;if(J=M(J,Z),J=I(J,Z),J=UY(J),J=Y3(J,Z),J=tZ(J),J=JY(J),J=await s3(J,Z,Y,G,Q),J=await q$(J,Z,Y,G,Q),J=J.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),J=_6(J),J=k1(J,Z,Y),J=X3(J,Z),J=J3(J,Z),J=Z$(J,Z),J=Q2(J,Z),J=G2(J,Z),J=await gZ(J,Z,Y,G),J=await r9(J,Z,Y),J=await z2(J,Z,Y,G),J=l6(J,Z,Y,G),J=YZ(J,Z,Y,G),J=XZ(J,Z,Y),J=JZ(J,Z,Y,G),J=sZ(J,Z,Y,G),J=E$(J,Z),J=k$(J),J=oY(J),!G.skipEventDirectives)J=SZ(J,Z,Y);if(J=xZ(J,Z,Y),G.debug){let P=/\bx-data\s*=/.test(J),x=D$($);if(P&&x)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
11986
12059
  Both work on the same page, but they manage separate scopes.
11987
- Prefer signals (state/derived/effect) for new components.`)}J=B2(J,Z),J=await p0(J,Z,Y),J=n2(J),J=o2(J),J=AZ(J);let{processXElementDirectives:C}=await Promise.resolve().then(() => $J);J=C(J);let S=Z.__originalFilePath||Y,k=j5(Z);if(J=await W6(J,G,S,k),J=await Q2(J,Z,Y,G),G.media?.image?.autoSiblings){let y=G.publicDir||"public",{rewriteImagesWithSiblings:x}=await Promise.resolve().then(() => (YJ(),ZJ));J=await x(J,{publicDir:y})}if(G.seo?.enabled)J=JZ(J,Z,G);let P=(y,x)=>{if(!x)return y;if(/<\/head>/i.test(y))return y.replace(/<\/head>/i,`${x}
11988
- </head>`);if(/<head\b[^>]*>/i.test(y))return y.replace(/(<head\b[^>]*>)/i,`$1
11989
- ${x}`);if(/<html\b[^>]*>/i.test(y))return y.replace(/(<html\b[^>]*>)/i,`$1
12060
+ Prefer signals (state/derived/effect) for new components.`)}J=jY(J,Z),J=await p0(J,Z,Y),J=sY(J),J=rY(J),J=AZ(J);let{processXElementDirectives:C}=await Promise.resolve().then(() => YJ);J=C(J);let S=Z.__originalFilePath||Y,k=O5(Z);if(J=await z6(J,G,S,k),J=await KY(J,Z,Y,G),G.media?.image?.autoSiblings){let P=G.publicDir||"public",{rewriteImagesWithSiblings:x}=await Promise.resolve().then(() => (JJ(),XJ));J=await x(J,{publicDir:P})}if(G.seo?.enabled)J=QZ(J,Z,G);let y=(P,x)=>{if(!x)return P;if(/<\/head>/i.test(P))return P.replace(/<\/head>/i,`${x}
12061
+ </head>`);if(/<head\b[^>]*>/i.test(P))return P.replace(/(<head\b[^>]*>)/i,`$1
12062
+ ${x}`);if(/<html\b[^>]*>/i.test(P))return P.replace(/(<html\b[^>]*>)/i,`$1
11990
12063
  <head>
11991
12064
  ${x}
11992
- </head>`);return y},{renderHead:d,getHead:g}=await Promise.resolve().then(() => (N5(),a$)),m=Z.__stx_runtime_head,s=m&&(m.title||m.meta?.length||m.link?.length)?m:g();if(s.title||s.meta?.length||s.link?.length){let y=d(s);if(y)J=P(J,y)}if(E.headContent)J=P(J,E.headContent);if(G.csp?.enabled&&G.csp.addMetaTag)J=nZ(J,G.csp,Z);if(G.analytics?.enabled)J=wZ(J,G);if(G.heatmap?.enabled)J=$9(J,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:y}=await Promise.resolve().then(() => (t5(),f6));J=y(J,G)}let Z0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(J),o0=/\bSTX\.\w+/.test(J),P0=/window\.STX\s*=/.test(J);if(Z0&&o0&&!P0){let x=`<script data-stx-scoped>
11993
- ${LZ()}
11994
- </script>`;if(J.includes("</head>")){let u=J.indexOf("</head>"),Y0=J.slice(0,u).indexOf("<script");if(Y0!==-1){let q0=J.slice(0,Y0),I0=J.slice(Y0);J=q0+x+`
11995
- `+I0}else J=J.replace("</head>",`${x}
12065
+ </head>`);return P},{renderHead:d,getHead:g}=await Promise.resolve().then(() => (T5(),t$)),m=Z.__stx_runtime_head,s=m&&(m.title||m.meta?.length||m.link?.length)?m:g();if(s.title||s.meta?.length||s.link?.length){let P=d(s);if(P)J=y(J,P)}if(E.headContent)J=y(J,E.headContent);if(G.csp?.enabled&&G.csp.addMetaTag)J=oZ(J,G.csp,Z);if(G.analytics?.enabled)J=TZ(J,G);if(G.heatmap?.enabled)J=Z9(J,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:P}=await Promise.resolve().then(() => (t5(),g6));J=P(J,G)}let Z0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(J),o0=/\bSTX\.\w+/.test(J),P0=/window\.STX\s*=/.test(J);if(Z0&&o0&&!P0){let x=`<script data-stx-scoped>
12066
+ ${FZ()}
12067
+ </script>`;if(J.includes("</head>")){let u=J.indexOf("</head>"),Y0=J.slice(0,u).indexOf("<script");if(Y0!==-1){let q0=J.slice(0,Y0),k0=J.slice(Y0);J=q0+x+`
12068
+ `+k0}else J=J.replace("</head>",`${x}
11996
12069
  </head>`)}else if(J.includes("<body"))J=J.replace(/<body([^>]*)>/,`<body$1>
11997
12070
  ${x}`);else J=x+`
11998
- `+J}{let y=/<script\s+server\b[^>]*>/gi,x,u=[];while((x=y.exec(J))!==null){let l=x.index+x[0].length,Y0=iB(J,l);if(Y0===-1)continue;let q0=Y0+9;while(q0<J.length&&/\s/.test(J[q0]))q0++;u.push({start:x.index,end:q0}),y.lastIndex=q0}for(let l=u.length-1;l>=0;l--){let{start:Y0,end:q0}=u[l];J=J.substring(0,Y0)+J.substring(q0)}}let T0=q4(J,Y);if(T0.hasScoped)J=T0.html;let e=Z.__stx_event_bindings||[],M0=!1,C0=[],v=/\s:[a-z][\w.-]*\s*=/.test(J),{scanScriptTags:f}=await Promise.resolve().then(() => (z6(),m2));for(let y of f(J,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))C0.push({match:y.fullMatch,attrs:y.attrs,content:y.body});for(let{match:y,attrs:x,content:u}of C0){M0=!0;let l=u;b$(u,Y,X.strict);let Y0=await H5(u,{eventBindings:e,attrs:x,hasColonDirectives:v,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:k});J=J.replace(y,()=>Y0)}if(M0)Z.__stx_event_bindings=[];return J}var C1="<!--PARENT_CONTENT_PLACEHOLDER-->";var _4=b(()=>{OZ();K4();d$();FZ();NZ();TZ();l$();m$();SZ();O5();xZ();gZ();t4();sZ();tZ();ZY();t0();N5();c0();GY();zY();aY();Z2();i3();Q7();G2();l1();q2();p7();H0();W2();_2();O2();F2();r$();z6();p3();c2();_6();j6();L0();L3();_6();j6()});import X_ from"fs";import L6 from"path";import HJ from"fs";import s0 from"path";var N6=[72,96,128,144,152,192,384,512],w6=[120,152,167,180],T6=[16,32];async function M6($,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=s0.isAbsolute(X.src)?X.src:s0.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=s0.resolve(Z,X.outputDir||"pwa-icons");try{HJ.mkdirSync(J,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${J}`),Y.success=!1,Y}let G=X.sizes||N6,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
11999
- 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=s0.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=s0.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 w6){let O=s0.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=s0.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 T6){let F=s0.join(J,`favicon-${L}x${L}.png`);await W.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Y.generatedFiles.push(F)}let B=512,_=s0.join(J,`icon-maskable-${B}x${B}.png`),j=Math.floor(B*0.1),H=B-j*2;await W.default(Q).resize(H,H,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:j,bottom:j,left:j,right:j,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 K_($){let Z=$.sizes||N6,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 w6)J.push(`${Y}/apple-touch-icon-${G}x${G}.png`)}for(let G of T6)J.push(`${Y}/favicon-${G}x${G}.png`);return J.push(`${Y}/icon-maskable-512x512.png`),J}async function I6(){try{return await import("sharp"),!0}catch{return!1}}t5();function xJ($,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 fJ($){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 gJ($){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 hJ($){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 dJ($){let Z=$.pwa?.protocolHandlers;if(!Z||Z.length===0)return;return Z.map((Y)=>({protocol:Y.protocol,url:Y.url}))}function mJ($){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:xJ(Q,J,G,K)};if(Y.shortcuts&&Y.shortcuts.length>0)q.shortcuts=fJ(Y.shortcuts);if(Y.screenshots&&Y.screenshots.length>0)q.screenshots=Y.screenshots.map((B)=>({src:B.src,sizes:B.sizes,type:B.type,label:B.label,form_factor:B.platform}));let W=gJ($);if(W)q.share_target=W;let U=hJ($);if(U)q.file_handlers=U;let z=dJ($);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 g6($){let Z=mJ($);if(!Z)return"";let Y=JSON.parse(JSON.stringify(Z));return JSON.stringify(Y,null,2)}function L_($,Z){return{...Z,...$,shortcuts:$.shortcuts||Z.shortcuts,screenshots:$.screenshots||Z.screenshots,categories:$.categories||Z.categories}}function F_($){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 GJ from"path";async function KJ($){let Z=$.pwa?.offline;if(!Z?.enabled)return"";if(Z.page){let Y=GJ.isAbsolute(Z.page)?Z.page:GJ.resolve(process.cwd(),Z.page);if(await Bun.file(Y).exists())try{let{processDirectives:X}=await Promise.resolve().then(() => (_4(),QJ)),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 eB($)}function eB($){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>
12071
+ `+J}{let P=/<script\s+server\b[^>]*>/gi,x,u=[];while((x=P.exec(J))!==null){let l=x.index+x[0].length,Y0=rB(J,l);if(Y0===-1)continue;let q0=Y0+9;while(q0<J.length&&/\s/.test(J[q0]))q0++;u.push({start:x.index,end:q0}),P.lastIndex=q0}for(let l=u.length-1;l>=0;l--){let{start:Y0,end:q0}=u[l];J=J.substring(0,Y0)+J.substring(q0)}}let M0=q4(J,Y);if(M0.hasScoped)J=M0.html;let e=Z.__stx_event_bindings||[],N0=!1,C0=[],v=/\s:[a-z][\w.-]*\s*=/.test(J),{scanScriptTags:f}=await Promise.resolve().then(() => (B6(),lY));for(let P of f(J,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))C0.push({match:P.fullMatch,attrs:P.attrs,content:P.body});for(let{match:P,attrs:x,content:u}of C0){N0=!0;let l=u;b$(u,Y,X.strict);let Y0=await L5(u,{eventBindings:e,attrs:x,hasColonDirectives:v,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:k});J=J.replace(P,()=>Y0)}if(N0)Z.__stx_event_bindings=[];return J}var C1="<!--PARENT_CONTENT_PLACEHOLDER-->";var _4=b(()=>{LZ();K4();d$();VZ();wZ();MZ();l$();m$();yZ();F5();fZ();hZ();t4();rZ();eZ();Y2();e0();T5();c0();K2();B2();e2();XY();n3();G7();qY();l1();WY();c7();H0();BY();HY();FY();RY();a$();B6();c3();nY();j6();H6();L0();F3();j6();H6()});import K_ from"fs";import F6 from"path";import LJ from"fs";import r0 from"path";var w6=[72,96,128,144,152,192,384,512],T6=[120,152,167,180],M6=[16,32];async function I6($,Z){let Y={success:!0,generatedFiles:[],errors:[],warnings:[]},X=$.pwa?.icons;if(!X?.src)return Y.errors.push("No source icon specified in pwa.icons.src"),Y.success=!1,Y;let Q=r0.isAbsolute(X.src)?X.src:r0.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=r0.resolve(Z,X.outputDir||"pwa-icons");try{LJ.mkdirSync(J,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${J}`),Y.success=!1,Y}let G=X.sizes||w6,K=X.generateWebP??!0,q=X.generateAppleIcons??!0;try{let U;try{U=await import("sharp")}catch{return Y.errors.push(`sharp is not installed. Install it with: bun add sharp
12072
+ Icon generation requires the sharp package for image processing.`),Y.success=!1,Y}let z=await U.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=r0.join(J,`icon-${L}x${L}.png`);if(await U.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=r0.join(J,`icon-${L}x${L}.webp`);await U.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 T6){let O=r0.join(J,`apple-touch-icon-${F}x${F}.png`);await U.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=r0.join(J,"apple-touch-icon.png");await U.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 M6){let F=r0.join(J,`favicon-${L}x${L}.png`);await U.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Y.generatedFiles.push(F)}let B=512,_=r0.join(J,`icon-maskable-${B}x${B}.png`),j=Math.floor(B*0.1),H=B-j*2;await U.default(Q).resize(H,H,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:j,bottom:j,left:j,right:j,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(_),Y.generatedFiles.push(_)}catch(U){let W=U instanceof Error?U.message:String(U);Y.errors.push(`Icon generation failed: ${W}`),Y.success=!1}return Y}function z_($){let Z=$.sizes||w6,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 T6)J.push(`${Y}/apple-touch-icon-${G}x${G}.png`)}for(let G of M6)J.push(`${Y}/favicon-${G}x${G}.png`);return J.push(`${Y}/icon-maskable-512x512.png`),J}async function D6(){try{return await import("sharp"),!0}catch{return!1}}t5();function gJ($,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 hJ($){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 dJ($){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 mJ($){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 uJ($){let Z=$.pwa?.protocolHandlers;if(!Z||Z.length===0)return;return Z.map((Y)=>({protocol:Y.protocol,url:Y.url}))}function lJ($){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:gJ(Q,J,G,K)};if(Y.shortcuts&&Y.shortcuts.length>0)q.shortcuts=hJ(Y.shortcuts);if(Y.screenshots&&Y.screenshots.length>0)q.screenshots=Y.screenshots.map((B)=>({src:B.src,sizes:B.sizes,type:B.type,label:B.label,form_factor:B.platform}));let U=dJ($);if(U)q.share_target=U;let W=mJ($);if(W)q.file_handlers=W;let z=uJ($);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 h6($){let Z=lJ($);if(!Z)return"";let Y=JSON.parse(JSON.stringify(Z));return JSON.stringify(Y,null,2)}function N_($,Z){return{...Z,...$,shortcuts:$.shortcuts||Z.shortcuts,screenshots:$.screenshots||Z.screenshots,categories:$.categories||Z.categories}}function A_($){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 qJ from"path";async function UJ($){let Z=$.pwa?.offline;if(!Z?.enabled)return"";if(Z.page){let Y=qJ.isAbsolute(Z.page)?Z.page:qJ.resolve(process.cwd(),Z.page);if(await Bun.file(Y).exists())try{let{processDirectives:X}=await Promise.resolve().then(() => (_4(),KJ)),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 X_($)}function X_($){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>
12000
12073
  <html lang="en">
12001
12074
  <head>
12002
12075
  <meta charset="UTF-8">
@@ -12229,9 +12302,9 @@ Icon generation requires the sharp package for image processing.`),Y.success=!1,
12229
12302
  }, 5000);
12230
12303
  </script>
12231
12304
  </body>
12232
- </html>`}function P$($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}G5();K5();import v1 from"fs";import C$ from"path";function $_($){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 Z_($){let Z=[],Y=C$.join($,"manifest.json"),X=v1.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(v1.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=C$.join($,"sw.js"),J=v1.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=C$.join($,"offline.html"),K=v1.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=C$.join($,"pwa-icons");if(v1.existsSync(q)){let U=v1.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 Y_($){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 LA($,Z){let Y=$_($),X=Z&&v1.existsSync(Z)?Z_(Z):[];return Y_([...Y,...X])}function FA($){let Z=[];Z.push(`
12305
+ </html>`}function P$($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}q5();U5();import v1 from"fs";import C$ from"path";function J_($){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 Q_($){let Z=[],Y=C$.join($,"manifest.json"),X=v1.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 W=JSON.parse(v1.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(W.icons)&&W.icons.length>0,message:W.icons?.length?`${W.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=C$.join($,"sw.js"),J=v1.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=C$.join($,"offline.html"),K=v1.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=C$.join($,"pwa-icons");if(v1.existsSync(q)){let W=v1.readdirSync(q).filter((z)=>z.endsWith(".png")||z.endsWith(".webp"));Z.push({id:"build-icons",name:"Generated Icons",category:"required",passed:W.length>0,message:W.length>0?`${W.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 G_($){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 NN($,Z){let Y=J_($),X=Z&&v1.existsSync(Z)?Q_(Z):[];return G_([...Y,...X])}function AN($){let Z=[];Z.push(`
12233
12306
  === PWA Audit Report ===
12234
12307
  `);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}
12235
12308
  `);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(`
12236
12309
  ${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(`
12237
- `)}g7();t5();G5();K5();async function EA($,Z){let Y={success:!0,files:{icons:[]},errors:[],warnings:[]},X=$.pwa;if(!X?.enabled)return Y;try{X_.mkdirSync(Z,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${Z}`),Y.success=!1,Y}try{let J=g6($);if(J){let G=L6.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 I6()){let G=await M6($,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 KJ($);if(J){let G=L6.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=H1(Z,$);Q={fileCount:J.fileCount,totalSize:J.totalSize},Y.precacheStats=Q}try{let J=r5($,Z);if(J){let G=f1($),K=L6.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 kA($,Z){return h$($,Z)}function bA($){return $.pwa?.enabled===!0}export{F_ as validateManifest,LA as runPwaAudit,hH as registerPwaDirectives,fK as pwaUpdateDirective,hK as pwaPushDirective,gK as pwaOfflineDirective,xK as pwaInstallDirective,f7 as pwaDirectives,kA as processPwaHtml,L_ as mergeManifestConfig,x6 as isWorkboxEnabled,I6 as isSharpAvailable,bA as isPwaEnabled,h$ as injectPwaTags,f1 as getServiceWorkerFileName,K_ as getExpectedIconPaths,vJ as generateThemeColorMeta,PJ as generateSwRegistrationScript,yJ as generateServiceWorkerAuto,r5 as generateServiceWorker,a5 as generatePwaTags,M6 as generatePwaIcons,s5 as generatePrecacheManifestJs,H1 as generatePrecacheManifest,KJ as generateOfflinePage,CJ as generateManifestLink,g6 as generateManifestJson,mJ as generateManifest,E6 as formatSize,FA as formatAuditResult,Y_ as calculateAuditResult,EA as buildPwaAssets,$_ as auditConfig,Z_ as auditBuildOutput,T6 as FAVICON_SIZES,N6 as DEFAULT_ICON_SIZES,w6 as APPLE_TOUCH_ICON_SIZES};
12310
+ `)}h7();t5();q5();U5();async function yN($,Z){let Y={success:!0,files:{icons:[]},errors:[],warnings:[]},X=$.pwa;if(!X?.enabled)return Y;try{K_.mkdirSync(Z,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${Z}`),Y.success=!1,Y}try{let J=h6($);if(J){let G=F6.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 D6()){let G=await I6($,Z);if(Y.files.icons=G.generatedFiles,Y.warnings.push(...G.warnings),!G.success)Y.errors.push(...G.errors),Y.success=!1}else Y.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(X.offline?.enabled)try{let J=await UJ($);if(J){let G=F6.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=H1(Z,$);Q={fileCount:J.fileCount,totalSize:J.totalSize},Y.precacheStats=Q}try{let J=r5($,Z);if(J){let G=f1($),K=F6.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 PN($,Z){return h$($,Z)}function CN($){return $.pwa?.enabled===!0}export{A_ as validateManifest,NN as runPwaAudit,lH as registerPwaDirectives,mK as pwaUpdateDirective,lK as pwaPushDirective,uK as pwaOfflineDirective,dK as pwaInstallDirective,g7 as pwaDirectives,PN as processPwaHtml,N_ as mergeManifestConfig,f6 as isWorkboxEnabled,D6 as isSharpAvailable,CN as isPwaEnabled,h$ as injectPwaTags,f1 as getServiceWorkerFileName,z_ as getExpectedIconPaths,fJ as generateThemeColorMeta,vJ as generateSwRegistrationScript,CJ as generateServiceWorkerAuto,r5 as generateServiceWorker,a5 as generatePwaTags,I6 as generatePwaIcons,s5 as generatePrecacheManifestJs,H1 as generatePrecacheManifest,UJ as generateOfflinePage,xJ as generateManifestLink,h6 as generateManifestJson,lJ as generateManifest,k6 as formatSize,AN as formatAuditResult,G_ as calculateAuditResult,yN as buildPwaAssets,J_ as auditConfig,Q_ as auditBuildOutput,M6 as FAVICON_SIZES,w6 as DEFAULT_ICON_SIZES,T6 as APPLE_TOUCH_ICON_SIZES};