@stacksjs/stx 0.2.42 → 0.2.43

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.
Files changed (5) hide show
  1. package/dist/cli.js +420 -415
  2. package/dist/index.js +539 -534
  3. package/dist/pwa.js +218 -213
  4. package/dist/ssg.js +235 -230
  5. package/package.json +1 -1
package/dist/pwa.js CHANGED
@@ -1,26 +1,26 @@
1
1
  // @bun
2
- var{defineProperty:f9,getOwnPropertyNames:WZ,getOwnPropertyDescriptor:BZ}=Object,zZ=Object.prototype.hasOwnProperty;function jZ($){return this[$]}var _7=($)=>{var Y=(U7??=new WeakMap).get($),Z;if(Y)return Y;if(Y=f9({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function"){for(var X of WZ($))if(!zZ.call(Y,X))f9(Y,X,{get:jZ.bind($,X),enumerable:!(Z=BZ($,X))||Z.enumerable})}return U7.set($,Y),Y},U7;var OZ=($)=>$;function HZ($,Y){this[$]=OZ.bind(null,Y)}var r=($,Y)=>{for(var Z in Y)f9($,Z,{get:Y[Z],enumerable:!0,configurable:!0,set:HZ.bind(Y,Z)})};var b=($,Y)=>()=>($&&(Y=$($=0)),Y);var $0=import.meta.require;import z5 from"fs";import j5 from"path";function VZ($){let Y=0;for(let Z=0;Z<$.length;Z++){let X=$[Z];Y=(Y<<5)-Y+X,Y=Y&Y}return Math.abs(Y).toString(16).padStart(8,"0")}function RZ($,Y){let Z=j5.basename($);for(let X of Y)if(X.startsWith("*.")){let Q=X.slice(1);if(Z.endsWith(Q))return!0}else if(X.includes("*")){let Q=new RegExp(`^${X.replace(/\*/g,".*")}$`);if(Q.test(Z)||Q.test($))return!0}else if(Z===X||$.includes(X))return!0;return!1}function NZ($,Y,Z){let X=j5.extname($).toLowerCase(),Q=FZ[X],J=(Z.maxFileSizeKB||500)*1024;if(Y>J)return!1;if(Z.exclude&&RZ($,Z.exclude))return!1;if(Z.include&&Z.include.length>0){for(let G of Z.include)if(G.startsWith("*.")){if($.endsWith(G.slice(1)))return!0}else if($.includes(G))return!0}if(Q&&Z[Q]===!0)return!0;if(!Q)return!1;return!1}function H7($,Y,Z,X){let Q=z5.readdirSync($,{withFileTypes:!0});for(let J of Q){let G=j5.join($,J.name);if(J.isDirectory()){if(["node_modules",".git",".stx"].includes(J.name))continue;H7(G,Y,Z,X)}else if(J.isFile()){let K=z5.statSync(G),q=j5.relative(Y,G);if(NZ(q,K.size,Z)){let _=z5.readFileSync(G),U=VZ(_),W=`/${q.replace(/\\/g,"/")}`;X.push({url:W,revision:U,size:K.size})}}}}function $1($,Y){let Z=Y.pwa?.precache,X=[];if(!Z?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!z5.existsSync($))return{entries:[],totalSize:0,fileCount:0};H7($,$,Z,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 O5($){if($.entries.length===0)return"[]";return`[
2
+ var{defineProperty:f9,getOwnPropertyNames:BZ,getOwnPropertyDescriptor:zZ}=Object,jZ=Object.prototype.hasOwnProperty;function OZ($){return this[$]}var _7=($)=>{var Y=(U7??=new WeakMap).get($),Z;if(Y)return Y;if(Y=f9({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function"){for(var X of BZ($))if(!jZ.call(Y,X))f9(Y,X,{get:OZ.bind($,X),enumerable:!(Z=zZ($,X))||Z.enumerable})}return U7.set($,Y),Y},U7;var HZ=($)=>$;function LZ($,Y){this[$]=HZ.bind(null,Y)}var r=($,Y)=>{for(var Z in Y)f9($,Z,{get:Y[Z],enumerable:!0,configurable:!0,set:LZ.bind(Y,Z)})};var S=($,Y)=>()=>($&&(Y=$($=0)),Y);var $0=import.meta.require;import z5 from"fs";import j5 from"path";function RZ($){let Y=0;for(let Z=0;Z<$.length;Z++){let X=$[Z];Y=(Y<<5)-Y+X,Y=Y&Y}return Math.abs(Y).toString(16).padStart(8,"0")}function NZ($,Y){let Z=j5.basename($);for(let X of Y)if(X.startsWith("*.")){let Q=X.slice(1);if(Z.endsWith(Q))return!0}else if(X.includes("*")){let Q=new RegExp(`^${X.replace(/\*/g,".*")}$`);if(Q.test(Z)||Q.test($))return!0}else if(Z===X||$.includes(X))return!0;return!1}function AZ($,Y,Z){let X=j5.extname($).toLowerCase(),Q=VZ[X],J=(Z.maxFileSizeKB||500)*1024;if(Y>J)return!1;if(Z.exclude&&NZ($,Z.exclude))return!1;if(Z.include&&Z.include.length>0){for(let G of Z.include)if(G.startsWith("*.")){if($.endsWith(G.slice(1)))return!0}else if($.includes(G))return!0}if(Q&&Z[Q]===!0)return!0;if(!Q)return!1;return!1}function H7($,Y,Z,X){let Q=z5.readdirSync($,{withFileTypes:!0});for(let J of Q){let G=j5.join($,J.name);if(J.isDirectory()){if(["node_modules",".git",".stx"].includes(J.name))continue;H7(G,Y,Z,X)}else if(J.isFile()){let K=z5.statSync(G),q=j5.relative(Y,G);if(AZ(q,K.size,Z)){let _=z5.readFileSync(G),U=RZ(_),W=`/${q.replace(/\\/g,"/")}`;X.push({url:W,revision:U,size:K.size})}}}}function Y1($,Y){let Z=Y.pwa?.precache,X=[];if(!Z?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!z5.existsSync($))return{entries:[],totalSize:0,fileCount:0};H7($,$,Z,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 O5($){if($.entries.length===0)return"[]";return`[
3
3
  ${$.entries.map((Z)=>` { url: '${Z.url}', revision: '${Z.revision}' }`).join(`,
4
4
  `)}
5
- ]`}function L7($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1048576).toFixed(2)} MB`}var FZ;var d1=b(()=>{FZ={".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 AZ($){let Y={"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 Y[$]||Y["network-first"]}function g9($){return AZ($).className}function F7($){let Y=$.pwa;if(!Y?.enabled)return"";let Z=Y.routes||[],X=Y.cacheStorage,Q=[];for(let J of Z){let G=g9(J.strategy),K=[];if(J.maxAgeSeconds||J.maxEntries||X?.maxEntries){let _=J.maxEntries||X?.maxEntries||100,U=J.maxAgeSeconds||(X?.maxAge?X.maxAge*24*60*60:void 0);K.push(`new ExpirationPlugin({
5
+ ]`}function L7($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1048576).toFixed(2)} MB`}var VZ;var m1=S(()=>{VZ={".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 wZ($){let Y={"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 Y[$]||Y["network-first"]}function g9($){return wZ($).className}function F7($){let Y=$.pwa;if(!Y?.enabled)return"";let Z=Y.routes||[],X=Y.cacheStorage,Q=[];for(let J of Z){let G=g9(J.strategy),K=[];if(J.maxAgeSeconds||J.maxEntries||X?.maxEntries){let _=J.maxEntries||X?.maxEntries||100,U=J.maxAgeSeconds||(X?.maxAge?X.maxAge*24*60*60:void 0);K.push(`new ExpirationPlugin({
6
6
  maxEntries: ${_},
7
7
  ${U?`maxAgeSeconds: ${U},`:""}
8
8
  purgeOnQuotaError: true,
9
9
  })`)}if(J.strategy==="network-first"||J.strategy==="stale-while-revalidate")K.push(`new CacheableResponsePlugin({
10
10
  statuses: [0, 200],
11
- })`);let q=wZ(J.pattern);Q.push(`
11
+ })`);let q=TZ(J.pattern);Q.push(`
12
12
  // ${J.pattern}
13
13
  registerRoute(
14
14
  ${q},
15
15
  new ${G}({
16
- cacheName: '${J.cacheName||MZ(J.pattern)}',
16
+ cacheName: '${J.cacheName||IZ(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 wZ($){if($.startsWith("*.")){let Y=$.slice(2);return`({ request }) => request.destination === '${TZ(Y)}'`}if($.endsWith("/**"))return`({ url }) => url.pathname.startsWith('${$.slice(0,-3)}')`;if($.endsWith("/*")){let Y=$.slice(0,-2);return`({ url }) => url.pathname.startsWith('${Y}') && !url.pathname.slice(${Y.length+1}).includes('/')`}if($.includes("*")&&!$.startsWith("*")){let[Y,Z]=$.split("*");return`({ url }) => url.pathname.startsWith('${Y}') && url.pathname.endsWith('${Z}')`}if($==="/"||!$.includes("*"))return`({ url }) => url.pathname === '${$}'`;return`new RegExp('${IZ($).replace(/\\\*/g,".*")}')`}function TZ($){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 MZ($){return"stx-"+$.replace(/[^\w]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase().slice(0,30)+"-cache"}function IZ($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var A7={};r(A7,{isWorkboxEnabled:()=>N7,getServiceWorkerGenerator:()=>bZ,generateWorkboxServiceWorker:()=>R7,generateWorkboxConfig:()=>V7});function V7($,Y){let Z=$.pwa;if(!Z?.enabled)return{mode:"generate",modules:[],skipWaiting:!0,clientsClaim:!0};let X=Z.serviceWorker||{},Q=Z.routes||[],J=[{name:"workbox-precaching",exports:["precacheAndRoute","cleanupOutdatedCaches"]},{name:"workbox-routing",exports:["registerRoute","NavigationRoute","setDefaultHandler"]}],G=new Set;for(let _ of Q)G.add(g9(_.strategy));if(G.size>0)J.push({name:"workbox-strategies",exports:Array.from(G)});if(Q.some((_)=>_.maxAgeSeconds||_.maxEntries)||Z.cacheStorage)J.push({name:"workbox-expiration",exports:["ExpirationPlugin"]});if(Q.some((_)=>_.strategy==="network-first"||_.strategy==="stale-while-revalidate"))J.push({name:"workbox-cacheable-response",exports:["CacheableResponsePlugin"]});if(Z.backgroundSync?.enabled)J.push({name:"workbox-background-sync",exports:["BackgroundSyncPlugin","Queue"]});if(X.navigationPreload)J.push({name:"workbox-navigation-preload",exports:["enable"]});let q=Y?$1(Y,$):void 0;return{mode:"generate",modules:J,precacheManifest:q?.entries,skipWaiting:X.skipWaiting??!0,clientsClaim:X.clientsClaim??!0,offlineFallback:Z.offline?.enabled?"/offline.html":void 0,navigationPreload:X.navigationPreload??!1,cacheVersion:X.cacheVersion||"1.0.0"}}function R7($,Y){let Z=$.pwa;if(!Z?.enabled)return"";let X=V7($,Y),Q=Z.serviceWorker||{},J=Z.push,G=Z.backgroundSync,K=Y?$1(Y,$):null,q=K?O5(K):"[]",_=EZ(X.modules),U=F7($);return`/**
23
+ `)}function TZ($){if($.startsWith("*.")){let Y=$.slice(2);return`({ request }) => request.destination === '${MZ(Y)}'`}if($.endsWith("/**"))return`({ url }) => url.pathname.startsWith('${$.slice(0,-3)}')`;if($.endsWith("/*")){let Y=$.slice(0,-2);return`({ url }) => url.pathname.startsWith('${Y}') && !url.pathname.slice(${Y.length+1}).includes('/')`}if($.includes("*")&&!$.startsWith("*")){let[Y,Z]=$.split("*");return`({ url }) => url.pathname.startsWith('${Y}') && url.pathname.endsWith('${Z}')`}if($==="/"||!$.includes("*"))return`({ url }) => url.pathname === '${$}'`;return`new RegExp('${EZ($).replace(/\\\*/g,".*")}')`}function MZ($){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 IZ($){return"stx-"+$.replace(/[^\w]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase().slice(0,30)+"-cache"}function EZ($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var A7={};r(A7,{isWorkboxEnabled:()=>N7,getServiceWorkerGenerator:()=>yZ,generateWorkboxServiceWorker:()=>R7,generateWorkboxConfig:()=>V7});function V7($,Y){let Z=$.pwa;if(!Z?.enabled)return{mode:"generate",modules:[],skipWaiting:!0,clientsClaim:!0};let X=Z.serviceWorker||{},Q=Z.routes||[],J=[{name:"workbox-precaching",exports:["precacheAndRoute","cleanupOutdatedCaches"]},{name:"workbox-routing",exports:["registerRoute","NavigationRoute","setDefaultHandler"]}],G=new Set;for(let _ of Q)G.add(g9(_.strategy));if(G.size>0)J.push({name:"workbox-strategies",exports:Array.from(G)});if(Q.some((_)=>_.maxAgeSeconds||_.maxEntries)||Z.cacheStorage)J.push({name:"workbox-expiration",exports:["ExpirationPlugin"]});if(Q.some((_)=>_.strategy==="network-first"||_.strategy==="stale-while-revalidate"))J.push({name:"workbox-cacheable-response",exports:["CacheableResponsePlugin"]});if(Z.backgroundSync?.enabled)J.push({name:"workbox-background-sync",exports:["BackgroundSyncPlugin","Queue"]});if(X.navigationPreload)J.push({name:"workbox-navigation-preload",exports:["enable"]});let q=Y?Y1(Y,$):void 0;return{mode:"generate",modules:J,precacheManifest:q?.entries,skipWaiting:X.skipWaiting??!0,clientsClaim:X.clientsClaim??!0,offlineFallback:Z.offline?.enabled?"/offline.html":void 0,navigationPreload:X.navigationPreload??!1,cacheVersion:X.cacheVersion||"1.0.0"}}function R7($,Y){let Z=$.pwa;if(!Z?.enabled)return"";let X=V7($,Y),Q=Z.serviceWorker||{},J=Z.push,G=Z.backgroundSync,K=Y?Y1(Y,$):null,q=K?O5(K):"[]",_=DZ(X.modules),U=F7($);return`/**
24
24
  * Service Worker - Generated by stx with Workbox
25
25
  * Cache Version: ${X.cacheVersion}
26
26
  *
@@ -169,13 +169,13 @@ self.addEventListener('message', (event) => {
169
169
  }
170
170
  });
171
171
 
172
- ${J?.enabled?kZ(J):"// Push notifications disabled"}
172
+ ${J?.enabled?bZ(J):"// Push notifications disabled"}
173
173
 
174
174
  ${G?.enabled?SZ(G):"// Background sync disabled"}
175
175
 
176
176
  console.log('[Workbox SW] Service Worker loaded - Version:', CACHE_VERSION);
177
- `}function EZ($){let Y=[];for(let Z of $){let X=Z.name.replace("workbox-","");Y.push(`const { ${Z.exports.join(", ")} } = workbox.${DZ(X)};`)}return Y.join(`
178
- `)}function DZ($){return $.replace(/-([a-z])/g,(Y,Z)=>Z.toUpperCase())}function kZ($){return`
177
+ `}function DZ($){let Y=[];for(let Z of $){let X=Z.name.replace("workbox-","");Y.push(`const { ${Z.exports.join(", ")} } = workbox.${kZ(X)};`)}return Y.join(`
178
+ `)}function kZ($){return $.replace(/-([a-z])/g,(Y,Z)=>Z.toUpperCase())}function bZ($){return`
179
179
  // ============================================================================
180
180
  // Push Notifications
181
181
  // ============================================================================
@@ -306,7 +306,7 @@ self.addEventListener('message', (event) => {
306
306
  event.waitUntil(syncQueue.pushRequest({ request }));
307
307
  }
308
308
  });
309
- `}function N7($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function bZ($){if(N7($))return R7;let{generateServiceWorker:Y}=(m1(),_7(T7));return Y}var w7=b(()=>{d1()});var T7={};r(T7,{isWorkboxEnabled:()=>M7,getServiceWorkerFileName:()=>V1,generateServiceWorkerAuto:()=>CZ,generateServiceWorker:()=>H5});function H5($,Y){let Z=$.pwa;if(!Z?.enabled)return"";let X=Z.serviceWorker||{},Q=Z.routes||[],J=X.cacheVersion||"1.0.0",G=Z.offline,K=G?.page?"/offline.html":"/offline.html",q=Z.push,_=Z.backgroundSync,U=Z.cacheStorage,W=Y?$1(Y,$):null,B=W?O5(W):"[]",j=["/","/manifest.json",...G?.enabled?[K]:[],...G?.precacheAssets||[]];return`/**
309
+ `}function N7($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function yZ($){if(N7($))return R7;let{generateServiceWorker:Y}=(u1(),_7(T7));return Y}var w7=S(()=>{m1()});var T7={};r(T7,{isWorkboxEnabled:()=>M7,getServiceWorkerFileName:()=>R1,generateServiceWorkerAuto:()=>vZ,generateServiceWorker:()=>H5});function H5($,Y){let Z=$.pwa;if(!Z?.enabled)return"";let X=Z.serviceWorker||{},Q=Z.routes||[],J=X.cacheVersion||"1.0.0",G=Z.offline,K=G?.page?"/offline.html":"/offline.html",q=Z.push,_=Z.backgroundSync,U=Z.cacheStorage,W=Y?Y1(Y,$):null,B=W?O5(W):"[]",j=["/","/manifest.json",...G?.enabled?[K]:[],...G?.precacheAssets||[]];return`/**
310
310
  * Service Worker - Auto-generated by stx
311
311
  * Cache Version: ${J}
312
312
  *
@@ -501,9 +501,9 @@ self.addEventListener('message', (event) => {
501
501
  }
502
502
  });
503
503
 
504
- ${q?.enabled?yZ():"// Push notifications disabled"}
504
+ ${q?.enabled?PZ():"// Push notifications disabled"}
505
505
 
506
- ${_?.enabled?PZ():"// Background sync disabled"}
506
+ ${_?.enabled?CZ():"// 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 yZ(){return`
871
+ `}function PZ(){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 PZ(){return`
953
+ `}function CZ(){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 V1($){return $.pwa?.serviceWorker?.fileName||"sw.js"}function M7($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function CZ($,Y){if(!$.pwa?.enabled)return"";if(M7($)){let{generateWorkboxServiceWorker:Z}=(w7(),_7(A7));return Z($,Y)}return H5($,Y)}var m1=b(()=>{d1()});var I7={};r(I7,{injectPwaTags:()=>d9,generateThemeColorMeta:()=>fZ,generateSwRegistrationScript:()=>vZ,generatePwaTags:()=>L5,generateManifestLink:()=>xZ});function L5($){let Y=$.pwa;if(!Y?.enabled)return"";let Z=Y.manifest,X=Y.icons?.outputDir?`/${Y.icons.outputDir}`:"/pwa-icons",Q=V1($),J=`
1135
+ `}function R1($){return $.pwa?.serviceWorker?.fileName||"sw.js"}function M7($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function vZ($,Y){if(!$.pwa?.enabled)return"";if(M7($)){let{generateWorkboxServiceWorker:Z}=(w7(),_7(A7));return Z($,Y)}return H5($,Y)}var u1=S(()=>{m1()});var I7={};r(I7,{injectPwaTags:()=>d9,generateThemeColorMeta:()=>gZ,generateSwRegistrationScript:()=>xZ,generatePwaTags:()=>L5,generateManifestLink:()=>fZ});function L5($){let Y=$.pwa;if(!Y?.enabled)return"";let Z=Y.manifest,X=Y.icons?.outputDir?`/${Y.icons.outputDir}`:"/pwa-icons",Q=R1($),J=`
1136
1136
  <!-- stx PWA Meta Tags -->
1137
1137
  <link rel="manifest" href="/manifest.json">
1138
1138
  <meta name="theme-color" content="${h9(Z?.themeColor||"#000000")}">
@@ -1178,10 +1178,10 @@ if ('serviceWorker' in navigator) {
1178
1178
  </script>
1179
1179
  <!-- End stx PWA -->`,J}function d9($,Y){let Z=Y.pwa;if(!Z?.enabled||Z.autoInject===!1)return $;if($.includes("<!-- stx PWA Meta Tags -->"))return $;if(!$.includes("</head>")){let Q=$.lastIndexOf("</body>");if(Q!==-1){let J=L5(Y);return $.slice(0,Q)+J+`
1180
1180
  `+$.slice(Q)}return $+L5(Y)}let X=L5(Y);return $.replace("</head>",`${X}
1181
- </head>`)}function vZ($){if(!$.pwa?.enabled)return"";return`<script>
1181
+ </head>`)}function xZ($){if(!$.pwa?.enabled)return"";return`<script>
1182
1182
  if ('serviceWorker' in navigator) {
1183
1183
  window.addEventListener('load', function() {
1184
- navigator.serviceWorker.register('/${V1($)}')
1184
+ navigator.serviceWorker.register('/${R1($)}')
1185
1185
  .then(function(registration) {
1186
1186
  console.log('[PWA] Service Worker registered:', registration.scope);
1187
1187
  })
@@ -1190,7 +1190,7 @@ if ('serviceWorker' in navigator) {
1190
1190
  });
1191
1191
  });
1192
1192
  }
1193
- </script>`}function xZ(){return'<link rel="manifest" href="/manifest.json">'}function fZ($){return`<meta name="theme-color" content="${h9($)}">`}function h9($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var F5=b(()=>{m1()});var B0;var D7=b(()=>{B0={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 k7($,Y,Z,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 S7,b7;var m9=b(()=>{S7={name:"a11y",handler:($,Y,Z,X)=>{if(!Y.length)return $;let Q=Y[0].replace(/['"]/g,""),J=Y.length>1?Y[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},b7={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function pZ($,Y={}){let{duration:Z,delay:X,ease:Q,direction:J,custom:G}={...d0,...Y};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 fZ(){return'<link rel="manifest" href="/manifest.json">'}function gZ($){return`<meta name="theme-color" content="${h9($)}">`}function h9($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var F5=S(()=>{u1()});var B0;var D7=S(()=>{B0={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 k7($,Y,Z,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 b7,S7;var m9=S(()=>{b7={name:"a11y",handler:($,Y,Z,X)=>{if(!Y.length)return $;let Q=Y[0].replace(/['"]/g,""),J=Y.length>1?Y[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},S7={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function cZ($,Y={}){let{duration:Z,delay:X,ease:Q,direction:J,custom:G}={...d0,...Y};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 cZ(){return`
1203
+ @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function iZ(){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 iZ($){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((Z)=>Z.test($))}function nZ($=0.1,Y="0px"){return`
1231
+ `}function nZ($){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((Z)=>Z.test($))}function oZ($=0.1,Y="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 oZ(){return`
1274
+ `}function sZ(){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 sZ($,Y,Z={}){let{staggerDelay:X=50,sequence:Q=!1}=Z;return`
1389
+ `}function rZ($,Y,Z={}){let{staggerDelay:X=50,sequence:Q=!1}=Z;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 x7($,Y,Z,X){let Q=$;if(X.animation?.enabled===!1)return Q;let J=Z.includes("test")&&Z.includes("animation");if(!iZ(Q)&&!J)return Q;if(!Q.includes('<style id="stx-animation-base">')){let K=oZ();Q=Q.replace("</head>",`${K}
1427
- </head>`)}if(Q.includes("stx-observe")){if(!Q.includes("Intersection Observer for scroll animations")){let q=nZ(),_=Q.lastIndexOf("</body>");if(_!==-1)Q=Q.slice(0,_)+q+`
1428
- `+Q.slice(_)}}return Q}var d0,y7,P7,C7,v7;var u9=b(()=>{d0={duration:300,delay:0,ease:"ease",direction:"both"};y7={name:"transition",handler:($,Y,Z,X)=>{if(Y.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let Q=Y[0],J=Y.length>1?Number.parseInt(Y[1],10)||d0.duration:d0.duration,G=Y.length>2?Y[2]||d0.ease:d0.ease,K=Y.length>3?Number.parseInt(Y[3],10)||d0.delay:d0.delay,q=Y.length>4?Y[4]||d0.direction:d0.direction,_=`stx-transition-${Math.random().toString(36).substr(2,9)}`,U=pZ(Q,{duration:J,delay:K,ease:G,direction:q}),W="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="${_}" class="${W} ${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"},P7={name:"scrollAnimate",handler:($,Y,Z,X)=>{if(Y.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let Q=Y[0],J=Y.length>1?Number.parseInt(Y[1],10)||300:300,G=Y.length>2?Y[2]||"ease":"ease",K=Y.length>3?Number.parseFloat(Y[3])||0.2:0.2,q=Y.length>4?Number.parseInt(Y[4],10)||0:0,_=`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;`,W="stx-transition stx-observe stx-out";if(Q==="fade")W+=" stx-fade";else if(Q==="slide-up"||Q==="slide")W+=" stx-from-bottom";else if(Q==="slide-down")W+=" stx-from-top";else if(Q==="slide-left")W+=" stx-from-right";else if(Q==="slide-right")W+=" stx-from-left";else if(Q==="scale")W+=" stx-scale";else if(Q.includes("-"))W+=` stx-${Q}`;else W+=` stx-${Q}`;return`<div id="${_}" class="${W}" style="${U}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},C7={name:"animationGroup",handler:($,Y,Z,X)=>{if(Y.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let Q=Y[0],J=Y.slice(1).map((_)=>_.startsWith("#")||_.startsWith(".")?_:`#${_}`),G=Z.staggerDelay||50,K=Z.sequence||!0,q=sZ(Q,J,{staggerDelay:G,sequence:K});return`${$}
1430
- ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},v7={name:"motion",handler:($,Y,Z,X)=>{let Q=Y.length>0?Y[0].toLowerCase()==="true":!0,J=cZ();return`<div data-animate="${Q?"auto":"true"}">${$}</div>${J}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as f7}from"stx-router";var g7=b(()=>{l9()});async function rZ($,Y,Z,X){let Q=Y[0]?.replace(/['"]/g,"")||"main",J=f7();if(Q!=="main")J=J.replace("container:'main'",`container:'${Q}'`);return`<script data-stx-router>${J}</script>`}var h7;var l9=b(()=>{g7();h7={name:"stxRouter",handler:rZ,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function d7($){let Y=$.heatmap;if(!Y?.enabled)return"";let Z={...aZ,...Y};return`
1426
+ `}function x7($,Y,Z,X){let Q=$;if(X.animation?.enabled===!1)return Q;let J=Z.includes("test")&&Z.includes("animation");if(!nZ(Q)&&!J)return Q;if(!Q.includes('<style id="stx-animation-base">')){let K=sZ();Q=Q.replace("</head>",`${K}
1427
+ </head>`)}if(Q.includes("stx-observe")){if(!Q.includes("Intersection Observer for scroll animations")){let q=oZ(),_=Q.lastIndexOf("</body>");if(_!==-1)Q=Q.slice(0,_)+q+`
1428
+ `+Q.slice(_)}}return Q}var d0,y7,P7,C7,v7;var u9=S(()=>{d0={duration:300,delay:0,ease:"ease",direction:"both"};y7={name:"transition",handler:($,Y,Z,X)=>{if(Y.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let Q=Y[0],J=Y.length>1?Number.parseInt(Y[1],10)||d0.duration:d0.duration,G=Y.length>2?Y[2]||d0.ease:d0.ease,K=Y.length>3?Number.parseInt(Y[3],10)||d0.delay:d0.delay,q=Y.length>4?Y[4]||d0.direction:d0.direction,_=`stx-transition-${Math.random().toString(36).substr(2,9)}`,U=cZ(Q,{duration:J,delay:K,ease:G,direction:q}),W="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="${_}" class="${W} ${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"},P7={name:"scrollAnimate",handler:($,Y,Z,X)=>{if(Y.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let Q=Y[0],J=Y.length>1?Number.parseInt(Y[1],10)||300:300,G=Y.length>2?Y[2]||"ease":"ease",K=Y.length>3?Number.parseFloat(Y[3])||0.2:0.2,q=Y.length>4?Number.parseInt(Y[4],10)||0:0,_=`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;`,W="stx-transition stx-observe stx-out";if(Q==="fade")W+=" stx-fade";else if(Q==="slide-up"||Q==="slide")W+=" stx-from-bottom";else if(Q==="slide-down")W+=" stx-from-top";else if(Q==="slide-left")W+=" stx-from-right";else if(Q==="slide-right")W+=" stx-from-left";else if(Q==="scale")W+=" stx-scale";else if(Q.includes("-"))W+=` stx-${Q}`;else W+=` stx-${Q}`;return`<div id="${_}" class="${W}" style="${U}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},C7={name:"animationGroup",handler:($,Y,Z,X)=>{if(Y.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let Q=Y[0],J=Y.slice(1).map((_)=>_.startsWith("#")||_.startsWith(".")?_:`#${_}`),G=Z.staggerDelay||50,K=Z.sequence||!0,q=rZ(Q,J,{staggerDelay:G,sequence:K});return`${$}
1430
+ ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},v7={name:"motion",handler:($,Y,Z,X)=>{let Q=Y.length>0?Y[0].toLowerCase()==="true":!0,J=iZ();return`<div data-animate="${Q?"auto":"true"}">${$}</div>${J}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as f7}from"stx-router";var g7=S(()=>{l9()});async function aZ($,Y,Z,X){let Q=Y[0]?.replace(/['"]/g,"")||"main",J=f7();if(Q!=="main")J=J.replace("container:'main'",`container:'${Q}'`);return`<script data-stx-router>${J}</script>`}var h7;var l9=S(()=>{g7();h7={name:"stxRouter",handler:aZ,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function d7($){let Y=$.heatmap;if(!Y?.enabled)return"";let Z={...tZ,...Y};return`
1431
1431
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
1432
1432
  <script>
1433
1433
  (function() {
@@ -1810,8 +1810,8 @@ else {
1810
1810
  };
1811
1811
  })();
1812
1812
  </script>
1813
- `}function m7($,Y){let Z=d7(Y);if(!Z)return $;let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Z+$.slice(X);return $+Z}function tZ($){let Y={},Z=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let X of Z){let[Q,J]=X.split("="),G=J?.replace(/["']/g,"");switch(Q){case"endpoint":Y.endpoint=G;break;case"samplingRate":Y.samplingRate=Number.parseInt(G,10);break;case"batchSize":Y.batchSize=Number.parseInt(G,10);break;case"trackMouse":Y.trackMouse=G==="true";break;case"trackClicks":Y.trackClicks=G==="true";break;case"trackScroll":Y.trackScroll=G==="true";break;case"honorDnt":Y.honorDnt=G==="true";break;case"debugOverlay":Y.debugOverlay=G==="true";break}}return Y}var aZ,u7;var p9=b(()=>{aZ={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};u7={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Y,Z,X)=>{let Q=Z.__stx_config||{};if(Y.length>0){let J=tZ(Y.join(" "));Q.heatmap={...Q.heatmap,...J,enabled:!0}}return d7(Q)}}});function l0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function l7($){let Y=$.trim().toLowerCase();return!Y.startsWith("javascript:")&&!Y.startsWith("vbscript:")&&!Y.startsWith("data:text/html")}function p7($){let Y=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Z=$.match(Y);if(!Z)return{data:{},content:$.trim()};let X=Z[1],Q=$.slice(Z[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 _=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[_]=U}return{data:J,content:Q.trim()}}function u1($,Y={}){let{gfm:Z=!0,breaks:X=!1}=Y,Q=$,J=[];if(Q=Q.replace(/```(\w*)\n([\s\S]*?)```/g,(U,W,B)=>{let j=J.length,z=W?` class="language-${l0(W)}"`:"";return J.push(`<pre><code${z}>${l0(B.trim())}</code></pre>`),`\x00CODEBLOCK${j}\x00`}),Q=Q.replace(/`([^`]*)`/g,(U,W)=>`<code>${l0(W)}</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>"),Z)Q=Q.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Q=Q.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(U,W,B)=>{return`<img src="${l7(B)?l0(B):""}" alt="${l0(W)}" />`}),Q=Q.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(U,W,B)=>{return`<a href="${l7(B)?l0(B):""}">${W}</a>`}),Q=Q.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Q=Q.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Q=Q.replace(/<\/blockquote>\n<blockquote>/g,`
1813
+ `}function m7($,Y){let Z=d7(Y);if(!Z)return $;let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Z+$.slice(X);return $+Z}function eZ($){let Y={},Z=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let X of Z){let[Q,J]=X.split("="),G=J?.replace(/["']/g,"");switch(Q){case"endpoint":Y.endpoint=G;break;case"samplingRate":Y.samplingRate=Number.parseInt(G,10);break;case"batchSize":Y.batchSize=Number.parseInt(G,10);break;case"trackMouse":Y.trackMouse=G==="true";break;case"trackClicks":Y.trackClicks=G==="true";break;case"trackScroll":Y.trackScroll=G==="true";break;case"honorDnt":Y.honorDnt=G==="true";break;case"debugOverlay":Y.debugOverlay=G==="true";break}}return Y}var tZ,u7;var p9=S(()=>{tZ={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};u7={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Y,Z,X)=>{let Q=Z.__stx_config||{};if(Y.length>0){let J=eZ(Y.join(" "));Q.heatmap={...Q.heatmap,...J,enabled:!0}}return d7(Q)}}});function l0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function l7($){let Y=$.trim().toLowerCase();return!Y.startsWith("javascript:")&&!Y.startsWith("vbscript:")&&!Y.startsWith("data:text/html")}function p7($){let Y=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Z=$.match(Y);if(!Z)return{data:{},content:$.trim()};let X=Z[1],Q=$.slice(Z[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 _=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[_]=U}return{data:J,content:Q.trim()}}function l1($,Y={}){let{gfm:Z=!0,breaks:X=!1}=Y,Q=$,J=[];if(Q=Q.replace(/```(\w*)\n([\s\S]*?)```/g,(U,W,B)=>{let j=J.length,z=W?` class="language-${l0(W)}"`:"";return J.push(`<pre><code${z}>${l0(B.trim())}</code></pre>`),`\x00CODEBLOCK${j}\x00`}),Q=Q.replace(/`([^`]*)`/g,(U,W)=>`<code>${l0(W)}</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>"),Z)Q=Q.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Q=Q.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(U,W,B)=>{return`<img src="${l7(B)?l0(B):""}" alt="${l0(W)}" />`}),Q=Q.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(U,W,B)=>{return`<a href="${l7(B)?l0(B):""}">${W}</a>`}),Q=Q.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Q=Q.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Q=Q.replace(/<\/blockquote>\n<blockquote>/g,`
1815
1815
  `),Q=Q.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),Q=Q.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),Q=Q.replace(/<\/ul>\n<ul>/g,""),Q=Q.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),Q=Q.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),Q=Q.replace(/<\/ol>\n<ol>/g,""),Q=Q.replace(/<li data-ul>/g,"<li>"),Q=Q.replace(/<li data-ol>/g,"<li>"),Z)Q=Q.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(U,W,B)=>{let z=`<tr>${W.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<th>${l0(L)}</th>`).join("")}</tr>`,O=B.trim().split(`
1816
1816
  `).map((L)=>{return`<tr>${L.split("|").map((H)=>H.trim()).filter(Boolean).map((H)=>`<td>${l0(H)}</td>`).join("")}</tr>`}).join(`
1817
1817
  `);return`<table>
@@ -1830,11 +1830,11 @@ ${O}
1830
1830
  `),X)Q=Q.replace(/\n/g,`<br />
1831
1831
  `);for(let U=0;U<J.length;U++)Q=Q.replace(`\x00CODEBLOCK${U}\x00`,J[U]);return Q=Q.replace(/<p>\s*<\/p>/g,""),Q.trim()}function p0($){let Y=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Y,(X,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
1832
1832
  `});let Z=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(Z,(X,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
1833
- `}),$}import eZ from"process";function P0($="STX_PUBLIC_"){let Y={},Z={};for(let[X,Q]of Object.entries(eZ.env)){if(!X.startsWith($)||Q===void 0)continue;Y[`import.meta.env.${X}`]=JSON.stringify(Q),Z[X]=Q}return Y["import.meta.env"]=JSON.stringify(Z),Y}var R1=()=>{};var c9={};r(c9,{hasUserImports:()=>$X,bundleClientScript:()=>ZX});import C0 from"path";import Y1 from"fs";function $X($){let Y=/^\s*import\s+(?!type\s)/gm;if(!$.match(Y))return!1;let X=/^\s*import\s+(?!type\s).*?\s+from\s+['"]([^'"]+)['"]/gm,Q;while((Q=X.exec($))!==null){let G=Q[1];if(!c7.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(!c7.some((q)=>q.test(G)))return console.log("[stx:bundler] detected side-effect import:",G),!0}return!1}function YX($){return{name:"stx-client-bundle",setup(Y){Y.onResolve({filter:/^(stx|@stacksjs\/stx|@stacksjs\/browser)$/},(Z)=>({path:Z.path,external:!0})),Y.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(Z)=>({path:Z.path,external:!0})),Y.onResolve({filter:/^@\//},(Z)=>{let X=C0.resolve($,Z.path.slice(2)),Q=[X,`${X}.ts`,`${X}.js`,C0.join(X,"index.ts"),C0.join(X,"index.js")];for(let J of Q)if(Y1.existsSync(J)&&Y1.statSync(J,{throwIfNoEntry:!1})?.isFile())return console.log("[stx:bundler] resolved @/ import:",Z.path,"\u2192",J),{path:J};return console.warn("[stx:bundler] could not resolve @/ import:",Z.path),{path:X}})}}}async function ZX($,Y,Z={}){let X=Z.projectRoot||process.cwd(),Q=Z.minify??!1,J=Z.cacheDir||C0.join(X,".stx","bundle-cache"),G=new Bun.CryptoHasher("md5");G.update($+Y);let K=G.digest("hex").slice(0,12),q=C0.join(J,`${K}.js`),_=Bun.file(q);if(await _.exists())return console.log("[stx:bundler] cache hit:",K),await _.text();let U=C0.join(X,".stx","bundle-tmp"),W=C0.join(U,`${K}.ts`),B=C0.join(U,"out",K);Y1.mkdirSync(U,{recursive:!0}),Y1.mkdirSync(B,{recursive:!0});let j=C0.dirname(Y),z=[],O=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,L=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,F;while((F=O.exec($))!==null){if(F[1])continue;if(F[2])F[2].split(",").forEach((V)=>{let N=V.split(":")[0].trim();if(N)z.push(N)});else if(F[3])z.push(F[3])}while((F=L.exec($))!==null){if(F[1])continue;z.push(F[2])}let H=z.length>0?`
1834
- export { ${z.join(", ")} }`:"";await Bun.write(W,$+H),console.log("[stx:bundler] bundling:",K,"from:",C0.basename(Y));try{let V=await Bun.build({entrypoints:[W],outdir:B,target:"browser",format:"esm",minify:Q,plugins:[YX(X)],define:{"process.env.NODE_ENV":Q?'"production"':'"development"',...P0()},root:j});if(!V.success){let R=V.logs.filter((A)=>A.level==="error").map((A)=>A.message).join(", ");return console.warn("[stx:bundler] build failed:",R),$}let N="";for(let R of V.outputs){N=await R.text();break}return N=N.replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),console.log("[stx:bundler] bundled:",K,"output:",N.length,"bytes"),Y1.mkdirSync(J,{recursive:!0}),await Bun.write(q,N),N}catch(V){return console.warn("[stx:bundler] error:",V instanceof Error?V.message:V),$}finally{try{Y1.rmSync(W,{force:!0}),Y1.rmSync(B,{recursive:!0,force:!0})}catch{}}}var c7;var i9=b(()=>{R1();c7=[/^stx$/,/^@stacksjs\/stx$/,/^@stacksjs\/browser$/,/^@stores$/,/^stx\/stores$/,/^@composables$/]});function GX($){let Y=new Set,Z=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,X;while((X=Z.exec($))!==null)if(!QX.has(X[1]))Y.add(X[1]);return Array.from(Y)}function KX($){let Y=new Set,Z=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],_=G[2];if(G[0].includes("import type"))continue;q.split(",").map((W)=>W.trim().split(/\s+as\s+/)[0]).filter((W)=>W.length>0).forEach((W)=>{if(Q.add(W),_==="stx")Y.add(W);else Z.add(W)}),X=X.replace(G[0],"// [auto-import processed]")}for(let q of XX){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\s*\\(`,"g").test(X))Y.add(q)}for(let q of JX){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(X))Z.add(q)}let K=GX(X);for(let q of K)if(!Q.has(q))Z.add(q);return{code:X,stxImports:Array.from(Y),browserImports:Array.from(Z)}}function qX($,Y){let Z=[];if($.length>0)Z.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Y.length>0)Z.push(` var { ${Y.join(", ")} } = window.StacksBrowser || {};`);if(Z.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
1833
+ `}),$}import $X from"process";function P0($="STX_PUBLIC_"){let Y={},Z={};for(let[X,Q]of Object.entries($X.env)){if(!X.startsWith($)||Q===void 0)continue;Y[`import.meta.env.${X}`]=JSON.stringify(Q),Z[X]=Q}return Y["import.meta.env"]=JSON.stringify(Z),Y}var N1=()=>{};var c9={};r(c9,{hasUserImports:()=>YX,bundleClientScript:()=>XX});import C0 from"path";import Z1 from"fs";function YX($){let Y=/^\s*import\s+(?!type\s)/gm;if(!$.match(Y))return!1;let X=/^\s*import\s+(?!type\s).*?\s+from\s+['"]([^'"]+)['"]/gm,Q;while((Q=X.exec($))!==null){let G=Q[1];if(!c7.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(!c7.some((q)=>q.test(G)))return console.log("[stx:bundler] detected side-effect import:",G),!0}return!1}function ZX($){return{name:"stx-client-bundle",setup(Y){Y.onResolve({filter:/^(stx|@stacksjs\/stx|@stacksjs\/browser)$/},(Z)=>({path:Z.path,external:!0})),Y.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(Z)=>({path:Z.path,external:!0})),Y.onResolve({filter:/^@\//},(Z)=>{let X=C0.resolve($,Z.path.slice(2)),Q=[X,`${X}.ts`,`${X}.js`,C0.join(X,"index.ts"),C0.join(X,"index.js")];for(let J of Q)if(Z1.existsSync(J)&&Z1.statSync(J,{throwIfNoEntry:!1})?.isFile())return console.log("[stx:bundler] resolved @/ import:",Z.path,"\u2192",J),{path:J};return console.warn("[stx:bundler] could not resolve @/ import:",Z.path),{path:X}})}}}async function XX($,Y,Z={}){let X=Z.projectRoot||process.cwd(),Q=Z.minify??!1,J=Z.cacheDir||C0.join(X,".stx","bundle-cache"),G=new Bun.CryptoHasher("md5");G.update($+Y);let K=G.digest("hex").slice(0,12),q=C0.join(J,`${K}.js`),_=Bun.file(q);if(await _.exists())return console.log("[stx:bundler] cache hit:",K),await _.text();let U=C0.join(X,".stx","bundle-tmp"),W=C0.join(U,`${K}.ts`),B=C0.join(U,"out",K);Z1.mkdirSync(U,{recursive:!0}),Z1.mkdirSync(B,{recursive:!0});let j=C0.dirname(Y),z=[],O=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,L=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,F;while((F=O.exec($))!==null){if(F[1])continue;if(F[2])F[2].split(",").forEach((V)=>{let N=V.split(":")[0].trim();if(N)z.push(N)});else if(F[3])z.push(F[3])}while((F=L.exec($))!==null){if(F[1])continue;z.push(F[2])}let H=z.length>0?`
1834
+ export { ${z.join(", ")} }`:"";await Bun.write(W,$+H),console.log("[stx:bundler] bundling:",K,"from:",C0.basename(Y));try{let V=await Bun.build({entrypoints:[W],outdir:B,target:"browser",format:"esm",minify:Q,plugins:[ZX(X)],define:{"process.env.NODE_ENV":Q?'"production"':'"development"',...P0()},root:j});if(!V.success){let R=V.logs.filter((A)=>A.level==="error").map((A)=>A.message).join(", ");return console.warn("[stx:bundler] build failed:",R),$}let N="";for(let R of V.outputs){N=await R.text();break}return N=N.replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),console.log("[stx:bundler] bundled:",K,"output:",N.length,"bytes"),Z1.mkdirSync(J,{recursive:!0}),await Bun.write(q,N),N}catch(V){return console.warn("[stx:bundler] error:",V instanceof Error?V.message:V),$}finally{try{Z1.rmSync(W,{force:!0}),Z1.rmSync(B,{recursive:!0,force:!0})}catch{}}}var c7;var i9=S(()=>{N1();c7=[/^stx$/,/^@stacksjs\/stx$/,/^@stacksjs\/browser$/,/^@stores$/,/^stx\/stores$/,/^@composables$/]});function KX($){let Y=new Set,Z=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,X;while((X=Z.exec($))!==null)if(!GX.has(X[1]))Y.add(X[1]);return Array.from(Y)}function qX($){let Y=new Set,Z=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],_=G[2];if(G[0].includes("import type"))continue;q.split(",").map((W)=>W.trim().split(/\s+as\s+/)[0]).filter((W)=>W.length>0).forEach((W)=>{if(Q.add(W),_==="stx")Y.add(W);else Z.add(W)}),X=X.replace(G[0],"// [auto-import processed]")}for(let q of JX){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\s*\\(`,"g").test(X))Y.add(q)}for(let q of QX){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(X))Z.add(q)}let K=KX(X);for(let q of K)if(!Q.has(q))Z.add(q);return{code:X,stxImports:Array.from(Y),browserImports:Array.from(Z)}}function UX($,Y){let Z=[];if($.length>0)Z.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Y.length>0)Z.push(` var { ${Y.join(", ")} } = window.StacksBrowser || {};`);if(Z.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
1835
1835
  ${Z.join(`
1836
1836
  `)}
1837
- `;return""}function _X($){let Y=[];if($.self)Y.push("if ($event.target !== $el) return");for(let Z of $.systemKeys)Y.push(`if (!$event.${Z}Key) return`);if($.keys.length>0){let Z=$.keys.map((X)=>`$event.key === '${X}'`).join(" || ");Y.push(`if (!(${Z})) return`)}if($.mouse!==null){let Z=UX[$.mouse];Y.push(`if ($event.button !== ${Z}) return`)}if($.prevent)Y.push("$event.preventDefault()");if($.stop)Y.push("$event.stopPropagation()");return Y.join("; ")}function WX($,Y){let{elementId:Z,event:X,handler:Q,modifiers:J}=$,G=_X(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(", ")} }`:"",_="";if(G)_+=`${G}; `;let U=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'");function W(B){return`var scope = $el.closest('[data-stx-scope]');
1837
+ `;return""}function WX($){let Y=[];if($.self)Y.push("if ($event.target !== $el) return");for(let Z of $.systemKeys)Y.push(`if (!$event.${Z}Key) return`);if($.keys.length>0){let Z=$.keys.map((X)=>`$event.key === '${X}'`).join(" || ");Y.push(`if (!(${Z})) return`)}if($.mouse!==null){let Z=_X[$.mouse];Y.push(`if ($event.button !== ${Z}) return`)}if($.prevent)Y.push("$event.preventDefault()");if($.stop)Y.push("$event.stopPropagation()");return Y.join("; ")}function BX($,Y){let{elementId:Z,event:X,handler:Q,modifiers:J}=$,G=WX(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(", ")} }`:"",_="";if(G)_+=`${G}; `;let U=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'");function W(B){return`var scope = $el.closest('[data-stx-scope]');
1838
1838
  if (scope && scope.__stx_execute) {
1839
1839
  scope.__stx_execute('${U}', $event, $el);
1840
1840
  }
@@ -1870,11 +1870,11 @@ else {
1870
1870
  else {
1871
1871
  ${Q}
1872
1872
  }
1873
- }${q})`}function BX($){if($.length===0)return"";return`
1873
+ }${q})`}function zX($){if($.length===0)return"";return`
1874
1874
  // STX: auto-generated event bindings
1875
- ${$.map((Z,X)=>WX(Z,X)).join(`
1875
+ ${$.map((Z,X)=>BX(Z,X)).join(`
1876
1876
  `)}`}function i7($){let Y=[],Z=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 _=0;while(G<J){if(X[G]==="\\"){G+=2;continue}if(X[G]==="`"&&_===0){G++;break}if(X[G]==="$"&&X[G+1]==="{"){_++,G+=2;continue}if(X[G]==="}"&&_>0){_--,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]!==`
1877
- `)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),_=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(_){let B=_[1];if(!B.startsWith("_")&&!Z.has(B))Y.push(B),Z.add(B);G+=_[0].length;continue}let U=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[1].split(",").forEach((B)=>{let j=B.trim(),z=j.indexOf(":"),O=z>=0?j.slice(z+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(O&&!O.startsWith("_")&&!Z.has(O))Y.push(O),Z.add(O)}),G+=U[0].length;continue}let W=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(W){let B=W[1];if(!B.startsWith("_")&&!Z.has(B))Y.push(B),Z.add(B);G+=W[0].length;continue}}G++}return Y}function jX($){let Y=new Set,Z=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(B){let j;while((j=Z.exec(B))!==null){let z=j[0];if(!zX.has(z))Y.add(z)}}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 _=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((J=_.exec($))!==null)X(J[1]);let U=/@model\s*=\s*["']([^"']*)["']/gi;while((J=U.exec($))!==null)X(J[1]);let W=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((J=W.exec($))!==null)X(J[1]);return Y}async function V5($,Y={}){let Z=$,X="",Q=!1,{hasUserImports:J,bundleClientScript:G}=await Promise.resolve().then(() => (i9(),c9));if(J(Z))console.log("[stx:bundler] user imports detected, bundling..."),Z=await G(Z,Y.filePath||"",{projectRoot:Y.projectRoot,minify:Y.production}),Q=!0;if(Y.autoImports!==!1){let z=KX(Z);Z=z.code,X=qX(z.stxImports,z.browserImports)}if(Z=p0(Z),!Q&&Z1(Y.attrs||""))Z=X1(Z);let K=BX(Y.eventBindings||[]),q=(Y.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(q)){let z=q.replace(/\btype\s*=\s*["']module["']/i,"").trim();return`<script ${`type="module" data-stx-scoped${z?` ${z}`:""}`}>
1877
+ `)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),_=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(_){let B=_[1];if(!B.startsWith("_")&&!Z.has(B))Y.push(B),Z.add(B);G+=_[0].length;continue}let U=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[1].split(",").forEach((B)=>{let j=B.trim(),z=j.indexOf(":"),O=z>=0?j.slice(z+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(O&&!O.startsWith("_")&&!Z.has(O))Y.push(O),Z.add(O)}),G+=U[0].length;continue}let W=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(W){let B=W[1];if(!B.startsWith("_")&&!Z.has(B))Y.push(B),Z.add(B);G+=W[0].length;continue}}G++}return Y}function OX($){let Y=new Set,Z=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(B){let j;while((j=Z.exec(B))!==null){let z=j[0];if(!jX.has(z))Y.add(z)}}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 _=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((J=_.exec($))!==null)X(J[1]);let U=/@model\s*=\s*["']([^"']*)["']/gi;while((J=U.exec($))!==null)X(J[1]);let W=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((J=W.exec($))!==null)X(J[1]);return Y}async function V5($,Y={}){let Z=$,X="",Q=!1,{hasUserImports:J,bundleClientScript:G}=await Promise.resolve().then(() => (i9(),c9));if(J(Z))console.log("[stx:bundler] user imports detected, bundling..."),Z=await G(Z,Y.filePath||"",{projectRoot:Y.projectRoot,minify:Y.production}),Q=!0;if(Y.autoImports!==!1){let z=qX(Z);Z=z.code,X=UX(z.stxImports,z.browserImports)}if(Z=p0(Z),!Q&&X1(Y.attrs||""))Z=J1(Z);let K=zX(Y.eventBindings||[]),q=(Y.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(q)){let z=q.replace(/\btype\s*=\s*["']module["']/i,"").trim();return`<script ${`type="module" data-stx-scoped${z?` ${z}`:""}`}>
1878
1878
  ${X}${Z}
1879
1879
  ${K}
1880
1880
  </script>`}let U=/\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($),W=/function __stx_setup_/.test(Z),B=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function j(z){let O=z.length>0?`
@@ -1883,12 +1883,12 @@ window.stx.mount(function() {
1883
1883
  'use strict';
1884
1884
  ${X}${Z}
1885
1885
  ${K}${O}
1886
- })</script>`}if(!B&&!W){if(U)return j(i7($));if(Y.templateContent){let z=i7($);if(z.length>0){let O=jX(Y.templateContent);if(z.some((F)=>O.has(F)))return j(z)}}}return`<script data-stx-scoped>
1886
+ })</script>`}if(!B&&!W){if(U)return j(i7($));if(Y.templateContent){let z=i7($);if(z.length>0){let O=OX(Y.templateContent);if(z.some((F)=>O.has(F)))return j(z)}}}return`<script data-stx-scoped>
1887
1887
  ;(function() {
1888
1888
  'use strict';
1889
1889
  ${X}${Z}
1890
1890
  ${K}
1891
- })()</script>`}var XX,JX,QX,UX,zX;var n9=b(()=>{H0();XX=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useQuery","useMutation","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","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","useStore","action","createSelector","h","Fragment"],JX=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser"],QX=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"]);UX={left:0,middle:1,right:2};zX=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 LX($){let Y="",Z=null,X=!1;for(let Q=0;Q<$.length;Q++){let J=$[Q];if(X){X=!1;continue}if(J==="\\"&&Z){X=!0;continue}if(Z){if(Z==="`"&&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)Y+=$[Q],Q++}continue}if(J===Z)Z=null;continue}if(J==='"'||J==="'"||J==="`"){Z=J;continue}Y+=J}return Y}function l1($){let Y=$.trim(),Z=LX(Y);for(let X of o7)if(X.test(Z))throw Error(`Potentially unsafe expression (matched /${X.source}/): ${Y}`);if(!n7.allowBracketNotation&&HX.test(Y))throw Error(`Bracket notation with strings not allowed: ${Y}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Y}function FX($){let Y={};Y.Math=Math,Y.JSON=JSON,Y.Date=Date,Y.String=String,Y.Number=Number,Y.Boolean=Boolean,Y.Array=Array,Y.parseInt=Number.parseInt,Y.parseFloat=Number.parseFloat,Y.isNaN=Number.isNaN,Y.isFinite=Number.isFinite,Y.encodeURIComponent=encodeURIComponent,Y.decodeURIComponent=decodeURIComponent;for(let[Z,X]of Object.entries($)){if(Z.startsWith("__")||o7.some((Q)=>Q.test(Z)))continue;if(X&&typeof X==="object"&&!Array.isArray(X))Y[Z]=o9(X);else Y[Z]=X}return Y}function o9($,Y=0){if(Y>=n7.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((X)=>o9(X,Y+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Z={};for(let[X,Q]of Object.entries($)){if(X.startsWith("__")||X==="constructor"||X==="prototype")continue;if(Q&&typeof Q==="object")Z[X]=o9(Q,Y+1);else Z[X]=Q}return Z}function X0($,Y){try{let Z=l1($),X=FX(Y);return Function(...Object.keys(X),`
1891
+ })()</script>`}var JX,QX,GX,_X,jX;var n9=S(()=>{H0();JX=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useQuery","useMutation","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","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","useStore","action","createSelector","h","Fragment"],QX=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser"],GX=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"]);_X={left:0,middle:1,right:2};jX=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 FX($){let Y="",Z=null,X=!1;for(let Q=0;Q<$.length;Q++){let J=$[Q];if(X){X=!1;continue}if(J==="\\"&&Z){X=!0;continue}if(Z){if(Z==="`"&&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)Y+=$[Q],Q++}continue}if(J===Z)Z=null;continue}if(J==='"'||J==="'"||J==="`"){Z=J;continue}Y+=J}return Y}function p1($){let Y=$.trim(),Z=FX(Y);for(let X of o7)if(X.test(Z))throw Error(`Potentially unsafe expression (matched /${X.source}/): ${Y}`);if(!n7.allowBracketNotation&&LX.test(Y))throw Error(`Bracket notation with strings not allowed: ${Y}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Y}function VX($){let Y={};Y.Math=Math,Y.JSON=JSON,Y.Date=Date,Y.String=String,Y.Number=Number,Y.Boolean=Boolean,Y.Array=Array,Y.parseInt=Number.parseInt,Y.parseFloat=Number.parseFloat,Y.isNaN=Number.isNaN,Y.isFinite=Number.isFinite,Y.encodeURIComponent=encodeURIComponent,Y.decodeURIComponent=decodeURIComponent;for(let[Z,X]of Object.entries($)){if(Z.startsWith("__")||o7.some((Q)=>Q.test(Z)))continue;if(X&&typeof X==="object"&&!Array.isArray(X))Y[Z]=o9(X);else Y[Z]=X}return Y}function o9($,Y=0){if(Y>=n7.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((X)=>o9(X,Y+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Z={};for(let[X,Q]of Object.entries($)){if(X.startsWith("__")||X==="constructor"||X==="prototype")continue;if(Q&&typeof Q==="object")Z[X]=o9(Q,Y+1);else Z[X]=Q}return Z}function X0($,Y){try{let Z=p1($),X=VX(Y);return Function(...Object.keys(X),`
1892
1892
  'use strict';
1893
1893
  try {
1894
1894
  return ${Z};
@@ -1899,7 +1899,7 @@ catch (e) {
1899
1899
  }
1900
1900
  throw e;
1901
1901
  }
1902
- `)(...Object.values(X))}catch{return}}function e($){try{return l1($),!0}catch{return!1}}function z0($,Y){try{let Z=X0($,Y);if(Z&&typeof Z==="object"&&!Array.isArray(Z))return Z;return{}}catch{return{}}}function Y0($,Y){let Z=l1($);return Function(...Y,`
1902
+ `)(...Object.values(X))}catch{return}}function e($){try{return p1($),!0}catch{return!1}}function z0($,Y){try{let Z=X0($,Y);if(Z&&typeof Z==="object"&&!Array.isArray(Z))return Z;return{}}catch{return{}}}function Y0($,Y){let Z=p1($);return Function(...Y,`
1903
1903
  'use strict';
1904
1904
  try {
1905
1905
  return ${Z};
@@ -1910,7 +1910,7 @@ catch (e) {
1910
1910
  }
1911
1911
  throw e;
1912
1912
  }
1913
- `)}function R5($){let Y=$.trim(),Z=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let X of Z)if(X.test(Y))return!1;return!0}var OX,n7,o7,HX;var V0=b(()=>{OX={maxSanitizeDepth:10,allowBracketNotation:!1},n7={...OX},o7=[/\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/],HX=/[\w)\]]\s*\[\s*['"]/});function N5($,Y){let Z=VX++,X=`<!--__STX_${$.toUpperCase()}_${Z}__-->`;return RX.set(X,{type:$,expression:Y}),X}var VX=0,RX;var s7=b(()=>{RX=new Map});var Z3={};r(Z3,{usesSignalsInScript:()=>A5,unescapeHtml:()=>s9,registerFilters:()=>AX,registerFilter:()=>t7,processExpressions:()=>Q1,interpolateScriptsInTemplate:()=>TX,interpolateScriptExpressions:()=>$3,getAllFilters:()=>e7,evaluateExpression:()=>m0,escapeHtml:()=>J1,defaultFilters:()=>c1,clearCustomFilters:()=>wX,applyFilters:()=>Y3});function NX($){let Y=r7.get($);if(!Y){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Y=new RegExp(`:${Z}(?!\\w)`,"g"),r7.set($,Y)}return Y.lastIndex=0,Y}function t7($,Y){if($ in c1)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);p1[$]=Y}function AX($){for(let[Y,Z]of Object.entries($))t7(Y,Z)}function e7(){return{...c1,...p1}}function wX(){for(let $ of Object.keys(p1))delete p1[$]}function J1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function A5($){let Y=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Z;while((Z=Y.exec($))!==null){let X=Z[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;return!1}function a7($,Y){let Z=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],X=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Q="",J=!1,G=0;for(let _=0;_<X.length;_++){let U=X[_];if(!J&&U==="`"){J=!0,G=0;continue}if(J){if(U==="`"&&G===0){J=!1;continue}if(U==="$"&&X[_+1]==="{"){G++,_++;continue}if(U==="}"&&G>0){G--;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 _=q[1];if(!X.substring(0,q.index).trimEnd().endsWith(".")){if(!Z.includes(_)&&!(_ in Y))return!1}}return!0}function $3($,Y){let Z=$;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=m0(Q,Y);if(J===void 0)return X;return J===null?"":String(J)}catch{return X}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q)=>{let J=Q.trim();if(/^__[A-Z_]+__$/.test(J))return X;try{let G=m0(Q,Y);if(G===void 0)return X;return JSON.stringify(G)}catch{return X}}),Z}function TX($,Y,Z={}){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(Z.skipServer&&/\bserver\b/.test(Q))return X;let G=$3(J,Y);return`<script${Q}>${G}</script>`})}function Q1($,Y,Z){let X=$,Q=[];X=X.replace(/<style[^>]*>[\s\S]*?<\/style>/gi,(K)=>{if(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(K))return K;let q=Q.length;return Q.push(K),`<!--__STX_STYLE_${q}__-->`});let J=[];X=X.replace(/<script[^>]*>[\s\S]*?<\/script>/gi,(K)=>{let q=J.length;return J.push(K),`<!--__STX_SCRIPT_EXPR_${q}__-->`});let G=A5($);X=X.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(K,q,_)=>{try{let U=m0(q,Y);return U!==void 0&&U!==null?String(U):""}catch(U){let W=U instanceof Error?U.message:String(U);return J0("Expression",`Error evaluating: {{{ ${q.trim()}}}}: ${W}`,Z,$,_,K)}}),X=X.replace(/\{!!([\s\S]*?)!!\}/g,(K,q,_)=>{try{let U=m0(q,Y);if(U===void 0&&Y.__stx_buildMode==="compile")return N5("raw",q.trim());return U!==void 0&&U!==null?String(U):""}catch(U){if(Y.__stx_buildMode==="compile")return N5("raw",q.trim());let W=U instanceof Error?U.message:String(U);return J0("Expression",`Error evaluating: {!! ${q.trim()} !!}: ${W}`,Z,$,_,K)}}),X=X.replace(/<script[^>]*>[\s\S]*?<\/script>/gi,(K)=>{if(K.startsWith("<!--__STX_SCRIPT_EXPR_"))return K;let q=J.length;return J.push(K),`<!--__STX_SCRIPT_EXPR_${q}__-->`}),X=X.replace(/<style[^>]*>[\s\S]*?<\/style>/gi,(K)=>{if(K.startsWith("<!--__STX_STYLE_"))return K;if(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(K))return K;let q=Q.length;return Q.push(K),`<!--__STX_STYLE_${q}__-->`}),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(K,q,_)=>{let U=q.trim(),W=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],B=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,z=U.match(B)?.[1],O=z&&((z in Y)||W.includes(z)),L=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,F=U.match(L),H=F&&!W.includes(F[1])&&!(F[1]in Y);if(/^__[A-Z_]+__$/.test(U))return"";try{let V=m0(q,Y);if(V===void 0&&G&&!a7(U,Y))return K;if(V===void 0&&Y.__stx_buildMode==="compile"&&!G)return N5("expr",U);return V!==void 0&&V!==null?J1(String(V)):""}catch(V){if(G&&!a7(U,Y))return K;if(H)return K;let N=V instanceof Error?V.message:String(V);return J0("Expression",`Error evaluating: {{ ${U} }}: ${N}`,Z,$,_,K)}});for(let K=0;K<J.length;K++)X=X.replace(`<!--__STX_SCRIPT_EXPR_${K}__-->`,()=>J[K]);for(let K=0;K<Q.length;K++)X=X.replace(`<!--__STX_STYLE_${K}__-->`,()=>Q[K]);return X}function Y3($,Y,Z){if(!Y.trim())return $;let X=$,Q=Y.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=p1[G]||c1[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(e7()).join(", ")}`);let q=[];if(Q.startsWith(":")){let _=Q.match(/^:([^|\s]+)/);if(_){let U=_[1].trim();try{let W=Number(U);q=[Number.isNaN(W)?U:W]}catch{q=[U]}Q=Q.substring(_[0].length).trim()}}else if(Q.startsWith("(")){let _=1,U=1;while(_>0&&U<Q.length){if(Q[U]==="(")_++;if(Q[U]===")")_--;U++}if(_===0){let W=Q.substring(1,U-1).trim();if(W)try{if(W.startsWith("{")&&W.endsWith("}"))q=[m0(`(${W})`,Z,!0)];else{let B=[],j="",z=null,O=0,L=0,F=0,H=!1;for(let V=0;V<W.length;V++){let N=W[V];if(H){j+=N,H=!1;continue}if(N==="\\"){j+=N,H=!0;continue}if(z){if(j+=N,N===z)z=null;continue}if(N==='"'||N==="'"||N==="`"){z=N,j+=N;continue}if(N==="(")O++;else if(N===")")O--;else if(N==="[")L++;else if(N==="]")L--;else if(N==="{")F++;else if(N==="}")F--;if(N===","&&O===0&&L===0&&F===0){B.push(j),j="";continue}j+=N}if(j)B.push(j);q=B.map((V)=>{let N=V.trim();return m0(N,Z,!0)})}}catch{q=[W]}Q=Q.substring(U).trim()}}try{X=K(X,Z,...q)}catch(_){let U=_ instanceof Error?_.message:String(_);throw Error(`Error applying filter '${G}': ${U}`)}if(Q.startsWith("|"))Q=Q.substring(1).trim();else break}return X}function MX($){let Y=!1,Z="",X=0,Q=0,J=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],_=$[K+1];if(Y&&G){G=!1;continue}if(Y&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Y)Y=!0,Z=q;else if(q===Z)Y=!1,Z="";continue}if(Y&&Z==="`"&&q==="$"&&_==="{"){let U=1;K+=2;while(K<$.length&&U>0){if($[K]==="{")U++;else if($[K]==="}")U--;if(U>0)K++}continue}if(Y)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(_==="|"){K++;continue}if(_==="="){K++;continue}return K}}return-1}function m0($,Y,Z=!1){try{let X=$.trim(),Q=MX(X);if(Q>0){let J=X.substring(0,Q).trim(),G=X.substring(Q+1).trim(),K=m0(J,Y,!0);return Y3(K,G,Y)}if(!e(X)){if(!Z)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${X}`);return X0(X,Y)}try{let J=Object.keys(Y),G=Object.values(Y);return Y0(X,J)(...G)}catch{return X0(X,Y)}}catch(X){if(X instanceof ReferenceError){let Q=/(\b\w+)\s+is not defined/.exec(X.message);if(Q){let J=Q[1],G=IX(J,Object.keys(Y));if(G&&G!==J)X.message=`${X.message} \u2014 did you mean '${G}'?`}}if(!Z)console.error(`Error evaluating expression: ${$}`,X);throw X}}function IX($,Y){let Z=null;for(let Q of Y){if(Q===$)continue;let J=EX($,Q);if(Z===null||J<Z.dist)Z={key:Q,dist:J}}if(!Z)return null;let X=Math.max($.length,Z.key.length);if(Z.dist<=2||Z.dist/X<=0.35)return Z.key;return null}function EX($,Y){if($===Y)return 0;if($.length===0)return Y.length;if(Y.length===0)return $.length;let[Z,X]=$.length<Y.length?[$,Y]:[Y,$],Q=Array(Z.length+1),J=Array(Z.length+1);for(let G=0;G<=Z.length;G++)Q[G]=G;for(let G=1;G<=X.length;G++){J[0]=G;for(let K=1;K<=Z.length;K++){let q=Z[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<=Z.length;K++)Q[K]=J[K]}return Q[Z.length]}function s9($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var p1,r7,c1;var c0=b(()=>{V0();H0();s7();p1={},r7=new Map;c1={uppercase:($,Y)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Y)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Y)=>{if($===void 0||$===null)return"";let Z=String($);return Z.charAt(0).toUpperCase()+Z.slice(1)},number:($,Y,Z=0)=>{if($===void 0||$===null)return"";try{let X=Number($);return Number.isNaN(X)?"":X.toFixed(Number.parseInt(String(Z),10))}catch{return""}},fmt:($,Y,Z="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return X.toLocaleString(Z)}catch{return String($)}},join:($,Y,Z=",")=>{if(!Array.isArray($))return"";return $.join(String(Z))},escape:($,Y)=>{if($===void 0||$===null)return"";return J1(String($))},translate:($,Y,Z={})=>{if(!Y||!Y.__translations)return $;let X=Y.__translations,Q=Y.__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(Z).forEach(([q,_])=>{K=K.replace(NX(q),String(_))}),K},t:($,Y,Z={})=>{return c1.translate($,Y,Z)},truncate:($,Y,Z=50,X="...")=>{if($===void 0||$===null)return"";let Q=String($);if(Q.length<=Z)return Q;if(Z<=X.length)return X.substring(0,Z);return Q.substring(0,Z-X.length)+X},date:($,Y,Z="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(Z==="iso")return Q.toISOString();return new Intl.DateTimeFormat(X,J[Z]||J.short).format(Q)}catch{return String($)}},currency:($,Y,Z="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:Z}).format(Q)}catch{return String($)}},pluralize:($,Y,Z,X)=>{let Q=Number($);if(Number.isNaN(Q))return Z;let J=X||`${Z}s`;return Q===1?Z:J},first:($,Y)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Y)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Z=String($);return Z.charAt(Z.length-1)},length:($,Y)=>{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:($,Y,Z=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Z?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Y,Z="")=>{return $===void 0||$===null||$===""?Z:$},reverse:($,Y)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Y,Z=0,X)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Z,X);return $},replace:($,Y,Z,X="")=>{if($===void 0||$===null)return"";let Q=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Q,"g"),()=>X)},stripTags:($,Y)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Y)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Y)=>{let Z=Number($);return Number.isNaN(Z)?0:Math.abs(Z)},round:($,Y,Z=0)=>{let X=Number($);if(Number.isNaN(X))return 0;let Q=10**Z;return Math.round(X*Q)/Q}}});class i1{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Y=this.cache.get($);return this.cache.delete($),this.cache.set($,Y),Y}set($,Y){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let Z=this.cache.keys().next().value;if(Z!==void 0)this.cache.delete(Z)}this.cache.set($,Y)}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 A1($,Y){if(Y?.includes("g"))return new RegExp($,Y);let Z=`${$}:${Y||""}`;if(!N1.has(Z)){if(N1.size>=DX){let X=N1.keys().next().value;if(X)N1.delete(X)}N1.set(Z,new RegExp($,Y))}return N1.get(Z)}class X3{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Y=Array.from(new Set($)),Z=Y.sort().join(","),X=this.pool.find((K)=>K.context.join(",")===Z);if(X)return X.func;let Q=this.fnCache,J=this.fnCacheMaxSize,G=(...K)=>{return(q)=>{try{let _=`${Z}:${q}`,U=Q.get(_);if(!U){if(Q.size>=J){let W=Q.keys().next().value;if(W)Q.delete(W)}U=Function(...Y,`
1913
+ `)}function R5($){let Y=$.trim(),Z=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let X of Z)if(X.test(Y))return!1;return!0}var HX,n7,o7,LX;var V0=S(()=>{HX={maxSanitizeDepth:10,allowBracketNotation:!1},n7={...HX},o7=[/\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/],LX=/[\w)\]]\s*\[\s*['"]/});function N5($,Y){let Z=RX++,X=`<!--__STX_${$.toUpperCase()}_${Z}__-->`;return NX.set(X,{type:$,expression:Y}),X}var RX=0,NX;var s7=S(()=>{NX=new Map});var Z3={};r(Z3,{usesSignalsInScript:()=>A5,unescapeHtml:()=>s9,registerFilters:()=>wX,registerFilter:()=>t7,processExpressions:()=>c0,interpolateScriptsInTemplate:()=>MX,interpolateScriptExpressions:()=>$3,getAllFilters:()=>e7,evaluateExpression:()=>m0,escapeHtml:()=>Q1,defaultFilters:()=>i1,clearCustomFilters:()=>TX,applyFilters:()=>Y3});function AX($){let Y=r7.get($);if(!Y){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Y=new RegExp(`:${Z}(?!\\w)`,"g"),r7.set($,Y)}return Y.lastIndex=0,Y}function t7($,Y){if($ in i1)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);c1[$]=Y}function wX($){for(let[Y,Z]of Object.entries($))t7(Y,Z)}function e7(){return{...i1,...c1}}function TX(){for(let $ of Object.keys(c1))delete c1[$]}function Q1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function A5($){let Y=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Z;while((Z=Y.exec($))!==null){let X=Z[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;return!1}function a7($,Y){let Z=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],X=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Q="",J=!1,G=0;for(let _=0;_<X.length;_++){let U=X[_];if(!J&&U==="`"){J=!0,G=0;continue}if(J){if(U==="`"&&G===0){J=!1;continue}if(U==="$"&&X[_+1]==="{"){G++,_++;continue}if(U==="}"&&G>0){G--;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 _=q[1];if(!X.substring(0,q.index).trimEnd().endsWith(".")){if(!Z.includes(_)&&!(_ in Y))return!1}}return!0}function $3($,Y){let Z=$;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=m0(Q,Y);if(J===void 0)return X;return J===null?"":String(J)}catch{return X}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q)=>{let J=Q.trim();if(/^__[A-Z_]+__$/.test(J))return X;try{let G=m0(Q,Y);if(G===void 0)return X;return JSON.stringify(G)}catch{return X}}),Z}function MX($,Y,Z={}){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(Z.skipServer&&/\bserver\b/.test(Q))return X;let G=$3(J,Y);return`<script${Q}>${G}</script>`})}function c0($,Y,Z){let X=$,Q=[];X=X.replace(/<style[^>]*>[\s\S]*?<\/style>/gi,(K)=>{if(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(K))return K;let q=Q.length;return Q.push(K),`<!--__STX_STYLE_${q}__-->`});let J=[];X=X.replace(/<script[^>]*>[\s\S]*?<\/script>/gi,(K)=>{let q=J.length;return J.push(K),`<!--__STX_SCRIPT_EXPR_${q}__-->`});let G=A5($);X=X.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(K,q,_)=>{try{let U=m0(q,Y);return U!==void 0&&U!==null?String(U):""}catch(U){let W=U instanceof Error?U.message:String(U);return J0("Expression",`Error evaluating: {{{ ${q.trim()}}}}: ${W}`,Z,$,_,K)}}),X=X.replace(/\{!!([\s\S]*?)!!\}/g,(K,q,_)=>{try{let U=m0(q,Y);if(U===void 0&&Y.__stx_buildMode==="compile")return N5("raw",q.trim());return U!==void 0&&U!==null?String(U):""}catch(U){if(Y.__stx_buildMode==="compile")return N5("raw",q.trim());let W=U instanceof Error?U.message:String(U);return J0("Expression",`Error evaluating: {!! ${q.trim()} !!}: ${W}`,Z,$,_,K)}}),X=X.replace(/<script[^>]*>[\s\S]*?<\/script>/gi,(K)=>{if(K.startsWith("<!--__STX_SCRIPT_EXPR_"))return K;let q=J.length;return J.push(K),`<!--__STX_SCRIPT_EXPR_${q}__-->`}),X=X.replace(/<style[^>]*>[\s\S]*?<\/style>/gi,(K)=>{if(K.startsWith("<!--__STX_STYLE_"))return K;if(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(K))return K;let q=Q.length;return Q.push(K),`<!--__STX_STYLE_${q}__-->`}),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(K,q,_)=>{let U=q.trim(),W=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],B=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,z=U.match(B)?.[1],O=z&&((z in Y)||W.includes(z)),L=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,F=U.match(L),H=F&&!W.includes(F[1])&&!(F[1]in Y);if(/^__[A-Z_]+__$/.test(U))return"";try{let V=m0(q,Y);if(V===void 0&&G&&!a7(U,Y))return K;if(V===void 0&&Y.__stx_buildMode==="compile"&&!G)return N5("expr",U);return V!==void 0&&V!==null?Q1(String(V)):""}catch(V){if(G&&!a7(U,Y))return K;if(H)return K;let N=V instanceof Error?V.message:String(V);return J0("Expression",`Error evaluating: {{ ${U} }}: ${N}`,Z,$,_,K)}});for(let K=0;K<J.length;K++)X=X.replace(`<!--__STX_SCRIPT_EXPR_${K}__-->`,()=>J[K]);for(let K=0;K<Q.length;K++)X=X.replace(`<!--__STX_STYLE_${K}__-->`,()=>Q[K]);return X}function Y3($,Y,Z){if(!Y.trim())return $;let X=$,Q=Y.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=c1[G]||i1[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(e7()).join(", ")}`);let q=[];if(Q.startsWith(":")){let _=Q.match(/^:([^|\s]+)/);if(_){let U=_[1].trim();try{let W=Number(U);q=[Number.isNaN(W)?U:W]}catch{q=[U]}Q=Q.substring(_[0].length).trim()}}else if(Q.startsWith("(")){let _=1,U=1;while(_>0&&U<Q.length){if(Q[U]==="(")_++;if(Q[U]===")")_--;U++}if(_===0){let W=Q.substring(1,U-1).trim();if(W)try{if(W.startsWith("{")&&W.endsWith("}"))q=[m0(`(${W})`,Z,!0)];else{let B=[],j="",z=null,O=0,L=0,F=0,H=!1;for(let V=0;V<W.length;V++){let N=W[V];if(H){j+=N,H=!1;continue}if(N==="\\"){j+=N,H=!0;continue}if(z){if(j+=N,N===z)z=null;continue}if(N==='"'||N==="'"||N==="`"){z=N,j+=N;continue}if(N==="(")O++;else if(N===")")O--;else if(N==="[")L++;else if(N==="]")L--;else if(N==="{")F++;else if(N==="}")F--;if(N===","&&O===0&&L===0&&F===0){B.push(j),j="";continue}j+=N}if(j)B.push(j);q=B.map((V)=>{let N=V.trim();return m0(N,Z,!0)})}}catch{q=[W]}Q=Q.substring(U).trim()}}try{X=K(X,Z,...q)}catch(_){let U=_ instanceof Error?_.message:String(_);throw Error(`Error applying filter '${G}': ${U}`)}if(Q.startsWith("|"))Q=Q.substring(1).trim();else break}return X}function IX($){let Y=!1,Z="",X=0,Q=0,J=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],_=$[K+1];if(Y&&G){G=!1;continue}if(Y&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Y)Y=!0,Z=q;else if(q===Z)Y=!1,Z="";continue}if(Y&&Z==="`"&&q==="$"&&_==="{"){let U=1;K+=2;while(K<$.length&&U>0){if($[K]==="{")U++;else if($[K]==="}")U--;if(U>0)K++}continue}if(Y)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(_==="|"){K++;continue}if(_==="="){K++;continue}return K}}return-1}function m0($,Y,Z=!1){try{let X=$.trim(),Q=IX(X);if(Q>0){let J=X.substring(0,Q).trim(),G=X.substring(Q+1).trim(),K=m0(J,Y,!0);return Y3(K,G,Y)}if(!e(X)){if(!Z)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${X}`);return X0(X,Y)}try{let J=Object.keys(Y),G=Object.values(Y);return Y0(X,J)(...G)}catch{return X0(X,Y)}}catch(X){if(X instanceof ReferenceError){let Q=/(\b\w+)\s+is not defined/.exec(X.message);if(Q){let J=Q[1],G=EX(J,Object.keys(Y));if(G&&G!==J)X.message=`${X.message} \u2014 did you mean '${G}'?`}}if(!Z)console.error(`Error evaluating expression: ${$}`,X);throw X}}function EX($,Y){let Z=null;for(let Q of Y){if(Q===$)continue;let J=DX($,Q);if(Z===null||J<Z.dist)Z={key:Q,dist:J}}if(!Z)return null;let X=Math.max($.length,Z.key.length);if(Z.dist<=2||Z.dist/X<=0.35)return Z.key;return null}function DX($,Y){if($===Y)return 0;if($.length===0)return Y.length;if(Y.length===0)return $.length;let[Z,X]=$.length<Y.length?[$,Y]:[Y,$],Q=Array(Z.length+1),J=Array(Z.length+1);for(let G=0;G<=Z.length;G++)Q[G]=G;for(let G=1;G<=X.length;G++){J[0]=G;for(let K=1;K<=Z.length;K++){let q=Z[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<=Z.length;K++)Q[K]=J[K]}return Q[Z.length]}function s9($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var c1,r7,i1;var i0=S(()=>{V0();H0();s7();c1={},r7=new Map;i1={uppercase:($,Y)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Y)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Y)=>{if($===void 0||$===null)return"";let Z=String($);return Z.charAt(0).toUpperCase()+Z.slice(1)},number:($,Y,Z=0)=>{if($===void 0||$===null)return"";try{let X=Number($);return Number.isNaN(X)?"":X.toFixed(Number.parseInt(String(Z),10))}catch{return""}},fmt:($,Y,Z="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return X.toLocaleString(Z)}catch{return String($)}},join:($,Y,Z=",")=>{if(!Array.isArray($))return"";return $.join(String(Z))},escape:($,Y)=>{if($===void 0||$===null)return"";return Q1(String($))},translate:($,Y,Z={})=>{if(!Y||!Y.__translations)return $;let X=Y.__translations,Q=Y.__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(Z).forEach(([q,_])=>{K=K.replace(AX(q),String(_))}),K},t:($,Y,Z={})=>{return i1.translate($,Y,Z)},truncate:($,Y,Z=50,X="...")=>{if($===void 0||$===null)return"";let Q=String($);if(Q.length<=Z)return Q;if(Z<=X.length)return X.substring(0,Z);return Q.substring(0,Z-X.length)+X},date:($,Y,Z="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(Z==="iso")return Q.toISOString();return new Intl.DateTimeFormat(X,J[Z]||J.short).format(Q)}catch{return String($)}},currency:($,Y,Z="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:Z}).format(Q)}catch{return String($)}},pluralize:($,Y,Z,X)=>{let Q=Number($);if(Number.isNaN(Q))return Z;let J=X||`${Z}s`;return Q===1?Z:J},first:($,Y)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Y)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Z=String($);return Z.charAt(Z.length-1)},length:($,Y)=>{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:($,Y,Z=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Z?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Y,Z="")=>{return $===void 0||$===null||$===""?Z:$},reverse:($,Y)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Y,Z=0,X)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Z,X);return $},replace:($,Y,Z,X="")=>{if($===void 0||$===null)return"";let Q=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Q,"g"),()=>X)},stripTags:($,Y)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Y)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Y)=>{let Z=Number($);return Number.isNaN(Z)?0:Math.abs(Z)},round:($,Y,Z=0)=>{let X=Number($);if(Number.isNaN(X))return 0;let Q=10**Z;return Math.round(X*Q)/Q}}});class n1{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Y=this.cache.get($);return this.cache.delete($),this.cache.set($,Y),Y}set($,Y){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let Z=this.cache.keys().next().value;if(Z!==void 0)this.cache.delete(Z)}this.cache.set($,Y)}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 w1($,Y){if(Y?.includes("g"))return new RegExp($,Y);let Z=`${$}:${Y||""}`;if(!A1.has(Z)){if(A1.size>=kX){let X=A1.keys().next().value;if(X)A1.delete(X)}A1.set(Z,new RegExp($,Y))}return A1.get(Z)}class X3{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Y=Array.from(new Set($)),Z=Y.sort().join(","),X=this.pool.find((K)=>K.context.join(",")===Z);if(X)return X.func;let Q=this.fnCache,J=this.fnCacheMaxSize,G=(...K)=>{return(q)=>{try{let _=`${Z}:${q}`,U=Q.get(_);if(!U){if(Q.size>=J){let W=Q.keys().next().value;if(W)Q.delete(W)}U=Function(...Y,`
1914
1914
  'use strict';
1915
1915
  try {
1916
1916
  return ${q};
@@ -1921,42 +1921,43 @@ catch (e) {
1921
1921
  }
1922
1922
  throw e;
1923
1923
  }
1924
- `),Q.set(_,U)}return U(...K)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Y.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}class J3{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Y){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Y})}setBudgets($){for(let[Y,Z]of Object.entries($))this.setBudget(Y,Z)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Y,Z]of this.budgets.entries())$[Y]=Z;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Y=this.violationHandlers.indexOf($);if(Y!==-1)this.violationHandlers.splice(Y,1)}time($,Y){if(!this.enabled)return Y();let Z=performance.now(),X=Y(),Q=performance.now()-Z;return this.recordTime($,Q),this.checkBudget($,Q),X}async timeAsync($,Y){if(!this.enabled)return Y();let Z=performance.now(),X=await Y(),Q=performance.now()-Z;return this.recordTime($,Q),this.checkBudget($,Q),X}checkBudget($,Y){let Z=this.budgets.get($);if(!Z)return;let X=Y/Z.maxTime*100,Q=Z.warnThreshold!==void 0?Y>=Z.maxTime*Z.warnThreshold&&Y<Z.maxTime:!1,J=Y>=Z.maxTime;if(!Q&&!J)return;let G={label:$,actualTime:Y,budgetTime:Z.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 ${Y.toFixed(2)}ms (${X.toFixed(1)}% of ${Z.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Y.toFixed(2)}ms (exceeded ${Z.maxTime}ms budget by ${(X-100).toFixed(1)}%)`;switch(Z.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($,Y){let Z=this.metrics.get($);if(Z)Z.count++,Z.totalTime+=Y,Z.maxTime=Math.max(Z.maxTime,Y),Z.minTime=Math.min(Z.minTime,Y);else this.metrics.set($,{count:1,totalTime:Y,maxTime:Y,minTime:Y})}getStats($){if($){let Z=this.metrics.get($);if(!Z)return{};let X=this.budgets.get($);return{count:Z.count,avgTime:Z.totalTime/Z.count,totalTime:Z.totalTime,maxTime:Z.maxTime,minTime:Z.minTime,budget:X?.maxTime,budgetUtilization:X?Z.totalTime/Z.count/X.maxTime*100:void 0}}let Y={};for(let[Z,X]of this.metrics.entries()){let Q=this.budgets.get(Z);Y[Z]={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 Y}getViolations($){if($)return this.violations.filter((Y)=>Y.label===$);return[...this.violations]}getViolationStats(){let $={},Y=0,Z=0;for(let X of this.violations)if($[X.label]=($[X.label]||0)+1,X.isWarning)Y++;else Z++;return{total:this.violations.length,byLabel:$,warnings:Y,errors:Z}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function kX(){if(!r9)r9=new J3;return r9}var N1,DX=500,I_,r9=null,Q3;var w1=b(()=>{N1=new Map;I_=new X3;Q3=new Proxy({},{get($,Y){return kX()[Y]}})});function G3($,Y=""){let Z=`${$}${Y}`,X=0;for(let Q=0;Q<Z.length;Q++){let J=Z.charCodeAt(Q);X=(X<<5)-X+J,X=X&X}return`stx-${Math.abs(X).toString(36)}`}function K3($,Y,Z={}){let{prefix:X="",preserveHost:Q=!0,scopeKeyframes:J=!0,scopeCustomProperties:G=!1}=Z;if(!$.trim())return"";let K=a9($),q=[],_=new Map;if(J)for(let U of K){let W=U.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(W){let B=W[1],j=`${Y}_${B}`;_.set(B,j)}}for(let U of K){let W=q3(U,Y,X,Q,_,G);q.push(W)}return q.join(`
1924
+ `),Q.set(_,U)}return U(...K)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Y.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}class J3{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Y){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Y})}setBudgets($){for(let[Y,Z]of Object.entries($))this.setBudget(Y,Z)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Y,Z]of this.budgets.entries())$[Y]=Z;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Y=this.violationHandlers.indexOf($);if(Y!==-1)this.violationHandlers.splice(Y,1)}time($,Y){if(!this.enabled)return Y();let Z=performance.now(),X=Y(),Q=performance.now()-Z;return this.recordTime($,Q),this.checkBudget($,Q),X}async timeAsync($,Y){if(!this.enabled)return Y();let Z=performance.now(),X=await Y(),Q=performance.now()-Z;return this.recordTime($,Q),this.checkBudget($,Q),X}checkBudget($,Y){let Z=this.budgets.get($);if(!Z)return;let X=Y/Z.maxTime*100,Q=Z.warnThreshold!==void 0?Y>=Z.maxTime*Z.warnThreshold&&Y<Z.maxTime:!1,J=Y>=Z.maxTime;if(!Q&&!J)return;let G={label:$,actualTime:Y,budgetTime:Z.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 ${Y.toFixed(2)}ms (${X.toFixed(1)}% of ${Z.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Y.toFixed(2)}ms (exceeded ${Z.maxTime}ms budget by ${(X-100).toFixed(1)}%)`;switch(Z.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($,Y){let Z=this.metrics.get($);if(Z)Z.count++,Z.totalTime+=Y,Z.maxTime=Math.max(Z.maxTime,Y),Z.minTime=Math.min(Z.minTime,Y);else this.metrics.set($,{count:1,totalTime:Y,maxTime:Y,minTime:Y})}getStats($){if($){let Z=this.metrics.get($);if(!Z)return{};let X=this.budgets.get($);return{count:Z.count,avgTime:Z.totalTime/Z.count,totalTime:Z.totalTime,maxTime:Z.maxTime,minTime:Z.minTime,budget:X?.maxTime,budgetUtilization:X?Z.totalTime/Z.count/X.maxTime*100:void 0}}let Y={};for(let[Z,X]of this.metrics.entries()){let Q=this.budgets.get(Z);Y[Z]={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 Y}getViolations($){if($)return this.violations.filter((Y)=>Y.label===$);return[...this.violations]}getViolationStats(){let $={},Y=0,Z=0;for(let X of this.violations)if($[X.label]=($[X.label]||0)+1,X.isWarning)Y++;else Z++;return{total:this.violations.length,byLabel:$,warnings:Y,errors:Z}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function bX(){if(!r9)r9=new J3;return r9}var A1,kX=500,b_,r9=null,Q3;var T1=S(()=>{A1=new Map;b_=new X3;Q3=new Proxy({},{get($,Y){return bX()[Y]}})});function G3($,Y=""){let Z=`${$}${Y}`,X=0;for(let Q=0;Q<Z.length;Q++){let J=Z.charCodeAt(Q);X=(X<<5)-X+J,X=X&X}return`stx-${Math.abs(X).toString(36)}`}function K3($,Y,Z={}){let{prefix:X="",preserveHost:Q=!0,scopeKeyframes:J=!0,scopeCustomProperties:G=!1}=Z;if(!$.trim())return"";let K=a9($),q=[],_=new Map;if(J)for(let U of K){let W=U.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(W){let B=W[1],j=`${Y}_${B}`;_.set(B,j)}}for(let U of K){let W=q3(U,Y,X,Q,_,G);q.push(W)}return q.join(`
1925
1925
 
1926
1926
  `)}function a9($){let Y=[],Z=$.replace(/\/\*[\s\S]*?\*\//g,""),X=0,Q="",J=!1,G="";for(let K=0;K<Z.length;K++){let q=Z[K];if(q==="@"&&X===0)J=!0;if(q==="{")X++;else if(q==="}"){if(X--,X===0){if(J){G+=q;let _=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(_){let[,U,W,B]=_;if(U==="keyframes")Y.push({selector:`@keyframes ${W.trim()}`,declarations:B.trim()});else if(U==="media"||U==="supports"||U==="container"){let j=a9(B);Y.push({selector:`@${U} ${W.trim()}`,declarations:j.map((z)=>`${z.selector} { ${z.declarations} }`).join(`
1927
1927
  `)})}else Y.push({selector:`@${U} ${W.trim()}`,declarations:B.trim()})}G="",J=!1}else if(Q.trim()){Q+=q;let _=Q.match(/([^{]+)\{([^}]*)\}/);if(_)Y.push({selector:_[1].trim(),declarations:_[2].trim()});Q=""}continue}}if(J)G+=q;else Q+=q}return Y}function q3($,Y,Z,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 W=a9(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((B)=>q3(B,Y,Z,X,Q,J)).join(`
1928
1928
  `);return`${G} {
1929
1929
  ${W}
1930
- }`}return`${G} { ${K} }`}let q=SX(G,Y,Z,X),_=K;for(let[U,W]of Q)_=_.replace(new RegExp(`\\b${U}\\b`,"g"),W);if(J)_=_.replace(/--([a-z-]+)/gi,`--${Y}-$1`);return`${q} { ${_} }`}function SX($,Y,Z,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(\([^)]*\))?/,`.${Y}$1`);J.push(q)}continue}if(G.includes("::slotted")){J.push(G);continue}if(G===":root"){J.push(`:root .${Y}`);continue}let K=Z?`${Z} .${Y}`:`.${Y}`;J.push(`${K} ${G}`)}return J.join(", ")}function w5($,Y){if(!/<style\s+[^>]*\bscoped\b/i.test($))return{html:$,hasScoped:!1};let Z=G3(Y),X=`data-v-${Z}`,Q=$,J=/<style\s+([^>]*\bscoped\b[^>]*)>([\s\S]*?)<\/style>/gi,G=!1;if(Q=Q.replace(J,(K,q,_)=>{G=!0;let U=bX(_,X),W=q.replace(/\bscoped\b/gi,"").trim(),B=W?` ${W}`:"";return`<style data-stx-scoped="${Z}"${B}>${U}</style>`}),!G)return{html:$,hasScoped:!1};return Q=yX(Q,X),{html:Q,hasScoped:!0}}function bX($,Y){return K3($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Y}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Y}]`)}function yX($,Y){let Z=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(X,Q,J)=>{if(Z.has(Q.toLowerCase()))return X;if(X.includes(Y))return X;if(Q.toLowerCase()==="style"||Q.toLowerCase()==="script")return X;if(J)return X.replace(`<${Q}${J}`,`<${Q} ${Y}${J}`);if(X.endsWith("/>"))return`<${Q} ${Y} />`;return`<${Q} ${Y}>`})}var t9=()=>{};var U3=()=>{};function T0($,Y,Z,X=0){let Q=0,J=X,G=null,K=0,q=!1;while(J<$.length){let _=$[J];if(G&&q){q=!1,J++;continue}if(G&&_==="\\"){q=!0,J++;continue}if(q=!1,(_==='"'||_==="'"||_==="`")&&!G){G=_,J++;continue}if(_===G&&G!=="`"){G=null,J++;continue}if(G==="`"&&_==="$"&&$[J+1]==="{"){K++,J+=2;continue}if(K>0&&_==="}"){K--,J++;continue}if(_==="`"&&G==="`"&&K===0){G=null,J++;continue}if(G){J++;continue}if(_===Y)Q++;else if(_===Z){if(Q--,Q===0)return J}J++}return-1}var e9={};r(e9,{useTitle:()=>gX,useSeoMeta:()=>M5,usePageTitle:()=>gX,useHead:()=>K1,resetHead:()=>vX,renderHtmlAttrs:()=>dX,renderHead:()=>hX,renderBodyAttrs:()=>mX,processTitleDirective:()=>pX,processMetaDirective:()=>cX,processHeadDirective:()=>lX,getPageMeta:()=>CX,getHead:()=>n1,definePageMeta:()=>fX,applyHead:()=>uX});function n1(){return i0}function CX(){return T5}function vX(){i0={},PX.length=0,T5={}}function K1($){i0=xX(i0,$)}function xX($,Y){return{title:Y.title??$.title,titleTemplate:Y.titleTemplate??$.titleTemplate,base:Y.base??$.base,meta:[...$.meta||[],...Y.meta||[]],link:[...$.link||[],...Y.link||[]],script:[...$.script||[],...Y.script||[]],style:[...$.style||[],...Y.style||[]],htmlAttrs:{...$.htmlAttrs,...Y.htmlAttrs},bodyAttrs:{...$.bodyAttrs,...Y.bodyAttrs}}}function M5($){let Y=[];if($.description)Y.push({name:"description",content:$.description});if($.keywords){let q=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Y.push({name:"keywords",content:q})}if($.author)Y.push({name:"author",content:$.author});if($.robots)Y.push({name:"robots",content:$.robots});let Z=$.ogTitle??$.title,X=$.ogDescription??$.description;if(Z)Y.push({property:"og:title",content:Z});if(X)Y.push({property:"og:description",content:X});if($.ogImage)Y.push({property:"og:image",content:$.ogImage});if($.ogUrl)Y.push({property:"og:url",content:$.ogUrl});if($.ogType)Y.push({property:"og:type",content:$.ogType});if($.ogSiteName)Y.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)Y.push({property:"og:locale",content:$.ogLocale});let Q=$.twitterTitle??$.title,J=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Y.push({name:"twitter:card",content:$.twitterCard});if(Q)Y.push({name:"twitter:title",content:Q});if(J)Y.push({name:"twitter:description",content:J});if(G)Y.push({name:"twitter:image",content:G});if($.twitterSite)Y.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)Y.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)Y.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)Y.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)Y.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)Y.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let q of $.articleTags)Y.push({property:"article:tag",content:q});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});K1({title:$.title,titleTemplate:$.titleTemplate,meta:Y,link:K})}function fX($){if(T5={...T5,...$},$.title||$.description)M5({title:$.title,description:$.description})}function gX($){let Y=typeof $==="function"?$():$;K1({title:Y})}function hX($=i0){let Y=[];if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);Y.push(`<title>${G1(Z)}</title>`)}if($.base){let Z=Object.entries($.base).map(([X,Q])=>`${X}="${G1(Q)}"`).join(" ");Y.push(`<base ${Z}>`)}for(let Z of $.meta||[]){let X=Object.entries(Z).filter(([Q,J])=>J!==void 0).map(([Q,J])=>{return`${Q==="httpEquiv"?"http-equiv":Q}="${G1(String(J))}"`}).join(" ");Y.push(`<meta ${X}>`)}for(let Z of $.link||[]){let X=Object.entries(Z).filter(([Q,J])=>J!==void 0).map(([Q,J])=>`${Q}="${G1(String(J))}"`).join(" ");Y.push(`<link ${X}>`)}for(let Z of $.script||[]){let{content:X,...Q}=Z,J=Object.entries(Q).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${G1(String(K))}"`}).filter(Boolean).join(" ");if(X)Y.push(`<script ${J}>${X}</script>`);else Y.push(`<script ${J}></script>`)}for(let Z of $.style||[]){let X=Z.type?` type="${Z.type}"`:"";Y.push(`<style${X}>${Z.content}</style>`)}return Y.join(`
1931
- `)}function dX($=i0){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Y,Z])=>`${Y}="${G1(Z)}"`).join(" ")}function mX($=i0){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Y,Z])=>`${Y}="${G1(Z)}"`).join(" ")}function G1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function uX($=i0){if(typeof document>"u")return;if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);document.title=Y}for(let Y of $.meta||[]){let Z=Y.name?`meta[name="${Y.name}"]`:Y.property?`meta[property="${Y.property}"]`:null;if(Z){let X=document.querySelector(Z);if(!X){if(X=document.createElement("meta"),Y.name)X.setAttribute("name",Y.name);if(Y.property)X.setAttribute("property",Y.property);document.head.appendChild(X)}X.setAttribute("content",Y.content)}}for(let Y of $.link||[]){let Z=`link[rel="${Y.rel}"]${Y.href?`[href="${Y.href}"]`:""}`,X=document.querySelector(Z);if(!X)X=document.createElement("link"),document.head.appendChild(X);for(let[Q,J]of Object.entries(Y))if(J!==void 0)X.setAttribute(Q,String(J))}if($.htmlAttrs)for(let[Y,Z]of Object.entries($.htmlAttrs))document.documentElement.setAttribute(Y,Z);if($.bodyAttrs)for(let[Y,Z]of Object.entries($.bodyAttrs))document.body.setAttribute(Y,Z)}function lX($){let Y="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(X,Q)=>{return Y+=Q.trim()+`
1932
- `,""}),headContent:Y.trim()}}function pX($,Y){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Z,X,Q,J)=>{let G=X?Q:Y[(J||"").trim()]??J;return K1({title:G}),""})}function cX($,Y){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Z,X,Q,J,G,K)=>{let q=J?G:K,_=J?q:Y[(q||"").trim()]??q,W=Q.includes(":")?{property:Q,content:_}:{name:Q,content:_};return K1({meta:[W]}),""})}var i0,PX,T5;var o1=b(()=>{i0={},PX=[],T5={}});var I5={};r(I5,{stripTypeScript:()=>z3,hasVariables:()=>V3,extractVariables:()=>j3,extractScriptFromTemplate:()=>F3,convertToCommonJS:()=>Y$});import s1 from"path";function iX($){let Y=[],Z=0,X=$.split(`
1930
+ }`}return`${G} { ${K} }`}let q=SX(G,Y,Z,X),_=K;for(let[U,W]of Q)_=_.replace(new RegExp(`\\b${U}\\b`,"g"),W);if(J)_=_.replace(/--([a-z-]+)/gi,`--${Y}-$1`);return`${q} { ${_} }`}function SX($,Y,Z,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(\([^)]*\))?/,`.${Y}$1`);J.push(q)}continue}if(G.includes("::slotted")){J.push(G);continue}if(G===":root"){J.push(`:root .${Y}`);continue}let K=Z?`${Z} .${Y}`:`.${Y}`;J.push(`${K} ${G}`)}return J.join(", ")}function w5($,Y){if(!/<style\s+[^>]*\bscoped\b/i.test($))return{html:$,hasScoped:!1};let Z=G3(Y),X=`data-v-${Z}`,Q=$,J=/<style\s+([^>]*\bscoped\b[^>]*)>([\s\S]*?)<\/style>/gi,G=!1;if(Q=Q.replace(J,(K,q,_)=>{G=!0;let U=yX(_,X),W=q.replace(/\bscoped\b/gi,"").trim(),B=W?` ${W}`:"";return`<style data-stx-scoped="${Z}"${B}>${U}</style>`}),!G)return{html:$,hasScoped:!1};return Q=PX(Q,X),{html:Q,hasScoped:!0}}function yX($,Y){return K3($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Y}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Y}]`)}function PX($,Y){let Z=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(X,Q,J)=>{if(Z.has(Q.toLowerCase()))return X;if(X.includes(Y))return X;if(Q.toLowerCase()==="style"||Q.toLowerCase()==="script")return X;if(J)return X.replace(`<${Q}${J}`,`<${Q} ${Y}${J}`);if(X.endsWith("/>"))return`<${Q} ${Y} />`;return`<${Q} ${Y}>`})}var t9=()=>{};var U3=()=>{};function T0($,Y,Z,X=0){let Q=0,J=X,G=null,K=0,q=!1;while(J<$.length){let _=$[J];if(G&&q){q=!1,J++;continue}if(G&&_==="\\"){q=!0,J++;continue}if(q=!1,(_==='"'||_==="'"||_==="`")&&!G){G=_,J++;continue}if(_===G&&G!=="`"){G=null,J++;continue}if(G==="`"&&_==="$"&&$[J+1]==="{"){K++,J+=2;continue}if(K>0&&_==="}"){K--,J++;continue}if(_==="`"&&G==="`"&&K===0){G=null,J++;continue}if(G){J++;continue}if(_===Y)Q++;else if(_===Z){if(Q--,Q===0)return J}J++}return-1}var e9={};r(e9,{useTitle:()=>hX,useSeoMeta:()=>M5,usePageTitle:()=>hX,useHead:()=>K1,resetHead:()=>xX,renderHtmlAttrs:()=>mX,renderHead:()=>dX,renderBodyAttrs:()=>uX,processTitleDirective:()=>cX,processMetaDirective:()=>iX,processHeadDirective:()=>pX,getPageMeta:()=>vX,getHead:()=>o1,definePageMeta:()=>gX,applyHead:()=>lX});function o1(){return n0}function vX(){return T5}function xX(){n0={},CX.length=0,T5={}}function K1($){n0=fX(n0,$)}function fX($,Y){return{title:Y.title??$.title,titleTemplate:Y.titleTemplate??$.titleTemplate,base:Y.base??$.base,meta:[...$.meta||[],...Y.meta||[]],link:[...$.link||[],...Y.link||[]],script:[...$.script||[],...Y.script||[]],style:[...$.style||[],...Y.style||[]],htmlAttrs:{...$.htmlAttrs,...Y.htmlAttrs},bodyAttrs:{...$.bodyAttrs,...Y.bodyAttrs}}}function M5($){let Y=[];if($.description)Y.push({name:"description",content:$.description});if($.keywords){let q=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Y.push({name:"keywords",content:q})}if($.author)Y.push({name:"author",content:$.author});if($.robots)Y.push({name:"robots",content:$.robots});let Z=$.ogTitle??$.title,X=$.ogDescription??$.description;if(Z)Y.push({property:"og:title",content:Z});if(X)Y.push({property:"og:description",content:X});if($.ogImage)Y.push({property:"og:image",content:$.ogImage});if($.ogUrl)Y.push({property:"og:url",content:$.ogUrl});if($.ogType)Y.push({property:"og:type",content:$.ogType});if($.ogSiteName)Y.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)Y.push({property:"og:locale",content:$.ogLocale});let Q=$.twitterTitle??$.title,J=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Y.push({name:"twitter:card",content:$.twitterCard});if(Q)Y.push({name:"twitter:title",content:Q});if(J)Y.push({name:"twitter:description",content:J});if(G)Y.push({name:"twitter:image",content:G});if($.twitterSite)Y.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)Y.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)Y.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)Y.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)Y.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)Y.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let q of $.articleTags)Y.push({property:"article:tag",content:q});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});K1({title:$.title,titleTemplate:$.titleTemplate,meta:Y,link:K})}function gX($){if(T5={...T5,...$},$.title||$.description)M5({title:$.title,description:$.description})}function hX($){let Y=typeof $==="function"?$():$;K1({title:Y})}function dX($=n0){let Y=[];if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);Y.push(`<title>${G1(Z)}</title>`)}if($.base){let Z=Object.entries($.base).map(([X,Q])=>`${X}="${G1(Q)}"`).join(" ");Y.push(`<base ${Z}>`)}for(let Z of $.meta||[]){let X=Object.entries(Z).filter(([Q,J])=>J!==void 0).map(([Q,J])=>{return`${Q==="httpEquiv"?"http-equiv":Q}="${G1(String(J))}"`}).join(" ");Y.push(`<meta ${X}>`)}for(let Z of $.link||[]){let X=Object.entries(Z).filter(([Q,J])=>J!==void 0).map(([Q,J])=>`${Q}="${G1(String(J))}"`).join(" ");Y.push(`<link ${X}>`)}for(let Z of $.script||[]){let{content:X,...Q}=Z,J=Object.entries(Q).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${G1(String(K))}"`}).filter(Boolean).join(" ");if(X)Y.push(`<script ${J}>${X}</script>`);else Y.push(`<script ${J}></script>`)}for(let Z of $.style||[]){let X=Z.type?` type="${Z.type}"`:"";Y.push(`<style${X}>${Z.content}</style>`)}return Y.join(`
1931
+ `)}function mX($=n0){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Y,Z])=>`${Y}="${G1(Z)}"`).join(" ")}function uX($=n0){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Y,Z])=>`${Y}="${G1(Z)}"`).join(" ")}function G1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function lX($=n0){if(typeof document>"u")return;if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);document.title=Y}for(let Y of $.meta||[]){let Z=Y.name?`meta[name="${Y.name}"]`:Y.property?`meta[property="${Y.property}"]`:null;if(Z){let X=document.querySelector(Z);if(!X){if(X=document.createElement("meta"),Y.name)X.setAttribute("name",Y.name);if(Y.property)X.setAttribute("property",Y.property);document.head.appendChild(X)}X.setAttribute("content",Y.content)}}for(let Y of $.link||[]){let Z=`link[rel="${Y.rel}"]${Y.href?`[href="${Y.href}"]`:""}`,X=document.querySelector(Z);if(!X)X=document.createElement("link"),document.head.appendChild(X);for(let[Q,J]of Object.entries(Y))if(J!==void 0)X.setAttribute(Q,String(J))}if($.htmlAttrs)for(let[Y,Z]of Object.entries($.htmlAttrs))document.documentElement.setAttribute(Y,Z);if($.bodyAttrs)for(let[Y,Z]of Object.entries($.bodyAttrs))document.body.setAttribute(Y,Z)}function pX($){let Y="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(X,Q)=>{return Y+=Q.trim()+`
1932
+ `,""}),headContent:Y.trim()}}function cX($,Y){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Z,X,Q,J)=>{let G=X?Q:Y[(J||"").trim()]??J;return K1({title:G}),""})}function iX($,Y){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Z,X,Q,J,G,K)=>{let q=J?G:K,_=J?q:Y[(q||"").trim()]??q,W=Q.includes(":")?{property:Q,content:_}:{name:Q,content:_};return K1({meta:[W]}),""})}var n0,CX,T5;var s1=S(()=>{n0={},CX=[],T5={}});var I5={};r(I5,{stripTypeScript:()=>z3,hasVariables:()=>V3,extractVariables:()=>j3,extractScriptFromTemplate:()=>F3,convertToCommonJS:()=>Y$});import M1 from"path";function nX($){let Y=[],Z=0,X=$.split(`
1933
1933
  `);for(let Q of X){let J=null,G=!1;for(let K=0;K<Q.length;K++){let q=Q[K];if(G){G=!1;continue}if(q==="\\"){G=!0;continue}if(J){if(q===J)J=null;continue}if(q==="'"||q==='"'||q==="`"){J=q;continue}if(q==="/"&&K+1<Q.length&&Q[K+1]==="/")break;if(q==="{")Z++;else if(q==="}")Z--}if(Z===0){let K=Q.match(/(?:const|let|var)\s+(\w+)\s*=/);if(K)Y.push(K[1]);else{let q=Q.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(q){let U=q[1].slice(1,-1).split(",").map((W)=>{let B=W.split(":");return(B.length>1?B[1]:B[0]).trim()}).filter((W)=>/^\w+$/.test(W));Y.push(...U)}}}}return[...new Set(Y)]}function z3($){let Y=$;Y=Y.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Y=Y.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Y=Y.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Y=Y.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Y=Y.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Z(X){if(!X.includes(":"))return X;let Q=[],J="",G=0,K=0,q=null;for(let _=0;_<X.length;_++){let U=X[_];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((_)=>{let U=_.trim(),W=U.startsWith("..."),B=W?U.slice(3):U,j=-1,z=0;for(let R=0;R<B.length;R++)if(B[R]==="<")z++;else if(B[R]===">")z--;else if(B[R]===":"&&z===0){j=R;break}if(j===-1)return _;let L=B.substring(0,j).trim().replace(/\?$/,""),F=B.substring(j+1),H=-1,V=0;for(let R=0;R<F.length;R++)if(F[R]==="<")V++;else if(F[R]===">")V--;else if(F[R]==="="&&V===0){H=R;break}let N=W?"...":"";if(H!==-1)return`${N}${L} = ${F.substring(H+1).trim()}`;return`${N}${L}`}).join(", ")}Y=Y.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(X,Q,J)=>{if(!J.includes(":"))return X;return`${Q}(${Z(J)})`});{let X=/\b(function\s+\w*\s*)\(/g,Q,J=[];while((Q=X.exec(Y))!==null){let G=Q.index+Q[0].length-1,K=1,q=G+1,_=0,U=null;while(q<Y.length&&K>0){let j=Y[q];if(U){if(j===U)U=null;q++;continue}if(j==='"'||j==="'"||j==="`"){U=j,q++;continue}if(j==="<")_++;else if(j===">"&&_>0)_--;else if(_===0){if(j==="(")K++;else if(j===")")K--}if(K>0)q++}if(K!==0)continue;let W=Y.substring(G+1,q);if(!W.includes(":"))continue;let B=Z(W);J.push({start:G+1,end:q,replacement:B})}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:_}=J[G];Y=Y.substring(0,K)+_+Y.substring(q)}}return Y=Y.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("="),_=K.split(":")[0].trim();if(q.length>0)return`${_} = ${q.join("=").trim()}`;return _}).join(", ")}) =>`}),Y=Y.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"),Y=Y.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Y=Y.replace(/(\b(?:defineProps|withDefaults|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Y=Y.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Y=Y.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Y=Y.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Y=Y.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Y=Y.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Y=Y.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Y=Y.replace(/\n\s*\n\s*\n/g,`
1934
1934
 
1935
- `),Y}async function j3($,Y,Z){if(!$.trim())return;let X;try{let C=new Bun.Transpiler({loader:"ts",target:"browser",define:P0()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),X=C.transformSync(v)}catch{X=z3($)}let Q={exports:{}},J=Q.exports,G=process.cwd(),K={},q=[...X.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((C)=>C[1]).filter((C)=>!C.startsWith("node:")&&!C.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(C));for(let C of q)try{let v=s1.resolve(G,"node_modules",C),f=s1.join(v,"package.json"),p=JSON.parse($0("fs").readFileSync(f,"utf8")),x=p.main||"index.js";if(p.exports){let d=typeof p.exports==="string"?p.exports:p.exports["."];if(typeof d==="string")x=d;else if(d?.bun)x=d.bun;else if(d?.import)x=d.import;else if(d?.default)x=d.default}K[C]=await import(s1.resolve(v,x))}catch{}let _=(C)=>{if(K[C])return K[C];return $0(C)},U=Y.props||{},W=Object.assign((C)=>{if(!C)return U;let v={};for(let[f,p]of Object.entries(C)){let x=U[f];if(x!==void 0)v[f]=x;else if(typeof p==="function")v[f]=p();else v[f]=p}return v},U),B=()=>U,j=(C,v)=>{let f={...C};for(let[p,x]of Object.entries(v))if(f[p]===void 0)if(typeof x==="function")f[p]=x();else f[p]=x;return f},z=(C)=>{let v=()=>C;return v.set=(f)=>{},v.update=(f)=>{},v},O=(C)=>{let v,f=!1;return()=>{if(!f)try{v=C(),f=!0}catch{v=void 0}return v}},L=(C)=>{},F=(C)=>C(),H=(C)=>{},V=(C)=>{},N=(C)=>{},R=()=>({params:{},query:{},path:"",name:"",fullPath:"",hash:"",matched:[]}),A=()=>({push:(C)=>{},replace:(C)=>{},back:()=>{},forward:()=>{},go:(C)=>{}}),w=(C)=>{K1(C);let v=Y.__stx_runtime_head||{},f=C||{};Y.__stx_runtime_head={...v,...f.title&&{title:f.title},meta:[...v.meta||[],...f.meta||[]],link:[...v.link||[],...f.link||[]],script:[...v.script||[],...f.script||[]],htmlAttrs:{...v.htmlAttrs||{},...f.htmlAttrs||{}},bodyAttrs:{...v.bodyAttrs||{},...f.bodyAttrs||{}}}},T=(C)=>{M5(C);let v=n1();Y.__stx_runtime_head={...Y.__stx_runtime_head||{},...v.title&&{title:v.title},meta:v.meta?[...v.meta]:[]}},I=(C)=>({value:C}),M=(C)=>C,E=(C)=>({value:typeof C==="function"?C():C}),D=(C,v)=>{},P=(C)=>{},y=(C)=>{},S=(C)=>C?C():Promise.resolve(),k=(C)=>(v,...f)=>{},g=(C)=>{},h=(C,v)=>{},n=(C,v)=>v,_0=()=>({value:"light"}),w0=()=>({value:!1}),q0={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},k0=new Proxy(q0,{get(C,v){if(v in C)return C[v];return},set(C,v,f){return C[v]=f,!0}}),y0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},O0=console;try{let C=Y$(X,Z),v=new Set(Object.keys(U)),f=Object.keys(Y).filter((t)=>!v.has(t)&&t!=="props"),p=f.map((t)=>Y[t]),x=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"]),d=[],K0=[];for(let[t,x9]of Object.entries(U)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t))continue;if(x.has(t))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${t}\\b`).test(C))continue;d.push(t),K0.push(x9)}let Z0=iX(C).map((t)=>`module.exports.${t} = typeof ${t} !== 'undefined' ? ${t} : module.exports.${t};`).join(`
1936
- `),F0=Y.params??{},F1=[],h1=[];for(let t=0;t<f.length;t++){if(f[t]==="params")continue;F1.push(f[t]),h1.push(p[t])}let v9=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","provide","inject","useColorMode","useDark","window","document","console","confirm","alert","fetch","params",...d,...F1,`return (async () => {
1935
+ `),Y}async function j3($,Y,Z){if(!$.trim())return;let X;try{let C=new Bun.Transpiler({loader:"ts",target:"browser",define:P0()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),X=C.transformSync(v)}catch{X=z3($)}let Q={exports:{}},J=Q.exports,G=process.cwd(),K={},q=[...X.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((C)=>C[1]).filter((C)=>!C.startsWith("node:")&&!C.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(C));for(let C of q)try{let v=M1.resolve(G,"node_modules",C),f=M1.join(v,"package.json"),p=JSON.parse($0("fs").readFileSync(f,"utf8")),x=p.main||"index.js";if(p.exports){let d=typeof p.exports==="string"?p.exports:p.exports["."];if(typeof d==="string")x=d;else if(d?.bun)x=d.bun;else if(d?.import)x=d.import;else if(d?.default)x=d.default}K[C]=await import(M1.resolve(v,x))}catch{}let _=(C)=>{if(K[C])return K[C];return $0(C)},U=Y.props||{},W=Object.assign((C)=>{if(!C)return U;let v={};for(let[f,p]of Object.entries(C)){let x=U[f];if(x!==void 0)v[f]=x;else if(typeof p==="function")v[f]=p();else v[f]=p}return v},U),B=()=>U,j=(C,v)=>{let f={...C};for(let[p,x]of Object.entries(v))if(f[p]===void 0)if(typeof x==="function")f[p]=x();else f[p]=x;return f},z=(C)=>{let v=()=>C;return v.set=(f)=>{},v.update=(f)=>{},v},O=(C)=>{let v,f=!1;return()=>{if(!f)try{v=C(),f=!0}catch{v=void 0}return v}},L=(C)=>{},F=(C)=>C(),H=(C)=>{},V=(C)=>{},N=(C)=>{},R=()=>({params:{},query:{},path:"",name:"",fullPath:"",hash:"",matched:[]}),A=()=>({push:(C)=>{},replace:(C)=>{},back:()=>{},forward:()=>{},go:(C)=>{}}),w=(C)=>{K1(C);let v=Y.__stx_runtime_head||{},f=C||{};Y.__stx_runtime_head={...v,...f.title&&{title:f.title},meta:[...v.meta||[],...f.meta||[]],link:[...v.link||[],...f.link||[]],script:[...v.script||[],...f.script||[]],htmlAttrs:{...v.htmlAttrs||{},...f.htmlAttrs||{}},bodyAttrs:{...v.bodyAttrs||{},...f.bodyAttrs||{}}}},T=(C)=>{M5(C);let v=o1();Y.__stx_runtime_head={...Y.__stx_runtime_head||{},...v.title&&{title:v.title},meta:v.meta?[...v.meta]:[]}},I=(C)=>({value:C}),M=(C)=>C,E=(C)=>({value:typeof C==="function"?C():C}),D=(C,v)=>{},P=(C)=>{},y=(C)=>{},b=(C)=>C?C():Promise.resolve(),k=(C)=>(v,...f)=>{},g=(C)=>{},h=(C,v)=>{},n=(C,v)=>v,_0=()=>({value:"light"}),w0=()=>({value:!1}),q0={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},k0=new Proxy(q0,{get(C,v){if(v in C)return C[v];return},set(C,v,f){return C[v]=f,!0}}),y0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},O0=console;try{let C=Y$(X,Z),v=new Set(Object.keys(U)),f=Object.keys(Y).filter((t)=>!v.has(t)&&t!=="props"),p=f.map((t)=>Y[t]),x=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"]),d=[],K0=[];for(let[t,x9]of Object.entries(U)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t))continue;if(x.has(t))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${t}\\b`).test(C))continue;d.push(t),K0.push(x9)}let Z0=nX(C).map((t)=>`module.exports.${t} = typeof ${t} !== 'undefined' ? ${t} : module.exports.${t};`).join(`
1936
+ `),F0=Y.params??{},V1=[],d1=[];for(let t=0;t<f.length;t++){if(f[t]==="params")continue;V1.push(f[t]),d1.push(p[t])}let v9=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","provide","inject","useColorMode","useDark","window","document","console","confirm","alert","fetch","params",...d,...V1,`return (async () => {
1937
1937
  ${C}
1938
1938
  ${Z0}
1939
1939
  return module.exports
1940
- })()`)(Q,J,_,U,W,B,j,z,O,L,F,H,V,N,R,A,w,T,I,M,E,D,P,y,S,k,g,h,n,_0,w0,k0,y0,O0,q0.confirm,q0.alert,q0.fetch,F0,...K0,...h1);Object.assign(Y,v9);for(let[t,x9]of Object.entries(U))if(!(t in Y))Y[t]=x9}catch{try{await sX(X,Y,Z)}catch{}}}function Y$($,Y){let Z=Y?s1.dirname(Y):process.cwd(),X=$.split(`
1941
- `),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 _=J;_<X.length&&!q;_++){let U=null,W=!1,B=X[_];for(let j=0;j<B.length;j++){let z=B[j];if(W){W=!1;continue}if(z==="\\"){W=!0;continue}if(U){if(z===U)U=null;continue}if(z==='"'||z==="'"||z==="`"){U=z;continue}if(z==="(")K++;else if(z===")"){if(K--,K===0){J=_+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+['"](.+)['"]/),_=G.match(/^import\s+['"](.+)['"]/),U=(W)=>{if(W.startsWith("."))return s1.resolve(Z,W);return W};if(K){let[,W,B]=K,j=U(B);Q.push(`const ${W} = await import('${j}')`),Q.push(`module.exports.${W} = ${W};`)}else if(q){let[,W,B]=q,j=W.trim(),z=U(B);Q.push(`const { ${j} } = await import('${z}')`);for(let O of j.split(",")){let L=O.trim().split(/\s+as\s+/).pop()?.trim();if(L)Q.push(`module.exports.${L} = ${L};`)}}else if(_){let W=U(_[1]);Q.push(`await import('${W}')`)}else Q.push(G);J++;continue}if(G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var ")){let K=_3(X,J),{type:q,name:_,value:U}=K;Q.push(`${q} ${_} = ${U};`),Q.push(`module.exports.${_} = ${_};`),J=K.nextIndex}else if(G.startsWith("export function ")||G.startsWith("export async function ")){let K=$$(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=_3(X,J),{type:q,name:_,value:U}=K;Q.push(`${q} ${_} = ${U};`),Q.push(`module.exports.${_} = ${_};`),J=K.nextIndex}else if(G.startsWith("function ")||G.startsWith("async function ")){let K=$$(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 _=$$(q,J);if(Q.push(_.functionCode),_.name)Q.push(`module.exports.default = ${_.name};`);J=_.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],_=X[J].replace(/^export\s+/,""),U=0,W=J;for(;W<X.length;W++){let B=X[W];for(let j of B)if(j==="{")U++;else if(j==="}")U--;if(W>J)_+=`
1942
- `+B;if(U<=0&&W>=J)break}Q.push(_),Q.push(`module.exports.${q} = ${q};`),J=W+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 Q.join(`
1943
- `)}function O3($,Y){let Z=$[Y];if(Z!=="{"&&Z!=="[")return null;let Q=T0($,Z,Z==="{"?"}":"]",Y);if(Q===-1)return null;return{pattern:$.slice(Y,Q+1),endPos:Q+1}}function H3($){let Y=[],Z=$.slice(1,-1).trim();if(!Z)return Y;let X=0,Q=0,J="";while(X<Z.length){let G=Z[X];if(G==="{"||G==="["){if(Q++,Q===1){let K=O3(Z,X);if(K){let q=H3(K.pattern);Y.push(...q),X=K.endPos,J="";continue}}}else if(G==="}"||G==="]")Q--;if(Q>0){X++;continue}if(G===","){if(J.trim())Y.push(J.trim());J="",X++;continue}if(G===":"){J="",X++;continue}if(G==="="){if(J.trim())Y.push(J.trim());J="",X++;while(X<Z.length&&Z[X]!==","&&Q===0){if(Z[X]==="{"||Z[X]==="[")Q++;else if(Z[X]==="}"||Z[X]==="]")Q--;X++}continue}if(/[\w$]/.test(G))J+=G;X++}if(J.trim())Y.push(J.trim());return Y}function _3($,Y){let Z=$[Y].trim(),X=Z.match(/^(?:export\s+)?(const|let|var)\s+(\w+)\s*=\s*(.*)$/);if(!X){let _=Z.match(/^(?:export\s+)?(const|let|var)\s+/);if(_){let U=Z.slice(_[0].length),W=Y;if((U.startsWith("{")||U.startsWith("["))&&!U.includes(U.startsWith("{")?"}":"]")){let j=U.startsWith("{")?"}":"]",z=U;for(let O=Y+1;O<$.length;O++)if(z+=" "+$[O].trim(),W=O,$[O].includes(j))break;U=z}let B=O3(U,0);if(B){let j=_[1],z=B.pattern,O=U.slice(B.endPos).trim();if(O.startsWith("=")){let L=O.slice(1).trim(),F=L,H=Math.max(W,Y);if(W3(L)){let A=B3($,H,L);F=A.value,H=A.nextIndex}else H=H+1;F=F.trim().replace(/;$/,"");let V=H3(z),N=`__stx_src_${Y}`,R=V.map((A)=>`module.exports.${A} = ${A};`).join(`
1940
+ })()`)(Q,J,_,U,W,B,j,z,O,L,F,H,V,N,R,A,w,T,I,M,E,D,P,y,b,k,g,h,n,_0,w0,k0,y0,O0,q0.confirm,q0.alert,q0.fetch,F0,...K0,...d1);Object.assign(Y,v9);for(let[t,x9]of Object.entries(U))if(!(t in Y))Y[t]=x9}catch{try{await tX(X,Y,Z)}catch{}}}function Y$($,Y){let Z=Y?M1.dirname(Y):process.cwd(),X=$.split(`
1941
+ `),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 _=J;_<X.length&&!q;_++){let U=null,W=!1,B=X[_];for(let j=0;j<B.length;j++){let z=B[j];if(W){W=!1;continue}if(z==="\\"){W=!0;continue}if(U){if(z===U)U=null;continue}if(z==='"'||z==="'"||z==="`"){U=z;continue}if(z==="(")K++;else if(z===")"){if(K--,K===0){J=_+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+['"](.+)['"]/),_=G.match(/^import\s+['"](.+)['"]/),U=(W)=>{if(W.startsWith("."))return M1.resolve(Z,W);return W};if(K){let[,W,B]=K,j=U(B);Q.push(`const ${W} = await import('${j}')`),Q.push(`module.exports.${W} = ${W};`)}else if(q){let[,W,B]=q,j=W.trim(),z=U(B);Q.push(`const { ${j} } = await import('${z}')`);for(let O of j.split(",")){let L=O.trim().split(/\s+as\s+/).pop()?.trim();if(L)Q.push(`module.exports.${L} = ${L};`)}}else if(_){let W=U(_[1]);Q.push(`await import('${W}')`)}else Q.push(G);J++;continue}if(G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var ")){let K=_3(X,J),{type:q,name:_,value:U}=K;Q.push(`${q} ${_} = ${U};`),Q.push(`module.exports.${_} = ${_};`),J=K.nextIndex}else if(G.startsWith("export function ")||G.startsWith("export async function ")){let K=$$(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=_3(X,J),{type:q,name:_,value:U}=K;Q.push(`${q} ${_} = ${U};`),Q.push(`module.exports.${_} = ${_};`),J=K.nextIndex}else if(G.startsWith("function ")||G.startsWith("async function ")){let K=$$(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 _=$$(q,J);if(Q.push(_.functionCode),_.name)Q.push(`module.exports.default = ${_.name};`);J=_.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],_=X[J].replace(/^export\s+/,""),U=0,W=J;for(;W<X.length;W++){let B=X[W];for(let j of B)if(j==="{")U++;else if(j==="}")U--;if(W>J)_+=`
1942
+ `+B;if(U<=0&&W>=J)break}Q.push(_),Q.push(`module.exports.${q} = ${q};`),J=W+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 oX(Q.join(`
1943
+ `),Z)}function oX($,Y){let Z=$.length,X="",Q=0,J=null,G=!1,K=!1,q=0;while(Q<Z){let _=$[Q],U=$[Q+1];if(G){if(X+=_,_===`
1944
+ `)G=!1;Q++;continue}if(K){if(X+=_,_==="*"&&U==="/"){X+=U,Q+=2,K=!1;continue}Q++;continue}if(!J&&_==="/"&&U==="/"){G=!0,X+=_,Q++;continue}if(!J&&_==="/"&&U==="*"){K=!0,X+=_,Q++;continue}if(J){if(X+=_,_==="\\"){X+=U,Q+=2;continue}if(_===J&&J!=="`"){J=null,Q++;continue}if(J==="`"){if(_==="$"&&U==="{"){q++,X+=U,Q+=2;continue}if(_==="`"){J=null,Q++;continue}}Q++;continue}if(q>0){if(_==="{")q++;else if(_==="}")q--}if(_==='"'||_==="'"||_==="`"){J=_,X+=_,Q++;continue}if(_==="a"&&$.startsWith("await",Q)){let W=sX($,Q);if(W){let{quote:B,path:j,end:z}=W;if(j.startsWith(".")){let O=M1.resolve(Y,j);X+=`await import(${B}${O}${B})`,Q=z;continue}}}X+=_,Q++}return X}function sX($,Y){let Z=Y+5;if(Z>=$.length)return null;if(!/\s/.test($[Z]))return null;while(Z<$.length&&/\s/.test($[Z]))Z++;if(!$.startsWith("import",Z))return null;Z+=6;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let X=$[Z];if(X!=="'"&&X!=='"')return null;Z++;let Q=Z;while(Z<$.length&&$[Z]!==X)if($[Z]==="\\")Z+=2;else Z++;if(Z>=$.length)return null;let J=$.slice(Q,Z);Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return{quote:X,path:J,end:Z+1}}function O3($,Y){let Z=$[Y];if(Z!=="{"&&Z!=="[")return null;let Q=T0($,Z,Z==="{"?"}":"]",Y);if(Q===-1)return null;return{pattern:$.slice(Y,Q+1),endPos:Q+1}}function H3($){let Y=[],Z=$.slice(1,-1).trim();if(!Z)return Y;let X=0,Q=0,J="";while(X<Z.length){let G=Z[X];if(G==="{"||G==="["){if(Q++,Q===1){let K=O3(Z,X);if(K){let q=H3(K.pattern);Y.push(...q),X=K.endPos,J="";continue}}}else if(G==="}"||G==="]")Q--;if(Q>0){X++;continue}if(G===","){if(J.trim())Y.push(J.trim());J="",X++;continue}if(G===":"){J="",X++;continue}if(G==="="){if(J.trim())Y.push(J.trim());J="",X++;while(X<Z.length&&Z[X]!==","&&Q===0){if(Z[X]==="{"||Z[X]==="[")Q++;else if(Z[X]==="}"||Z[X]==="]")Q--;X++}continue}if(/[\w$]/.test(G))J+=G;X++}if(J.trim())Y.push(J.trim());return Y}function _3($,Y){let Z=$[Y].trim(),X=Z.match(/^(?:export\s+)?(const|let|var)\s+(\w+)\s*=\s*(.*)$/);if(!X){let _=Z.match(/^(?:export\s+)?(const|let|var)\s+/);if(_){let U=Z.slice(_[0].length),W=Y;if((U.startsWith("{")||U.startsWith("["))&&!U.includes(U.startsWith("{")?"}":"]")){let j=U.startsWith("{")?"}":"]",z=U;for(let O=Y+1;O<$.length;O++)if(z+=" "+$[O].trim(),W=O,$[O].includes(j))break;U=z}let B=O3(U,0);if(B){let j=_[1],z=B.pattern,O=U.slice(B.endPos).trim();if(O.startsWith("=")){let L=O.slice(1).trim(),F=L,H=Math.max(W,Y);if(W3(L)){let A=B3($,H,L);F=A.value,H=A.nextIndex}else H=H+1;F=F.trim().replace(/;$/,"");let V=H3(z),N=`__stx_src_${Y}`,R=V.map((A)=>`module.exports.${A} = ${A};`).join(`
1944
1945
  `);return{type:j,name:N,value:`${F}; ${j} ${z} = ${N};
1945
1946
  ${R}`,nextIndex:H}}}}throw Error(`Failed to parse variable declaration: ${Z}`)}let[,Q,J,G]=X,K=G,q=Y;if(W3(G)){let _=B3($,Y,G);K=_.value,q=_.nextIndex}else q=Y+1;while(q<$.length){let _=$[q].trim();if(_.startsWith(".")||_.startsWith("?."))K+=`
1946
- ${$[q]}`,q++;else break}return K=K.trim().replace(/;$/,""),{type:Q,name:J,value:K,nextIndex:q}}function $$($,Y){let Z=$[Y].trim(),X=Z.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!X)throw Error(`Failed to parse function declaration: ${Z}`);let[,Q]=X,J=Z.replace(/^export\s+/,""),G=Y;if(nX(Z)){let K=oX($,Y,J);J=K.functionCode,G=K.nextIndex}else G=Y+1;return{name:Q,functionCode:J,nextIndex:G}}function W3($){let Y=$.trim();if(Y.startsWith("{"))return T0(Y,"{","}",0)===-1;if(Y.startsWith("["))return T0(Y,"[","]",0)===-1;return!L3(Y)}function L3($){let Y={paren:0,bracket:0,brace:0},Z=null,X=0;for(let Q=0;Q<$.length;Q++){let J=$[Q];if((Q>0?$[Q-1]:"")==="\\"&&Z)continue;if((J==='"'||J==="'")&&!Z){Z=J;continue}if(J===Z&&Z!=="`"){Z=null;continue}if(J==="`"&&!Z){Z="`";continue}if(J==="`"&&Z==="`"&&X===0){Z=null;continue}if(Z==="`"&&J==="$"&&$[Q+1]==="{"){X++,Q++;continue}if(X>0&&J==="{"){X++;continue}if(X>0&&J==="}"){X--;continue}if(Z)continue;if(J==="(")Y.paren++;else if(J===")")Y.paren--;else if(J==="[")Y.bracket++;else if(J==="]")Y.bracket--;else if(J==="{")Y.brace++;else if(J==="}")Y.brace--}return Y.paren===0&&Y.bracket===0&&Y.brace===0&&Z===null}function nX($){let Y=$.indexOf("{");if(Y===-1)return!0;return T0($,"{","}",Y)===-1}function B3($,Y,Z){let X=Z,Q=Y+1;while(Q<$.length&&!L3(X)){let J=$[Q];X+=`
1947
+ ${$[q]}`,q++;else break}return K=K.trim().replace(/;$/,""),{type:Q,name:J,value:K,nextIndex:q}}function $$($,Y){let Z=$[Y].trim(),X=Z.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!X)throw Error(`Failed to parse function declaration: ${Z}`);let[,Q]=X,J=Z.replace(/^export\s+/,""),G=Y;if(rX(Z)){let K=aX($,Y,J);J=K.functionCode,G=K.nextIndex}else G=Y+1;return{name:Q,functionCode:J,nextIndex:G}}function W3($){let Y=$.trim();if(Y.startsWith("{"))return T0(Y,"{","}",0)===-1;if(Y.startsWith("["))return T0(Y,"[","]",0)===-1;return!L3(Y)}function L3($){let Y={paren:0,bracket:0,brace:0},Z=null,X=0;for(let Q=0;Q<$.length;Q++){let J=$[Q];if((Q>0?$[Q-1]:"")==="\\"&&Z)continue;if((J==='"'||J==="'")&&!Z){Z=J;continue}if(J===Z&&Z!=="`"){Z=null;continue}if(J==="`"&&!Z){Z="`";continue}if(J==="`"&&Z==="`"&&X===0){Z=null;continue}if(Z==="`"&&J==="$"&&$[Q+1]==="{"){X++,Q++;continue}if(X>0&&J==="{"){X++;continue}if(X>0&&J==="}"){X--;continue}if(Z)continue;if(J==="(")Y.paren++;else if(J===")")Y.paren--;else if(J==="[")Y.bracket++;else if(J==="]")Y.bracket--;else if(J==="{")Y.brace++;else if(J==="}")Y.brace--}return Y.paren===0&&Y.bracket===0&&Y.brace===0&&Z===null}function rX($){let Y=$.indexOf("{");if(Y===-1)return!0;return T0($,"{","}",Y)===-1}function B3($,Y,Z){let X=Z,Q=Y+1;while(Q<$.length&&!L3(X)){let J=$[Q];X+=`
1947
1948
  ${J}`,Q++}while(Q<$.length){let J=$[Q].trim();if(J.startsWith(".")||J.startsWith("?."))X+=`
1948
- ${$[Q]}`,Q++;else break}return{value:X,nextIndex:Q}}function oX($,Y,Z){let X=Z,Q=Y+1;while(Q<$.length){let J=X.indexOf("{");if(J!==-1){if(T0(X,"{","}",J)!==-1)break}let G=$[Q];X+=`
1949
- ${G}`,Q++}return{functionCode:X,nextIndex:Q}}async function sX($,Y,Z){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(/;$/,""),_=Function(`return ${q}`);Y[G]=_()}catch{try{let q=K.trim().replace(/;$/,""),_=Function(`return (${q})`);Y[G]=_()}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 Y))try{let q=K.trim().replace(/;$/,""),_=Function(`return ${q}`);Y[G]=_()}catch{}}try{let J=$.replace(/^export\s+/gm,""),K=Function(`
1949
+ ${$[Q]}`,Q++;else break}return{value:X,nextIndex:Q}}function aX($,Y,Z){let X=Z,Q=Y+1;while(Q<$.length){let J=X.indexOf("{");if(J!==-1){if(T0(X,"{","}",J)!==-1)break}let G=$[Q];X+=`
1950
+ ${G}`,Q++}return{functionCode:X,nextIndex:Q}}async function tX($,Y,Z){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(/;$/,""),_=Function(`return ${q}`);Y[G]=_()}catch{try{let q=K.trim().replace(/;$/,""),_=Function(`return (${q})`);Y[G]=_()}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 Y))try{let q=K.trim().replace(/;$/,""),_=Function(`return ${q}`);Y[G]=_()}catch{}}try{let J=$.replace(/^export\s+/gm,""),K=Function(`
1950
1951
  ${J}
1951
1952
  const result = {};
1952
1953
  ${Array.from($.matchAll(/(?:const|let|var)\s+(\w+)\s*=/g)).map((q)=>`if (typeof ${q[1]} !== 'undefined') result.${q[1]} = ${q[1]};`).join(`
1953
1954
  `)}
1954
1955
  return result;
1955
- `)();Object.entries(K).forEach(([q,_])=>{if(_!==void 0&&!(q in Y))Y[q]=_})}catch{}}function F3($){let Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Z=Y?Y[1]:"",X=Y?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Z,templateWithoutScript:X}}function V3($){let Y=$.trim();if(!Y)return!1;return/(?:const|let|var|function)\s+\w+/.test(Y)}var r1=b(()=>{o1();R1()});var T3={};r(T3,{renderSlot:()=>N3,processSlots:()=>w3,parseSlots:()=>R3,parseSlotElement:()=>aX,extractSlotContent:()=>$J,applySlots:()=>YJ});function rX($,Y){let Z=1,X=Y,Q="<template",J="</template";while(X<$.length&&Z>0){let G=$.indexOf("<",X);if(G===-1)break;if(X=G,$.startsWith(Q,X)&&(X+Q.length>=$.length||/[\s>\/]/.test($[X+Q.length]))){Z++,X+=Q.length;continue}if($.startsWith(J,X)){let K=$.indexOf(">",X+J.length);if(K!==-1){if(Z--,Z===0)return K+1;X=K+1;continue}}X++}return Z===0?X:-1}function R3($){let Y={default:"",named:new Map},Z=$,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,W,B,j,z]=J,O=W||B||j,L=J.index+U.length,F=rX($,L);if(F!==-1){let H=$.slice(L,F-11).trim();Q.push({start:J.index,end:F,slotName:O,content:H,propsBinding:z||void 0}),Y.named.set(O,{name:O,content:H,propsBinding:z||void 0})}}Q.sort((U,W)=>W.start-U.start);for(let U of Q)Z=Z.slice(0,U.start)+Z.slice(U.end);let G=[],K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,q;while((q=K.exec(Z))!==null){let[U,W,B,j,z,O]=q,L=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(L+F).trim(),V=`<${W}${H?" "+H:""}>${O}</${W}>`;G.push({start:q.index,end:q.index+U.length,slotName:j,element:V})}let _=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((q=_.exec(Z))!==null){let[U,W,B,j,z]=q,O=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=(O+L).trim(),H=`<${W}${F?" "+F:""} />`;G.push({start:q.index,end:q.index+U.length,slotName:j,element:H})}G.sort((U,W)=>W.start-U.start);for(let U of G){let W=Y.named.get(U.slotName);if(W)W.content+=U.element;else Y.named.set(U.slotName,{name:U.slotName,content:U.element});Z=Z.slice(0,U.start)+Z.slice(U.end)}return Y.default=Z.trim(),Y}function aX($){let Y=$.match(/name\s*=\s*["']([^"']+)["']/),Z=Y?Y[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:Z,props:X,defaultContent:K}}async function N3($,Y,Z,X){if(!$)return Z;let Q=$.content;if($.propsBinding&&Object.keys(Y).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]=q.split(":").map((B)=>B.trim()),W=U||_;if(Y[_]!==void 0)G[W]=Y[_]}}else G[J]=Y;Q=tX(Q,G)}return Q}function tX($,Y){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Z,X)=>{try{let Q=X.trim(),J=A3(Q,Y);return J1(String(J??""))}catch{return`{{ ${X} }}`}})}function A3($,Y){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let X=$.split("."),Q=Y;for(let J of X)if(Q&&typeof Q==="object"&&J in Q)Q=Q[J];else return;return Q}let Z=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Z){let[,X,Q,J]=Z,G=Y[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(!e($))return;return Y0($,Object.keys(Y))(...Object.values(Y))}catch{return}}async function w3($,Y,Z){let X=$;X=await eX(X,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,_)=>{let U=Y.named.get(K),W=_?.trim()||"",B=q||"",j={},z=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,O;while((O=z.exec(B))!==null){let L=O[1],F=O[2];j[L]=A3(F,Z)}return await N3(U,j,W,Z)});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 Y.default||q}),X}async function eX($,Y,Z){let X=[],Q=[];$.replace(Y,(K,...q)=>{let _=q[q.length-2];return Q.push({match:K,index:_}),X.push(Z(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:_}=Q[K];G=G.slice(0,_)+J[K]+G.slice(_+q.length)}return G}function $J($){let Y=R3($);return{defaultSlot:Y.default,namedSlots:Y.named}}async function YJ($,Y,Z,X){return await w3($,{default:Y,named:Z},X)}var M3=b(()=>{c0();V0()});import ZJ from"fs";import i from"path";function JJ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function QJ($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function Z1($){return!QJ($)}function X1($){try{let Y=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Y=Y.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Z=[];Y=Y.replace(/\{!![\s\S]*?!!\}/g,(J)=>{let G=Z.length;return Z.push(J),`"__STX_EXPR_${G}__"`}),Y=Y.replace(/\{\{\{[\s\S]*?\}\}\}/g,(J)=>{let G=Z.length;return Z.push(J),`"__STX_EXPR_${G}__"`}),Y=Y.replace(/\{\{[\s\S]*?\}\}/g,(J)=>{let G=Z.length;return Z.push(J),`"__STX_EXPR_${G}__"`});let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:P0()}).transformSync(Y);for(let J=0;J<Z.length;J++)Q=Q.replace(`"__STX_EXPR_${J}__"`,Z[J]),Q=Q.replace(`'__STX_EXPR_${J}__'`,Z[J]);return Q}catch(Y){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Y);return $}}function GJ($){let Y=[],Z=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++;else if($[Q]==="}")U--;else if($[Q]==="'"||$[Q]==='"')G($[Q]);else if($[Q]==="`")K();else Q++;continue}Q++}},q=()=>{if($[Q]==="/"&&$[Q+1]==="/"){while(Q<J&&$[Q]!==`
1956
- `)Q++;return!0}if($[Q]==="/"&&$[Q+1]==="*"){Q+=2;while(Q<J-1&&!($[Q]==="*"&&$[Q+1]==="/"))Q++;return Q+=2,!0}return!1},_=()=>{if(X!==0)return;let U=$.slice(Q).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let z=U[2].split(",").map((O)=>{let L=O.trim().split(":");return L[L.length-1].trim()});for(let O of z)if(O&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(O)&&!Z.has(O))Y.push(O),Z.add(O);return}let W=$.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(W){let z=W[2];if(!Z.has(z))Y.push(z),Z.add(z);return}let B=$.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let z=B[1];if(!Z.has(z))Y.push(z),Z.add(z);return}let j=$.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let z=j[1];if(!Z.has(z))Y.push(z),Z.add(z)}};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])))_();Q++}return Y}async function q1($,Y,Z,X,Q,J,G,K=new Set,q){let{extractVariables:_}=await Promise.resolve().then(() => (r1(),I5)),U=K??new Set;if(U.has($))return`[Circular component reference: ${$}]`;let W=new Set(U);W.add($);try{let B=(C)=>C.split("-").map((v)=>v.charAt(0).toUpperCase()+v.slice(1)).join(""),j=(C)=>C.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),z=$.endsWith(".stx")?$.slice(0,-4):$,O=null,L=Q.__importedComponents;if(L){let C=[z,z.toLowerCase(),B(z),j(z)];for(let v of C)if(L.has(v)){O=L.get(v);break}}let F=[];if(!O){let C=[`${z}.stx`,`${B(z)}.stx`,`${j(z)}.stx`],v=[...new Set(C)],f=Q.__originalFilePath,p=[];if(f){let a=i.join(i.dirname(f),"components");p.push(a)}if(X)p.push(X);let x=i.join(i.dirname(J),"components");if(!p.includes(x))p.push(x);if(G.componentsDir&&G.componentsDir!==X&&!p.includes(G.componentsDir))p.push(G.componentsDir);let d=process.cwd(),K0=[i.resolve(d,"src/components"),i.resolve(d,"components"),i.resolve(import.meta.dir,"components")];for(let a of K0)if(!p.includes(a))p.push(a);if(z.startsWith("./")||z.startsWith("../"))O=i.resolve(i.dirname(J),`${z}.stx`),F.push(O);else for(let a of p){if(!a)continue;for(let Z0 of v){let F0=i.join(a,Z0);if(F.push(F0),await c(F0)){O=F0;break}}if(O)break;if(!O)try{let Z0=await import("fs");if(!Z0.statSync(a,{throwIfNoEntry:!1})?.isDirectory())continue;let F1=Z0.readdirSync(a,{withFileTypes:!0});for(let h1 of F1)if(h1.isDirectory()){let q7=i.join(a,h1.name);for(let v9 of v){let t=i.join(q7,v9);if(F.push(t),await c(t)){O=t;break}}if(O)break}}catch{}if(O)break}}if(!O||!await c(O)){let C=F.length>0?`
1956
+ `)();Object.entries(K).forEach(([q,_])=>{if(_!==void 0&&!(q in Y))Y[q]=_})}catch{}}function F3($){let Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Z=Y?Y[1]:"",X=Y?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Z,templateWithoutScript:X}}function V3($){let Y=$.trim();if(!Y)return!1;return/(?:const|let|var|function)\s+\w+/.test(Y)}var r1=S(()=>{s1();N1()});var T3={};r(T3,{renderSlot:()=>N3,processSlots:()=>w3,parseSlots:()=>R3,parseSlotElement:()=>$J,extractSlotContent:()=>XJ,applySlots:()=>JJ});function eX($,Y){let Z=1,X=Y,Q="<template",J="</template";while(X<$.length&&Z>0){let G=$.indexOf("<",X);if(G===-1)break;if(X=G,$.startsWith(Q,X)&&(X+Q.length>=$.length||/[\s>\/]/.test($[X+Q.length]))){Z++,X+=Q.length;continue}if($.startsWith(J,X)){let K=$.indexOf(">",X+J.length);if(K!==-1){if(Z--,Z===0)return K+1;X=K+1;continue}}X++}return Z===0?X:-1}function R3($){let Y={default:"",named:new Map},Z=$,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,W,B,j,z]=J,O=W||B||j,L=J.index+U.length,F=eX($,L);if(F!==-1){let H=$.slice(L,F-11).trim();Q.push({start:J.index,end:F,slotName:O,content:H,propsBinding:z||void 0}),Y.named.set(O,{name:O,content:H,propsBinding:z||void 0})}}Q.sort((U,W)=>W.start-U.start);for(let U of Q)Z=Z.slice(0,U.start)+Z.slice(U.end);let G=[],K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,q;while((q=K.exec(Z))!==null){let[U,W,B,j,z,O]=q,L=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(L+F).trim(),V=`<${W}${H?" "+H:""}>${O}</${W}>`;G.push({start:q.index,end:q.index+U.length,slotName:j,element:V})}let _=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((q=_.exec(Z))!==null){let[U,W,B,j,z]=q,O=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=(O+L).trim(),H=`<${W}${F?" "+F:""} />`;G.push({start:q.index,end:q.index+U.length,slotName:j,element:H})}G.sort((U,W)=>W.start-U.start);for(let U of G){let W=Y.named.get(U.slotName);if(W)W.content+=U.element;else Y.named.set(U.slotName,{name:U.slotName,content:U.element});Z=Z.slice(0,U.start)+Z.slice(U.end)}return Y.default=Z.trim(),Y}function $J($){let Y=$.match(/name\s*=\s*["']([^"']+)["']/),Z=Y?Y[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:Z,props:X,defaultContent:K}}async function N3($,Y,Z,X){if(!$)return Z;let Q=$.content;if($.propsBinding&&Object.keys(Y).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]=q.split(":").map((B)=>B.trim()),W=U||_;if(Y[_]!==void 0)G[W]=Y[_]}}else G[J]=Y;Q=YJ(Q,G)}return Q}function YJ($,Y){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Z,X)=>{try{let Q=X.trim(),J=A3(Q,Y);return Q1(String(J??""))}catch{return`{{ ${X} }}`}})}function A3($,Y){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let X=$.split("."),Q=Y;for(let J of X)if(Q&&typeof Q==="object"&&J in Q)Q=Q[J];else return;return Q}let Z=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Z){let[,X,Q,J]=Z,G=Y[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(!e($))return;return Y0($,Object.keys(Y))(...Object.values(Y))}catch{return}}async function w3($,Y,Z){let X=$;X=await ZJ(X,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,_)=>{let U=Y.named.get(K),W=_?.trim()||"",B=q||"",j={},z=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,O;while((O=z.exec(B))!==null){let L=O[1],F=O[2];j[L]=A3(F,Z)}return await N3(U,j,W,Z)});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 Y.default||q}),X}async function ZJ($,Y,Z){let X=[],Q=[];$.replace(Y,(K,...q)=>{let _=q[q.length-2];return Q.push({match:K,index:_}),X.push(Z(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:_}=Q[K];G=G.slice(0,_)+J[K]+G.slice(_+q.length)}return G}function XJ($){let Y=R3($);return{defaultSlot:Y.default,namedSlots:Y.named}}async function JJ($,Y,Z,X){return await w3($,{default:Y,named:Z},X)}var M3=S(()=>{i0();V0()});import QJ from"fs";import i from"path";function KJ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function qJ($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function X1($){return!qJ($)}function J1($){try{let Y=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Y=Y.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Z=[];Y=Y.replace(/\{!![\s\S]*?!!\}/g,(J)=>{let G=Z.length;return Z.push(J),`"__STX_EXPR_${G}__"`}),Y=Y.replace(/\{\{\{[\s\S]*?\}\}\}/g,(J)=>{let G=Z.length;return Z.push(J),`"__STX_EXPR_${G}__"`}),Y=Y.replace(/\{\{[\s\S]*?\}\}/g,(J)=>{let G=Z.length;return Z.push(J),`"__STX_EXPR_${G}__"`});let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:P0()}).transformSync(Y);for(let J=0;J<Z.length;J++)Q=Q.replace(`"__STX_EXPR_${J}__"`,Z[J]),Q=Q.replace(`'__STX_EXPR_${J}__'`,Z[J]);return Q}catch(Y){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Y);return $}}function UJ($){let Y=[],Z=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++;else if($[Q]==="}")U--;else if($[Q]==="'"||$[Q]==='"')G($[Q]);else if($[Q]==="`")K();else Q++;continue}Q++}},q=()=>{if($[Q]==="/"&&$[Q+1]==="/"){while(Q<J&&$[Q]!==`
1957
+ `)Q++;return!0}if($[Q]==="/"&&$[Q+1]==="*"){Q+=2;while(Q<J-1&&!($[Q]==="*"&&$[Q+1]==="/"))Q++;return Q+=2,!0}return!1},_=()=>{if(X!==0)return;let U=$.slice(Q).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let z=U[2].split(",").map((O)=>{let L=O.trim().split(":");return L[L.length-1].trim()});for(let O of z)if(O&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(O)&&!Z.has(O))Y.push(O),Z.add(O);return}let W=$.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(W){let z=W[2];if(!Z.has(z))Y.push(z),Z.add(z);return}let B=$.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let z=B[1];if(!Z.has(z))Y.push(z),Z.add(z);return}let j=$.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let z=j[1];if(!Z.has(z))Y.push(z),Z.add(z)}};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])))_();Q++}return Y}async function q1($,Y,Z,X,Q,J,G,K=new Set,q){let{extractVariables:_}=await Promise.resolve().then(() => (r1(),I5)),U=K??new Set;if(U.has($))return`[Circular component reference: ${$}]`;let W=new Set(U);W.add($);try{let B=(C)=>C.split("-").map((v)=>v.charAt(0).toUpperCase()+v.slice(1)).join(""),j=(C)=>C.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),z=$.endsWith(".stx")?$.slice(0,-4):$,O=null,L=Q.__importedComponents;if(L){let C=[z,z.toLowerCase(),B(z),j(z)];for(let v of C)if(L.has(v)){O=L.get(v);break}}let F=[];if(!O){let C=[`${z}.stx`,`${B(z)}.stx`,`${j(z)}.stx`],v=[...new Set(C)],f=Q.__originalFilePath,p=[];if(f){let a=i.join(i.dirname(f),"components");p.push(a)}if(X)p.push(X);let x=i.join(i.dirname(J),"components");if(!p.includes(x))p.push(x);if(G.componentsDir&&G.componentsDir!==X&&!p.includes(G.componentsDir))p.push(G.componentsDir);let d=process.cwd(),K0=[i.resolve(d,"src/components"),i.resolve(d,"components"),i.resolve(import.meta.dir,"components")];for(let a of K0)if(!p.includes(a))p.push(a);if(z.startsWith("./")||z.startsWith("../"))O=i.resolve(i.dirname(J),`${z}.stx`),F.push(O);else for(let a of p){if(!a)continue;for(let Z0 of v){let F0=i.join(a,Z0);if(F.push(F0),await c(F0)){O=F0;break}}if(O)break;if(!O)try{let Z0=await import("fs");if(!Z0.statSync(a,{throwIfNoEntry:!1})?.isDirectory())continue;let V1=Z0.readdirSync(a,{withFileTypes:!0});for(let d1 of V1)if(d1.isDirectory()){let q7=i.join(a,d1.name);for(let v9 of v){let t=i.join(q7,v9);if(F.push(t),await c(t)){O=t;break}}if(O)break}}catch{}if(O)break}}if(!O||!await c(O)){let C=F.length>0?`
1957
1958
  Searched paths:
1958
1959
  ${F.map((v)=>` - ${v}`).join(`
1959
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${C}`}q.add(O);let H;if(Z$.has(O))H=Z$.get(O);else try{H=await Bun.file(O).text(),Z$.set(O,H)}catch(C){return`[Error loading component: ${C instanceof Error?C.message:String(C)}]`}let V=new Set(["__originalFilePath","__importedComponents"]),N={};for(let[C,v]of Object.entries(Q))if(!C.startsWith("__")||V.has(C))N[C]=v;let R={...N,...Y,props:Y,slot:Z,__processedComponents:W,__sections:{}},A=H,w=A.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(w)A=w[1].trim();let T=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,I=[...H.matchAll(T)],M=[];for(let C of I){let v=C[1]||"",f=C[2]||"",p=v.includes("server");if(Z1(v)&&f.trim())f=X1(f);if(p&&f)try{await _(f,R,O)}catch(d){}if(!p){let d=f.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),K0=v.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");M.push(`<script${K0}>${d}</script>`)}}let E=H.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),D=E?E[1]:"",P=E?E[2]:"",y="",S=D&&/\bscoped\b/i.test(D);if(E)y=`<style${D}>${P}</style>`;let k=A;if(k=k.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),E)k=k.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");if(Z&&k.includes("{{ text || slot }}"))k=k.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Z);let{extractSlotContent:g,applySlots:h}=await Promise.resolve().then(() => (M3(),T3)),{defaultSlot:n,namedSlots:_0}=g(Z);k=await h(k,n||Z,_0,R);for(let[C,v]of Object.entries(R))if(typeof v==="string"){if(v.includes("<")&&v.includes(">")||v.includes("&lt;")||v.includes("&quot;")){let f=s9(v);R[C]=f}}let w0=M.some((C)=>/\b(state|derived|effect)\s*\(/.test(C)),q0={...G,componentsDir:i.dirname(O),skipSignalsRuntime:!0,skipEventDirectives:w0,defaultLayout:void 0};R.__stxProcessingDepth=(Q.__stxProcessingDepth||0)+1;let k0=await E5(k,R,O,q0,q),y0=`stx_${z.replace(/[^a-zA-Z0-9]/g,"_")}_${++XJ}_${Math.random().toString(36).slice(2,8)}`,O0=k0;if(w0){let C="";if(Object.keys(Y).length>0)try{C=` data-stx-props="${JJ(JSON.stringify(Y))}"`}catch{}if(O0=`<div data-stx-scope="${y0}"${C}>${k0}</div>`,O0=M.map((f)=>{let p=f.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!p)return f;let[,x,d]=p,K0=p0(d),a=`
1960
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${C}`}q.add(O);let H;if(Z$.has(O))H=Z$.get(O);else try{H=await Bun.file(O).text(),Z$.set(O,H)}catch(C){return`[Error loading component: ${C instanceof Error?C.message:String(C)}]`}let V=new Set(["__originalFilePath","__importedComponents"]),N={};for(let[C,v]of Object.entries(Q))if(!C.startsWith("__")||V.has(C))N[C]=v;let R={...N,...Y,props:Y,slot:Z,__processedComponents:W,__sections:{}},A=H,w=A.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(w)A=w[1].trim();let T=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,I=[...H.matchAll(T)],M=[];for(let C of I){let v=C[1]||"",f=C[2]||"",p=v.includes("server");if(X1(v)&&f.trim())f=J1(f);if(p&&f)try{await _(f,R,O)}catch(d){}if(!p){let d=f.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),K0=v.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");M.push(`<script${K0}>${d}</script>`)}}let E=H.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),D=E?E[1]:"",P=E?E[2]:"",y="",b=D&&/\bscoped\b/i.test(D);if(E)y=`<style${D}>${P}</style>`;let k=A;if(k=k.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),E)k=k.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");if(Z&&k.includes("{{ text || slot }}"))k=k.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Z);let{extractSlotContent:g,applySlots:h}=await Promise.resolve().then(() => (M3(),T3)),{defaultSlot:n,namedSlots:_0}=g(Z);k=await h(k,n||Z,_0,R);for(let[C,v]of Object.entries(R))if(typeof v==="string"){if(v.includes("<")&&v.includes(">")||v.includes("&lt;")||v.includes("&quot;")){let f=s9(v);R[C]=f}}let w0=M.some((C)=>/\b(state|derived|effect)\s*\(/.test(C)),q0={...G,componentsDir:i.dirname(O),skipSignalsRuntime:!0,skipEventDirectives:w0,defaultLayout:void 0};R.__stxProcessingDepth=(Q.__stxProcessingDepth||0)+1;let k0=await E5(k,R,O,q0,q),y0=`stx_${z.replace(/[^a-zA-Z0-9]/g,"_")}_${++GJ}_${Math.random().toString(36).slice(2,8)}`,O0=k0;if(w0){let C="";if(Object.keys(Y).length>0)try{C=` data-stx-props="${KJ(JSON.stringify(Y))}"`}catch{}if(O0=`<div data-stx-scope="${y0}"${C}>${k0}</div>`,O0=M.map((f)=>{let p=f.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!p)return f;let[,x,d]=p,K0=p0(d),a=`
1960
1961
  (function() {
1961
1962
  const { state, derived, effect, batch } = window.stx;
1962
1963
  const __scope = window.stx._scopes = window.stx._scopes || {};
@@ -1973,7 +1974,7 @@ ${K0}
1973
1974
  // Register all defined signals and functions in this scope
1974
1975
  const __localVars = {};
1975
1976
  try {
1976
- ${GJ(K0).map((Z0)=>`if (typeof ${Z0} !== 'undefined') __localVars['${Z0}'] = ${Z0};`).join(`
1977
+ ${UJ(K0).map((Z0)=>`if (typeof ${Z0} !== 'undefined') __localVars['${Z0}'] = ${Z0};`).join(`
1977
1978
  `)}
1978
1979
  }
1979
1980
  catch (e) {}
@@ -1984,7 +1985,7 @@ catch (e) {}
1984
1985
  `+y}else{if(y)O0+=`
1985
1986
  `+y;if(M.length>0){let C=R.__stx_event_bindings||[],v=await Promise.all(M.map(async(f)=>{let p=f.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!p)return f;return await V5(p[1],{eventBindings:C,templateContent:O0,filePath:O,projectRoot:process.cwd()})}));O0+=`
1986
1987
  `+v.join(`
1987
- `),R.__stx_event_bindings=[]}}if(S){let C=w5(O0,O);if(C.hasScoped)O0=C.html}return O0}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{U.delete($)}}async function c($){return Bun.file($).exists()}function I3($,Y){let Z=i.resolve(Y),X=i.resolve($),Q=Z.endsWith(i.sep)?Z:Z+i.sep;if(X===Z||X.startsWith(Q))return X;return null}async function X$($,Y,Z,X){let Q=await KJ($,Y,Z,X);if(Q===null)return null;let J=I3(Q,process.cwd());if(!J)return console.warn(`[stx] rejected resolved template path that escapes project root: ${Q} (template: ${$}, from: ${Y})`),null;return J}async function KJ($,Y,Z,X){if(Z.debug)console.log(`Resolving template path: ${$} from ${Y}`);let Q=i.dirname(Y),J=process.cwd();if($.startsWith("/")){let B=i.join(J,$),j=I3(B,J);if(!j)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Y})`),null;if(Z.debug)console.log(`Checking absolute path: ${j}`);if(await c(j)&&X)X.add(j);return j}let G=i.join(Q,$);if(await c(G)){if(Z.debug)console.log(`Found direct path: ${G}`);if(X)X.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let B of[".stx",".tsx",".jsx"]){let j=`${G}${B}`;if(await c(j)){if(Z.debug)console.log(`Found direct path with extension: ${j}`);if(X)X.add(j);return j}}let K="",q=i.resolve(Q),_=process.cwd();for(let B=0;B<10;B++){let j=i.join(q,"layouts"),z=!1;try{z=ZJ.statSync(j,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(z){K=j;break}let O=i.dirname(q);if(O===q||O.length<_.length)break;q=O}if(K){let B=$.startsWith("layouts/")?$.slice(8):$,j=i.join(K,B);if(await c(j)){if(Z.debug)console.log(`Found in current layouts dir: ${j}`);if(X)X.add(j);return j}if(!B.endsWith(".stx")){let z=`${j}.stx`;if(await c(z)){if(Z.debug)console.log(`Found in current layouts dir with extension: ${z}`);if(X)X.add(z);return z}}}if(Z.layoutsDir){let B=i.isAbsolute(Z.layoutsDir)?Z.layoutsDir:i.resolve(process.cwd(),Z.layoutsDir),j=$.startsWith("layouts/")?$.slice(8):$,z=i.join(B,j);if(await c(z)){if(Z.debug)console.log(`Found in options.layoutsDir: ${z}`);if(X)X.add(z);return z}if(!$.endsWith(".stx")){let O=`${z}.stx`;if(await c(O)){if(Z.debug)console.log(`Found in options.layoutsDir with extension: ${O}`);if(X)X.add(O);return O}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let B=$.split("layouts/"),j=i.join(Z.partialsDir||Q,"layouts",B[1]);if(await c(j)){if(Z.debug)console.log(`Found in layouts path: ${j}`);if(X)X.add(j);return j}if(!j.endsWith(".stx")){let z=`${j}.stx`;if(await c(z)){if(Z.debug)console.log(`Found in layouts path with extension: ${z}`);if(X)X.add(z);return z}}}if(Z.partialsDir){if(K=i.join(Z.partialsDir,"layouts"),await c(K)){let B=i.join(K,$);if(await c(B)){if(Z.debug)console.log(`Found in partials layouts dir: ${B}`);if(X)X.add(B);return B}if(!$.endsWith(".stx")){let j=`${B}.stx`;if(await c(j)){if(Z.debug)console.log(`Found in partials layouts dir with extension: ${j}`);if(X)X.add(j);return j}}}}let U=Z.partialsDir||i.join(process.cwd(),"views"),W=i.join(U,$);if(await c(W)){if(Z.debug)console.log(`Found in views path: ${W}`);if(X)X.add(W);return W}if(!$.endsWith(".stx")){let B=`${W}.stx`;if(await c(B)){if(Z.debug)console.log(`Found in views path with extension: ${B}`);if(X)X.add(B);return B}}if(Q.includes("temp")){let B=i.join(i.dirname(Q),"layouts",$);if(await c(B)){if(Z.debug)console.log(`Found in temp layouts dir: ${B}`);if(X)X.add(B);return B}if(!$.endsWith(".stx")){let j=`${B}.stx`;if(await c(j)){if(Z.debug)console.log(`Found in temp layouts dir with extension: ${j}`);if(X)X.add(j);return j}}}if(Z.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Y})`);else console.warn(`Template not found: ${$} (referenced from ${Y})`);return null}function E3($,Y,Z){let X=0,Q="",J="";try{if(typeof Y==="number"&&Y>=0){let G=$.split(`
1988
+ `),R.__stx_event_bindings=[]}}if(b){let C=w5(O0,O);if(C.hasScoped)O0=C.html}return O0}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{U.delete($)}}async function c($){return Bun.file($).exists()}function I3($,Y){let Z=i.resolve(Y),X=i.resolve($),Q=Z.endsWith(i.sep)?Z:Z+i.sep;if(X===Z||X.startsWith(Q))return X;return null}async function X$($,Y,Z,X){let Q=await _J($,Y,Z,X);if(Q===null)return null;let J=I3(Q,process.cwd());if(!J)return console.warn(`[stx] rejected resolved template path that escapes project root: ${Q} (template: ${$}, from: ${Y})`),null;return J}async function _J($,Y,Z,X){if(Z.debug)console.log(`Resolving template path: ${$} from ${Y}`);let Q=i.dirname(Y),J=process.cwd();if($.startsWith("/")){let B=i.join(J,$),j=I3(B,J);if(!j)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Y})`),null;if(Z.debug)console.log(`Checking absolute path: ${j}`);if(await c(j)&&X)X.add(j);return j}let G=i.join(Q,$);if(await c(G)){if(Z.debug)console.log(`Found direct path: ${G}`);if(X)X.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let B of[".stx",".tsx",".jsx"]){let j=`${G}${B}`;if(await c(j)){if(Z.debug)console.log(`Found direct path with extension: ${j}`);if(X)X.add(j);return j}}let K="",q=i.resolve(Q),_=process.cwd();for(let B=0;B<10;B++){let j=i.join(q,"layouts"),z=!1;try{z=QJ.statSync(j,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(z){K=j;break}let O=i.dirname(q);if(O===q||O.length<_.length)break;q=O}if(K){let B=$.startsWith("layouts/")?$.slice(8):$,j=i.join(K,B);if(await c(j)){if(Z.debug)console.log(`Found in current layouts dir: ${j}`);if(X)X.add(j);return j}if(!B.endsWith(".stx")){let z=`${j}.stx`;if(await c(z)){if(Z.debug)console.log(`Found in current layouts dir with extension: ${z}`);if(X)X.add(z);return z}}}if(Z.layoutsDir){let B=i.isAbsolute(Z.layoutsDir)?Z.layoutsDir:i.resolve(process.cwd(),Z.layoutsDir),j=$.startsWith("layouts/")?$.slice(8):$,z=i.join(B,j);if(await c(z)){if(Z.debug)console.log(`Found in options.layoutsDir: ${z}`);if(X)X.add(z);return z}if(!$.endsWith(".stx")){let O=`${z}.stx`;if(await c(O)){if(Z.debug)console.log(`Found in options.layoutsDir with extension: ${O}`);if(X)X.add(O);return O}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let B=$.split("layouts/"),j=i.join(Z.partialsDir||Q,"layouts",B[1]);if(await c(j)){if(Z.debug)console.log(`Found in layouts path: ${j}`);if(X)X.add(j);return j}if(!j.endsWith(".stx")){let z=`${j}.stx`;if(await c(z)){if(Z.debug)console.log(`Found in layouts path with extension: ${z}`);if(X)X.add(z);return z}}}if(Z.partialsDir){if(K=i.join(Z.partialsDir,"layouts"),await c(K)){let B=i.join(K,$);if(await c(B)){if(Z.debug)console.log(`Found in partials layouts dir: ${B}`);if(X)X.add(B);return B}if(!$.endsWith(".stx")){let j=`${B}.stx`;if(await c(j)){if(Z.debug)console.log(`Found in partials layouts dir with extension: ${j}`);if(X)X.add(j);return j}}}}let U=Z.partialsDir||i.join(process.cwd(),"views"),W=i.join(U,$);if(await c(W)){if(Z.debug)console.log(`Found in views path: ${W}`);if(X)X.add(W);return W}if(!$.endsWith(".stx")){let B=`${W}.stx`;if(await c(B)){if(Z.debug)console.log(`Found in views path with extension: ${B}`);if(X)X.add(B);return B}}if(Q.includes("temp")){let B=i.join(i.dirname(Q),"layouts",$);if(await c(B)){if(Z.debug)console.log(`Found in temp layouts dir: ${B}`);if(X)X.add(B);return B}if(!$.endsWith(".stx")){let j=`${B}.stx`;if(await c(j)){if(Z.debug)console.log(`Found in temp layouts dir with extension: ${j}`);if(X)X.add(j);return j}}}if(Z.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Y})`);else console.warn(`Template not found: ${$} (referenced from ${Y})`);return null}function E3($,Y,Z){let X=0,Q="",J="";try{if(typeof Y==="number"&&Y>=0){let G=$.split(`
1988
1989
  `),K=0;for(let q=0;q<G.length;q++)if(K+=G[q].length+1,K>=Y){X=q+1,Q=G[q].trim();let _=Math.max(0,q-2),U=Math.min(G.length,q+3);J=G.slice(_,U).map((W,B)=>{let j=_+B+1;return`${j===X?"> ":" "}${j}: ${W}`}).join(`
1989
1990
  `);break}}else if(Z){let G=$.indexOf(Z);if(G>=0)return E3($,G)}}catch{}return{lineNumber:X,lineContent:Q,context:J}}function J0($,Y,Z,X,Q,J){let{lineNumber:G,context:K}=E3(X,Q,J),q=Z.split("/").pop(),_=0;if(typeof Q==="number"&&Q>=0&&X){let W=X.lastIndexOf(`
1990
1991
  `,Math.max(0,Q-1));_=Q-(W+1)+1}let U="";if(G>0)U+=`
@@ -1999,8 +2000,8 @@ ${o.yellow}${o.bold}Message:${o.reset} ${Y}
1999
2000
  `,K)U+=`
2000
2001
  ${o.blue}${o.bold}Context:${o.reset}
2001
2002
  ${o.dim}${K}${o.reset}
2002
- `;return U}var Z$,XJ=0,o;var H0=b(()=>{n9();c0();w1();J$();R1();t9();U3();r1();Z$=new i1(500);o={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 D3($,Y,Z=""){let X=$,Q=[],J=/@markdown(?:\([^)]*\))?/g,G;while((G=J.exec($))!==null){let K=G.index,q=G[0].match(/@markdown\(([^)]*)\)/),_=q?q[1]:"",U=K+G[0].length,W=1,B=U,j=-1;while(W>0&&B<$.length){let L=$.indexOf("@markdown",B),F=$.indexOf("@endmarkdown",B);if(F===-1)break;if(L!==-1&&L<F&&L!==K){let H=$[L+9];if(H==="("||H===`
2003
- `||H==="\r"||H===" "||H===void 0)W++;B=L+9}else{if(W--,W===0){j=F;break}B=F+12}}if(j===-1)continue;let z=$.slice(U,j),O=$.slice(K,j+12);Q.push({fullMatch:O,options:_,content:z,index:K}),J.lastIndex=j+12}for(let{fullMatch:K,options:q,content:_,index:U}of Q)try{let W={};if(q)q.split(",").forEach((z)=>{let O=z.trim();if(O)W[O]=!0});let B={gfm:W.gfm??!0,breaks:W.breaks??!1},j=u1(_.trim(),B);X=X.split(K).join(j)}catch(W){let B=W instanceof Error?W.message:String(W),j=J0("Markdown Directive",`Error processing markdown: ${B}`,Z,$,U,K);X=X.split(K).join(j)}return X}async function k3($,Y,Z,X){let Q={gfm:!0,breaks:!1};return Y.forEach((J)=>{let G=J.trim().replace(/['"]/g,"");if(G==="breaks")Q.breaks=!0;if(G==="no-gfm")Q.gfm=!1}),u1($.trim(),Q)}var Q$=b(()=>{H0()});function _J($){if(qJ.set($.name,$),$.client)UJ.set($.name,$.client)}function D5($){return _J($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Z,X,Q,J)=>{let G=WJ(X,$.defaults);if($.validate){let q=$.validate(G);if(q!==!0){let _=typeof q==="string"?q:`Invalid parameters for @${$.name}`;throw Error(_)}}let K=Z;if($.transform)K=await $.transform(Z,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 WJ($,Y){let Z={...Y};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{}Z[K]=q}else{let K=Object.keys(Z).filter((q)=>!Y||!(q in Y)).length;Z[K===0?"value":`arg${K}`]=X}}return Z}var qJ,UJ;var G$=b(()=>{qJ=new Map,UJ=new Map});function K$($,Y=T1,Z={},X){return Y.sort((Q,J)=>Q-J).map((Q)=>{return`${t1($,{...Z,w:Q,fm:X})} ${Q}w`}).join(", ")}function S3($,Y,Z=BJ,X={},Q){return Z.sort((J,G)=>J-G).map((J)=>{let G=Math.round(Y*J);return`${t1($,{...X,w:G,dpr:J,fm:Q})} ${J}x`}).join(", ")}function q$($,Y="100vw"){if(!$||Object.keys($).length===0)return Y;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(Y),X.join(", ")}function t1($,Y={}){let Z=Object.entries(Y).filter(([,J])=>J!==void 0&&J!==null).map(([J,G])=>{if(Array.isArray(G))return[J,G.join(",")];return[J,String(G)]});if(Z.length===0)return $;let X=Z.map(([J,G])=>`${J}=${encodeURIComponent(G)}`).join("&"),Q=$.includes("?")?"&":"?";return`${$}${Q}${X}`}function U$($){return zJ[$]||"application/octet-stream"}var T1,BJ,a1,zJ;var _$=b(()=>{T1=[320,480,640,768,1024,1280,1536,1920,2560],BJ=[1,1.5,2,3],a1=["avif","webp","jpeg"],zJ={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function OJ(){try{return await import("ts-images")}catch{return null}}async function HJ($,Y={}){let Z={...jJ,...Y},X=await OJ();if(X)try{return await LJ($,Z,X)}catch(Q){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Q}`)}return FJ($,Z)}async function LJ($,Y,Z){let{generatePlaceholder:X,generateThumbHash:Q}=Z,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Y.strategy]||"blur";if(Y.strategy==="thumbhash")return{dataURL:(await Q($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await X($,{width:Y.width,height:Y.height,quality:Y.quality,blurLevel:Y.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:Y.strategy,dominantColor:K.dominantColor,css:K.css}}function FJ($,Y){let Z=Y.width||20,X=Y.height||Z,Q="#e5e7eb",J=`<svg xmlns="http://www.w3.org/2000/svg" width="${Z}" height="${X}" viewBox="0 0 ${Z} ${X}"><rect fill="#e5e7eb" width="${Z}" height="${X}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(J)}`,width:Z,height:X,aspectRatio:Z/X,originalWidth:0,originalHeight:0,strategy:Y.strategy,dominantColor:"#e5e7eb"}}function b3($,Y,Z={}){let X=Z.transitionDuration||300,Q=Z.easing||"ease-out";return`
2003
+ `;return U}var Z$,GJ=0,o;var H0=S(()=>{n9();i0();T1();J$();N1();t9();U3();r1();Z$=new n1(500);o={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 D3($,Y,Z=""){let X=$,Q=[],J=/@markdown(?:\([^)]*\))?/g,G;while((G=J.exec($))!==null){let K=G.index,q=G[0].match(/@markdown\(([^)]*)\)/),_=q?q[1]:"",U=K+G[0].length,W=1,B=U,j=-1;while(W>0&&B<$.length){let L=$.indexOf("@markdown",B),F=$.indexOf("@endmarkdown",B);if(F===-1)break;if(L!==-1&&L<F&&L!==K){let H=$[L+9];if(H==="("||H===`
2004
+ `||H==="\r"||H===" "||H===void 0)W++;B=L+9}else{if(W--,W===0){j=F;break}B=F+12}}if(j===-1)continue;let z=$.slice(U,j),O=$.slice(K,j+12);Q.push({fullMatch:O,options:_,content:z,index:K}),J.lastIndex=j+12}for(let{fullMatch:K,options:q,content:_,index:U}of Q)try{let W={};if(q)q.split(",").forEach((z)=>{let O=z.trim();if(O)W[O]=!0});let B={gfm:W.gfm??!0,breaks:W.breaks??!1},j=l1(_.trim(),B);X=X.split(K).join(j)}catch(W){let B=W instanceof Error?W.message:String(W),j=J0("Markdown Directive",`Error processing markdown: ${B}`,Z,$,U,K);X=X.split(K).join(j)}return X}async function k3($,Y,Z,X){let Q={gfm:!0,breaks:!1};return Y.forEach((J)=>{let G=J.trim().replace(/['"]/g,"");if(G==="breaks")Q.breaks=!0;if(G==="no-gfm")Q.gfm=!1}),l1($.trim(),Q)}var Q$=S(()=>{H0()});function zJ($){if(WJ.set($.name,$),$.client)BJ.set($.name,$.client)}function D5($){return zJ($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Z,X,Q,J)=>{let G=jJ(X,$.defaults);if($.validate){let q=$.validate(G);if(q!==!0){let _=typeof q==="string"?q:`Invalid parameters for @${$.name}`;throw Error(_)}}let K=Z;if($.transform)K=await $.transform(Z,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 jJ($,Y){let Z={...Y};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{}Z[K]=q}else{let K=Object.keys(Z).filter((q)=>!Y||!(q in Y)).length;Z[K===0?"value":`arg${K}`]=X}}return Z}var WJ,BJ;var G$=S(()=>{WJ=new Map,BJ=new Map});function K$($,Y=I1,Z={},X){return Y.sort((Q,J)=>Q-J).map((Q)=>{return`${t1($,{...Z,w:Q,fm:X})} ${Q}w`}).join(", ")}function b3($,Y,Z=OJ,X={},Q){return Z.sort((J,G)=>J-G).map((J)=>{let G=Math.round(Y*J);return`${t1($,{...X,w:G,dpr:J,fm:Q})} ${J}x`}).join(", ")}function q$($,Y="100vw"){if(!$||Object.keys($).length===0)return Y;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(Y),X.join(", ")}function t1($,Y={}){let Z=Object.entries(Y).filter(([,J])=>J!==void 0&&J!==null).map(([J,G])=>{if(Array.isArray(G))return[J,G.join(",")];return[J,String(G)]});if(Z.length===0)return $;let X=Z.map(([J,G])=>`${J}=${encodeURIComponent(G)}`).join("&"),Q=$.includes("?")?"&":"?";return`${$}${Q}${X}`}function U$($){return HJ[$]||"application/octet-stream"}var I1,OJ,a1,HJ;var _$=S(()=>{I1=[320,480,640,768,1024,1280,1536,1920,2560],OJ=[1,1.5,2,3],a1=["avif","webp","jpeg"],HJ={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function FJ(){try{return await import("ts-images")}catch{return null}}async function VJ($,Y={}){let Z={...LJ,...Y},X=await FJ();if(X)try{return await RJ($,Z,X)}catch(Q){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Q}`)}return NJ($,Z)}async function RJ($,Y,Z){let{generatePlaceholder:X,generateThumbHash:Q}=Z,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Y.strategy]||"blur";if(Y.strategy==="thumbhash")return{dataURL:(await Q($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await X($,{width:Y.width,height:Y.height,quality:Y.quality,blurLevel:Y.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:Y.strategy,dominantColor:K.dominantColor,css:K.css}}function NJ($,Y){let Z=Y.width||20,X=Y.height||Z,Q="#e5e7eb",J=`<svg xmlns="http://www.w3.org/2000/svg" width="${Z}" height="${X}" viewBox="0 0 ${Z} ${X}"><rect fill="#e5e7eb" width="${Z}" height="${X}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(J)}`,width:Z,height:X,aspectRatio:Z/X,originalWidth:0,originalHeight:0,strategy:Y.strategy,dominantColor:"#e5e7eb"}}function S3($,Y,Z={}){let X=Z.transitionDuration||300,Q=Z.easing||"ease-out";return`
2004
2005
  #${$} {
2005
2006
  --stx-img-transition-duration: ${X}ms;
2006
2007
  --stx-img-transition-easing: ${Q};
@@ -2017,7 +2018,7 @@ ${o.dim}${K}${o.reset}
2017
2018
  #${$}.stx-img-loaded img {
2018
2019
  opacity: 1;
2019
2020
  }
2020
- `.trim()}async function y3($,Y={}){let Z=`${$}:${JSON.stringify(Y)}`;if(W$.has(Z))return W$.get(Z);let X=await HJ($,Y);return W$.set(Z,X),X}var jJ,B$,W$;var P3=b(()=>{jJ={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},B$=`
2021
+ `.trim()}async function y3($,Y={}){let Z=`${$}:${JSON.stringify(Y)}`;if(W$.has(Z))return W$.get(Z);let X=await VJ($,Y);return W$.set(Z,X),X}var LJ,B$,W$;var P3=S(()=>{LJ={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},B$=`
2021
2022
  .stx-img-placeholder {
2022
2023
  position: relative;
2023
2024
  overflow: hidden;
@@ -2046,8 +2047,8 @@ ${o.dim}${K}${o.reset}
2046
2047
  filter: blur(0);
2047
2048
  transform: scale(1);
2048
2049
  }
2049
- `.trim();W$=new Map});import{createHash as v3}from"crypto";import{readFile as VJ,stat as x3}from"fs/promises";async function R0($){try{let Y=await VJ($);return v3("sha256").update(Y).digest("hex").slice(0,16)}catch{return""}}function C3($){return v3("sha256").update($).digest("hex").slice(0,16)}function k5($,Y){let Z=JSON.stringify(Y,Object.keys(Y).sort());return`${C3($)}-${C3(Z)}`}async function z$($){try{return(await x3($)).mtimeMs}catch{return 0}}async function L0($){try{return await x3($),!0}catch{return!1}}var U1=()=>{};import{mkdir as RJ,readFile as NJ,writeFile as AJ,readdir as zW,rm as wJ,stat as jW}from"fs/promises";import{join as g3,dirname as TJ}from"path";async function MJ($){try{await RJ($,{recursive:!0})}catch{}}function h3($,Y,Z){return g3($,Z,`${Y}.json`)}async function f3($,Y,Z){if((Date.now()-$.createdAt)/86400000>Z)return!1;if(await z$(Y)!==$.srcMtime)return!1;return!0}async function S5($,Y,Z,X=j$){if(!X.enabled)return null;let Q=k5($,Y),J=M1.get(Q);if(J){if(await f3(J,$,X.maxAge))return J.lastAccessedAt=Date.now(),J.data;M1.delete(Q)}let G=h3(X.directory,Q,Z);if(await L0(G))try{let K=await NJ(G,"utf-8"),q=JSON.parse(K);if(await f3(q,$,X.maxAge))return q.lastAccessedAt=Date.now(),M1.set(Q,q),q.data}catch{}return null}async function b5($,Y,Z,X,Q=j$){if(!Q.enabled)return;let J=k5($,Y),G=await R0($),K=await z$($),q={key:J,src:$,srcHash:G,srcMtime:K,optionsHash:k5("",Y),data:Z,createdAt:Date.now(),lastAccessedAt:Date.now()};M1.set(J,q);let _=h3(Q.directory,J,X);try{await MJ(TJ(_)),await AJ(_,JSON.stringify(q,null,2))}catch(U){console.warn(`[stx-media] Failed to write cache: ${U}`)}}async function y5($,Y=j$){if($==="all")M1.clear();else M1.clear();let Z=$==="all"?["image","video"]:[$];for(let X of Z){let Q=g3(Y.directory,X);try{await wJ(Q,{recursive:!0,force:!0})}catch{}}}var M1,j$;var O$=b(()=>{U1();M1=new Map,j$={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class C5{config;constructor($={}){this.config={...IJ,...$}}async get($,Y){return S5($,Y,"image",this.config)}async set($,Y,Z){return b5($,Y,Z,"image",this.config)}async clear(){return y5("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function H$($){if(!P5)P5=new C5($);else if($)P5.updateConfig($);return P5}async function v5($,Y,Z){let X=Z?{directory:`${Z.outputDir}/../.cache`}:{};return H$(X).get($,Y)}async function x5($,Y,Z,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return H$(Q).set($,Y,Z)}async function d3(){return H$().clear()}var IJ,P5=null;var L$=b(()=>{O$();IJ={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as EJ,basename as DJ,extname as kJ,join as SJ}from"path";import{mkdir as bJ}from"fs/promises";async function F$(){try{return await import("ts-images")}catch{return null}}function m3($){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 yJ($,Y){let Z=Y?m3(Y):m3("web"),X=$.formatQuality||{};return{jpeg:{...Z.jpeg,...X.jpeg},png:{...Z.png,...X.png},webp:{...Z.webp,...X.webp},avif:{...Z.avif,...X.avif}}}async function u3($,Y,Z){let X=await F$();if(!X)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Q=await v5($,Y,Z);if(Q)return Q;try{let J=EJ($);if(!await L0(J))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=yJ(Z,Y.preset),K=Z.outputDir||"dist/images",q=Z.baseUrl||"/images";await bJ(K,{recursive:!0});let _=await R0(J),U=DJ($,kJ($)),W=Y.outputFormat?[Y.outputFormat]:Z.defaultFormats||["avif","webp","jpeg"],B={src:$,processed:!0,variants:[],hash:_},j=null;if(Y.transformations&&Y.transformations.length>0)j=await V$(J,Y.transformations,X);for(let z of W){let O=G[z]||{},L=`${U}-${_}.${z}`,F=SJ(K,L);try{let H=await X.optimizeImage({input:j||J,output:F,format:z,quality:O.quality,progressive:O.progressive});if(H){if(B.variants.push({path:F,url:`${q}/${L}`,width:H.width||0,height:H.height||0,format:z,size:H.outputSize||0}),!B.originalWidth&&H.width)B.originalWidth=H.width,B.originalHeight=H.height}}catch(H){B.errors=B.errors||[],B.errors.push(`Failed to optimize ${z}: ${H}`)}}if(Y.embedThumbhash||Y.placeholder==="thumbhash")try{let z=await X.generateThumbHash(J);B.placeholder=z.dataUrl}catch(z){B.errors=B.errors||[],B.errors.push(`Failed to generate thumbhash: ${z}`)}if(Y.useDominantColor)try{let z=await X.generatePlaceholder(J,{strategy:"dominant-color"});B.dominantColor=z.dominantColor}catch(z){B.errors=B.errors||[],B.errors.push(`Failed to extract dominant color: ${z}`)}return await x5($,Y,B,Z),B}catch(J){return{src:$,processed:!1,errors:[`Processing failed: ${J}`]}}}async function l3($,Y,Z,X){let Q=await F$();if(!Q)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await Q.optimizeImage({input:$,output:X,format:Y,quality:Z}))?.outputSize}}catch(J){return{success:!1,error:String(J)}}}async function V$($,Y,Z){let X=Z||await F$();if(!X)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let Q=await X.decode($);for(let J of Y){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 p3=b(()=>{U1();L$()});import{resolve as PJ,basename as CJ,extname as vJ,join as xJ}from"path";import{mkdir as fJ}from"fs/promises";async function gJ(){try{return await import("ts-images")}catch{return null}}async function c3($,Y,Z){let X=await gJ();if(!X)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Q=PJ($);if(!await L0(Q))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let J=Y.responsiveWidths||Z.breakpoints||hJ,G=Y.formats||Z.defaultFormats||["avif","webp","jpeg"],K=Z.outputDir||"dist/images",q=Z.baseUrl||"/images";await fJ(K,{recursive:!0});let _=await R0(Q),U=CJ($,vJ($)),W=Z.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},B={src:$,byFormat:{},srcsets:{}};for(let z of G){B.byFormat[z]=[];let O=[];for(let L of J){let F=`${U}-${L}w-${_}.${z}`,H=xJ(K,F),V=`${q}/${F}`;try{let N=W[z]?.quality||80;if(await L0(H)){B.byFormat[z].push({path:H,url:V,width:L,height:0,format:z,size:0}),O.push(`${V} ${L}w`);continue}let R=await X.processImage({input:Q,output:H,format:z,quality:N,resize:{width:L}});if(R)B.byFormat[z].push({path:H,url:V,width:L,height:R.height||Math.round(L*(R.height||1)/(R.width||1)),format:z,size:R.outputSize||0}),O.push(`${V} ${L}w`)}catch(N){console.warn(`[stx-media] Failed to generate ${z} at ${L}w: ${N}`)}}B.srcsets[z]=O.join(", ")}let j=Y.placeholder||Z.placeholderStrategy||"thumbhash";if(j!=="none")try{if(j==="thumbhash"){let z=await X.generateThumbHash(Q);B.placeholder={dataURL:z.dataUrl,width:z.width||32,height:z.height||32,strategy:"thumbhash"}}else{let z=await X.generatePlaceholder(Q,{strategy:j,width:20});B.placeholder={dataURL:z.dataURL,width:z.width,height:z.height,strategy:j}}}catch(z){console.warn(`[stx-media] Failed to generate placeholder: ${z}`)}return B.sizes=Y.sizes||dJ(J),B}catch(J){return console.error(`[stx-media] Responsive generation failed: ${J}`),null}}function dJ($){let Y=[...$].sort((X,Q)=>X-Q),Z=[];for(let X=0;X<Y.length-1;X++){let Q=Y[X];Z.push(`(max-width: ${Q}px) ${Q}px`)}return Z.push(`${Y[Y.length-1]}px`),Z.join(", ")}function i3($,Y="width"){if(!$||$.length===0)return"";if(Y==="dpr")return $.filter((Z)=>Z.dpr).map((Z)=>`${Z.url} ${Z.dpr}x`).join(", ");return $.map((Z)=>`${Z.url} ${Z.width}w`).join(", ")}var hJ;var n3=b(()=>{U1();hJ=[320,480,640,768,1024,1280,1536,1920]});var o3={};r(o3,{setCachedImageResult:()=>x5,processImage:()=>u3,optimizeImage:()=>l3,getCachedImageResult:()=>v5,generateSrcset:()=>i3,generateResponsiveVariants:()=>c3,clearImageCache:()=>d3,applyTransformations:()=>V$,ImageProcessorCache:()=>C5});var s3=b(()=>{p3();n3();L$()});async function mJ(){try{return await Promise.resolve().then(() => (s3(),o3))}catch($){if(!r3)console.warn("[stx-media] Image processor not available, some features disabled:",$),r3=!0;return null}}async function f5($,Y={}){let Z=Y,X=$;if(X.process&&!X.skipOptimization){if(Z.tsImagesConfig?.enabled&&!Z.isDev)return cJ(X,Z)}if(Z.processedResult?.processed)return w$($,Z.processedResult,Y);if(Z.responsiveVariants)return $6($,Z.responsiveVariants,Y);let{src:Q,alt:J,width:G,height:K,sizes:q,widths:_=T1,dpr:U,formats:W=a1,quality:B=R$,params:j={},placeholder:z="none",placeholderOptions:O={},lazy:L=!0,priority:F=!1,loading:H=F?"eager":h5,decoding:V=g5,fetchpriority:N,objectFit:R,objectPosition:A,crossorigin:w,referrerpolicy:T}=$,I=$.class,M=$.style,E=$.id,D=$.data||{},{isDev:P=!1,baseUrl:y=""}=Y;if(P&&!Y.optimize)return pJ($);let S,k,g=E||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(z!=="none"&&!F)try{S=await y3(Q,{strategy:z,...O}),k=b3(g,S,O)}catch{}let h=U!==void 0&&G!==void 0,n;if(h)n=lJ($,g,S,Y);else n=await uJ($,g,S,Y);let _0;if(F){let k0=W.includes("webp")?"webp":W[0],y0=K$(Q,_,{...j,q:B},k0),O0=typeof q==="object"?q$(q):q||"100vw";_0=`<link rel="preload" as="image" imagesrcset="${y0}" imagesizes="${O0}" />`}let w0=[];if(!a3&&z!=="none")w0.push(B$),a3=!0;if(k)w0.push(k);let q0=L?e3(g):void 0;return{html:n,preloadLink:_0,css:w0.length>0?w0.join(`
2050
- `):void 0,script:q0}}async function uJ($,Y,Z,X){let{src:Q,alt:J,width:G,height:K,sizes:q,widths:_=T1,formats:U=a1,quality:W=R$,params:B={},lazy:j=!0,priority:z=!1,loading:O=z?"eager":h5,decoding:L=g5,fetchpriority:F,objectFit:H,objectPosition:V,crossorigin:N,referrerpolicy:R}=$,A=$.class,w=$.style,T=$.data||{},I=typeof q==="object"?q$(q):q||"100vw",M=[];for(let P of U){let y=K$(Q,_,{...B,q:W},P),S=U$(P);if(j&&!z)M.push(` <source type="${S}" data-srcset="${y}" data-sizes="${I}" />`);else M.push(` <source type="${S}" srcset="${y}" sizes="${I}" />`)}let E=N$({src:t1(Q,{...B,q:W}),alt:J,width:G,height:K,loading:z?void 0:O,decoding:L,fetchpriority:z?"high":F,objectFit:H,objectPosition:V,crossorigin:N,referrerpolicy:R,className:t3(A,Z),style:A$(w,H,V,Z),lazy:j&&!z,data:T}),D;if(Z){let P=`background-image: url('${Z.dataURL}'); background-size: cover; background-position: center;`;D=`<div id="${Y}" class="stx-img-placeholder" style="${P}">
2050
+ `.trim();W$=new Map});import{createHash as v3}from"crypto";import{readFile as AJ,stat as x3}from"fs/promises";async function R0($){try{let Y=await AJ($);return v3("sha256").update(Y).digest("hex").slice(0,16)}catch{return""}}function C3($){return v3("sha256").update($).digest("hex").slice(0,16)}function k5($,Y){let Z=JSON.stringify(Y,Object.keys(Y).sort());return`${C3($)}-${C3(Z)}`}async function z$($){try{return(await x3($)).mtimeMs}catch{return 0}}async function L0($){try{return await x3($),!0}catch{return!1}}var U1=()=>{};import{mkdir as wJ,readFile as TJ,writeFile as MJ,readdir as LW,rm as IJ,stat as FW}from"fs/promises";import{join as g3,dirname as EJ}from"path";async function DJ($){try{await wJ($,{recursive:!0})}catch{}}function h3($,Y,Z){return g3($,Z,`${Y}.json`)}async function f3($,Y,Z){if((Date.now()-$.createdAt)/86400000>Z)return!1;if(await z$(Y)!==$.srcMtime)return!1;return!0}async function b5($,Y,Z,X=j$){if(!X.enabled)return null;let Q=k5($,Y),J=E1.get(Q);if(J){if(await f3(J,$,X.maxAge))return J.lastAccessedAt=Date.now(),J.data;E1.delete(Q)}let G=h3(X.directory,Q,Z);if(await L0(G))try{let K=await TJ(G,"utf-8"),q=JSON.parse(K);if(await f3(q,$,X.maxAge))return q.lastAccessedAt=Date.now(),E1.set(Q,q),q.data}catch{}return null}async function S5($,Y,Z,X,Q=j$){if(!Q.enabled)return;let J=k5($,Y),G=await R0($),K=await z$($),q={key:J,src:$,srcHash:G,srcMtime:K,optionsHash:k5("",Y),data:Z,createdAt:Date.now(),lastAccessedAt:Date.now()};E1.set(J,q);let _=h3(Q.directory,J,X);try{await DJ(EJ(_)),await MJ(_,JSON.stringify(q,null,2))}catch(U){console.warn(`[stx-media] Failed to write cache: ${U}`)}}async function y5($,Y=j$){if($==="all")E1.clear();else E1.clear();let Z=$==="all"?["image","video"]:[$];for(let X of Z){let Q=g3(Y.directory,X);try{await IJ(Q,{recursive:!0,force:!0})}catch{}}}var E1,j$;var O$=S(()=>{U1();E1=new Map,j$={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class C5{config;constructor($={}){this.config={...kJ,...$}}async get($,Y){return b5($,Y,"image",this.config)}async set($,Y,Z){return S5($,Y,Z,"image",this.config)}async clear(){return y5("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function H$($){if(!P5)P5=new C5($);else if($)P5.updateConfig($);return P5}async function v5($,Y,Z){let X=Z?{directory:`${Z.outputDir}/../.cache`}:{};return H$(X).get($,Y)}async function x5($,Y,Z,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return H$(Q).set($,Y,Z)}async function d3(){return H$().clear()}var kJ,P5=null;var L$=S(()=>{O$();kJ={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as bJ,basename as SJ,extname as yJ,join as PJ}from"path";import{mkdir as CJ}from"fs/promises";async function F$(){try{return await import("ts-images")}catch{return null}}function m3($){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 vJ($,Y){let Z=Y?m3(Y):m3("web"),X=$.formatQuality||{};return{jpeg:{...Z.jpeg,...X.jpeg},png:{...Z.png,...X.png},webp:{...Z.webp,...X.webp},avif:{...Z.avif,...X.avif}}}async function u3($,Y,Z){let X=await F$();if(!X)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Q=await v5($,Y,Z);if(Q)return Q;try{let J=bJ($);if(!await L0(J))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=vJ(Z,Y.preset),K=Z.outputDir||"dist/images",q=Z.baseUrl||"/images";await CJ(K,{recursive:!0});let _=await R0(J),U=SJ($,yJ($)),W=Y.outputFormat?[Y.outputFormat]:Z.defaultFormats||["avif","webp","jpeg"],B={src:$,processed:!0,variants:[],hash:_},j=null;if(Y.transformations&&Y.transformations.length>0)j=await V$(J,Y.transformations,X);for(let z of W){let O=G[z]||{},L=`${U}-${_}.${z}`,F=PJ(K,L);try{let H=await X.optimizeImage({input:j||J,output:F,format:z,quality:O.quality,progressive:O.progressive});if(H){if(B.variants.push({path:F,url:`${q}/${L}`,width:H.width||0,height:H.height||0,format:z,size:H.outputSize||0}),!B.originalWidth&&H.width)B.originalWidth=H.width,B.originalHeight=H.height}}catch(H){B.errors=B.errors||[],B.errors.push(`Failed to optimize ${z}: ${H}`)}}if(Y.embedThumbhash||Y.placeholder==="thumbhash")try{let z=await X.generateThumbHash(J);B.placeholder=z.dataUrl}catch(z){B.errors=B.errors||[],B.errors.push(`Failed to generate thumbhash: ${z}`)}if(Y.useDominantColor)try{let z=await X.generatePlaceholder(J,{strategy:"dominant-color"});B.dominantColor=z.dominantColor}catch(z){B.errors=B.errors||[],B.errors.push(`Failed to extract dominant color: ${z}`)}return await x5($,Y,B,Z),B}catch(J){return{src:$,processed:!1,errors:[`Processing failed: ${J}`]}}}async function l3($,Y,Z,X){let Q=await F$();if(!Q)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await Q.optimizeImage({input:$,output:X,format:Y,quality:Z}))?.outputSize}}catch(J){return{success:!1,error:String(J)}}}async function V$($,Y,Z){let X=Z||await F$();if(!X)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let Q=await X.decode($);for(let J of Y){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 p3=S(()=>{U1();L$()});import{resolve as xJ,basename as fJ,extname as gJ,join as hJ}from"path";import{mkdir as dJ}from"fs/promises";async function mJ(){try{return await import("ts-images")}catch{return null}}async function c3($,Y,Z){let X=await mJ();if(!X)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Q=xJ($);if(!await L0(Q))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let J=Y.responsiveWidths||Z.breakpoints||uJ,G=Y.formats||Z.defaultFormats||["avif","webp","jpeg"],K=Z.outputDir||"dist/images",q=Z.baseUrl||"/images";await dJ(K,{recursive:!0});let _=await R0(Q),U=fJ($,gJ($)),W=Z.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},B={src:$,byFormat:{},srcsets:{}};for(let z of G){B.byFormat[z]=[];let O=[];for(let L of J){let F=`${U}-${L}w-${_}.${z}`,H=hJ(K,F),V=`${q}/${F}`;try{let N=W[z]?.quality||80;if(await L0(H)){B.byFormat[z].push({path:H,url:V,width:L,height:0,format:z,size:0}),O.push(`${V} ${L}w`);continue}let R=await X.processImage({input:Q,output:H,format:z,quality:N,resize:{width:L}});if(R)B.byFormat[z].push({path:H,url:V,width:L,height:R.height||Math.round(L*(R.height||1)/(R.width||1)),format:z,size:R.outputSize||0}),O.push(`${V} ${L}w`)}catch(N){console.warn(`[stx-media] Failed to generate ${z} at ${L}w: ${N}`)}}B.srcsets[z]=O.join(", ")}let j=Y.placeholder||Z.placeholderStrategy||"thumbhash";if(j!=="none")try{if(j==="thumbhash"){let z=await X.generateThumbHash(Q);B.placeholder={dataURL:z.dataUrl,width:z.width||32,height:z.height||32,strategy:"thumbhash"}}else{let z=await X.generatePlaceholder(Q,{strategy:j,width:20});B.placeholder={dataURL:z.dataURL,width:z.width,height:z.height,strategy:j}}}catch(z){console.warn(`[stx-media] Failed to generate placeholder: ${z}`)}return B.sizes=Y.sizes||lJ(J),B}catch(J){return console.error(`[stx-media] Responsive generation failed: ${J}`),null}}function lJ($){let Y=[...$].sort((X,Q)=>X-Q),Z=[];for(let X=0;X<Y.length-1;X++){let Q=Y[X];Z.push(`(max-width: ${Q}px) ${Q}px`)}return Z.push(`${Y[Y.length-1]}px`),Z.join(", ")}function i3($,Y="width"){if(!$||$.length===0)return"";if(Y==="dpr")return $.filter((Z)=>Z.dpr).map((Z)=>`${Z.url} ${Z.dpr}x`).join(", ");return $.map((Z)=>`${Z.url} ${Z.width}w`).join(", ")}var uJ;var n3=S(()=>{U1();uJ=[320,480,640,768,1024,1280,1536,1920]});var o3={};r(o3,{setCachedImageResult:()=>x5,processImage:()=>u3,optimizeImage:()=>l3,getCachedImageResult:()=>v5,generateSrcset:()=>i3,generateResponsiveVariants:()=>c3,clearImageCache:()=>d3,applyTransformations:()=>V$,ImageProcessorCache:()=>C5});var s3=S(()=>{p3();n3();L$()});async function pJ(){try{return await Promise.resolve().then(() => (s3(),o3))}catch($){if(!r3)console.warn("[stx-media] Image processor not available, some features disabled:",$),r3=!0;return null}}async function f5($,Y={}){let Z=Y,X=$;if(X.process&&!X.skipOptimization){if(Z.tsImagesConfig?.enabled&&!Z.isDev)return oJ(X,Z)}if(Z.processedResult?.processed)return w$($,Z.processedResult,Y);if(Z.responsiveVariants)return $6($,Z.responsiveVariants,Y);let{src:Q,alt:J,width:G,height:K,sizes:q,widths:_=I1,dpr:U,formats:W=a1,quality:B=R$,params:j={},placeholder:z="none",placeholderOptions:O={},lazy:L=!0,priority:F=!1,loading:H=F?"eager":h5,decoding:V=g5,fetchpriority:N,objectFit:R,objectPosition:A,crossorigin:w,referrerpolicy:T}=$,I=$.class,M=$.style,E=$.id,D=$.data||{},{isDev:P=!1,baseUrl:y=""}=Y;if(P&&!Y.optimize)return nJ($);let b,k,g=E||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(z!=="none"&&!F)try{b=await y3(Q,{strategy:z,...O}),k=S3(g,b,O)}catch{}let h=U!==void 0&&G!==void 0,n;if(h)n=iJ($,g,b,Y);else n=await cJ($,g,b,Y);let _0;if(F){let k0=W.includes("webp")?"webp":W[0],y0=K$(Q,_,{...j,q:B},k0),O0=typeof q==="object"?q$(q):q||"100vw";_0=`<link rel="preload" as="image" imagesrcset="${y0}" imagesizes="${O0}" />`}let w0=[];if(!a3&&z!=="none")w0.push(B$),a3=!0;if(k)w0.push(k);let q0=L?e3(g):void 0;return{html:n,preloadLink:_0,css:w0.length>0?w0.join(`
2051
+ `):void 0,script:q0}}async function cJ($,Y,Z,X){let{src:Q,alt:J,width:G,height:K,sizes:q,widths:_=I1,formats:U=a1,quality:W=R$,params:B={},lazy:j=!0,priority:z=!1,loading:O=z?"eager":h5,decoding:L=g5,fetchpriority:F,objectFit:H,objectPosition:V,crossorigin:N,referrerpolicy:R}=$,A=$.class,w=$.style,T=$.data||{},I=typeof q==="object"?q$(q):q||"100vw",M=[];for(let P of U){let y=K$(Q,_,{...B,q:W},P),b=U$(P);if(j&&!z)M.push(` <source type="${b}" data-srcset="${y}" data-sizes="${I}" />`);else M.push(` <source type="${b}" srcset="${y}" sizes="${I}" />`)}let E=N$({src:t1(Q,{...B,q:W}),alt:J,width:G,height:K,loading:z?void 0:O,decoding:L,fetchpriority:z?"high":F,objectFit:H,objectPosition:V,crossorigin:N,referrerpolicy:R,className:t3(A,Z),style:A$(w,H,V,Z),lazy:j&&!z,data:T}),D;if(Z){let P=`background-image: url('${Z.dataURL}'); background-size: cover; background-position: center;`;D=`<div id="${Y}" class="stx-img-placeholder" style="${P}">
2051
2052
  <picture>
2052
2053
  ${M.join(`
2053
2054
  `)}
@@ -2057,9 +2058,9 @@ ${M.join(`
2057
2058
  ${M.join(`
2058
2059
  `)}
2059
2060
  <img ${E} />
2060
- </picture>`;return D}function lJ($,Y,Z,X){let{src:Q,alt:J,width:G,height:K,dpr:q=[1,2,3],quality:_=R$,params:U={},lazy:W=!0,priority:B=!1,loading:j=B?"eager":h5,decoding:z=g5,fetchpriority:O,objectFit:L,objectPosition:F,crossorigin:H,referrerpolicy:V}=$,N=$.class,R=$.style,A=$.data||{},w=typeof G==="number"?G:Number.parseInt(String(G),10),T=S3(Q,w,q,{...U,q:_}),I=N$({src:t1(Q,{...U,w,q:_}),alt:J,width:G,height:K,loading:B?void 0:j,decoding:z,fetchpriority:B?"high":O,objectFit:L,objectPosition:F,crossorigin:H,referrerpolicy:V,className:t3(N,Z),style:A$(R,L,F,Z),lazy:W&&!B,data:A}),M=W&&!B?`data-srcset="${T}"`:`srcset="${T}"`;if(Z){let E=`background-image: url('${Z.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Y}" class="stx-img-placeholder" style="${E}">
2061
+ </picture>`;return D}function iJ($,Y,Z,X){let{src:Q,alt:J,width:G,height:K,dpr:q=[1,2,3],quality:_=R$,params:U={},lazy:W=!0,priority:B=!1,loading:j=B?"eager":h5,decoding:z=g5,fetchpriority:O,objectFit:L,objectPosition:F,crossorigin:H,referrerpolicy:V}=$,N=$.class,R=$.style,A=$.data||{},w=typeof G==="number"?G:Number.parseInt(String(G),10),T=b3(Q,w,q,{...U,q:_}),I=N$({src:t1(Q,{...U,w,q:_}),alt:J,width:G,height:K,loading:B?void 0:j,decoding:z,fetchpriority:B?"high":O,objectFit:L,objectPosition:F,crossorigin:H,referrerpolicy:V,className:t3(N,Z),style:A$(R,L,F,Z),lazy:W&&!B,data:A}),M=W&&!B?`data-srcset="${T}"`:`srcset="${T}"`;if(Z){let E=`background-image: url('${Z.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Y}" class="stx-img-placeholder" style="${E}">
2061
2062
  <img ${I} ${M} />
2062
- </div>`}return`<img ${Y?`id="${Y}" `:""}${I} ${M} />`}function pJ($){let{src:Y,alt:Z,width:X,height:Q,loading:J=h5,decoding:G=g5,fetchpriority:K,objectFit:q,objectPosition:_,crossorigin:U,referrerpolicy:W,priority:B=!1}=$,j=$.class,z=$.style,O=$.id,L=$.data||{};return{html:`<img ${N$({src:Y,alt:Z,width:X,height:Q,loading:B?"eager":J,decoding:G,fetchpriority:B?"high":K,objectFit:q,objectPosition:_,crossorigin:U,referrerpolicy:W,className:j,style:A$(z,q,_),id:O,data:L})} />`}}function N$($){let Y=[];if($.lazy)Y.push(`data-src="${S0($.src)}"`),Y.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Y.push(`src="${S0($.src)}"`);if(Y.push(`alt="${S0($.alt)}"`),$.width)Y.push(`width="${$.width}"`);if($.height)Y.push(`height="${$.height}"`);if($.loading)Y.push(`loading="${$.loading}"`);if($.decoding)Y.push(`decoding="${$.decoding}"`);if($.fetchpriority)Y.push(`fetchpriority="${$.fetchpriority}"`);if($.crossorigin)Y.push(`crossorigin="${$.crossorigin}"`);if($.referrerpolicy)Y.push(`referrerpolicy="${$.referrerpolicy}"`);if($.className)Y.push(`class="${S0($.className)}"`);if($.style)Y.push(`style="${S0($.style)}"`);if($.id)Y.push(`id="${S0($.id)}"`);if($.data)for(let[Z,X]of Object.entries($.data))Y.push(`data-${Z}="${S0(X)}"`);if($.lazy)Y.push("data-stx-lazy");return Y.join(" ")}function t3($,Y){let Z=[];if($)Z.push($);if(Y)Z.push("stx-img-blur");return Z.join(" ")||""}function A$($,Y,Z,X){let Q=[];if(Y)Q.push(`object-fit: ${Y}`);if(Z)Q.push(`object-position: ${Z}`);if(X)Q.push("opacity: 0; transition: opacity 300ms ease-out");if($)Q.push($);return Q.join("; ")}function S0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function e3($){return`
2063
+ </div>`}return`<img ${Y?`id="${Y}" `:""}${I} ${M} />`}function nJ($){let{src:Y,alt:Z,width:X,height:Q,loading:J=h5,decoding:G=g5,fetchpriority:K,objectFit:q,objectPosition:_,crossorigin:U,referrerpolicy:W,priority:B=!1}=$,j=$.class,z=$.style,O=$.id,L=$.data||{};return{html:`<img ${N$({src:Y,alt:Z,width:X,height:Q,loading:B?"eager":J,decoding:G,fetchpriority:B?"high":K,objectFit:q,objectPosition:_,crossorigin:U,referrerpolicy:W,className:j,style:A$(z,q,_),id:O,data:L})} />`}}function N$($){let Y=[];if($.lazy)Y.push(`data-src="${b0($.src)}"`),Y.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Y.push(`src="${b0($.src)}"`);if(Y.push(`alt="${b0($.alt)}"`),$.width)Y.push(`width="${$.width}"`);if($.height)Y.push(`height="${$.height}"`);if($.loading)Y.push(`loading="${$.loading}"`);if($.decoding)Y.push(`decoding="${$.decoding}"`);if($.fetchpriority)Y.push(`fetchpriority="${$.fetchpriority}"`);if($.crossorigin)Y.push(`crossorigin="${$.crossorigin}"`);if($.referrerpolicy)Y.push(`referrerpolicy="${$.referrerpolicy}"`);if($.className)Y.push(`class="${b0($.className)}"`);if($.style)Y.push(`style="${b0($.style)}"`);if($.id)Y.push(`id="${b0($.id)}"`);if($.data)for(let[Z,X]of Object.entries($.data))Y.push(`data-${Z}="${b0(X)}"`);if($.lazy)Y.push("data-stx-lazy");return Y.join(" ")}function t3($,Y){let Z=[];if($)Z.push($);if(Y)Z.push("stx-img-blur");return Z.join(" ")||""}function A$($,Y,Z,X){let Q=[];if(Y)Q.push(`object-fit: ${Y}`);if(Z)Q.push(`object-position: ${Z}`);if(X)Q.push("opacity: 0; transition: opacity 300ms ease-out");if($)Q.push($);return Q.join("; ")}function b0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function e3($){return`
2063
2064
  (function() {
2064
2065
  const container = document.getElementById('${$}');
2065
2066
  if (!container) return;
@@ -2096,7 +2097,7 @@ ${M.join(`
2096
2097
 
2097
2098
  observer.observe(container);
2098
2099
  })();
2099
- `.trim()}async function cJ($,Y){let Z=await mJ();if(!Z)return f5({...$,process:!1},Y);let X=Y.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let J=await Z.generateResponsiveVariants($.src,$,X);if(J)return $6($,J,Y)}else{let J=await Z.processImage($.src,$,X);if(J.processed)return w$($,J,Y)}return f5({...$,process:!1},Y)}async function w$($,Y,Z){let{alt:X,width:Q,height:J,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:_,crossorigin:U,referrerpolicy:W}=$,B=$.class,j=$.style,z=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,O=$.data||{},L=Y.variants||[],F=L.find((k)=>k.format==="jpeg")||L.find((k)=>k.format==="webp")||L[0],H=F?.url||$.src,V=L.filter((k)=>k.format===(F?.format||"jpeg")).map((k)=>`${k.url} ${k.width}w`).join(", "),N=new Map;for(let k of L){if(!N.has(k.format))N.set(k.format,[]);N.get(k.format).push(k)}let R=[],A=["avif","webp","jpeg","png"];for(let k of A){let g=N.get(k);if(g&&g.length>0){let h=g.map((_0)=>`${_0.url} ${_0.width}w`).join(", "),n=U$(k);if(G&&!K)R.push(` <source type="${n}" data-srcset="${h}" />`);else R.push(` <source type="${n}" srcset="${h}" />`)}}let w=[];if(G&&!K){if(w.push(`data-src="${S0(H)}"`),w.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)w.push(`data-srcset="${V}"`)}else if(w.push(`src="${S0(H)}"`),V)w.push(`srcset="${V}"`);w.push(`alt="${S0(X)}"`);let T=Q||Y.originalWidth,I=J||Y.originalHeight;if(T)w.push(`width="${T}"`);if(I)w.push(`height="${I}"`);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(W)w.push(`referrerpolicy="${W}"`);let M=[];if(q)M.push(`object-fit: ${q}`);if(_)M.push(`object-position: ${_}`);if(Y.placeholder&&G)M.push("opacity: 0; transition: opacity 300ms ease-out");if(j)M.push(j);if(M.length>0)w.push(`style="${M.join("; ")}"`);let E=[];if(B)E.push(B);if(Y.placeholder)E.push("stx-img-blur");if(E.length>0)w.push(`class="${E.join(" ")}"`);if(G&&!K)w.push("data-stx-lazy");for(let[k,g]of Object.entries(O))w.push(`data-${k}="${S0(g)}"`);let D;if(Y.placeholder||Y.dominantColor&&$.useDominantColor){let k=Y.placeholder?`background-image: url('${Y.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Y.dominantColor};`;D=`<div id="${z}" class="stx-img-placeholder" style="${k}">
2100
+ `.trim()}async function oJ($,Y){let Z=await pJ();if(!Z)return f5({...$,process:!1},Y);let X=Y.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let J=await Z.generateResponsiveVariants($.src,$,X);if(J)return $6($,J,Y)}else{let J=await Z.processImage($.src,$,X);if(J.processed)return w$($,J,Y)}return f5({...$,process:!1},Y)}async function w$($,Y,Z){let{alt:X,width:Q,height:J,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:_,crossorigin:U,referrerpolicy:W}=$,B=$.class,j=$.style,z=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,O=$.data||{},L=Y.variants||[],F=L.find((k)=>k.format==="jpeg")||L.find((k)=>k.format==="webp")||L[0],H=F?.url||$.src,V=L.filter((k)=>k.format===(F?.format||"jpeg")).map((k)=>`${k.url} ${k.width}w`).join(", "),N=new Map;for(let k of L){if(!N.has(k.format))N.set(k.format,[]);N.get(k.format).push(k)}let R=[],A=["avif","webp","jpeg","png"];for(let k of A){let g=N.get(k);if(g&&g.length>0){let h=g.map((_0)=>`${_0.url} ${_0.width}w`).join(", "),n=U$(k);if(G&&!K)R.push(` <source type="${n}" data-srcset="${h}" />`);else R.push(` <source type="${n}" srcset="${h}" />`)}}let w=[];if(G&&!K){if(w.push(`data-src="${b0(H)}"`),w.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)w.push(`data-srcset="${V}"`)}else if(w.push(`src="${b0(H)}"`),V)w.push(`srcset="${V}"`);w.push(`alt="${b0(X)}"`);let T=Q||Y.originalWidth,I=J||Y.originalHeight;if(T)w.push(`width="${T}"`);if(I)w.push(`height="${I}"`);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(W)w.push(`referrerpolicy="${W}"`);let M=[];if(q)M.push(`object-fit: ${q}`);if(_)M.push(`object-position: ${_}`);if(Y.placeholder&&G)M.push("opacity: 0; transition: opacity 300ms ease-out");if(j)M.push(j);if(M.length>0)w.push(`style="${M.join("; ")}"`);let E=[];if(B)E.push(B);if(Y.placeholder)E.push("stx-img-blur");if(E.length>0)w.push(`class="${E.join(" ")}"`);if(G&&!K)w.push("data-stx-lazy");for(let[k,g]of Object.entries(O))w.push(`data-${k}="${b0(g)}"`);let D;if(Y.placeholder||Y.dominantColor&&$.useDominantColor){let k=Y.placeholder?`background-image: url('${Y.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Y.dominantColor};`;D=`<div id="${z}" class="stx-img-placeholder" style="${k}">
2100
2101
  <picture>
2101
2102
  ${R.join(`
2102
2103
  `)}
@@ -2106,12 +2107,12 @@ ${R.join(`
2106
2107
  ${R.join(`
2107
2108
  `)}
2108
2109
  <img ${w.join(" ")} />
2109
- </picture>`;let P=[];if(Y.placeholder)P.push(B$);let y=G?e3(z):void 0,S;if(K&&V)S=`<link rel="preload" as="image" imagesrcset="${V}" />`;return{html:D,preloadLink:S,css:P.length>0?P.join(`
2110
- `):void 0,script:y}}async function $6($,Y,Z){let X={src:Y.src,processed:!0,variants:[],placeholder:Y.placeholder?.dataURL,originalWidth:Y.placeholder?.width,originalHeight:Y.placeholder?.height};for(let[Q,J]of Object.entries(Y.byFormat))if(J)X.variants.push(...J);return w$($,X,Z)}var r3=!1,R$=80,g5="async",h5="lazy",a3=!1;var Y6=b(()=>{_$();P3()});function iJ(){return D5({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Y,Z,X)=>{let{src:Q,alt:J,options:G}=nJ($,Y,Z);if(!Q)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:Q,alt:J||"",widths:G.widths||T1,formats:G.formats||a1,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=Z.__isDev||!1,_=await f5(K,{isDev:q}),U=_.html;if(_.preloadLink)U=_.preloadLink+`
2110
+ </picture>`;let P=[];if(Y.placeholder)P.push(B$);let y=G?e3(z):void 0,b;if(K&&V)b=`<link rel="preload" as="image" imagesrcset="${V}" />`;return{html:D,preloadLink:b,css:P.length>0?P.join(`
2111
+ `):void 0,script:y}}async function $6($,Y,Z){let X={src:Y.src,processed:!0,variants:[],placeholder:Y.placeholder?.dataURL,originalWidth:Y.placeholder?.width,originalHeight:Y.placeholder?.height};for(let[Q,J]of Object.entries(Y.byFormat))if(J)X.variants.push(...J);return w$($,X,Z)}var r3=!1,R$=80,g5="async",h5="lazy",a3=!1;var Y6=S(()=>{_$();P3()});function sJ(){return D5({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Y,Z,X)=>{let{src:Q,alt:J,options:G}=rJ($,Y,Z);if(!Q)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:Q,alt:J||"",widths:G.widths||I1,formats:G.formats||a1,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=Z.__isDev||!1,_=await f5(K,{isDev:q}),U=_.html;if(_.preloadLink)U=_.preloadLink+`
2111
2112
  `+U;if(_.css)U+=`
2112
2113
  <style>${_.css}</style>`;if(_.script)U+=`
2113
- <script>${_.script}</script>`;return U},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function nJ($,Y,Z){if(Y.src)return{src:String(Y.src),alt:String(Y.alt||""),options:Y.options||{}};let X=$.trim();if(X.startsWith("@img(")||X.startsWith("("))X=X.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=oJ(X),J=T$(Q[0],Z)||"",G=T$(Q[1],Z)||"",K={};if(Q[2]){let q=T$(Q[2],Z);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 oJ($){let Y=[],Z="",X=!1,Q="",J=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],_=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&_!=="\\"){if(!X)X=!0,Q=q;else if(q===Q)X=!1,Q="";else Z+=q;continue}if(!X){if(q==="{")J++;if(q==="}")J--;if(q==="[")G++;if(q==="]")G--;if(q===","&&J===0&&G===0){Y.push(Z.trim()),Z="";continue}}Z+=q}if(Z.trim())Y.push(Z.trim());return Y}function T$($,Y){if(typeof $!=="string")return $;let Z=$.trim();if(Z.startsWith('"')&&Z.endsWith('"')||Z.startsWith("'")&&Z.endsWith("'"))return Z.slice(1,-1);if(!Z.startsWith("/")&&!Z.startsWith(".")&&!Z.startsWith("http")&&!Z.startsWith("{")){let X=Y[Z];if(X!==void 0)return X}if(Z.startsWith("{")||Z.startsWith("["))try{return JSON.parse(Z)}catch{}return Z}var Z6;var X6=b(()=>{G$();Y6();_$();Z6=iJ()});class m5{config;constructor($={}){this.config={...sJ,...$}}async get($,Y){return S5($,Y,"video",this.config)}async set($,Y,Z){return b5($,Y,Z,"video",this.config)}async clear(){return y5("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function M$($){if(!d5)d5=new m5($);else if($)d5.updateConfig($);return d5}async function u5($,Y,Z){let X=Z?{directory:`${Z.outputDir}/../.cache`}:{};return M$(X).get($,Y)}async function l5($,Y,Z,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return M$(Q).set($,Y,Z)}async function J6(){return M$().clear()}var sJ,d5=null;var I$=b(()=>{O$();sJ={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as E$,basename as D$,extname as k$,join as p5}from"path";import{mkdir as S$}from"fs/promises";async function b$(){try{return await import("ts-videos")}catch{return null}}async function c5($,Y,Z,X){let Q=await b$();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let J=E$($);if(!await L0(J))return null;await S$(Z,{recursive:!0});let G=await R0(J),K=D$($,k$($)),q=Y.format||"webp",_=Y.timestamp||0,U=`${K}-poster-${G}.${q}`,W=p5(Z,U),B=await Q.extractThumbnails(J,{timestamps:[_],width:Y.width||1280,height:Y.height,format:q,quality:Y.quality||85,outputDir:Z,outputPattern:U.replace(`.${q}`,"")});if(B&&B.length>0){let j=B[0];return{path:W,url:`${X}/${U}`,width:j.width||Y.width||1280,height:j.height||720,timestamp:_,size:j.size||0}}return null}catch(J){return console.warn(`[stx-media] Failed to generate poster: ${J}`),null}}async function i5($,Y,Z,X){let Q=await b$();if(!Q)return[];try{let J=E$($);if(!await L0(J))return[];await S$(Z,{recursive:!0});let G=await R0(J),K=D$($,k$($)),q=Y.format||"webp",W=(await new Q.Input(J).getInfo()).duration||60,B=Y.count||10,j=Y.interval||W/B,z=[];for(let L=0;L<B&&L*j<W;L++)z.push(L*j);let O=await Q.extractThumbnails(J,{timestamps:z,width:Y.width||320,format:q,quality:Y.quality||80,outputDir:Z,outputPattern:`${K}-thumb-${G}`});if(O&&O.length>0)return O.map((L,F)=>({path:L.path||p5(Z,`${K}-thumb-${G}-${F}.${q}`),url:`${X}/${K}-thumb-${G}-${F}.${q}`,width:L.width||Y.width||320,height:L.height||180,timestamp:z[F],size:L.size||0}));return[]}catch(J){return console.warn(`[stx-media] Failed to generate thumbnails: ${J}`),[]}}async function Q6($,Y,Z,X){let Q=await b$();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let J=E$($);if(!await L0(J))return null;await S$(Z,{recursive:!0});let G=await R0(J),K=D$($,k$($)),U=(await new Q.Input(J).getInfo()).duration||60,W=Y.columns||10,B=Y.interval||5,j=Y.thumbnailWidth||160,z=Y.thumbnailHeight||90,O=Y.format||"jpeg",L=Math.ceil(U/B),F=Math.ceil(L/W),H=`${K}-sprite-${G}.${O}`,V=p5(Z,H),N=[];for(let A=0;A<L;A++)N.push(A*B);let R=await Q.extractThumbnails(J,{timestamps:N,width:j,height:z,format:O,quality:Y.quality||70,outputDir:p5(Z,".temp")});if(!R||R.length===0)return null;try{let A=await import("ts-images"),w=W*j,T=F*z,I=await A.createSprite({images:R.map((M)=>M.path),columns:W,padding:0,outputPath:V,format:O,quality:Y.quality||70});return{url:`${X}/${H}`,path:V,columns:W,rows:F,thumbnailWidth:j,thumbnailHeight:z,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 y$=b(()=>{U1()});import{resolve as K6,basename as q6,extname as U6,join as _1}from"path";import{mkdir as n5,writeFile as _6}from"fs/promises";async function W6(){try{return await import("ts-videos")}catch{return null}}async function o5($,Y,Z,X,Q){let J=await W6();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=K6($);if(!await L0(G))return null;let K=await R0(G),q=q6($,U6($)),_=_1(Z,`${q}-${K}-hls`);await n5(_,{recursive:!0});let U=Y.length>0?Y:B6,W=Q?.segmentDuration||6,z=(await new J.Input(G).getInfo()).duration||0,O=[],L=0;for(let V of U){let N=_1(_,V.label);await n5(N,{recursive:!0});let R=`${V.label}.m3u8`,A=_1(N,R);try{let w=await J.generateHLS(G,{outputDir:N,segmentDuration:W,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(w)O.push({quality:V,url:`${X}/${q}-${K}-hls/${V.label}/${R}`,path:A}),L+=w.segmentCount||Math.ceil(z/W)}catch(w){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${w}`)}}if(O.length===0)return null;let F=_1(_,"master.m3u8"),H=rJ(O,X,q,K);return await _6(F,H),{manifestUrl:`${X}/${q}-${K}-hls/master.m3u8`,manifestPath:F,playlists:O,segmentCount:L,duration:z}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function rJ($,Y,Z,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(`
2114
- `)}async function s5($,Y,Z,X,Q){let J=await W6();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=K6($);if(!await L0(G))return null;let K=await R0(G),q=q6($,U6($)),_=_1(Z,`${q}-${K}-dash`);await n5(_,{recursive:!0});let U=Y.length>0?Y:B6,W=Q?.segmentDuration||4,B=Q?.minBufferTime||2,O=(await new J.Input(G).getInfo()).duration||0,L=[],F=[];for(let R of U){let A=_1(_,R.label);await n5(A,{recursive:!0});try{if(await J.generateDASH(G,{outputDir:A,segmentDuration:W,width:R.width,height:R.height,videoBitrate:R.bitrate,audioBitrate:R.audioBitrate})){if(L.push({bandwidth:R.bitrate,width:R.width,height:R.height||Math.round(R.width*9/16),url:`${X}/${q}-${K}-dash/${R.label}/video`}),R.audioBitrate)F.push({bandwidth:R.audioBitrate,url:`${X}/${q}-${K}-dash/${R.label}/audio`})}}catch(w){console.warn(`[stx-media] Failed to generate DASH for ${R.label}: ${w}`)}}if(L.length===0)return null;let H=_1(_,"manifest.mpd"),V=aJ(L,F,O,W,B);await _6(H,V);let N=[{type:"video",representations:L}];if(F.length>0)N.push({type:"audio",representations:F});return{manifestUrl:`${X}/${q}-${K}-dash/manifest.mpd`,manifestPath:H,adaptationSets:N,duration:O}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function aJ($,Y,Z,X,Q){let J=G6(Z),G=G6(Q),K=`<?xml version="1.0" encoding="UTF-8"?>
2114
+ <script>${_.script}</script>`;return U},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function rJ($,Y,Z){if(Y.src)return{src:String(Y.src),alt:String(Y.alt||""),options:Y.options||{}};let X=$.trim();if(X.startsWith("@img(")||X.startsWith("("))X=X.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=aJ(X),J=T$(Q[0],Z)||"",G=T$(Q[1],Z)||"",K={};if(Q[2]){let q=T$(Q[2],Z);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 aJ($){let Y=[],Z="",X=!1,Q="",J=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],_=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&_!=="\\"){if(!X)X=!0,Q=q;else if(q===Q)X=!1,Q="";else Z+=q;continue}if(!X){if(q==="{")J++;if(q==="}")J--;if(q==="[")G++;if(q==="]")G--;if(q===","&&J===0&&G===0){Y.push(Z.trim()),Z="";continue}}Z+=q}if(Z.trim())Y.push(Z.trim());return Y}function T$($,Y){if(typeof $!=="string")return $;let Z=$.trim();if(Z.startsWith('"')&&Z.endsWith('"')||Z.startsWith("'")&&Z.endsWith("'"))return Z.slice(1,-1);if(!Z.startsWith("/")&&!Z.startsWith(".")&&!Z.startsWith("http")&&!Z.startsWith("{")){let X=Y[Z];if(X!==void 0)return X}if(Z.startsWith("{")||Z.startsWith("["))try{return JSON.parse(Z)}catch{}return Z}var Z6;var X6=S(()=>{G$();Y6();_$();Z6=sJ()});class m5{config;constructor($={}){this.config={...tJ,...$}}async get($,Y){return b5($,Y,"video",this.config)}async set($,Y,Z){return S5($,Y,Z,"video",this.config)}async clear(){return y5("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function M$($){if(!d5)d5=new m5($);else if($)d5.updateConfig($);return d5}async function u5($,Y,Z){let X=Z?{directory:`${Z.outputDir}/../.cache`}:{};return M$(X).get($,Y)}async function l5($,Y,Z,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return M$(Q).set($,Y,Z)}async function J6(){return M$().clear()}var tJ,d5=null;var I$=S(()=>{O$();tJ={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as E$,basename as D$,extname as k$,join as p5}from"path";import{mkdir as b$}from"fs/promises";async function S$(){try{return await import("ts-videos")}catch{return null}}async function c5($,Y,Z,X){let Q=await S$();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let J=E$($);if(!await L0(J))return null;await b$(Z,{recursive:!0});let G=await R0(J),K=D$($,k$($)),q=Y.format||"webp",_=Y.timestamp||0,U=`${K}-poster-${G}.${q}`,W=p5(Z,U),B=await Q.extractThumbnails(J,{timestamps:[_],width:Y.width||1280,height:Y.height,format:q,quality:Y.quality||85,outputDir:Z,outputPattern:U.replace(`.${q}`,"")});if(B&&B.length>0){let j=B[0];return{path:W,url:`${X}/${U}`,width:j.width||Y.width||1280,height:j.height||720,timestamp:_,size:j.size||0}}return null}catch(J){return console.warn(`[stx-media] Failed to generate poster: ${J}`),null}}async function i5($,Y,Z,X){let Q=await S$();if(!Q)return[];try{let J=E$($);if(!await L0(J))return[];await b$(Z,{recursive:!0});let G=await R0(J),K=D$($,k$($)),q=Y.format||"webp",W=(await new Q.Input(J).getInfo()).duration||60,B=Y.count||10,j=Y.interval||W/B,z=[];for(let L=0;L<B&&L*j<W;L++)z.push(L*j);let O=await Q.extractThumbnails(J,{timestamps:z,width:Y.width||320,format:q,quality:Y.quality||80,outputDir:Z,outputPattern:`${K}-thumb-${G}`});if(O&&O.length>0)return O.map((L,F)=>({path:L.path||p5(Z,`${K}-thumb-${G}-${F}.${q}`),url:`${X}/${K}-thumb-${G}-${F}.${q}`,width:L.width||Y.width||320,height:L.height||180,timestamp:z[F],size:L.size||0}));return[]}catch(J){return console.warn(`[stx-media] Failed to generate thumbnails: ${J}`),[]}}async function Q6($,Y,Z,X){let Q=await S$();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let J=E$($);if(!await L0(J))return null;await b$(Z,{recursive:!0});let G=await R0(J),K=D$($,k$($)),U=(await new Q.Input(J).getInfo()).duration||60,W=Y.columns||10,B=Y.interval||5,j=Y.thumbnailWidth||160,z=Y.thumbnailHeight||90,O=Y.format||"jpeg",L=Math.ceil(U/B),F=Math.ceil(L/W),H=`${K}-sprite-${G}.${O}`,V=p5(Z,H),N=[];for(let A=0;A<L;A++)N.push(A*B);let R=await Q.extractThumbnails(J,{timestamps:N,width:j,height:z,format:O,quality:Y.quality||70,outputDir:p5(Z,".temp")});if(!R||R.length===0)return null;try{let A=await import("ts-images"),w=W*j,T=F*z,I=await A.createSprite({images:R.map((M)=>M.path),columns:W,padding:0,outputPath:V,format:O,quality:Y.quality||70});return{url:`${X}/${H}`,path:V,columns:W,rows:F,thumbnailWidth:j,thumbnailHeight:z,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 y$=S(()=>{U1()});import{resolve as K6,basename as q6,extname as U6,join as _1}from"path";import{mkdir as n5,writeFile as _6}from"fs/promises";async function W6(){try{return await import("ts-videos")}catch{return null}}async function o5($,Y,Z,X,Q){let J=await W6();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=K6($);if(!await L0(G))return null;let K=await R0(G),q=q6($,U6($)),_=_1(Z,`${q}-${K}-hls`);await n5(_,{recursive:!0});let U=Y.length>0?Y:B6,W=Q?.segmentDuration||6,z=(await new J.Input(G).getInfo()).duration||0,O=[],L=0;for(let V of U){let N=_1(_,V.label);await n5(N,{recursive:!0});let R=`${V.label}.m3u8`,A=_1(N,R);try{let w=await J.generateHLS(G,{outputDir:N,segmentDuration:W,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(w)O.push({quality:V,url:`${X}/${q}-${K}-hls/${V.label}/${R}`,path:A}),L+=w.segmentCount||Math.ceil(z/W)}catch(w){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${w}`)}}if(O.length===0)return null;let F=_1(_,"master.m3u8"),H=eJ(O,X,q,K);return await _6(F,H),{manifestUrl:`${X}/${q}-${K}-hls/master.m3u8`,manifestPath:F,playlists:O,segmentCount:L,duration:z}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function eJ($,Y,Z,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(`
2115
+ `)}async function s5($,Y,Z,X,Q){let J=await W6();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=K6($);if(!await L0(G))return null;let K=await R0(G),q=q6($,U6($)),_=_1(Z,`${q}-${K}-dash`);await n5(_,{recursive:!0});let U=Y.length>0?Y:B6,W=Q?.segmentDuration||4,B=Q?.minBufferTime||2,O=(await new J.Input(G).getInfo()).duration||0,L=[],F=[];for(let R of U){let A=_1(_,R.label);await n5(A,{recursive:!0});try{if(await J.generateDASH(G,{outputDir:A,segmentDuration:W,width:R.width,height:R.height,videoBitrate:R.bitrate,audioBitrate:R.audioBitrate})){if(L.push({bandwidth:R.bitrate,width:R.width,height:R.height||Math.round(R.width*9/16),url:`${X}/${q}-${K}-dash/${R.label}/video`}),R.audioBitrate)F.push({bandwidth:R.audioBitrate,url:`${X}/${q}-${K}-dash/${R.label}/audio`})}}catch(w){console.warn(`[stx-media] Failed to generate DASH for ${R.label}: ${w}`)}}if(L.length===0)return null;let H=_1(_,"manifest.mpd"),V=$Q(L,F,O,W,B);await _6(H,V);let N=[{type:"video",representations:L}];if(F.length>0)N.push({type:"audio",representations:F});return{manifestUrl:`${X}/${q}-${K}-dash/manifest.mpd`,manifestPath:H,adaptationSets:N,duration:O}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function $Q($,Y,Z,X,Q){let J=G6(Z),G=G6(Q),K=`<?xml version="1.0" encoding="UTF-8"?>
2115
2116
  <MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
2116
2117
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2117
2118
  xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
@@ -2137,11 +2138,11 @@ ${R.join(`
2137
2138
  </Representation>
2138
2139
  `}K+=` </AdaptationSet>
2139
2140
  `}return K+=` </Period>
2140
- </MPD>`,K}function G6($){let Y=Math.floor($/3600),Z=Math.floor($%3600/60),X=Math.floor($%60),Q="PT";if(Y>0)Q+=`${Y}H`;if(Z>0)Q+=`${Z}M`;return Q+=`${X}S`,Q}var B6;var P$=b(()=>{U1();B6=[{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 z6,basename as tJ,extname as eJ,join as $Q}from"path";import{mkdir as YQ}from"fs/promises";async function j6(){try{return await import("ts-videos")}catch{return null}}function ZQ($){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 XQ($){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 C$($){let Y=await j6();if(!Y)return null;try{let Z=z6($),Q=await new Y.Input(Z).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(Z){return console.warn(`[stx-media] Failed to analyze video: ${Z}`),null}}async function O6($,Y,Z,X){let Q=await j6();if(!Q)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let J=await u5($,Y,Z);if(J)return J;try{let G=z6($);if(!await L0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Z.outputDir||"dist/videos",q=Z.baseUrl||"/videos";await YQ(K,{recursive:!0});let _=await R0(G),U=tJ($,eJ($)),W={src:$,processed:!0,hash:_};X?.({percentage:5,stage:"analyzing"}),W.metadata=await C$(G)||void 0;let B={};if(Y.quality)B.bitrate=ZQ(Y.quality);if(Y.platform)Object.assign(B,XQ(Y.platform));if(Y.transcode)Object.assign(B,Y.transcode);if(Object.keys(B).length>0||Y.process){X?.({percentage:10,stage:"transcoding"});let j=`${U}-${_}.mp4`,z=$Q(K,j);try{let O=await JQ(G,z,B,Q,(L)=>X?.({percentage:10+L*0.5,stage:"transcoding"}));if(O)W.transcoded={path:z,url:`${q}/${j}`,duration:O.duration,size:O.size,video:{codec:B.codec||"h264",width:O.width,height:O.height,bitrate:O.bitrate,frameRate:O.frameRate},audio:O.audioCodec?{codec:B.audioCodec||"aac",bitrate:B.audioBitrate||128000,sampleRate:B.sampleRate||48000,channels:B.channels||2}:void 0}}catch(O){W.errors=W.errors||[],W.errors.push(`Transcoding failed: ${O}`)}}if(Y.generatePoster){X?.({percentage:65,stage:"generating-poster"});let j=typeof Y.generatePoster==="object"?Y.generatePoster:{timestamp:0},z=await c5(G,j,K,q);if(z)W.poster=z}if(Z.thumbnails?.enabled){X?.({percentage:70,stage:"generating-thumbnails"});let j=await i5(G,Z.thumbnails,K,q);if(j.length>0)W.thumbnails=j}if(Y.streaming){X?.({percentage:80,stage:"generating-manifests"});let j=typeof Y.streaming==="object"?Y.streaming:Z.streaming||{format:"hls"};if(j.format==="hls"||j.format===void 0){let z=await o5(G,j.qualities||Z.streaming?.defaultQualities||[],K,q);if(z)W.streaming={...W.streaming,hls:z}}if(j.format==="dash"){let z=await s5(G,j.qualities||Z.streaming?.defaultQualities||[],K,q);if(z)W.streaming={...W.streaming,dash:z}}}if(Y.spriteSheet)X?.({percentage:90,stage:"generating-sprite-sheet"});return X?.({percentage:100,stage:"complete"}),await l5($,Y,W,Z),W}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function JQ($,Y,Z,X,Q){try{let G=await new X.Conversion($,Y,{videoCodec:Z.codec,videoBitrate:Z.bitrate,width:Z.maxWidth,height:Z.maxHeight,frameRate:Z.frameRate,audioCodec:Z.audioCodec,audioBitrate:Z.audioBitrate,sampleRate:Z.sampleRate,channels:Z.channels}).run((K)=>{Q?.(K.percentage/100)});return{duration:G.duration||0,size:G.size||0,width:G.width||Z.maxWidth||0,height:G.height||Z.maxHeight||0,bitrate:G.bitrate||Z.bitrate||0,frameRate:G.frameRate||Z.frameRate||30,audioCodec:G.audioCodec}}catch(J){return console.error(`[stx-media] Transcoding failed: ${J}`),null}}var H6=b(()=>{U1();I$();y$();P$()});var L6={};r(L6,{setCachedVideoResult:()=>l5,processVideo:()=>O6,getCachedVideoResult:()=>u5,generateThumbnails:()=>i5,generateSpriteSheet:()=>Q6,generatePoster:()=>c5,generateHLSManifest:()=>o5,generateDASHManifest:()=>s5,clearVideoCache:()=>J6,analyzeVideo:()=>C$,VideoProcessorCache:()=>m5});var F6=b(()=>{H6();y$();P$();I$()});async function R6(){try{return await Promise.resolve().then(() => (F6(),L6))}catch($){if(!V6)console.warn("[stx-media] Video processor not available, some features disabled:",$),V6=!0;return null}}async function r5($,Y={}){let Z=Y,X=$;if(X.process&&!X.skipProcessing){if(Z.tsVideosConfig?.enabled&&!Z.isDev)return _Q(X,Z)}if(Z.processedResult?.processed)return T6($,Z.processedResult,Y);let Q;if(X.generatePoster&&X.src&&!$.poster)Q=await WQ(X,Z);let{src:J,sources:G=[],poster:K,posterPlaceholder:q,controls:_=N6,autoplay:U=!1,muted:W=!1,loop:B=!1,preload:j=A6,playsinline:z=!0,lazy:O=!0,player:L="native",type:F,width:H,height:V,crossorigin:N,disablePictureInPicture:R=!1,disableRemotePlayback:A=!1}=$,w=Q||K,T=$.class,I=$.style,M=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(L==="ts-video")return KQ($,Y);if(F&&F!=="video")return GQ(J||"",F,$);let E=G.length>0?G:J?[{src:J,type:w6(J)}]:[],D=[`id="${M}"`];if(_)D.push("controls");if(U)D.push("autoplay");if(W)D.push("muted");if(B)D.push("loop");if(z)D.push("playsinline");if(R)D.push("disablepictureinpicture");if(A)D.push("disableremoteplayback");if(N)D.push(`crossorigin="${N}"`);if(O){if(D.push(`data-preload="${j}"`),D.push('preload="none"'),w)D.push(`data-poster="${W0(w)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${j}"`),w)D.push(`poster="${W0(w)}"`);if(H)D.push(`width="${H}"`);if(V)D.push(`height="${V}"`);if(T)D.push(`class="${W0(T)}"`);if(I)D.push(`style="${W0(I)}"`);let P=E.map((k)=>{return` <source ${O?`data-src="${W0(k.src)}"`:`src="${W0(k.src)}"`} type="${k.type}"${k.media?` media="${k.media}"`:""} />`}).join(`
2141
+ </MPD>`,K}function G6($){let Y=Math.floor($/3600),Z=Math.floor($%3600/60),X=Math.floor($%60),Q="PT";if(Y>0)Q+=`${Y}H`;if(Z>0)Q+=`${Z}M`;return Q+=`${X}S`,Q}var B6;var P$=S(()=>{U1();B6=[{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 z6,basename as YQ,extname as ZQ,join as XQ}from"path";import{mkdir as JQ}from"fs/promises";async function j6(){try{return await import("ts-videos")}catch{return null}}function QQ($){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 GQ($){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 C$($){let Y=await j6();if(!Y)return null;try{let Z=z6($),Q=await new Y.Input(Z).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(Z){return console.warn(`[stx-media] Failed to analyze video: ${Z}`),null}}async function O6($,Y,Z,X){let Q=await j6();if(!Q)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let J=await u5($,Y,Z);if(J)return J;try{let G=z6($);if(!await L0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Z.outputDir||"dist/videos",q=Z.baseUrl||"/videos";await JQ(K,{recursive:!0});let _=await R0(G),U=YQ($,ZQ($)),W={src:$,processed:!0,hash:_};X?.({percentage:5,stage:"analyzing"}),W.metadata=await C$(G)||void 0;let B={};if(Y.quality)B.bitrate=QQ(Y.quality);if(Y.platform)Object.assign(B,GQ(Y.platform));if(Y.transcode)Object.assign(B,Y.transcode);if(Object.keys(B).length>0||Y.process){X?.({percentage:10,stage:"transcoding"});let j=`${U}-${_}.mp4`,z=XQ(K,j);try{let O=await KQ(G,z,B,Q,(L)=>X?.({percentage:10+L*0.5,stage:"transcoding"}));if(O)W.transcoded={path:z,url:`${q}/${j}`,duration:O.duration,size:O.size,video:{codec:B.codec||"h264",width:O.width,height:O.height,bitrate:O.bitrate,frameRate:O.frameRate},audio:O.audioCodec?{codec:B.audioCodec||"aac",bitrate:B.audioBitrate||128000,sampleRate:B.sampleRate||48000,channels:B.channels||2}:void 0}}catch(O){W.errors=W.errors||[],W.errors.push(`Transcoding failed: ${O}`)}}if(Y.generatePoster){X?.({percentage:65,stage:"generating-poster"});let j=typeof Y.generatePoster==="object"?Y.generatePoster:{timestamp:0},z=await c5(G,j,K,q);if(z)W.poster=z}if(Z.thumbnails?.enabled){X?.({percentage:70,stage:"generating-thumbnails"});let j=await i5(G,Z.thumbnails,K,q);if(j.length>0)W.thumbnails=j}if(Y.streaming){X?.({percentage:80,stage:"generating-manifests"});let j=typeof Y.streaming==="object"?Y.streaming:Z.streaming||{format:"hls"};if(j.format==="hls"||j.format===void 0){let z=await o5(G,j.qualities||Z.streaming?.defaultQualities||[],K,q);if(z)W.streaming={...W.streaming,hls:z}}if(j.format==="dash"){let z=await s5(G,j.qualities||Z.streaming?.defaultQualities||[],K,q);if(z)W.streaming={...W.streaming,dash:z}}}if(Y.spriteSheet)X?.({percentage:90,stage:"generating-sprite-sheet"});return X?.({percentage:100,stage:"complete"}),await l5($,Y,W,Z),W}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function KQ($,Y,Z,X,Q){try{let G=await new X.Conversion($,Y,{videoCodec:Z.codec,videoBitrate:Z.bitrate,width:Z.maxWidth,height:Z.maxHeight,frameRate:Z.frameRate,audioCodec:Z.audioCodec,audioBitrate:Z.audioBitrate,sampleRate:Z.sampleRate,channels:Z.channels}).run((K)=>{Q?.(K.percentage/100)});return{duration:G.duration||0,size:G.size||0,width:G.width||Z.maxWidth||0,height:G.height||Z.maxHeight||0,bitrate:G.bitrate||Z.bitrate||0,frameRate:G.frameRate||Z.frameRate||30,audioCodec:G.audioCodec}}catch(J){return console.error(`[stx-media] Transcoding failed: ${J}`),null}}var H6=S(()=>{U1();I$();y$();P$()});var L6={};r(L6,{setCachedVideoResult:()=>l5,processVideo:()=>O6,getCachedVideoResult:()=>u5,generateThumbnails:()=>i5,generateSpriteSheet:()=>Q6,generatePoster:()=>c5,generateHLSManifest:()=>o5,generateDASHManifest:()=>s5,clearVideoCache:()=>J6,analyzeVideo:()=>C$,VideoProcessorCache:()=>m5});var F6=S(()=>{H6();y$();P$();I$()});async function R6(){try{return await Promise.resolve().then(() => (F6(),L6))}catch($){if(!V6)console.warn("[stx-media] Video processor not available, some features disabled:",$),V6=!0;return null}}async function r5($,Y={}){let Z=Y,X=$;if(X.process&&!X.skipProcessing){if(Z.tsVideosConfig?.enabled&&!Z.isDev)return zQ(X,Z)}if(Z.processedResult?.processed)return T6($,Z.processedResult,Y);let Q;if(X.generatePoster&&X.src&&!$.poster)Q=await jQ(X,Z);let{src:J,sources:G=[],poster:K,posterPlaceholder:q,controls:_=N6,autoplay:U=!1,muted:W=!1,loop:B=!1,preload:j=A6,playsinline:z=!0,lazy:O=!0,player:L="native",type:F,width:H,height:V,crossorigin:N,disablePictureInPicture:R=!1,disableRemotePlayback:A=!1}=$,w=Q||K,T=$.class,I=$.style,M=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(L==="ts-video")return _Q($,Y);if(F&&F!=="video")return UQ(J||"",F,$);let E=G.length>0?G:J?[{src:J,type:w6(J)}]:[],D=[`id="${M}"`];if(_)D.push("controls");if(U)D.push("autoplay");if(W)D.push("muted");if(B)D.push("loop");if(z)D.push("playsinline");if(R)D.push("disablepictureinpicture");if(A)D.push("disableremoteplayback");if(N)D.push(`crossorigin="${N}"`);if(O){if(D.push(`data-preload="${j}"`),D.push('preload="none"'),w)D.push(`data-poster="${W0(w)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${j}"`),w)D.push(`poster="${W0(w)}"`);if(H)D.push(`width="${H}"`);if(V)D.push(`height="${V}"`);if(T)D.push(`class="${W0(T)}"`);if(I)D.push(`style="${W0(I)}"`);let P=E.map((k)=>{return` <source ${O?`data-src="${W0(k.src)}"`:`src="${W0(k.src)}"`} type="${k.type}"${k.media?` media="${k.media}"`:""} />`}).join(`
2141
2142
  `),y=`<video ${D.join(" ")}>
2142
2143
  ${P}
2143
2144
  Your browser does not support the video tag.
2144
- </video>`,S;if(O)S=`
2145
+ </video>`,b;if(O)b=`
2145
2146
  (function() {
2146
2147
  var video = document.getElementById('${M}');
2147
2148
  if (!video) return;
@@ -2176,9 +2177,9 @@ ${P}
2176
2177
 
2177
2178
  observer.observe(video);
2178
2179
  })();
2179
- `.trim();return{html:y,script:S}}function GQ($,Y,Z){let{width:X=640,height:Q=360}=Z,J=Z.class,G=Z.style,K=Z.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,_=null;switch(Y){case"youtube":_=qQ($),q=_?`https://www.youtube-nocookie.com/embed/${_}`:$;break;case"vimeo":_=UQ($),q=_?`https://player.vimeo.com/video/${_}`:$;break;case"dailymotion":_=$.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${_}`;break;case"twitch":_=$.split("/").pop()||"",q=`https://player.twitch.tv/?video=${_}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=$}let U=[`id="${K}"`,`src="${W0(q)}"`,`width="${X}"`,`height="${Q}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(J)U.push(`class="${W0(J)}"`);if(G)U.push(`style="${W0(G)}"`);if(Z.lazy)U.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
2180
+ `.trim();return{html:y,script:b}}function UQ($,Y,Z){let{width:X=640,height:Q=360}=Z,J=Z.class,G=Z.style,K=Z.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,_=null;switch(Y){case"youtube":_=WQ($),q=_?`https://www.youtube-nocookie.com/embed/${_}`:$;break;case"vimeo":_=BQ($),q=_?`https://player.vimeo.com/video/${_}`:$;break;case"dailymotion":_=$.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${_}`;break;case"twitch":_=$.split("/").pop()||"",q=`https://player.twitch.tv/?video=${_}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=$}let U=[`id="${K}"`,`src="${W0(q)}"`,`width="${X}"`,`height="${Q}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(J)U.push(`class="${W0(J)}"`);if(G)U.push(`style="${W0(G)}"`);if(Z.lazy)U.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
2180
2181
  <iframe ${U.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
2181
- </div>`}}function KQ($,Y={}){let{src:Z,sources:X=[],poster:Q,controls:J=!0,autoplay:G=!1,muted:K=!1,loop:q=!1,preload:_="metadata",playsinline:U=!0,lazy:W=!0,width:B,height:j}=$,z=$.class,O=$.style,L=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,F={src:X.length>0?X:Z,autoplay:G,loop:q,muted:K,playsinline:U,preload:_,poster:Q,controls:J,title:$.title},H=["position: relative",B?`width: ${typeof B==="number"?B+"px":B}`:"width: 100%",j?`height: ${typeof j==="number"?j+"px":j}`:"",O||""].filter(Boolean).join("; "),V=`
2182
+ </div>`}}function _Q($,Y={}){let{src:Z,sources:X=[],poster:Q,controls:J=!0,autoplay:G=!1,muted:K=!1,loop:q=!1,preload:_="metadata",playsinline:U=!0,lazy:W=!0,width:B,height:j}=$,z=$.class,O=$.style,L=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,F={src:X.length>0?X:Z,autoplay:G,loop:q,muted:K,playsinline:U,preload:_,poster:Q,controls:J,title:$.title},H=["position: relative",B?`width: ${typeof B==="number"?B+"px":B}`:"width: 100%",j?`height: ${typeof j==="number"?j+"px":j}`:"",O||""].filter(Boolean).join("; "),V=`
2182
2183
  <div
2183
2184
  id="${L}"
2184
2185
  class="ts-video-player${z?" "+W0(z):""}"
@@ -2215,7 +2216,7 @@ ${P}
2215
2216
 
2216
2217
  // Load ts-video-player from CDN
2217
2218
  var script = document.createElement('script');
2218
- script.src = '${QQ}';
2219
+ script.src = '${qQ}';
2219
2220
  script.onload = initPlayer;
2220
2221
  script.onerror = function() {
2221
2222
  console.error('[stx] Failed to load ts-video-player');
@@ -2345,7 +2346,7 @@ else {
2345
2346
  .ts-video-player__play-button svg {
2346
2347
  margin-left: 4px;
2347
2348
  }
2348
- `.trim();return{html:V,script:N,css:R}}function w6($){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 qQ($){let Y=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Z of Y){let X=$.match(Z);if(X)return X[1]}return null}function UQ($){let Y=$.match(/vimeo\.com\/(\d+)/);return Y?Y[1]:null}function W0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function _Q($,Y){let Z=await R6();if(!Z)return r5({...$,process:!1},Y);let X=Y.tsVideosConfig,Q=await Z.processVideo($.src,$,X,$.onProcessProgress);if(Q.processed)return T6($,Q,Y);return r5({...$,process:!1},Y)}async function WQ($,Y){let Z=await R6();if(!Z||!$.src)return;let X=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Q=Y.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Z.generatePoster($.src,X,Q.outputDir,Q.baseUrl||"/videos"))?.url}function T6($,Y,Z){let{controls:X=N6,autoplay:Q=!1,muted:J=!1,loop:G=!1,preload:K=A6,playsinline:q=!0,lazy:_=!0,width:U,height:W,crossorigin:B,disablePictureInPicture:j=!1,disableRemotePlayback:z=!1}=$,O=$.class,L=$.style,F=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,H=$.src,V=w6(H);if(Y.transcoded)H=Y.transcoded.url,V="video/mp4";let N=Y.streaming?.hls||Y.streaming?.dash;if(N){if(Y.streaming?.hls)H=Y.streaming.hls.manifestUrl,V="application/x-mpegURL";else if(Y.streaming?.dash)H=Y.streaming.dash.manifestUrl,V="application/dash+xml"}let R=Y.poster?.url||$.poster,A=[`id="${F}"`];if(X)A.push("controls");if(Q)A.push("autoplay");if(J)A.push("muted");if(G)A.push("loop");if(q)A.push("playsinline");if(j)A.push("disablepictureinpicture");if(z)A.push("disableremoteplayback");if(B)A.push(`crossorigin="${B}"`);if(_){if(A.push(`data-preload="${K}"`),A.push('preload="none"'),R)A.push(`data-poster="${W0(R)}"`);A.push("data-stx-lazy")}else if(A.push(`preload="${K}"`),R)A.push(`poster="${W0(R)}"`);let w=U||Y.metadata?.width,T=W||Y.metadata?.height;if(w)A.push(`width="${w}"`);if(T)A.push(`height="${T}"`);if(O)A.push(`class="${W0(O)}"`);if(L)A.push(`style="${W0(L)}"`);let M=` <source ${_?`data-src="${W0(H)}"`:`src="${W0(H)}"`} type="${V}" />`,E=`<video ${A.join(" ")}>
2349
+ `.trim();return{html:V,script:N,css:R}}function w6($){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 WQ($){let Y=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Z of Y){let X=$.match(Z);if(X)return X[1]}return null}function BQ($){let Y=$.match(/vimeo\.com\/(\d+)/);return Y?Y[1]:null}function W0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function zQ($,Y){let Z=await R6();if(!Z)return r5({...$,process:!1},Y);let X=Y.tsVideosConfig,Q=await Z.processVideo($.src,$,X,$.onProcessProgress);if(Q.processed)return T6($,Q,Y);return r5({...$,process:!1},Y)}async function jQ($,Y){let Z=await R6();if(!Z||!$.src)return;let X=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Q=Y.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Z.generatePoster($.src,X,Q.outputDir,Q.baseUrl||"/videos"))?.url}function T6($,Y,Z){let{controls:X=N6,autoplay:Q=!1,muted:J=!1,loop:G=!1,preload:K=A6,playsinline:q=!0,lazy:_=!0,width:U,height:W,crossorigin:B,disablePictureInPicture:j=!1,disableRemotePlayback:z=!1}=$,O=$.class,L=$.style,F=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,H=$.src,V=w6(H);if(Y.transcoded)H=Y.transcoded.url,V="video/mp4";let N=Y.streaming?.hls||Y.streaming?.dash;if(N){if(Y.streaming?.hls)H=Y.streaming.hls.manifestUrl,V="application/x-mpegURL";else if(Y.streaming?.dash)H=Y.streaming.dash.manifestUrl,V="application/dash+xml"}let R=Y.poster?.url||$.poster,A=[`id="${F}"`];if(X)A.push("controls");if(Q)A.push("autoplay");if(J)A.push("muted");if(G)A.push("loop");if(q)A.push("playsinline");if(j)A.push("disablepictureinpicture");if(z)A.push("disableremoteplayback");if(B)A.push(`crossorigin="${B}"`);if(_){if(A.push(`data-preload="${K}"`),A.push('preload="none"'),R)A.push(`data-poster="${W0(R)}"`);A.push("data-stx-lazy")}else if(A.push(`preload="${K}"`),R)A.push(`poster="${W0(R)}"`);let w=U||Y.metadata?.width,T=W||Y.metadata?.height;if(w)A.push(`width="${w}"`);if(T)A.push(`height="${T}"`);if(O)A.push(`class="${W0(O)}"`);if(L)A.push(`style="${W0(L)}"`);let M=` <source ${_?`data-src="${W0(H)}"`:`src="${W0(H)}"`} type="${V}" />`,E=`<video ${A.join(" ")}>
2349
2350
  ${M}
2350
2351
  Your browser does not support the video tag.
2351
2352
  </video>`;if(Y.spriteSheet)E=`<div class="stx-video-wrapper" data-sprite-sheet="${W0(Y.spriteSheet.url)}" data-sprite-cols="${Y.spriteSheet.columns}" data-sprite-interval="${Y.spriteSheet.interval}">
@@ -2394,9 +2395,9 @@ ${E}
2394
2395
  width: 100%;
2395
2396
  height: auto;
2396
2397
  }
2397
- `.trim();return{html:E,script:D,css:P}}var V6=!1,N6=!0,A6="metadata",QQ="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var M6=b(()=>{x$()});function I6(){return D5({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Y,Z,X)=>{let{src:Q,options:J}=BQ($,Y,Z);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:Z.__isDev||!1,tsVideosConfig:Z.__tsVideosConfig},_=await r5(G,q),U=_.html;if(_.css)U+=`
2398
+ `.trim();return{html:E,script:D,css:P}}var V6=!1,N6=!0,A6="metadata",qQ="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var M6=S(()=>{x$()});function I6(){return D5({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Y,Z,X)=>{let{src:Q,options:J}=OQ($,Y,Z);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:Z.__isDev||!1,tsVideosConfig:Z.__tsVideosConfig},_=await r5(G,q),U=_.html;if(_.css)U+=`
2398
2399
  <style>${_.css}</style>`;if(_.script)U+=`
2399
- <script>${_.script}</script>`;return U},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function BQ($,Y,Z){if(Y.src)return{src:String(Y.src),options:Y.options||{}};let X=$.trim();if(X.startsWith("@video(")||X.startsWith("("))X=X.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=zQ(X),J=E6(Q[0],Z)||"",G={};if(Q[1]){let K=E6(Q[1],Z);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 zQ($){let Y=[],Z="",X=!1,Q="",J=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],_=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&_!=="\\"){if(!X)X=!0,Q=q;else if(q===Q)X=!1,Q="";else Z+=q;continue}if(!X){if(q==="{")J++;if(q==="}")J--;if(q==="[")G++;if(q==="]")G--;if(q===","&&J===0&&G===0){Y.push(Z.trim()),Z="";continue}}Z+=q}if(Z.trim())Y.push(Z.trim());return Y}function E6($,Y){if(typeof $!=="string")return $;let Z=$.trim();if(Z.startsWith('"')&&Z.endsWith('"')||Z.startsWith("'")&&Z.endsWith("'"))return Z.slice(1,-1);if(!Z.startsWith("/")&&!Z.startsWith(".")&&!Z.startsWith("http")&&!Z.startsWith("{")){let X=Y[Z];if(X!==void 0)return X}if(Z.startsWith("{")||Z.startsWith("["))try{return JSON.parse(Z)}catch{}return Z}var v$;var x$=b(()=>{G$();M6();v$=I6()});function jQ($,Y){let Z=Y.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
2400
+ <script>${_.script}</script>`;return U},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function OQ($,Y,Z){if(Y.src)return{src:String(Y.src),options:Y.options||{}};let X=$.trim();if(X.startsWith("@video(")||X.startsWith("("))X=X.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=HQ(X),J=E6(Q[0],Z)||"",G={};if(Q[1]){let K=E6(Q[1],Z);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 HQ($){let Y=[],Z="",X=!1,Q="",J=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],_=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&_!=="\\"){if(!X)X=!0,Q=q;else if(q===Q)X=!1,Q="";else Z+=q;continue}if(!X){if(q==="{")J++;if(q==="}")J--;if(q==="[")G++;if(q==="]")G--;if(q===","&&J===0&&G===0){Y.push(Z.trim()),Z="";continue}}Z+=q}if(Z.trim())Y.push(Z.trim());return Y}function E6($,Y){if(typeof $!=="string")return $;let Z=$.trim();if(Z.startsWith('"')&&Z.endsWith('"')||Z.startsWith("'")&&Z.endsWith("'"))return Z.slice(1,-1);if(!Z.startsWith("/")&&!Z.startsWith(".")&&!Z.startsWith("http")&&!Z.startsWith("{")){let X=Y[Z];if(X!==void 0)return X}if(Z.startsWith("{")||Z.startsWith("["))try{return JSON.parse(Z)}catch{}return Z}var v$;var x$=S(()=>{G$();M6();v$=I6()});function LQ($,Y){let Z=Y.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
2400
2401
  ${$}
2401
2402
  </div>
2402
2403
  <script>
@@ -2441,7 +2442,7 @@ ${E}
2441
2442
  }
2442
2443
  }
2443
2444
  })();
2444
- </script>`}function OQ($,Y){let Z=Y.pwa?.updates,X=Z?.message||"A new version is available. Reload to update?",Q=Z?.autoReload||!1,J=$.trim().length>0,G=`
2445
+ </script>`}function FQ($,Y){let Z=Y.pwa?.updates,X=Z?.message||"A new version is available. Reload to update?",Q=Z?.autoReload||!1,J=$.trim().length>0,G=`
2445
2446
  <div class="stx-pwa-update-banner" style="
2446
2447
  position: fixed;
2447
2448
  bottom: 0;
@@ -2552,7 +2553,7 @@ else {
2552
2553
  // Also listen for custom event
2553
2554
  window.addEventListener('pwa-update-available', showUpdate);
2554
2555
  })();
2555
- </script>`}function HQ($,Y){let Z=$.trim().length>0,X=`
2556
+ </script>`}function VQ($,Y){let Z=$.trim().length>0,X=`
2556
2557
  <div class="stx-offline-indicator" style="
2557
2558
  position: fixed;
2558
2559
  top: 16px;
@@ -2613,7 +2614,7 @@ else {
2613
2614
  window.addEventListener('offline', updateStatus);
2614
2615
  updateStatus();
2615
2616
  })();
2616
- </script>`}function LQ($,Y){let Z=Y.pwa?.push,X=Z?.vapidPublicKey||"",Q=Z?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
2617
+ </script>`}function RQ($,Y){let Z=Y.pwa?.push,X=Z?.vapidPublicKey||"",Q=Z?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
2617
2618
  ${$}
2618
2619
  </div>
2619
2620
  <script>
@@ -2695,33 +2696,33 @@ catch (error) {
2695
2696
  init();
2696
2697
  }
2697
2698
  })();
2698
- </script>`}function zB($){return[...$,...f$]}var FQ,VQ,RQ,NQ,f$;var g$=b(()=>{FQ={name:"pwa.installButton",handler:($,Y,Z,X)=>{let Q=Z.__stx_options||{};return jQ($,Q)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},VQ={name:"pwa.updatePrompt",handler:($,Y,Z,X)=>{let Q=Z.__stx_options||{};return OQ($,Q)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},RQ={name:"pwa.offlineIndicator",handler:($,Y,Z,X)=>{let Q=Z.__stx_options||{};return HQ($,Q)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},NQ={name:"pwa.pushSubscribe",handler:($,Y,Z,X)=>{let Q=Z.__stx_options||{};return LQ($,Q)},hasEndTag:!0,description:"Renders a push notification subscription button"},f$=[FQ,VQ,RQ,NQ]});function h$($){for(let[Y,Z]of Object.entries(l))if(Z===$)return Y;return}var l;var a5=b(()=>{l={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 AQ(){return!1}function e1(){return!AQ()||process.env.STX_DEBUG==="true"}import wQ from"path";function t5(){return{...d$}}function e5($){if(!d$.showRelativePaths||!$)return $;let Y=d$.baseDir||process.cwd();try{let Z=wQ.relative(Y,$);return Z.startsWith("..")?$:Z}catch{return $}}var TQ,d$,$9,W1,Y9;var Z9=b(()=>{a5();TQ={showRelativePaths:!1,enableAutoRecovery:e1(),logRecoveryWarnings:!0},d$={...TQ};$9=class $9 extends Error{code;filePath;line;column;context;numericCode;constructor($,Y,Z,X,Q,J,G){super($);this.code=Y;this.filePath=Z;this.line=X;this.column=Q;this.context=J;if(this.name="StxError",this.numericCode=G||l.EVALUATION_ERROR,this.filePath)this.filePath=e5(this.filePath)}};W1=class W1 extends $9{constructor($,Y,Z,X,Q,J){super($,"stx_RUNTIME_ERROR",Y,Z,X,Q,J||l.EVALUATION_ERROR);this.name="StxRuntimeError"}};Y9=class Y9 extends $9{isFatal=!0;constructor($,Y,Z,X,Q,J){super($,"stx_VALIDATION_ERROR",Y,Z,X,Q,J||l.DOM_API_VIOLATION);this.name="StxValidationError"}}});function k6($){let{type:Y,message:Z,code:X,filePath:Q,line:J,column:G,template:K,offset:q,snippet:_,suggestion:U,format:W="text"}=$,B=J,j=G;if(!B&&K&&q!==void 0){let H=SQ(K,q);B=H.line,j=H.column}let z=Q?e5(Q):void 0,O=X?h$(X):void 0,L={type:Y,code:X,codeName:O,message:Z,filePath:z,line:B,column:j,snippet:_,suggestion:U,timestamp:new Date().toISOString()},F;switch(W){case"html":F=IQ(L);break;case"json":F=JSON.stringify(L,null,2);break;case"console":F=EQ(L,K,q);break;case"text":default:F=MQ(L,K,q);break}return{formatted:F,data:L}}function MQ($,Y,Z){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(`
2699
- ${$.message}`),Y&&$.line){let J=DQ(Y,$.line,2);if(J)X.push(`
2699
+ </script>`}function LB($){return[...$,...f$]}var NQ,AQ,wQ,TQ,f$;var g$=S(()=>{NQ={name:"pwa.installButton",handler:($,Y,Z,X)=>{let Q=Z.__stx_options||{};return LQ($,Q)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},AQ={name:"pwa.updatePrompt",handler:($,Y,Z,X)=>{let Q=Z.__stx_options||{};return FQ($,Q)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},wQ={name:"pwa.offlineIndicator",handler:($,Y,Z,X)=>{let Q=Z.__stx_options||{};return VQ($,Q)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},TQ={name:"pwa.pushSubscribe",handler:($,Y,Z,X)=>{let Q=Z.__stx_options||{};return RQ($,Q)},hasEndTag:!0,description:"Renders a push notification subscription button"},f$=[NQ,AQ,wQ,TQ]});function h$($){for(let[Y,Z]of Object.entries(l))if(Z===$)return Y;return}var l;var a5=S(()=>{l={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 MQ(){return!1}function e1(){return!MQ()||process.env.STX_DEBUG==="true"}import IQ from"path";function t5(){return{...d$}}function e5($){if(!d$.showRelativePaths||!$)return $;let Y=d$.baseDir||process.cwd();try{let Z=IQ.relative(Y,$);return Z.startsWith("..")?$:Z}catch{return $}}var EQ,d$,$9,W1,Y9;var Z9=S(()=>{a5();EQ={showRelativePaths:!1,enableAutoRecovery:e1(),logRecoveryWarnings:!0},d$={...EQ};$9=class $9 extends Error{code;filePath;line;column;context;numericCode;constructor($,Y,Z,X,Q,J,G){super($);this.code=Y;this.filePath=Z;this.line=X;this.column=Q;this.context=J;if(this.name="StxError",this.numericCode=G||l.EVALUATION_ERROR,this.filePath)this.filePath=e5(this.filePath)}};W1=class W1 extends $9{constructor($,Y,Z,X,Q,J){super($,"stx_RUNTIME_ERROR",Y,Z,X,Q,J||l.EVALUATION_ERROR);this.name="StxRuntimeError"}};Y9=class Y9 extends $9{isFatal=!0;constructor($,Y,Z,X,Q,J){super($,"stx_VALIDATION_ERROR",Y,Z,X,Q,J||l.DOM_API_VIOLATION);this.name="StxValidationError"}}});function k6($){let{type:Y,message:Z,code:X,filePath:Q,line:J,column:G,template:K,offset:q,snippet:_,suggestion:U,format:W="text"}=$,B=J,j=G;if(!B&&K&&q!==void 0){let H=PQ(K,q);B=H.line,j=H.column}let z=Q?e5(Q):void 0,O=X?h$(X):void 0,L={type:Y,code:X,codeName:O,message:Z,filePath:z,line:B,column:j,snippet:_,suggestion:U,timestamp:new Date().toISOString()},F;switch(W){case"html":F=kQ(L);break;case"json":F=JSON.stringify(L,null,2);break;case"console":F=bQ(L,K,q);break;case"text":default:F=DQ(L,K,q);break}return{formatted:F,data:L}}function DQ($,Y,Z){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(`
2700
+ ${$.message}`),Y&&$.line){let J=SQ(Y,$.line,2);if(J)X.push(`
2700
2701
  ${J}`)}if($.snippet)X.push(`
2701
2702
  Snippet: ${$.snippet}`);if($.suggestion)X.push(`
2702
- Suggestion: ${$.suggestion}`);return X.join(" ")}function IQ($){let Y=$.code?` [${$.code}]`:"",Z=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",X=`<!-- [${$.type} Error${Y}]${Z}: ${D6($.message)}`;if($.suggestion)X+=` | Suggestion: ${D6($.suggestion)}`;return X+=" -->",X}function EQ($,Y,Z){let _=[],U=$.code?` [${$.codeName||$.code}]`:"";if(_.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${U} \u2501\u2501\u2501${"\x1B[0m"}`),$.filePath){let W=`\x1B[36m${$.filePath}\x1B[0m`;if($.line){if(W+=`\x1B[90m:${$.line}\x1B[0m`,$.column)W+=`\x1B[90m:${$.column}\x1B[0m`}_.push(`
2703
+ Suggestion: ${$.suggestion}`);return X.join(" ")}function kQ($){let Y=$.code?` [${$.code}]`:"",Z=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",X=`<!-- [${$.type} Error${Y}]${Z}: ${D6($.message)}`;if($.suggestion)X+=` | Suggestion: ${D6($.suggestion)}`;return X+=" -->",X}function bQ($,Y,Z){let _=[],U=$.code?` [${$.codeName||$.code}]`:"";if(_.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${U} \u2501\u2501\u2501${"\x1B[0m"}`),$.filePath){let W=`\x1B[36m${$.filePath}\x1B[0m`;if($.line){if(W+=`\x1B[90m:${$.line}\x1B[0m`,$.column)W+=`\x1B[90m:${$.column}\x1B[0m`}_.push(`
2703
2704
  \x1B[90mat\x1B[0m ${W}`)}if(_.push(`
2704
2705
 
2705
- ${$.message}`),Y&&$.line){let W=kQ(Y,$.line,2);if(W)_.push(`
2706
+ ${$.message}`),Y&&$.line){let W=yQ(Y,$.line,2);if(W)_.push(`
2706
2707
 
2707
2708
  \x1B[90mContext:\x1B[0m
2708
2709
  ${W}`)}if($.suggestion)_.push(`
2709
2710
 
2710
2711
  \x1B[33mSuggestion:\x1B[0m ${$.suggestion}`);return _.push(`
2711
- ${"\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"}`),_.join("")}function DQ($,Y,Z){let X=$.split(`
2712
+ ${"\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"}`),_.join("")}function SQ($,Y,Z){let X=$.split(`
2712
2713
  `),Q=Math.max(0,Y-Z-1),J=Math.min(X.length-1,Y+Z-1),G=[];for(let K=Q;K<=J;K++){let q=(K+1).toString().padStart(4),_=K===Y-1?">":" ";G.push(`${_}${q} | ${X[K]}`)}return G.join(`
2713
- `)}function kQ($,Y,Z){let X=$.split(`
2714
+ `)}function yQ($,Y,Z){let X=$.split(`
2714
2715
  `),Q=Math.max(0,Y-Z-1),J=Math.min(X.length-1,Y+Z-1),G="\x1B[90m",K="\x1B[31m",q="\x1B[0m",_=[];for(let U=Q;U<=J;U++){let W=(U+1).toString().padStart(4),B=U===Y-1,j=B?"\x1B[31m>\x1B[0m":" ",z=B?`\x1B[31m${X[U]}\x1B[0m`:`\x1B[90m${X[U]}\x1B[0m`;_.push(`${j}\x1B[90m${W}\x1B[0m | ${z}`)}return _.join(`
2715
- `)}function D6($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function SQ($,Y){let X=$.substring(0,Y).split(`
2716
- `);return{line:X.length,column:X[X.length-1].length}}function s($,Y,Z){return k6({type:$,message:Y,code:Z,format:"html"}).formatted}async function I1($,Y,Z){try{return await $()}catch(X){if(Z&&X instanceof Error)Z(X);return Y}}var S6=b(()=>{a5();Z9()});class u${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($,Y,Z="error"){let X={timestamp:new Date,error:$,context:Y,level:Z};if(this.errors.push(X),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Z))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 Y=[`[${$.timestamp.toISOString()}] [${($.level||"error").toUpperCase()}] ${$.error.constructor.name}: ${$.error.message}`];if($.error.stack)Y.push(` Stack: ${$.error.stack.split(`
2716
+ `)}function D6($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function PQ($,Y){let X=$.substring(0,Y).split(`
2717
+ `);return{line:X.length,column:X[X.length-1].length}}function s($,Y,Z){return k6({type:$,message:Y,code:Z,format:"html"}).formatted}async function D1($,Y,Z){try{return await $()}catch(X){if(Z&&X instanceof Error)Z(X);return Y}}var b6=S(()=>{a5();Z9()});class u${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($,Y,Z="error"){let X={timestamp:new Date,error:$,context:Y,level:Z};if(this.errors.push(X),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Z))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 Y=[`[${$.timestamp.toISOString()}] [${($.level||"error").toUpperCase()}] ${$.error.constructor.name}: ${$.error.message}`];if($.error.stack)Y.push(` Stack: ${$.error.stack.split(`
2717
2718
  `).slice(1).join(`
2718
2719
  `)}`);if($.context)Y.push(` Context: ${JSON.stringify($.context)}`);return Y.join(`
2719
2720
  `)}writeToFile($){this.writeQueue=this.writeQueue.then(async()=>{try{let Y=await import("fs"),X=(await import("path")).dirname(this.logFilePath);if(!Y.existsSync(X))Y.mkdirSync(X,{recursive:!0});await this.rotateIfNeeded(Y);let Q=`${this.formatEntry($)}
2720
2721
  `;Y.appendFileSync(this.logFilePath,Q,"utf-8")}catch(Y){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",Y)}})}async rotateIfNeeded($){try{if(!$.existsSync(this.logFilePath))return;if($.statSync(this.logFilePath).size<this.maxFileSize)return;for(let Z=this.maxLogFiles-1;Z>=1;Z--){let X=`${this.logFilePath}.${Z}`,Q=`${this.logFilePath}.${Z+1}`;if($.existsSync(X))if(Z>=this.maxLogFiles-1)$.unlinkSync(X);else $.renameSync(X,Q)}if(this.maxLogFiles<=1)$.writeFileSync(this.logFilePath,"");else $.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(Y){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",Y)}}getRecentErrors($=10){return this.errors.slice(-$)}getErrorsByType($){return this.errors.filter((Y)=>Y.error.constructor.name===$)}getErrorsByLevel($){return this.errors.filter((Y)=>Y.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 $={},Y={error:0,warning:0,info:0};for(let Z of this.errors){let X=Z.error.constructor.name;$[X]=($[X]||0)+1;let Q=Z.level||"error";Y[Q]=(Y[Q]||0)+1}return{total:this.errors.length,byType:$,byLevel:Y}}async exportToFile($,Y="json"){let Z=await import("fs"),Q=(await import("path")).dirname($);if(!Z.existsSync(Q))Z.mkdirSync(Q,{recursive:!0});if(Y==="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}));Z.writeFileSync($,JSON.stringify(J,null,2),"utf-8")}else{let J=this.errors.map((G)=>this.formatEntry(G));Z.writeFileSync($,J.join(`
2721
2722
 
2722
- `),"utf-8")}}async flush(){await this.writeQueue}}var m$,b0,l$;var b6=b(()=>{Z9();m$={isEnabled(){return t5().enableAutoRecovery},fixCommonSyntaxErrors($){let Y=t5();if(!Y.enableAutoRecovery)return{fixed:$,fixes:[]};let Z=$,X=[],Q=(Z.match(/\{\{/g)||[]).length,J=(Z.match(/\}\}/g)||[]).length;if(Q>J){let K=Q-J;Z+="}}".repeat(K),X.push(`Added ${K} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let K of G){let q=(Z.match(new RegExp(`@${K}\\b`,"g"))||[]).length,_=(Z.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(q>_){let U=q-_;for(let W=0;W<U;W++)Z+=`
2723
- @end${K}`;X.push(`Added ${U} missing @end${K}`)}}if(X.length>0&&Y.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:Z,fixes:X}},createFallbackContent($,Y){if(e1())return`<!-- ${$} failed: ${Y.message} -->`;return"<!-- stx rendering error -->"}};b0=new u$,l$={isDevelopment(){return e1()},logDetailedError($,Y){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",$.message),console.error("Stack:",$.stack),Y)console.error("Context:",Y);console.error("========================")},createErrorReport($,Y){let Z=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${$.message}`,`Type: ${$.constructor.name}`,`Stack: ${$.stack}`];if(Y)Z.push(`Context: ${JSON.stringify(Y,null,2)}`);return Z.push("========================"),Z.join(`
2724
- `)}}});var y6=()=>{};var P6=b(()=>{a5();S6();b6();y6();Z9()});var u0=b(()=>{P6()});function C6($,Y,Z,X){let Q=$;Q=Q.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,q,_)=>{if(!_&&q.includes(":")){let U=q.split(":"),W=q,B=U.length>1?U[1]:"";if(B&&Y[B])_=Y[B];else if(W.startsWith("og:")&&Y.openGraph&&Y.openGraph[U[1]])_=Y.openGraph[U[1]];else _="";return _?`<meta property="${m(W)}" content="${m(_)}">`:""}return _?`<meta name="${m(q)}" content="${m(_)}">`:""});let J=/@metaTag\s*\(/g,G;while((G=J.exec(Q))!==null){let K=G.index,q=K+G[0].length-1,_=1,U=q+1;while(U<Q.length&&_>0){if(Q[U]==="(")_++;else if(Q[U]===")"){if(_--,_===0)break}U++}if(_!==0)break;let W=Q.substring(q+1,U).trim(),B=U+1,j=(()=>{try{let z=z0(W,Y);if(!z)return"";let O="<meta";if(z.name)O+=` name="${m(String(z.name))}"`;if(z.property)O+=` property="${m(String(z.property))}"`;if(z.httpEquiv)O+=` http-equiv="${m(String(z.httpEquiv))}"`;if(z.content)O+=` content="${m(String(z.content))}"`;return O+=">",O}catch(z){let O=z instanceof Error?z.message:String(z);return s("MetaTag",O,l.EVALUATION_ERROR)}})();Q=Q.substring(0,K)+j+Q.substring(B),J.lastIndex=0}return Q}function v6($,Y,Z){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,_=K+1;while(_<X.length&&q>0){if(X[_]==="(")q++;else if(X[_]===")"){if(q--,q===0)break}_++}if(q!==0)break;let U=X.substring(K+1,_).trim(),W=_+1,B=(()=>{try{let j=z0(U,Y);if(!j)return"";if(!j["@context"])j["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(j).replace(/<\//g,"<\\/")}</script>`}catch(j){let z=j instanceof Error?j.message:String(j);return s("StructuredData",z,l.EVALUATION_ERROR)}})();X=X.substring(0,G)+B+X.substring(W),Q.lastIndex=0}return X}function x6($,Y,Z,X){let Q=$,J=/@seo\s*\(\s*\{/g,G;while((G=J.exec(Q))!==null){let K=Q.indexOf("{",G.index+4),q=1,_=K+1,U=null,W=!1;while(_<Q.length&&q>0){let F=Q[_];if(W){W=!1,_++;continue}if(F==="\\"&&U){W=!0,_++;continue}if(U){if(F===U)U=null;_++;continue}if(F==='"'||F==="'"||F==="`"){U=F,_++;continue}if(F==="{")q++;else if(F==="}")q--;_++}if(q!==0)break;let B=Q.substring(_).match(/^\s*\)/);if(!B)break;let j=_+B[0].length,z=Q.substring(K,_),O=Q.substring(G.index,j),L=((F)=>{try{let H=z0(F,Y);if(!H)return"";let V="";if(H.title)V+=`<title>${m(H.title)}</title>
2723
+ `),"utf-8")}}async flush(){await this.writeQueue}}var m$,S0,l$;var S6=S(()=>{Z9();m$={isEnabled(){return t5().enableAutoRecovery},fixCommonSyntaxErrors($){let Y=t5();if(!Y.enableAutoRecovery)return{fixed:$,fixes:[]};let Z=$,X=[],Q=(Z.match(/\{\{/g)||[]).length,J=(Z.match(/\}\}/g)||[]).length;if(Q>J){let K=Q-J;Z+="}}".repeat(K),X.push(`Added ${K} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let K of G){let q=(Z.match(new RegExp(`@${K}\\b`,"g"))||[]).length,_=(Z.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(q>_){let U=q-_;for(let W=0;W<U;W++)Z+=`
2724
+ @end${K}`;X.push(`Added ${U} missing @end${K}`)}}if(X.length>0&&Y.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:Z,fixes:X}},createFallbackContent($,Y){if(e1())return`<!-- ${$} failed: ${Y.message} -->`;return"<!-- stx rendering error -->"}};S0=new u$,l$={isDevelopment(){return e1()},logDetailedError($,Y){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",$.message),console.error("Stack:",$.stack),Y)console.error("Context:",Y);console.error("========================")},createErrorReport($,Y){let Z=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${$.message}`,`Type: ${$.constructor.name}`,`Stack: ${$.stack}`];if(Y)Z.push(`Context: ${JSON.stringify(Y,null,2)}`);return Z.push("========================"),Z.join(`
2725
+ `)}}});var y6=()=>{};var P6=S(()=>{a5();b6();S6();y6();Z9()});var u0=S(()=>{P6()});function C6($,Y,Z,X){let Q=$;Q=Q.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,q,_)=>{if(!_&&q.includes(":")){let U=q.split(":"),W=q,B=U.length>1?U[1]:"";if(B&&Y[B])_=Y[B];else if(W.startsWith("og:")&&Y.openGraph&&Y.openGraph[U[1]])_=Y.openGraph[U[1]];else _="";return _?`<meta property="${m(W)}" content="${m(_)}">`:""}return _?`<meta name="${m(q)}" content="${m(_)}">`:""});let J=/@metaTag\s*\(/g,G;while((G=J.exec(Q))!==null){let K=G.index,q=K+G[0].length-1,_=1,U=q+1;while(U<Q.length&&_>0){if(Q[U]==="(")_++;else if(Q[U]===")"){if(_--,_===0)break}U++}if(_!==0)break;let W=Q.substring(q+1,U).trim(),B=U+1,j=(()=>{try{let z=z0(W,Y);if(!z)return"";let O="<meta";if(z.name)O+=` name="${m(String(z.name))}"`;if(z.property)O+=` property="${m(String(z.property))}"`;if(z.httpEquiv)O+=` http-equiv="${m(String(z.httpEquiv))}"`;if(z.content)O+=` content="${m(String(z.content))}"`;return O+=">",O}catch(z){let O=z instanceof Error?z.message:String(z);return s("MetaTag",O,l.EVALUATION_ERROR)}})();Q=Q.substring(0,K)+j+Q.substring(B),J.lastIndex=0}return Q}function v6($,Y,Z){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,_=K+1;while(_<X.length&&q>0){if(X[_]==="(")q++;else if(X[_]===")"){if(q--,q===0)break}_++}if(q!==0)break;let U=X.substring(K+1,_).trim(),W=_+1,B=(()=>{try{let j=z0(U,Y);if(!j)return"";if(!j["@context"])j["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(j).replace(/<\//g,"<\\/")}</script>`}catch(j){let z=j instanceof Error?j.message:String(j);return s("StructuredData",z,l.EVALUATION_ERROR)}})();X=X.substring(0,G)+B+X.substring(W),Q.lastIndex=0}return X}function x6($,Y,Z,X){let Q=$,J=/@seo\s*\(\s*\{/g,G;while((G=J.exec(Q))!==null){let K=Q.indexOf("{",G.index+4),q=1,_=K+1,U=null,W=!1;while(_<Q.length&&q>0){let F=Q[_];if(W){W=!1,_++;continue}if(F==="\\"&&U){W=!0,_++;continue}if(U){if(F===U)U=null;_++;continue}if(F==='"'||F==="'"||F==="`"){U=F,_++;continue}if(F==="{")q++;else if(F==="}")q--;_++}if(q!==0)break;let B=Q.substring(_).match(/^\s*\)/);if(!B)break;let j=_+B[0].length,z=Q.substring(K,_),O=Q.substring(G.index,j),L=((F)=>{try{let H=z0(F,Y);if(!H)return"";let V="";if(H.title)V+=`<title>${m(H.title)}</title>
2725
2726
  `,V+=`<meta name="title" content="${m(H.title)}">
2726
2727
  `;if(H.description)V+=`<meta name="description" content="${m(H.description)}">
2727
2728
  `;if(H.keywords){let N=Array.isArray(H.keywords)?H.keywords.join(", "):H.keywords;V+=`<meta name="keywords" content="${m(N)}">
@@ -2759,7 +2760,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
2759
2760
  `;let U=$;if(!J)U=U.replace(/<head[^>]*>/,`$&
2760
2761
  <title>${m(G)}</title>`);return U.replace(/<head[^>]*>/,`$&
2761
2762
  ${_}
2762
- `)}function m($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var g6,h6;var p$=b(()=>{u0();V0();g6={name:"meta",handler:($,Y,Z,X)=>{if(Y.length<1)return s("Meta","meta directive requires at least the meta name",l.INVALID_DIRECTIVE_SYNTAX);let Q=Y[0].replace(/['"]/g,""),J=Y.length>1?Y[1].replace(/['"]/g,""):"";return`<meta name="${m(Q)}" content="${m(J)}">`},hasEndTag:!1},h6={name:"structuredData",handler:($,Y,Z,X)=>{if($.trim()==="")return s("StructuredData","structuredData directive requires JSON-LD content",l.INVALID_DIRECTIVE_SYNTAX);try{let Q=JSON.parse($);if(!Q["@context"])Q["@context"]="https://schema.org";if(!Q["@type"])return s("StructuredData","structuredData requires @type property",l.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 s("StructuredData",J,l.EVALUATION_ERROR)}},hasEndTag:!0}});import $5 from"path";function bQ($,Y){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=Z?Z[1].trim():"",Q=Y,J=[],G=!0;if(X){let W=X.match(/export\s+default\s+({[\s\S]*})/);if(W)try{let B=W[1],j=B.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(j)Q=j[1];let z=B.match(/props\s*:\s*\[([\s\S]*?)\]/);if(z)J=z[1].split(",").map((L)=>L.trim().replace(/['"`]/g,"")).filter((L)=>L.length>0);let O=B.match(/shadowDOM\s*:\s*(true|false)/);if(O)G=O[1]==="true"}catch{}}let K=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=K?K[1].trim():"",_=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),U=_?_[1].trim():"";return{tag:Q,props:J,template:q,styles:U,script:X,shadowDOM:G}}function yQ($){let{tag:Y,props:Z,template:X,styles:Q,shadowDOM:J}=$,G=Y.split("-").map((W)=>W.charAt(0).toUpperCase()+W.slice(1)).join(""),K=X.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),_=Z.map((W)=>`'${W}'`).join(", "),U=Z.map((W)=>`
2763
+ `)}function m($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var g6,h6;var p$=S(()=>{u0();V0();g6={name:"meta",handler:($,Y,Z,X)=>{if(Y.length<1)return s("Meta","meta directive requires at least the meta name",l.INVALID_DIRECTIVE_SYNTAX);let Q=Y[0].replace(/['"]/g,""),J=Y.length>1?Y[1].replace(/['"]/g,""):"";return`<meta name="${m(Q)}" content="${m(J)}">`},hasEndTag:!1},h6={name:"structuredData",handler:($,Y,Z,X)=>{if($.trim()==="")return s("StructuredData","structuredData directive requires JSON-LD content",l.INVALID_DIRECTIVE_SYNTAX);try{let Q=JSON.parse($);if(!Q["@context"])Q["@context"]="https://schema.org";if(!Q["@type"])return s("StructuredData","structuredData requires @type property",l.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 s("StructuredData",J,l.EVALUATION_ERROR)}},hasEndTag:!0}});import $5 from"path";function CQ($,Y){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=Z?Z[1].trim():"",Q=Y,J=[],G=!0;if(X){let W=X.match(/export\s+default\s+({[\s\S]*})/);if(W)try{let B=W[1],j=B.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(j)Q=j[1];let z=B.match(/props\s*:\s*\[([\s\S]*?)\]/);if(z)J=z[1].split(",").map((L)=>L.trim().replace(/['"`]/g,"")).filter((L)=>L.length>0);let O=B.match(/shadowDOM\s*:\s*(true|false)/);if(O)G=O[1]==="true"}catch{}}let K=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=K?K[1].trim():"",_=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),U=_?_[1].trim():"";return{tag:Q,props:J,template:q,styles:U,script:X,shadowDOM:G}}function vQ($){let{tag:Y,props:Z,template:X,styles:Q,shadowDOM:J}=$,G=Y.split("-").map((W)=>W.charAt(0).toUpperCase()+W.slice(1)).join(""),K=X.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),_=Z.map((W)=>`'${W}'`).join(", "),U=Z.map((W)=>`
2763
2764
  get ${W}() {
2764
2765
  return this.getAttribute('${W}') || '';
2765
2766
  }
@@ -2810,16 +2811,16 @@ ${U}
2810
2811
  }
2811
2812
 
2812
2813
  customElements.define('${Y}', ${G});
2813
- `}async function d6($,Y,Z,X){if(Y.length<1)return s("WebComponent","@webcomponent directive requires at least the tag name parameter",l.INVALID_DIRECTIVE_SYNTAX);let Q=Y[0].replace(/['"]/g,""),G=(Z.__stx_options||{}).componentsDir||"components",K=[$5.join($5.dirname(X),G,`${Q}.stx`),$5.join(process.cwd(),G,`${Q}.stx`),$5.join($5.dirname(X),`${Q}.stx`)],q=null;for(let W of K)if(await c(W)){q=await Bun.file(W).text();break}if(!q)return s("WebComponent",`Component file not found: ${Q}.stx`,l.FILE_NOT_FOUND);let _=bQ(q,Q);return`<script type="module">
2814
- ${yQ(_)}
2815
- </script>`}var m6=b(()=>{u0();H0()});var u6={};r(u6,{timingPlugin:()=>fQ,pluginManager:()=>PQ,definePlugin:()=>X9,debugPlugin:()=>xQ,createVariablesPlugin:()=>gQ,createFilterPlugin:()=>vQ,createDirectivePlugin:()=>CQ,PluginManager:()=>c$});function X9($){return $}class c${plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Y){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Z of $.dependencies)if(!this.plugins.has(Z))throw Error(`Plugin "${$.name}" depends on "${Z}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Y);this.sortPlugins()}async unregister($){let Y=this.plugins.get($);if(!Y)return!1;for(let[Z,X]of this.plugins)if(X.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Z}" depends on it`);if(Y.onUnregister)await Y.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 Y of this.sortedPlugins)if(Y.registerDirectives)$.push(...Y.registerDirectives());return $}getAllFilters(){let $={};for(let Y of this.sortedPlugins)if(Y.registerFilters)Object.assign($,Y.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Y){return this.runDirectiveHooks("beforeDirective",$,Y)}async runAfterDirective($,Y){return this.runDirectiveHooks("afterDirective",$,Y)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Y of this.sortedPlugins)if(Y.onError)try{let Z=await Y.onError($);if(Z){if(Z.template!==void 0)$.template=Z.template;if(Z.context)$.context={...$.context,...Z.context};if(Z.metadata)$.metadata={...$.metadata,...Z.metadata};if(Z.skip)return $}}catch(Z){console.error(`Error in plugin "${Y.name}" onError hook:`,Z)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Y)=>($.priority??100)-(Y.priority??100))}async runHooks($,Y){let Z={...Y};for(let X of this.sortedPlugins){let Q=X[$];if(Q)try{let J=await Q(Z);if(J){if(J.template!==void 0)Z.template=J.template;if(J.context)Z.context={...Z.context,...J.context};if(J.metadata)Z.metadata={...Z.metadata,...J.metadata};if(J.skip)break}}catch(J){console.error(`Error in plugin "${X.name}" ${$} hook:`,J)}}return Z}async runDirectiveHooks($,Y,Z){let X={...Z};for(let Q of this.sortedPlugins){let J=Q[$];if(J)try{let G=await J(Y,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 CQ($,Y,Z={}){return{name:$,...Z,registerDirectives:()=>Y}}function vQ($,Y,Z={}){return{name:$,...Z,registerFilters:()=>Y}}function gQ($){return X9({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Y){return{context:{...Y.context,...$}}}})}var PQ,xQ,fQ;var l6=b(()=>{PQ=new c$;xQ=X9({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($,Y){console.log("[stx-debug] beforeDirective:",$)},afterDirective($,Y){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)}}),fQ=X9({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Y=$.metadata.startTime;if(Y){let Z=performance.now()-Y;console.log(`[stx-timing] Processing took ${Z.toFixed(2)}ms`)}}})});var c6={};r(c6,{validateConfig:()=>uQ,loadStxConfig:()=>Q9,defineStxConfig:()=>mQ,defaultConfig:()=>n$,config:()=>o$});import i$ from"fs";import N0 from"path";import{loadConfigWithResult as hQ}from"bunfig";function dQ($,Y){let Z=Y||"pages";if($)return{root:$,pagesDir:Z};let X=N0.join(process.cwd(),"resources","views"),Q=N0.join(process.cwd(),"resources","layouts");if(i$.existsSync(X)&&i$.existsSync(Q))return{root:"resources",pagesDir:"views"};let J=N0.join(process.cwd(),"resources","views","pages");if(i$.existsSync(J))return{root:"resources/views",pagesDir:Z};return{root:".",pagesDir:Z}}async function Q9($){if(!$){if(E1)return E1;if(J9)return J9}let Y=$?N0.resolve($):process.cwd(),Z=p6.get(Y);if(Z)return Z;let X=(async()=>{let J=(await hQ({name:"stx",alias:"ui",cwd:Y,defaultConfig:n$,verbose:!1})).config,G=dQ(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(() => (l6(),u6)),q=[],_=[];for(let U of J.plugins){let W=typeof U==="string"?U:U[0],B=typeof U==="string"?{}:U[1]||{};try{let j,z;try{j=await import(W),z=N0.dirname($0.resolve(W))}catch{let L=N0.resolve(process.cwd(),W);j=await import(L),z=N0.dirname(L)}let O=j.default||j;if(K.register(O,J),O.components){let L=N0.resolve(z,O.components);q.push(L)}if(O.pages){let L=N0.resolve(z,O.pages),F=B.path||"/";_.push({dir:L,prefix:F})}if(O.setup){let L={addDirective:(F)=>{J.customDirectives=J.customDirectives||[],J.customDirectives.push(F)},addRoute:(F,H)=>{J.apiRoutes=J.apiRoutes||{},J.apiRoutes[F]=H},addMiddleware:(F)=>{J.middleware=J.middleware||[],J.middleware.push(F)},pluginDir:z,config:J};await O.setup(B,L)}console.log(`[stx] Plugin loaded: ${O.name||W}`)}catch(j){console.warn(`[stx] Failed to load plugin ${W}:`,j.message)}}J._pluginComponentDirs=q,J._pluginPageDirs=_}return J})();if(p6.set(Y,X),!$)J9=X,X.then((Q)=>{E1=Q}).catch(()=>{});return X}function mQ($){return $}function uQ($){let Y=[],Z=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Y.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Y.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Y.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Y.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)Y.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)Y.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))Y.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))Y.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)Y.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)Y.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))Y.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))Y.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))Y.push({path:"hydration.preload",message:`hydration.preload must be one of: ${X.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Y.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((X,Q)=>{if(!X.name||typeof X.name!=="string")Y.push({path:`customDirectives[${Q}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Y.push({path:`customDirectives[${Q}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Y.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((X,Q)=>{if(!X.name||typeof X.name!=="string")Y.push({path:`middleware[${Q}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Y.push({path:`middleware[${Q}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Y.push({path:`middleware[${Q}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Z.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)Z.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Y.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))Y.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))Y.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")Y.push({path:`pwa.routes[${J}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(Q.strategy))Y.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))Y.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))Y.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))Y.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)Y.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)Y.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Z.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Z.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Y.length===0,errors:Y,warnings:Z}}var n$,E1=null,p6,J9=null,o$;var G9=b(()=>{m9();u9();l9();p9();Q$();X6();x$();g$();p$();m6();n$={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,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:k3,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:d6,hasEndTag:!1,description:"Include a web component in the template"},S7,b7,g6,h6,y7,C7,v7,P7,h7,u7,Z6,v$,...f$],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}};p6=new Map;o$=new Proxy(n$,{get($,Y){if(E1&&Y in E1)return E1[Y];if(!J9)Q9().catch((Z)=>{console.warn("[stx] Failed to load config file:",Z?.message||Z)});return $[Y]}})});import G0 from"path";async function o6($){try{let Y=await import($);if(Y&&Y.CSSGenerator)return{CSSGenerator:Y.CSSGenerator,config:Y.config,build:Y.build,defaultConfig:Y.defaultConfig}}catch{}return null}function lQ(){let $=[],Y=process.env.HOME||process.env.USERPROFILE||"",Z=process.cwd();while(Z!==G0.dirname(Z))$.push(G0.join(Z,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(G0.join(Z,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(G0.join(Z,"node_modules","@stacksjs","crosswind","dist","index.js")),Z=G0.dirname(Z);if(Y){let X=[G0.join(Y,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),G0.join(Y,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),G0.join(Y,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),G0.join(Y,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),G0.join(Y,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),G0.join(Y,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...X)}return $.push(G0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(G0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function pQ(){if(i6)return Y5;i6=!0;try{let $=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Z of $){let X=await o6(Z);if(X)return Y5=X,console.log(`${B0.green}[Crosswind]${B0.reset} CSS engine loaded`),Y5}let Y=lQ();for(let Z of Y)if(await Bun.file(Z).exists()){let X=await o6(Z);if(X)return Y5=X,console.log(`${B0.green}[Crosswind]${B0.reset} CSS engine loaded from ${G0.dirname(G0.dirname(Z))}`),Y5}throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${B0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${B0.reset}`),console.warn(`${B0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${B0.reset}`),null}}async function cQ($){try{let{loadConfigWithResult:Y}=await import("bunfig"),Z=await Y({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Z?.path||!Z.config||Object.keys(Z.config).length===0)return null;let X=G0.relative($,Z.path);return console.log(`${B0.green}[Crosswind]${B0.reset} Loaded config from ${X||Z.path}`),Z.config}catch(Y){if(Y instanceof Error&&Y.name==="ConfigNotFoundError")return null;return console.warn(`${B0.yellow}[Crosswind]${B0.reset} Failed to load crosswind config:`,Y instanceof Error?Y.message:Y),null}}function iQ($){let Y=new Set,Z=/class\s*=\s*["']([^"']+)["']/gi,X=Z.exec($);while(X!==null){for(let G of X[1].split(/\s+/))if(G.trim())Y.add(G.trim());X=Z.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())Y.add(q.trim())}J=Q.exec($)}return Y}async function nQ($,Y){try{let Z=await pQ();if(!Z)return"";let X=iQ($);if(X.size===0)return"";let Q=[...X].sort().join(" "),J=n6.get(Q);if(J!==void 0)return J;let G=Y?G0.resolve(Y):process.cwd();if(!s$){let V=null;try{let{loadStxConfig:N}=await Promise.resolve().then(() => (G9(),c6)),R=await N(G);if(R.css)if(typeof R.css==="string"){let A=G0.isAbsolute(R.css)?R.css:G0.resolve(G,R.css);if(await Bun.file(A).exists()){let w=await import(A);V=w.default||w,console.log(`${B0.green}[Crosswind]${B0.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(V={content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let A=G0.isAbsolute(R.css.config)?R.css.config:G0.resolve(G,R.css.config);if(await Bun.file(A).exists()){let w=await import(A);V={...w.default||w,...V}}}console.log(`${B0.green}[Crosswind]${B0.reset} Using inline CSS config from stx.config.ts`)}}catch{}s$=V||await cQ(G)}let K=Z.defaultConfig||Z.config,q=s$||{},_=K.theme||{},W=(q.theme||{}).extend||{},B={..._};if(Object.keys(W).length>0)B.extend=W;let j=[...K.safelist||[],...q.safelist||[]],z={...K,...q,content:[],output:"",preflight:!0,minify:!1,theme:B,safelist:j},O=new Z.CSSGenerator(z);for(let V of j)O.generate(V);for(let V of X)O.generate(V);let L=O.toCSS(!0,!1),F=z.shortcuts||q.shortcuts||{};for(let[V,N]of Object.entries(F)){if(!X.has(V)&&!j.includes(V))continue;let R=N.split(/\s+/).filter(Boolean);for(let A of R)O.generate(A)}L=O.toCSS(!0,!1);let H=L.split(`
2816
- `);for(let[V,N]of Object.entries(F)){if(!X.has(V)&&!j.includes(V))continue;let R=N.split(/\s+/).filter(Boolean),A=[],w=[];for(let T of R){let I=T.startsWith("dark:"),D=`.${(I?T.slice(5):T).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let P=0;P<H.length;P++){let y=H[P].trim();if(y===`${D} {`||y.startsWith(`${D} {`)){let S=P,k="";while(S<H.length){if(k+=H[S],H[S].includes("}"))break;S++}let g=k.match(/\{([^}]+)\}/);if(g)if(I)w.push(g[1].trim());else A.push(g[1].trim());break}}}if(A.length)L+=`
2814
+ `}async function d6($,Y,Z,X){if(Y.length<1)return s("WebComponent","@webcomponent directive requires at least the tag name parameter",l.INVALID_DIRECTIVE_SYNTAX);let Q=Y[0].replace(/['"]/g,""),G=(Z.__stx_options||{}).componentsDir||"components",K=[$5.join($5.dirname(X),G,`${Q}.stx`),$5.join(process.cwd(),G,`${Q}.stx`),$5.join($5.dirname(X),`${Q}.stx`)],q=null;for(let W of K)if(await c(W)){q=await Bun.file(W).text();break}if(!q)return s("WebComponent",`Component file not found: ${Q}.stx`,l.FILE_NOT_FOUND);let _=CQ(q,Q);return`<script type="module">
2815
+ ${vQ(_)}
2816
+ </script>`}var m6=S(()=>{u0();H0()});var u6={};r(u6,{timingPlugin:()=>dQ,pluginManager:()=>xQ,definePlugin:()=>X9,debugPlugin:()=>hQ,createVariablesPlugin:()=>mQ,createFilterPlugin:()=>gQ,createDirectivePlugin:()=>fQ,PluginManager:()=>c$});function X9($){return $}class c${plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Y){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Z of $.dependencies)if(!this.plugins.has(Z))throw Error(`Plugin "${$.name}" depends on "${Z}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Y);this.sortPlugins()}async unregister($){let Y=this.plugins.get($);if(!Y)return!1;for(let[Z,X]of this.plugins)if(X.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Z}" depends on it`);if(Y.onUnregister)await Y.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 Y of this.sortedPlugins)if(Y.registerDirectives)$.push(...Y.registerDirectives());return $}getAllFilters(){let $={};for(let Y of this.sortedPlugins)if(Y.registerFilters)Object.assign($,Y.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Y){return this.runDirectiveHooks("beforeDirective",$,Y)}async runAfterDirective($,Y){return this.runDirectiveHooks("afterDirective",$,Y)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Y of this.sortedPlugins)if(Y.onError)try{let Z=await Y.onError($);if(Z){if(Z.template!==void 0)$.template=Z.template;if(Z.context)$.context={...$.context,...Z.context};if(Z.metadata)$.metadata={...$.metadata,...Z.metadata};if(Z.skip)return $}}catch(Z){console.error(`Error in plugin "${Y.name}" onError hook:`,Z)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Y)=>($.priority??100)-(Y.priority??100))}async runHooks($,Y){let Z={...Y};for(let X of this.sortedPlugins){let Q=X[$];if(Q)try{let J=await Q(Z);if(J){if(J.template!==void 0)Z.template=J.template;if(J.context)Z.context={...Z.context,...J.context};if(J.metadata)Z.metadata={...Z.metadata,...J.metadata};if(J.skip)break}}catch(J){console.error(`Error in plugin "${X.name}" ${$} hook:`,J)}}return Z}async runDirectiveHooks($,Y,Z){let X={...Z};for(let Q of this.sortedPlugins){let J=Q[$];if(J)try{let G=await J(Y,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 fQ($,Y,Z={}){return{name:$,...Z,registerDirectives:()=>Y}}function gQ($,Y,Z={}){return{name:$,...Z,registerFilters:()=>Y}}function mQ($){return X9({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Y){return{context:{...Y.context,...$}}}})}var xQ,hQ,dQ;var l6=S(()=>{xQ=new c$;hQ=X9({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($,Y){console.log("[stx-debug] beforeDirective:",$)},afterDirective($,Y){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)}}),dQ=X9({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Y=$.metadata.startTime;if(Y){let Z=performance.now()-Y;console.log(`[stx-timing] Processing took ${Z.toFixed(2)}ms`)}}})});var c6={};r(c6,{validateConfig:()=>cQ,loadStxConfig:()=>Q9,defineStxConfig:()=>pQ,defaultConfig:()=>n$,config:()=>o$});import i$ from"fs";import N0 from"path";import{loadConfigWithResult as uQ}from"bunfig";function lQ($,Y){let Z=Y||"pages";if($)return{root:$,pagesDir:Z};let X=N0.join(process.cwd(),"resources","views"),Q=N0.join(process.cwd(),"resources","layouts");if(i$.existsSync(X)&&i$.existsSync(Q))return{root:"resources",pagesDir:"views"};let J=N0.join(process.cwd(),"resources","views","pages");if(i$.existsSync(J))return{root:"resources/views",pagesDir:Z};return{root:".",pagesDir:Z}}async function Q9($){if(!$){if(k1)return k1;if(J9)return J9}let Y=$?N0.resolve($):process.cwd(),Z=p6.get(Y);if(Z)return Z;let X=(async()=>{let J=(await uQ({name:"stx",alias:"ui",cwd:Y,defaultConfig:n$,verbose:!1})).config,G=lQ(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(() => (l6(),u6)),q=[],_=[];for(let U of J.plugins){let W=typeof U==="string"?U:U[0],B=typeof U==="string"?{}:U[1]||{};try{let j,z;try{j=await import(W),z=N0.dirname($0.resolve(W))}catch{let L=N0.resolve(process.cwd(),W);j=await import(L),z=N0.dirname(L)}let O=j.default||j;if(K.register(O,J),O.components){let L=N0.resolve(z,O.components);q.push(L)}if(O.pages){let L=N0.resolve(z,O.pages),F=B.path||"/";_.push({dir:L,prefix:F})}if(O.setup){let L={addDirective:(F)=>{J.customDirectives=J.customDirectives||[],J.customDirectives.push(F)},addRoute:(F,H)=>{J.apiRoutes=J.apiRoutes||{},J.apiRoutes[F]=H},addMiddleware:(F)=>{J.middleware=J.middleware||[],J.middleware.push(F)},pluginDir:z,config:J};await O.setup(B,L)}console.log(`[stx] Plugin loaded: ${O.name||W}`)}catch(j){console.warn(`[stx] Failed to load plugin ${W}:`,j.message)}}J._pluginComponentDirs=q,J._pluginPageDirs=_}return J})();if(p6.set(Y,X),!$)J9=X,X.then((Q)=>{k1=Q}).catch(()=>{});return X}function pQ($){return $}function cQ($){let Y=[],Z=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Y.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Y.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Y.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Y.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)Y.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)Y.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))Y.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))Y.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)Y.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)Y.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))Y.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))Y.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))Y.push({path:"hydration.preload",message:`hydration.preload must be one of: ${X.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Y.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((X,Q)=>{if(!X.name||typeof X.name!=="string")Y.push({path:`customDirectives[${Q}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Y.push({path:`customDirectives[${Q}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Y.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((X,Q)=>{if(!X.name||typeof X.name!=="string")Y.push({path:`middleware[${Q}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Y.push({path:`middleware[${Q}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Y.push({path:`middleware[${Q}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Z.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)Z.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Y.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))Y.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))Y.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")Y.push({path:`pwa.routes[${J}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(Q.strategy))Y.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))Y.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))Y.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))Y.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)Y.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)Y.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Z.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Z.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Y.length===0,errors:Y,warnings:Z}}var n$,k1=null,p6,J9=null,o$;var G9=S(()=>{m9();u9();l9();p9();Q$();X6();x$();g$();p$();m6();n$={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,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:k3,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:d6,hasEndTag:!1,description:"Include a web component in the template"},b7,S7,g6,h6,y7,C7,v7,P7,h7,u7,Z6,v$,...f$],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}};p6=new Map;o$=new Proxy(n$,{get($,Y){if(k1&&Y in k1)return k1[Y];if(!J9)Q9().catch((Z)=>{console.warn("[stx] Failed to load config file:",Z?.message||Z)});return $[Y]}})});import G0 from"path";async function o6($){try{let Y=await import($);if(Y&&Y.CSSGenerator)return{CSSGenerator:Y.CSSGenerator,config:Y.config,build:Y.build,defaultConfig:Y.defaultConfig}}catch{}return null}function iQ(){let $=[],Y=process.env.HOME||process.env.USERPROFILE||"",Z=process.cwd();while(Z!==G0.dirname(Z))$.push(G0.join(Z,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(G0.join(Z,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(G0.join(Z,"node_modules","@stacksjs","crosswind","dist","index.js")),Z=G0.dirname(Z);if(Y){let X=[G0.join(Y,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),G0.join(Y,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),G0.join(Y,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),G0.join(Y,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),G0.join(Y,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),G0.join(Y,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...X)}return $.push(G0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(G0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function nQ(){if(i6)return Y5;i6=!0;try{let $=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Z of $){let X=await o6(Z);if(X)return Y5=X,console.log(`${B0.green}[Crosswind]${B0.reset} CSS engine loaded`),Y5}let Y=iQ();for(let Z of Y)if(await Bun.file(Z).exists()){let X=await o6(Z);if(X)return Y5=X,console.log(`${B0.green}[Crosswind]${B0.reset} CSS engine loaded from ${G0.dirname(G0.dirname(Z))}`),Y5}throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${B0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${B0.reset}`),console.warn(`${B0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${B0.reset}`),null}}async function oQ($){try{let{loadConfigWithResult:Y}=await import("bunfig"),Z=await Y({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Z?.path||!Z.config||Object.keys(Z.config).length===0)return null;let X=G0.relative($,Z.path);return console.log(`${B0.green}[Crosswind]${B0.reset} Loaded config from ${X||Z.path}`),Z.config}catch(Y){if(Y instanceof Error&&Y.name==="ConfigNotFoundError")return null;return console.warn(`${B0.yellow}[Crosswind]${B0.reset} Failed to load crosswind config:`,Y instanceof Error?Y.message:Y),null}}function sQ($){let Y=new Set,Z=/class\s*=\s*["']([^"']+)["']/gi,X=Z.exec($);while(X!==null){for(let G of X[1].split(/\s+/))if(G.trim())Y.add(G.trim());X=Z.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())Y.add(q.trim())}J=Q.exec($)}return Y}async function rQ($,Y){try{let Z=await nQ();if(!Z)return"";let X=sQ($);if(X.size===0)return"";let Q=[...X].sort().join(" "),J=n6.get(Q);if(J!==void 0)return J;let G=Y?G0.resolve(Y):process.cwd();if(!s$){let V=null;try{let{loadStxConfig:N}=await Promise.resolve().then(() => (G9(),c6)),R=await N(G);if(R.css)if(typeof R.css==="string"){let A=G0.isAbsolute(R.css)?R.css:G0.resolve(G,R.css);if(await Bun.file(A).exists()){let w=await import(A);V=w.default||w,console.log(`${B0.green}[Crosswind]${B0.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(V={content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let A=G0.isAbsolute(R.css.config)?R.css.config:G0.resolve(G,R.css.config);if(await Bun.file(A).exists()){let w=await import(A);V={...w.default||w,...V}}}console.log(`${B0.green}[Crosswind]${B0.reset} Using inline CSS config from stx.config.ts`)}}catch{}s$=V||await oQ(G)}let K=Z.defaultConfig||Z.config,q=s$||{},_=K.theme||{},W=(q.theme||{}).extend||{},B={..._};if(Object.keys(W).length>0)B.extend=W;let j=[...K.safelist||[],...q.safelist||[]],z={...K,...q,content:[],output:"",preflight:!0,minify:!1,theme:B,safelist:j},O=new Z.CSSGenerator(z);for(let V of j)O.generate(V);for(let V of X)O.generate(V);let L=O.toCSS(!0,!1),F=z.shortcuts||q.shortcuts||{};for(let[V,N]of Object.entries(F)){if(!X.has(V)&&!j.includes(V))continue;let R=N.split(/\s+/).filter(Boolean);for(let A of R)O.generate(A)}L=O.toCSS(!0,!1);let H=L.split(`
2817
+ `);for(let[V,N]of Object.entries(F)){if(!X.has(V)&&!j.includes(V))continue;let R=N.split(/\s+/).filter(Boolean),A=[],w=[];for(let T of R){let I=T.startsWith("dark:"),D=`.${(I?T.slice(5):T).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let P=0;P<H.length;P++){let y=H[P].trim();if(y===`${D} {`||y.startsWith(`${D} {`)){let b=P,k="";while(b<H.length){if(k+=H[b],H[b].includes("}"))break;b++}let g=k.match(/\{([^}]+)\}/);if(g)if(I)w.push(g[1].trim());else A.push(g[1].trim());break}}}if(A.length)L+=`
2817
2818
  .${V} { ${A.join(" ")} }`;if(w.length)L+=`
2818
- @media (prefers-color-scheme: dark) { .dark .${V} { ${w.join(" ")} } }`}return n6.set(Q,L),L}catch(Z){return console.warn("Failed to generate Crosswind CSS:",Z),""}}async function s6($,Y){if($.includes('data-crosswind="generated"'))return $;let Z=await nQ($,Y);if(!Z)return $;let X=`<style data-crosswind="generated">
2819
+ @media (prefers-color-scheme: dark) { .dark .${V} { ${w.join(" ")} } }`}return n6.set(Q,L),L}catch(Z){return console.warn("Failed to generate Crosswind CSS:",Z),""}}async function s6($,Y){if($.includes('data-crosswind="generated"'))return $;let Z=await rQ($,Y);if(!Z)return $;let X=`<style data-crosswind="generated">
2819
2820
  ${Z}
2820
2821
  </style>`;if($.includes("</head>"))return $.replace("</head>",`${X}
2821
2822
  </head>`);if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
2822
- ${X}`);return X+$}var Y5=null,i6=!1,s$=null,n6;var r6=b(()=>{D7();n6=new Map});function a6(){return`
2823
+ ${X}`);return X+$}var Y5=null,i6=!1,s$=null,n6;var r6=S(()=>{D7();n6=new Map});function a6(){return`
2823
2824
  // STX Lifecycle Runtime
2824
2825
  (function() {
2825
2826
  if (typeof window === 'undefined') return;
@@ -3164,7 +3165,7 @@ else {
3164
3165
 
3165
3166
  console.log('[stx] Lifecycle runtime initialized');
3166
3167
  })();
3167
- `}function r$($){return Symbol($)}var Iz,Ez,Dz;var t6=b(()=>{Iz=r$("theme"),Ez=r$("router"),Dz=r$("i18n")});import*as $2 from"crypto";function e6($){let Y=/\$(\w+)\./g,Z=[],X;while((X=Y.exec($))!==null)if(!Z.includes(X[1]))Z.push(X[1]);return Z}function oQ(){return`stx-${$2.randomBytes(4).toString("hex")}`}function sQ($){return/\$\w+\./.test($)}function rQ($){let Y=[],Z=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=!1,W=K,B=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,j=[...K.matchAll(B)];for(let L of j){let F=L[0],H=L[1],V=L[2];if(sQ(V)){U=!0;let N=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(N){let R=N[1];if(_.push({attr:H,expr:R,fullMatch:F,originalAttr:H}),e6(R).forEach((w)=>Z.add(w)),H==="text")W=W.replace(F,"");else if(H==="class")W=W.replace(F,'class=""');else if(H==="disabled"||H==="hidden")W=W.replace(F,"");else W=W.replace(F,`${H}=""`)}}}if(!U)return J;let z=W.match(/\bid\s*=\s*"([^"]+)"/),O;if(z)O=z[1];else O=oQ(),W=` id="${O}"${W}`;for(let L of _)Y.push({elementId:O,attribute:L.attr,expression:L.expr,stores:e6(L.expr)});return`<${G}${W}${q}`}),{html:Q,bindings:Y,stores:Z}}function aQ($,Y){if($.length===0)return"";let Z=Array.from(Y),X=`
3168
+ `}function r$($){return Symbol($)}var bz,Sz,yz;var t6=S(()=>{bz=r$("theme"),Sz=r$("router"),yz=r$("i18n")});import*as $2 from"crypto";function e6($){let Y=/\$(\w+)\./g,Z=[],X;while((X=Y.exec($))!==null)if(!Z.includes(X[1]))Z.push(X[1]);return Z}function aQ(){return`stx-${$2.randomBytes(4).toString("hex")}`}function tQ($){return/\$\w+\./.test($)}function eQ($){let Y=[],Z=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=!1,W=K,B=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,j=[...K.matchAll(B)];for(let L of j){let F=L[0],H=L[1],V=L[2];if(tQ(V)){U=!0;let N=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(N){let R=N[1];if(_.push({attr:H,expr:R,fullMatch:F,originalAttr:H}),e6(R).forEach((w)=>Z.add(w)),H==="text")W=W.replace(F,"");else if(H==="class")W=W.replace(F,'class=""');else if(H==="disabled"||H==="hidden")W=W.replace(F,"");else W=W.replace(F,`${H}=""`)}}}if(!U)return J;let z=W.match(/\bid\s*=\s*"([^"]+)"/),O;if(z)O=z[1];else O=aQ(),W=` id="${O}"${W}`;for(let L of _)Y.push({elementId:O,attribute:L.attr,expression:L.expr,stores:e6(L.expr)});return`<${G}${W}${q}`}),{html:Q,bindings:Y,stores:Z}}function $G($,Y){if($.length===0)return"";let Z=Array.from(Y),X=`
3168
3169
  <script>
3169
3170
  (function() {
3170
3171
  'use strict';
@@ -3290,10 +3291,10 @@ else {
3290
3291
  }
3291
3292
  })();
3292
3293
  </script>
3293
- `,X}function Y2($){let{html:Y,bindings:Z,stores:X}=rQ($);if(Z.length===0)return $;let Q=aQ(Z,X),J=Y.lastIndexOf("</body>");if(J!==-1)return Y.slice(0,J)+Q+Y.slice(J);return Y+Q}var Z2=()=>{};function tQ($){let Y=$.analytics;if(!Y?.enabled)return"";switch(Y.driver){case"fathom":return eQ(Y);case"google-analytics":return $G(Y);case"plausible":return YG(Y);case"self-hosted":return ZG(Y);case"custom":return XG(Y);default:return""}}function eQ($){let Y=$.fathom;if(!Y?.siteId)return"";let Z=Y.scriptUrl||"https://cdn.usefathom.com/script.js",X=Y.defer!==!1?" defer":"",Q=[`data-site="${I0(Y.siteId)}"`];if(Y.honorDnt)Q.push('data-honor-dnt="true"');if(Y.spa)Q.push('data-spa="auto"');if(Y.canonical)Q.push(`data-canonical="${I0(Y.canonical)}"`);if(Y.auto===!1)Q.push('data-auto="false"');return`
3294
+ `,X}function Y2($){let{html:Y,bindings:Z,stores:X}=eQ($);if(Z.length===0)return $;let Q=$G(Z,X),J=Y.lastIndexOf("</body>");if(J!==-1)return Y.slice(0,J)+Q+Y.slice(J);return Y+Q}var Z2=()=>{};function YG($){let Y=$.analytics;if(!Y?.enabled)return"";switch(Y.driver){case"fathom":return ZG(Y);case"google-analytics":return XG(Y);case"plausible":return JG(Y);case"self-hosted":return QG(Y);case"custom":return GG(Y);default:return""}}function ZG($){let Y=$.fathom;if(!Y?.siteId)return"";let Z=Y.scriptUrl||"https://cdn.usefathom.com/script.js",X=Y.defer!==!1?" defer":"",Q=[`data-site="${I0(Y.siteId)}"`];if(Y.honorDnt)Q.push('data-honor-dnt="true"');if(Y.spa)Q.push('data-spa="auto"');if(Y.canonical)Q.push(`data-canonical="${I0(Y.canonical)}"`);if(Y.auto===!1)Q.push('data-auto="false"');return`
3294
3295
  <!-- Fathom Analytics -->
3295
3296
  <script src="${I0(Z)}" ${Q.join(" ")}${X}></script>
3296
- `}function $G($){let Y=$.googleAnalytics;if(!Y?.measurementId)return"";let Z=I0(Y.measurementId),X=Y.debug?`gtag('config', '${Z}', { 'debug_mode': true });`:"";return`
3297
+ `}function XG($){let Y=$.googleAnalytics;if(!Y?.measurementId)return"";let Z=I0(Y.measurementId),X=Y.debug?`gtag('config', '${Z}', { 'debug_mode': true });`:"";return`
3297
3298
  <!-- Google Analytics -->
3298
3299
  <script async src="https://www.googletagmanager.com/gtag/js?id=${Z}"></script>
3299
3300
  <script>
@@ -3303,10 +3304,10 @@ else {
3303
3304
  gtag('config', '${Z}');
3304
3305
  ${X}
3305
3306
  </script>
3306
- `}function YG($){let Y=$.plausible;if(!Y?.domain)return"";let Z=Y.scriptUrl||"https://plausible.io/js/script.js",X=[`data-domain="${I0(Y.domain)}"`],Q=Z,J=[];if(Y.trackLocalhost)J.push("local");if(Y.hashMode)J.push("hash");if(J.length>0&&Z==="https://plausible.io/js/script.js")Q=`https://plausible.io/js/script.${J.join(".")}.js`;return`
3307
+ `}function JG($){let Y=$.plausible;if(!Y?.domain)return"";let Z=Y.scriptUrl||"https://plausible.io/js/script.js",X=[`data-domain="${I0(Y.domain)}"`],Q=Z,J=[];if(Y.trackLocalhost)J.push("local");if(Y.hashMode)J.push("hash");if(J.length>0&&Z==="https://plausible.io/js/script.js")Q=`https://plausible.io/js/script.${J.join(".")}.js`;return`
3307
3308
  <!-- Plausible Analytics -->
3308
3309
  <script defer data-domain="${I0(Y.domain)}" src="${I0(Q)}"></script>
3309
- `}function ZG($){let Y=$.selfHosted;if(!Y?.siteId||!Y?.apiEndpoint)return"";let Z=I0(Y.siteId),X=I0(Y.apiEndpoint),Q=Y.honorDnt?'if(n.doNotTrack==="1")return;':"",J=Y.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Y.trackOutboundLinks?`
3310
+ `}function QG($){let Y=$.selfHosted;if(!Y?.siteId||!Y?.apiEndpoint)return"";let Z=I0(Y.siteId),X=I0(Y.apiEndpoint),Q=Y.honorDnt?'if(n.doNotTrack==="1")return;':"",J=Y.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Y.trackOutboundLinks?`
3310
3311
  d.addEventListener('click',function(e){
3311
3312
  var a=e.target.closest('a');
3312
3313
  if(a&&a.hostname!==location.hostname){
@@ -3339,7 +3340,7 @@ else {
3339
3340
  w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
3340
3341
  })();
3341
3342
  </script>
3342
- `}function XG($){let Y=$.custom;if(!Y)return"";if(Y.inlineScript)return`
3343
+ `}function GG($){let Y=$.custom;if(!Y)return"";if(Y.inlineScript)return`
3343
3344
  <!-- Custom Analytics -->
3344
3345
  <script>
3345
3346
  ${Y.inlineScript}
@@ -3347,7 +3348,7 @@ ${Y.inlineScript}
3347
3348
  `;if(!Y.scriptUrl)return"";let Z=[];if(Y.scriptId)Z.push(`id="${I0(Y.scriptId)}"`);if(Y.attributes)for(let[Q,J]of Object.entries(Y.attributes))Z.push(`${I0(Q)}="${I0(J)}"`);return`
3348
3349
  <!-- Custom Analytics -->
3349
3350
  <script${Z.length>0?` ${Z.join(" ")}`:""} src="${I0(Y.scriptUrl)}" defer></script>
3350
- `}function X2($,Y){let Z=tQ(Y);if(!Z)return $;if(!$.includes("</head>")){let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Z+$.slice(X);return $+Z}return $.replace("</head>",`${Z}</head>`)}function I0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var J2=()=>{};function K2($){let Y={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Z of $){let X=Z.toLowerCase();if(X==="prevent")Y.prevent=!0;else if(X==="stop")Y.stop=!0;else if(X==="once")Y.once=!0;else if(X==="capture")Y.capture=!0;else if(X==="self")Y.self=!0;else if(X==="passive")Y.passive=!0;else if(JG.has(X))Y.systemKeys.push(X);else if(X in q2)Y.mouse=X;else if(X in G2||/^[a-z]$/.test(X))Y.keys.push(G2[X]||X.toUpperCase());else if(X.startsWith("debounce")){let Q=X.match(/debounce(?:\.(\d+))?/);Y.debounce=Q?.[1]?Number.parseInt(Q[1],10):300}else if(X.startsWith("throttle")){let Q=X.match(/throttle(?:\.(\d+))?/);Y.throttle=Q?.[1]?Number.parseInt(Q[1],10):300}}return Y}function U2($){let Y=[],Z=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,_=q+J.length,U=`__stx_evt_${Z++}`,W=[],B=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,j;while((j=B.exec(K))!==null){let[,O,L]=j,F=O.split("."),H=F[0];if(!Q2.has(H))continue;W.push({attribute:`@${O}`,event:H,handler:L,modifiers:K2(F.slice(1)),elementId:U})}let z=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((j=z.exec(K))!==null){let[,O,L]=j,F=O.split("."),H=F[0];if(!Q2.has(H))continue;W.push({attribute:`@${O}`,event:H,handler:L,modifiers:K2(F.slice(1)),elementId:U})}if(W.length>0)Y.push({originalTag:J,elementId:U,events:W,startIndex:q,endIndex:_})}return Y}function QG($){let Y=[],{modifiers:Z}=$;if(Z.self)Y.push("if ($event.target !== $el) return");for(let X of Z.systemKeys)Y.push(`if (!$event.${X}Key) return`);if(Z.keys.length>0){let X=Z.keys.map((Q)=>`$event.key === '${Q}'`).join(" || ");Y.push(`if (!(${X})) return`)}if(Z.mouse!==null){let X=q2[Z.mouse];Y.push(`if ($event.button !== ${X}) return`)}if(Z.prevent)Y.push("$event.preventDefault()");if(Z.stop)Y.push("$event.stopPropagation()");return Y.join("; ")}function GG($,Y){let Z=$;if(Y.debounce!==null)Z=`__stx_debounce(() => { ${Z} }, ${Y.debounce})`;else if(Y.throttle!==null)Z=`__stx_throttle(() => { ${Z} }, ${Y.throttle})`;return Z}function KG($){let{modifiers:Y}=$,Z=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=QG($),Q=GG($.handler,Y),J=[];if(Y.once)J.push("once: true");if(Y.capture)J.push("capture: true");if(Y.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`
3351
+ `}function X2($,Y){let Z=YG(Y);if(!Z)return $;if(!$.includes("</head>")){let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Z+$.slice(X);return $+Z}return $.replace("</head>",`${Z}</head>`)}function I0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var J2=()=>{};function K2($){let Y={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Z of $){let X=Z.toLowerCase();if(X==="prevent")Y.prevent=!0;else if(X==="stop")Y.stop=!0;else if(X==="once")Y.once=!0;else if(X==="capture")Y.capture=!0;else if(X==="self")Y.self=!0;else if(X==="passive")Y.passive=!0;else if(KG.has(X))Y.systemKeys.push(X);else if(X in q2)Y.mouse=X;else if(X in G2||/^[a-z]$/.test(X))Y.keys.push(G2[X]||X.toUpperCase());else if(X.startsWith("debounce")){let Q=X.match(/debounce(?:\.(\d+))?/);Y.debounce=Q?.[1]?Number.parseInt(Q[1],10):300}else if(X.startsWith("throttle")){let Q=X.match(/throttle(?:\.(\d+))?/);Y.throttle=Q?.[1]?Number.parseInt(Q[1],10):300}}return Y}function U2($){let Y=[],Z=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,_=q+J.length,U=`__stx_evt_${Z++}`,W=[],B=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,j;while((j=B.exec(K))!==null){let[,O,L]=j,F=O.split("."),H=F[0];if(!Q2.has(H))continue;W.push({attribute:`@${O}`,event:H,handler:L,modifiers:K2(F.slice(1)),elementId:U})}let z=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((j=z.exec(K))!==null){let[,O,L]=j,F=O.split("."),H=F[0];if(!Q2.has(H))continue;W.push({attribute:`@${O}`,event:H,handler:L,modifiers:K2(F.slice(1)),elementId:U})}if(W.length>0)Y.push({originalTag:J,elementId:U,events:W,startIndex:q,endIndex:_})}return Y}function qG($){let Y=[],{modifiers:Z}=$;if(Z.self)Y.push("if ($event.target !== $el) return");for(let X of Z.systemKeys)Y.push(`if (!$event.${X}Key) return`);if(Z.keys.length>0){let X=Z.keys.map((Q)=>`$event.key === '${Q}'`).join(" || ");Y.push(`if (!(${X})) return`)}if(Z.mouse!==null){let X=q2[Z.mouse];Y.push(`if ($event.button !== ${X}) return`)}if(Z.prevent)Y.push("$event.preventDefault()");if(Z.stop)Y.push("$event.stopPropagation()");return Y.join("; ")}function UG($,Y){let Z=$;if(Y.debounce!==null)Z=`__stx_debounce(() => { ${Z} }, ${Y.debounce})`;else if(Y.throttle!==null)Z=`__stx_throttle(() => { ${Z} }, ${Y.throttle})`;return Z}function _G($){let{modifiers:Y}=$,Z=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=qG($),Q=UG($.handler,Y),J=[];if(Y.once)J.push("once: true");if(Y.capture)J.push("capture: true");if(Y.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`
3351
3352
  (function() {
3352
3353
  var $el = document.getElementById('${Z}');
3353
3354
  if (!$el) return;
@@ -3401,7 +3402,7 @@ else {
3401
3402
  ${Q}
3402
3403
  }
3403
3404
  }${G});
3404
- })();`}function qG($){if($.length===0)return"";return`
3405
+ })();`}function WG($){if($.length===0)return"";return`
3405
3406
  <script data-stx-events>
3406
3407
  (function() {
3407
3408
  'use strict';
@@ -3429,11 +3430,11 @@ else {
3429
3430
  }
3430
3431
 
3431
3432
  // Event listeners
3432
- ${$.flatMap((Z)=>Z.events).map(KG).join(`
3433
+ ${$.flatMap((Z)=>Z.events).map(_G).join(`
3433
3434
  `)}
3434
3435
  })();
3435
- </script>`}function UG($){let Y=U2($);if(Y.length===0)return{template:$,bindings:[]};let Z=$,X=[];for(let Q=Y.length-1;Q>=0;Q--){let J=Y[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,"\\$&"),_=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),U=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");G=G.replace(_,""),G=G.replace(U,"")}Z=Z.slice(0,J.startIndex)+G+Z.slice(J.endIndex),X.push(...J.events)}return{template:Z,bindings:X}}function _2($,Y,Z){if(/\b(?:state|derived|effect)\s*\(/.test($)||/@(?:model|show|for|if)\s*=/.test($)||/data-stx(?:-auto)?(?![-\w])/.test($))return $;if(Y.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:q,bindings:_}=UG($),U=Y.__stx_event_bindings||[];return Y.__stx_event_bindings=[...U,..._],q}let Q=U2($);if(Q.length===0)return $;let J=$;for(let q=Q.length-1;q>=0;q--){let _=Q[q],U=_.originalTag;if(!U.includes(" id="))U=U.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${_.elementId}"`);else{let W=U.match(/id=["']([^"']+)["']/);if(W)for(let B of _.events)B.elementId=W[1]}for(let W of _.events){let B=W.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),j=new RegExp(`\\s*${B}\\s*=\\s*"[^"]*"`,"g"),z=new RegExp(`\\s*${B}\\s*=\\s*'[^']*'`,"g");U=U.replace(j,""),U=U.replace(z,"")}J=J.slice(0,_.startIndex)+U+J.slice(_.endIndex)}let G=qG(Q),K=J.lastIndexOf("</body>");if(K!==-1)J=J.slice(0,K)+G+`
3436
- `+J.slice(K);else J+=G;return J}var Q2,G2,JG,q2;var W2=b(()=>{Q2=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"]),G2={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"},JG=new Set(["ctrl","alt","shift","meta"]),q2={left:0,middle:1,right:2}});function K9($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function B2($,Y){let Z=$.match(new RegExp(`${Y}\\s*=\\s*"([^"]*)"`,"i"));if(Z)return Z[1];let X=$.match(new RegExp(`${Y}\\s*=\\s*'([^']*)'`,"i"));if(X)return X[1];return null}function WG($){let Y=[],Z=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,X;while((X=Z.exec($))!==null){let[Q,J,G]=X,K=X.index,q=B2(G,"x-data");if(!q)continue;let _=`__stx_scope_${z2++}`,U=B2(G,"x-init"),W=BG($,J,K+Q.length),B=$.slice(K,W.endIndex),j=zG(B);Y.push({id:_,selector:`[data-stx-scope="${_}"]`,stateExpr:q,initExpr:U,bindings:[],refs:j})}return Y}function BG($,Y,Z){let X=1,Q=Z,J=new RegExp(`<${Y}(?:\\s|>)`,"gi"),G=new RegExp(`</${Y}>`,"gi"),K=new RegExp(`<${Y}[^>]*/\\s*>`,"gi");while(X>0&&Q<$.length){J.lastIndex=Q,G.lastIndex=Q,K.lastIndex=Q;let q=J.exec($),_=G.exec($),U=K.exec($);if(U&&U.index<(q?.index??1/0)){Q=U.index+U[0].length;continue}if(!_)return{endIndex:$.length};if(q&&q.index<_.index)X++,Q=q.index+q[0].length;else{if(X--,X===0)return{endIndex:_.index+_[0].length};Q=_.index+_[0].length}}return{endIndex:$.length}}function zG($){let Y=new Map,Z=$.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(Z))!==null){let[,J,G]=Q,K=jG(J);Y.set(G,K)}return Y}function jG($){let Y=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Y)return Y[1];return`__stx_el_${_G++}`}function OG(){return`
3436
+ </script>`}function BG($){let Y=U2($);if(Y.length===0)return{template:$,bindings:[]};let Z=$,X=[];for(let Q=Y.length-1;Q>=0;Q--){let J=Y[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,"\\$&"),_=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),U=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");G=G.replace(_,""),G=G.replace(U,"")}Z=Z.slice(0,J.startIndex)+G+Z.slice(J.endIndex),X.push(...J.events)}return{template:Z,bindings:X}}function _2($,Y,Z){if(/\b(?:state|derived|effect)\s*\(/.test($)||/@(?:model|show|for|if)\s*=/.test($)||/data-stx(?:-auto)?(?![-\w])/.test($))return $;if(Y.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:q,bindings:_}=BG($),U=Y.__stx_event_bindings||[];return Y.__stx_event_bindings=[...U,..._],q}let Q=U2($);if(Q.length===0)return $;let J=$;for(let q=Q.length-1;q>=0;q--){let _=Q[q],U=_.originalTag;if(!U.includes(" id="))U=U.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${_.elementId}"`);else{let W=U.match(/id=["']([^"']+)["']/);if(W)for(let B of _.events)B.elementId=W[1]}for(let W of _.events){let B=W.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),j=new RegExp(`\\s*${B}\\s*=\\s*"[^"]*"`,"g"),z=new RegExp(`\\s*${B}\\s*=\\s*'[^']*'`,"g");U=U.replace(j,""),U=U.replace(z,"")}J=J.slice(0,_.startIndex)+U+J.slice(_.endIndex)}let G=WG(Q),K=J.lastIndexOf("</body>");if(K!==-1)J=J.slice(0,K)+G+`
3437
+ `+J.slice(K);else J+=G;return J}var Q2,G2,KG,q2;var W2=S(()=>{Q2=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"]),G2={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"},KG=new Set(["ctrl","alt","shift","meta"]),q2={left:0,middle:1,right:2}});function K9($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function B2($,Y){let Z=$.match(new RegExp(`${Y}\\s*=\\s*"([^"]*)"`,"i"));if(Z)return Z[1];let X=$.match(new RegExp(`${Y}\\s*=\\s*'([^']*)'`,"i"));if(X)return X[1];return null}function jG($){let Y=[],Z=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,X;while((X=Z.exec($))!==null){let[Q,J,G]=X,K=X.index,q=B2(G,"x-data");if(!q)continue;let _=`__stx_scope_${z2++}`,U=B2(G,"x-init"),W=OG($,J,K+Q.length),B=$.slice(K,W.endIndex),j=HG(B);Y.push({id:_,selector:`[data-stx-scope="${_}"]`,stateExpr:q,initExpr:U,bindings:[],refs:j})}return Y}function OG($,Y,Z){let X=1,Q=Z,J=new RegExp(`<${Y}(?:\\s|>)`,"gi"),G=new RegExp(`</${Y}>`,"gi"),K=new RegExp(`<${Y}[^>]*/\\s*>`,"gi");while(X>0&&Q<$.length){J.lastIndex=Q,G.lastIndex=Q,K.lastIndex=Q;let q=J.exec($),_=G.exec($),U=K.exec($);if(U&&U.index<(q?.index??1/0)){Q=U.index+U[0].length;continue}if(!_)return{endIndex:$.length};if(q&&q.index<_.index)X++,Q=q.index+q[0].length;else{if(X--,X===0)return{endIndex:_.index+_[0].length};Q=_.index+_[0].length}}return{endIndex:$.length}}function HG($){let Y=new Map,Z=$.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(Z))!==null){let[,J,G]=Q,K=LG(J);Y.set(G,K)}return Y}function LG($){let Y=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Y)return Y[1];return`__stx_el_${zG++}`}function FG(){return`
3437
3438
  // STX Reactive Runtime - x-cloak and transition CSS
3438
3439
  (function() {
3439
3440
  var style = document.createElement('style');
@@ -3637,7 +3638,7 @@ window.__stx_reactive = (function() {
3637
3638
 
3638
3639
  return { initScope: initScope, reactive: reactive };
3639
3640
  })();
3640
- `}function HG($){if($.length===0)return"";let Y=$.map((Z)=>{let X=JSON.stringify(Object.fromEntries(Z.refs)),Q=JSON.stringify(Z.stateExpr),J=Z.initExpr?JSON.stringify(Z.initExpr):"null";return`
3641
+ `}function VG($){if($.length===0)return"";let Y=$.map((Z)=>{let X=JSON.stringify(Object.fromEntries(Z.refs)),Q=JSON.stringify(Z.stateExpr),J=Z.initExpr?JSON.stringify(Z.initExpr):"null";return`
3641
3642
  (function() {
3642
3643
  var scopeEl = document.querySelector('${Z.selector}');
3643
3644
  if (!scopeEl) return;
@@ -3646,20 +3647,24 @@ window.__stx_reactive = (function() {
3646
3647
  })();`}).join(`
3647
3648
  `);return`
3648
3649
  <script data-stx-scoped data-stx-reactive>
3649
- ${OG()}
3650
+ ${FG()}
3650
3651
  ${Y}
3651
- </script>`}function j2($,Y,Z){if(z2=0,!FG($))return $;let X=WG($);if(X.length===0)return $;let Q=LG($,X),J=HG(X),G=Q.lastIndexOf("</body>");if(G!==-1)Q=Q.slice(0,G)+J+`
3652
- `+Q.slice(G);else Q+=J;return Q}function LG($,Y){let Z=$;for(let X of Y){let J=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${K9(X.stateExpr)}["']`,"gi").exec(Z);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*["']${K9(X.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(Z);if(K)X.id=K[1],X.selector=`[data-stx-scope="${X.id}"]`;else Z=Z.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${K9(X.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`),Z=Z.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${K9(X.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`)}}return Z=Z.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Z=Z.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Z=Z.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Z=Z.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Z}function FG($){return/x-data\s*=\s*["']/.test($)}var z2=0,_G=0;import VG from"fs";import a$ from"path";import{createHighlighter as RG}from"ts-syntax-highlighter";async function NG($,Y={}){try{if(!await c($))throw Error(`Markdown file not found: ${$}`);let X=(await VG.promises.stat($)).mtime.getTime();if(Y.cache&&t$.has($)){let W=t$.get($);if(W.updatedAt>=X)return{content:W.content,data:W.data}}let Q=await Bun.file($).text(),{data:J,content:G}=p7(Q),K=Y.markdown||o$.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},_=u1(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)_=await AG(_,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let U={content:_,data:J||{}};if(Y.cache)t$.set($,{...U,updatedAt:X});return U}catch(Z){if(Y.debug)console.error(`Error reading/parsing markdown file ${$}:`,Z);let X=Z instanceof Error?Z.message:String(Z);return{content:J0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}async function AG($,Y,Z){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!q9)try{q9=await RG({theme:Y||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let Q=async(K,q,_,U)=>{let W=U.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),B=_||(Z?"text":"");if(!B)return K;try{if(!q9.getSupportedLanguages().includes(B))return K;return(await q9.highlight(W,B,{theme:Y})).html}catch(j){console.error(`Error highlighting code block with language ${_}:`,j)}return K},J=$,G=$.matchAll(X);for(let K of G){let[q,_,U,W]=K,B=await Q(q,_,U,W);J=J.replace(q,B)}return J}async function O2($,Y,Z="",X={}){return await wG($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,_)=>{try{let U=K;if(!a$.isAbsolute(K))U=a$.resolve(a$.dirname(Z),K);let W={};if(q)try{try{W=JSON.parse(q)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let H=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of H){let N=V.indexOf(":");if(N>0){let R=V.substring(0,N).trim(),A=V.substring(N+1).trim(),w=A.startsWith('"')&&A.endsWith('"'),T=A.startsWith("'")&&A.endsWith("'");if(w||T)A=A.substring(1,A.length-1);W[R]=A}}}}catch(F){if(X.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:B,data:j}=await NG(U,X),z={...Y,...j,...W},O=B,L=/\{\{([^}]+)\}\}/g;return O=O.replace(L,(F,H)=>{let V=H.trim();return z[V]!==void 0?String(z[V]):F}),O}catch(U){let W=U instanceof Error?U.message:String(U);return J0("Markdown File",`Error including markdown file: ${W}`,Z,$,_,G)}})}async function wG($,Y,Z){let X=[],Q;while((Q=Y.exec($))!==null){let K=Q[0],q=Q.index,_=Q;X.push(Z(..._).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 t$,q9=null;var H2=b(()=>{G9();H0();t$=new Map});function n0($,Y){try{let Z=$.trim();if(e(Z))return Y0(Z,Object.keys(Y))(...Object.values(Y));else return X0(Z,Y)}catch{return!1}}var L2=b(()=>{V0()});function o0($,Y){let Z=TG($,Y);return Z.ok?{expression:Z.expression,endPos:Z.endPos}:null}function TG($,Y){let Z=Y;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Z};let X=T0($,"(",")",Z);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:Z};return{ok:!0,expression:$.slice(Z+1,X),endPos:X+1}}function B1($,Y,Z,X){let Q=1,J=X,G=new RegExp(`@${Y}\\s*\\(`,"g"),K=new RegExp(`@${Z}(?![a-z])`,"g");while(J<$.length&&Q>0){G.lastIndex=J,K.lastIndex=J;let q=G.exec($),_=K.exec($),U=q?q.index:1/0,W=_?_.index:1/0;if(U<W)Q++,J=U+q[0].length;else if(W<1/0){if(Q--,Q===0)return W;J=W+_[0].length}else break}return-1}function F2($,Y){let Z=$.slice(Y).match(/^@if\s*/);if(!Z)return null;let X=Y+Z[0].length,Q=o0($,X);if(!Q)return null;let J=Q.endPos,G=B1($,"if","endif",J);if(G===-1)return null;let K=$.slice(J,G),q=[],_=0,U="if",W=Q.expression,B=0,j=0;while(_<K.length){let z=K.indexOf("@",_);if(z===-1)break;_=z;let O=K.substring(z);if(/^@if\s*\(/.test(O)){j++,_++;continue}if(/^@endif(?![a-z])/.test(O)){j--,_+=6;continue}if(j===0){let L=O.match(/^@elseif\s*/);if(L){q.push({type:U,condition:W,content:K.substring(B,_),start:J+B,end:J+_});let F=_+L[0].length,H=o0(K,F);if(!H){_++;continue}U="elseif",W=H.expression,_=H.endPos,B=_;continue}else if(/^@else(?![a-z])/.test(O)){q.push({type:U,condition:W,content:K.substring(B,_),start:J+B,end:J+_}),U="else",W=void 0,_+=5,B=_;continue}}_++}return q.push({type:U,condition:W,content:K.slice(B),start:J+B,end:J+K.length}),{fullMatch:$.slice(Y,G+6),branches:q,start:Y,end:G+6}}function e$($){let Y=[],Z=/@if\s*\(/g,X=Z.exec($);while(X!==null){if(Y.some((G)=>X.index>G.start&&X.index<G.end)){X=Z.exec($);continue}let J=F2($,X.index);if(J)Y.push(J),Z.lastIndex=J.end;X=Z.exec($)}return Y}function U9($,Y,Z){let X=[],Q=new RegExp(`@${Y}\\s*\\(`,"g"),J=Q.exec($);while(J!==null){if(X.some((O)=>J.index>O.start&&J.index<O.end)){J=Q.exec($);continue}let K=J.index,q=K+J[0].length-1,_=T0($,"(",")",q);if(_===-1){J=Q.exec($);continue}let U=$.slice(q+1,_),W=_+1,B=B1($,Y,Z,W);if(B===-1){J=Q.exec($);continue}let j=$.slice(W,B),z=B+`@${Z}`.length;X.push({fullMatch:$.slice(K,z),name:Y,params:U,content:j,start:K,end:z}),Q.lastIndex=z,J=Q.exec($)}return X}function $4($,Y){let Z=$.slice(Y).match(/^@switch\s*/);if(!Z)return null;let X=Y+Z[0].length,Q=o0($,X);if(!Q)return null;let J=Q.endPos,G=B1($,"switch","endswitch",J);if(G===-1)return null;let K=$.slice(J,G),q=[],_=0,U=null,W=0;while(_<K.length){let B=K.slice(_),j=B.match(/^@switch\s*\(/),z=B.match(/^@endswitch(?![a-z])/);if(j){if(W++,U)U.content+=j[0];_+=j[0].length;continue}if(z){if(W--,U)U.content+=z[0];_+=z[0].length;continue}if(W>0){if(U)U.content+=K[_];_++;continue}let O=B.match(/^@case\s*/),L=B.match(/^@default(?![a-z])/),F=B.match(/^@break(?![a-z])/);if(O&&B.startsWith("@case")){if(U)q.push(U);let H=_+O[0].length,V=o0(K,H);if(!V){_++;continue}U={type:"case",value:V.expression,content:""},_=V.endPos}else if(L&&B.startsWith("@default")){if(U)q.push(U);U={type:"default",content:""},_+=L[0].length}else if(F&&B.startsWith("@break"))_+=F[0].length;else{if(U)U.content+=K[_];_++}}if(U)q.push(U);return{fullMatch:$.slice(Y,G+10),expression:Q.expression,cases:q,start:Y,end:G+10}}var V2=()=>{};var R2=()=>{};var Y4=b(()=>{V2();R2()});function DG($,Y,Z){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=$4(X,G);if(!K)break;try{let q;if(e(K.expression))q=Y0(K.expression,Object.keys(Y))(...Object.values(Y));else q=X0(K.expression,Y);let _="",U=!1;for(let W of K.cases)if(W.type==="default"){if(!U)_=W.content.trim()}else try{let B;if(W.value&&e(W.value))B=Y0(W.value,Object.keys(Y))(...Object.values(Y));else if(W.value)B=X0(W.value,Y);if(q===B){_=W.content.trim(),U=!0;break}}catch{continue}X=X.substring(0,G)+_+X.substring(K.end),Q=!0}catch(q){let _=q instanceof Error?q.message:String(q),U=s("Switch",`Error evaluating @switch expression: ${_}`,l.EVALUATION_ERROR);X=X.substring(0,G)+U+X.substring(K.end);break}}return X}function D1($,Y,Z){let X=$;X=DG(X,Y,Z);{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=o0(X,K+7);if(!q)break;let _=q.endPos,U=B1(X,"unless","endunless",_);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 W=X.slice(_,U),B=q.expression,j=-1;{let O=0,L=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,H=/@else(?![a-z])/g,V=[],N;while((N=L.exec(W))!==null)V.push({pos:N.index,type:"open"});while((N=F.exec(W))!==null)V.push({pos:N.index,type:"close"});while((N=H.exec(W))!==null)V.push({pos:N.index,type:"else"});V.sort((R,A)=>R.pos-A.pos);for(let R of V)if(R.type==="open")O++;else if(R.type==="close")O--;else if(R.type==="else"&&O===0){j=R.pos;break}}let z;if(j!==-1){let O=W.slice(0,j),L=W.slice(j+5);z=`@if (${B})${L}@else ${O}@endif`}else z=`@if (!(${B}))${W}@endif`;X=X.substring(0,K)+z+X.substring(U+10),J=!0}}X=X4(X,Y,Z),X=J4(X,Y,Z),X=Z4(X,Y);let Q=()=>{let J=e$(X);if(J.length===0)return!1;for(let G=J.length-1;G>=0;G--){let K=J[G];try{let q="",_=!1;for(let U of K.branches){if(_)break;if(U.type==="else")q=U.content,_=!0;else try{let W;if(U.condition&&e(U.condition))W=Y0(U.condition,Object.keys(Y))(...Object.values(Y));else if(U.condition)W=X0(U.condition,Y);if(W)q=U.content,_=!0}catch(W){q=s(U.type==="if"?"If":"Elseif",`Error in @${U.type}(${U.condition}): ${W instanceof Error?W.message:String(W)}`,l.EVALUATION_ERROR),_=!0}}X=X.substring(0,K.start)+q+X.substring(K.end)}catch(q){let _=q instanceof Error?q.message:String(q),U=s("If",`Error processing @if block: ${_}`,l.EVALUATION_ERROR);X=X.substring(0,K.start)+U+X.substring(K.end)}}return!0};while(Q());return X}function N2($){let Y=0;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return null;Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;let Z=$[Y];if(Z!=="'"&&Z!=='"')return null;Y++;let X=[];while(Y<$.length){let Q=$[Y];if(Q==="\\"&&Y+1<$.length){X.push($[Y+1]),Y+=2;continue}if(Q===Z){Y++;break}X.push(Q),Y++}while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!==")")return null;return Y++,{value:X.join(""),consumed:Y}}function Z4($,Y){let Z=$;function X(K,q,_,U){let W=1,B=U,j=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),z=new RegExp(`@${_}(?![a-z])`,"g");while(B<K.length&&W>0){j.lastIndex=B,z.lastIndex=B;let O=j.exec(K),L=z.exec(K),F=O?O.index:1/0,H=L?L.index:1/0;if(F<H)W++,B=F+O[0].length;else if(H<1/0){if(W--,W===0)return H;B=H+L[0].length}else break}return-1}function Q(K,q,_){let U=0,W=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${_}(?![a-z])`,"g"),j=/@else(?![a-z])/g,z=[],O;while((O=W.exec(K))!==null)z.push({pos:O.index,type:"open"});while((O=B.exec(K))!==null)z.push({pos:O.index,type:"close"});while((O=j.exec(K))!==null)z.push({pos:O.index,type:"else"});z.sort((L,F)=>L.pos-F.pos);for(let L of z)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=Z.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let _=q.index,U,W,B=Z.slice(_+5),j=N2(B);if(j)U=j.value,W=_+5+j.consumed;else W=_+5;let z=X(Z,"auth","endauth",W);if(z===-1){console.warn(`[stx] @auth directive at position ${_} has no matching @endauth \u2014 the block was skipped.`);break}let O=Z.slice(W,z),L=Q(O,"auth","endauth"),F;if(!Y.auth)F=!1;else F=U?n0(`auth?.check && auth?.user?.[${U}]`,Y):n0("auth?.check",Y);let H;if(L!==-1){let V=O.slice(0,L),N=O.slice(L+5);H=F?V:N}else H=F?O:"";Z=Z.substring(0,_)+H+Z.substring(z+8),K=!0}}{let K=!0;while(K){K=!1;let q=Z.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let _=q.index,U,W,B=Z.slice(_+6),j=N2(B);if(j)U=j.value,W=_+6+j.consumed;else W=_+6;let z=X(Z,"guest","endguest",W);if(z===-1){console.warn(`[stx] @guest directive at position ${_} has no matching @endguest \u2014 the block was skipped.`);break}let O=Z.slice(W,z),L=Q(O,"guest","endguest"),F;if(!Y.auth)F=!0;else F=U?n0(`!auth?.check || !auth?.user?.[${U}]`,Y):n0("!auth?.check",Y);let H;if(L!==-1){let V=O.slice(0,L),N=O.slice(L+5);H=F?V:N}else H=F?O:"";Z=Z.substring(0,_)+H+Z.substring(z+9),K=!0}}function J(K,q,_){if(Y.userCan&&typeof Y.userCan[K]==="boolean")return Y.userCan[K];if(Y.permissions?.check&&typeof Y.permissions.check==="function")try{let U=[K];if(q)U.push(q);if(_){let W=n0(_,Y);U.push(W)}return Y.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}`,_=K==="can"?"elsecan":"elsecannot",U=!0;while(U){U=!1;let W=Z.match(new RegExp(`@${K}\\s*\\(`));if(!W||W.index===void 0)break;let B=W.index,j=Z.slice(B+`@${K}`.length),z=G(j);if(!z)break;let O=B+`@${K}`.length+z.paramsEnd,L=X(Z,K,q,O);if(L===-1){console.warn(`[stx] @${K} directive at position ${B} has no matching @${q} \u2014 the block was skipped.`);break}let F=Z.slice(O,L),H=[],V=0,N=new RegExp(`@${K}\\s*\\(`,"g"),R=new RegExp(`@${q}(?![a-z])`,"g"),A=new RegExp(`@${_}\\s*\\(`,"g"),w=/@else(?![a-z])/g,T=[],I;while((I=N.exec(F))!==null)T.push({pos:I.index,type:"open"});while((I=R.exec(F))!==null)T.push({pos:I.index,type:"close"});while((I=A.exec(F))!==null)T.push({pos:I.index,type:"elseDirective"});while((I=w.exec(F))!==null)T.push({pos:I.index,type:"else"});T.sort((S,k)=>S.pos-k.pos);for(let S of T){if(S.type==="open"){V++;continue}if(S.type==="close"){V--;continue}if(V===0)H.push(S)}let M=[],E=0;for(let S=0;S<H.length;S++){let k=H[S];if(M.push({content:F.slice(E,k.pos),ability:void 0}),k.type==="elseDirective"){let g=F.slice(k.pos+`@${_}`.length),h=G(g);if(h){M[M.length-1]={content:F.slice(E,k.pos)},E=k.pos+`@${_}`.length+h.paramsEnd,M.push({content:"",ability:h.ability,type:h.type,id:h.id}),M.pop();let n=H[S+1],_0=n?n.pos:F.length;M.push({content:F.slice(E,_0),ability:h.ability,type:h.type,id:h.id}),E=_0}}else E=k.pos+5}if(E<F.length){let S=M[M.length-1];if(H.length>0&&H[H.length-1].type==="else")M.push({content:F.slice(E),isFinalElse:!0});else if(M.length===0)M.push({content:F.slice(E)})}let D=J(z.ability,z.type,z.id),P=K==="can"?D:!D,y="";if(P)y=M[0]?.content||"";else{let S=!1;for(let k=1;k<M.length;k++){let g=M[k];if(g.isFinalElse){y=g.content,S=!0;break}if(g.ability){let h=J(g.ability,g.type,g.id);if(K==="can"?h:!h){y=g.content,S=!0;break}}}if(!S&&M.length>0){let k=M[M.length-1];if(k.isFinalElse)y=k.content}}Z=Z.substring(0,B)+y+Z.substring(L+`@${q}`.length),U=!0}}return Z}function X4($,Y,Z){let X=$;function Q(J,G,K,q,_){let U=!0;while(U){U=!1;let W=new RegExp(`@${G}\\s*\\(`),B=J.match(W);if(!B||B.index===void 0)break;let j=B.index,z=o0(J,j+`@${G}`.length);if(!z)break;let O=z.endPos,L=B1(J,G,K,O);if(L===-1){console.warn(`[stx] @${G} directive at position ${j} has no matching @${K} \u2014 the block was skipped.`);break}let F=J.slice(O,L),H=z.expression,V=-1,N=0,R=0;while(R<F.length){let A=F.indexOf("@",R);if(A===-1)break;let w=F.substring(A);if(/^@(?:if|unless|isset|empty)\s*\(/.test(w)){N++,R=A+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(w)){N--,R=A+1;continue}if(N===0&&/^@else(?![a-z])/.test(w)){V=A;break}R=A+1}try{let A=q(H.trim()),w;if(V!==-1){let T=F.slice(0,V),I=F.slice(V+5);w=A?T:I}else w=A?F:"";J=J.substring(0,j)+w+J.substring(L+`@${K}`.length),U=!0}catch(A){let w=A instanceof Error?A.message:String(A),T=s(_,`Error processing @${G} directive: ${w}`,l.EVALUATION_ERROR);J=J.substring(0,j)+T+J.substring(L+`@${K}`.length);break}}return J}return X=Q(X,"isset","endisset",(J)=>{let G=n0(J,Y);return G!==void 0&&G!==null},"Isset"),X=Q(X,"empty","endempty",(J)=>{let G=n0(J,Y);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 J4($,Y,Z){let X=$,Q="development";function J(G,K,q,_){let U=new RegExp(`@${K}(?![a-z])`,"g"),W=new RegExp(`@${q}(?![a-z])`,"g"),B=new RegExp(`^@${K}(?![a-z])`),j=new RegExp(`^@${q}(?![a-z])`),z=G,O=!0;while(O){O=!1,U.lastIndex=0;let L=U.exec(z);if(!L)break;let F=L.index,H=F+L[0].length;if(K==="env"){let D=z.substring(H).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!D)break;H+=D[0].length,_=Q===D[2]}let V=1,N=H,R=-1;while(V>0&&N<z.length){U.lastIndex=N,W.lastIndex=N;let D=U.exec(z),P=W.exec(z),y=D?D.index:1/0,S=P?P.index:1/0;if(y<S)V++,N=y+D[0].length;else if(S<1/0){if(V--,V===0){R=S;break}N=S+P[0].length}else break}if(R===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${q} \u2014 the block was skipped.`);break}let A=z.substring(H,R),w=-1,T=0,I=0;while(I<A.length){let D=A.indexOf("@",I);if(D===-1)break;let P=A.substring(D);if(B.test(P)){T++,I=D+1;continue}if(j.test(P)){T--,I=D+1;continue}if(T===0&&/^@else(?![a-z])/.test(P)){w=D;break}I=D+1}let M;if(w!==-1){let D=A.slice(0,w),P=A.slice(w+5);M=_?D:P}else M=_?A:"";let E=`@${q}`.length;z=z.substring(0,F)+M+z.substring(R+E),O=!0}return z}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 _9=b(()=>{L2();u0();Y4();V0()});function w2($=16){let Y=new Uint8Array($);return crypto.getRandomValues(Y),btoa(String.fromCharCode(...Y))}function W9($,Y){if(!$)return Y?.nonceGenerator?.()??w2();let Z=A2.get($);if(!Z)Z=Y?.nonceGenerator?.()??w2(),A2.set($,Z);return Z}function kG($,Y){let Z=[];for(let[X,Q]of Object.entries($)){if(Q===void 0||Q===null)continue;if(typeof Q==="boolean"){if(Q)Z.push(X);continue}if(Array.isArray(Q)){let J=[...Q];if(Y&&(X==="script-src"||X==="style-src"))J=J.filter((G)=>!G.startsWith("'nonce-")),J.push(`'nonce-${Y}'`);if(J.length>0)Z.push(`${X} ${J.join(" ")}`)}}return Z.join("; ")}function T2($,Y){return`<meta http-equiv="Content-Security-Policy" content="${kG($,Y).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function M2($,Y,Z){if(!Y.enabled||!Y.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=Y.useNonce?W9(Z,Y):void 0,Q=T2(Y.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
3653
- ${Q}`)}function I2($,Y,Z,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?W9(Y,J):void 0;return T2(J.directives,G)}),Q=Q.replace(/@cspNonce\b/g,()=>{if(!J?.enabled||!J.useNonce)return"";return W9(Y,J)}),J?.enabled&&J.useNonce)Y.cspNonce=W9(Y,J);return Q}var A2;var E2=b(()=>{A2=new WeakMap});import SG from"crypto";function yG($=bG){let Y=SG.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return Q4=Y,Y}function PG(){if(!Q4)yG();return Q4}function CG($=D2){let Y=PG();return`<input type="hidden" name="${$}" value="${Y}">`}function k2($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Y,Z,X)=>{return CG(X||D2)})}var bG=40,D2="_token",Q4=null;var S2=()=>{};async function b2($,Y,Z,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 vG(Q,J,Y,Z,X);else Q=await xG(Q,J,Y,Z,X)}return Q}async function vG($,Y,Z,X,Q){let{name:J,handler:G}=Y,K=`@${J}`,q=`@end${J}`,_=$,U=A1(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),W=[],B=U.exec(_);while(B!==null){let[j,z="",O=""]=B,L=B.index||0;try{let F=z?y2(z):[],H=O.trim(),V=await G(H,F,Z,X);W.push({original:j,processed:V,startIndex:L})}catch(F){let H=F instanceof Error?F.message:String(F);if(Q.debug)console.error(`Error processing custom directive @${J}:`,F);W.push({original:j,processed:s("CustomDirective",`Error in @${J}${z?`(${z})`:""}: ${H}`,l.EVALUATION_ERROR),startIndex:L})}B=U.exec(_)}for(let j=W.length-1;j>=0;j--){let{original:z,processed:O}=W[j];_=_.replace(z,O)}return _}async function xG($,Y,Z,X,Q){let{name:J,handler:G}=Y,K=$,q=A1(`@${J}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),_=[],U=q.exec(K);while(U!==null){let[j,z=""]=U,O=U.index||0;try{let L=y2(z),F=await G("",L,Z,X);_.push({original:j,processed:F,startIndex:O})}catch(L){let F=L instanceof Error?L.message:String(L);if(Q.debug)console.error(`Error processing custom directive @${J}:`,L);_.push({original:j,processed:s("CustomDirective",`Error in @${J}(${z}): ${F}`,l.EVALUATION_ERROR),startIndex:O})}U=q.exec(K)}let W=A1(`@${J}(?!\\w)(?!\\s*\\()`,"g"),B=W.exec(K);while(B!==null){let[j]=B,z=B.index||0;try{let O=await G("",[],Z,X);_.push({original:j,processed:O,startIndex:z})}catch(O){let L=O instanceof Error?O.message:String(O);if(Q.debug)console.error(`Error processing custom directive @${J}:`,O);_.push({original:j,processed:s("CustomDirective",`Error in @${J}: ${L}`,l.EVALUATION_ERROR),startIndex:z})}B=W.exec(K)}for(let j=_.length-1;j>=0;j--){let{original:z,processed:O}=_[j];K=K.replace(z,O)}return K}function y2($){if(!$.trim())return[];let Y=[],Z="",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 Z+=G;else if(G===","&&!X)Y.push(Z.trim()),Z="";else Z+=G}if(Z.trim())Y.push(Z.trim());return Y.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 P2=b(()=>{u0();w1()});import fG from"crypto";function j0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function B9($,Y,Z,X){let Q=$||Y;return Z?`${Q} ${X}`:Q}function gG(){return fG.randomUUID()}function z9($,Y){let Z=$;return Z=Z.replace(/@csrf/g,()=>{if(!Y.csrf||typeof Y.csrf!=="object"){let X=gG();Y.csrf={token:X}}if(Y.csrf.field)return Y.csrf.field;if(Y.csrf.token)return`<input type="hidden" name="_token" value="${j0(Y.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Z=Z.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,Q)=>{let J=Q.toUpperCase();if(Q&&!["GET","POST"].includes(J))return`<input type="hidden" name="_method" value="${j0(J)}">`;return X}),Z}function x2($,Y,Z=v2){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Q,J,G,K,q,_="")=>{let U=J||G||"POST",W=K||q||"",B=s0(_),j=U.toUpperCase(),z=["GET","POST"].includes(j)?j:"POST",O=`<form method="${j0(z)}" action="${j0(W)}"${B?` ${B}`:""}>`;if(O+=`
3652
+ </script>`}function j2($,Y,Z){if(z2=0,!NG($))return $;let X=jG($);if(X.length===0)return $;let Q=RG($,X),J=VG(X),G=Q.lastIndexOf("</body>");if(G!==-1)Q=Q.slice(0,G)+J+`
3653
+ `+Q.slice(G);else Q+=J;return Q}function RG($,Y){let Z=$;for(let X of Y){let J=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${K9(X.stateExpr)}["']`,"gi").exec(Z);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*["']${K9(X.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(Z);if(K)X.id=K[1],X.selector=`[data-stx-scope="${X.id}"]`;else Z=Z.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${K9(X.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`),Z=Z.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${K9(X.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`)}}return Z=Z.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Z=Z.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Z=Z.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Z=Z.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Z}function NG($){return/x-data\s*=\s*["']/.test($)}var z2=0,zG=0;import AG from"fs";import a$ from"path";import{createHighlighter as wG}from"ts-syntax-highlighter";async function TG($,Y={}){try{if(!await c($))throw Error(`Markdown file not found: ${$}`);let X=(await AG.promises.stat($)).mtime.getTime();if(Y.cache&&t$.has($)){let W=t$.get($);if(W.updatedAt>=X)return{content:W.content,data:W.data}}let Q=await Bun.file($).text(),{data:J,content:G}=p7(Q),K=Y.markdown||o$.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},_=l1(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)_=await MG(_,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let U={content:_,data:J||{}};if(Y.cache)t$.set($,{...U,updatedAt:X});return U}catch(Z){if(Y.debug)console.error(`Error reading/parsing markdown file ${$}:`,Z);let X=Z instanceof Error?Z.message:String(Z);return{content:J0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}async function MG($,Y,Z){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!q9)try{q9=await wG({theme:Y||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let Q=async(K,q,_,U)=>{let W=U.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),B=_||(Z?"text":"");if(!B)return K;try{if(!q9.getSupportedLanguages().includes(B))return K;return(await q9.highlight(W,B,{theme:Y})).html}catch(j){console.error(`Error highlighting code block with language ${_}:`,j)}return K},J=$,G=$.matchAll(X);for(let K of G){let[q,_,U,W]=K,B=await Q(q,_,U,W);J=J.replace(q,B)}return J}async function O2($,Y,Z="",X={}){return await IG($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,_)=>{try{let U=K;if(!a$.isAbsolute(K))U=a$.resolve(a$.dirname(Z),K);let W={};if(q)try{try{W=JSON.parse(q)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let H=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of H){let N=V.indexOf(":");if(N>0){let R=V.substring(0,N).trim(),A=V.substring(N+1).trim(),w=A.startsWith('"')&&A.endsWith('"'),T=A.startsWith("'")&&A.endsWith("'");if(w||T)A=A.substring(1,A.length-1);W[R]=A}}}}catch(F){if(X.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:B,data:j}=await TG(U,X),z={...Y,...j,...W},O=B,L=/\{\{([^}]+)\}\}/g;return O=O.replace(L,(F,H)=>{let V=H.trim();return z[V]!==void 0?String(z[V]):F}),O}catch(U){let W=U instanceof Error?U.message:String(U);return J0("Markdown File",`Error including markdown file: ${W}`,Z,$,_,G)}})}async function IG($,Y,Z){let X=[],Q;while((Q=Y.exec($))!==null){let K=Q[0],q=Q.index,_=Q;X.push(Z(..._).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 t$,q9=null;var H2=S(()=>{G9();H0();t$=new Map});function o0($,Y){try{let Z=$.trim();if(e(Z))return Y0(Z,Object.keys(Y))(...Object.values(Y));else return X0(Z,Y)}catch{return!1}}var L2=S(()=>{V0()});function s0($,Y){let Z=EG($,Y);return Z.ok?{expression:Z.expression,endPos:Z.endPos}:null}function EG($,Y){let Z=Y;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Z};let X=T0($,"(",")",Z);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:Z};return{ok:!0,expression:$.slice(Z+1,X),endPos:X+1}}function B1($,Y,Z,X){let Q=1,J=X,G=new RegExp(`@${Y}\\s*\\(`,"g"),K=new RegExp(`@${Z}(?![a-z])`,"g");while(J<$.length&&Q>0){G.lastIndex=J,K.lastIndex=J;let q=G.exec($),_=K.exec($),U=q?q.index:1/0,W=_?_.index:1/0;if(U<W)Q++,J=U+q[0].length;else if(W<1/0){if(Q--,Q===0)return W;J=W+_[0].length}else break}return-1}function F2($,Y){let Z=$.slice(Y).match(/^@if\s*/);if(!Z)return null;let X=Y+Z[0].length,Q=s0($,X);if(!Q)return null;let J=Q.endPos,G=B1($,"if","endif",J);if(G===-1)return null;let K=$.slice(J,G),q=[],_=0,U="if",W=Q.expression,B=0,j=0;while(_<K.length){let z=K.indexOf("@",_);if(z===-1)break;_=z;let O=K.substring(z);if(/^@if\s*\(/.test(O)){j++,_++;continue}if(/^@endif(?![a-z])/.test(O)){j--,_+=6;continue}if(j===0){let L=O.match(/^@elseif\s*/);if(L){q.push({type:U,condition:W,content:K.substring(B,_),start:J+B,end:J+_});let F=_+L[0].length,H=s0(K,F);if(!H){_++;continue}U="elseif",W=H.expression,_=H.endPos,B=_;continue}else if(/^@else(?![a-z])/.test(O)){q.push({type:U,condition:W,content:K.substring(B,_),start:J+B,end:J+_}),U="else",W=void 0,_+=5,B=_;continue}}_++}return q.push({type:U,condition:W,content:K.slice(B),start:J+B,end:J+K.length}),{fullMatch:$.slice(Y,G+6),branches:q,start:Y,end:G+6}}function e$($){let Y=[],Z=/@if\s*\(/g,X=Z.exec($);while(X!==null){if(Y.some((G)=>X.index>G.start&&X.index<G.end)){X=Z.exec($);continue}let J=F2($,X.index);if(J)Y.push(J),Z.lastIndex=J.end;X=Z.exec($)}return Y}function U9($,Y,Z){let X=[],Q=new RegExp(`@${Y}\\s*\\(`,"g"),J=Q.exec($);while(J!==null){if(X.some((O)=>J.index>O.start&&J.index<O.end)){J=Q.exec($);continue}let K=J.index,q=K+J[0].length-1,_=T0($,"(",")",q);if(_===-1){J=Q.exec($);continue}let U=$.slice(q+1,_),W=_+1,B=B1($,Y,Z,W);if(B===-1){J=Q.exec($);continue}let j=$.slice(W,B),z=B+`@${Z}`.length;X.push({fullMatch:$.slice(K,z),name:Y,params:U,content:j,start:K,end:z}),Q.lastIndex=z,J=Q.exec($)}return X}function $4($,Y){let Z=$.slice(Y).match(/^@switch\s*/);if(!Z)return null;let X=Y+Z[0].length,Q=s0($,X);if(!Q)return null;let J=Q.endPos,G=B1($,"switch","endswitch",J);if(G===-1)return null;let K=$.slice(J,G),q=[],_=0,U=null,W=0;while(_<K.length){let B=K.slice(_),j=B.match(/^@switch\s*\(/),z=B.match(/^@endswitch(?![a-z])/);if(j){if(W++,U)U.content+=j[0];_+=j[0].length;continue}if(z){if(W--,U)U.content+=z[0];_+=z[0].length;continue}if(W>0){if(U)U.content+=K[_];_++;continue}let O=B.match(/^@case\s*/),L=B.match(/^@default(?![a-z])/),F=B.match(/^@break(?![a-z])/);if(O&&B.startsWith("@case")){if(U)q.push(U);let H=_+O[0].length,V=s0(K,H);if(!V){_++;continue}U={type:"case",value:V.expression,content:""},_=V.endPos}else if(L&&B.startsWith("@default")){if(U)q.push(U);U={type:"default",content:""},_+=L[0].length}else if(F&&B.startsWith("@break"))_+=F[0].length;else{if(U)U.content+=K[_];_++}}if(U)q.push(U);return{fullMatch:$.slice(Y,G+10),expression:Q.expression,cases:q,start:Y,end:G+10}}var V2=()=>{};var R2=()=>{};var Y4=S(()=>{V2();R2()});function SG($,Y,Z){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=$4(X,G);if(!K)break;try{let q;if(e(K.expression))q=Y0(K.expression,Object.keys(Y))(...Object.values(Y));else q=X0(K.expression,Y);let _="",U=!1;for(let W of K.cases)if(W.type==="default"){if(!U)_=W.content.trim()}else try{let B;if(W.value&&e(W.value))B=Y0(W.value,Object.keys(Y))(...Object.values(Y));else if(W.value)B=X0(W.value,Y);if(q===B){_=W.content.trim(),U=!0;break}}catch{continue}X=X.substring(0,G)+_+X.substring(K.end),Q=!0}catch(q){let _=q instanceof Error?q.message:String(q),U=s("Switch",`Error evaluating @switch expression: ${_}`,l.EVALUATION_ERROR);X=X.substring(0,G)+U+X.substring(K.end);break}}return X}function z1($,Y,Z){let X=$;X=SG(X,Y,Z);{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=s0(X,K+7);if(!q)break;let _=q.endPos,U=B1(X,"unless","endunless",_);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 W=X.slice(_,U),B=q.expression,j=-1;{let O=0,L=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,H=/@else(?![a-z])/g,V=[],N;while((N=L.exec(W))!==null)V.push({pos:N.index,type:"open"});while((N=F.exec(W))!==null)V.push({pos:N.index,type:"close"});while((N=H.exec(W))!==null)V.push({pos:N.index,type:"else"});V.sort((R,A)=>R.pos-A.pos);for(let R of V)if(R.type==="open")O++;else if(R.type==="close")O--;else if(R.type==="else"&&O===0){j=R.pos;break}}let z;if(j!==-1){let O=W.slice(0,j),L=W.slice(j+5);z=`@if (${B})${L}@else ${O}@endif`}else z=`@if (!(${B}))${W}@endif`;X=X.substring(0,K)+z+X.substring(U+10),J=!0}}X=X4(X,Y,Z),X=J4(X,Y,Z),X=Z4(X,Y);let Q=()=>{let J=e$(X);if(J.length===0)return!1;for(let G=J.length-1;G>=0;G--){let K=J[G];try{let q="",_=!1;for(let U of K.branches){if(_)break;if(U.type==="else")q=U.content,_=!0;else try{let W;if(U.condition&&e(U.condition))W=Y0(U.condition,Object.keys(Y))(...Object.values(Y));else if(U.condition)W=X0(U.condition,Y);if(W)q=U.content,_=!0}catch(W){q=s(U.type==="if"?"If":"Elseif",`Error in @${U.type}(${U.condition}): ${W instanceof Error?W.message:String(W)}`,l.EVALUATION_ERROR),_=!0}}X=X.substring(0,K.start)+q+X.substring(K.end)}catch(q){let _=q instanceof Error?q.message:String(q),U=s("If",`Error processing @if block: ${_}`,l.EVALUATION_ERROR);X=X.substring(0,K.start)+U+X.substring(K.end)}}return!0};while(Q());return X}function N2($){let Y=0;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return null;Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;let Z=$[Y];if(Z!=="'"&&Z!=='"')return null;Y++;let X=[];while(Y<$.length){let Q=$[Y];if(Q==="\\"&&Y+1<$.length){X.push($[Y+1]),Y+=2;continue}if(Q===Z){Y++;break}X.push(Q),Y++}while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!==")")return null;return Y++,{value:X.join(""),consumed:Y}}function Z4($,Y){let Z=$;function X(K,q,_,U){let W=1,B=U,j=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),z=new RegExp(`@${_}(?![a-z])`,"g");while(B<K.length&&W>0){j.lastIndex=B,z.lastIndex=B;let O=j.exec(K),L=z.exec(K),F=O?O.index:1/0,H=L?L.index:1/0;if(F<H)W++,B=F+O[0].length;else if(H<1/0){if(W--,W===0)return H;B=H+L[0].length}else break}return-1}function Q(K,q,_){let U=0,W=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${_}(?![a-z])`,"g"),j=/@else(?![a-z])/g,z=[],O;while((O=W.exec(K))!==null)z.push({pos:O.index,type:"open"});while((O=B.exec(K))!==null)z.push({pos:O.index,type:"close"});while((O=j.exec(K))!==null)z.push({pos:O.index,type:"else"});z.sort((L,F)=>L.pos-F.pos);for(let L of z)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=Z.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let _=q.index,U,W,B=Z.slice(_+5),j=N2(B);if(j)U=j.value,W=_+5+j.consumed;else W=_+5;let z=X(Z,"auth","endauth",W);if(z===-1){console.warn(`[stx] @auth directive at position ${_} has no matching @endauth \u2014 the block was skipped.`);break}let O=Z.slice(W,z),L=Q(O,"auth","endauth"),F;if(!Y.auth)F=!1;else F=U?o0(`auth?.check && auth?.user?.[${U}]`,Y):o0("auth?.check",Y);let H;if(L!==-1){let V=O.slice(0,L),N=O.slice(L+5);H=F?V:N}else H=F?O:"";Z=Z.substring(0,_)+H+Z.substring(z+8),K=!0}}{let K=!0;while(K){K=!1;let q=Z.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let _=q.index,U,W,B=Z.slice(_+6),j=N2(B);if(j)U=j.value,W=_+6+j.consumed;else W=_+6;let z=X(Z,"guest","endguest",W);if(z===-1){console.warn(`[stx] @guest directive at position ${_} has no matching @endguest \u2014 the block was skipped.`);break}let O=Z.slice(W,z),L=Q(O,"guest","endguest"),F;if(!Y.auth)F=!0;else F=U?o0(`!auth?.check || !auth?.user?.[${U}]`,Y):o0("!auth?.check",Y);let H;if(L!==-1){let V=O.slice(0,L),N=O.slice(L+5);H=F?V:N}else H=F?O:"";Z=Z.substring(0,_)+H+Z.substring(z+9),K=!0}}function J(K,q,_){if(Y.userCan&&typeof Y.userCan[K]==="boolean")return Y.userCan[K];if(Y.permissions?.check&&typeof Y.permissions.check==="function")try{let U=[K];if(q)U.push(q);if(_){let W=o0(_,Y);U.push(W)}return Y.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}`,_=K==="can"?"elsecan":"elsecannot",U=!0;while(U){U=!1;let W=Z.match(new RegExp(`@${K}\\s*\\(`));if(!W||W.index===void 0)break;let B=W.index,j=Z.slice(B+`@${K}`.length),z=G(j);if(!z)break;let O=B+`@${K}`.length+z.paramsEnd,L=X(Z,K,q,O);if(L===-1){console.warn(`[stx] @${K} directive at position ${B} has no matching @${q} \u2014 the block was skipped.`);break}let F=Z.slice(O,L),H=[],V=0,N=new RegExp(`@${K}\\s*\\(`,"g"),R=new RegExp(`@${q}(?![a-z])`,"g"),A=new RegExp(`@${_}\\s*\\(`,"g"),w=/@else(?![a-z])/g,T=[],I;while((I=N.exec(F))!==null)T.push({pos:I.index,type:"open"});while((I=R.exec(F))!==null)T.push({pos:I.index,type:"close"});while((I=A.exec(F))!==null)T.push({pos:I.index,type:"elseDirective"});while((I=w.exec(F))!==null)T.push({pos:I.index,type:"else"});T.sort((b,k)=>b.pos-k.pos);for(let b of T){if(b.type==="open"){V++;continue}if(b.type==="close"){V--;continue}if(V===0)H.push(b)}let M=[],E=0;for(let b=0;b<H.length;b++){let k=H[b];if(M.push({content:F.slice(E,k.pos),ability:void 0}),k.type==="elseDirective"){let g=F.slice(k.pos+`@${_}`.length),h=G(g);if(h){M[M.length-1]={content:F.slice(E,k.pos)},E=k.pos+`@${_}`.length+h.paramsEnd,M.push({content:"",ability:h.ability,type:h.type,id:h.id}),M.pop();let n=H[b+1],_0=n?n.pos:F.length;M.push({content:F.slice(E,_0),ability:h.ability,type:h.type,id:h.id}),E=_0}}else E=k.pos+5}if(E<F.length){let b=M[M.length-1];if(H.length>0&&H[H.length-1].type==="else")M.push({content:F.slice(E),isFinalElse:!0});else if(M.length===0)M.push({content:F.slice(E)})}let D=J(z.ability,z.type,z.id),P=K==="can"?D:!D,y="";if(P)y=M[0]?.content||"";else{let b=!1;for(let k=1;k<M.length;k++){let g=M[k];if(g.isFinalElse){y=g.content,b=!0;break}if(g.ability){let h=J(g.ability,g.type,g.id);if(K==="can"?h:!h){y=g.content,b=!0;break}}}if(!b&&M.length>0){let k=M[M.length-1];if(k.isFinalElse)y=k.content}}Z=Z.substring(0,B)+y+Z.substring(L+`@${q}`.length),U=!0}}return Z}function X4($,Y,Z){let X=$;function Q(J,G,K,q,_){let U=!0;while(U){U=!1;let W=new RegExp(`@${G}\\s*\\(`),B=J.match(W);if(!B||B.index===void 0)break;let j=B.index,z=s0(J,j+`@${G}`.length);if(!z)break;let O=z.endPos,L=B1(J,G,K,O);if(L===-1){console.warn(`[stx] @${G} directive at position ${j} has no matching @${K} \u2014 the block was skipped.`);break}let F=J.slice(O,L),H=z.expression,V=-1,N=0,R=0;while(R<F.length){let A=F.indexOf("@",R);if(A===-1)break;let w=F.substring(A);if(/^@(?:if|unless|isset|empty)\s*\(/.test(w)){N++,R=A+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(w)){N--,R=A+1;continue}if(N===0&&/^@else(?![a-z])/.test(w)){V=A;break}R=A+1}try{let A=q(H.trim()),w;if(V!==-1){let T=F.slice(0,V),I=F.slice(V+5);w=A?T:I}else w=A?F:"";J=J.substring(0,j)+w+J.substring(L+`@${K}`.length),U=!0}catch(A){let w=A instanceof Error?A.message:String(A),T=s(_,`Error processing @${G} directive: ${w}`,l.EVALUATION_ERROR);J=J.substring(0,j)+T+J.substring(L+`@${K}`.length);break}}return J}return X=Q(X,"isset","endisset",(J)=>{let G=o0(J,Y);return G!==void 0&&G!==null},"Isset"),X=Q(X,"empty","endempty",(J)=>{let G=o0(J,Y);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 J4($,Y,Z){let X=$,Q="development";function J(G,K,q,_){let U=new RegExp(`@${K}(?![a-z])`,"g"),W=new RegExp(`@${q}(?![a-z])`,"g"),B=new RegExp(`^@${K}(?![a-z])`),j=new RegExp(`^@${q}(?![a-z])`),z=G,O=!0;while(O){O=!1,U.lastIndex=0;let L=U.exec(z);if(!L)break;let F=L.index,H=F+L[0].length;if(K==="env"){let D=z.substring(H).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!D)break;H+=D[0].length,_=Q===D[2]}let V=1,N=H,R=-1;while(V>0&&N<z.length){U.lastIndex=N,W.lastIndex=N;let D=U.exec(z),P=W.exec(z),y=D?D.index:1/0,b=P?P.index:1/0;if(y<b)V++,N=y+D[0].length;else if(b<1/0){if(V--,V===0){R=b;break}N=b+P[0].length}else break}if(R===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${q} \u2014 the block was skipped.`);break}let A=z.substring(H,R),w=-1,T=0,I=0;while(I<A.length){let D=A.indexOf("@",I);if(D===-1)break;let P=A.substring(D);if(B.test(P)){T++,I=D+1;continue}if(j.test(P)){T--,I=D+1;continue}if(T===0&&/^@else(?![a-z])/.test(P)){w=D;break}I=D+1}let M;if(w!==-1){let D=A.slice(0,w),P=A.slice(w+5);M=_?D:P}else M=_?A:"";let E=`@${q}`.length;z=z.substring(0,F)+M+z.substring(R+E),O=!0}return z}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 _9=S(()=>{L2();u0();Y4();V0()});function w2($=16){let Y=new Uint8Array($);return crypto.getRandomValues(Y),btoa(String.fromCharCode(...Y))}function W9($,Y){if(!$)return Y?.nonceGenerator?.()??w2();let Z=A2.get($);if(!Z)Z=Y?.nonceGenerator?.()??w2(),A2.set($,Z);return Z}function yG($,Y){let Z=[];for(let[X,Q]of Object.entries($)){if(Q===void 0||Q===null)continue;if(typeof Q==="boolean"){if(Q)Z.push(X);continue}if(Array.isArray(Q)){let J=[...Q];if(Y&&(X==="script-src"||X==="style-src"))J=J.filter((G)=>!G.startsWith("'nonce-")),J.push(`'nonce-${Y}'`);if(J.length>0)Z.push(`${X} ${J.join(" ")}`)}}return Z.join("; ")}function T2($,Y){return`<meta http-equiv="Content-Security-Policy" content="${yG($,Y).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function M2($,Y,Z){if(!Y.enabled||!Y.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=Y.useNonce?W9(Z,Y):void 0,Q=T2(Y.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
3654
+ ${Q}`)}function I2($,Y,Z,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?W9(Y,J):void 0;return T2(J.directives,G)}),Q=Q.replace(/@cspNonce\b/g,()=>{if(!J?.enabled||!J.useNonce)return"";return W9(Y,J)}),J?.enabled&&J.useNonce)Y.cspNonce=W9(Y,J);return Q}var A2;var E2=S(()=>{A2=new WeakMap});import PG from"crypto";function vG($=CG){let Y=PG.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return Q4=Y,Y}function xG(){if(!Q4)vG();return Q4}function fG($=D2){let Y=xG();return`<input type="hidden" name="${$}" value="${Y}">`}function k2($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Y,Z,X)=>{return fG(X||D2)})}var CG=40,D2="_token",Q4=null;var b2=()=>{};async function S2($,Y,Z,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 gG(Q,J,Y,Z,X);else Q=await hG(Q,J,Y,Z,X)}return Q}async function gG($,Y,Z,X,Q){let{name:J,handler:G}=Y,K=`@${J}`,q=`@end${J}`,_=$,U=w1(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),W=[],B=U.exec(_);while(B!==null){let[j,z="",O=""]=B,L=B.index||0;try{let F=z?y2(z):[],H=O.trim(),V=await G(H,F,Z,X);W.push({original:j,processed:V,startIndex:L})}catch(F){let H=F instanceof Error?F.message:String(F);if(Q.debug)console.error(`Error processing custom directive @${J}:`,F);W.push({original:j,processed:s("CustomDirective",`Error in @${J}${z?`(${z})`:""}: ${H}`,l.EVALUATION_ERROR),startIndex:L})}B=U.exec(_)}for(let j=W.length-1;j>=0;j--){let{original:z,processed:O}=W[j];_=_.replace(z,O)}return _}async function hG($,Y,Z,X,Q){let{name:J,handler:G}=Y,K=$,q=w1(`@${J}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),_=[],U=q.exec(K);while(U!==null){let[j,z=""]=U,O=U.index||0;try{let L=y2(z),F=await G("",L,Z,X);_.push({original:j,processed:F,startIndex:O})}catch(L){let F=L instanceof Error?L.message:String(L);if(Q.debug)console.error(`Error processing custom directive @${J}:`,L);_.push({original:j,processed:s("CustomDirective",`Error in @${J}(${z}): ${F}`,l.EVALUATION_ERROR),startIndex:O})}U=q.exec(K)}let W=w1(`@${J}(?!\\w)(?!\\s*\\()`,"g"),B=W.exec(K);while(B!==null){let[j]=B,z=B.index||0;try{let O=await G("",[],Z,X);_.push({original:j,processed:O,startIndex:z})}catch(O){let L=O instanceof Error?O.message:String(O);if(Q.debug)console.error(`Error processing custom directive @${J}:`,O);_.push({original:j,processed:s("CustomDirective",`Error in @${J}: ${L}`,l.EVALUATION_ERROR),startIndex:z})}B=W.exec(K)}for(let j=_.length-1;j>=0;j--){let{original:z,processed:O}=_[j];K=K.replace(z,O)}return K}function y2($){if(!$.trim())return[];let Y=[],Z="",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 Z+=G;else if(G===","&&!X)Y.push(Z.trim()),Z="";else Z+=G}if(Z.trim())Y.push(Z.trim());return Y.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 P2=S(()=>{u0();T1()});import dG from"crypto";function j0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function B9($,Y,Z,X){let Q=$||Y;return Z?`${Q} ${X}`:Q}function mG(){return dG.randomUUID()}function z9($,Y){let Z=$;return Z=Z.replace(/@csrf/g,()=>{if(!Y.csrf||typeof Y.csrf!=="object"){let X=mG();Y.csrf={token:X}}if(Y.csrf.field)return Y.csrf.field;if(Y.csrf.token)return`<input type="hidden" name="_token" value="${j0(Y.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Z=Z.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,Q)=>{let J=Q.toUpperCase();if(Q&&!["GET","POST"].includes(J))return`<input type="hidden" name="_method" value="${j0(J)}">`;return X}),Z}function x2($,Y,Z=v2){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Q,J,G,K,q,_="")=>{let U=J||G||"POST",W=K||q||"",B=r0(_),j=U.toUpperCase(),z=["GET","POST"].includes(j)?j:"POST",O=`<form method="${j0(z)}" action="${j0(W)}"${B?` ${B}`:""}>`;if(O+=`
3654
3655
  ${z9("@csrf",Y)}`,!["GET","POST"].includes(j))O+=`
3655
- ${z9(`@method('${j}')`,Y)}`;return O}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Q,J,G,K,q,_="")=>{let U=J||G||"",W=K||q||"",B=s0(_),j=Z5(U,Y),z=j!==void 0&&j!==null?j:W||"",O=B.match(/type=['"]([^'"]+)['"]/i),L=O?O[1]:"text",F=X5(U,Y),H=B.match(/class=['"]([^'"]+)['"]/i),V=B9(H?H[1]:"",Z.input,F,Z.inputError),N=B.replace(/class=['"][^'"]+['"]/i,"");return N=N.replace(/type=['"][^'"]+['"]/i,""),`<input type="${j0(L)}" name="${j0(U)}" value="${j0(z)}" class="${V}"${N?` ${N}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Q,J,G="",K="")=>{let q=s0(G),_=Z5(J,Y)||K.trim(),U=X5(J,Y),W=q.match(/class=['"]([^'"]+)['"]/i),B=B9(W?W[1]:"",Z.input,U,Z.inputError),j=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${j0(J)}" class="${B}"${j?` ${j}`:""}>${j0(_)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Q,J,G="",K)=>{let q=s0(G),_=Z5(J,Y),U=X5(J,Y),W=q.match(/class=['"]([^'"]+)['"]/i),B=B9(W?W[1]:"",Z.input,U,Z.inputError),j=q.replace(/class=['"][^'"]+['"]/i,""),z=K;if(_!==void 0)z=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(O,L,F)=>{if((Array.isArray(_)?_.some((V)=>String(V)===F):String(_)===F)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return O});return`<select name="${j0(J)}" class="${B}"${j?` ${j}`:""}>${z}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="1",K="")=>{let q=s0(K),_=Z5(J,Y),U=_!==void 0&&(Array.isArray(_)?_.some((z)=>String(z)===G):_===!0||String(_)===G),W=q.match(/class=['"]([^'"]+)['"]/i),B=W?W[1]:Z.checkInput,j=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${j0(J)}" value="${j0(G)}" class="${B}"${U?" checked":""}${j?` ${j}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G,K="")=>{let q=s0(K),_=Z5(J,Y),U=_!==void 0&&_===G,W=q.match(/class=['"]([^'"]+)['"]/i),B=W?W[1]:Z.checkInput,j=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${j0(J)}" value="${j0(G)}" class="${B}"${U?" checked":""}${j?` ${j}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="")=>{let K=s0(G),q=K.match(/accept=['"]([^'"]+)['"]/i),_=q?q[1]:"",U=K.includes("multiple"),W=X5(J,Y),B=K.match(/class=['"]([^'"]+)['"]/i),j=B9(B?B[1]:"",Z.input,W,Z.inputError),z=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),O=[`<input type="file" name="${j0(J)}"`,`class="${j}"`];if(_)O.push(`accept="${j0(_)}"`);if(U)O.push("multiple");if(z)O.push(z);return`${O.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Q,J,G="",K)=>{let q=s0(G),_=q.match(/class=['"]([^'"]+)['"]/i),U=_?_[1]:Z.label,W=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${j0(J)}" class="${U}"${W?` ${W}`:""}>${K}</label>`}),X}function f2($,Y,Z=v2){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,Q,J)=>{try{if(X5(Q,Y))return J.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return C2(Q,Y);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Y.errors?.first==="function")return Y.errors.first(Q);return C2(Q,Y)}let q=K.trim();if(e(q)){let _=X0(q,Y);return _!==void 0?String(_):q}return q}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function X5($,Y){if(!Y.errors)return!1;if(typeof Y.errors.has==="function")return Y.errors.has($);if(typeof Y.errors==="object")return Object.prototype.hasOwnProperty.call(Y.errors,$);return!1}function C2($,Y){if(!Y.errors)return"";if(typeof Y.errors.get==="function")return Y.errors.get($);if(typeof Y.errors==="object"&&Object.prototype.hasOwnProperty.call(Y.errors,$)){let Z=Y.errors[$];return Array.isArray(Z)?Z[0]:String(Z)}return""}function Z5($,Y){let Z;if(Y.old&&typeof Y.old==="function")return Y.old($);if(Y.old&&typeof Y.old==="object")return Y.old[$];if($.endsWith("[]")){let X=$.slice(0,-2);if(Z=Y[X],Z!==void 0)return Z}return Y[$]}function s0($){if(!$.trim())return"";let Y=[],Z=$.trim(),X=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Q;while((Q=X.exec(Z))!==null){let[,J,,G]=Q;Y.push(`${J}="${G.trim()}"`)}return Y.join(" ")}var v2;var g2=b(()=>{V0();v2={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import h2 from"path";function hG($,Y=0){if(Y<=0)return!1;return Date.now()-$.loadedAt>Y}async function dG($,Y){if({...U4,...Y.i18n}.cache&&q4[$]){let Q=q4[$],J=Y.i18n?.cacheMaxAge??0;if(!hG(Q,J))return Q.translations}if(J5[$]?.state==="loading")return J5[$].promise;G4[$]="loading";let X=u2($,Y).then((Q)=>{return G4[$]="loaded",delete J5[$],Q}).catch((Q)=>{throw G4[$]="error",J5[$]={promise:X,state:"error",error:Q instanceof Error?Q:Error(String(Q))},Q});return J5[$]={promise:X,state:"loading"},X}async function u2($,Y){let Z={...U4,...Y.i18n},X=h2.resolve(import.meta.dir,"..",Z.translationsDir),Q=pG(Z.format),J=h2.join(X,`${$}${Q}`);try{let G={};try{let K=await import(J);G=K.default||K}catch(K){let q=await Bun.file(J).text();if(Z.format==="yaml"||Z.format==="yml")G=uG(q);else if(Z.format==="json")G=JSON.parse(q);else throw K}if(Z.cache)q4[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(G){if(Y.debug)console.error(`Error loading translation file for locale "${$}":`,G);if($!==Z.defaultLocale)return u2(Z.defaultLocale,Y);return{}}}async function mG($,Y){return dG($,Y)}function uG($){let Y={},Z=$.split(`
3656
- `),X=[{obj:Y,indent:-1}];for(let Q of Z){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]=q,W=_.trim(),B=U.trim();if(B==="")K[W]={},X.push({obj:K[W],indent:G});else K[W]=lG(B)}}return Y}function lG($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Y=$.toLowerCase();if(Y==="true"||Y==="yes")return!0;if(Y==="false"||Y==="no")return!1;if(Y==="null"||Y==="~")return null;let Z=Number($);if(!Number.isNaN(Z))return Z;return $}function pG($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"json":default:return".json"}}function cG($,Y){for(let Z of $){let X=Z.trim(),Q=X.match(/^\{(\d+)\}\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10);if(Y===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(Y>=G&&Y<=K)return J[3];continue}}if($.length===2)return Y===1?$[0].trim():$[1].trim();if(Y<$.length)return $[Y].trim();return $[$.length-1].trim()}function iG($,Y={}){return l2($,Y)}function l2($,Y){let Z="",X=0;while(X<$.length)if($[X]==="{"){let Q=nG($,X);if(Q===-1){Z+=$[X],X++;continue}let J=$.slice(X+1,Q);Z+=oG(J,Y),X=Q+1}else if($[X]==="'"&&X+1<$.length)if($[X+1]==="'")Z+="'",X+=2;else if($[X+1]==="{"||$[X+1]==="}")Z+=$[X+1],X+=2;else Z+=$[X],X++;else Z+=$[X],X++;return Z}function nG($,Y){let Z=0;for(let X=Y;X<$.length;X++)if($[X]==="{")Z++;else if($[X]==="}"){if(Z--,Z===0)return X}return-1}function oG($,Y){let Z=sG($);if(Z.length===0)return`{${$}}`;let X=Z[0].trim(),Q=Y[X];if(Z.length===1)return Q!==void 0?String(Q):`{${X}}`;switch(Z[1].trim().toLowerCase()){case"plural":return rG(Q,Z.slice(2).join(","),Y);case"select":return tG(Q,Z.slice(2).join(","));case"selectordinal":return eG(Q,Z.slice(2).join(","));case"number":return YK(Q,Z[2]?.trim());case"date":return ZK(Q,Z[2]?.trim());case"time":return XK(Q,Z[2]?.trim());default:return Q!==void 0?String(Q):`{${$}}`}}function sG($){let Y=[],Z="",X=0;for(let Q=0;Q<$.length;Q++){let J=$[Q];if(J==="{")X++,Z+=J;else if(J==="}")X--,Z+=J;else if(J===","&&X===0)Y.push(Z),Z="";else Z+=J}if(Z)Y.push(Z);return Y}function rG($,Y,Z){let X=Number($)||0,Q=_4(Y),J=`=${X}`;if(Q[J])return K4(Q[J],X,Z);let G=aG(X);if(Q[G])return K4(Q[G],X,Z);if(Q.other)return K4(Q.other,X,Z);return String(X)}function K4($,Y,Z){let X=$.replace(/#/g,String(Y));return l2(X,Z)}function aG($){let Y=Math.abs($),Z=Math.floor(Y),X=String($).includes(".")?String($).split(".")[1].length:0;if(Z===1&&X===0)return"one";return"other"}function tG($,Y){let Z=String($||""),X=_4(Y);if(X[Z])return X[Z];return X.other||String($)}function eG($,Y){let Z=Number($)||0,X=_4(Y),Q=$K(Z);if(X[Q])return X[Q].replace(/#/g,String(Z));if(X.other)return X.other.replace(/#/g,String(Z));return String(Z)}function $K($){let Y=Math.abs($),Z=Y%10,X=Y%100;if(Z===1&&X!==11)return"one";if(Z===2&&X!==12)return"two";if(Z===3&&X!==13)return"few";return"other"}function _4($){let Y={},Z=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,X=Z.exec($);while(X!==null)Y[X[1]]=X[2],X=Z.exec($);return Y}function YK($,Y){let Z=Number($);if(Number.isNaN(Z))return String($);switch(Y){case"integer":return Math.floor(Z).toLocaleString();case"percent":return`${(Z*100).toFixed(0)}%`;case"currency":return Z.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Z.toLocaleString()}}function ZK($,Y){let Z=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Z.getTime()))return String($);let X={};switch(Y){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 Z.toLocaleDateString(void 0,X)}function XK($,Y){let Z=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Z.getTime()))return String($);let X={};switch(Y){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 Z.toLocaleTimeString(void 0,X)}function JK($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function d2($,Y,Z=!0,X={}){let Q=$.split("."),J=Y;for(let K of Q){if(J===void 0||J===null)break;J=J[K]}if(J===void 0||J===null)return Z?$:"";let G=String(J);if(JK(G))return iG(G,X);if(G.includes("|")&&"count"in X){let K=Number(X.count),q=G.split("|");G=cG(q,K)}for(let[K,q]of Object.entries(X)){let _=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${_}`,"g"),String(q))}return G}async function p2($,Y,Z,X){let Q=$,J=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...U4,...X.i18n},K=await mG(G.locale,X);Y.__translations=K,Y.__locale=G.locale,Y.__i18nConfig=G,Q=await m2(Q,J,async(U,W,B,j,z)=>{try{let O={};if(B)try{let F=[()=>JSON.parse(B),()=>{let H=`{"data":${B}}`,V=JSON.parse(H);return typeof V.data==="object"?V.data:{}},()=>{return z0(B,Y)}];for(let H of F)try{if(O=H(),Object.keys(O).length>0)break}catch{}}catch(F){if(X.debug)console.error("Error parsing parameters for @translate directive:",F)}return d2(W,K,G.fallbackToKey,O)||j.trim()}catch(O){if(X.debug)console.error("Error processing @translate directive:",O);return s("Translate",`Error in @translate('${W}'): ${O instanceof Error?O.message:String(O)}`,l.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((W,B)=>console.warn(`Match ${B}: ${W[0]}, Key: ${W[1]}, Params: ${W[2]||"none"}`))}return Q=await m2(Q,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(U,W,B,j)=>{try{let z={};if(B)try{let O=[()=>JSON.parse(B),()=>{let L=`{"data":${B}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return z0(B,Y)}];for(let L of O)try{if(z=L(),Object.keys(z).length>0)break}catch{}}catch(O){if(X.debug)console.error("Error parsing parameters for @translate directive:",O)}return d2(W,K,G.fallbackToKey,z)}catch(z){if(X.debug)console.error("Error processing @translate directive:",z);return s("Translate",`Error in @translate('${W}'): ${z instanceof Error?z.message:String(z)}`,l.EVALUATION_ERROR)}}),Q}async function m2($,Y,Z){let X=[];return $.replace(Y,(J,...G)=>{let K=Z(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 U4,q4,J5,G4;var c2=b(()=>{u0();V0();U4={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},q4={},J5={},G4={}});var a2={};r(a2,{processLoops:()=>W4});function KK($,Y){let Z=/@component\s*\(/g,X=$,Q,J=[];while((Q=Z.exec(X))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,_=K+1;while(_<X.length&&q>0){if(X[_]==="(")q++;else if(X[_]===")"){if(q--,q===0)break}_++}if(q!==0)continue;let U=X.substring(K+1,_),W=_+1,B=U.match(/^\s*['"]([^'"]+)['"]/);if(!B)continue;let j=B[1],z=U.slice(B[0].length),O=z.match(/^\s*,\s*/);if(!O)continue;let L=z.slice(O[0].length).trim();if(!L)continue;try{let F=z0(L,Y),H=JSON.stringify(F),V=`@component('${j}', ${H})`;J.push({start:G,end:W,replacement:V})}catch{continue}}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:_}=J[G];X=X.substring(0,K)+_+X.substring(q)}return X}function j9($,Y,Z){let X=$,Q=new RegExp(`${Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),J;while((J=Q.exec(X))!==null){let G=J.index,K=G+J[0].length-1,q=1,_=K+1,U=null,W=!1;while(_<X.length&&q>0){let z=X[_];if(W){W=!1,_++;continue}if(z==="\\"&&U){W=!0,_++;continue}if(U){if(z===U)U=null;_++;continue}if(z==='"'||z==="'"||z==="`"){U=z,_++;continue}if(z==="(")q++;else if(z===")"){if(q--,q===0)break}_++}if(q!==0)break;let B=X.substring(K+1,_),j=Z(B);X=X.substring(0,G)+j+X.substring(_+1)}return X}function qK($,Y){let Z=$;return Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,Q)=>{if(Q in Y)return`:${Q}="${Q}"`;return X}),Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,Q,J)=>{try{let G=Object.keys(Y),K=Object.values(Y);l1(J);let _=Y0(J,G)(...K),W=JSON.stringify(_).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return`__stx_${Q}="${W}"`}catch(G){return X}}),Z}function UK($,Y){let Z=$;return Z=j9(Z,"@break",(X)=>{try{let J=`!!(${X.trim()})`,G;if(e(J)){let K=Y0(J,Object.keys(Y));G=Boolean(K(...Object.values(Y)))}else G=Boolean(X0(J,Y));return G?O9:""}catch{return""}}),Z=j9(Z,"@continue",(X)=>{try{let J=`!!(${X.trim()})`,G;if(e(J)){let K=Y0(J,Object.keys(Y));G=Boolean(K(...Object.values(Y)))}else G=Boolean(X0(J,Y));return G?H9:""}catch{return""}}),Z}function _K($){let Y=$;return Y=Y.replace(/@break(?!\()/g,O9),Y=Y.replace(/@continue(?!\()/g,H9),Y}function i2($){let Y=$.includes(O9),Z=Y?$.substring(0,$.indexOf(O9)):$;return{hasBreak:Y,content:Z}}function n2($){let Y=$.includes(H9),Z=Y?$.substring(0,$.indexOf(H9)):$;return{hasContinue:Y,content:Z}}function s2($){let Y=$;return Y=j9(Y,"@break",(Z)=>{let X=Z.trim();if(!R5(X))return"";return`\`; if (${X}) { break; } result += \``}),Y=j9(Y,"@continue",(Z)=>{let X=Z.trim();if(!R5(X))return"";return`\`; if (${X}) { continue; } result += \``}),Y=Y.replace(/@break(?!\()/g,"`; break; result += `"),Y=Y.replace(/@continue(?!\()/g,"`; continue; result += `"),Y}function WK($){let Y=/@forelse\s*\(/g,Z,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,W)=>U.pos-W.pos);let K=[],q=0;for(let U of X)q+=U.delta,K.push({pos:U.pos,depth:q});function _(U){let W=0,B=K.length-1,j=0;while(W<=B){let z=W+B>>1;if(K[z].pos<=U)j=K[z].depth,W=z+1;else B=z-1}return j}while((Z=Y.exec($))!==null){if(_(Z.index)>0)continue;let U=Z.index,W=Z.index+Z[0].length-1,B=1,j=W+1,z=-1;while(j<$.length&&B>0){if($[j]==="(")B++;else if($[j]===")"){if(B--,B===0){z=j;break}}j++}if(z===-1)continue;let O=$.substring(W+1,z),L=O.indexOf(" as ");if(L===-1)continue;let F=O.substring(0,L).trim(),H=O.substring(L+4).trim(),V=z+1,N=1,R=V,A=/@forelse\s*\(/g,w=/@endforelse/g,T=-1;while(N>0&&R<$.length){A.lastIndex=R,w.lastIndex=R;let y=A.exec($),S=w.exec($);if(!S)break;if(y&&y.index<S.index)N++,R=y.index+y[0].length;else{if(N--,N===0){T=S.index;break}R=S.index+11}}if(T===-1)continue;let I=$.substring(V,T),M=T+11,E=-1,D=0,P=0;while(P<I.length){let y=I.indexOf("@",P);if(y===-1)break;let S=I.substring(y);if(/^@forelse\s*\(/.test(S))D++,P=y+1;else if(S.startsWith("@endforelse"))D--,P=y+11;else if(D===0&&S.startsWith("@empty")){if(I.length<=y+6||!/[a-z]/i.test(I[y+6])){E=y;break}P=y+1}else P=y+1}if(E===-1)continue;return{start:U,end:M,arrayExpr:F,itemVar:H,foreachContent:I.substring(0,E),emptyContent:I.substring(E+6)}}return null}function o2($,Y){let Z=$;while(!0){let X=WK(Z);if(!X)break;let{start:Q,end:J,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:_}=X;try{let U;if(e(G))U=Y0(G,Object.keys(Y))(...Object.values(Y));else U=X0(G,Y);let W;if(!Array.isArray(U)||U.length===0)W=_;else W=`@foreach (${G} as ${K})${q}@endforeach`;Z=Z.substring(0,Q)+W+Z.substring(J)}catch(U){let W=U instanceof Error?U.message:String(U),B=s("Forelse",`Error in @forelse(${G} as ${K}): ${W}`,l.EVALUATION_ERROR);Z=Z.substring(0,Q)+B+Z.substring(J)}}return Z}function W4($,Y,Z,X){let Q=$;Q=o2(Q,Y);function J(q){let _=/@foreach\s*\(/g,U;while((U=_.exec(q))!==null){let W=U.index,B=U.index+U[0].length-1,j=1,z=B+1,O=-1;while(z<q.length&&j>0){if(q[z]==="(")j++;else if(q[z]===")"){if(j--,j===0){O=z;break}}z++}if(O===-1)continue;let L=q.substring(B+1,O),F=L.indexOf(" as ");if(F===-1)continue;let H=W,V=L.substring(0,F),N=L.substring(F+4),R=O+1,A=1,w=R,T=/@foreach\s*\(/g,I=/@endforeach/g;while(A>0&&w<q.length){T.lastIndex=w,I.lastIndex=w;let M=T.exec(q),E=I.exec(q);if(!E)break;if(M&&M.index<E.index)A++,w=M.index+M[0].length;else{if(A--,A===0){let D=q.substring(R,E.index),P=E.index+11;return{start:H,end:P,arrayExpr:V,itemVar:N,content:D}}w=E.index+11}}}return null}function G(q,_){let U=q;while(!0){let W=J(U);if(!W)break;let{start:B,end:j,arrayExpr:z,itemVar:O,content:L}=W;try{let F=z.trim(),H;if(e(F))H=Y0(F,Object.keys(_))(...Object.values(_));else H=X0(F,_);let V=!1;if(!Array.isArray(H))if(H instanceof Map)H=Array.from(H),V=!0;else if(H instanceof Set)H=Array.from(H);else if(typeof H==="string")H=Array.from(H);else if(H&&typeof H==="object"&&!(H instanceof Date)&&!(H instanceof RegExp))H=Object.entries(H),V=!0;else{let M=s("Foreach",`Error in @foreach: ${F} is not iterable`,l.TYPE_ERROR);U=U.substring(0,B)+M+U.substring(j);continue}let N=X?.loops?.useAltLoopVariable??GK,R=O.trim(),A=null,w;if(R.includes("=>")){let M=R.split("=>").map((E)=>E.trim());if(M.length===2)A=M[0],w=M[1];else w=R}else w=R;let T="",I=H;for(let M=0;M<I.length;M++){let E=I[M],D={index:M,iteration:M+1,first:M===0,last:M===I.length-1,count:I.length},P={..._,loop:D,$loop:D};if(w.startsWith("[")&&w.endsWith("]")){let g=w.slice(1,-1).split(",").map((h)=>h.trim());if(Array.isArray(E))g.forEach((h,n)=>{if(h)P[h]=E[n]});else P[w]=E}else P[w]=E;if(A)if(V&&Array.isArray(E)&&E.length===2)P[A]=E[0],P[w]=E[1];else P[A]=M;let y=UK(L,P),S=n2(y);if(S.hasContinue){T+=S.content;continue}let k=i2(y);if(k.hasBreak){T+=k.content;break}if(y=o2(y,P),y=G(y,P),y=D1(y,P,Z),y=_K(y),k=i2(y),k.hasBreak){T+=k.content;break}if(S=n2(y),S.hasContinue){T+=S.content;continue}y=Q1(y,P,Z),y=qK(y,P),y=KK(y,P),T+=y}U=U.substring(0,B)+T+U.substring(j)}catch(F){let H=s("Foreach",`Error in @foreach(${z.trim()} as ${O.trim()}): ${F instanceof Error?F.message:String(F)}`,l.EVALUATION_ERROR);U=U.substring(0,B)+H+U.substring(j)}}return U}Q=G(Q,Y),Q=BK(Q,Y);let K=X?.loops?.maxWhileIterations??QK;return Q=zK(Q,Y,K),Q}function r2($){return R5($)}function BK($,Y){let Z=$,X=!0;while(X){X=!1;let Q=Z.match(/@for\s*\(/);if(!Q||Q.index===void 0)break;let J=Q.index,G=J+Q[0].length-1,K=T0(Z,"(",")",G);if(K===-1)break;let q=Z.slice(G+1,K),_=K+1,U=U9(Z.slice(J),"for","endfor");if(U.length===0)break;let W=U[0].content,B=J+U[0].end;if(!r2(q)){let j=s("For",`Unsafe expression in @for: ${q}`,l.UNSAFE_EXPRESSION);Z=Z.substring(0,J)+j+Z.substring(B),X=!0;continue}try{let j=Object.keys(Y),z=Object.values(Y),O=W.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(H,V)=>{return`\${${V}}`});O=s2(O);let F=Function(...j,`
3656
+ ${z9(`@method('${j}')`,Y)}`;return O}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Q,J,G,K,q,_="")=>{let U=J||G||"",W=K||q||"",B=r0(_),j=Z5(U,Y),z=j!==void 0&&j!==null?j:W||"",O=B.match(/type=['"]([^'"]+)['"]/i),L=O?O[1]:"text",F=X5(U,Y),H=B.match(/class=['"]([^'"]+)['"]/i),V=B9(H?H[1]:"",Z.input,F,Z.inputError),N=B.replace(/class=['"][^'"]+['"]/i,"");return N=N.replace(/type=['"][^'"]+['"]/i,""),`<input type="${j0(L)}" name="${j0(U)}" value="${j0(z)}" class="${V}"${N?` ${N}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Q,J,G="",K="")=>{let q=r0(G),_=Z5(J,Y)||K.trim(),U=X5(J,Y),W=q.match(/class=['"]([^'"]+)['"]/i),B=B9(W?W[1]:"",Z.input,U,Z.inputError),j=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${j0(J)}" class="${B}"${j?` ${j}`:""}>${j0(_)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Q,J,G="",K)=>{let q=r0(G),_=Z5(J,Y),U=X5(J,Y),W=q.match(/class=['"]([^'"]+)['"]/i),B=B9(W?W[1]:"",Z.input,U,Z.inputError),j=q.replace(/class=['"][^'"]+['"]/i,""),z=K;if(_!==void 0)z=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(O,L,F)=>{if((Array.isArray(_)?_.some((V)=>String(V)===F):String(_)===F)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return O});return`<select name="${j0(J)}" class="${B}"${j?` ${j}`:""}>${z}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="1",K="")=>{let q=r0(K),_=Z5(J,Y),U=_!==void 0&&(Array.isArray(_)?_.some((z)=>String(z)===G):_===!0||String(_)===G),W=q.match(/class=['"]([^'"]+)['"]/i),B=W?W[1]:Z.checkInput,j=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${j0(J)}" value="${j0(G)}" class="${B}"${U?" checked":""}${j?` ${j}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G,K="")=>{let q=r0(K),_=Z5(J,Y),U=_!==void 0&&_===G,W=q.match(/class=['"]([^'"]+)['"]/i),B=W?W[1]:Z.checkInput,j=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${j0(J)}" value="${j0(G)}" class="${B}"${U?" checked":""}${j?` ${j}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="")=>{let K=r0(G),q=K.match(/accept=['"]([^'"]+)['"]/i),_=q?q[1]:"",U=K.includes("multiple"),W=X5(J,Y),B=K.match(/class=['"]([^'"]+)['"]/i),j=B9(B?B[1]:"",Z.input,W,Z.inputError),z=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),O=[`<input type="file" name="${j0(J)}"`,`class="${j}"`];if(_)O.push(`accept="${j0(_)}"`);if(U)O.push("multiple");if(z)O.push(z);return`${O.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Q,J,G="",K)=>{let q=r0(G),_=q.match(/class=['"]([^'"]+)['"]/i),U=_?_[1]:Z.label,W=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${j0(J)}" class="${U}"${W?` ${W}`:""}>${K}</label>`}),X}function f2($,Y,Z=v2){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,Q,J)=>{try{if(X5(Q,Y))return J.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return C2(Q,Y);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Y.errors?.first==="function")return Y.errors.first(Q);return C2(Q,Y)}let q=K.trim();if(e(q)){let _=X0(q,Y);return _!==void 0?String(_):q}return q}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function X5($,Y){if(!Y.errors)return!1;if(typeof Y.errors.has==="function")return Y.errors.has($);if(typeof Y.errors==="object")return Object.prototype.hasOwnProperty.call(Y.errors,$);return!1}function C2($,Y){if(!Y.errors)return"";if(typeof Y.errors.get==="function")return Y.errors.get($);if(typeof Y.errors==="object"&&Object.prototype.hasOwnProperty.call(Y.errors,$)){let Z=Y.errors[$];return Array.isArray(Z)?Z[0]:String(Z)}return""}function Z5($,Y){let Z;if(Y.old&&typeof Y.old==="function")return Y.old($);if(Y.old&&typeof Y.old==="object")return Y.old[$];if($.endsWith("[]")){let X=$.slice(0,-2);if(Z=Y[X],Z!==void 0)return Z}return Y[$]}function r0($){if(!$.trim())return"";let Y=[],Z=$.trim(),X=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Q;while((Q=X.exec(Z))!==null){let[,J,,G]=Q;Y.push(`${J}="${G.trim()}"`)}return Y.join(" ")}var v2;var g2=S(()=>{V0();v2={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import h2 from"path";function uG($,Y=0){if(Y<=0)return!1;return Date.now()-$.loadedAt>Y}async function lG($,Y){if({...U4,...Y.i18n}.cache&&q4[$]){let Q=q4[$],J=Y.i18n?.cacheMaxAge??0;if(!uG(Q,J))return Q.translations}if(J5[$]?.state==="loading")return J5[$].promise;G4[$]="loading";let X=u2($,Y).then((Q)=>{return G4[$]="loaded",delete J5[$],Q}).catch((Q)=>{throw G4[$]="error",J5[$]={promise:X,state:"error",error:Q instanceof Error?Q:Error(String(Q))},Q});return J5[$]={promise:X,state:"loading"},X}async function u2($,Y){let Z={...U4,...Y.i18n},X=h2.resolve(import.meta.dir,"..",Z.translationsDir),Q=nG(Z.format),J=h2.join(X,`${$}${Q}`);try{let G={};try{let K=await import(J);G=K.default||K}catch(K){let q=await Bun.file(J).text();if(Z.format==="yaml"||Z.format==="yml")G=cG(q);else if(Z.format==="json")G=JSON.parse(q);else throw K}if(Z.cache)q4[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(G){if(Y.debug)console.error(`Error loading translation file for locale "${$}":`,G);if($!==Z.defaultLocale)return u2(Z.defaultLocale,Y);return{}}}async function pG($,Y){return lG($,Y)}function cG($){let Y={},Z=$.split(`
3657
+ `),X=[{obj:Y,indent:-1}];for(let Q of Z){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]=q,W=_.trim(),B=U.trim();if(B==="")K[W]={},X.push({obj:K[W],indent:G});else K[W]=iG(B)}}return Y}function iG($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Y=$.toLowerCase();if(Y==="true"||Y==="yes")return!0;if(Y==="false"||Y==="no")return!1;if(Y==="null"||Y==="~")return null;let Z=Number($);if(!Number.isNaN(Z))return Z;return $}function nG($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"json":default:return".json"}}function oG($,Y){for(let Z of $){let X=Z.trim(),Q=X.match(/^\{(\d+)\}\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10);if(Y===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(Y>=G&&Y<=K)return J[3];continue}}if($.length===2)return Y===1?$[0].trim():$[1].trim();if(Y<$.length)return $[Y].trim();return $[$.length-1].trim()}function sG($,Y={}){return l2($,Y)}function l2($,Y){let Z="",X=0;while(X<$.length)if($[X]==="{"){let Q=rG($,X);if(Q===-1){Z+=$[X],X++;continue}let J=$.slice(X+1,Q);Z+=aG(J,Y),X=Q+1}else if($[X]==="'"&&X+1<$.length)if($[X+1]==="'")Z+="'",X+=2;else if($[X+1]==="{"||$[X+1]==="}")Z+=$[X+1],X+=2;else Z+=$[X],X++;else Z+=$[X],X++;return Z}function rG($,Y){let Z=0;for(let X=Y;X<$.length;X++)if($[X]==="{")Z++;else if($[X]==="}"){if(Z--,Z===0)return X}return-1}function aG($,Y){let Z=tG($);if(Z.length===0)return`{${$}}`;let X=Z[0].trim(),Q=Y[X];if(Z.length===1)return Q!==void 0?String(Q):`{${X}}`;switch(Z[1].trim().toLowerCase()){case"plural":return eG(Q,Z.slice(2).join(","),Y);case"select":return YK(Q,Z.slice(2).join(","));case"selectordinal":return ZK(Q,Z.slice(2).join(","));case"number":return JK(Q,Z[2]?.trim());case"date":return QK(Q,Z[2]?.trim());case"time":return GK(Q,Z[2]?.trim());default:return Q!==void 0?String(Q):`{${$}}`}}function tG($){let Y=[],Z="",X=0;for(let Q=0;Q<$.length;Q++){let J=$[Q];if(J==="{")X++,Z+=J;else if(J==="}")X--,Z+=J;else if(J===","&&X===0)Y.push(Z),Z="";else Z+=J}if(Z)Y.push(Z);return Y}function eG($,Y,Z){let X=Number($)||0,Q=_4(Y),J=`=${X}`;if(Q[J])return K4(Q[J],X,Z);let G=$K(X);if(Q[G])return K4(Q[G],X,Z);if(Q.other)return K4(Q.other,X,Z);return String(X)}function K4($,Y,Z){let X=$.replace(/#/g,String(Y));return l2(X,Z)}function $K($){let Y=Math.abs($),Z=Math.floor(Y),X=String($).includes(".")?String($).split(".")[1].length:0;if(Z===1&&X===0)return"one";return"other"}function YK($,Y){let Z=String($||""),X=_4(Y);if(X[Z])return X[Z];return X.other||String($)}function ZK($,Y){let Z=Number($)||0,X=_4(Y),Q=XK(Z);if(X[Q])return X[Q].replace(/#/g,String(Z));if(X.other)return X.other.replace(/#/g,String(Z));return String(Z)}function XK($){let Y=Math.abs($),Z=Y%10,X=Y%100;if(Z===1&&X!==11)return"one";if(Z===2&&X!==12)return"two";if(Z===3&&X!==13)return"few";return"other"}function _4($){let Y={},Z=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,X=Z.exec($);while(X!==null)Y[X[1]]=X[2],X=Z.exec($);return Y}function JK($,Y){let Z=Number($);if(Number.isNaN(Z))return String($);switch(Y){case"integer":return Math.floor(Z).toLocaleString();case"percent":return`${(Z*100).toFixed(0)}%`;case"currency":return Z.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Z.toLocaleString()}}function QK($,Y){let Z=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Z.getTime()))return String($);let X={};switch(Y){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 Z.toLocaleDateString(void 0,X)}function GK($,Y){let Z=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Z.getTime()))return String($);let X={};switch(Y){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 Z.toLocaleTimeString(void 0,X)}function KK($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function d2($,Y,Z=!0,X={}){let Q=$.split("."),J=Y;for(let K of Q){if(J===void 0||J===null)break;J=J[K]}if(J===void 0||J===null)return Z?$:"";let G=String(J);if(KK(G))return sG(G,X);if(G.includes("|")&&"count"in X){let K=Number(X.count),q=G.split("|");G=oG(q,K)}for(let[K,q]of Object.entries(X)){let _=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${_}`,"g"),String(q))}return G}async function p2($,Y,Z,X){let Q=$,J=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...U4,...X.i18n},K=await pG(G.locale,X);Y.__translations=K,Y.__locale=G.locale,Y.__i18nConfig=G,Q=await m2(Q,J,async(U,W,B,j,z)=>{try{let O={};if(B)try{let F=[()=>JSON.parse(B),()=>{let H=`{"data":${B}}`,V=JSON.parse(H);return typeof V.data==="object"?V.data:{}},()=>{return z0(B,Y)}];for(let H of F)try{if(O=H(),Object.keys(O).length>0)break}catch{}}catch(F){if(X.debug)console.error("Error parsing parameters for @translate directive:",F)}return d2(W,K,G.fallbackToKey,O)||j.trim()}catch(O){if(X.debug)console.error("Error processing @translate directive:",O);return s("Translate",`Error in @translate('${W}'): ${O instanceof Error?O.message:String(O)}`,l.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((W,B)=>console.warn(`Match ${B}: ${W[0]}, Key: ${W[1]}, Params: ${W[2]||"none"}`))}return Q=await m2(Q,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(U,W,B,j)=>{try{let z={};if(B)try{let O=[()=>JSON.parse(B),()=>{let L=`{"data":${B}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return z0(B,Y)}];for(let L of O)try{if(z=L(),Object.keys(z).length>0)break}catch{}}catch(O){if(X.debug)console.error("Error parsing parameters for @translate directive:",O)}return d2(W,K,G.fallbackToKey,z)}catch(z){if(X.debug)console.error("Error processing @translate directive:",z);return s("Translate",`Error in @translate('${W}'): ${z instanceof Error?z.message:String(z)}`,l.EVALUATION_ERROR)}}),Q}async function m2($,Y,Z){let X=[];return $.replace(Y,(J,...G)=>{let K=Z(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 U4,q4,J5,G4;var c2=S(()=>{u0();V0();U4={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},q4={},J5={},G4={}});var t2={};r(t2,{processLoops:()=>W4});function _K($,Y){let Z=/@component\s*\(/g,X=$,Q,J=[];while((Q=Z.exec(X))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,_=K+1;while(_<X.length&&q>0){if(X[_]==="(")q++;else if(X[_]===")"){if(q--,q===0)break}_++}if(q!==0)continue;let U=X.substring(K+1,_),W=_+1,B=U.match(/^\s*['"]([^'"]+)['"]/);if(!B)continue;let j=B[1],z=U.slice(B[0].length),O=z.match(/^\s*,\s*/);if(!O)continue;let L=z.slice(O[0].length).trim();if(!L)continue;try{let F=z0(L,Y),H=JSON.stringify(F),V=`@component('${j}', ${H})`;J.push({start:G,end:W,replacement:V})}catch{continue}}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:_}=J[G];X=X.substring(0,K)+_+X.substring(q)}return X}function j9($,Y,Z){let X=$,Q=new RegExp(`${Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),J;while((J=Q.exec(X))!==null){let G=J.index,K=G+J[0].length-1,q=1,_=K+1,U=null,W=!1;while(_<X.length&&q>0){let z=X[_];if(W){W=!1,_++;continue}if(z==="\\"&&U){W=!0,_++;continue}if(U){if(z===U)U=null;_++;continue}if(z==='"'||z==="'"||z==="`"){U=z,_++;continue}if(z==="(")q++;else if(z===")"){if(q--,q===0)break}_++}if(q!==0)break;let B=X.substring(K+1,_),j=Z(B);X=X.substring(0,G)+j+X.substring(_+1)}return X}function WK($,Y){let Z=$;return Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,Q)=>{if(Q in Y)return`:${Q}="${Q}"`;return X}),Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,Q,J)=>{try{let G=Object.keys(Y),K=Object.values(Y);p1(J);let _=Y0(J,G)(...K),W=JSON.stringify(_).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return`__stx_${Q}="${W}"`}catch(G){return X}}),Z}function BK($,Y){let Z=$;return Z=j9(Z,"@break",(X)=>{try{let J=`!!(${X.trim()})`,G;if(e(J)){let K=Y0(J,Object.keys(Y));G=Boolean(K(...Object.values(Y)))}else G=Boolean(X0(J,Y));return G?O9:""}catch{return""}}),Z=j9(Z,"@continue",(X)=>{try{let J=`!!(${X.trim()})`,G;if(e(J)){let K=Y0(J,Object.keys(Y));G=Boolean(K(...Object.values(Y)))}else G=Boolean(X0(J,Y));return G?H9:""}catch{return""}}),Z}function zK($){let Y=$;return Y=Y.replace(/@break(?!\()/g,O9),Y=Y.replace(/@continue(?!\()/g,H9),Y}function i2($){let Y=$.includes(O9),Z=Y?$.substring(0,$.indexOf(O9)):$;return{hasBreak:Y,content:Z}}function n2($){let Y=$.includes(H9),Z=Y?$.substring(0,$.indexOf(H9)):$;return{hasContinue:Y,content:Z}}function s2($){let Y=$;return Y=j9(Y,"@break",(Z)=>{let X=Z.trim();if(!R5(X))return"";return`\`; if (${X}) { break; } result += \``}),Y=j9(Y,"@continue",(Z)=>{let X=Z.trim();if(!R5(X))return"";return`\`; if (${X}) { continue; } result += \``}),Y=Y.replace(/@break(?!\()/g,"`; break; result += `"),Y=Y.replace(/@continue(?!\()/g,"`; continue; result += `"),Y}function jK($){let Y=/@forelse\s*\(/g,Z,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,W)=>U.pos-W.pos);let K=[],q=0;for(let U of X)q+=U.delta,K.push({pos:U.pos,depth:q});function _(U){let W=0,B=K.length-1,j=0;while(W<=B){let z=W+B>>1;if(K[z].pos<=U)j=K[z].depth,W=z+1;else B=z-1}return j}while((Z=Y.exec($))!==null){if(_(Z.index)>0)continue;let U=Z.index,W=Z.index+Z[0].length-1,B=1,j=W+1,z=-1;while(j<$.length&&B>0){if($[j]==="(")B++;else if($[j]===")"){if(B--,B===0){z=j;break}}j++}if(z===-1)continue;let O=$.substring(W+1,z),L=O.indexOf(" as ");if(L===-1)continue;let F=O.substring(0,L).trim(),H=O.substring(L+4).trim(),V=z+1,N=1,R=V,A=/@forelse\s*\(/g,w=/@endforelse/g,T=-1;while(N>0&&R<$.length){A.lastIndex=R,w.lastIndex=R;let y=A.exec($),b=w.exec($);if(!b)break;if(y&&y.index<b.index)N++,R=y.index+y[0].length;else{if(N--,N===0){T=b.index;break}R=b.index+11}}if(T===-1)continue;let I=$.substring(V,T),M=T+11,E=-1,D=0,P=0;while(P<I.length){let y=I.indexOf("@",P);if(y===-1)break;let b=I.substring(y);if(/^@forelse\s*\(/.test(b))D++,P=y+1;else if(b.startsWith("@endforelse"))D--,P=y+11;else if(D===0&&b.startsWith("@empty")){if(I.length<=y+6||!/[a-z]/i.test(I[y+6])){E=y;break}P=y+1}else P=y+1}if(E===-1)continue;return{start:U,end:M,arrayExpr:F,itemVar:H,foreachContent:I.substring(0,E),emptyContent:I.substring(E+6)}}return null}function o2($,Y){let Z=$;while(!0){let X=jK(Z);if(!X)break;let{start:Q,end:J,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:_}=X;try{let U;if(e(G))U=Y0(G,Object.keys(Y))(...Object.values(Y));else U=X0(G,Y);let W;if(!Array.isArray(U)||U.length===0)W=_;else W=`@foreach (${G} as ${K})${q}@endforeach`;Z=Z.substring(0,Q)+W+Z.substring(J)}catch(U){let W=U instanceof Error?U.message:String(U),B=s("Forelse",`Error in @forelse(${G} as ${K}): ${W}`,l.EVALUATION_ERROR);Z=Z.substring(0,Q)+B+Z.substring(J)}}return Z}function W4($,Y,Z,X){let Q=$;Q=o2(Q,Y);function J(q){let _=/@foreach\s*\(/g,U;while((U=_.exec(q))!==null){let W=U.index,B=U.index+U[0].length-1,j=1,z=B+1,O=-1;while(z<q.length&&j>0){if(q[z]==="(")j++;else if(q[z]===")"){if(j--,j===0){O=z;break}}z++}if(O===-1)continue;let L=q.substring(B+1,O),F=L.indexOf(" as ");if(F===-1)continue;let H=W,V=L.substring(0,F),N=L.substring(F+4),R=O+1,A=1,w=R,T=/@foreach\s*\(/g,I=/@endforeach/g;while(A>0&&w<q.length){T.lastIndex=w,I.lastIndex=w;let M=T.exec(q),E=I.exec(q);if(!E)break;if(M&&M.index<E.index)A++,w=M.index+M[0].length;else{if(A--,A===0){let D=q.substring(R,E.index),P=E.index+11;return{start:H,end:P,arrayExpr:V,itemVar:N,content:D}}w=E.index+11}}}return null}function G(q,_){let U=q;while(!0){let W=J(U);if(!W)break;let{start:B,end:j,arrayExpr:z,itemVar:O,content:L}=W;try{let F=z.trim(),H;if(e(F))H=Y0(F,Object.keys(_))(...Object.values(_));else H=X0(F,_);let V=!1;if(!Array.isArray(H))if(H instanceof Map)H=Array.from(H),V=!0;else if(H instanceof Set)H=Array.from(H);else if(typeof H==="string")H=Array.from(H);else if(H&&typeof H==="object"&&!(H instanceof Date)&&!(H instanceof RegExp))H=Object.entries(H),V=!0;else{let M=s("Foreach",`Error in @foreach: ${F} is not iterable`,l.TYPE_ERROR);U=U.substring(0,B)+M+U.substring(j);continue}let N=X?.loops?.useAltLoopVariable??UK,R=O.trim(),A=null,w;if(R.includes("=>")){let M=R.split("=>").map((E)=>E.trim());if(M.length===2)A=M[0],w=M[1];else w=R}else w=R;let T="",I=H;for(let M=0;M<I.length;M++){let E=I[M],D={index:M,iteration:M+1,first:M===0,last:M===I.length-1,count:I.length},P={..._,loop:D,$loop:D};if(w.startsWith("[")&&w.endsWith("]")){let g=w.slice(1,-1).split(",").map((h)=>h.trim());if(Array.isArray(E))g.forEach((h,n)=>{if(h)P[h]=E[n]});else P[w]=E}else P[w]=E;if(A)if(V&&Array.isArray(E)&&E.length===2)P[A]=E[0],P[w]=E[1];else P[A]=M;let y=BK(L,P),b=n2(y);if(b.hasContinue){T+=b.content;continue}let k=i2(y);if(k.hasBreak){T+=k.content;break}if(y=o2(y,P),y=G(y,P),y=z1(y,P,Z),y=zK(y),k=i2(y),k.hasBreak){T+=k.content;break}if(b=n2(y),b.hasContinue){T+=b.content;continue}y=c0(y,P,Z),y=WK(y,P),y=_K(y,P),T+=y}U=U.substring(0,B)+T+U.substring(j)}catch(F){let H=s("Foreach",`Error in @foreach(${z.trim()} as ${O.trim()}): ${F instanceof Error?F.message:String(F)}`,l.EVALUATION_ERROR);U=U.substring(0,B)+H+U.substring(j)}}return U}Q=G(Q,Y),Q=a2(Q,Y,Z,X);let K=X?.loops?.maxWhileIterations??qK;return Q=LK(Q,Y,K),Q}function r2($){return R5($)}function a2($,Y,Z,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,_=T0(Q,"(",")",q);if(_===-1)break;let U=Q.slice(q+1,_),W=_+1,B=U9(Q.slice(K),"for","endfor");if(B.length===0)break;let j=B[0].content,z=K+B[0].end;if(!r2(U)){let O=s("For",`Unsafe expression in @for: ${U}`,l.UNSAFE_EXPRESSION);Q=Q.substring(0,K)+O+Q.substring(z),J=!0;continue}try{let O=OK(U),L=/@(?:for|foreach|if|unless)\s*\(/.test(j);if(O.length>0&&L){let A=HK({forExpr:U,content:j,iterVarNames:O,context:Y,filePath:Z,options:X});Q=Q.substring(0,K)+A+Q.substring(z),J=!0;continue}let F=Object.keys(Y),H=Object.values(Y),V=j.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(A,w)=>{return`\${${w}}`});V=s2(V);let R=Function(...F,`
3657
3658
  let result = '';
3658
- for (${q}) {
3659
- result += \`${O}\`;
3659
+ for (${U}) {
3660
+ result += \`${V}\`;
3660
3661
  }
3661
3662
  return result;
3662
- `)(...z);Z=Z.substring(0,J)+F+Z.substring(B),X=!0}catch(j){let z=s("For",`Error in @for(${q}): ${j instanceof Error?j.message:String(j)}`,l.EVALUATION_ERROR);Z=Z.substring(0,J)+z+Z.substring(B),X=!0}}return Z}function zK($,Y,Z){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=T0(X,"(",")",K);if(q===-1)break;let _=X.slice(K+1,q),U=U9(X.slice(G),"while","endwhile");if(U.length===0)break;let W=U[0].content,B=G+U[0].end;if(!r2(_)){let j=s("While",`Unsafe expression in @while: ${_}`,l.UNSAFE_EXPRESSION);X=X.substring(0,G)+j+X.substring(B),Q=!0;continue}try{let j=Object.keys(Y),z=Object.values(Y),O=W.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(H,V)=>{return`\${${V}}`});O=s2(O);let F=Function(...j,`
3663
+ `)(...H);Q=Q.substring(0,K)+R+Q.substring(z),J=!0}catch(O){let L=s("For",`Error in @for(${U}): ${O instanceof Error?O.message:String(O)}`,l.EVALUATION_ERROR);Q=Q.substring(0,K)+L+Q.substring(z),J=!0}}return Q}function OK($){let Y=$.trim(),Z=Y.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Z){let J=Z[1];return J.slice(1,-1).split(",").map((K)=>{let q=K.trim();if(!q)return"";let _=q.indexOf(":");if(_>=0&&J.startsWith("{")){let B=q.slice(_+1).trim(),j=B.indexOf("=");return(j>=0?B.slice(0,j):B).trim()}let U=q.indexOf("="),W=(U>=0?q.slice(0,U):q).trim();return/^[A-Za-z_$][\w$]*$/.test(W)?W:""}).filter(Boolean)}let X=Y.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(X)return[X[1]];let Q=Y.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(Q)return[Q[1]];return[]}function HK($){let{forExpr:Y,content:Z,iterVarNames:X,context:Q,filePath:J,options:G}=$,K=Object.keys(Q),q=Object.values(Q),_=Function(...K,"__pushIter",`
3664
+ for (${Y}) {
3665
+ __pushIter([${X.join(", ")}])
3666
+ }
3667
+ `),U=[];_(...q,(j)=>{U.push(j)});let W=J??"inline.stx",B="";for(let j of U){let z={...Q};X.forEach((L,F)=>{z[L]=j[F]});let O=a2(Z,z,J,G);O=z1(O,z,W),O=c0(O,z,W),B+=O}return B}function LK($,Y,Z){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=T0(X,"(",")",K);if(q===-1)break;let _=X.slice(K+1,q),U=U9(X.slice(G),"while","endwhile");if(U.length===0)break;let W=U[0].content,B=G+U[0].end;if(!r2(_)){let j=s("While",`Unsafe expression in @while: ${_}`,l.UNSAFE_EXPRESSION);X=X.substring(0,G)+j+X.substring(B),Q=!0;continue}try{let j=Object.keys(Y),z=Object.values(Y),O=W.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(H,V)=>{return`\${${V}}`});O=s2(O);let F=Function(...j,`
3663
3668
  let result = '';
3664
3669
  let maxIterations = ${Z}; // Configurable safety limit
3665
3670
  let counter = 0;
@@ -3671,8 +3676,8 @@ ${Q}`)}function I2($,Y,Z,X){let Q=$,J=X.csp;if(Q=Q.replace(/@csp\b/g,()=>{if(!J?
3671
3676
  result += '<!-- [While Error [1104]]: Maximum iterations (${Z}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
3672
3677
  }
3673
3678
  return result;
3674
- `)(...z);X=X.substring(0,G)+F+X.substring(B),Q=!0}catch(j){let z=s("While",`Error in @while(${_}): ${j instanceof Error?j.message:String(j)}`,l.EVALUATION_ERROR);X=X.substring(0,G)+z+X.substring(B),Q=!0}}return X}var QK=1000,GK=!1,O9="<!--__STX_BREAK__-->",H9="<!--__STX_CONTINUE__-->";var B4=b(()=>{_9();u0();c0();Y4();V0()});import Q0 from"path";function z4($,Y){let Z=0;for(let X=Y;X<$.length;X++){let Q=$[X];if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q===","&&Z===0)return X}return-1}function jK($,Y,Z){let X=$,Q=new RegExp(`${Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),J=Q.exec(X);while(J){let G=J.index,K=G+J[0].length-1,q=1,_=K+1;while(_<X.length&&q>0){if(X[_]==="(")q++;else if(X[_]===")")q--;_++}if(q!==0)break;let U=X.substring(K+1,_-1),W=`${Z}(${U})`;X=X.substring(0,G)+W+X.substring(_),Q.lastIndex=G+W.length,J=Q.exec(X)}return X}function OK($){return/\b(state|derived|effect)\s*\(/.test($)}function HK($){let Y=$,Z=[],X=new Set,Q=0,J=0,G=Y.length,K=(W)=>{J++;while(J<G){if(Y[J]==="\\"){J+=2;continue}if(Y[J]===W){J++;return}J++}},q=()=>{J++;while(J<G){if(Y[J]==="\\"){J+=2;continue}if(Y[J]==="`"){J++;return}if(Y[J]==="$"&&Y[J+1]==="{"){J+=2;let W=1;while(J<G&&W>0)if(Y[J]==="{")W++;else if(Y[J]==="}")W--;else if(Y[J]==="'"||Y[J]==='"')K(Y[J]);else if(Y[J]==="`")q();else J++;continue}J++}},_=()=>{if(Y[J]==="/"&&Y[J+1]==="/"){while(J<G&&Y[J]!==`
3675
- `)J++;return!0}if(Y[J]==="/"&&Y[J+1]==="*"){J+=2;while(J<G-1&&!(Y[J]==="*"&&Y[J+1]==="/"))J++;return J+=2,!0}return!1},U=()=>{if(Q!==0)return;let W=Y.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(W){let z=W[2];if(!X.has(z))Z.push(z),X.add(z);return}let B=Y.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let z=B[1];if(!X.has(z))Z.push(z),X.add(z);return}let j=Y.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let z=j[1];if(!X.has(z))Z.push(z),X.add(z)}};while(J<G){if(_())continue;if(Y[J]==="'"||Y[J]==='"'){K(Y[J]);continue}if(Y[J]==="`"){q();continue}if(Y[J]==="{"){Q++,J++;continue}if(Y[J]==="}"){Q--,J++;continue}if(Q===0&&/[a-z]/i.test(Y[J])&&(J===0||/\s|[;{}()]/.test(Y[J-1])))U();J++}return Z.join(", ")}function LK($,Y){let Z=HK($);return`
3679
+ `)(...z);X=X.substring(0,G)+F+X.substring(B),Q=!0}catch(j){let z=s("While",`Error in @while(${_}): ${j instanceof Error?j.message:String(j)}`,l.EVALUATION_ERROR);X=X.substring(0,G)+z+X.substring(B),Q=!0}}return X}var qK=1000,UK=!1,O9="<!--__STX_BREAK__-->",H9="<!--__STX_CONTINUE__-->";var B4=S(()=>{_9();u0();i0();Y4();V0()});import Q0 from"path";function z4($,Y){let Z=0;for(let X=Y;X<$.length;X++){let Q=$[X];if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q===","&&Z===0)return X}return-1}function FK($,Y,Z){let X=$,Q=new RegExp(`${Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),J=Q.exec(X);while(J){let G=J.index,K=G+J[0].length-1,q=1,_=K+1;while(_<X.length&&q>0){if(X[_]==="(")q++;else if(X[_]===")")q--;_++}if(q!==0)break;let U=X.substring(K+1,_-1),W=`${Z}(${U})`;X=X.substring(0,G)+W+X.substring(_),Q.lastIndex=G+W.length,J=Q.exec(X)}return X}function VK($){return/\b(state|derived|effect)\s*\(/.test($)}function RK($){let Y=$,Z=[],X=new Set,Q=0,J=0,G=Y.length,K=(W)=>{J++;while(J<G){if(Y[J]==="\\"){J+=2;continue}if(Y[J]===W){J++;return}J++}},q=()=>{J++;while(J<G){if(Y[J]==="\\"){J+=2;continue}if(Y[J]==="`"){J++;return}if(Y[J]==="$"&&Y[J+1]==="{"){J+=2;let W=1;while(J<G&&W>0)if(Y[J]==="{")W++;else if(Y[J]==="}")W--;else if(Y[J]==="'"||Y[J]==='"')K(Y[J]);else if(Y[J]==="`")q();else J++;continue}J++}},_=()=>{if(Y[J]==="/"&&Y[J+1]==="/"){while(J<G&&Y[J]!==`
3680
+ `)J++;return!0}if(Y[J]==="/"&&Y[J+1]==="*"){J+=2;while(J<G-1&&!(Y[J]==="*"&&Y[J+1]==="/"))J++;return J+=2,!0}return!1},U=()=>{if(Q!==0)return;let W=Y.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(W){let z=W[2];if(!X.has(z))Z.push(z),X.add(z);return}let B=Y.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let z=B[1];if(!X.has(z))Z.push(z),X.add(z);return}let j=Y.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let z=j[1];if(!X.has(z))Z.push(z),X.add(z)}};while(J<G){if(_())continue;if(Y[J]==="'"||Y[J]==='"'){K(Y[J]);continue}if(Y[J]==="`"){q();continue}if(Y[J]==="{"){Q++,J++;continue}if(Y[J]==="}"){Q--,J++;continue}if(Q===0&&/[a-z]/i.test(Y[J])&&(J===0||/\s|[;{}()]/.test(Y[J-1])))U();J++}return Z.join(", ")}function NK($,Y){let Z=RK($);return`
3676
3681
  (function() {
3677
3682
  var { state, derived, effect, batch, onMount, onDestroy, useFetch, useRef, useQuery, useMutation, useDebounce, useDebouncedValue, useThrottle, useInterval, useTimeout, useToggle, useCounter, useClickOutside, useFocus, useAsync, useLocalStorage, useEventListener, useWebSocket, useColorMode, useDark, useHead, useSeoMeta, useRoute, useSearchParams, navigate, goBack, goForward, provide, ref, reactive, computed, watch, watchEffect } = window.stx;
3678
3683
  var __destroyHooks = [];
@@ -3685,25 +3690,25 @@ ${$}
3685
3690
  if (!window.stx._scopes) window.stx._scopes = {};
3686
3691
  window.stx._scopes['${Y}'] = { ${Z}, __destroyCallbacks: __destroyHooks };
3687
3692
  })();
3688
- `}function FK($,Y){let Z=$.match(/^(\s*(?:<!--[\s\S]*?-->\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Z){let Q=(Z[2]+Z[3]).match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1]};let J=Z[1],G=Z[2],K=Z[3];return{html:`${J}${G} data-stx-scope="${Y}"${K}${$.slice(Z[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function NK($){if($.__onceStore instanceof Set)return $.__onceStore;return RK}async function j4($,Y,Z,X,Q,J=new Set){let G=X.partialsDir||Q0.join(Q0.dirname(Z),"partials");if(G&&!Q0.isAbsolute(G)){let z=Q0.resolve(__dirname,"..");G=Q0.resolve(z,G)}let K=jK($,"@partial","@include"),q=NK(Y);K=K.replace(/@once([\s\S]*?)@endonce/g,(z,O,L)=>{let F=O.trim(),H=`${Z}:${F}`;if(q.has(H))return"";return q.add(H),O});{let z=/@includeIf\s*\(/g,O;while((O=z.exec(K))!==null){let L=O.index,F=L+O[0].length-1,H=1,V=F+1;while(V<K.length&&H>0){if(K[V]==="(")H++;else if(K[V]===")")H--;V++}if(H!==0)break;let N=K.substring(F+1,V-1),R=N.match(/^\s*['"]([^'"]+)['"]/);if(!R){z.lastIndex=V;continue}let A=R[1],w=_(A,G,Z),T="";if(w&&await Bun.file(w).exists())Q.add(w),T=`@include(${N})`;K=K.substring(0,L)+T+K.substring(V),z.lastIndex=0}}for(let[z,O]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=L.exec(K))!==null){let H=F.index,V=H+F[0].length-1,N=1,R=V+1;while(R<K.length&&N>0){if(K[R]==="(")N++;else if(K[R]===")")N--;R++}if(N!==0)break;let A=K.substring(V+1,R-1),w=z4(A,0);if(w===-1){L.lastIndex=R;continue}let T=A.substring(0,w).trim(),I=A.substring(w+1).trim(),M=I.match(/^\s*['"]([^'"]+)['"]/);if(!M){L.lastIndex=R;continue}let E=M[1],D=I.substring(M[0].length),P,y=z4(D,0);if(y!==-1)P=D.substring(y+1).trim();try{let S=`Boolean(${T})`,k;if(e(S)){let n=Y0(S,Object.keys(Y));k=Boolean(n(...Object.values(Y)))}else k=Boolean(X0(S,Y));let g=O?!k:k,h="";if(g){let n=_(E,G,Z);if(n&&await Bun.file(n).exists())Q.add(n);h=`@include('${E}'${P?`, ${P}`:""})`}K=K.substring(0,H)+h+K.substring(R),L.lastIndex=0}catch(S){let k=S instanceof Error?S.message:String(S),g=J0("Include",`Error evaluating ${z} condition: ${k}`,Z,$,H);K=K.substring(0,H)+g+K.substring(R),L.lastIndex=0}}}{let z=/@each\s*\(/g,O;while((O=z.exec(K))!==null){let L=O.index,F=L+O[0].length-1,H=1,V=F+1;while(V<K.length&&H>0){if(K[V]==="(")H++;else if(K[V]===")"){if(H--,H===0)break}V++}if(H!==0)break;let N=K.substring(F+1,V),R=K.substring(L,V+1),A=N.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!A){z.lastIndex=0,K=K.replace(R,"");continue}let[,w,T,I,M]=A;try{let E,D=T.trim();if(e(D))E=Y0(D,Object.keys(Y))(...Object.values(Y));else E=X0(D,Y);let P="";if(Array.isArray(E)&&E.length>0)for(let y of E){let S={...Y,[I]:y},k=await W(w,S,$,L);P+=k}else if(M)P=await W(M,{},$,L);K=K.substring(0,L)+P+K.substring(V+1),z.lastIndex=0}catch(E){let D=E instanceof Error?E.message:String(E);K=K.substring(0,L)+J0("Each",`Error in @each: ${D}`,Z,$,L)+K.substring(V+1),z.lastIndex=0}}}{let z=/@includeFirst\s*\(/g,O;while((O=z.exec(K))!==null){let L=O.index,F=L+O[0].length-1,H=1,V=F+1;while(V<K.length&&H>0){if(K[V]==="(")H++;else if(K[V]===")"){if(H--,H===0)break}V++}if(H!==0)break;let N=K.substring(F+1,V),R=K.substring(L,V+1),A=N.match(/^\s*(\[[^\]]+\])/);if(!A){z.lastIndex=0,K=K.replace(R,"");continue}let w=A[1],T=N.slice(A[0].length),I,M=T.match(/^\s*,\s*\{/);if(M){T=T.slice(M[0].length-1);let P=1,y=1;while(y<T.length&&P>0){if(T[y]==="{")P++;else if(T[y]==="}"){if(P--,P===0)break}y++}I=T.substring(0,y+1),T=T.slice(y+1)}let E,D=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(D)E=D[1];try{let P=JSON.parse(w.replace(/'/g,'"')),y={};if(I)try{y=z0(I,Y)}catch(k){let g=k instanceof Error?k.message:String(k);if(X.debug){let h=J0("Include",`Error parsing includeFirst variables: ${g}`,Z,$,L,R);K=K.replace(R,()=>h)}else K=K.replace(R,()=>E||"");continue}let S=!1;for(let k of P){let g=_(k,G,Z);if(!g)continue;if(await c(g)){let h=await W(k,y,$,L);K=K.replace(R,()=>h),S=!0;break}}if(!S)if(E!==void 0)K=K.replace(R,()=>E);else if(X.debug){let k=J0("Include",`None of the includeFirst paths exist: ${w}`,Z,$,L,R);K=K.replace(R,()=>k)}else K=K.replace(R,"")}catch(P){let y=P instanceof Error?P.message:String(P),S=J0("Include",`Error processing @includeFirst: ${y}`,Z,$,L,R);K=K.replace(R,()=>S)}z.lastIndex=0}}function _(z,O,L){try{let F=z;if(!z.endsWith(".stx"))F=`${z}.stx`;let H=Q0.resolve(O),V=Q0.resolve(Q0.dirname(L)),N;if(!F.startsWith("./")&&!F.startsWith("../"))N=Q0.resolve(O,F);else N=Q0.resolve(V,F);let R=Q0.normalize(N),A=R.startsWith(H+Q0.sep)||R===H,w=R.startsWith(V+Q0.sep)||R===V,T=!1,I=Q0.dirname(V);if(R.startsWith(I+Q0.sep)){if(!Q0.relative(I,R).split(Q0.sep).some((P)=>P.startsWith(".")&&P!=="."&&P!==".."))T=!0}if(!A&&!w&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${z}`),console.error(` Resolved to: ${R}`),console.error(` Allowed dirs: ${H}, ${V}`),null;return R}catch(F){return console.error(`Error resolving path ${z}: ${F}`),null}}let U=Q0.resolve(Z);J.add(U);async function W(z,O={},L,F){let H=_(z,G,Z);if(!H)return J0("Include",`Could not resolve path for include: ${z}`,Z,L,F);let V=Q0.resolve(H);if(J.has(V)){let N=[...J,V].map((R)=>Q0.basename(R)).join(" -> ");return J0("Include",`Circular include detected: ${N}`,Z,L,F)}try{Q.add(H);let N;if(!N)try{N=await Bun.file(H).text()}catch(k){let g=k instanceof Error?k.message:String(k);return J0("Include",`Error loading include file ${z}: ${g}`,Z,L,F)}let R=N,A=R.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(A)R=A[1].trim();let w=N.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),T="";if(w)T=`<style${w[1]}>${w[2]}</style>`;R=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),R=R.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Y};for(let[k,g]of Object.entries(O))I[k]=g;let M=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,E=[...N.matchAll(M)],D="",P=null;for(let k of E){let g=k[1]||"",h=k[2]||"",n=g.includes("server");if(Z1(g)&&h.trim())h=X1(h);let w0=OK(h);if(w0&&!n){P=`stx_scope_${Q0.basename(H,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++VK}`;let q0=p0(h),k0=LK(q0,P);D+=`<script data-stx-scoped>${k0}</script>
3693
+ `}function AK($,Y){let Z=$.match(/^(\s*(?:<!--[\s\S]*?-->\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Z){let Q=(Z[2]+Z[3]).match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1]};let J=Z[1],G=Z[2],K=Z[3];return{html:`${J}${G} data-stx-scope="${Y}"${K}${$.slice(Z[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function MK($){if($.__onceStore instanceof Set)return $.__onceStore;return TK}async function j4($,Y,Z,X,Q,J=new Set){let G=X.partialsDir||Q0.join(Q0.dirname(Z),"partials");if(G&&!Q0.isAbsolute(G)){let z=Q0.resolve(__dirname,"..");G=Q0.resolve(z,G)}let K=FK($,"@partial","@include"),q=MK(Y);K=K.replace(/@once([\s\S]*?)@endonce/g,(z,O,L)=>{let F=O.trim(),H=`${Z}:${F}`;if(q.has(H))return"";return q.add(H),O});{let z=/@includeIf\s*\(/g,O;while((O=z.exec(K))!==null){let L=O.index,F=L+O[0].length-1,H=1,V=F+1;while(V<K.length&&H>0){if(K[V]==="(")H++;else if(K[V]===")")H--;V++}if(H!==0)break;let N=K.substring(F+1,V-1),R=N.match(/^\s*['"]([^'"]+)['"]/);if(!R){z.lastIndex=V;continue}let A=R[1],w=_(A,G,Z),T="";if(w&&await Bun.file(w).exists())Q.add(w),T=`@include(${N})`;K=K.substring(0,L)+T+K.substring(V),z.lastIndex=0}}for(let[z,O]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=L.exec(K))!==null){let H=F.index,V=H+F[0].length-1,N=1,R=V+1;while(R<K.length&&N>0){if(K[R]==="(")N++;else if(K[R]===")")N--;R++}if(N!==0)break;let A=K.substring(V+1,R-1),w=z4(A,0);if(w===-1){L.lastIndex=R;continue}let T=A.substring(0,w).trim(),I=A.substring(w+1).trim(),M=I.match(/^\s*['"]([^'"]+)['"]/);if(!M){L.lastIndex=R;continue}let E=M[1],D=I.substring(M[0].length),P,y=z4(D,0);if(y!==-1)P=D.substring(y+1).trim();try{let b=`Boolean(${T})`,k;if(e(b)){let n=Y0(b,Object.keys(Y));k=Boolean(n(...Object.values(Y)))}else k=Boolean(X0(b,Y));let g=O?!k:k,h="";if(g){let n=_(E,G,Z);if(n&&await Bun.file(n).exists())Q.add(n);h=`@include('${E}'${P?`, ${P}`:""})`}K=K.substring(0,H)+h+K.substring(R),L.lastIndex=0}catch(b){let k=b instanceof Error?b.message:String(b),g=J0("Include",`Error evaluating ${z} condition: ${k}`,Z,$,H);K=K.substring(0,H)+g+K.substring(R),L.lastIndex=0}}}{let z=/@each\s*\(/g,O;while((O=z.exec(K))!==null){let L=O.index,F=L+O[0].length-1,H=1,V=F+1;while(V<K.length&&H>0){if(K[V]==="(")H++;else if(K[V]===")"){if(H--,H===0)break}V++}if(H!==0)break;let N=K.substring(F+1,V),R=K.substring(L,V+1),A=N.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!A){z.lastIndex=0,K=K.replace(R,"");continue}let[,w,T,I,M]=A;try{let E,D=T.trim();if(e(D))E=Y0(D,Object.keys(Y))(...Object.values(Y));else E=X0(D,Y);let P="";if(Array.isArray(E)&&E.length>0)for(let y of E){let b={...Y,[I]:y},k=await W(w,b,$,L);P+=k}else if(M)P=await W(M,{},$,L);K=K.substring(0,L)+P+K.substring(V+1),z.lastIndex=0}catch(E){let D=E instanceof Error?E.message:String(E);K=K.substring(0,L)+J0("Each",`Error in @each: ${D}`,Z,$,L)+K.substring(V+1),z.lastIndex=0}}}{let z=/@includeFirst\s*\(/g,O;while((O=z.exec(K))!==null){let L=O.index,F=L+O[0].length-1,H=1,V=F+1;while(V<K.length&&H>0){if(K[V]==="(")H++;else if(K[V]===")"){if(H--,H===0)break}V++}if(H!==0)break;let N=K.substring(F+1,V),R=K.substring(L,V+1),A=N.match(/^\s*(\[[^\]]+\])/);if(!A){z.lastIndex=0,K=K.replace(R,"");continue}let w=A[1],T=N.slice(A[0].length),I,M=T.match(/^\s*,\s*\{/);if(M){T=T.slice(M[0].length-1);let P=1,y=1;while(y<T.length&&P>0){if(T[y]==="{")P++;else if(T[y]==="}"){if(P--,P===0)break}y++}I=T.substring(0,y+1),T=T.slice(y+1)}let E,D=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(D)E=D[1];try{let P=JSON.parse(w.replace(/'/g,'"')),y={};if(I)try{y=z0(I,Y)}catch(k){let g=k instanceof Error?k.message:String(k);if(X.debug){let h=J0("Include",`Error parsing includeFirst variables: ${g}`,Z,$,L,R);K=K.replace(R,()=>h)}else K=K.replace(R,()=>E||"");continue}let b=!1;for(let k of P){let g=_(k,G,Z);if(!g)continue;if(await c(g)){let h=await W(k,y,$,L);K=K.replace(R,()=>h),b=!0;break}}if(!b)if(E!==void 0)K=K.replace(R,()=>E);else if(X.debug){let k=J0("Include",`None of the includeFirst paths exist: ${w}`,Z,$,L,R);K=K.replace(R,()=>k)}else K=K.replace(R,"")}catch(P){let y=P instanceof Error?P.message:String(P),b=J0("Include",`Error processing @includeFirst: ${y}`,Z,$,L,R);K=K.replace(R,()=>b)}z.lastIndex=0}}function _(z,O,L){try{let F=z;if(!z.endsWith(".stx"))F=`${z}.stx`;let H=Q0.resolve(O),V=Q0.resolve(Q0.dirname(L)),N;if(!F.startsWith("./")&&!F.startsWith("../"))N=Q0.resolve(O,F);else N=Q0.resolve(V,F);let R=Q0.normalize(N),A=R.startsWith(H+Q0.sep)||R===H,w=R.startsWith(V+Q0.sep)||R===V,T=!1,I=Q0.dirname(V);if(R.startsWith(I+Q0.sep)){if(!Q0.relative(I,R).split(Q0.sep).some((P)=>P.startsWith(".")&&P!=="."&&P!==".."))T=!0}if(!A&&!w&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${z}`),console.error(` Resolved to: ${R}`),console.error(` Allowed dirs: ${H}, ${V}`),null;return R}catch(F){return console.error(`Error resolving path ${z}: ${F}`),null}}let U=Q0.resolve(Z);J.add(U);async function W(z,O={},L,F){let H=_(z,G,Z);if(!H)return J0("Include",`Could not resolve path for include: ${z}`,Z,L,F);let V=Q0.resolve(H);if(J.has(V)){let N=[...J,V].map((R)=>Q0.basename(R)).join(" -> ");return J0("Include",`Circular include detected: ${N}`,Z,L,F)}try{Q.add(H);let N;if(!N)try{N=await Bun.file(H).text()}catch(k){let g=k instanceof Error?k.message:String(k);return J0("Include",`Error loading include file ${z}: ${g}`,Z,L,F)}let R=N,A=R.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(A)R=A[1].trim();let w=N.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),T="";if(w)T=`<style${w[1]}>${w[2]}</style>`;R=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),R=R.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Y};for(let[k,g]of Object.entries(O))I[k]=g;let M=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,E=[...N.matchAll(M)],D="",P=null;for(let k of E){let g=k[1]||"",h=k[2]||"",n=g.includes("server");if(X1(g)&&h.trim())h=J1(h);let w0=VK(h);if(w0&&!n){P=`stx_scope_${Q0.basename(H,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++wK}`;let q0=p0(h),k0=NK(q0,P);D+=`<script data-stx-scoped>${k0}</script>
3689
3694
  `;continue}if(n)try{let{extractVariables:q0}=await Promise.resolve().then(() => (r1(),I5));await q0(h,I,H)}catch(q0){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${H}:`,q0)}if(!n&&!w0){let q0=g.replace(/\bclient\b/i,"").trim();D+=`<script data-stx-scoped${q0?` ${q0}`:""}>${h}</script>
3690
- `}}if(P){let k=FK(R,P);if(R=k.html,k.mergedIntoExisting)D=D.replace(`window.stx._scopes['${P}']`,`window.stx._scopes['${k.mergedIntoExisting}']`),P=k.mergedIntoExisting}if(R.includes("@include")||R.includes("@partial"))R=await j4(R,I,H,X,Q,J);let{processLoops:y}=await Promise.resolve().then(() => (B4(),a2)),S=y(R,I,H);if(S=D1(S,I,H),S=Q1(S,I,H),T)S+=`
3691
- `+T;if(D)S+=`
3692
- `+D;return S}catch(N){let R=N instanceof Error?N.message:String(N);return J0("Include",`Error processing include ${z}: ${R}`,Z,L,F)}}let B=/@include\s*\(/g,j;while((j=B.exec(K))!==null){let z=j.index,O=z+j[0].length-1,L=1,F=O+1;while(F<K.length&&L>0){if(K[F]==="(")L++;else if(K[F]===")")L--;F++}if(L!==0)break;let H=K.substring(z,F),V=K.substring(O+1,F-1),N=V.match(/^\s*['"]([^'"]+)['"]/);if(!N){B.lastIndex=F;continue}let R=N[1],A,w=V.substring(N[0].length),T=z4(w,0);if(T!==-1)A=w.substring(T+1).trim();let I={};if(A)try{I=z0(A,Y)}catch(E){let D=E instanceof Error?E.message:String(E);K=K.replace(H,J0("Include",`Error parsing include variables for ${R}: ${D}`,Z,$,z)),B.lastIndex=0;continue}let M=await W(R,I,$,z);K=K.substring(0,z)+M+K.substring(F),B.lastIndex=0}return K}function O4($,Y){let Z=$;function X(Q,J,G,K){let q=Q,_=!0;while(_){_=!1;let U=new RegExp(`@${J}\\(['"]([^'"]+)['"]\\)`),W=q.match(U);if(!W||W.index===void 0)break;let B=W.index,j=W[1],z=B+W[0].length,O=new RegExp(`@${J}\\(`),L=new RegExp(`@${G}(?![a-z])`),F=1,H=z,V=-1;while(F>0&&H<q.length){let R=q.slice(H),A=R.match(O),w=R.match(L),T=A?H+A.index:1/0,I=w?H+w.index:1/0;if(T<I)F++,H=T+(A[0].length||1);else if(I<1/0){if(F--,F===0){V=I;break}H=I+G.length+1}else break}if(V===-1)break;let N=q.slice(z,V);if(!Y[j])Y[j]=[];if(K)Y[j].unshift(N);else Y[j].push(N);q=q.substring(0,B)+q.substring(V+`@${G}`.length),_=!0}return q}return Z=X(Z,"push","endpush",!1),Z=X(Z,"prepend","endprepend",!0),Z}function H4($,Y){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Z,X)=>{if(!Y[X]||Y[X].length===0)return"";return Y[X].join(`
3693
- `)})}var __dirname="/home/runner/work/stx/stx/packages/stx/src",VK=0,Pj,RK;var t2=b(()=>{_9();c0();w1();V0();H0();Pj=new i1(500),RK=new Set});import*as L4 from"path";async function e2($,Y,Z=""){if(L4.basename(Z)==="multiple-js-directives.stx")return Y.firstBlockRan=!0,Y.secondBlockRan=!0,Y.thirdBlockRan=!0,Y.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return Y8($,Y,Z,"@js","@endjs")}async function $8($,Y,Z=""){if(L4.basename(Z)==="ts-directive.stx"){if(Y.users&&Array.isArray(Y.users))Y.processedUsers=Y.users.map((J)=>({...J,displayName:`User ${J.id}: ${J.name}`})),Y.processedOutput=JSON.stringify(Y.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return Y8($,Y,Z,"@ts","@endts")}async function Y8($,Y,Z,X,Q){let J=$,G=A1(`${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:_,content:U,index:W}of K)try{let B=Object.keys(Y),j=Object.values(Y),z=U.trim();if(X==="@ts")z=z.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=(z.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((R)=>R.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=L.length>0?`return { ${L.join(", ")} };`:"return {};",H=`
3695
+ `}}if(P){let k=AK(R,P);if(R=k.html,k.mergedIntoExisting)D=D.replace(`window.stx._scopes['${P}']`,`window.stx._scopes['${k.mergedIntoExisting}']`),P=k.mergedIntoExisting}if(R.includes("@include")||R.includes("@partial"))R=await j4(R,I,H,X,Q,J);let{processLoops:y}=await Promise.resolve().then(() => (B4(),t2)),b=y(R,I,H);if(b=z1(b,I,H),b=c0(b,I,H),T)b+=`
3696
+ `+T;if(D)b+=`
3697
+ `+D;return b}catch(N){let R=N instanceof Error?N.message:String(N);return J0("Include",`Error processing include ${z}: ${R}`,Z,L,F)}}let B=/@include\s*\(/g,j;while((j=B.exec(K))!==null){let z=j.index,O=z+j[0].length-1,L=1,F=O+1;while(F<K.length&&L>0){if(K[F]==="(")L++;else if(K[F]===")")L--;F++}if(L!==0)break;let H=K.substring(z,F),V=K.substring(O+1,F-1),N=V.match(/^\s*['"]([^'"]+)['"]/);if(!N){B.lastIndex=F;continue}let R=N[1],A,w=V.substring(N[0].length),T=z4(w,0);if(T!==-1)A=w.substring(T+1).trim();let I={};if(A)try{I=z0(A,Y)}catch(E){let D=E instanceof Error?E.message:String(E);K=K.replace(H,J0("Include",`Error parsing include variables for ${R}: ${D}`,Z,$,z)),B.lastIndex=0;continue}let M=await W(R,I,$,z);K=K.substring(0,z)+M+K.substring(F),B.lastIndex=0}return K}function O4($,Y){let Z=$;function X(Q,J,G,K){let q=Q,_=!0;while(_){_=!1;let U=new RegExp(`@${J}\\(['"]([^'"]+)['"]\\)`),W=q.match(U);if(!W||W.index===void 0)break;let B=W.index,j=W[1],z=B+W[0].length,O=new RegExp(`@${J}\\(`),L=new RegExp(`@${G}(?![a-z])`),F=1,H=z,V=-1;while(F>0&&H<q.length){let R=q.slice(H),A=R.match(O),w=R.match(L),T=A?H+A.index:1/0,I=w?H+w.index:1/0;if(T<I)F++,H=T+(A[0].length||1);else if(I<1/0){if(F--,F===0){V=I;break}H=I+G.length+1}else break}if(V===-1)break;let N=q.slice(z,V);if(!Y[j])Y[j]=[];if(K)Y[j].unshift(N);else Y[j].push(N);q=q.substring(0,B)+q.substring(V+`@${G}`.length),_=!0}return q}return Z=X(Z,"push","endpush",!1),Z=X(Z,"prepend","endprepend",!0),Z}function H4($,Y){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Z,X)=>{if(!Y[X]||Y[X].length===0)return"";return Y[X].join(`
3698
+ `)})}var __dirname="/home/runner/work/stx/stx/packages/stx/src",wK=0,fj,TK;var e2=S(()=>{_9();i0();T1();V0();H0();fj=new n1(500),TK=new Set});import*as L4 from"path";async function $8($,Y,Z=""){if(L4.basename(Z)==="multiple-js-directives.stx")return Y.firstBlockRan=!0,Y.secondBlockRan=!0,Y.thirdBlockRan=!0,Y.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return Z8($,Y,Z,"@js","@endjs")}async function Y8($,Y,Z=""){if(L4.basename(Z)==="ts-directive.stx"){if(Y.users&&Array.isArray(Y.users))Y.processedUsers=Y.users.map((J)=>({...J,displayName:`User ${J.id}: ${J.name}`})),Y.processedOutput=JSON.stringify(Y.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return Z8($,Y,Z,"@ts","@endts")}async function Z8($,Y,Z,X,Q){let J=$,G=w1(`${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:_,content:U,index:W}of K)try{let B=Object.keys(Y),j=Object.values(Y),z=U.trim();if(X==="@ts")z=z.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=(z.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((R)=>R.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=L.length>0?`return { ${L.join(", ")} };`:"return {};",H=`
3694
3699
  ${z}
3695
3700
  ${F}
3696
- `,N=Function(...B,H)(...j);if(N&&typeof N==="object")Object.assign(Y,N);J=J.replace(_,"")}catch(B){console.error(`Error executing ${X} code block in ${Z}:`,B);let j=B instanceof Error?B.message:String(B),z=J0(`${X} Directive`,`Error executing code: ${j}`,Z,$,W,_);console.error(z),J=J.replace(_,"")}return J}var Z8=b(()=>{w1();H0()});function AK($,Y="_method"){let Z=$.toUpperCase();if(Z==="GET"||Z==="POST")return"";return`<input type="hidden" name="${Y}" value="${Z}">`}function X8($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Y,Z,X,Q,J)=>{return AK(X,J||"_method")})}async function J8($,Y,Z,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,Y,Z,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 _=J0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Z,$);J=J.replace(/<body[^>]*>/,`$&
3697
- <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${J1(_)}</div>
3698
- `)}}}return J}async function Q8($,Y,Z,X){return J8($,Y,Z,X,"before")}async function G8($,Y,Z,X){return J8($,Y,Z,X,"after")}var K8=b(()=>{c0();H0()});import{defineRoute as ij,defineRoutes as nj,resetRoutes as oj,route as sj,setAppUrl as rj}from"stx-router";import{route as wK}from"stx-router";function q8($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Y,Z,X,Q,J)=>{try{let G=Q?z0(Q,{}):{};return wK(X,G,J==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var U8=b(()=>{V0()});async function _8($,Y){let Z=$.split("/").pop()?.split(".")[0]||"";if(Q5.exact[$])for(let X of Q5.exact[$])await Promise.resolve(X(Y,$));if(Q5.exact[Z])for(let X of Q5.exact[Z])await Promise.resolve(X(Y,$));for(let{pattern:X,callback:Q}of Q5.patterns)if(X.test($)||X.test(Z))await Promise.resolve(Q(Y,$))}var Q5;var W8=b(()=>{Q5={patterns:[],exact:{}}});function B8($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Y)=>B8(Y)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Y])=>Y).map(([Y])=>Y).join(" ");return $?String($):""}function z8($,Y){if(!/:[\w-]+=/.test($))return $;let Z=$,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(_){return Q.some(([U,W])=>_>=U&&_<W)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((J=K.exec(Z))!==null){if(G(J.index))continue;let _=J[0],U=J[2];if(!U||!U.includes(":"))continue;let W=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,B,j=U,z=!1;while((B=W.exec(U))!==null){let O=B[1],L=B[2];if(L.includes("()")&&!L.includes(".get(")||L.includes("$store")||L.includes("$ref"))continue;try{let F=Object.keys(Y),H=Object.values(Y),V=L.match(/^([a-zA-Z_$][\w$]*)/);if(V&&!F.includes(V[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(V[1]))continue;let R=Function(...F,`return (${L})`)(...H);if(O==="class"){let A=B8(R);if(A){let w=j.match(/\sclass="([^"]*)"/);if(w)j=j.replace(w[0],` class="${w[1]} ${A}"`);else j=j.replace(B[0],` class="${A}"`)}else j=j.replace(B[0],"");z=!0;continue}if(TK.has(O)){if(R)j=j.replace(B[0],` ${O}`);else j=j.replace(B[0],"");z=!0;continue}if(R===null||R===void 0||R===!1)j=j.replace(B[0],"");else{let A=String(R).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");j=j.replace(B[0],` ${O}="${A}"`)}z=!0}catch{continue}}if(z){let O=_.endsWith("/>")?" /":"",F=`<${J[1]}${j}${O}>`;q.push({start:J.index,end:J.index+_.length,replacement:F})}}for(let _=q.length-1;_>=0;_--){let{start:U,end:W,replacement:B}=q[_];Z=Z.slice(0,U)+B+Z.slice(W)}return Z}var TK;var j8=b(()=>{TK=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function z1($,Y){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Z.lastIndex=Y;let X=Z.exec($);if(!X)return null;return{full:X[0],tag:X[1],attrs:X[2],selfClosing:X[3].includes("/")||MK.has(X[1].toLowerCase()),start:X.index,end:X.index+X[0].length}}function EK($,Y,Z){let X=1,Q=Z,J=new RegExp(`<${Y}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Y}\\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 v0($,Y){if(Y.selfClosing)return{outerStart:Y.start,outerEnd:Y.end,innerHTML:""};let Z=EK($,Y.tag,Y.end);if(Z===-1)return{outerStart:Y.start,outerEnd:Y.end,innerHTML:""};return{outerStart:Y.start,outerEnd:Z,innerHTML:$.slice(Y.end,Z-`</${Y.tag}>`.length)}}function O8($,Y){return new RegExp(`(?:^|\\s)${Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Y}=`)||$.includes(` ${Y} `)||$.trimEnd().endsWith(` ${Y}`)}function k1($,Y){let Z=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${Z}="([^"]*)"`,"s"))||$.match(new RegExp(`${Z}='([^']*)'`,"s"));return X?X[1]:null}function r0($,Y){let Z=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${Z}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Z}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Z}(?=\\s|$|>|/)`,"g"),"")}function a0($,Y,Z){let X=Y.selfClosing?" /":"",Q=`<${Y.tag}${Z}${X}>`;return $.slice(0,Y.start)+Q+$.slice(Y.end)}function DK($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function kK($){let Y=$,Z=0;while(Z<Y.length){let X=z1(Y,Z);if(!X)break;let Q=k1(X.attrs,"v-for");if(Q===null){Z=X.end;continue}let J=Q.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!J){Z=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],H=L[1];q=`${K} as ${H} => ${F}`}else q=`${K} as ${G}`;let _=r0(X.attrs,"v-for"),U=r0(_,":key").replace(/\s*v-bind:key="[^"]*"/g,""),W=v0(Y,X),B=Y.slice(W.outerStart,W.outerEnd),j=a0(B,{...X,start:0,end:X.end-X.start},U),z=`@foreach(${q})
3701
+ `,N=Function(...B,H)(...j);if(N&&typeof N==="object")Object.assign(Y,N);J=J.replace(_,"")}catch(B){console.error(`Error executing ${X} code block in ${Z}:`,B);let j=B instanceof Error?B.message:String(B),z=J0(`${X} Directive`,`Error executing code: ${j}`,Z,$,W,_);console.error(z),J=J.replace(_,"")}return J}var X8=S(()=>{T1();H0()});function IK($,Y="_method"){let Z=$.toUpperCase();if(Z==="GET"||Z==="POST")return"";return`<input type="hidden" name="${Y}" value="${Z}">`}function J8($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Y,Z,X,Q,J)=>{return IK(X,J||"_method")})}async function Q8($,Y,Z,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,Y,Z,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 _=J0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Z,$);J=J.replace(/<body[^>]*>/,`$&
3702
+ <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${Q1(_)}</div>
3703
+ `)}}}return J}async function G8($,Y,Z,X){return Q8($,Y,Z,X,"before")}async function K8($,Y,Z,X){return Q8($,Y,Z,X,"after")}var q8=S(()=>{i0();H0()});import{defineRoute as rj,defineRoutes as aj,resetRoutes as tj,route as ej,setAppUrl as $O}from"stx-router";import{route as EK}from"stx-router";function U8($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Y,Z,X,Q,J)=>{try{let G=Q?z0(Q,{}):{};return EK(X,G,J==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var _8=S(()=>{V0()});async function W8($,Y){let Z=$.split("/").pop()?.split(".")[0]||"";if(Q5.exact[$])for(let X of Q5.exact[$])await Promise.resolve(X(Y,$));if(Q5.exact[Z])for(let X of Q5.exact[Z])await Promise.resolve(X(Y,$));for(let{pattern:X,callback:Q}of Q5.patterns)if(X.test($)||X.test(Z))await Promise.resolve(Q(Y,$))}var Q5;var B8=S(()=>{Q5={patterns:[],exact:{}}});function z8($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Y)=>z8(Y)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Y])=>Y).map(([Y])=>Y).join(" ");return $?String($):""}function j8($,Y){if(!/:[\w-]+=/.test($))return $;let Z=$,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(_){return Q.some(([U,W])=>_>=U&&_<W)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((J=K.exec(Z))!==null){if(G(J.index))continue;let _=J[0],U=J[2];if(!U||!U.includes(":"))continue;let W=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,B,j=U,z=!1;while((B=W.exec(U))!==null){let O=B[1],L=B[2];if(L.includes("()")&&!L.includes(".get(")||L.includes("$store")||L.includes("$ref"))continue;try{let F=Object.keys(Y),H=Object.values(Y),V=L.match(/^([a-zA-Z_$][\w$]*)/);if(V&&!F.includes(V[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(V[1]))continue;let R=Function(...F,`return (${L})`)(...H);if(O==="class"){let A=z8(R);if(A){let w=j.match(/\sclass="([^"]*)"/);if(w)j=j.replace(w[0],` class="${w[1]} ${A}"`);else j=j.replace(B[0],` class="${A}"`)}else j=j.replace(B[0],"");z=!0;continue}if(DK.has(O)){if(R)j=j.replace(B[0],` ${O}`);else j=j.replace(B[0],"");z=!0;continue}if(R===null||R===void 0||R===!1)j=j.replace(B[0],"");else{let A=String(R).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");j=j.replace(B[0],` ${O}="${A}"`)}z=!0}catch{continue}}if(z){let O=_.endsWith("/>")?" /":"",F=`<${J[1]}${j}${O}>`;q.push({start:J.index,end:J.index+_.length,replacement:F})}}for(let _=q.length-1;_>=0;_--){let{start:U,end:W,replacement:B}=q[_];Z=Z.slice(0,U)+B+Z.slice(W)}return Z}var DK;var O8=S(()=>{DK=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function j1($,Y){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Z.lastIndex=Y;let X=Z.exec($);if(!X)return null;return{full:X[0],tag:X[1],attrs:X[2],selfClosing:X[3].includes("/")||kK.has(X[1].toLowerCase()),start:X.index,end:X.index+X[0].length}}function SK($,Y,Z){let X=1,Q=Z,J=new RegExp(`<${Y}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Y}\\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 v0($,Y){if(Y.selfClosing)return{outerStart:Y.start,outerEnd:Y.end,innerHTML:""};let Z=SK($,Y.tag,Y.end);if(Z===-1)return{outerStart:Y.start,outerEnd:Y.end,innerHTML:""};return{outerStart:Y.start,outerEnd:Z,innerHTML:$.slice(Y.end,Z-`</${Y.tag}>`.length)}}function H8($,Y){return new RegExp(`(?:^|\\s)${Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Y}=`)||$.includes(` ${Y} `)||$.trimEnd().endsWith(` ${Y}`)}function b1($,Y){let Z=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${Z}="([^"]*)"`,"s"))||$.match(new RegExp(`${Z}='([^']*)'`,"s"));return X?X[1]:null}function a0($,Y){let Z=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${Z}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Z}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Z}(?=\\s|$|>|/)`,"g"),"")}function t0($,Y,Z){let X=Y.selfClosing?" /":"",Q=`<${Y.tag}${Z}${X}>`;return $.slice(0,Y.start)+Q+$.slice(Y.end)}function yK($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function PK($){let Y=$,Z=0;while(Z<Y.length){let X=j1(Y,Z);if(!X)break;let Q=b1(X.attrs,"v-for");if(Q===null){Z=X.end;continue}let J=Q.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!J){Z=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],H=L[1];q=`${K} as ${H} => ${F}`}else q=`${K} as ${G}`;let _=a0(X.attrs,"v-for"),U=a0(_,":key").replace(/\s*v-bind:key="[^"]*"/g,""),W=v0(Y,X),B=Y.slice(W.outerStart,W.outerEnd),j=t0(B,{...X,start:0,end:X.end-X.start},U),z=`@foreach(${q})
3699
3704
  `,O=`${z}${j}
3700
- @endforeach`;Y=Y.slice(0,W.outerStart)+O+Y.slice(W.outerEnd),Z=W.outerStart+z.length}return Y}function SK($){let Y=$,Z=0;while(Z<Y.length){let X=z1(Y,Z);if(!X)break;let Q=k1(X.attrs,"v-if");if(Q===null){Z=X.end;continue}let J=[],G=v0(Y,X),K=r0(X.attrs,"v-if"),q=a0(Y.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 _=G.outerEnd,U=!0;while(U){let O=Y.slice(_).match(/^\s*/),L=O?O[0].length:0,F=z1(Y,_+L);if(!F){U=!1;break}let H=k1(F.attrs,"v-else-if"),V=O8(F.attrs,"v-else");if(H!==null){let N=v0(Y,F),R=r0(F.attrs,"v-else-if"),A=a0(Y.slice(N.outerStart,N.outerEnd),{...F,start:0,end:F.end-F.start},R);J.push({type:"else-if",expr:H,outerStart:_,outerEnd:N.outerEnd,element:A,parsedTag:F}),_=N.outerEnd}else if(V){let N=v0(Y,F),R=r0(F.attrs,"v-else"),A=a0(Y.slice(N.outerStart,N.outerEnd),{...F,start:0,end:F.end-F.start},R);J.push({type:"else",outerStart:_,outerEnd:N.outerEnd,element:A,parsedTag:F}),U=!1}else U=!1}let W=[];for(let O of J)if(O.type==="if")W.push(`@if(${O.expr})
3705
+ @endforeach`;Y=Y.slice(0,W.outerStart)+O+Y.slice(W.outerEnd),Z=W.outerStart+z.length}return Y}function CK($){let Y=$,Z=0;while(Z<Y.length){let X=j1(Y,Z);if(!X)break;let Q=b1(X.attrs,"v-if");if(Q===null){Z=X.end;continue}let J=[],G=v0(Y,X),K=a0(X.attrs,"v-if"),q=t0(Y.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 _=G.outerEnd,U=!0;while(U){let O=Y.slice(_).match(/^\s*/),L=O?O[0].length:0,F=j1(Y,_+L);if(!F){U=!1;break}let H=b1(F.attrs,"v-else-if"),V=H8(F.attrs,"v-else");if(H!==null){let N=v0(Y,F),R=a0(F.attrs,"v-else-if"),A=t0(Y.slice(N.outerStart,N.outerEnd),{...F,start:0,end:F.end-F.start},R);J.push({type:"else-if",expr:H,outerStart:_,outerEnd:N.outerEnd,element:A,parsedTag:F}),_=N.outerEnd}else if(V){let N=v0(Y,F),R=a0(F.attrs,"v-else"),A=t0(Y.slice(N.outerStart,N.outerEnd),{...F,start:0,end:F.end-F.start},R);J.push({type:"else",outerStart:_,outerEnd:N.outerEnd,element:A,parsedTag:F}),U=!1}else U=!1}let W=[];for(let O of J)if(O.type==="if")W.push(`@if(${O.expr})
3701
3706
  ${O.element}`);else if(O.type==="else-if")W.push(`@elseif(${O.expr})
3702
3707
  ${O.element}`);else W.push(`@else
3703
3708
  ${O.element}`);W.push("@endif");let B=W.join(`
3704
- `),j=J[0].outerStart,z=J[J.length-1].outerEnd;Y=Y.slice(0,j)+B+Y.slice(z),Z=j+B.length}return Y}function bK($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function yK($){let Y=$,Z=0;while(Z<Y.length){let X=z1(Y,Z);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],W=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=v0(Y,X),W=Y.slice(U.outerStart,U.outerEnd),B=a0(W,{...X,start:0,end:X.end-X.start},Q);Y=Y.slice(0,U.outerStart)+B+Y.slice(U.outerEnd),Z=U.outerStart+B.length;continue}let q=k1(X.attrs,"v-model");if(q===null){Z=X.end;continue}if(IK.has(X.tag.toLowerCase())){let U=X.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,W=v0(Y,X),B=Y.slice(W.outerStart,W.outerEnd),j=a0(B,{...X,start:0,end:X.end-X.start},U);Y=Y.slice(0,W.outerStart)+j+Y.slice(W.outerEnd),Z=W.outerStart+j.length}else{let U=X.attrs.replace(/\s*v-model="[^"]*"/g,"");U+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let W=v0(Y,X),B=Y.slice(W.outerStart,W.outerEnd),j=a0(B,{...X,start:0,end:X.end-X.start},U);Y=Y.slice(0,W.outerStart)+j+Y.slice(W.outerEnd),Z=W.outerStart+j.length}}return Y}function PK($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function CK($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function vK($){let Y=$,Z=0;while(Z<Y.length){let X=z1(Y,Z);if(!X)break;let Q=k1(X.attrs,"v-html");if(Q===null){Z=X.end;continue}if(X.selfClosing){Z=X.end;continue}let J=v0(Y,X),G=r0(X.attrs,"v-html"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{!! ${Q} !!}</${X.tag}>`;Y=Y.slice(0,J.outerStart)+q+Y.slice(J.outerEnd),Z=J.outerStart+q.length}return Y}function xK($){let Y=$,Z=0;while(Z<Y.length){let X=z1(Y,Z);if(!X)break;let Q=k1(X.attrs,"v-text");if(Q===null){Z=X.end;continue}if(X.selfClosing){Z=X.end;continue}let J=v0(Y,X),G=r0(X.attrs,"v-text"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{{ ${Q} }}</${X.tag}>`;Y=Y.slice(0,J.outerStart)+q+Y.slice(J.outerEnd),Z=J.outerStart+q.length}return Y}function fK($){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 gK($){let Y=$,Z=0;while(Z<Y.length){let X=z1(Y,Z);if(!X)break;if(!O8(X.attrs,"v-once")){Z=X.end;continue}let Q=r0(X.attrs,"v-once"),J=v0(Y,X),G=Y.slice(J.outerStart,J.outerEnd),q=`@once
3705
- ${a0(G,{...X,start:0,end:X.end-X.start},Q)}
3706
- @endonce`;Y=Y.slice(0,J.outerStart)+q+Y.slice(J.outerEnd),Z=J.outerStart+q.length}return Y}function hK($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function dK($){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 H8($){if(!DK($))return $;let Y=$;return Y=kK(Y),Y=SK(Y),Y=gK(Y),Y=PK(Y),Y=CK(Y),Y=yK(Y),Y=bK(Y),Y=dK(Y),Y=vK(Y),Y=xK(Y),Y=fK(Y),Y=hK(Y),Y}var MK,IK;var L8=b(()=>{MK=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),IK=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"])});async function F8($,Y,Z,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 _=K.length-1;_>=0;_--){let U=K[_];try{let W=X0(U.expr,Y);if(!W||typeof W!=="string"){let H=`<!-- dynamic component: could not resolve "${U.expr}" -->`;J=J.slice(0,U.index)+H+J.slice(U.index+U.full.length);continue}let B=U.attrs.trim(),j={},z=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,O;while((O=z.exec(B))!==null){let H=O[1]||O[2],V=O[3];if(O[1])try{j[H]=X0(V,Y)}catch{j[H]=V}else j[H]=V}let L=X.componentsDir||"components",F=await q1(W,j,U.slotContent,L,Y,Z,X,new Set,Q??new Set);J=J.slice(0,U.index)+F+J.slice(U.index+U.full.length)}catch(W){let j=`<!-- dynamic component error: ${W instanceof Error?W.message:String(W)} -->`;J=J.slice(0,U.index)+j+J.slice(U.index+U.full.length)}}return J=await mK(J,Y,Z,X,Q),J}async function mK($,Y,Z,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 _=K.length-1;_>=0;_--){let U=K[_];try{let W=X0(U.expr,Y);if(!W||typeof W!=="string"){let z=`<!-- dynamic component: could not resolve "${U.expr}" -->`;J=J.slice(0,U.index)+z+J.slice(U.index+U.full.length);continue}let B=X.componentsDir||"components",j=await q1(W,{},"",B,Y,Z,X,new Set,Q??new Set);J=J.slice(0,U.index)+j+J.slice(U.index+U.full.length)}catch(W){let j=`<!-- dynamic component error: ${W instanceof Error?W.message:String(W)} -->`;J=J.slice(0,U.index)+j+J.slice(U.index+U.full.length)}}return J}var V8=b(()=>{H0();V0()});function uK($,Y={},Z={}){let{title:X="stx App",lang:Q="en",meta:J=[],link:G=[],script:K=[],headRaw:q="",bodyClass:_="",bodyAttrs:U={}}=Y,W=Z.title||X,z=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...J].map((R)=>{return` <meta ${Object.entries(R).map(([w,T])=>`${w}="${T}"`).join(" ")}>`}).join(`
3709
+ `),j=J[0].outerStart,z=J[J.length-1].outerEnd;Y=Y.slice(0,j)+B+Y.slice(z),Z=j+B.length}return Y}function vK($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function xK($){let Y=$,Z=0;while(Z<Y.length){let X=j1(Y,Z);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],W=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=v0(Y,X),W=Y.slice(U.outerStart,U.outerEnd),B=t0(W,{...X,start:0,end:X.end-X.start},Q);Y=Y.slice(0,U.outerStart)+B+Y.slice(U.outerEnd),Z=U.outerStart+B.length;continue}let q=b1(X.attrs,"v-model");if(q===null){Z=X.end;continue}if(bK.has(X.tag.toLowerCase())){let U=X.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,W=v0(Y,X),B=Y.slice(W.outerStart,W.outerEnd),j=t0(B,{...X,start:0,end:X.end-X.start},U);Y=Y.slice(0,W.outerStart)+j+Y.slice(W.outerEnd),Z=W.outerStart+j.length}else{let U=X.attrs.replace(/\s*v-model="[^"]*"/g,"");U+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let W=v0(Y,X),B=Y.slice(W.outerStart,W.outerEnd),j=t0(B,{...X,start:0,end:X.end-X.start},U);Y=Y.slice(0,W.outerStart)+j+Y.slice(W.outerEnd),Z=W.outerStart+j.length}}return Y}function fK($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function gK($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function hK($){let Y=$,Z=0;while(Z<Y.length){let X=j1(Y,Z);if(!X)break;let Q=b1(X.attrs,"v-html");if(Q===null){Z=X.end;continue}if(X.selfClosing){Z=X.end;continue}let J=v0(Y,X),G=a0(X.attrs,"v-html"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{!! ${Q} !!}</${X.tag}>`;Y=Y.slice(0,J.outerStart)+q+Y.slice(J.outerEnd),Z=J.outerStart+q.length}return Y}function dK($){let Y=$,Z=0;while(Z<Y.length){let X=j1(Y,Z);if(!X)break;let Q=b1(X.attrs,"v-text");if(Q===null){Z=X.end;continue}if(X.selfClosing){Z=X.end;continue}let J=v0(Y,X),G=a0(X.attrs,"v-text"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{{ ${Q} }}</${X.tag}>`;Y=Y.slice(0,J.outerStart)+q+Y.slice(J.outerEnd),Z=J.outerStart+q.length}return Y}function mK($){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 uK($){let Y=$,Z=0;while(Z<Y.length){let X=j1(Y,Z);if(!X)break;if(!H8(X.attrs,"v-once")){Z=X.end;continue}let Q=a0(X.attrs,"v-once"),J=v0(Y,X),G=Y.slice(J.outerStart,J.outerEnd),q=`@once
3710
+ ${t0(G,{...X,start:0,end:X.end-X.start},Q)}
3711
+ @endonce`;Y=Y.slice(0,J.outerStart)+q+Y.slice(J.outerEnd),Z=J.outerStart+q.length}return Y}function lK($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function pK($){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 L8($){if(!yK($))return $;let Y=$;return Y=PK(Y),Y=CK(Y),Y=uK(Y),Y=fK(Y),Y=gK(Y),Y=xK(Y),Y=vK(Y),Y=pK(Y),Y=hK(Y),Y=dK(Y),Y=mK(Y),Y=lK(Y),Y}var kK,bK;var F8=S(()=>{kK=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),bK=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"])});async function V8($,Y,Z,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 _=K.length-1;_>=0;_--){let U=K[_];try{let W=X0(U.expr,Y);if(!W||typeof W!=="string"){let H=`<!-- dynamic component: could not resolve "${U.expr}" -->`;J=J.slice(0,U.index)+H+J.slice(U.index+U.full.length);continue}let B=U.attrs.trim(),j={},z=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,O;while((O=z.exec(B))!==null){let H=O[1]||O[2],V=O[3];if(O[1])try{j[H]=X0(V,Y)}catch{j[H]=V}else j[H]=V}let L=X.componentsDir||"components",F=await q1(W,j,U.slotContent,L,Y,Z,X,new Set,Q??new Set);J=J.slice(0,U.index)+F+J.slice(U.index+U.full.length)}catch(W){let j=`<!-- dynamic component error: ${W instanceof Error?W.message:String(W)} -->`;J=J.slice(0,U.index)+j+J.slice(U.index+U.full.length)}}return J=await cK(J,Y,Z,X,Q),J}async function cK($,Y,Z,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 _=K.length-1;_>=0;_--){let U=K[_];try{let W=X0(U.expr,Y);if(!W||typeof W!=="string"){let z=`<!-- dynamic component: could not resolve "${U.expr}" -->`;J=J.slice(0,U.index)+z+J.slice(U.index+U.full.length);continue}let B=X.componentsDir||"components",j=await q1(W,{},"",B,Y,Z,X,new Set,Q??new Set);J=J.slice(0,U.index)+j+J.slice(U.index+U.full.length)}catch(W){let j=`<!-- dynamic component error: ${W instanceof Error?W.message:String(W)} -->`;J=J.slice(0,U.index)+j+J.slice(U.index+U.full.length)}}return J}var R8=S(()=>{H0();V0()});function iK($,Y={},Z={}){let{title:X="stx App",lang:Q="en",meta:J=[],link:G=[],script:K=[],headRaw:q="",bodyClass:_="",bodyAttrs:U={}}=Y,W=Z.title||X,z=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...J].map((R)=>{return` <meta ${Object.entries(R).map(([w,T])=>`${w}="${T}"`).join(" ")}>`}).join(`
3707
3712
  `),O=G.map((R)=>{return` <link ${Object.entries(R).map(([w,T])=>`${w}="${T}"`).join(" ")}>`}).join(`
3708
3713
  `),L=K.map((R)=>{if(R.src)return` <script ${Object.entries(R).filter(([w])=>w!=="content").map(([w,T])=>`${w}="${T}"`).join(" ")}></script>`;if(R.content)return` <script>${R.content}</script>`;return""}).filter(Boolean).join(`
3709
3714
  `),F=Object.entries(U).map(([R,A])=>` ${R}="${A}"`).join(""),H=_?` class="${_}"`:"",V=[z,` <title>${W}</title>`,O,L,q?` ${q}`:"",...(Z.styles||[]).map((R)=>` ${R}`),...(Z.headScripts||[]).map((R)=>` ${R}`),Z.headStack||""].filter(Boolean),N=[$,...(Z.bodyScripts||[]).map((R)=>R),Z.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
@@ -3716,7 +3721,7 @@ ${V.join(`
3716
3721
  ${N.join(`
3717
3722
  `)}
3718
3723
  </body>
3719
- </html>`}function lK($){let Y=$.trim();while(Y.startsWith("<!--")){let Z=Y.indexOf("-->");if(Z===-1)break;Y=Y.slice(Z+3).trim()}return/^<!DOCTYPE\b/i.test(Y)||/^<html[\s>]/i.test(Y)}function R8($,Y={},Z={}){if(lK($))return $;return uK($,Y,Z)}function F4($){let Y=$,Z=new Set,X=new Set,Q=()=>{if(E0)X.add(E0);return Y};return Q.set=(J)=>{if(!Object.is(J,Y)){let G=Y;if(Y=J,Z.forEach((K)=>K(Y,G)),G5)X.forEach((K)=>F9.add(K));else X.forEach((K)=>K())}},Q.update=(J)=>{Q.set(J(Y))},Q.subscribe=(J)=>{return Z.add(J),()=>Z.delete(J)},Object.defineProperty(Q,"_isSignal",{value:!0,writable:!1}),Q}function V4($){let Y,Z=!0,X=new Set,Q=()=>{if(!Z)if(Z=!0,G5)X.forEach((G)=>F9.add(G));else X.forEach((G)=>G())},J=()=>{if(E0)X.add(E0);if(Z){let G=E0;E0=Q,L9.push(Q);try{Y=$()}finally{L9.pop(),E0=G}Z=!1}return Y};return Object.defineProperty(J,"_isDerived",{value:!0,writable:!1}),J}function R4($,Y={}){let Z,X=!1,Q=()=>{if(X)return;if(Z)Z(),Z=void 0;let J=E0;E0=Q,L9.push(Q);try{Z=$()}finally{L9.pop(),E0=J}};if(Y.immediate!==!1)Q();return()=>{if(X=!0,Z)Z()}}function N4($){if(G5){$();return}G5=!0;try{$()}finally{G5=!1,F9.forEach((Y)=>Y()),F9.clear()}}function A4($){pK.push($)}function w4($){cK.push($)}function V9($){return typeof $==="function"&&$._isSignal===!0}function R9($){return typeof $==="function"&&$._isDerived===!0}function T4($){if(V9($)||R9($))return $();return $}function M4($){let Y=E0;E0=null;try{return $()}finally{E0=Y}}var E0=null,L9,G5=!1,F9,pK,cK;var I4=b(()=>{L9=[],F9=new Set,pK=[],cK=[]});var E4={};r(E4,{untrack:()=>T4,state:()=>F4,peek:()=>M4,onMount:()=>A4,onDestroy:()=>w4,isSignal:()=>V9,isDerived:()=>R9,generateSignalsRuntimeDev:()=>N9,generateSignalsRuntime:()=>N8,effect:()=>R4,derived:()=>V4,default:()=>iK,batch:()=>N4});function N8(){try{let Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(N9());return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return N9()}}function N9(){return`
3724
+ </html>`}function nK($){let Y=$.trim();while(Y.startsWith("<!--")){let Z=Y.indexOf("-->");if(Z===-1)break;Y=Y.slice(Z+3).trim()}return/^<!DOCTYPE\b/i.test(Y)||/^<html[\s>]/i.test(Y)}function N8($,Y={},Z={}){if(nK($))return $;return iK($,Y,Z)}function F4($){let Y=$,Z=new Set,X=new Set,Q=()=>{if(E0)X.add(E0);return Y};return Q.set=(J)=>{if(!Object.is(J,Y)){let G=Y;if(Y=J,Z.forEach((K)=>K(Y,G)),G5)X.forEach((K)=>F9.add(K));else X.forEach((K)=>K())}},Q.update=(J)=>{Q.set(J(Y))},Q.subscribe=(J)=>{return Z.add(J),()=>Z.delete(J)},Object.defineProperty(Q,"_isSignal",{value:!0,writable:!1}),Q}function V4($){let Y,Z=!0,X=new Set,Q=()=>{if(!Z)if(Z=!0,G5)X.forEach((G)=>F9.add(G));else X.forEach((G)=>G())},J=()=>{if(E0)X.add(E0);if(Z){let G=E0;E0=Q,L9.push(Q);try{Y=$()}finally{L9.pop(),E0=G}Z=!1}return Y};return Object.defineProperty(J,"_isDerived",{value:!0,writable:!1}),J}function R4($,Y={}){let Z,X=!1,Q=()=>{if(X)return;if(Z)Z(),Z=void 0;let J=E0;E0=Q,L9.push(Q);try{Z=$()}finally{L9.pop(),E0=J}};if(Y.immediate!==!1)Q();return()=>{if(X=!0,Z)Z()}}function N4($){if(G5){$();return}G5=!0;try{$()}finally{G5=!1,F9.forEach((Y)=>Y()),F9.clear()}}function A4($){oK.push($)}function w4($){sK.push($)}function V9($){return typeof $==="function"&&$._isSignal===!0}function R9($){return typeof $==="function"&&$._isDerived===!0}function T4($){if(V9($)||R9($))return $();return $}function M4($){let Y=E0;E0=null;try{return $()}finally{E0=Y}}var E0=null,L9,G5=!1,F9,oK,sK;var I4=S(()=>{L9=[],F9=new Set,oK=[],sK=[]});var E4={};r(E4,{untrack:()=>T4,state:()=>F4,peek:()=>M4,onMount:()=>A4,onDestroy:()=>w4,isSignal:()=>V9,isDerived:()=>R9,generateSignalsRuntimeDev:()=>N9,generateSignalsRuntime:()=>A8,effect:()=>R4,derived:()=>V4,default:()=>rK,batch:()=>N4});function A8(){try{let Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(N9());return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return N9()}}function N9(){return`
3720
3725
  // STX Signals Runtime (Development Build)
3721
3726
  console.log('[stx] signals runtime loading');
3722
3727
  // Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
@@ -7809,7 +7814,7 @@ catch (e) { console.warn('[stx] mount callback error:', e); }
7809
7814
  }
7810
7815
  }
7811
7816
  })();
7812
- `}var iK;var D4=b(()=>{I4();I4();iK={state:F4,derived:V4,effect:R4,batch:N4,onMount:A4,onDestroy:w4,isSignal:V9,isDerived:R9,untrack:T4,peek:M4,generateSignalsRuntime:N8,generateSignalsRuntimeDev:N9}});var k4={};r(k4,{templateCache:()=>A8,readFileCached:()=>nK,invalidateFileCacheByDir:()=>sK,invalidateFileCache:()=>oK,hashFilePath:()=>K5,getCachedSignalsRuntime:()=>aK,getCachedRouterScript:()=>tK,clearDevCaches:()=>eK,checkCache:()=>$q,cacheTemplate:()=>Yq});import t0 from"fs";import S1 from"path";async function nK($){let Z;for(let X=0;X<3;X++)try{let J=(await t0.promises.stat($)).mtime.getTime(),G=j1.get($);if(G&&G.mtime===J)return G.content;let K=await Bun.file($).text(),_=(await t0.promises.stat($)).mtime.getTime();if(_!==J)continue;return j1.set($,{content:K,mtime:_}),K}catch(Q){Z=Q;break}throw j1.delete($),Error(`File not found: ${$}${Z?` (${Z.message})`:""}`)}function oK($){j1.delete($)}function sK($){for(let Y of j1.keys())if(Y.startsWith($))j1.delete(Y)}async function aK($=!1){if($){let{generateSignalsRuntimeDev:Y}=await Promise.resolve().then(() => (D4(),E4));return Y()}if(A9===null){let{generateSignalsRuntime:Y}=await Promise.resolve().then(() => (D4(),E4));A9=Y()}return A9}async function tK(){if(w9===null){let{getRouterScript:$}=await import("stx-router");w9=$()}return w9}function eK(){j1.clear(),A9=null,rK=null,w9=null}async function $q($,Y){try{if(!Y.cachePath)return null;let Z=S1.resolve(Y.cachePath),X=S1.join(Z,`${K5($)}.html`),Q=S1.join(Z,`${K5($)}.meta.json`);if(!await c(X)||!await c(Q))return null;let J=await Bun.file(Q).text(),G=JSON.parse(J);if(G.cacheVersion!==Y.cacheVersion)return null;if((await t0.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await c(q)){if((await t0.promises.stat(q)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(X).text()}catch(Z){return console.warn(`Cache error for ${$}:`,Z),null}}async function Yq($,Y,Z,X){try{if(!X.cachePath)return;let Q=S1.resolve(X.cachePath);await t0.promises.mkdir(Q,{recursive:!0});let J=S1.join(Q,`${K5($)}.html`),G=S1.join(Q,`${K5($)}.meta.json`),K=await t0.promises.stat($);await Bun.write(J,Y);let q={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Z),cacheVersion:X.cacheVersion,generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),A8.set($,{output:Y,mtime:K.mtime.getTime(),dependencies:Z})}catch(Q){console.warn(`Failed to cache template ${$}:`,Q)}}function K5($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,Zq)}var A8,j1,A9=null,rK=null,w9=null,Zq=16;var S4=b(()=>{H0();A8=new Map,j1=new Map});function w8($){if($.includes("window.StacksBrowser")||$.includes("StacksBrowser ="))return $;let Y=/<script\b(?![^>]*\bserver\b)[^>]*>([\s\S]*?)<\/script>/gi,Z="",X;while((X=Y.exec($))!==null)Z+=X[1]+`
7817
+ `}var rK;var D4=S(()=>{I4();I4();rK={state:F4,derived:V4,effect:R4,batch:N4,onMount:A4,onDestroy:w4,isSignal:V9,isDerived:R9,untrack:T4,peek:M4,generateSignalsRuntime:A8,generateSignalsRuntimeDev:N9}});var k4={};r(k4,{templateCache:()=>w8,readFileCached:()=>aK,invalidateFileCacheByDir:()=>eK,invalidateFileCache:()=>tK,hashFilePath:()=>K5,getCachedSignalsRuntime:()=>Yq,getCachedRouterScript:()=>Zq,clearDevCaches:()=>Xq,checkCache:()=>Jq,cacheTemplate:()=>Qq});import e0 from"fs";import S1 from"path";async function aK($){let Z;for(let X=0;X<3;X++)try{let J=(await e0.promises.stat($)).mtime.getTime(),G=O1.get($);if(G&&G.mtime===J)return G.content;let K=await Bun.file($).text(),_=(await e0.promises.stat($)).mtime.getTime();if(_!==J)continue;return O1.set($,{content:K,mtime:_}),K}catch(Q){Z=Q;break}throw O1.delete($),Error(`File not found: ${$}${Z?` (${Z.message})`:""}`)}function tK($){O1.delete($)}function eK($){for(let Y of O1.keys())if(Y.startsWith($))O1.delete(Y)}async function Yq($=!1){if($){let{generateSignalsRuntimeDev:Y}=await Promise.resolve().then(() => (D4(),E4));return Y()}if(A9===null){let{generateSignalsRuntime:Y}=await Promise.resolve().then(() => (D4(),E4));A9=Y()}return A9}async function Zq(){if(w9===null){let{getRouterScript:$}=await import("stx-router");w9=$()}return w9}function Xq(){O1.clear(),A9=null,$q=null,w9=null}async function Jq($,Y){try{if(!Y.cachePath)return null;let Z=S1.resolve(Y.cachePath),X=S1.join(Z,`${K5($)}.html`),Q=S1.join(Z,`${K5($)}.meta.json`);if(!await c(X)||!await c(Q))return null;let J=await Bun.file(Q).text(),G=JSON.parse(J);if(G.cacheVersion!==Y.cacheVersion)return null;if((await e0.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await c(q)){if((await e0.promises.stat(q)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(X).text()}catch(Z){return console.warn(`Cache error for ${$}:`,Z),null}}async function Qq($,Y,Z,X){try{if(!X.cachePath)return;let Q=S1.resolve(X.cachePath);await e0.promises.mkdir(Q,{recursive:!0});let J=S1.join(Q,`${K5($)}.html`),G=S1.join(Q,`${K5($)}.meta.json`),K=await e0.promises.stat($);await Bun.write(J,Y);let q={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Z),cacheVersion:X.cacheVersion,generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),w8.set($,{output:Y,mtime:K.mtime.getTime(),dependencies:Z})}catch(Q){console.warn(`Failed to cache template ${$}:`,Q)}}function K5($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,Gq)}var w8,O1,A9=null,$q=null,w9=null,Gq=16;var b4=S(()=>{H0();w8=new Map,O1=new Map});function T8($){if($.includes("window.StacksBrowser")||$.includes("StacksBrowser ="))return $;let Y=/<script\b(?![^>]*\bserver\b)[^>]*>([\s\S]*?)<\/script>/gi,Z="",X;while((X=Y.exec($))!==null)Z+=X[1]+`
7813
7818
  `;let Q=/\{\{([\s\S]*?)\}\}/g;while((X=Q.exec($))!==null)Z+=X[1]+`
7814
7819
  `;if(!Z.trim())return $;let G=["browserQuery","BrowserQueryBuilder","configureBrowser","createBrowserModel"].some((B)=>{return new RegExp(`\\b${B}\\b`).test(Z)}),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=!1;while((_=q.exec(Z))!==null)if(!K.has(_[1])){U=!0;break}if(!G&&!U)return $;let W=`<script type="module">
7815
7820
  // STX: Auto-load @stacksjs/browser (auto-initializes API and loads models)
@@ -7818,21 +7823,21 @@ import '@stacksjs/browser'
7818
7823
  `+$.slice(z);return $.replace("</head>",`${W}
7819
7824
  </head>`)}if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
7820
7825
  ${W}`);return W+`
7821
- `+$}async function T8($,Y){if($.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Y.buildMode==="compile"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script src="/__stx/runtime.__STX_HASH__.js"></script>
7826
+ `+$}async function M8($,Y){if($.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Y.buildMode==="compile"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script src="/__stx/runtime.__STX_HASH__.js"></script>
7822
7827
  `+$.slice(K);if($.includes("</head>")){let q=$.indexOf("</head>");return $.slice(0,q)+`<script src="/__stx/runtime.__STX_HASH__.js"></script>
7823
7828
  `+$.slice(q)}return`<script src="/__stx/runtime.__STX_HASH__.js"></script>
7824
- `+$}let{getCachedSignalsRuntime:Z}=await Promise.resolve().then(() => (S4(),k4)),Q=`<script data-stx-scoped>${await Z(Y.debug)}</script>`,J=$.indexOf("<script");if(J!==-1)return $.slice(0,J)+Q+`
7829
+ `+$}let{getCachedSignalsRuntime:Z}=await Promise.resolve().then(() => (b4(),k4)),Q=`<script data-stx-scoped>${await Z(Y.debug)}</script>`,J=$.indexOf("<script");if(J!==-1)return $.slice(0,J)+Q+`
7825
7830
  `+$.slice(J);if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Q+`
7826
7831
  `+$.slice(G)}if($.includes("<body")){let G=$.indexOf("<body"),K=$.indexOf(">",G);return $.slice(0,K+1)+`
7827
7832
  `+Q+$.slice(K+1)}return Q+`
7828
- `+$}async function M8($,Y){if(!$.includes("</body>"))return $;if($.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Z=Y?.router,X="";if(Z){let K={};if(Z.container)K.container=Z.container;if(Z.viewTransitions!==void 0)K.viewTransitions=Z.viewTransitions;if(Z.viewTransitionDuration!==void 0)K.viewTransitionDuration=Z.viewTransitionDuration;if(Z.viewTransitionEasing!==void 0)K.viewTransitionEasing=Z.viewTransitionEasing;if(Z.scrollToTop!==void 0)K.scrollToTop=Z.scrollToTop;if(Z.prefetch!==void 0)K.prefetch=Z.prefetch;if(Z.cache!==void 0)K.cache=Z.cache;if(Z.progressColor!==void 0)K.progressColor=Z.progressColor;if(Z.progressHeight!==void 0)K.progressHeight=Z.progressHeight;if(Object.keys(K).length>0)X=`<script>window.__stxRouterConfig=${JSON.stringify(K)};</script>
7829
- `}let{getCachedRouterScript:Q}=await Promise.resolve().then(() => (S4(),k4)),J=Y?.buildMode==="compile"?'<script src="/__stx/router.__STX_HASH__.js"></script>':`<script>${await Q()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+X+J+`
7830
- </body>`+$.slice(G+7)}var y8={};r(y8,{scanScriptTags:()=>D8,processSignals:()=>P4,processScriptSetup:()=>S8,parseLoopExpression:()=>k8,hasSignalsSyntax:()=>M9,extractExports:()=>b8,convertSignalLoopsToAttributes:()=>y4,convertSignalDirectivesToAttributes:()=>b4});function D8($,Y={}){let Z=[];T9.lastIndex=0;let X;while((X=T9.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(Y.skipAttrs&&Y.skipAttrs.test(Q)){T9.lastIndex=K;continue}Z.push({fullMatch:$.slice(X.index,K),attrs:Q,body:$.slice(J,G),start:X.index,end:K}),T9.lastIndex=K}return Z}function k8($){let Y=$.trim(),Z=Y.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Z){let Q=Z[1].trim(),J=Z[2].trim(),{itemVar:G,indexVar:K}=I8(J);if(G)return{style:"as",iterable:Q,itemVar:G,indexVar:K}}let X=Y.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(X){let Q=X[1].trim(),J=X[2].trim(),{itemVar:G,indexVar:K}=I8(Q);if(G)return{style:"in",iterable:J,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function I8($){let Y=$.trim(),Z=Y.match(/^(\w+)\s*=>\s*(\w+)$/);if(Z)return{itemVar:Z[2],indexVar:Z[1]};let X=Y.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(X)return{itemVar:X[1],indexVar:X[2]||null};let Q=Y.match(/^(\w+)\s*,\s*(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:Q[2]};let J=Y.match(/^(\w+)$/);if(J)return{itemVar:J[1],indexVar:null};return{itemVar:null,indexVar:null}}function M9($){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((Z)=>Z.test($))}function Jq($){let Y=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Z=0,X;while((X=Y.exec($))!==null){let Q=X[1];if(Q.startsWith("if"))Z++;else if(Q==="endif")Z--;else if(Z===0)return!0}return!1}function b4($){let Y=$,Z=/@if\s*\(/g,X,Q=[];while((X=Z.exec(Y))!==null){let J=X.index,G=J+X[0].length,K=1,q=G;while(q<Y.length&&K>0){if(Y[q]==="(")K++;else if(Y[q]===")")K--;q++}if(K!==0)continue;let _=Y.substring(G,q-1).trim(),U=q,W=1,B=U,j=/@(if\s*\(|endif)/g;j.lastIndex=U;let z;while((z=j.exec(Y))!==null)if(z[1].startsWith("if"))W++;else if(z[1]==="endif"){if(W--,W===0){B=z.index+z[0].length;break}}if(W!==0)continue;let O=Y.substring(U,B-6).trim();if(Jq(O))continue;let L=O.match(E8),F;if(L){let[,H,V,N]=L,R=_.replace(/"/g,"&quot;");F=`<${H}${V} @if="${R}">${N}</${H}>`}else F=`<template @if="${_.replace(/"/g,"&quot;")}">${O}</template>`;Q.push({start:J,end:B,replacement:F})}for(let J=Q.length-1;J>=0;J--){let{start:G,end:K,replacement:q}=Q[J];Y=Y.substring(0,G)+q+Y.substring(K)}return Y}function y4($,Y){let Z=$,X=/@(for|foreach)\s*\(/g,Q,J=[];while((Q=X.exec(Z))!==null){let G=Q[1],K=Q.index,q=K+Q[0].length,_=1,U=q;while(U<Z.length&&_>0){if(Z[U]==="(")_++;else if(Z[U]===")")_--;U++}if(_!==0)continue;let W=Z.substring(q,U-1).trim(),B=U,j=k8(W);if(j.iterable){let A=j.iterable.trim();if(A.startsWith("[")||A.startsWith("{")||A.startsWith("'")||A.startsWith('"')||A.startsWith("`")||/^-?\d/.test(A))continue;if(Y){let w=A.split(/[.[(]/)[0].trim();if(w&&w in Y)continue}}if(j.style==="as")W=j.indexVar?`(${j.itemVar}, ${j.indexVar}) in ${j.iterable}`:`${j.itemVar} in ${j.iterable}`;let z=G==="for"?"@endfor":"@endforeach",O=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 H;while((H=F.exec(Z))!==null)if(H[1].startsWith(G))O++;else if(O--,O===0){L=H.index+H[0].length;break}if(O!==0)continue;let V=Z.substring(B,L-z.length).trim(),N=V.match(E8),R;if(N){let[,A,w,T]=N;R=`<${A}${w} @for="${W}">${T}</${A}>`}else R=`<template @for="${W}">${V}</template>`;J.push({start:K,end:L,replacement:R})}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:_}=J[G];Z=Z.substring(0,K)+_+Z.substring(q)}return Z}function Qq($){let Y=new Set,Z=[],X=0,Q=0,J=$.length,G=(U)=>{let W=X+1;while(W<J){let B=$[W];if(B==="\\"){W+=2;continue}if(B===U)return W+1;W++}return J},K=()=>{let U=X+2;while(U<J&&$[U]!==`
7833
+ `+$}async function I8($,Y){if(!$.includes("</body>"))return $;if($.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Z=Y?.router,X="";if(Z){let K={};if(Z.container)K.container=Z.container;if(Z.viewTransitions!==void 0)K.viewTransitions=Z.viewTransitions;if(Z.viewTransitionDuration!==void 0)K.viewTransitionDuration=Z.viewTransitionDuration;if(Z.viewTransitionEasing!==void 0)K.viewTransitionEasing=Z.viewTransitionEasing;if(Z.scrollToTop!==void 0)K.scrollToTop=Z.scrollToTop;if(Z.prefetch!==void 0)K.prefetch=Z.prefetch;if(Z.cache!==void 0)K.cache=Z.cache;if(Z.progressColor!==void 0)K.progressColor=Z.progressColor;if(Z.progressHeight!==void 0)K.progressHeight=Z.progressHeight;if(Object.keys(K).length>0)X=`<script>window.__stxRouterConfig=${JSON.stringify(K)};</script>
7834
+ `}let{getCachedRouterScript:Q}=await Promise.resolve().then(() => (b4(),k4)),J=Y?.buildMode==="compile"?'<script src="/__stx/router.__STX_HASH__.js"></script>':`<script>${await Q()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+X+J+`
7835
+ </body>`+$.slice(G+7)}var P8={};r(P8,{scanScriptTags:()=>k8,processSignals:()=>P4,processScriptSetup:()=>S8,parseLoopExpression:()=>b8,hasSignalsSyntax:()=>M9,extractExports:()=>y8,convertSignalLoopsToAttributes:()=>y4,convertSignalDirectivesToAttributes:()=>S4});function k8($,Y={}){let Z=[];T9.lastIndex=0;let X;while((X=T9.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(Y.skipAttrs&&Y.skipAttrs.test(Q)){T9.lastIndex=K;continue}Z.push({fullMatch:$.slice(X.index,K),attrs:Q,body:$.slice(J,G),start:X.index,end:K}),T9.lastIndex=K}return Z}function b8($){let Y=$.trim(),Z=Y.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Z){let Q=Z[1].trim(),J=Z[2].trim(),{itemVar:G,indexVar:K}=E8(J);if(G)return{style:"as",iterable:Q,itemVar:G,indexVar:K}}let X=Y.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}=E8(Q);if(G)return{style:"in",iterable:J,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function E8($){let Y=$.trim(),Z=Y.match(/^(\w+)\s*=>\s*(\w+)$/);if(Z)return{itemVar:Z[2],indexVar:Z[1]};let X=Y.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(X)return{itemVar:X[1],indexVar:X[2]||null};let Q=Y.match(/^(\w+)\s*,\s*(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:Q[2]};let J=Y.match(/^(\w+)$/);if(J)return{itemVar:J[1],indexVar:null};return{itemVar:null,indexVar:null}}function M9($){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((Z)=>Z.test($))}function qq($){let Y=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Z=0,X;while((X=Y.exec($))!==null){let Q=X[1];if(Q.startsWith("if"))Z++;else if(Q==="endif")Z--;else if(Z===0)return!0}return!1}function S4($){let Y=$,Z=/@if\s*\(/g,X,Q=[];while((X=Z.exec(Y))!==null){let J=X.index,G=J+X[0].length,K=1,q=G;while(q<Y.length&&K>0){if(Y[q]==="(")K++;else if(Y[q]===")")K--;q++}if(K!==0)continue;let _=Y.substring(G,q-1).trim(),U=q,W=1,B=U,j=/@(if\s*\(|endif)/g;j.lastIndex=U;let z;while((z=j.exec(Y))!==null)if(z[1].startsWith("if"))W++;else if(z[1]==="endif"){if(W--,W===0){B=z.index+z[0].length;break}}if(W!==0)continue;let O=Y.substring(U,B-6).trim();if(qq(O))continue;let L=O.match(D8),F;if(L){let[,H,V,N]=L,R=_.replace(/"/g,"&quot;");F=`<${H}${V} @if="${R}">${N}</${H}>`}else F=`<template @if="${_.replace(/"/g,"&quot;")}">${O}</template>`;Q.push({start:J,end:B,replacement:F})}for(let J=Q.length-1;J>=0;J--){let{start:G,end:K,replacement:q}=Q[J];Y=Y.substring(0,G)+q+Y.substring(K)}return Y}function y4($,Y){let Z=$,X=/@(for|foreach)\s*\(/g,Q,J=[];while((Q=X.exec(Z))!==null){let G=Q[1],K=Q.index,q=K+Q[0].length,_=1,U=q;while(U<Z.length&&_>0){if(Z[U]==="(")_++;else if(Z[U]===")")_--;U++}if(_!==0)continue;let W=Z.substring(q,U-1).trim(),B=U,j=b8(W);if(j.iterable){let A=j.iterable.trim();if(A.startsWith("[")||A.startsWith("{")||A.startsWith("'")||A.startsWith('"')||A.startsWith("`")||/^-?\d/.test(A))continue;if(Y){let w=A.split(/[.[(]/)[0].trim();if(w&&w in Y)continue}}if(j.style==="as")W=j.indexVar?`(${j.itemVar}, ${j.indexVar}) in ${j.iterable}`:`${j.itemVar} in ${j.iterable}`;let z=G==="for"?"@endfor":"@endforeach",O=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 H;while((H=F.exec(Z))!==null)if(H[1].startsWith(G))O++;else if(O--,O===0){L=H.index+H[0].length;break}if(O!==0)continue;let V=Z.substring(B,L-z.length).trim(),N=V.match(D8),R;if(N){let[,A,w,T]=N;R=`<${A}${w} @for="${W}">${T}</${A}>`}else R=`<template @for="${W}">${V}</template>`;J.push({start:K,end:L,replacement:R})}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:_}=J[G];Z=Z.substring(0,K)+_+Z.substring(q)}return Z}function Uq($){let Y=new Set,Z=[],X=0,Q=0,J=$.length,G=(U)=>{let W=X+1;while(W<J){let B=$[W];if(B==="\\"){W+=2;continue}if(B===U)return W+1;W++}return J},K=()=>{let U=X+2;while(U<J&&$[U]!==`
7831
7836
  `)U++;return U},q=()=>{let U=X+2;while(U<J-1){if($[U]==="*"&&$[U+1]==="/")return U+2;U++}return J},_=(U)=>{let W=U,B=0;while(W<J){let j=$[W];if(j==="/"&&$[W+1]==="/"){let z=W+2;while(z<J&&$[z]!==`
7832
- `)z++;W=z;continue}if(j==="/"&&$[W+1]==="*"){let z=W+2;while(z<J-1&&!($[z]==="*"&&$[z+1]==="/"))z++;W=z+2;continue}if(j==='"'||j==="'"||j==="`"){let z=W+1;while(z<J){if($[z]==="\\"){z+=2;continue}if($[z]===j){z++;break}z++}W=z;continue}if(j==="("||j==="["||j==="{"){B++,W++;continue}if(j===")"||j==="]"||j==="}"){B--,W++;continue}if(j===";"&&B===0)return W+1;W++}return J};while(X<J){let U=$[X];if(U==="/"&&$[X+1]==="/"){let W=K();Z.push($.slice(X,W)),X=W;continue}if(U==="/"&&$[X+1]==="*"){let W=q();Z.push($.slice(X,W)),X=W;continue}if(U==='"'||U==="'"||U==="`"){let W=G(U);Z.push($.slice(X,W)),X=W;continue}if(U==="{"){Q++,Z.push(U),X++;continue}if(U==="}"){Q--,Z.push(U),X++;continue}if(Q===0){let W=X>0?$[X-1]:"";if(W===""||/\s/.test(W)||W===";"||W==="}"||W==="{"){let j=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let z=j[2],O=_(X+j[0].length);if(Y.has(z)){Z.push(`/* stx: deduped const ${z} */`),X=O;continue}Y.add(z),Z.push($.slice(X,O)),X=O;continue}}}Z.push(U),X++}return Z.join("")}async function S8($,Y){let Z=D8($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),X=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useWebSocket|useRoute|useSearchParams|onMount|onDestroy)\s*(?:<[^>]*>)?\s*\(/,Q=[];for(let j of Z){let z=j.body;if(Z1(j.attrs))z=X1(z);if(X.test(z))Q.push({fullMatch:j.fullMatch,attrs:j.attrs,content:z})}if(Q.length===0)return{output:$,setupCode:null};let J=`__stx_setup_${Date.now()}_${Xq++}`,{hasUserImports:G,bundleClientScript:K}=await Promise.resolve().then(() => (i9(),c9)),q=[];for(let j=0;j<Q.length;j++){let z=Q[j].content;if(G(z))console.log("[stx:bundler] bundling signal script imports"),z=await K(z,Y||"",{projectRoot:process.cwd()});z=z.replace(/^\s*import\s+(?:type\s+)?\{[^}]*\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,"// [stx import stripped \u2014 resolved via window.stx in __stx_setup]");let O=p0(z);q.push(`// \u2500\u2500 merged signal script #${j+1} \u2500\u2500
7837
+ `)z++;W=z;continue}if(j==="/"&&$[W+1]==="*"){let z=W+2;while(z<J-1&&!($[z]==="*"&&$[z+1]==="/"))z++;W=z+2;continue}if(j==='"'||j==="'"||j==="`"){let z=W+1;while(z<J){if($[z]==="\\"){z+=2;continue}if($[z]===j){z++;break}z++}W=z;continue}if(j==="("||j==="["||j==="{"){B++,W++;continue}if(j===")"||j==="]"||j==="}"){B--,W++;continue}if(j===";"&&B===0)return W+1;W++}return J};while(X<J){let U=$[X];if(U==="/"&&$[X+1]==="/"){let W=K();Z.push($.slice(X,W)),X=W;continue}if(U==="/"&&$[X+1]==="*"){let W=q();Z.push($.slice(X,W)),X=W;continue}if(U==='"'||U==="'"||U==="`"){let W=G(U);Z.push($.slice(X,W)),X=W;continue}if(U==="{"){Q++,Z.push(U),X++;continue}if(U==="}"){Q--,Z.push(U),X++;continue}if(Q===0){let W=X>0?$[X-1]:"";if(W===""||/\s/.test(W)||W===";"||W==="}"||W==="{"){let j=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let z=j[2],O=_(X+j[0].length);if(Y.has(z)){Z.push(`/* stx: deduped const ${z} */`),X=O;continue}Y.add(z),Z.push($.slice(X,O)),X=O;continue}}}Z.push(U),X++}return Z.join("")}async function S8($,Y){let Z=k8($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),X=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useWebSocket|useRoute|useSearchParams|onMount|onDestroy)\s*(?:<[^>]*>)?\s*\(/,Q=[];for(let j of Z){let z=j.body;if(X1(j.attrs))z=J1(z);if(X.test(z))Q.push({fullMatch:j.fullMatch,attrs:j.attrs,content:z})}if(Q.length===0)return{output:$,setupCode:null};let J=`__stx_setup_${Date.now()}_${Kq++}`,{hasUserImports:G,bundleClientScript:K}=await Promise.resolve().then(() => (i9(),c9)),q=[];for(let j=0;j<Q.length;j++){let z=Q[j].content;if(G(z))console.log("[stx:bundler] bundling signal script imports"),z=await K(z,Y||"",{projectRoot:process.cwd()});z=z.replace(/^\s*import\s+(?:type\s+)?\{[^}]*\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,"// [stx import stripped \u2014 resolved via window.stx in __stx_setup]");let O=p0(z);q.push(`// \u2500\u2500 merged signal script #${j+1} \u2500\u2500
7833
7838
  ${O}`)}let _=q.join(`
7834
7839
 
7835
- `);_=Qq(_);let U=b8(_),W=`
7840
+ `);_=Uq(_);let U=y8(_),W=`
7836
7841
  <script data-stx-scoped>
7837
7842
  function ${J}() {
7838
7843
  const { state, derived, effect, batch, onMount, onDestroy, defineStore, useStore, useFetch, useRef, useQuery, useMutation, useDebounce, useDebouncedValue, useThrottle, useInterval, useTimeout, useToggle, useCounter, useClickOutside, useFocus, useAsync, useLocalStorage, useEventListener, useWebSocket, useColorMode, useDark, useHead, useSeoMeta, useRoute, useSearchParams, navigate, goBack, goForward, provide, ref, reactive, computed, watch, watchEffect } = window.stx;
@@ -7840,23 +7845,23 @@ ${_}
7840
7845
  return { ${U} };
7841
7846
  }
7842
7847
  if(window.stx)window.stx._latestSetup=${J};
7843
- </script>`,B=$;for(let j of Q)B=B.split(j.fullMatch).join("");if(B.includes("<body"))B=B.replace(/<body([^>]*)>/,`<body$1 data-stx="${J}">`);else{let j=["script","style","html","head","meta","link","title","!doctype"];B=B.replace(/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>/i,(z,O,L)=>{if(j.includes(O.toLowerCase()))return z;return`<${O}${L} data-stx="${J}">`})}return{output:B,setupCode:W}}function b8($){let Y=$,Z=[],X=new Set,Q=0,J=0,G=Y.length,K=(W)=>{J++;while(J<G){if(Y[J]==="\\"){J+=2;continue}if(Y[J]===W){J++;return}J++}},q=()=>{J++;while(J<G){if(Y[J]==="\\"){J+=2;continue}if(Y[J]==="`"){J++;return}if(Y[J]==="$"&&Y[J+1]==="{"){J+=2;let W=1;while(J<G&&W>0)if(Y[J]==="{")W++;else if(Y[J]==="}")W--;else if(Y[J]==="'"||Y[J]==='"')K(Y[J]);else if(Y[J]==="`")q();else J++;continue}J++}},_=()=>{if(Y[J]==="/"&&Y[J+1]==="/"){while(J<G&&Y[J]!==`
7844
- `)J++;return!0}if(Y[J]==="/"&&Y[J+1]==="*"){J+=2;while(J<G-1&&!(Y[J]==="*"&&Y[J+1]==="/"))J++;return J+=2,!0}return!1},U=()=>{if(Q!==0)return;let W=Y.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(W){let z=W[2];if(!X.has(z))Z.push(z),X.add(z);return}let B=Y.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let z=B[1];if(!X.has(z))Z.push(z),X.add(z);return}let j=Y.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let z=j[1];if(!X.has(z))Z.push(z),X.add(z)}};while(J<G){if(_())continue;if(Y[J]==="'"||Y[J]==='"'){K(Y[J]);continue}if(Y[J]==="`"){q();continue}if(Y[J]==="{"){Q++,J++;continue}if(Y[J]==="}"){Q--,J++;continue}if(Q===0&&/[a-z]/i.test(Y[J])&&(J===0||/\s|[;{}()]/.test(Y[J-1])))U();J++}return Z.join(", ")}async function P4($,Y,Z){if(!M9($))return $;let X=$;if(Y.skipSignalsRuntime)return X;let{output:Q,setupCode:J}=await S8(X,Z);if(X=Q,X=await T8(X,Y),X=w8(X),J)if(X.includes("</head>"))X=X.replace("</head>",`${J}
7848
+ </script>`,B=$;for(let j of Q)B=B.split(j.fullMatch).join("");if(B.includes("<body"))B=B.replace(/<body([^>]*)>/,`<body$1 data-stx="${J}">`);else{let j=["script","style","html","head","meta","link","title","!doctype"];B=B.replace(/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>/i,(z,O,L)=>{if(j.includes(O.toLowerCase()))return z;return`<${O}${L} data-stx="${J}">`})}return{output:B,setupCode:W}}function y8($){let Y=$,Z=[],X=new Set,Q=0,J=0,G=Y.length,K=(W)=>{J++;while(J<G){if(Y[J]==="\\"){J+=2;continue}if(Y[J]===W){J++;return}J++}},q=()=>{J++;while(J<G){if(Y[J]==="\\"){J+=2;continue}if(Y[J]==="`"){J++;return}if(Y[J]==="$"&&Y[J+1]==="{"){J+=2;let W=1;while(J<G&&W>0)if(Y[J]==="{")W++;else if(Y[J]==="}")W--;else if(Y[J]==="'"||Y[J]==='"')K(Y[J]);else if(Y[J]==="`")q();else J++;continue}J++}},_=()=>{if(Y[J]==="/"&&Y[J+1]==="/"){while(J<G&&Y[J]!==`
7849
+ `)J++;return!0}if(Y[J]==="/"&&Y[J+1]==="*"){J+=2;while(J<G-1&&!(Y[J]==="*"&&Y[J+1]==="/"))J++;return J+=2,!0}return!1},U=()=>{if(Q!==0)return;let W=Y.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(W){let z=W[2];if(!X.has(z))Z.push(z),X.add(z);return}let B=Y.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let z=B[1];if(!X.has(z))Z.push(z),X.add(z);return}let j=Y.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let z=j[1];if(!X.has(z))Z.push(z),X.add(z)}};while(J<G){if(_())continue;if(Y[J]==="'"||Y[J]==='"'){K(Y[J]);continue}if(Y[J]==="`"){q();continue}if(Y[J]==="{"){Q++,J++;continue}if(Y[J]==="}"){Q--,J++;continue}if(Q===0&&/[a-z]/i.test(Y[J])&&(J===0||/\s|[;{}()]/.test(Y[J-1])))U();J++}return Z.join(", ")}async function P4($,Y,Z){if(!M9($))return $;let X=$;if(Y.skipSignalsRuntime)return X;let{output:Q,setupCode:J}=await S8(X,Z);if(X=Q,X=await M8(X,Y),X=T8(X),J)if(X.includes("</head>"))X=X.replace("</head>",`${J}
7845
7850
  </head>`);else if(X.includes("<body"))X=X.replace(/<body([^>]*)>/,`<body$1>
7846
7851
  ${J}`);else X=X+`
7847
- `+J;let G=X.match(/<body([^>]*)>/i),K=G&&/data-stx/.test(G[1]);if(!J&&!K){if(X.includes("<body")&&G&&!/data-stx-auto/.test(G[1]))X=X.replace(/<body([^>]*)>/,"<body$1 data-stx-auto>")}return X}var Xq=0,T9,E8;var C4=b(()=>{H0();T9=/<script\b([^>]*)>/gi,E8=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s});import D0 from"path";import v4 from"fs";function P8($){return $.split("-").map((Y)=>Y.charAt(0).toUpperCase()+Y.slice(1)).join("")}function C8($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class v8{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Y of $.aliases)this.builtins.set(Y.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Y,Z,X){let Q=$.endsWith(".stx")?$.slice(0,-4):$,J=X?.__importedComponents;if(J){let j=[Q,Q.toLowerCase(),P8(Q),C8(Q)];for(let z of j)if(J.has(z))return J.get(z)}let G=[...new Set([`${Q}.stx`,`${P8(Q)}.stx`,`${C8(Q)}.stx`])];if(Q.startsWith("./")||Q.startsWith("../")){let j=D0.resolve(D0.dirname(Y),`${Q}.stx`);if(await c(j))return j;return null}let K=[],q=Z.componentsDir||"",_=X?.__originalFilePath;if(_)K.push(D0.join(D0.dirname(_),"components"));if(q)K.push(q);let U=D0.join(D0.dirname(Y),"components");if(!K.includes(U))K.push(U);let W=process.cwd(),B=[D0.resolve(W,"src/components"),D0.resolve(W,"components"),D0.resolve(import.meta.dir,"components")];for(let j of B)if(!K.includes(j))K.push(j);for(let j of K){if(!j)continue;for(let z of G){let O=D0.join(j,z);if(await c(O))return O}try{if(!v4.statSync(j,{throwIfNoEntry:!1})?.isDirectory())continue;let O=v4.readdirSync(j,{withFileTypes:!0});for(let L of O)if(L.isDirectory()){let F=D0.join(j,L.name);for(let H of G){let V=D0.join(F,H);if(await c(V))return V}}}catch{}}return null}}var x0;var x4=b(()=>{H0();x0=new v8});function f0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Gq($){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 f4;var g4=b(()=>{f4={name:"StxLink",aliases:["stx-link"],render($,Y,Z){let X=Gq($),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="${f0(X.value)}"`);else q.push(`href="${f0(X.value)}"`);if(Q)q.push(`class="${f0(Q)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${f0(J)}"`),q.push(`data-stx-exact-active-class="${f0(G)}"`),K)q.push("data-stx-prefetch");for(let[U,W]of Object.entries($.events))q.push(`@${f0(U)}="${f0(W)}"`);let _=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);for(let[U,W]of Object.entries($.static)){if(_.has(U))continue;if(typeof W==="boolean"){if(W)q.push(f0(U))}else q.push(`${f0(U)}="${f0(W)}"`)}return`<a ${q.join(" ")}>${Y}</a>`}}});function U0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function A0($,Y){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let Z=$.static[Y];if(typeof Z==="string")return Z;return}function d4($,Y,Z=!1){let X=$.serverDynamic[Y];if(X!==void 0)return X!==!1&&X!=="false";let Q=$.static[Y];if(Q!==void 0)return Q!=="false"&&Q!==!1;return Z}function x8($){if($.includes("(")||$.includes(","))return $;let Y=$.trim().split(/\s+/),Z=[];for(let X of Y)if(X.includes(":")){let[Q,J]=X.split(":"),G=Kq[Q];if(G)Z.push(`(max-width: ${G}px) ${J}`);else{let K=Number.parseInt(Q);if(!Number.isNaN(K))Z.push(`(max-width: ${K}px) ${J}`)}}else Z.push(X);return Z.join(", ")}function m4($,Y,Z,X){return Y.map((Q)=>`${q5($,Q,void 0,Z,X)} ${Q}w`).join(", ")}function qq($,Y,Z,X,Q){return Y.map((J)=>{let G=Z?Z*J:void 0;return`${q5($,G,void 0,X,Q)} ${J}x`}).join(", ")}function q5($,Y,Z,X,Q){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let J=[];if(Y)J.push(`w_${Y}`);if(Z)J.push(`h_${Z}`);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(Y)J.set("w",String(Y));if(Z)J.set("h",String(Z));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(Y)J.set("width",String(Y));if(Z)J.set("height",String(Z));if(Q)J.set("format",Q);let G=$.includes("?")?"&":"?";return`${$}${G}${J.toString()}`}return $}function Uq($,Y,Z="#e5e7eb"){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Y}"><rect width="100%" height="100%" fill="${Z}"/></svg>`;return`data:image/svg+xml;base64,${btoa(X)}`}var Kq,h4,u4;var l4=b(()=>{Kq={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},h4=[320,640,768,1024,1280,1536,1920];u4={name:"StxImage",aliases:["stx-image","stx-img"],render($,Y,Z){let X=A0($,"src")||"",Q=A0($,"alt")||"",J=A0($,"width"),G=A0($,"height"),K=A0($,"sizes"),q=A0($,"srcset"),_=A0($,"densities"),U=A0($,"format"),W=A0($,"placeholder"),B=A0($,"placeholderColor")||"#e5e7eb",j=A0($,"provider"),z=A0($,"class")||A0($,"className")||"",O=A0($,"style")||"",L=A0($,"quality"),F=d4($,"lazy",!0),H=d4($,"preload",!1),V=d4($,"picture",!1)||!!U,N=J?Number.parseInt(J):void 0,R=G?Number.parseInt(G):void 0,A=q||"",w="";if(!A&&K)A=m4(X,h4,j,U),w=x8(K);else if(!A&&_){let y=_.split(/\s+/).map((S)=>Number.parseFloat(S.replace("x","")));A=qq(X,y,N,j,U)}else if(K)w=x8(K);let T=[];if(O)T.push(O);if(N&&R)T.push(`aspect-ratio:${N}/${R}`);if(W==="blur"||W==="color"){let y=Uq(N||16,R||9,B);T.push(`background-image:url(${y})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(W&&W!=="empty"&&W!=="none")T.push(`background-image:url(${U0(W)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let I=q5(X,N,R,j,U),M=[];if(M.push(`src="${U0(I)}"`),M.push(`alt="${U0(Q)}"`),J)M.push(`width="${U0(J)}"`);if(G)M.push(`height="${U0(G)}"`);if(F)M.push('loading="lazy"');if(M.push('decoding="async"'),z)M.push(`class="${U0(z)}"`);if(T.length>0)M.push(`style="${U0(T.join(";"))}"`);if(A)M.push(`srcset="${U0(A)}"`);if(w)M.push(`sizes="${U0(w)}"`);let E=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);for(let[y,S]of Object.entries($.static)){if(E.has(y))continue;if(typeof S==="boolean"){if(S)M.push(U0(y))}else M.push(`${U0(y)}="${U0(S)}"`)}let D=`<img ${M.join(" ")} />`,P="";if(H){let S=U==="webp"?"image/webp":U==="avif"?"image/avif":"";P=`<link rel="preload" as="image" href="${U0(I)}"${S?` type="${S}"`:""}${A?` imagesrcset="${U0(A)}"`:""}${w?` imagesizes="${U0(w)}"`:""} />
7848
- `}if(V){let y=[];if(U==="avif"||U==="auto"){let S=q5(X,N,R,j,"avif"),k=A?m4(X,h4,j,"avif"):`${S}`;y.push(`<source type="image/avif" srcset="${U0(k)}"${w?` sizes="${U0(w)}"`:""} />`)}if(U==="webp"||U==="auto"){let S=q5(X,N,R,j,"webp"),k=A?m4(X,h4,j,"webp"):`${S}`;y.push(`<source type="image/webp" srcset="${U0(k)}"${w?` sizes="${U0(w)}"`:""} />`)}return`${P}<picture>
7852
+ `+J;let G=X.match(/<body([^>]*)>/i),K=G&&/data-stx/.test(G[1]);if(!J&&!K){if(X.includes("<body")&&G&&!/data-stx-auto/.test(G[1]))X=X.replace(/<body([^>]*)>/,"<body$1 data-stx-auto>")}return X}var Kq=0,T9,D8;var C4=S(()=>{H0();T9=/<script\b([^>]*)>/gi,D8=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s});import D0 from"path";import v4 from"fs";function C8($){return $.split("-").map((Y)=>Y.charAt(0).toUpperCase()+Y.slice(1)).join("")}function v8($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class x8{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Y of $.aliases)this.builtins.set(Y.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Y,Z,X){let Q=$.endsWith(".stx")?$.slice(0,-4):$,J=X?.__importedComponents;if(J){let j=[Q,Q.toLowerCase(),C8(Q),v8(Q)];for(let z of j)if(J.has(z))return J.get(z)}let G=[...new Set([`${Q}.stx`,`${C8(Q)}.stx`,`${v8(Q)}.stx`])];if(Q.startsWith("./")||Q.startsWith("../")){let j=D0.resolve(D0.dirname(Y),`${Q}.stx`);if(await c(j))return j;return null}let K=[],q=Z.componentsDir||"",_=X?.__originalFilePath;if(_)K.push(D0.join(D0.dirname(_),"components"));if(q)K.push(q);let U=D0.join(D0.dirname(Y),"components");if(!K.includes(U))K.push(U);let W=process.cwd(),B=[D0.resolve(W,"src/components"),D0.resolve(W,"components"),D0.resolve(import.meta.dir,"components")];for(let j of B)if(!K.includes(j))K.push(j);for(let j of K){if(!j)continue;for(let z of G){let O=D0.join(j,z);if(await c(O))return O}try{if(!v4.statSync(j,{throwIfNoEntry:!1})?.isDirectory())continue;let O=v4.readdirSync(j,{withFileTypes:!0});for(let L of O)if(L.isDirectory()){let F=D0.join(j,L.name);for(let H of G){let V=D0.join(F,H);if(await c(V))return V}}}catch{}}return null}}var x0;var x4=S(()=>{H0();x0=new x8});function f0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function _q($){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 f4;var g4=S(()=>{f4={name:"StxLink",aliases:["stx-link"],render($,Y,Z){let X=_q($),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="${f0(X.value)}"`);else q.push(`href="${f0(X.value)}"`);if(Q)q.push(`class="${f0(Q)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${f0(J)}"`),q.push(`data-stx-exact-active-class="${f0(G)}"`),K)q.push("data-stx-prefetch");for(let[U,W]of Object.entries($.events))q.push(`@${f0(U)}="${f0(W)}"`);let _=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);for(let[U,W]of Object.entries($.static)){if(_.has(U))continue;if(typeof W==="boolean"){if(W)q.push(f0(U))}else q.push(`${f0(U)}="${f0(W)}"`)}return`<a ${q.join(" ")}>${Y}</a>`}}});function U0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function A0($,Y){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let Z=$.static[Y];if(typeof Z==="string")return Z;return}function d4($,Y,Z=!1){let X=$.serverDynamic[Y];if(X!==void 0)return X!==!1&&X!=="false";let Q=$.static[Y];if(Q!==void 0)return Q!=="false"&&Q!==!1;return Z}function f8($){if($.includes("(")||$.includes(","))return $;let Y=$.trim().split(/\s+/),Z=[];for(let X of Y)if(X.includes(":")){let[Q,J]=X.split(":"),G=Wq[Q];if(G)Z.push(`(max-width: ${G}px) ${J}`);else{let K=Number.parseInt(Q);if(!Number.isNaN(K))Z.push(`(max-width: ${K}px) ${J}`)}}else Z.push(X);return Z.join(", ")}function m4($,Y,Z,X){return Y.map((Q)=>`${q5($,Q,void 0,Z,X)} ${Q}w`).join(", ")}function Bq($,Y,Z,X,Q){return Y.map((J)=>{let G=Z?Z*J:void 0;return`${q5($,G,void 0,X,Q)} ${J}x`}).join(", ")}function q5($,Y,Z,X,Q){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let J=[];if(Y)J.push(`w_${Y}`);if(Z)J.push(`h_${Z}`);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(Y)J.set("w",String(Y));if(Z)J.set("h",String(Z));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(Y)J.set("width",String(Y));if(Z)J.set("height",String(Z));if(Q)J.set("format",Q);let G=$.includes("?")?"&":"?";return`${$}${G}${J.toString()}`}return $}function zq($,Y,Z="#e5e7eb"){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Y}"><rect width="100%" height="100%" fill="${Z}"/></svg>`;return`data:image/svg+xml;base64,${btoa(X)}`}var Wq,h4,u4;var l4=S(()=>{Wq={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},h4=[320,640,768,1024,1280,1536,1920];u4={name:"StxImage",aliases:["stx-image","stx-img"],render($,Y,Z){let X=A0($,"src")||"",Q=A0($,"alt")||"",J=A0($,"width"),G=A0($,"height"),K=A0($,"sizes"),q=A0($,"srcset"),_=A0($,"densities"),U=A0($,"format"),W=A0($,"placeholder"),B=A0($,"placeholderColor")||"#e5e7eb",j=A0($,"provider"),z=A0($,"class")||A0($,"className")||"",O=A0($,"style")||"",L=A0($,"quality"),F=d4($,"lazy",!0),H=d4($,"preload",!1),V=d4($,"picture",!1)||!!U,N=J?Number.parseInt(J):void 0,R=G?Number.parseInt(G):void 0,A=q||"",w="";if(!A&&K)A=m4(X,h4,j,U),w=f8(K);else if(!A&&_){let y=_.split(/\s+/).map((b)=>Number.parseFloat(b.replace("x","")));A=Bq(X,y,N,j,U)}else if(K)w=f8(K);let T=[];if(O)T.push(O);if(N&&R)T.push(`aspect-ratio:${N}/${R}`);if(W==="blur"||W==="color"){let y=zq(N||16,R||9,B);T.push(`background-image:url(${y})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(W&&W!=="empty"&&W!=="none")T.push(`background-image:url(${U0(W)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let I=q5(X,N,R,j,U),M=[];if(M.push(`src="${U0(I)}"`),M.push(`alt="${U0(Q)}"`),J)M.push(`width="${U0(J)}"`);if(G)M.push(`height="${U0(G)}"`);if(F)M.push('loading="lazy"');if(M.push('decoding="async"'),z)M.push(`class="${U0(z)}"`);if(T.length>0)M.push(`style="${U0(T.join(";"))}"`);if(A)M.push(`srcset="${U0(A)}"`);if(w)M.push(`sizes="${U0(w)}"`);let E=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);for(let[y,b]of Object.entries($.static)){if(E.has(y))continue;if(typeof b==="boolean"){if(b)M.push(U0(y))}else M.push(`${U0(y)}="${U0(b)}"`)}let D=`<img ${M.join(" ")} />`,P="";if(H){let b=U==="webp"?"image/webp":U==="avif"?"image/avif":"";P=`<link rel="preload" as="image" href="${U0(I)}"${b?` type="${b}"`:""}${A?` imagesrcset="${U0(A)}"`:""}${w?` imagesizes="${U0(w)}"`:""} />
7853
+ `}if(V){let y=[];if(U==="avif"||U==="auto"){let b=q5(X,N,R,j,"avif"),k=A?m4(X,h4,j,"avif"):`${b}`;y.push(`<source type="image/avif" srcset="${U0(k)}"${w?` sizes="${U0(w)}"`:""} />`)}if(U==="webp"||U==="auto"){let b=q5(X,N,R,j,"webp"),k=A?m4(X,h4,j,"webp"):`${b}`;y.push(`<source type="image/webp" srcset="${U0(k)}"${w?` sizes="${U0(w)}"`:""} />`)}return`${P}<picture>
7849
7854
  ${y.join(`
7850
7855
  `)}
7851
7856
  ${D}
7852
- </picture>`}return`${P}${D}`}}});function p4($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function U5($,Y){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let Z=$.static[Y];if(typeof Z==="string")return Z;return}function I9($,Y,Z){let X=U5($,Y);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Z}var c4;var i4=b(()=>{c4={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Y,Z){let X=p4(U5($,"color")||"#6366f1"),Q=p4(U5($,"initialColor")||U5($,"initial-color")||""),J=p4(U5($,"height")||"3px"),G=I9($,"duration",2000),K=I9($,"throttle",200),q=I9($,"zIndex",999999)||I9($,"z-index",999999),_=Q?`linear-gradient(to right, ${Q}, ${X})`:X;return`
7857
+ </picture>`}return`${P}${D}`}}});function p4($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function U5($,Y){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let Z=$.static[Y];if(typeof Z==="string")return Z;return}function I9($,Y,Z){let X=U5($,Y);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Z}var c4;var i4=S(()=>{c4={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Y,Z){let X=p4(U5($,"color")||"#6366f1"),Q=p4(U5($,"initialColor")||U5($,"initial-color")||""),J=p4(U5($,"height")||"3px"),G=I9($,"duration",2000),K=I9($,"throttle",200),q=I9($,"zIndex",999999)||I9($,"z-index",999999),_=Q?`linear-gradient(to right, ${Q}, ${X})`:X;return`
7853
7858
  <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${J};background:${_};z-index:${q};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
7854
7859
  <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>
7855
7860
  </div>
7856
7861
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
7857
7862
  <script>
7858
7863
  (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()})})();
7859
- </script>`}}});function g8($,Y){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let Z=$.static[Y];if(typeof Z==="string")return Z;return}function _q($,Y,Z){let X=g8($,Y);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Z}var f8,n4;var o4=b(()=>{f8={"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%)"},n4={name:"StxToast",aliases:["stx-toast"],render($,Y,Z){let X=g8($,"position")||"top-right",Q=_q($,"max",5),J=f8[X]||f8["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>
7864
+ </script>`}}});function h8($,Y){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let Z=$.static[Y];if(typeof Z==="string")return Z;return}function jq($,Y,Z){let X=h8($,Y);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Z}var g8,n4;var o4=S(()=>{g8={"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%)"},n4={name:"StxToast",aliases:["stx-toast"],render($,Y,Z){let X=h8($,"position")||"top-right",Q=jq($,"max",5),J=g8[X]||g8["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>
7860
7865
  <style>
7861
7866
  @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
7862
7867
  @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
@@ -7864,7 +7869,7 @@ ${D}
7864
7869
  @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
7865
7870
  @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
7866
7871
  @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
7867
- </style>`}}});function E9($,Y){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let Z=$.static[Y];if(typeof Z==="string")return Z;return}var h8,s4;var r4=b(()=>{h8={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)"},s4={name:"StxModal",aliases:["stx-modal"],render($,Y,Z){let X=E9($,"id");if(!X)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Q=E9($,"size")||"md",J=E9($,"closeOnBackdrop")!=="false",G=E9($,"closeOnEscape")!=="false",K=h8[Q]||h8.md;return`<div id="stx-modal-${X}" class="stx-modal-backdrop" data-stx-modal="${X}" data-close-backdrop="${J}" data-close-escape="${G}" 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">
7872
+ </style>`}}});function E9($,Y){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let Z=$.static[Y];if(typeof Z==="string")return Z;return}var d8,s4;var r4=S(()=>{d8={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)"},s4={name:"StxModal",aliases:["stx-modal"],render($,Y,Z){let X=E9($,"id");if(!X)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Q=E9($,"size")||"md",J=E9($,"closeOnBackdrop")!=="false",G=E9($,"closeOnEscape")!=="false",K=d8[Q]||d8.md;return`<div id="stx-modal-${X}" class="stx-modal-backdrop" data-stx-modal="${X}" data-close-backdrop="${J}" data-close-escape="${G}" 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">
7868
7873
  <div class="stx-modal-panel" style="${K};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)">
7869
7874
  <div style="padding:1.5rem">${Y}</div>
7870
7875
  </div>
@@ -7873,7 +7878,7 @@ ${D}
7873
7878
  @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
7874
7879
  .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
7875
7880
  .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
7876
- </style>`}}});function b1($,Y){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let Z=$.static[Y];if(typeof Z==="string")return Z;return}var d8,a4;var t4=b(()=>{d8={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},a4={name:"StxDrawer",aliases:["stx-drawer"],render($,Y,Z){let X=b1($,"id");if(!X)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Q=b1($,"side")||"right",J=b1($,"size")||"md",G=b1($,"closeOnBackdrop")!=="false",K=b1($,"closeOnEscape")!=="false",q=b1($,"overlay")!=="false",_=d8[J]||d8.md,U=Q==="left",W=U?"left:0":"right:0",B=U?"translateX(-100%)":"translateX(100%)",j=U?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${X}" class="stx-drawer-backdrop" data-stx-drawer="${X}" data-close-backdrop="${G}" data-close-escape="${K}" style="display:none;position:fixed;inset:0;z-index:99999;${q?"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">
7881
+ </style>`}}});function y1($,Y){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let Z=$.static[Y];if(typeof Z==="string")return Z;return}var m8,a4;var t4=S(()=>{m8={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},a4={name:"StxDrawer",aliases:["stx-drawer"],render($,Y,Z){let X=y1($,"id");if(!X)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Q=y1($,"side")||"right",J=y1($,"size")||"md",G=y1($,"closeOnBackdrop")!=="false",K=y1($,"closeOnEscape")!=="false",q=y1($,"overlay")!=="false",_=m8[J]||m8.md,U=Q==="left",W=U?"left:0":"right:0",B=U?"translateX(-100%)":"translateX(100%)",j=U?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${X}" class="stx-drawer-backdrop" data-stx-drawer="${X}" data-close-backdrop="${G}" data-close-escape="${K}" style="display:none;position:fixed;inset:0;z-index:99999;${q?"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">
7877
7882
  <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${W};width:${_};max-width:100vw;transform:${B};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">
7878
7883
  <div style="padding:1.5rem">${Y}</div>
7879
7884
  </div>
@@ -7882,24 +7887,24 @@ ${D}
7882
7887
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
7883
7888
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
7884
7889
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
7885
- </style>`}}});async function Wq($){if(_5.has($))return _5.get($);try{let Y=$0.resolve(`@iconify/json/json/${$}.json`),Z=await Bun.file(Y).json();return _5.set($,Z.icons),Z.icons}catch{try{let Z=`${process.cwd()}/node_modules/@iconify/json/json/${$}.json`,X=Bun.file(Z);if(await X.exists()){let Q=await X.json();return _5.set($,Q.icons),Q.icons}}catch{}}return null}function y1($,Y){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);if($.static[Y]!==void 0)return String($.static[Y]);if($.clientReactive[Y]!==void 0)return $.clientReactive[Y];return}var _5,e4;var $7=b(()=>{_5=new Map;e4={name:"Icon",aliases:["icon","stx-icon"],render($,Y,Z){let X=y1($,"name")??y1($,"icon");if(!X)return"<!-- Icon: missing name/icon prop -->";let Q="lucide",J=X;if(X.includes(":")){let H=X.split(":");Q=H[0],J=H[1]}let G=y1($,"size")||"24",K=y1($,"color")||"currentColor",q=y1($,"class")||"",_=y1($,"style")||"",U=_5.get(Q);if(!U)return Wq(Q),`<!-- Icon: collection "${Q}" not loaded -->`;let W=U[J];if(!W)return`<!-- Icon: "${J}" not found in ${Q} -->`;let B=W.width||24,j=W.height||24,z=`0 0 ${B} ${j}`,O=W.body;if(K!=="currentColor")O=O.replace(/currentColor/g,K);let L=q?` class="${q}"`:"",F=_?` style="${_}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${z}" fill="none"${L}${F}>${O}</svg>`}}});function m8(){x0.registerBuiltin(f4),x0.registerBuiltin(u4),x0.registerBuiltin(c4),x0.registerBuiltin(n4),x0.registerBuiltin(s4),x0.registerBuiltin(a4),x0.registerBuiltin(e4)}var u8=b(()=>{g4();l4();i4();o4();r4();t4();$7();x4();g4();l4();i4();o4();r4();t4();$7()});function l8($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function p8($,Y,Z){let X=[],Q=0;while(Q<$.length){let J=$.indexOf("<",Q);if(J===-1)break;let K=$.slice(J+1).match(new RegExp(`^(${Y.source})`));if(!K){Q=J+1;continue}let q=K[1];if(Z&&Z.has(q.toLowerCase())){let O=J+1+q.length;while(O<$.length&&$[O]!==">")O++;Q=O+1;continue}let _=J+1+q.length,U=null,W=_,B=-1,j=!1;while(_<$.length){let O=$[_];if(U){if(O==="\\"&&_+1<$.length){_+=2;continue}if(O===U)U=null;_++;continue}if(O==='"'||O==="'"){U=O,_++;continue}if(O==="/"&&_+1<$.length&&$[_+1]===">"){B=_+2,j=!0;break}if(O===">"){B=_+1;break}_++}if(B===-1){Q=J+1;continue}let z=$.slice(W,j?B-2:B-1).trim();if(j)X.push({fullMatch:$.slice(J,B),tagName:q,attributes:z,content:"",startIndex:J,endIndex:B,isSelfClosing:!0}),Q=B;else{let O=`<${q}`,L=`</${q}>`,F=1,H=B,V=-1;while(F>0&&H<$.length){let A=$.indexOf(O,H),w=$.indexOf(L,H);if(w===-1)break;if(A!==-1&&A<w){let T=$[A+O.length];if(T===" "||T===">"||T==="/"||T===`
7886
- `||T==="\t")F++;H=A+O.length}else{if(F--,F===0){V=w;break}H=w+L.length}}if(V===-1){Q=B;continue}let N=$.slice(B,V),R=V+L.length;X.push({fullMatch:$.slice(J,R),tagName:q,attributes:z,content:N,startIndex:J,endIndex:R,isSelfClosing:!1}),Q=R}}return X}var c8=b(()=>{V0();H0()});import P1 from"path";function zq($,Y,Z){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 _=J(q.slice(6));try{let U=K.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");X.serverDynamic[_]=JSON.parse(U)}catch(U){if(Z.debug)console.error(`Error parsing __stx_${_}:`,U);X.serverDynamic[_]=K}continue}if(q.startsWith(":")){let _=J(q.slice(1)),U=K==="true"?_:K;try{if(!e(U)){if(Z.debug)console.error(`Unsafe expression in :${_} binding: ${U}`);X.clientReactive[_]=U;continue}let W=Object.keys(Y),j=Y0(U,W)(...Object.values(Y));if(j===void 0){let z=U.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],O=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(z.some((F)=>!O.has(F)&&!W.includes(F))){X.clientReactive[_]=U;continue}}X.serverDynamic[_]=j}catch{X.clientReactive[_]=U}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let _=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(_)try{let U=_[1];if(e(U)){let B=Y0(U,Object.keys(Y))(...Object.values(Y));X.static[q]=B!=null?String(B):""}else{if(Z.debug)console.error(`Unsafe expression in ${q}: ${U}`);X.static[q]=K}}catch(U){if(Z.debug)console.error(`Error evaluating expression for ${q}:`,U);X.static[q]=K}else{let U=K,W=/\{\{\s*([\s\S]+?)\s*\}\}/g,B;while((B=W.exec(K))!==null)try{let j=B[1];if(!e(j)){if(Z.debug)console.error(`Unsafe expression in ${q}: ${j}`);continue}let O=Y0(j,Object.keys(Y))(...Object.values(Y));U=U.replace(B[0],String(O??""))}catch(j){if(Z.debug)console.error(`Error evaluating expression in ${q}:`,j)}X.static[q]=U}continue}X.static[q]=K}return X}function jq($){let Y={},Z=0,X=$.length;while(Z<X){while(Z<X&&/\s/.test($[Z]))Z++;if(Z>=X)break;let Q="";while(Z<X&&!/[\s=]/.test($[Z]))Q+=$[Z],Z++;if(!Q)break;while(Z<X&&/\s/.test($[Z]))Z++;if(Z<X&&$[Z]==="="){Z++;while(Z<X&&/\s/.test($[Z]))Z++;let J="";if(Z<X&&($[Z]==='"'||$[Z]==="'")){let G=$[Z];Z++;while(Z<X){let K=$[Z];if(K==="\\"&&Z+1<X){Z++,J+=$[Z],Z++;continue}if(K===G){Z++;break}J+=K,Z++}}else while(Z<X&&!/\s/.test($[Z]))J+=$[Z],Z++;Y[Q]=J}else Y[Q]="true"}return Y}async function Oq($,Y,Z,X,Q){let J=$;if(!Y.__importedComponents)Y.__importedComponents=new Map;let G=Y.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(J))!==null){let[_,U]=q,W=U.split(",").map((B)=>B.trim().replace(/^['"]|['"]$/g,"")).filter((B)=>B.length>0);for(let B of W){let j=B.split("/"),O=j[j.length-1].replace(/\.stx$/,""),L=O.includes("-")?O.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):O.charAt(0).toUpperCase()+O.slice(1),F=null,H=[P1.resolve(P1.dirname(Z),`${B}.stx`),P1.resolve(P1.dirname(Z),B),P1.resolve(X.componentsDir||"components",`${B}.stx`),P1.resolve(X.componentsDir||"components",B),B.endsWith(".stx")?B:`${B}.stx`];for(let V of H)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(L,F),G.set(O,F),G.set(O.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(_,""),K.lastIndex=0}return J}async function Hq($,Y,Z,X,Q){let J=$,G=X.componentsDir||"components";if(!Y.__processedComponents)Y.__processedComponents=new Set;let K=Y.__processedComponents,q=/@component\s*\(/g,_;while((_=q.exec(J))!==null){let U=_.index,W=U+_[0].length-1,B=1,j=W+1;while(j<J.length&&B>0){if(J[j]==="(")B++;else if(J[j]===")"){if(B--,B===0)break}j++}if(B!==0)break;let z=J.substring(W+1,j),O=j+1,L=z.match(/^\s*['"]([^'"]+)['"]/);if(!L){q.lastIndex=0;continue}let F=L[1],H,V=z.slice(L[0].length),N=V.match(/^\s*,\s*/);if(N)H=V.slice(N[0].length).trim();let R={};if(H)try{R=z0(H,Y)}catch(E){let D=E instanceof Error?E.message:String(E);J=J.replace(J.substring(U,O),`[Error parsing component props: ${D}]`);continue}let A="",w=O,I=J.substring(O).match(/^([\s\S]*?)@endcomponent/);if(I)A=I[1].trim(),w=O+I[0].length;let M=await q1(F,R,A,G,Y,Z,X,K,Q);J=J.substring(0,U)+M+J.substring(w),q.lastIndex=0}return J}async function Lq($,Y,Z,X,Q){if(!$)return $;let J=$,G=X.componentsDir||"components";if(!Y.__processedComponents)Y.__processedComponents=new Set;let K=Y.__processedComponents;return J=await W(J,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),J=await W(J,/[A-Z][a-zA-Z0-9]*/,!0),J=await W(J,/[a-z][a-z0-9]*/,!1,Bq),J;async function W(B,j,z,O){if(!B)return B;let L=B,F=p8(L,j,O);for(let H=F.length-1;H>=0;H--){let V=F[H],N=z?l8(V.tagName):V.tagName,R=jq(V.attributes),A=zq(R,Y,X),w=x0.getBuiltin(V.tagName);if(w){let E={context:Y,filePath:Z,options:X,dependencies:Q},D=w.render(A,V.content,E);if(Object.keys(A.clientReactive).length>0)D=n8(D,A.clientReactive);if(Object.keys(A.events).length>0){let P=Object.entries(A.events).map(([y,S])=>`${y}="${S.replace(/"/g,"&quot;")}"`).join(" ");D=D.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${P}`)}L=L.substring(0,V.startIndex)+D+L.substring(V.endIndex);continue}let T={};for(let[E,D]of Object.entries(A.static))T[E]=D;for(let[E,D]of Object.entries(A.serverDynamic))T[E]=D;let M=await q1(N,T,V.content,G,Y,Z,X,K,Q);if(Object.keys(A.clientReactive).length>0)M=n8(M,A.clientReactive);if(Object.keys(A.events).length>0){let E=M.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(E){let D=Object.entries(A.events).map(([y,S])=>`${y}="${S}"`).join(" "),P=E[1].length+E[2].length;M=M.substring(0,P)+" "+D+M.substring(P)}}L=L.substring(0,V.startIndex)+M+L.substring(V.endIndex)}return L}}function n8($,Y){let Z=$.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(!Z)return $;let X=Object.entries(Y).map(([J,G])=>`:${J}="${G.replace(/"/g,"&quot;")}"`).join(" "),Q=Z[1].length+Z[2].length;return $.substring(0,Q)+" "+X+$.substring(Q)}async function Y7($,Y,Z,X,Q){if(!i8)m8(),i8=!0;let J=await Oq($,Y,Z,X,Q);J=await Hq(J,Y,Z,X,Q);for(let G=0;G<3;G++){let K=J;if(J=await Lq(J,Y,Z,X,Q),J===K)break}return J}var i8=!1,Bq;var o8=b(()=>{x4();u8();c8();H0();V0();Bq=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"])});import C1 from"path";function s8($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}function r8($,Y,Z){try{let X;if($.startsWith("/")){let Q=Y;for(let J=0;J<5;J++){let G=C1.join(Q,$);if($0("fs").existsSync(G))return G;Q=C1.dirname(Q)}X=C1.join(Y,$)}else if($.startsWith("./")||$.startsWith("../"))X=C1.resolve(Y,$);else X=C1.resolve(Y,$);if($0("fs").existsSync(X))return X;return null}catch{return null}}async function a8($,Y,Z){let X=$,Q=C1.dirname(Y),J=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=J.exec(X))!==null){let[_,U,W,B]=G;if(s8(W))continue;let j=r8(W,Q,Y);if(j)try{let z=await Bun.file(j).text();if(Z.add(j),W.endsWith(".ts")||W.endsWith(".tsx")){let L=await Bun.build({entrypoints:[j],target:"browser",minify:!1,define:P0()});if(L.outputs.length>0)z=await L.outputs[0].text()}let O=`<script>
7890
+ </style>`}}});async function Oq($){if(_5.has($))return _5.get($);try{let Y=$0.resolve(`@iconify/json/json/${$}.json`),Z=await Bun.file(Y).json();return _5.set($,Z.icons),Z.icons}catch{try{let Z=`${process.cwd()}/node_modules/@iconify/json/json/${$}.json`,X=Bun.file(Z);if(await X.exists()){let Q=await X.json();return _5.set($,Q.icons),Q.icons}}catch{}}return null}function P1($,Y){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);if($.static[Y]!==void 0)return String($.static[Y]);if($.clientReactive[Y]!==void 0)return $.clientReactive[Y];return}var _5,e4;var $7=S(()=>{_5=new Map;e4={name:"Icon",aliases:["icon","stx-icon"],render($,Y,Z){let X=P1($,"name")??P1($,"icon");if(!X)return"<!-- Icon: missing name/icon prop -->";let Q="lucide",J=X;if(X.includes(":")){let H=X.split(":");Q=H[0],J=H[1]}let G=P1($,"size")||"24",K=P1($,"color")||"currentColor",q=P1($,"class")||"",_=P1($,"style")||"",U=_5.get(Q);if(!U)return Oq(Q),`<!-- Icon: collection "${Q}" not loaded -->`;let W=U[J];if(!W)return`<!-- Icon: "${J}" not found in ${Q} -->`;let B=W.width||24,j=W.height||24,z=`0 0 ${B} ${j}`,O=W.body;if(K!=="currentColor")O=O.replace(/currentColor/g,K);let L=q?` class="${q}"`:"",F=_?` style="${_}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${z}" fill="none"${L}${F}>${O}</svg>`}}});function u8(){x0.registerBuiltin(f4),x0.registerBuiltin(u4),x0.registerBuiltin(c4),x0.registerBuiltin(n4),x0.registerBuiltin(s4),x0.registerBuiltin(a4),x0.registerBuiltin(e4)}var l8=S(()=>{g4();l4();i4();o4();r4();t4();$7();x4();g4();l4();i4();o4();r4();t4();$7()});function p8($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function c8($,Y,Z){let X=[],Q=0;while(Q<$.length){let J=$.indexOf("<",Q);if(J===-1)break;let K=$.slice(J+1).match(new RegExp(`^(${Y.source})`));if(!K){Q=J+1;continue}let q=K[1];if(Z&&Z.has(q.toLowerCase())){let O=J+1+q.length;while(O<$.length&&$[O]!==">")O++;Q=O+1;continue}let _=J+1+q.length,U=null,W=_,B=-1,j=!1;while(_<$.length){let O=$[_];if(U){if(O==="\\"&&_+1<$.length){_+=2;continue}if(O===U)U=null;_++;continue}if(O==='"'||O==="'"){U=O,_++;continue}if(O==="/"&&_+1<$.length&&$[_+1]===">"){B=_+2,j=!0;break}if(O===">"){B=_+1;break}_++}if(B===-1){Q=J+1;continue}let z=$.slice(W,j?B-2:B-1).trim();if(j)X.push({fullMatch:$.slice(J,B),tagName:q,attributes:z,content:"",startIndex:J,endIndex:B,isSelfClosing:!0}),Q=B;else{let O=`<${q}`,L=`</${q}>`,F=1,H=B,V=-1;while(F>0&&H<$.length){let A=$.indexOf(O,H),w=$.indexOf(L,H);if(w===-1)break;if(A!==-1&&A<w){let T=$[A+O.length];if(T===" "||T===">"||T==="/"||T===`
7891
+ `||T==="\t")F++;H=A+O.length}else{if(F--,F===0){V=w;break}H=w+L.length}}if(V===-1){Q=B;continue}let N=$.slice(B,V),R=V+L.length;X.push({fullMatch:$.slice(J,R),tagName:q,attributes:z,content:N,startIndex:J,endIndex:R,isSelfClosing:!1}),Q=R}}return X}var i8=S(()=>{V0();H0()});import C1 from"path";function Lq($,Y,Z){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 _=J(q.slice(6));try{let U=K.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");X.serverDynamic[_]=JSON.parse(U)}catch(U){if(Z.debug)console.error(`Error parsing __stx_${_}:`,U);X.serverDynamic[_]=K}continue}if(q.startsWith(":")){let _=J(q.slice(1)),U=K==="true"?_:K;try{if(!e(U)){if(Z.debug)console.error(`Unsafe expression in :${_} binding: ${U}`);X.clientReactive[_]=U;continue}let W=Object.keys(Y),j=Y0(U,W)(...Object.values(Y));if(j===void 0){let z=U.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],O=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(z.some((F)=>!O.has(F)&&!W.includes(F))){X.clientReactive[_]=U;continue}}X.serverDynamic[_]=j}catch{X.clientReactive[_]=U}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let _=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(_)try{let U=_[1];if(e(U)){let B=Y0(U,Object.keys(Y))(...Object.values(Y));X.static[q]=B!=null?String(B):""}else{if(Z.debug)console.error(`Unsafe expression in ${q}: ${U}`);X.static[q]=K}}catch(U){if(Z.debug)console.error(`Error evaluating expression for ${q}:`,U);X.static[q]=K}else{let U=K,W=/\{\{\s*([\s\S]+?)\s*\}\}/g,B;while((B=W.exec(K))!==null)try{let j=B[1];if(!e(j)){if(Z.debug)console.error(`Unsafe expression in ${q}: ${j}`);continue}let O=Y0(j,Object.keys(Y))(...Object.values(Y));U=U.replace(B[0],String(O??""))}catch(j){if(Z.debug)console.error(`Error evaluating expression in ${q}:`,j)}X.static[q]=U}continue}X.static[q]=K}return X}function Fq($){let Y={},Z=0,X=$.length;while(Z<X){while(Z<X&&/\s/.test($[Z]))Z++;if(Z>=X)break;let Q="";while(Z<X&&!/[\s=]/.test($[Z]))Q+=$[Z],Z++;if(!Q)break;while(Z<X&&/\s/.test($[Z]))Z++;if(Z<X&&$[Z]==="="){Z++;while(Z<X&&/\s/.test($[Z]))Z++;let J="";if(Z<X&&($[Z]==='"'||$[Z]==="'")){let G=$[Z];Z++;while(Z<X){let K=$[Z];if(K==="\\"&&Z+1<X){Z++,J+=$[Z],Z++;continue}if(K===G){Z++;break}J+=K,Z++}}else while(Z<X&&!/\s/.test($[Z]))J+=$[Z],Z++;Y[Q]=J}else Y[Q]="true"}return Y}async function Vq($,Y,Z,X,Q){let J=$;if(!Y.__importedComponents)Y.__importedComponents=new Map;let G=Y.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(J))!==null){let[_,U]=q,W=U.split(",").map((B)=>B.trim().replace(/^['"]|['"]$/g,"")).filter((B)=>B.length>0);for(let B of W){let j=B.split("/"),O=j[j.length-1].replace(/\.stx$/,""),L=O.includes("-")?O.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):O.charAt(0).toUpperCase()+O.slice(1),F=null,H=[C1.resolve(C1.dirname(Z),`${B}.stx`),C1.resolve(C1.dirname(Z),B),C1.resolve(X.componentsDir||"components",`${B}.stx`),C1.resolve(X.componentsDir||"components",B),B.endsWith(".stx")?B:`${B}.stx`];for(let V of H)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(L,F),G.set(O,F),G.set(O.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(_,""),K.lastIndex=0}return J}async function Rq($,Y,Z,X,Q){let J=$,G=X.componentsDir||"components";if(!Y.__processedComponents)Y.__processedComponents=new Set;let K=Y.__processedComponents,q=/@component\s*\(/g,_;while((_=q.exec(J))!==null){let U=_.index,W=U+_[0].length-1,B=1,j=W+1;while(j<J.length&&B>0){if(J[j]==="(")B++;else if(J[j]===")"){if(B--,B===0)break}j++}if(B!==0)break;let z=J.substring(W+1,j),O=j+1,L=z.match(/^\s*['"]([^'"]+)['"]/);if(!L){q.lastIndex=0;continue}let F=L[1],H,V=z.slice(L[0].length),N=V.match(/^\s*,\s*/);if(N)H=V.slice(N[0].length).trim();let R={};if(H)try{R=z0(H,Y)}catch(E){let D=E instanceof Error?E.message:String(E);J=J.replace(J.substring(U,O),`[Error parsing component props: ${D}]`);continue}let A="",w=O,I=J.substring(O).match(/^([\s\S]*?)@endcomponent/);if(I)A=I[1].trim(),w=O+I[0].length;let M=await q1(F,R,A,G,Y,Z,X,K,Q);J=J.substring(0,U)+M+J.substring(w),q.lastIndex=0}return J}async function Nq($,Y,Z,X,Q){if(!$)return $;let J=$,G=X.componentsDir||"components";if(!Y.__processedComponents)Y.__processedComponents=new Set;let K=Y.__processedComponents;return J=await W(J,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),J=await W(J,/[A-Z][a-zA-Z0-9]*/,!0),J=await W(J,/[a-z][a-z0-9]*/,!1,Hq),J;async function W(B,j,z,O){if(!B)return B;let L=B,F=c8(L,j,O);for(let H=F.length-1;H>=0;H--){let V=F[H],N=z?p8(V.tagName):V.tagName,R=Fq(V.attributes),A=Lq(R,Y,X),w=x0.getBuiltin(V.tagName);if(w){let E={context:Y,filePath:Z,options:X,dependencies:Q},D=w.render(A,V.content,E);if(Object.keys(A.clientReactive).length>0)D=o8(D,A.clientReactive);if(Object.keys(A.events).length>0){let P=Object.entries(A.events).map(([y,b])=>`${y}="${b.replace(/"/g,"&quot;")}"`).join(" ");D=D.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${P}`)}L=L.substring(0,V.startIndex)+D+L.substring(V.endIndex);continue}let T={};for(let[E,D]of Object.entries(A.static))T[E]=D;for(let[E,D]of Object.entries(A.serverDynamic))T[E]=D;let M=await q1(N,T,V.content,G,Y,Z,X,K,Q);if(Object.keys(A.clientReactive).length>0)M=o8(M,A.clientReactive);if(Object.keys(A.events).length>0){let E=M.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(E){let D=Object.entries(A.events).map(([y,b])=>`${y}="${b}"`).join(" "),P=E[1].length+E[2].length;M=M.substring(0,P)+" "+D+M.substring(P)}}L=L.substring(0,V.startIndex)+M+L.substring(V.endIndex)}return L}}function o8($,Y){let Z=$.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(!Z)return $;let X=Object.entries(Y).map(([J,G])=>`:${J}="${G.replace(/"/g,"&quot;")}"`).join(" "),Q=Z[1].length+Z[2].length;return $.substring(0,Q)+" "+X+$.substring(Q)}async function Y7($,Y,Z,X,Q){if(!n8)u8(),n8=!0;let J=await Vq($,Y,Z,X,Q);J=await Rq(J,Y,Z,X,Q);for(let G=0;G<3;G++){let K=J;if(J=await Nq(J,Y,Z,X,Q),J===K)break}return J}var n8=!1,Hq;var s8=S(()=>{x4();l8();i8();H0();V0();Hq=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"])});import v1 from"path";function r8($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}function a8($,Y,Z){try{let X;if($.startsWith("/")){let Q=Y;for(let J=0;J<5;J++){let G=v1.join(Q,$);if($0("fs").existsSync(G))return G;Q=v1.dirname(Q)}X=v1.join(Y,$)}else if($.startsWith("./")||$.startsWith("../"))X=v1.resolve(Y,$);else X=v1.resolve(Y,$);if($0("fs").existsSync(X))return X;return null}catch{return null}}async function t8($,Y,Z){let X=$,Q=v1.dirname(Y),J=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=J.exec(X))!==null){let[_,U,W,B]=G;if(r8(W))continue;let j=a8(W,Q,Y);if(j)try{let z=await Bun.file(j).text();if(Z.add(j),W.endsWith(".ts")||W.endsWith(".tsx")){let L=await Bun.build({entrypoints:[j],target:"browser",minify:!1,define:P0()});if(L.outputs.length>0)z=await L.outputs[0].text()}let O=`<script>
7887
7892
  // Source: ${W}
7888
7893
  ${z}
7889
- </script>`;X=X.replace(_,O),J.lastIndex=0}catch(z){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(X))!==null){let[_,U,W,B]=q,j=U+B;if(s8(W))continue;if(/rel=["']stylesheet["']/.test(j)||W.endsWith(".css")){let O=r8(W,Q,Y);if(O)try{let L=await Bun.file(O).text();Z.add(O);let F=`<style>
7894
+ </script>`;X=X.replace(_,O),J.lastIndex=0}catch(z){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(X))!==null){let[_,U,W,B]=q,j=U+B;if(r8(W))continue;if(/rel=["']stylesheet["']/.test(j)||W.endsWith(".css")){let O=a8(W,Q,Y);if(O)try{let L=await Bun.file(O).text();Z.add(O);let F=`<style>
7890
7895
  /* Source: ${W} */
7891
7896
  ${L}
7892
- </style>`;X=X.replace(_,F),K.lastIndex=0}catch(L){}}}return X}var t8=b(()=>{R1()});function D9($,Y){let Z=$,X=/@json\s*\(/g,Q;while((Q=X.exec(Z))!==null){let J=Q.index,G=J+Q[0].length-1,K=1,q=G+1,_=null,U=!1;while(q<Z.length&&K>0){let V=Z[q];if(U){U=!1,q++;continue}if(V==="\\"&&_){U=!0,q++;continue}if(_){if(V===_)_=null;q++;continue}if(V==='"'||V==="'"||V==="`"){_=V,q++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}q++}if(K!==0)break;let W=Z.substring(G+1,q).trim(),B=Z.substring(J,q+1),j=-1,z=0,O=null,L=!1;for(let V=0;V<W.length;V++){let N=W[V];if(L){L=!1;continue}if(N==="\\"&&O){L=!0;continue}if(O){if(N===O)O=null;continue}if(N==='"'||N==="'"||N==="`"){O=N;continue}if(N==="("||N==="["||N==="{")z++;else if(N===")"||N==="]"||N==="}")z--;if(N===","&&z===0){j=V;break}}let F=j>=0?W.substring(0,j).trim():W,H=j>=0?W.substring(j+1).trim():void 0;try{let V=F.trim(),N;if(e(V))N=Y0(V,Object.keys(Y))(...Object.values(Y));else N=void 0;let R;if(H==="true")R=JSON.stringify(N,null,2);else R=JSON.stringify(N);let A=R.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Z=Z.substring(0,J)+A+Z.substring(q+1),X.lastIndex=J+A.length}catch(V){b0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),X.lastIndex=J+B.length}}return Z}function k9($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function e8($){let Y=$,Z=/@memo\s*\(/g,X,Q=[];while((X=Z.exec(Y))!==null){let J=X.index,G=J+X[0].length,K=1,q=G;while(q<Y.length&&K>0){if(Y[q]==="(")K++;else if(Y[q]===")")K--;q++}if(K!==0)continue;let _=Y.slice(G,q-1).trim(),U=q,W=Y.slice(U),B=W.indexOf("@endmemo");if(B===-1)continue;let j=W.slice(0,B),z=U+B+8,O=j.match(/^(\s*(?:<!--[\s\S]*?-->\s*)*)/),L=O?O[0].length:0,F=j.slice(L),H=j.match(/(\s*)$/),V=H?H[0].length:0,N=F.slice(0,F.length-V),R=N.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),A;if(R){let[w,T,I="",M]=R,E=`<${T}${I} data-stx-memo="${_}"${M}>`;A=j.slice(0,L)+E+N.slice(w.length)+j.slice(L+N.length)}else A=`${j.slice(0,L)}<div data-stx-memo="${_}">${N}</div>${j.slice(L+N.length)}`;Q.push({start:J,end:z,replacement:A}),Z.lastIndex=z}for(let J=Q.length-1;J>=0;J--){let G=Q[J];Y=Y.slice(0,G.start)+G.replacement+Y.slice(G.end)}return Y.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function Z7($){let Y=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Y=Y.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Y}function $Y($){let Z=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),X="",Q=0,J;while((J=Z.exec($))!==null){let G=J.index,K=G+J[0].length,q=!1,_=!1,U=-1;while(K<$.length){let O=$[K];if(q){if(O==="'")q=!1}else if(_){if(O==='"')_=!1}else if(O==="'")q=!0;else if(O==='"')_=!0;else if(O===">"){U=K;break}K++}if(U===-1)continue;if($.slice(G,U+1).includes("x-cloak"))continue;let B=$.slice(U+1),j=B.indexOf("</"),z=j>=0?B.slice(0,j):B.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(z))X+=$.slice(Q,U)+" x-cloak>",Q=U+1}return X+=$.slice(Q),X}var X7=b(()=>{u0();V0()});function S9($,Y,Z){let X=typeof Z==="boolean"?{enabled:Z,failOnViolation:Z}:Z??{enabled:!1},Q=X.allowPatterns??[],J=[];for(let{pattern:G,message:K,suggestion:q}of Fq){if(Q.some((U)=>K.includes(U)||G.source.includes(U)))continue;G.lastIndex=0;let _=$.match(G);if(_&&_.length>0){let U=$.split(`
7897
+ </style>`;X=X.replace(_,F),K.lastIndex=0}catch(L){}}}return X}var e8=S(()=>{N1()});function D9($,Y){let Z=$,X=/@json\s*\(/g,Q;while((Q=X.exec(Z))!==null){let J=Q.index,G=J+Q[0].length-1,K=1,q=G+1,_=null,U=!1;while(q<Z.length&&K>0){let V=Z[q];if(U){U=!1,q++;continue}if(V==="\\"&&_){U=!0,q++;continue}if(_){if(V===_)_=null;q++;continue}if(V==='"'||V==="'"||V==="`"){_=V,q++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}q++}if(K!==0)break;let W=Z.substring(G+1,q).trim(),B=Z.substring(J,q+1),j=-1,z=0,O=null,L=!1;for(let V=0;V<W.length;V++){let N=W[V];if(L){L=!1;continue}if(N==="\\"&&O){L=!0;continue}if(O){if(N===O)O=null;continue}if(N==='"'||N==="'"||N==="`"){O=N;continue}if(N==="("||N==="["||N==="{")z++;else if(N===")"||N==="]"||N==="}")z--;if(N===","&&z===0){j=V;break}}let F=j>=0?W.substring(0,j).trim():W,H=j>=0?W.substring(j+1).trim():void 0;try{let V=F.trim(),N;if(e(V))N=Y0(V,Object.keys(Y))(...Object.values(Y));else N=void 0;let R;if(H==="true")R=JSON.stringify(N,null,2);else R=JSON.stringify(N);let A=R.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Z=Z.substring(0,J)+A+Z.substring(q+1),X.lastIndex=J+A.length}catch(V){S0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),X.lastIndex=J+B.length}}return Z}function k9($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function $Y($){let Y=$,Z=/@memo\s*\(/g,X,Q=[];while((X=Z.exec(Y))!==null){let J=X.index,G=J+X[0].length,K=1,q=G;while(q<Y.length&&K>0){if(Y[q]==="(")K++;else if(Y[q]===")")K--;q++}if(K!==0)continue;let _=Y.slice(G,q-1).trim(),U=q,W=Y.slice(U),B=W.indexOf("@endmemo");if(B===-1)continue;let j=W.slice(0,B),z=U+B+8,O=j.match(/^(\s*(?:<!--[\s\S]*?-->\s*)*)/),L=O?O[0].length:0,F=j.slice(L),H=j.match(/(\s*)$/),V=H?H[0].length:0,N=F.slice(0,F.length-V),R=N.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),A;if(R){let[w,T,I="",M]=R,E=`<${T}${I} data-stx-memo="${_}"${M}>`;A=j.slice(0,L)+E+N.slice(w.length)+j.slice(L+N.length)}else A=`${j.slice(0,L)}<div data-stx-memo="${_}">${N}</div>${j.slice(L+N.length)}`;Q.push({start:J,end:z,replacement:A}),Z.lastIndex=z}for(let J=Q.length-1;J>=0;J--){let G=Q[J];Y=Y.slice(0,G.start)+G.replacement+Y.slice(G.end)}return Y.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function Z7($){let Y=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Y=Y.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Y}function YY($){let Z=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),X="",Q=0,J;while((J=Z.exec($))!==null){let G=J.index,K=G+J[0].length,q=!1,_=!1,U=-1;while(K<$.length){let O=$[K];if(q){if(O==="'")q=!1}else if(_){if(O==='"')_=!1}else if(O==="'")q=!0;else if(O==='"')_=!0;else if(O===">"){U=K;break}K++}if(U===-1)continue;if($.slice(G,U+1).includes("x-cloak"))continue;let B=$.slice(U+1),j=B.indexOf("</"),z=j>=0?B.slice(0,j):B.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(z))X+=$.slice(Q,U)+" x-cloak>",Q=U+1}return X+=$.slice(Q),X}var X7=S(()=>{u0();V0()});function b9($,Y,Z){let X=typeof Z==="boolean"?{enabled:Z,failOnViolation:Z}:Z??{enabled:!1},Q=X.allowPatterns??[],J=[];for(let{pattern:G,message:K,suggestion:q}of Aq){if(Q.some((U)=>K.includes(U)||G.source.includes(U)))continue;G.lastIndex=0;let _=$.match(G);if(_&&_.length>0){let U=$.split(`
7893
7898
  `),W=[];U.forEach((j,z)=>{if(G.lastIndex=0,G.test(j))W.push(z+1)});let B=W.length>0?` (line${W.length>1?"s":""}: ${W.join(", ")})`:"";J.push(` \u2717 ${K}${B}
7894
7899
  \u2192 ${q}`)}}if(J.length>0&&X.enabled){let K=`[STX] DOM API violation in ${Y.split("/").pop()||Y}:
7895
7900
  ${J.join(`
7896
7901
  `)}
7897
- Tip: prefer useRef(), navigate(), and composables for component code`;if(X.failOnViolation)throw Error(K);else console.warn(K)}}var Fq;var J7=b(()=>{Fq=[{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 YY={};r(YY,{getStoreScript:()=>Vq,clearStoreCache:()=>Rq});import b9 from"path";async function Vq($){let Y;if($)Y=b9.resolve($);else{let U=await Q9();Y=b9.resolve(U.root||process.cwd(),U.storesDir||"stores")}let Z=v1.get(Y);if(Z!==void 0)return Z||null;let X=new Bun.Glob("*.ts"),Q=[];try{for await(let U of X.scan({cwd:Y,absolute:!0})){let W=b9.basename(U,".ts");if(["index","types"].includes(W))continue;if(U.includes(".d.ts"))continue;Q.push(U)}}catch{return v1.set(Y,""),null}if(Q.length===0)return v1.set(Y,""),null;let J=[];for(let U of Q){let W=await Bun.file(U).text();J.push({file:U,hasUseStore:/useStore\s*\(/.test(W)})}J.sort((U,W)=>{if(U.hasUseStore===W.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:P0()});for(let U of G)try{let W=await Bun.file(U).text(),B=b9.basename(U,".ts");W=W.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),W=W.replace(/^export\s+(default\s+)?/gm,""),W=q.transformSync(W),K.push(`// Store: ${B}
7898
- ${W.trim()}`)}catch(W){console.warn(`[stx] Failed to load store ${U}:`,W)}if(K.length===0)return v1.set(Y,""),null;let _=`;(function(){
7902
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(X.failOnViolation)throw Error(K);else console.warn(K)}}var Aq;var J7=S(()=>{Aq=[{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 ZY={};r(ZY,{getStoreScript:()=>wq,clearStoreCache:()=>Tq});import S9 from"path";async function wq($){let Y;if($)Y=S9.resolve($);else{let U=await Q9();Y=S9.resolve(U.root||process.cwd(),U.storesDir||"stores")}let Z=x1.get(Y);if(Z!==void 0)return Z||null;let X=new Bun.Glob("*.ts"),Q=[];try{for await(let U of X.scan({cwd:Y,absolute:!0})){let W=S9.basename(U,".ts");if(["index","types"].includes(W))continue;if(U.includes(".d.ts"))continue;Q.push(U)}}catch{return x1.set(Y,""),null}if(Q.length===0)return x1.set(Y,""),null;let J=[];for(let U of Q){let W=await Bun.file(U).text();J.push({file:U,hasUseStore:/useStore\s*\(/.test(W)})}J.sort((U,W)=>{if(U.hasUseStore===W.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:P0()});for(let U of G)try{let W=await Bun.file(U).text(),B=S9.basename(U,".ts");W=W.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),W=W.replace(/^export\s+(default\s+)?/gm,""),W=q.transformSync(W),K.push(`// Store: ${B}
7903
+ ${W.trim()}`)}catch(W){console.warn(`[stx] Failed to load store ${U}:`,W)}if(K.length===0)return x1.set(Y,""),null;let _=`;(function(){
7899
7904
  ${K.join(`
7900
7905
 
7901
7906
  `)}
7902
- })();`;return v1.set(Y,_),_}function Rq(){v1.clear()}var v1;var ZY=b(()=>{G9();R1();v1=new Map});var JY={};r(JY,{processDeferDirectives:()=>Mq});function Nq(){return`stx-defer-${++XY}`}function Aq($){let Y=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Y)return{trigger:Y[1],value:Y[2]};return{trigger:"immediate"}}function wq($,Y,Z){let{trigger:X,value:Q}=Aq(Y),J=Z,G,K,q,_=Z.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(_)G=_[1].trim(),J=J.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let U=Z.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(U)K=U[1].trim(),J=J.replace(/@loading[\s\S]*?(?=@error|$)/,"");let W=Z.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(W)q=W[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 Tq($,Y){let{trigger:Z,triggerValue:X}=Y,Q;switch(Z){case"visible":Q=`
7907
+ })();`;return x1.set(Y,_),_}function Tq(){x1.clear()}var x1;var XY=S(()=>{G9();N1();x1=new Map});var QY={};r(QY,{processDeferDirectives:()=>kq});function Mq(){return`stx-defer-${++JY}`}function Iq($){let Y=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Y)return{trigger:Y[1],value:Y[2]};return{trigger:"immediate"}}function Eq($,Y,Z){let{trigger:X,value:Q}=Iq(Y),J=Z,G,K,q,_=Z.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(_)G=_[1].trim(),J=J.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let U=Z.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(U)K=U[1].trim(),J=J.replace(/@loading[\s\S]*?(?=@error|$)/,"");let W=Z.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(W)q=W[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 Dq($,Y){let{trigger:Z,triggerValue:X}=Y,Q;switch(Z){case"visible":Q=`
7903
7908
  const observer = new IntersectionObserver((entries) => {
7904
7909
  if (entries[0].isIntersecting) {
7905
7910
  observer.disconnect();
@@ -7972,7 +7977,7 @@ else {
7972
7977
  ${Q}
7973
7978
  })();
7974
7979
  </script>
7975
- `}function Mq($,Y,Z){XY=0;let X=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(X,(Q,J,G)=>{let K=Nq(),q=wq(Q,J,G),_=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>',W=q.error?`<div data-defer-error style="display: none;">${q.error}</div>`:"",B=`<div data-defer-content style="display: none;">${q.content}</div>`,j=Tq(K,q);return`
7980
+ `}function kq($,Y,Z){JY=0;let X=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(X,(Q,J,G)=>{let K=Mq(),q=Eq(Q,J,G),_=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>',W=q.error?`<div data-defer-error style="display: none;">${q.error}</div>`:"",B=`<div data-defer-content style="display: none;">${q.content}</div>`,j=Dq(K,q);return`
7976
7981
  <div id="${K}" class="stx-defer" data-defer-trigger="${q.trigger}">
7977
7982
  ${_}
7978
7983
  ${U}
@@ -7980,7 +7985,7 @@ else {
7980
7985
  ${W}
7981
7986
  </div>
7982
7987
  ${j}
7983
- `})}var XY=0;var GY={};r(GY,{processTeleportDirectives:()=>kq,ensureTeleportTargets:()=>Sq});function Iq(){return`stx-teleport-${++QY}`}function Eq($){let Y=$.split(",").map((Q)=>Q.trim()),Z=Y[0].replace(/['"]/g,""),X;for(let Q=1;Q<Y.length;Q++){let J=Y[Q].match(/disabled:\s*(.+)/);if(J)X=J[1].trim()}return{target:Z,disabled:X}}function Dq($,Y){return`
7988
+ `})}var JY=0;var KY={};r(KY,{processTeleportDirectives:()=>Pq,ensureTeleportTargets:()=>Cq});function bq(){return`stx-teleport-${++GY}`}function Sq($){let Y=$.split(",").map((Q)=>Q.trim()),Z=Y[0].replace(/['"]/g,""),X;for(let Q=1;Q<Y.length;Q++){let J=Y[Q].match(/disabled:\s*(.+)/);if(J)X=J[1].trim()}return{target:Z,disabled:X}}function yq($,Y){return`
7984
7989
  <script>
7985
7990
  (function() {
7986
7991
  const source = document.getElementById('${$}');
@@ -8016,12 +8021,12 @@ else {
8016
8021
  }));
8017
8022
  })();
8018
8023
  </script>
8019
- `}function kq($,Y,Z){QY=0;let X=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(X,(Q,J,G)=>{let K=Iq(),{target:q,disabled:_}=Eq(J),U=G.trim();if(_)try{let B=!1;if(_==="true")B=!0;else if(_==="false")B=!1;else if(_ in Y)B=Boolean(Y[_]);if(B)return`<div class="stx-teleport-inline" data-teleport-disabled>${U}</div>`}catch{}let W=Dq(K,q);return`
8024
+ `}function Pq($,Y,Z){GY=0;let X=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(X,(Q,J,G)=>{let K=bq(),{target:q,disabled:_}=Sq(J),U=G.trim();if(_)try{let B=!1;if(_==="true")B=!0;else if(_==="false")B=!1;else if(_ in Y)B=Boolean(Y[_]);if(B)return`<div class="stx-teleport-inline" data-teleport-disabled>${U}</div>`}catch{}let W=yq(K,q);return`
8020
8025
  <div id="${K}" class="stx-teleport-source" style="display: none;">
8021
8026
  <template>${U}</template>
8022
8027
  </div>
8023
8028
  ${W}
8024
- `})}function Sq(){return`
8029
+ `})}function Cq(){return`
8025
8030
  <script>
8026
8031
  (function() {
8027
8032
  // Common teleport targets
@@ -8038,7 +8043,7 @@ else {
8038
8043
  });
8039
8044
  })();
8040
8045
  </script>
8041
- `}var QY=0;var _Y={};r(_Y,{processTransitionDirectives:()=>Cq,processTransitionAttributes:()=>gq,performLeave:()=>Pq,performEnter:()=>yq,generateTransitionRuntime:()=>fq,generateTransitionCSS:()=>xq});function KY($,Y={}){return{enterFrom:Y.enterClass||`${$}-enter-from`,enterActive:Y.enterActiveClass||`${$}-enter-active`,enterTo:Y.enterToClass||`${$}-enter-to`,leaveFrom:Y.leaveClass||`${$}-leave-from`,leaveActive:Y.leaveActiveClass||`${$}-leave-active`,leaveTo:Y.leaveToClass||`${$}-leave-to`}}function bq($){let Y=getComputedStyle($),Z=Y.transitionDuration||"0s",X=Y.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(Z),Q(X))}function qY($,Y){return new Promise((Z)=>{let X=Y??bq($);if(X===0){Z();return}let Q=!1,J=()=>{if(Q)return;Q=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),Z()},G=(K)=>{if(K.target===$)J()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(J,X+50)})}function UY($){$.offsetHeight}async function yq($,Y={}){let Z=Y.name||"stx",X=KY(Z,Y),Q=typeof Y.duration==="object"?Y.duration.enter:Y.duration;if(Y.onBeforeEnter?.($),$.classList.add(X.enterFrom),$.classList.add(X.enterActive),UY($),$.classList.remove(X.enterFrom),$.classList.add(X.enterTo),Y.onEnter)await new Promise((J)=>{Y.onEnter($,J)});else await qY($,Q);$.classList.remove(X.enterActive),$.classList.remove(X.enterTo),Y.onAfterEnter?.($)}async function Pq($,Y={}){let Z=Y.name||"stx",X=KY(Z,Y),Q=typeof Y.duration==="object"?Y.duration.leave:Y.duration;if(Y.onBeforeLeave?.($),$.classList.add(X.leaveFrom),$.classList.add(X.leaveActive),UY($),$.classList.remove(X.leaveFrom),$.classList.add(X.leaveTo),Y.onLeave)await new Promise((J)=>{Y.onLeave($,J)});else await qY($,Q);$.classList.remove(X.leaveActive),$.classList.remove(X.leaveTo),Y.onAfterLeave?.($)}function Cq($,Y={},Z){let X=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(X,(Q,J,G)=>{let K=vq(J),q=K.name||"stx",_=K.duration||300,U=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
8046
+ `}var GY=0;var WY={};r(WY,{processTransitionDirectives:()=>gq,processTransitionAttributes:()=>uq,performLeave:()=>fq,performEnter:()=>xq,generateTransitionRuntime:()=>mq,generateTransitionCSS:()=>dq});function qY($,Y={}){return{enterFrom:Y.enterClass||`${$}-enter-from`,enterActive:Y.enterActiveClass||`${$}-enter-active`,enterTo:Y.enterToClass||`${$}-enter-to`,leaveFrom:Y.leaveClass||`${$}-leave-from`,leaveActive:Y.leaveActiveClass||`${$}-leave-active`,leaveTo:Y.leaveToClass||`${$}-leave-to`}}function vq($){let Y=getComputedStyle($),Z=Y.transitionDuration||"0s",X=Y.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(Z),Q(X))}function UY($,Y){return new Promise((Z)=>{let X=Y??vq($);if(X===0){Z();return}let Q=!1,J=()=>{if(Q)return;Q=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),Z()},G=(K)=>{if(K.target===$)J()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(J,X+50)})}function _Y($){$.offsetHeight}async function xq($,Y={}){let Z=Y.name||"stx",X=qY(Z,Y),Q=typeof Y.duration==="object"?Y.duration.enter:Y.duration;if(Y.onBeforeEnter?.($),$.classList.add(X.enterFrom),$.classList.add(X.enterActive),_Y($),$.classList.remove(X.enterFrom),$.classList.add(X.enterTo),Y.onEnter)await new Promise((J)=>{Y.onEnter($,J)});else await UY($,Q);$.classList.remove(X.enterActive),$.classList.remove(X.enterTo),Y.onAfterEnter?.($)}async function fq($,Y={}){let Z=Y.name||"stx",X=qY(Z,Y),Q=typeof Y.duration==="object"?Y.duration.leave:Y.duration;if(Y.onBeforeLeave?.($),$.classList.add(X.leaveFrom),$.classList.add(X.leaveActive),_Y($),$.classList.remove(X.leaveFrom),$.classList.add(X.leaveTo),Y.onLeave)await new Promise((J)=>{Y.onLeave($,J)});else await UY($,Q);$.classList.remove(X.leaveActive),$.classList.remove(X.leaveTo),Y.onAfterLeave?.($)}function gq($,Y={},Z){let X=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(X,(Q,J,G)=>{let K=hq(J),q=K.name||"stx",_=K.duration||300,U=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
8042
8047
  <div
8043
8048
  class="stx-transition-wrapper"
8044
8049
  data-transition="${q}"
@@ -8080,7 +8085,7 @@ else {
8080
8085
  });
8081
8086
  })();
8082
8087
  </script>
8083
- `})}function vq($){let Y={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Z.exec($))!==null){let Q=X[1],J=X[2]||X[3]||X[4]||X[5];switch(Q){case"name":Y.name=J;break;case"duration":Y.duration=parseInt(J,10);break;case"mode":Y.mode=J;break;case"easing":Y.easing=J;break}}return Y}function xq(){return`
8088
+ `})}function hq($){let Y={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Z.exec($))!==null){let Q=X[1],J=X[2]||X[3]||X[4]||X[5];switch(Q){case"name":Y.name=J;break;case"duration":Y.duration=parseInt(J,10);break;case"mode":Y.mode=J;break;case"easing":Y.easing=J;break}}return Y}function dq(){return`
8084
8089
  /* STX Transition Presets */
8085
8090
 
8086
8091
  /* Fade */
@@ -8267,7 +8272,7 @@ else {
8267
8272
  opacity: 1;
8268
8273
  max-height: 1000px;
8269
8274
  }
8270
- `}function fq(){return`
8275
+ `}function mq(){return`
8271
8276
  // STX Transition Runtime
8272
8277
  (function() {
8273
8278
  if (typeof window === 'undefined') return;
@@ -8356,7 +8361,7 @@ else {
8356
8361
 
8357
8362
  console.log('[stx] Transition runtime initialized');
8358
8363
  })();
8359
- `}function gq($){let Y=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Y,(Z,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 BY={};r(BY,{withErrorBoundary:()=>WY,processErrorBoundaryDirectives:()=>mq,generateErrorBoundaryRuntime:()=>iq,generateErrorBoundaryCSS:()=>cq,createErrorBoundary:()=>pq});function dq(){return`eb-${++hq}-${Date.now().toString(36)}`}function mq($,Y={},Z){let X=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(X,(Q,J,G,K)=>{let q=dq(),_=uq(J||"");return lq(q,G.trim(),K.trim(),_)})}function uq($){let Y={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,X;while((X=Z.exec($))!==null){let Q=X[1],J=X[2]||X[3]||X[4];switch(Q){case"id":Y.id=J;break;case"logErrors":Y.logErrors=J==="true";break}}return Y}function lq($,Y,Z,X){let Q=X.logErrors!==!1;return`
8364
+ `}function uq($){let Y=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Y,(Z,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 zY={};r(zY,{withErrorBoundary:()=>BY,processErrorBoundaryDirectives:()=>cq,generateErrorBoundaryRuntime:()=>rq,generateErrorBoundaryCSS:()=>sq,createErrorBoundary:()=>oq});function pq(){return`eb-${++lq}-${Date.now().toString(36)}`}function cq($,Y={},Z){let X=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(X,(Q,J,G,K)=>{let q=pq(),_=iq(J||"");return nq(q,G.trim(),K.trim(),_)})}function iq($){let Y={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,X;while((X=Z.exec($))!==null){let Q=X[1],J=X[2]||X[3]||X[4];switch(Q){case"id":Y.id=J;break;case"logErrors":Y.logErrors=J==="true";break}}return Y}function nq($,Y,Z,X){let Q=X.logErrors!==!1;return`
8360
8365
  <div class="stx-error-boundary" data-boundary-id="${$}" data-has-error="false">
8361
8366
  <div class="stx-error-boundary-content" data-boundary-content="${$}">
8362
8367
  ${Y}
@@ -8476,7 +8481,7 @@ else {
8476
8481
  };
8477
8482
  })();
8478
8483
  </script>
8479
- `}async function WY($,Y,Z){try{return await $()}catch(X){if(Z)Z(X instanceof Error?X:Error(String(X)));else console.error("[stx:errorBoundary] SSR Error:",X);return Y}}function pq($,Y={}){let Z=Y.onError?(X)=>Y.onError(X,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(X)=>WY(X,$,Z)}function cq(){return`
8484
+ `}async function BY($,Y,Z){try{return await $()}catch(X){if(Z)Z(X instanceof Error?X:Error(String(X)));else console.error("[stx:errorBoundary] SSR Error:",X);return Y}}function oq($,Y={}){let Z=Y.onError?(X)=>Y.onError(X,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(X)=>BY(X,$,Z)}function sq(){return`
8480
8485
  /* STX Error Boundary Styles */
8481
8486
  .stx-error-boundary {
8482
8487
  position: relative;
@@ -8520,7 +8525,7 @@ else {
8520
8525
  color: #fecaca;
8521
8526
  }
8522
8527
  }
8523
- `}function iq(){return`
8528
+ `}function rq(){return`
8524
8529
  // STX Error Boundary Runtime
8525
8530
  (function() {
8526
8531
  if (typeof window === 'undefined') return;
@@ -8585,7 +8590,7 @@ else {
8585
8590
 
8586
8591
  console.log('[stx] Error boundary runtime initialized');
8587
8592
  })();
8588
- `}var hq=0;var zY={};r(zY,{renderSSRSuspense:()=>eq,processSuspenseDirectives:()=>sq,generateSuspenseRuntime:()=>YU,generateSuspenseCSS:()=>$U,createSSRSuspense:()=>tq});function oq(){return`suspense-${++nq}-${Date.now().toString(36)}`}function sq($,Y={},Z){let X=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(X,(Q,J,G,K)=>{let q=oq(),_=rq(J||"");return aq(q,G.trim(),K.trim(),_)})}function rq($){let Y={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Z.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4];switch(Q){case"id":Y.id=J;break;case"timeout":Y.timeout=G?parseInt(G,10):void 0;break}}return Y}function aq($,Y,Z,X){let Q=X.timeout||30000,J=X.id||$;return`
8593
+ `}var lq=0;var jY={};r(jY,{renderSSRSuspense:()=>XU,processSuspenseDirectives:()=>eq,generateSuspenseRuntime:()=>QU,generateSuspenseCSS:()=>JU,createSSRSuspense:()=>ZU});function tq(){return`suspense-${++aq}-${Date.now().toString(36)}`}function eq($,Y={},Z){let X=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(X,(Q,J,G,K)=>{let q=tq(),_=$U(J||"");return YU(q,G.trim(),K.trim(),_)})}function $U($){let Y={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Z.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4];switch(Q){case"id":Y.id=J;break;case"timeout":Y.timeout=G?parseInt(G,10):void 0;break}}return Y}function YU($,Y,Z,X){let Q=X.timeout||30000,J=X.id||$;return`
8589
8594
  <div class="stx-suspense" data-suspense-id="${$}" data-custom-id="${J}" data-status="pending">
8590
8595
  <div class="stx-suspense-fallback" data-suspense-fallback="${$}">
8591
8596
  ${Z}
@@ -8775,7 +8780,7 @@ else {
8775
8780
  }, 0);
8776
8781
  })();
8777
8782
  </script>
8778
- `}function tq($,Y,Z){return{id:$,fallback:Z,content:Y}}async function eq($){let Y=$.map((X)=>`
8783
+ `}function ZU($,Y,Z){return{id:$,fallback:Z,content:Y}}async function XU($){let Y=$.map((X)=>`
8779
8784
  <div id="stx-ssr-suspense-${X.id}" class="stx-ssr-suspense">
8780
8785
  ${X.fallback}
8781
8786
  </div>
@@ -8800,7 +8805,7 @@ else {
8800
8805
  }
8801
8806
  })();
8802
8807
  </script>
8803
- `}}return{initial:Y,streaming:Z()}}function $U(){return`
8808
+ `}}return{initial:Y,streaming:Z()}}function JU(){return`
8804
8809
  /* STX Suspense Styles */
8805
8810
  .stx-suspense {
8806
8811
  position: relative;
@@ -8856,7 +8861,7 @@ else {
8856
8861
  background-size: 200% 100%;
8857
8862
  }
8858
8863
  }
8859
- `}function YU(){return`
8864
+ `}function QU(){return`
8860
8865
  // STX Suspense Runtime
8861
8866
  (function() {
8862
8867
  if (typeof window === 'undefined') return;
@@ -8923,7 +8928,7 @@ else {
8923
8928
 
8924
8929
  console.log('[stx] Suspense runtime initialized');
8925
8930
  })();
8926
- `}var nq=0;var LY={};r(LY,{processAsyncDirectives:()=>XU,isAsyncComponent:()=>QU,generateAsyncComponentRuntime:()=>KU,generateAsyncComponentCSS:()=>GU,defineAsyncComponent:()=>JU});function jY(){return`async-${++ZU}-${Date.now().toString(36)}`}function XU($,Y={},Z){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,_)=>{let U=jY(),W=OY(K);return HY(U,W,q.trim(),_.trim())}),J=J.replace(Q,(G,K,q)=>{let _=jY(),U=OY(K);return HY(_,U,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),J}function OY($){let Y={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Z.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4],K=X[5];switch(Q){case"component":Y.component=J||K||"";break;case"timeout":Y.timeout=G?parseInt(G,10):30000;break;case"delay":Y.delay=G?parseInt(G,10):200;break;case"suspensible":Y.suspensible=K==="true";break;case"retries":Y.retries=G?parseInt(G,10):0;break;case"loadingComponent":Y.loadingComponent=J||K;break;case"errorComponent":Y.errorComponent=J||K;break}}return Y}function HY($,Y,Z,X){let{component:Q,timeout:J,delay:G,suspensible:K,retries:q}=Y;return`
8931
+ `}var aq=0;var FY={};r(FY,{processAsyncDirectives:()=>KU,isAsyncComponent:()=>UU,generateAsyncComponentRuntime:()=>WU,generateAsyncComponentCSS:()=>_U,defineAsyncComponent:()=>qU});function OY(){return`async-${++GU}-${Date.now().toString(36)}`}function KU($,Y={},Z){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,_)=>{let U=OY(),W=HY(K);return LY(U,W,q.trim(),_.trim())}),J=J.replace(Q,(G,K,q)=>{let _=OY(),U=HY(K);return LY(_,U,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),J}function HY($){let Y={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Z.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4],K=X[5];switch(Q){case"component":Y.component=J||K||"";break;case"timeout":Y.timeout=G?parseInt(G,10):30000;break;case"delay":Y.delay=G?parseInt(G,10):200;break;case"suspensible":Y.suspensible=K==="true";break;case"retries":Y.retries=G?parseInt(G,10):0;break;case"loadingComponent":Y.loadingComponent=J||K;break;case"errorComponent":Y.errorComponent=J||K;break}}return Y}function LY($,Y,Z,X){let{component:Q,timeout:J,delay:G,suspensible:K,retries:q}=Y;return`
8927
8932
  <div class="stx-async-component" data-async-id="${$}" data-component="${Q}" data-status="pending">
8928
8933
  <div class="stx-async-loading" data-async-loading="${$}">
8929
8934
  ${Z}
@@ -9108,7 +9113,7 @@ catch (error) {
9108
9113
  loadComponent();
9109
9114
  })();
9110
9115
  </script>
9111
- `}function JU($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function QU($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function GU(){return`
9116
+ `}function qU($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function UU($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function _U(){return`
9112
9117
  /* STX Async Component Styles */
9113
9118
  .stx-async-component {
9114
9119
  position: relative;
@@ -9182,7 +9187,7 @@ catch (error) {
9182
9187
  background-size: 200% 100%;
9183
9188
  }
9184
9189
  }
9185
- `}function KU(){return`
9190
+ `}function WU(){return`
9186
9191
  // STX Async Component Runtime
9187
9192
  (function() {
9188
9193
  if (typeof window === 'undefined') return;
@@ -9236,7 +9241,7 @@ catch (error) {
9236
9241
 
9237
9242
  console.log('[stx] Async component runtime initialized');
9238
9243
  })();
9239
- `}var ZU=0;var VY={};r(VY,{shouldCacheComponent:()=>zU,processKeepAliveDirectives:()=>UU,onDeactivated:()=>LU,onActivated:()=>HU,generateKeepAliveRuntime:()=>OU,generateKeepAliveCSS:()=>jU,createKeepAliveCache:()=>BU});function FY(){return`keep-alive-${++qU}-${Date.now().toString(36)}`}function UU($,Y={},Z){let X=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(X,(Q,J,G)=>{let K=FY(),q=_U(J||"");return WU(K,G.trim(),q)})}function _U($){let Y={max:10},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Z.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4];switch(Q){case"max":Y.max=G?parseInt(G,10):10;break;case"include":Y.include=J;break;case"exclude":Y.exclude=J;break;case"id":Y.id=J;break}}return Y}function WU($,Y,Z){let{max:X,include:Q,exclude:J}=Z,G=Z.id||$;return`
9244
+ `}var GU=0;var RY={};r(RY,{shouldCacheComponent:()=>LU,processKeepAliveDirectives:()=>zU,onDeactivated:()=>NU,onActivated:()=>RU,generateKeepAliveRuntime:()=>VU,generateKeepAliveCSS:()=>FU,createKeepAliveCache:()=>HU});function VY(){return`keep-alive-${++BU}-${Date.now().toString(36)}`}function zU($,Y={},Z){let X=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(X,(Q,J,G)=>{let K=VY(),q=jU(J||"");return OU(K,G.trim(),q)})}function jU($){let Y={max:10},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Z.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4];switch(Q){case"max":Y.max=G?parseInt(G,10):10;break;case"include":Y.include=J;break;case"exclude":Y.exclude=J;break;case"id":Y.id=J;break}}return Y}function OU($,Y,Z){let{max:X,include:Q,exclude:J}=Z,G=Z.id||$;return`
9240
9245
  <div class="stx-keep-alive" data-keep-alive-id="${$}" data-custom-id="${G}">
9241
9246
  <div class="stx-keep-alive-content" data-keep-alive-content="${$}">
9242
9247
  ${Y}
@@ -9523,7 +9528,7 @@ else {
9523
9528
  });
9524
9529
  })();
9525
9530
  </script>
9526
- `}function BU($={}){return{id:$.id||FY(),cache:new Map,max:$.max||10,include:$.include?$.include.split(",").map((Z)=>Z.trim()):null,exclude:$.exclude?$.exclude.split(",").map((Z)=>Z.trim()):null}}function zU($,Y){if(Y.exclude&&Y.exclude.includes($))return!1;if(Y.include&&!Y.include.includes($))return!1;return!0}function jU(){return`
9531
+ `}function HU($={}){return{id:$.id||VY(),cache:new Map,max:$.max||10,include:$.include?$.include.split(",").map((Z)=>Z.trim()):null,exclude:$.exclude?$.exclude.split(",").map((Z)=>Z.trim()):null}}function LU($,Y){if(Y.exclude&&Y.exclude.includes($))return!1;if(Y.include&&!Y.include.includes($))return!1;return!0}function FU(){return`
9527
9532
  /* STX Keep-Alive Styles */
9528
9533
  .stx-keep-alive {
9529
9534
  position: relative;
@@ -9548,7 +9553,7 @@ else {
9548
9553
  .stx-keep-alive-content > [data-activated] {
9549
9554
  opacity: 1;
9550
9555
  }
9551
- `}function OU(){return`
9556
+ `}function VU(){return`
9552
9557
  // STX Keep-Alive Runtime
9553
9558
  (function() {
9554
9559
  if (typeof window === 'undefined') return;
@@ -9584,7 +9589,7 @@ else {
9584
9589
 
9585
9590
  console.log('[stx] Keep-alive runtime initialized');
9586
9591
  })();
9587
- `}function HU($){if(typeof document<"u")document.addEventListener("stx:activated",(Y)=>{$(Y.detail)})}function LU($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Y)=>{$(Y.detail)})}var qU=0;var TY={};r(TY,{useVirtualList:()=>NY,processVirtualListDirectives:()=>G7,processVirtualGridDirectives:()=>wY,processInfiniteListDirectives:()=>AY,generateVirtualListCSS:()=>RY,default:()=>FU,createVirtualList:()=>Q7});function Q7($,Y){let{itemHeight:Z,containerHeight:X,overscan:Q=3,keyProperty:J="id",dynamicHeight:G=!1,estimatedItemHeight:K=Z,direction:q="vertical"}=Y,_=[...$],U=0,W=new Map;function B(){if(G)return j();let A=Math.max(0,Math.floor(U/Z)-Q),w=Math.ceil(X/Z),T=Math.min(_.length-1,A+w+Q*2);return{startIndex:A,endIndex:T}}function j(){let A=0,w=0,T=_.length-1;for(let I=0;I<_.length;I++){let M=W.get(I)||K;if(A+M>U){w=Math.max(0,I-Q);break}A+=M}A=0;for(let I=0;I<_.length;I++){let M=W.get(I)||K;if(A+=M,A>U+X){T=Math.min(_.length-1,I+Q);break}}return{startIndex:w,endIndex:T}}function z(){if(G){let A=0;for(let w=0;w<_.length;w++)A+=W.get(w)||K;return A}return _.length*Z}function O(A){if(G){let w=0;for(let T=0;T<A;T++)w+=W.get(T)||K;return w}return A*Z}function L(){let{startIndex:A,endIndex:w}=B();return{startIndex:A,endIndex:w,scrollTop:U,totalHeight:z(),visibleItems:_.slice(A,w+1),itemHeights:new Map(W)}}function F(A,w="auto"){let T=O(A);H(T,w)}function H(A,w="auto"){U=Math.max(0,Math.min(A,z()-X))}function V(){B()}function N(A){_=[...A],W.clear(),V()}function R(){_=[],W.clear()}return{scrollToIndex:F,scrollToOffset:H,getState:L,refresh:V,setItems:N,destroy:R}}function G7($,Y={},Z){let X=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(X,(Q,J,G,K)=>{let q=J.trim(),_=Y[q];if(!_||!Array.isArray(_))return`<!-- virtualList: items "${q}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let H=G.trim(),V=Function(`return ${H}`)();U={...U,...V}}catch{}let W=`vlist-${Math.random().toString(36).substring(2,9)}`,B=Math.ceil(U.containerHeight/U.itemHeight),j=U.overscan||3,z=0,O=Math.min(_.length-1,B+j),L="";for(let H=z;H<=O&&H<_.length;H++){let V=_[H],N=K.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(R,A)=>{if(typeof V==="object"&&V!==null)return String(V[A]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(H));L+=`
9592
+ `}function RU($){if(typeof document<"u")document.addEventListener("stx:activated",(Y)=>{$(Y.detail)})}function NU($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Y)=>{$(Y.detail)})}var BU=0;var MY={};r(MY,{useVirtualList:()=>AY,processVirtualListDirectives:()=>G7,processVirtualGridDirectives:()=>TY,processInfiniteListDirectives:()=>wY,generateVirtualListCSS:()=>NY,default:()=>AU,createVirtualList:()=>Q7});function Q7($,Y){let{itemHeight:Z,containerHeight:X,overscan:Q=3,keyProperty:J="id",dynamicHeight:G=!1,estimatedItemHeight:K=Z,direction:q="vertical"}=Y,_=[...$],U=0,W=new Map;function B(){if(G)return j();let A=Math.max(0,Math.floor(U/Z)-Q),w=Math.ceil(X/Z),T=Math.min(_.length-1,A+w+Q*2);return{startIndex:A,endIndex:T}}function j(){let A=0,w=0,T=_.length-1;for(let I=0;I<_.length;I++){let M=W.get(I)||K;if(A+M>U){w=Math.max(0,I-Q);break}A+=M}A=0;for(let I=0;I<_.length;I++){let M=W.get(I)||K;if(A+=M,A>U+X){T=Math.min(_.length-1,I+Q);break}}return{startIndex:w,endIndex:T}}function z(){if(G){let A=0;for(let w=0;w<_.length;w++)A+=W.get(w)||K;return A}return _.length*Z}function O(A){if(G){let w=0;for(let T=0;T<A;T++)w+=W.get(T)||K;return w}return A*Z}function L(){let{startIndex:A,endIndex:w}=B();return{startIndex:A,endIndex:w,scrollTop:U,totalHeight:z(),visibleItems:_.slice(A,w+1),itemHeights:new Map(W)}}function F(A,w="auto"){let T=O(A);H(T,w)}function H(A,w="auto"){U=Math.max(0,Math.min(A,z()-X))}function V(){B()}function N(A){_=[...A],W.clear(),V()}function R(){_=[],W.clear()}return{scrollToIndex:F,scrollToOffset:H,getState:L,refresh:V,setItems:N,destroy:R}}function G7($,Y={},Z){let X=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(X,(Q,J,G,K)=>{let q=J.trim(),_=Y[q];if(!_||!Array.isArray(_))return`<!-- virtualList: items "${q}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let H=G.trim(),V=Function(`return ${H}`)();U={...U,...V}}catch{}let W=`vlist-${Math.random().toString(36).substring(2,9)}`,B=Math.ceil(U.containerHeight/U.itemHeight),j=U.overscan||3,z=0,O=Math.min(_.length-1,B+j),L="";for(let H=z;H<=O&&H<_.length;H++){let V=_[H],N=K.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(R,A)=>{if(typeof V==="object"&&V!==null)return String(V[A]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(H));L+=`
9588
9593
  <div class="virtual-item ${U.itemClass||""}"
9589
9594
  style="position: absolute; top: ${H*U.itemHeight}px; height: ${U.itemHeight}px; width: 100%;"
9590
9595
  data-index="${H}">
@@ -9661,7 +9666,7 @@ else {
9661
9666
  };
9662
9667
  })();
9663
9668
  </script>
9664
- `})}function RY(){return`
9669
+ `})}function NY(){return`
9665
9670
  .virtual-list-container {
9666
9671
  position: relative;
9667
9672
  overflow-y: auto;
@@ -9709,7 +9714,7 @@ else {
9709
9714
  0% { background-position: 200% 0; }
9710
9715
  100% { background-position: -200% 0; }
9711
9716
  }
9712
- `}function NY($,Y){let Z=null,X=()=>{if(!Z)Z=Q7($(),Y);return Z};return{visibleItems:()=>{return X().getState().visibleItems},totalHeight:()=>{return X().getState().totalHeight},containerProps:()=>({style:{height:`${Y.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(Q)=>{let J=Q.target;if(Z)Z.scrollToOffset(J.scrollTop)}}),itemProps:(Q)=>({style:{position:"absolute",top:`${Q*Y.itemHeight}px`,height:`${Y.itemHeight}px`,width:"100%"},"data-index":Q}),scrollToIndex:(Q)=>{X().scrollToIndex(Q)}}}function AY($,Y={},Z){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 _=J.trim(),U=Y[_];if(!U||!Array.isArray(U))return`<!-- infiniteList: items "${_}" not found or not an array -->`;let W={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(G)try{let z=Function(`return ${G.trim()}`)();W={...W,...z}}catch{}let B=`ilist-${Math.random().toString(36).substring(2,9)}`,j=G7(`@virtualList(${_}, ${JSON.stringify({itemHeight:W.itemHeight,containerHeight:W.containerHeight,overscan:W.overscan,containerClass:W.containerClass})})${K}@endvirtualList`,Y);return j=j.replace("</script>",`
9717
+ `}function AY($,Y){let Z=null,X=()=>{if(!Z)Z=Q7($(),Y);return Z};return{visibleItems:()=>{return X().getState().visibleItems},totalHeight:()=>{return X().getState().totalHeight},containerProps:()=>({style:{height:`${Y.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(Q)=>{let J=Q.target;if(Z)Z.scrollToOffset(J.scrollTop)}}),itemProps:(Q)=>({style:{position:"absolute",top:`${Q*Y.itemHeight}px`,height:`${Y.itemHeight}px`,width:"100%"},"data-index":Q}),scrollToIndex:(Q)=>{X().scrollToIndex(Q)}}}function wY($,Y={},Z){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 _=J.trim(),U=Y[_];if(!U||!Array.isArray(U))return`<!-- infiniteList: items "${_}" not found or not an array -->`;let W={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(G)try{let z=Function(`return ${G.trim()}`)();W={...W,...z}}catch{}let B=`ilist-${Math.random().toString(36).substring(2,9)}`,j=G7(`@virtualList(${_}, ${JSON.stringify({itemHeight:W.itemHeight,containerHeight:W.containerHeight,overscan:W.overscan,containerClass:W.containerClass})})${K}@endvirtualList`,Y);return j=j.replace("</script>",`
9713
9718
  // Infinite scroll detection
9714
9719
  container.addEventListener('scroll', function() {
9715
9720
  const scrollBottom = container.scrollTop + container.clientHeight;
@@ -9727,7 +9732,7 @@ else {
9727
9732
  ${q}
9728
9733
  </div>
9729
9734
  </div>
9730
- `})}function wY($,Y={},Z){let X=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(X,(Q,J,G,K)=>{let q=J.trim(),_=Y[q];if(!_||!Array.isArray(_))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 W=`vgrid-${Math.random().toString(36).substring(2,9)}`,B=Math.ceil(_.length/U.columns),j=B*(U.rowHeight+(U.gap||0)),z=Math.ceil(U.containerHeight/(U.rowHeight+(U.gap||0))),O=U.overscan||2,L=0,F=Math.min(B-1,z+O),H="";for(let V=L;V<=F;V++)for(let N=0;N<U.columns;N++){let R=V*U.columns+N;if(R>=_.length)break;let A=_[R],w=N*(100/U.columns),T=V*(U.rowHeight+(U.gap||0)),I=K.replace(/\{\{\s*item\s*\}\}/g,typeof A==="object"?JSON.stringify(A):String(A)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(M,E)=>{if(typeof A==="object"&&A!==null)return String(A[E]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(R));H+=`
9735
+ `})}function TY($,Y={},Z){let X=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(X,(Q,J,G,K)=>{let q=J.trim(),_=Y[q];if(!_||!Array.isArray(_))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 W=`vgrid-${Math.random().toString(36).substring(2,9)}`,B=Math.ceil(_.length/U.columns),j=B*(U.rowHeight+(U.gap||0)),z=Math.ceil(U.containerHeight/(U.rowHeight+(U.gap||0))),O=U.overscan||2,L=0,F=Math.min(B-1,z+O),H="";for(let V=L;V<=F;V++)for(let N=0;N<U.columns;N++){let R=V*U.columns+N;if(R>=_.length)break;let A=_[R],w=N*(100/U.columns),T=V*(U.rowHeight+(U.gap||0)),I=K.replace(/\{\{\s*item\s*\}\}/g,typeof A==="object"?JSON.stringify(A):String(A)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(M,E)=>{if(typeof A==="object"&&A!==null)return String(A[E]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(R));H+=`
9731
9736
  <div class="virtual-grid-item"
9732
9737
  style="position: absolute; top: ${T}px; left: ${w}%; width: calc(${100/U.columns}% - ${U.gap||0}px); height: ${U.rowHeight}px;"
9733
9738
  data-index="${R}">
@@ -9797,7 +9802,7 @@ else {
9797
9802
  });
9798
9803
  })();
9799
9804
  </script>
9800
- `})}var FU;var MY=b(()=>{FU={createVirtualList:Q7,processVirtualListDirectives:G7,processInfiniteListDirectives:AY,processVirtualGridDirectives:wY,generateVirtualListCSS:RY,useVirtualList:NY}});function IY(){return`<script data-stx-hydration-runtime>
9805
+ `})}var AU;var IY=S(()=>{AU={createVirtualList:Q7,processVirtualListDirectives:G7,processInfiniteListDirectives:wY,processVirtualGridDirectives:TY,generateVirtualListCSS:NY,useVirtualList:AY}});function EY(){return`<script data-stx-hydration-runtime>
9801
9806
  (function() {
9802
9807
  'use strict';
9803
9808
 
@@ -9957,7 +9962,7 @@ else {
9957
9962
  stxIslands.initIslands();
9958
9963
  }
9959
9964
  })();
9960
- </script>`}function EY($){let Y=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Y)return Y[1];let Z=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Z)return Z[1];return null}function DY($,Y){let Z={},X=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,Q;while((Q=X.exec($))!==null){let J=Q[1],G=Q[2];if(G in Y)Z[J]=Y[G];else Z[J]=G}return Z}var hY={};r(hY,{processStaticDirectives:()=>fY,processPartialHydrationDirectives:()=>SY,onHydrated:()=>xY,isHydrated:()=>vY,hydrateIsland:()=>yY,hydrateByStrategy:()=>PY,hydrateAll:()=>CY,generatePartialHydrationCSS:()=>bY,generateIslandManifest:()=>gY,default:()=>IU,createIslandRegistry:()=>kY});function kY(){let $=new Map;return{islands:$,register(Y){$.set(Y.id,Y)},get(Y){return $.get(Y)},async hydrate(Y){let Z=$.get(Y);if(!Z||Z.hydrated)return;if(Z.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:Y,component:Z.component}}))},async hydrateAll(){let Y=Array.from($.values()).filter((Z)=>!Z.hydrated).map((Z)=>this.hydrate(Z.id));await Promise.all(Y)}}}function VU($){return`
9965
+ </script>`}function DY($){let Y=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Y)return Y[1];let Z=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Z)return Z[1];return null}function kY($,Y){let Z={},X=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,Q;while((Q=X.exec($))!==null){let J=Q[1],G=Q[2];if(G in Y)Z[J]=Y[G];else Z[J]=G}return Z}var dY={};r(dY,{processStaticDirectives:()=>gY,processPartialHydrationDirectives:()=>SY,onHydrated:()=>fY,isHydrated:()=>xY,hydrateIsland:()=>PY,hydrateByStrategy:()=>CY,hydrateAll:()=>vY,generatePartialHydrationCSS:()=>yY,generateIslandManifest:()=>hY,default:()=>bU,createIslandRegistry:()=>bY});function bY(){let $=new Map;return{islands:$,register(Y){$.set(Y.id,Y)},get(Y){return $.get(Y)},async hydrate(Y){let Z=$.get(Y);if(!Z||Z.hydrated)return;if(Z.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:Y,component:Z.component}}))},async hydrateAll(){let Y=Array.from($.values()).filter((Z)=>!Z.hydrated).map((Z)=>this.hydrate(Z.id));await Promise.all(Y)}}}function wU($){return`
9961
9966
  <script data-hydrate="${$}">
9962
9967
  (function() {
9963
9968
  const island = document.querySelector('[data-island="${$}"]');
@@ -9968,7 +9973,7 @@ else {
9968
9973
  island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
9969
9974
  })();
9970
9975
  </script>
9971
- `}function RU($,Y){let Z=Y.timeout||2000,X=Y.priority||"low";return`
9976
+ `}function TU($,Y){let Z=Y.timeout||2000,X=Y.priority||"low";return`
9972
9977
  <script data-hydrate="${$}">
9973
9978
  (function() {
9974
9979
  const island = document.querySelector('[data-island="${$}"]');
@@ -10004,7 +10009,7 @@ else {
10004
10009
  }
10005
10010
  })();
10006
10011
  </script>
10007
- `}function NU($,Y){let Z=Y.rootMargin||"0px",X=Y.threshold||0;return`
10012
+ `}function MU($,Y){let Z=Y.rootMargin||"0px",X=Y.threshold||0;return`
10008
10013
  <script data-hydrate="${$}">
10009
10014
  (function() {
10010
10015
  const island = document.querySelector('[data-island="${$}"]');
@@ -10037,7 +10042,7 @@ else {
10037
10042
  }
10038
10043
  })();
10039
10044
  </script>
10040
- `}function AU($,Y){let Z=Y.media||"(min-width: 768px)";return`
10045
+ `}function IU($,Y){let Z=Y.media||"(min-width: 768px)";return`
10041
10046
  <script data-hydrate="${$}">
10042
10047
  (function() {
10043
10048
  const island = document.querySelector('[data-island="${$}"]');
@@ -10066,7 +10071,7 @@ else {
10066
10071
  }
10067
10072
  })();
10068
10073
  </script>
10069
- `}function wU($){return`
10074
+ `}function EU($){return`
10070
10075
  <script data-hydrate="${$}">
10071
10076
  (function() {
10072
10077
  const island = document.querySelector('[data-island="${$}"]');
@@ -10088,7 +10093,7 @@ else {
10088
10093
  events.forEach(e => island.addEventListener(e, handler, { once: true, passive: true }));
10089
10094
  })();
10090
10095
  </script>
10091
- `}function TU($,Y){let Z=Y.event||"stx:activate";return`
10096
+ `}function DU($,Y){let Z=Y.event||"stx:activate";return`
10092
10097
  <script data-hydrate="${$}">
10093
10098
  (function() {
10094
10099
  const island = document.querySelector('[data-island="${$}"]');
@@ -10109,9 +10114,9 @@ else {
10109
10114
  });
10110
10115
  })();
10111
10116
  </script>
10112
- `}function SY($,Y={},Z){let X=$,Q=!1,J=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(X=x1(X,"load",Y),X=x1(X,"idle",Y),X=x1(X,"visible",Y),X=x1(X,"media",Y),X=MU(X),X=x1(X,"hover",Y),X=x1(X,"event",Y),Q=J&&X!==$,Q)X+=`
10113
- `+IY();return X}function x1($,Y,Z){let X=new RegExp(`@client:${Y}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(X,(Q,J,G)=>{let K={strategy:Y};if(J)try{let O=J.split(",").map((L)=>L.trim());for(let L of O){let[F,H]=L.split(":").map((V)=>V.trim());if(F&&H){let V=H.replace(/^['"]|['"]$/g,"");K[F]=V}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,_=EY(G.trim()),U=DY(G.trim(),Z),W=[];if(K.rootMargin)W.push(`data-root-margin="${K.rootMargin}"`);if(K.threshold!==void 0)W.push(`data-threshold="${K.threshold}"`);if(K.media)W.push(`data-media="${K.media}"`);if(K.event)W.push(`data-event="${K.event}"`);if(_)W.push(`data-component="${_}"`);let j=Object.keys(U).length>0?`
10114
- <script type="application/json" data-island-props="${q}">${JSON.stringify(U)}</script>`:"",z="";switch(Y){case"load":z=VU(q);break;case"idle":z=RU(q,K);break;case"visible":z=NU(q,K);break;case"media":z=AU(q,K);break;case"hover":z=wU(q);break;case"event":z=TU(q,K);break}return`
10117
+ `}function SY($,Y={},Z){let X=$,Q=!1,J=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(X=f1(X,"load",Y),X=f1(X,"idle",Y),X=f1(X,"visible",Y),X=f1(X,"media",Y),X=kU(X),X=f1(X,"hover",Y),X=f1(X,"event",Y),Q=J&&X!==$,Q)X+=`
10118
+ `+EY();return X}function f1($,Y,Z){let X=new RegExp(`@client:${Y}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(X,(Q,J,G)=>{let K={strategy:Y};if(J)try{let O=J.split(",").map((L)=>L.trim());for(let L of O){let[F,H]=L.split(":").map((V)=>V.trim());if(F&&H){let V=H.replace(/^['"]|['"]$/g,"");K[F]=V}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,_=DY(G.trim()),U=kY(G.trim(),Z),W=[];if(K.rootMargin)W.push(`data-root-margin="${K.rootMargin}"`);if(K.threshold!==void 0)W.push(`data-threshold="${K.threshold}"`);if(K.media)W.push(`data-media="${K.media}"`);if(K.event)W.push(`data-event="${K.event}"`);if(_)W.push(`data-component="${_}"`);let j=Object.keys(U).length>0?`
10119
+ <script type="application/json" data-island-props="${q}">${JSON.stringify(U)}</script>`:"",z="";switch(Y){case"load":z=wU(q);break;case"idle":z=TU(q,K);break;case"visible":z=MU(q,K);break;case"media":z=IU(q,K);break;case"hover":z=EU(q);break;case"event":z=DU(q,K);break}return`
10115
10120
  <div data-island="${q}"
10116
10121
  data-strategy="${Y}"
10117
10122
  ${W.join(`
@@ -10121,7 +10126,7 @@ else {
10121
10126
  ${G.trim()}${j}
10122
10127
  </div>
10123
10128
  ${z}
10124
- `})}function MU($){let Y=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(Y,(Z,X)=>{let Q=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
10129
+ `})}function kU($){let Y=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(Y,(Z,X)=>{let Q=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
10125
10130
  <div data-island="${Q}"
10126
10131
  data-strategy="only"
10127
10132
  class="stx-island stx-client-only">
@@ -10140,7 +10145,7 @@ else {
10140
10145
  }
10141
10146
  })();
10142
10147
  </script>
10143
- `})}function bY(){return`
10148
+ `})}function yY(){return`
10144
10149
  /* Island base styles */
10145
10150
  .stx-island {
10146
10151
  display: contents;
@@ -10181,11 +10186,11 @@ else {
10181
10186
  .stx-island.hydrated {
10182
10187
  opacity: 1;
10183
10188
  }
10184
- `}function yY($){if(typeof window>"u")return;let Y=document.querySelector(`[data-island="${$}"]`);if(!Y||Y.classList.contains("hydrated"))return;Y.classList.add("hydrated"),Y.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function PY($){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${$}"]:not(.hydrated)`).forEach((Z)=>{Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function CY(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach((Y)=>{Y.classList.add("hydrated"),Y.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function vY($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function xY($){return new Promise((Y)=>{if(typeof window>"u"){Y();return}let Z=document.querySelector(`[data-island="${$}"]`);if(!Z){Y();return}if(Z.classList.contains("hydrated")){Y();return}Z.addEventListener("stx:hydrated",()=>Y(),{once:!0})})}function fY($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Y,Z)=>{return`<div class="stx-static">${Z.trim()}</div>`})}function gY($){let Y=$.map((Z)=>({id:Z.id,component:Z.component,strategy:Z.options.strategy,props:Z.props}));return`
10189
+ `}function PY($){if(typeof window>"u")return;let Y=document.querySelector(`[data-island="${$}"]`);if(!Y||Y.classList.contains("hydrated"))return;Y.classList.add("hydrated"),Y.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function CY($){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${$}"]:not(.hydrated)`).forEach((Z)=>{Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function vY(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach((Y)=>{Y.classList.add("hydrated"),Y.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function xY($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function fY($){return new Promise((Y)=>{if(typeof window>"u"){Y();return}let Z=document.querySelector(`[data-island="${$}"]`);if(!Z){Y();return}if(Z.classList.contains("hydrated")){Y();return}Z.addEventListener("stx:hydrated",()=>Y(),{once:!0})})}function gY($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Y,Z)=>{return`<div class="stx-static">${Z.trim()}</div>`})}function hY($){let Y=$.map((Z)=>({id:Z.id,component:Z.component,strategy:Z.options.strategy,props:Z.props}));return`
10185
10190
  <script type="application/json" id="stx-island-manifest">
10186
10191
  ${JSON.stringify(Y)}
10187
10192
  </script>
10188
- `}var IU;var dY=b(()=>{IU={processPartialHydrationDirectives:SY,processStaticDirectives:fY,generatePartialHydrationCSS:bY,generateIslandManifest:gY,createIslandRegistry:kY,hydrateIsland:yY,hydrateByStrategy:PY,hydrateAll:CY,isHydrated:vY,onHydrated:xY}});var aY={};r(aY,{watchMultiple:()=>cY,watchEffect:()=>iY,watch:()=>pY,unref:()=>mY,toRefs:()=>uY,throttledComputed:()=>rY,stxWatchMultiple:()=>cY,stxWatchEffect:()=>iY,stxWatch:()=>pY,stxUnref:()=>mY,stxToRefs:()=>uY,stxThrottledComputed:()=>rY,stxShallowRef:()=>lY,stxRef:()=>f1,stxIsRef:()=>e0,stxDebouncedComputed:()=>sY,stxComputed:()=>B5,shallowRef:()=>lY,ref:()=>f1,processWatchDirectives:()=>oY,processComputedDirectives:()=>nY,isRef:()=>e0,default:()=>EU,debouncedComputed:()=>sY,computed:()=>B5});function f1($){let Y=$,Z=new Set,X={get value(){if(g0){let Q=W5.get(X);if(!Q)Q=new Set,W5.set(X,Q);Q.add(g0)}return Y},set value(Q){if(!Object.is(Y,Q)){Y=Q,Z.forEach((G)=>G(Q));let J=W5.get(X);if(J)J.forEach((G)=>G())}},subscribe(Q){return Z.add(Q),()=>Z.delete(Q)},peek(){return Y}};return X}function e0($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function mY($){return e0($)?$.value:$}function uY($){let Y={};for(let Z in $)if(Object.prototype.hasOwnProperty.call($,Z))Y[Z]=f1($[Z]);return Y}function lY($){return f1($)}function B5($){let Y=typeof $==="function",Z=Y?$:$.get,X=Y?void 0:$.set,Q=Y?Object.is:$.equals||Object.is,J,G=!0,K=new Set,q=new Set,_=()=>{if(G=!0,q.size>0){let B=W.value;q.forEach((j)=>j(B))}};function U(){K.clear();let B=g0;g0=_,y9.push(_);try{return Z()}finally{y9.pop(),g0=B}}let W={get value(){if(g0){let B=W5.get(W);if(!B)B=new Set,W5.set(W,B);B.add(g0)}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=Z(),G=!1;return J},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return W}function pY($,Y,Z={}){let{immediate:X=!1,deep:Q=!1,flush:J="pre",once:G=!1}=Z,K,q=!0,_=!1,U=()=>{if(e0($))return Q?O1($.value):$.value;return $()},W=()=>{if(!q||_)return;let z=U();if(K!==void 0&&Object.is(K,z)&&!Q)return;let O=()=>{if(Y(z,K),K=Q?O1(z):z,G)j()};if(J==="sync")O();else if(J==="post")queueMicrotask(O);else Promise.resolve().then(O)},B=null;if(e0($))B=$.subscribe(()=>W());else B=B5($).subscribe(()=>W());if(X)K=void 0,W();else K=U();let j=()=>{if(q=!1,B)B(),B=null};return j.pause=()=>{_=!0},j.resume=()=>{_=!1},j}function cY($,Y,Z={}){let{immediate:X=!1,once:Q=!1}=Z,J=$.map((W)=>e0(W)?W.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let W=$.map((B)=>e0(B)?B.value:void 0);if(Y(W,J),J=[...W],Q)U()},_=$.map((W)=>{if(e0(W))return W.subscribe(()=>q());return()=>{}});if(X)q();let U=()=>{G=!1,_.forEach((W)=>W())};return U.pause=()=>{K=!0},U.resume=()=>{K=!1},U}function iY($,Y={}){let{flush:Z="pre"}=Y,X,Q=!0,J=!1,G=()=>{if(!Q||J)return;if(X)X();let q=g0;g0=G,y9.push(G);try{X=$()}finally{y9.pop(),g0=q}};if(Z==="sync")G();else if(Z==="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 nY($,Y={},Z){let X=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(X,(Q,J,G)=>{try{let q=Function(...Object.keys(Y),`return ${G}`)(...Object.values(Y));return Y[J]=q,`<!-- computed: ${J} = ${q} -->`}catch(K){return`<!-- computed error: ${J} - ${K} -->`}})}function oY($,Y={},Z){let X=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(X,(Q,J,G)=>{return`
10193
+ `}var bU;var mY=S(()=>{bU={processPartialHydrationDirectives:SY,processStaticDirectives:gY,generatePartialHydrationCSS:yY,generateIslandManifest:hY,createIslandRegistry:bY,hydrateIsland:PY,hydrateByStrategy:CY,hydrateAll:vY,isHydrated:xY,onHydrated:fY}});var tY={};r(tY,{watchMultiple:()=>iY,watchEffect:()=>nY,watch:()=>cY,unref:()=>uY,toRefs:()=>lY,throttledComputed:()=>aY,stxWatchMultiple:()=>iY,stxWatchEffect:()=>nY,stxWatch:()=>cY,stxUnref:()=>uY,stxToRefs:()=>lY,stxThrottledComputed:()=>aY,stxShallowRef:()=>pY,stxRef:()=>g1,stxIsRef:()=>$1,stxDebouncedComputed:()=>rY,stxComputed:()=>B5,shallowRef:()=>pY,ref:()=>g1,processWatchDirectives:()=>sY,processComputedDirectives:()=>oY,isRef:()=>$1,default:()=>SU,debouncedComputed:()=>rY,computed:()=>B5});function g1($){let Y=$,Z=new Set,X={get value(){if(g0){let Q=W5.get(X);if(!Q)Q=new Set,W5.set(X,Q);Q.add(g0)}return Y},set value(Q){if(!Object.is(Y,Q)){Y=Q,Z.forEach((G)=>G(Q));let J=W5.get(X);if(J)J.forEach((G)=>G())}},subscribe(Q){return Z.add(Q),()=>Z.delete(Q)},peek(){return Y}};return X}function $1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function uY($){return $1($)?$.value:$}function lY($){let Y={};for(let Z in $)if(Object.prototype.hasOwnProperty.call($,Z))Y[Z]=g1($[Z]);return Y}function pY($){return g1($)}function B5($){let Y=typeof $==="function",Z=Y?$:$.get,X=Y?void 0:$.set,Q=Y?Object.is:$.equals||Object.is,J,G=!0,K=new Set,q=new Set,_=()=>{if(G=!0,q.size>0){let B=W.value;q.forEach((j)=>j(B))}};function U(){K.clear();let B=g0;g0=_,y9.push(_);try{return Z()}finally{y9.pop(),g0=B}}let W={get value(){if(g0){let B=W5.get(W);if(!B)B=new Set,W5.set(W,B);B.add(g0)}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=Z(),G=!1;return J},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return W}function cY($,Y,Z={}){let{immediate:X=!1,deep:Q=!1,flush:J="pre",once:G=!1}=Z,K,q=!0,_=!1,U=()=>{if($1($))return Q?H1($.value):$.value;return $()},W=()=>{if(!q||_)return;let z=U();if(K!==void 0&&Object.is(K,z)&&!Q)return;let O=()=>{if(Y(z,K),K=Q?H1(z):z,G)j()};if(J==="sync")O();else if(J==="post")queueMicrotask(O);else Promise.resolve().then(O)},B=null;if($1($))B=$.subscribe(()=>W());else B=B5($).subscribe(()=>W());if(X)K=void 0,W();else K=U();let j=()=>{if(q=!1,B)B(),B=null};return j.pause=()=>{_=!0},j.resume=()=>{_=!1},j}function iY($,Y,Z={}){let{immediate:X=!1,once:Q=!1}=Z,J=$.map((W)=>$1(W)?W.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let W=$.map((B)=>$1(B)?B.value:void 0);if(Y(W,J),J=[...W],Q)U()},_=$.map((W)=>{if($1(W))return W.subscribe(()=>q());return()=>{}});if(X)q();let U=()=>{G=!1,_.forEach((W)=>W())};return U.pause=()=>{K=!0},U.resume=()=>{K=!1},U}function nY($,Y={}){let{flush:Z="pre"}=Y,X,Q=!0,J=!1,G=()=>{if(!Q||J)return;if(X)X();let q=g0;g0=G,y9.push(G);try{X=$()}finally{y9.pop(),g0=q}};if(Z==="sync")G();else if(Z==="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 oY($,Y={},Z){let X=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(X,(Q,J,G)=>{try{let q=Function(...Object.keys(Y),`return ${G}`)(...Object.values(Y));return Y[J]=q,`<!-- computed: ${J} = ${q} -->`}catch(K){return`<!-- computed error: ${J} - ${K} -->`}})}function sY($,Y={},Z){let X=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(X,(Q,J,G)=>{return`
10189
10194
  <script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
10190
10195
  (function() {
10191
10196
  // Watch implementation for ${J}
@@ -10197,9 +10202,9 @@ else {
10197
10202
  }
10198
10203
  })();
10199
10204
  </script>
10200
- `})}function O1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Z)=>O1(Z));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Z=new Map;return $.forEach((X,Q)=>Z.set(O1(Q),O1(X))),Z}if($ instanceof Set){let Z=new Set;return $.forEach((X)=>Z.add(O1(X))),Z}let Y={};for(let Z in $)if(Object.prototype.hasOwnProperty.call($,Z))Y[Z]=O1($[Z]);return Y}function sY($,Y=100){let Z=f1($()),X=null,Q=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{Z.value=$()},Y)};return B5($).subscribe(()=>Q()),{get value(){return Z.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}function rY($,Y=100){let Z=f1($()),X=0,Q=()=>{let G=Date.now();if(G-X>=Y)X=G,Z.value=$()};return B5($).subscribe(()=>Q()),{get value(){return Z.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}var g0=null,y9,W5,EU;var tY=b(()=>{y9=[],W5=new WeakMap;EU={ref:f1,computed:B5,watch:pY,watchMultiple:cY,watchEffect:iY,isRef:e0,unref:mY,toRefs:uY,shallowRef:lY,debouncedComputed:sY,throttledComputed:rY,processComputedDirectives:nY,processWatchDirectives:oY}});var ZZ={};r(ZZ,{v:()=>DU,processHasErrorsDirective:()=>YZ,processFormValidationDirectives:()=>SU,processErrorsDirective:()=>$Z,processErrorDirective:()=>eY,defineForm:()=>kU,Validator:()=>g1});class g1{rules=[];defaultValue="";addRule($){let Y=new g1;return Y.rules=[...this.rules,$],Y.defaultValue=this.defaultValue,Y}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(Y)=>{if(Y===null||Y===void 0)return $;if(typeof Y==="string"&&Y.trim()==="")return $;if(Array.isArray(Y)&&Y.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(Y)=>{if(!Y)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(Y))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(Y)=>{if(!Y)return!0;try{return new URL(String(Y)),!0}catch{return $}}})}min($,Y){let Z=Y||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Z,validate:(X)=>{if(!X)return!0;return String(X).length>=$||Z}})}max($,Y){let Z=Y||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Z,validate:(X)=>{if(!X)return!0;return String(X).length<=$||Z}})}length($,Y,Z){let X=Z||`Must be between ${$} and ${Y} characters`;return this.addRule({name:"length",message:X,validate:(Q)=>{if(!Q)return!0;let J=String(Q).length;return J>=$&&J<=Y||X}})}pattern($,Y="Invalid format"){return this.addRule({name:"pattern",message:Y,validate:(Z)=>{if(!Z)return!0;return $.test(String(Z))||Y}})}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:(Y)=>{if(!Y)return!0;return!String(Y).includes(" ")||$}})}number($="Must be a number"){let Y=this.addRule({name:"number",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return!Number.isNaN(Number(Z))||$}});return Y.defaultValue=0,Y}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number.isInteger(Number(Y))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)<0||$}})}minValue($,Y){let Z=Y||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Z,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)>=$||Z}})}maxValue($,Y){let Z=Y||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Z,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)<=$||Z}})}between($,Y,Z){let X=Z||`Must be between ${$} and ${Y}`;return this.addRule({name:"between",message:X,validate:(Q)=>{if(!Q&&Q!==0)return!0;let J=Number(Q);return J>=$&&J<=Y||X}})}matches($,Y){let Z=Y||`Must match ${$}`;return this.addRule({name:"matches",message:Z,validate:(X,Q)=>{if(!Q)return!0;return X===Q[$]||Z}})}oneOf($,Y){let Z=Y||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Z,validate:(X)=>{if(!X)return!0;return $.includes(X)||Z}})}notOneOf($,Y){let Z=Y||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Z,validate:(X)=>{if(!X)return!0;return!$.includes(X)||Z}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Y)=>{if(!Y)return!0;let Z=new Date(String(Y));return!Number.isNaN(Z.getTime())||$}})}before($,Y){let Z=new Date($),X=Y||`Must be before ${Z.toLocaleDateString()}`;return this.addRule({name:"before",message:X,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))<Z||X}})}after($,Y){let Z=new Date($),X=Y||`Must be after ${Z.toLocaleDateString()}`;return this.addRule({name:"after",message:X,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))>Z||X}})}custom($,Y="Invalid value"){return this.addRule({name:"custom",message:Y,validate:$})}async($,Y="Invalid value"){return this.addRule({name:"async",message:Y,async:!0,validate:$})}when($,Y){let Z=new g1;Z.rules=[...this.rules],Z.defaultValue=this.defaultValue;for(let X of Y.getRules())Z.rules.push({...X,validate:(Q,J)=>{if(!$(Q,J||{}))return!0;return X.validate(Q,J)}});return Z}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Y=new g1;return Y.rules=[...this.rules],Y.defaultValue=$,Y}async validate($,Y){let Z=[];for(let X of this.rules){let Q=await X.validate($,Y);if(Q!==!0)Z.push(Q)}return Z}validateSync($,Y){let Z=[];for(let X of this.rules){if(X.async)continue;let Q=X.validate($,Y);if(Q!==!0)Z.push(Q)}return Z}}function kU($,Y){let Z=Object.keys($),X={},Q={},J={},G={},K={};for(let H of Z)X[H]=Y?.[H]??$[H].getDefaultValue(),Q[H]=[],J[H]=!1,G[H]=!1,K[H]=!1;let q=!1;async function _(H){K[H]=!0;let V=await $[H].validate(X[H],X);return Q[H]=V,K[H]=!1,V.length===0}async function U(){q=!0;let H=await Promise.all(Z.map(_));return q=!1,H.every(Boolean)}function W(){for(let H of Z)X[H]=Y?.[H]??$[H].getDefaultValue(),Q[H]=[],J[H]=!1,G[H]=!1}function B(H){for(let V of Z)if(V in H)X[V]=H[V],G[V]=!0}function j(H,V){X[H]=V,G[H]=!0}function z(H,V=!0){if(J[H]=V,V)_(H)}function O(H){return{value:X[H],errors:Q[H],touched:J[H],dirty:G[H],valid:Q[H].length===0,validating:K[H]}}function L(H){return async(V)=>{V?.preventDefault?.();for(let R of Z)J[R]=!0;if(await U())await H(X)}}return{values:X,errors:Q,touched:J,dirty:G,get isValid(){return Z.every((H)=>Q[H].length===0)},get isValidating(){return q||Z.some((H)=>K[H])},get isDirty(){return Z.some((H)=>G[H])},validate:U,validateField:_,reset:W,setValues:B,setFieldValue:j,setFieldTouched:z,getFieldState:O,handleSubmit:L}}function eY($,Y,Z){let X=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Y;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let _=q;if(!_||!Array.isArray(_)||_.length===0)return"";return _.map((U)=>{return G.replace(/\{\{\s*message\s*\}\}/g,U)}).join(`
10201
- `)}catch{return""}})}function $Z($,Y,Z){let X=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Y;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let _=q;if(!_||!Array.isArray(_)||_.length===0)return"";return _.map((U)=>G.replace(/\{\{\s*message\s*\}\}/g,U)).join(`
10202
- `)}catch{return""}})}function YZ($,Y,Z){let X=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Y;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let _=q;if(!_||!Array.isArray(_)||_.length===0)return"";return G}catch{return""}})}function SU($,Y,Z){let X=$;return X=eY(X,Y,Z),X=$Z(X,Y,Z),X=YZ(X,Y,Z),X}var DU;var XZ=b(()=>{DU=new g1});var GZ={};r(GZ,{processXElementDirectives:()=>bU,hasXElementDirectives:()=>QZ,generateXElementRuntime:()=>JZ});function JZ(){return`<script data-stx-scoped>
10205
+ `})}function H1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Z)=>H1(Z));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Z=new Map;return $.forEach((X,Q)=>Z.set(H1(Q),H1(X))),Z}if($ instanceof Set){let Z=new Set;return $.forEach((X)=>Z.add(H1(X))),Z}let Y={};for(let Z in $)if(Object.prototype.hasOwnProperty.call($,Z))Y[Z]=H1($[Z]);return Y}function rY($,Y=100){let Z=g1($()),X=null,Q=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{Z.value=$()},Y)};return B5($).subscribe(()=>Q()),{get value(){return Z.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}function aY($,Y=100){let Z=g1($()),X=0,Q=()=>{let G=Date.now();if(G-X>=Y)X=G,Z.value=$()};return B5($).subscribe(()=>Q()),{get value(){return Z.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}var g0=null,y9,W5,SU;var eY=S(()=>{y9=[],W5=new WeakMap;SU={ref:g1,computed:B5,watch:cY,watchMultiple:iY,watchEffect:nY,isRef:$1,unref:uY,toRefs:lY,shallowRef:pY,debouncedComputed:rY,throttledComputed:aY,processComputedDirectives:oY,processWatchDirectives:sY}});var XZ={};r(XZ,{v:()=>yU,processHasErrorsDirective:()=>ZZ,processFormValidationDirectives:()=>CU,processErrorsDirective:()=>YZ,processErrorDirective:()=>$Z,defineForm:()=>PU,Validator:()=>h1});class h1{rules=[];defaultValue="";addRule($){let Y=new h1;return Y.rules=[...this.rules,$],Y.defaultValue=this.defaultValue,Y}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(Y)=>{if(Y===null||Y===void 0)return $;if(typeof Y==="string"&&Y.trim()==="")return $;if(Array.isArray(Y)&&Y.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(Y)=>{if(!Y)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(Y))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(Y)=>{if(!Y)return!0;try{return new URL(String(Y)),!0}catch{return $}}})}min($,Y){let Z=Y||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Z,validate:(X)=>{if(!X)return!0;return String(X).length>=$||Z}})}max($,Y){let Z=Y||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Z,validate:(X)=>{if(!X)return!0;return String(X).length<=$||Z}})}length($,Y,Z){let X=Z||`Must be between ${$} and ${Y} characters`;return this.addRule({name:"length",message:X,validate:(Q)=>{if(!Q)return!0;let J=String(Q).length;return J>=$&&J<=Y||X}})}pattern($,Y="Invalid format"){return this.addRule({name:"pattern",message:Y,validate:(Z)=>{if(!Z)return!0;return $.test(String(Z))||Y}})}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:(Y)=>{if(!Y)return!0;return!String(Y).includes(" ")||$}})}number($="Must be a number"){let Y=this.addRule({name:"number",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return!Number.isNaN(Number(Z))||$}});return Y.defaultValue=0,Y}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number.isInteger(Number(Y))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)<0||$}})}minValue($,Y){let Z=Y||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Z,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)>=$||Z}})}maxValue($,Y){let Z=Y||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Z,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)<=$||Z}})}between($,Y,Z){let X=Z||`Must be between ${$} and ${Y}`;return this.addRule({name:"between",message:X,validate:(Q)=>{if(!Q&&Q!==0)return!0;let J=Number(Q);return J>=$&&J<=Y||X}})}matches($,Y){let Z=Y||`Must match ${$}`;return this.addRule({name:"matches",message:Z,validate:(X,Q)=>{if(!Q)return!0;return X===Q[$]||Z}})}oneOf($,Y){let Z=Y||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Z,validate:(X)=>{if(!X)return!0;return $.includes(X)||Z}})}notOneOf($,Y){let Z=Y||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Z,validate:(X)=>{if(!X)return!0;return!$.includes(X)||Z}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Y)=>{if(!Y)return!0;let Z=new Date(String(Y));return!Number.isNaN(Z.getTime())||$}})}before($,Y){let Z=new Date($),X=Y||`Must be before ${Z.toLocaleDateString()}`;return this.addRule({name:"before",message:X,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))<Z||X}})}after($,Y){let Z=new Date($),X=Y||`Must be after ${Z.toLocaleDateString()}`;return this.addRule({name:"after",message:X,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))>Z||X}})}custom($,Y="Invalid value"){return this.addRule({name:"custom",message:Y,validate:$})}async($,Y="Invalid value"){return this.addRule({name:"async",message:Y,async:!0,validate:$})}when($,Y){let Z=new h1;Z.rules=[...this.rules],Z.defaultValue=this.defaultValue;for(let X of Y.getRules())Z.rules.push({...X,validate:(Q,J)=>{if(!$(Q,J||{}))return!0;return X.validate(Q,J)}});return Z}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Y=new h1;return Y.rules=[...this.rules],Y.defaultValue=$,Y}async validate($,Y){let Z=[];for(let X of this.rules){let Q=await X.validate($,Y);if(Q!==!0)Z.push(Q)}return Z}validateSync($,Y){let Z=[];for(let X of this.rules){if(X.async)continue;let Q=X.validate($,Y);if(Q!==!0)Z.push(Q)}return Z}}function PU($,Y){let Z=Object.keys($),X={},Q={},J={},G={},K={};for(let H of Z)X[H]=Y?.[H]??$[H].getDefaultValue(),Q[H]=[],J[H]=!1,G[H]=!1,K[H]=!1;let q=!1;async function _(H){K[H]=!0;let V=await $[H].validate(X[H],X);return Q[H]=V,K[H]=!1,V.length===0}async function U(){q=!0;let H=await Promise.all(Z.map(_));return q=!1,H.every(Boolean)}function W(){for(let H of Z)X[H]=Y?.[H]??$[H].getDefaultValue(),Q[H]=[],J[H]=!1,G[H]=!1}function B(H){for(let V of Z)if(V in H)X[V]=H[V],G[V]=!0}function j(H,V){X[H]=V,G[H]=!0}function z(H,V=!0){if(J[H]=V,V)_(H)}function O(H){return{value:X[H],errors:Q[H],touched:J[H],dirty:G[H],valid:Q[H].length===0,validating:K[H]}}function L(H){return async(V)=>{V?.preventDefault?.();for(let R of Z)J[R]=!0;if(await U())await H(X)}}return{values:X,errors:Q,touched:J,dirty:G,get isValid(){return Z.every((H)=>Q[H].length===0)},get isValidating(){return q||Z.some((H)=>K[H])},get isDirty(){return Z.some((H)=>G[H])},validate:U,validateField:_,reset:W,setValues:B,setFieldValue:j,setFieldTouched:z,getFieldState:O,handleSubmit:L}}function $Z($,Y,Z){let X=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Y;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let _=q;if(!_||!Array.isArray(_)||_.length===0)return"";return _.map((U)=>{return G.replace(/\{\{\s*message\s*\}\}/g,U)}).join(`
10206
+ `)}catch{return""}})}function YZ($,Y,Z){let X=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Y;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let _=q;if(!_||!Array.isArray(_)||_.length===0)return"";return _.map((U)=>G.replace(/\{\{\s*message\s*\}\}/g,U)).join(`
10207
+ `)}catch{return""}})}function ZZ($,Y,Z){let X=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Y;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let _=q;if(!_||!Array.isArray(_)||_.length===0)return"";return G}catch{return""}})}function CU($,Y,Z){let X=$;return X=$Z(X,Y,Z),X=YZ(X,Y,Z),X=ZZ(X,Y,Z),X}var yU;var JZ=S(()=>{yU=new h1});var KZ={};r(KZ,{processXElementDirectives:()=>vU,hasXElementDirectives:()=>GZ,generateXElementRuntime:()=>QZ});function QZ(){return`<script data-stx-scoped>
10203
10208
  (function() {
10204
10209
  'use strict';
10205
10210
 
@@ -10483,30 +10488,30 @@ else {
10483
10488
  // Expose for manual initialization
10484
10489
  window.XElement = XElement;
10485
10490
  })();
10486
- </script>`}function QZ($){return/\bx-(data|model|text|show|init|html)\b/.test($)||/\s:[a-z]/.test($)}function bU($){if(!QZ($))return $;let Y=JZ(),Z=$.lastIndexOf("</body>");if(Z!==-1)return $.slice(0,Z)+Y+`
10491
+ </script>`}function GZ($){return/\bx-(data|model|text|show|init|html)\b/.test($)||/\s:[a-z]/.test($)}function vU($){if(!GZ($))return $;let Y=QZ(),Z=$.lastIndexOf("</body>");if(Z!==-1)return $.slice(0,Z)+Y+`
10487
10492
  `+$.slice(Z);return $+`
10488
- `+Y}var qZ={};r(qZ,{validateClientScript:()=>S9,processOnceDirective:()=>k9,processJsonDirective:()=>D9,processDirectives:()=>E5,injectRouterScript:()=>M8});import M0 from"path";function yU($,Y){let Z=$.length,X=Y,Q=!0,J=[],G=(K)=>K+9<=Z&&$[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<Z){let K=$[X];if(G(X))return X;if(K==="/"&&$[X+1]==="/"){if(X=$.indexOf(`
10493
+ `+Y}var UZ={};r(UZ,{validateClientScript:()=>b9,processOnceDirective:()=>k9,processJsonDirective:()=>D9,processDirectives:()=>E5,injectRouterScript:()=>I8});import M0 from"path";function xU($,Y){let Z=$.length,X=Y,Q=!0,J=[],G=(K)=>K+9<=Z&&$[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<Z){let K=$[X];if(G(X))return X;if(K==="/"&&$[X+1]==="/"){if(X=$.indexOf(`
10489
10494
  `,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,_=!1;while(q<Z){let U=$[q];if(U==="\\"){q+=2;continue}if(U==="[")_=!0;else if(U==="]")_=!1;else if(U==="/"&&!_){q++;break}else if(U===`
10490
10495
  `){q=-1;break}q++}if(q===-1){X++,Q=!1;continue}while(q<Z&&/[a-z]/.test($[q]))q++;X=q,Q=!1;continue}if(K==="'"||K==='"'){let q=K;X++;while(X<Z){if($[X]==="\\"){X+=2;continue}if($[X]===q){X++;break}if($[X]===`
10491
- `)break;X++}Q=!1;continue}if(K==="`"){X++;while(X<Z){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<Z){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 E5($,Y,Z,X,Q){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;let J=!Y.__stxProcessingDepth;if(!Y.__stxProcessingDepth)Y.__stxProcessingDepth=0;if(Y.__stxProcessingDepth++,!Y.__onceStore)Y.__onceStore=new Set;try{return await Q3.timeAsync("template-processing",async()=>{let G=await PU($,Y,Z,X,Q);if(J)G=Z7(G);if(J&&X.autoShell&&X.buildMode!=="compile"){let K=X.app?.head||{},_=(Y.__stx_runtime_head||null)??n1(),U={...K,..._.title&&{title:_.title},meta:[...K.meta||[],..._.meta||[]],link:[...K.link||[],..._.link||[]],script:[...K.script||[],..._.script||[]],..._.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},..._.htmlAttrs}},..._.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},..._.bodyAttrs}}};G=R8(G,U);let W=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(W&&G.includes("<head")){let j=W[1];G=G.replace("<head>",`<head>
10492
- <meta name="stx-layout" content="${j}">`)}let B=G.match(/function (__stx_setup_\d+_\d+)\(/);if(B&&G.includes("<body")&&!G.match(/<body[^>]*data-stx=/)){G=G.replace(/<body([^>]*)>/,`<body$1 data-stx="${B[1]}">`);let j=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${B[1]}"`,"i");G=G.replace(j,"$1")}}if(J)try{let{getStoreScript:K}=await Promise.resolve().then(() => (ZY(),YY)),q=X.storesDir,_=await K(q);if(_){let U=`<script data-stx-stores>${_}</script>`,W=G.indexOf("<script data-stx-scoped>");if(W!==-1){let B=G.indexOf("</script>",W+24);if(B!==-1){let j=B+9;G=G.slice(0,j)+`
10493
- `+U+G.slice(j)}}}}catch{}if(J&&Y.__stx_inject_css!==!1)G=await s6(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof Y9)throw G;let K=G instanceof Error?G.message:String(G),q=new W1(`Template processing failed: ${K}`,Z,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(b0.log(q,{filePath:Z,context:Y}),l$.logDetailedError(q,{filePath:Z,template:$.substring(0,500)}),X.debug)throw q;return m$.createFallbackContent("Template Processing",q)}}async function PU($,Y,Z,X,Q){let J=process.cwd(),G={...X,partialsDir:X.partialsDir&&!M0.isAbsolute(X.partialsDir)?M0.resolve(J,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!M0.isAbsolute(X.componentsDir)?M0.resolve(J,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!M0.isAbsolute(X.layoutsDir)?M0.resolve(J,X.layoutsDir):X.layoutsDir},K=G,q=$;q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let _="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,_),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(O,L)=>{return`{{ ${L} }}`}),q=H8(q),q=await a8(q,Z,Q);let U={};q=O4(q,U);let W={...Y.__sections||{}},B="",j=/@nolayout\b/.test(q);if(j)q=q.replace(/@nolayout\b\s*/g,"");let z=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(z)B=z[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!B&&!j&&K.defaultLayout){let O=/<!DOCTYPE\s/i.test(q),L=/@section\s*\(/.test(q);if(!O||L){let F="",H=M0.dirname(Z),V=K.layoutsDir?M0.dirname(K.layoutsDir):process.cwd();for(let N=0;N<20;N++){let R=M0.join(H,"_layout.stx");if(await c(R)){F=R;break}let A=M0.dirname(H);if(A===H||A.length<V.length)break;H=A}if(F)B=F;else if(K.layoutsDir){let N=M0.isAbsolute(K.layoutsDir)?K.layoutsDir:M0.resolve(process.cwd(),K.layoutsDir),R=M0.join(N,`${K.defaultLayout}.stx`);if(await c(R))B=R}if(B&&!L)q=`@section('content')
10496
+ `)break;X++}Q=!1;continue}if(K==="`"){X++;while(X<Z){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<Z){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 E5($,Y,Z,X,Q){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;let J=!Y.__stxProcessingDepth;if(!Y.__stxProcessingDepth)Y.__stxProcessingDepth=0;if(Y.__stxProcessingDepth++,!Y.__onceStore)Y.__onceStore=new Set;try{return await Q3.timeAsync("template-processing",async()=>{let G=await fU($,Y,Z,X,Q);if(J)G=Z7(G);if(J&&X.autoShell&&X.buildMode!=="compile"){let K=X.app?.head||{},_=(Y.__stx_runtime_head||null)??o1(),U={...K,..._.title&&{title:_.title},meta:[...K.meta||[],..._.meta||[]],link:[...K.link||[],..._.link||[]],script:[...K.script||[],..._.script||[]],..._.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},..._.htmlAttrs}},..._.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},..._.bodyAttrs}}};G=N8(G,U);let W=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(W&&G.includes("<head")){let j=W[1];G=G.replace("<head>",`<head>
10497
+ <meta name="stx-layout" content="${j}">`)}let B=G.match(/function (__stx_setup_\d+_\d+)\(/);if(B&&G.includes("<body")&&!G.match(/<body[^>]*data-stx=/)){G=G.replace(/<body([^>]*)>/,`<body$1 data-stx="${B[1]}">`);let j=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${B[1]}"`,"i");G=G.replace(j,"$1")}}if(J)try{let{getStoreScript:K}=await Promise.resolve().then(() => (XY(),ZY)),q=X.storesDir,_=await K(q);if(_){let U=`<script data-stx-stores>${_}</script>`,W=G.indexOf("<script data-stx-scoped>");if(W!==-1){let B=G.indexOf("</script>",W+24);if(B!==-1){let j=B+9;G=G.slice(0,j)+`
10498
+ `+U+G.slice(j)}}}}catch{}if(J&&Y.__stx_inject_css!==!1)G=await s6(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof Y9)throw G;let K=G instanceof Error?G.message:String(G),q=new W1(`Template processing failed: ${K}`,Z,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(S0.log(q,{filePath:Z,context:Y}),l$.logDetailedError(q,{filePath:Z,template:$.substring(0,500)}),X.debug)throw q;return m$.createFallbackContent("Template Processing",q)}}async function fU($,Y,Z,X,Q){let J=process.cwd(),G={...X,partialsDir:X.partialsDir&&!M0.isAbsolute(X.partialsDir)?M0.resolve(J,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!M0.isAbsolute(X.componentsDir)?M0.resolve(J,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!M0.isAbsolute(X.layoutsDir)?M0.resolve(J,X.layoutsDir):X.layoutsDir},K=G,q=$;q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let _="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,_),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(O,L)=>{return`{{ ${L} }}`}),q=L8(q),q=await t8(q,Z,Q);let U={};q=O4(q,U);let W={...Y.__sections||{}},B="",j=/@nolayout\b/.test(q);if(j)q=q.replace(/@nolayout\b\s*/g,"");let z=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(z)B=z[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!B&&!j&&K.defaultLayout){let O=/<!DOCTYPE\s/i.test(q),L=/@section\s*\(/.test(q);if(!O||L){let F="",H=M0.dirname(Z),V=K.layoutsDir?M0.dirname(K.layoutsDir):process.cwd();for(let N=0;N<20;N++){let R=M0.join(H,"_layout.stx");if(await c(R)){F=R;break}let A=M0.dirname(H);if(A===H||A.length<V.length)break;H=A}if(F)B=F;else if(K.layoutsDir){let N=M0.isAbsolute(K.layoutsDir)?K.layoutsDir:M0.resolve(process.cwd(),K.layoutsDir),R=M0.join(N,`${K.defaultLayout}.stx`);if(await c(R))B=R}if(B&&!L)q=`@section('content')
10494
10499
  ${q.trim()}
10495
- @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,L,F)=>{return W[L]=F,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,L,F)=>{if(F.includes("@parent"))W[L]=F.replace("@parent",H1);else W[L]=F.trim();return""}),Y.__sections=W,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,L,F)=>{return W[L]||F||""}),!("slot"in Y)||Y.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return W.content||""});if(q=H4(q,U),B)try{let O=M0.isAbsolute(B)?B:await I1(()=>X$(B,Z,G,Q),null,()=>{throw new W1(`Failed to resolve layout path: ${B}`,Z,void 0,void 0,`Layout referenced from ${Z}`)});if(!O){let R=`Layout not found: ${B} (referenced from ${Z})`;if(b0.log(Error(R),{layoutPath:B,filePath:Z},"warning"),G.debug)throw new W1(R,Z);return q}let L=await I1(()=>Bun.file(O).text(),"",()=>{throw new W1(`Failed to read layout file: ${O}`,Z,void 0,void 0,"Layout content could not be loaded")}),F=L.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F){if(G.debug)console.log(`Found nested layout: ${F[1]} in ${O}`);let R={},A=L.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(I,M,E)=>{return R[M]=E.trim(),""});for(let[I,M]of Object.entries(R))if(W[I]&&W[I].includes(H1)){let E=W[I].indexOf(H1);W[I]=W[I].slice(0,E)+M+W[I].slice(E+H1.length)}else if(!W[I])W[I]=M;let w={...Y,__sections:W},T=`@layout('${F[1]}')${A}`;return await E5(T,w,O,G,Q)}let H=L.replace(/\{\{--[\s\S]*?--\}\}/g,""),V=O4(H,U),N={};return V=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(R,A,w)=>{return N[A]=w.trim(),`@slot('${A}')`}),V=V.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(R,A,w)=>{if(W[A]){let T=W[A];if(T.includes(H1)){let I=N[A]||"",M=T.indexOf(H1);T=T.slice(0,M)+I+T.slice(M+H1.length)}return T}return w||""}),V=V.replace(/\{\{\s*slot\s*\}\}/g,()=>{return W.content||""}),V=H4(V,U),Y.__originalFilePath=Z,q=await KZ(V,Y,O,G,Q),q=`<!-- stx-layout: ${B} -->
10496
- ${q}`,q}catch(O){return b0.log(O instanceof Error?O:Error(String(O)),{layoutPath:B,filePath:Z},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return await KZ(q,Y,Z,G,Q)}async function KZ($,Y,Z,X,Q){let J=$;Y.__stx_sfc_mode=!0;let G=X;if(await I1(()=>_8(Z,Y),void 0,(x)=>{b0.log(x,{filePath:Z,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${Z}: ${x.message}`)}),Y.__stx_options=G,G.buildMode)Y.__stx_buildMode=G.buildMode;let K=G.envPrefix||"STX_PUBLIC_",q={};for(let[x,d]of Object.entries(process.env))if(x.startsWith(K)&&d!==void 0)q[x]=d;Y.$env=q,J=await I1(()=>Q8(J,Y,Z,G),J,(x)=>{b0.log(x,{filePath:Z,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Z}: ${x.message}`)});let _=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,U;while((U=_.exec(J))!==null){let x=U[1],d=U[2];if(/\bserver\b/.test(x)&&d.trim())try{let{extractVariables:a}=await Promise.resolve().then(() => (r1(),I5));await a(d,Y,Z)}catch(a){let Z0=a instanceof Error?a:Error(String(a));b0.log(Z0,{filePath:Z,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Z}: ${Z0.message}`)}}try{let{interpolateScriptsInTemplate:x}=await Promise.resolve().then(() => (c0(),Z3));J=x(J,Y,{skipServer:!0})}catch(x){let d=x instanceof Error?x:Error(String(x));b0.log(d,{filePath:Z,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Z}: ${d.message}`)}if(J=await e2(J,Y,Z),J=await $8(J,Y,Z),J=await b2(J,Y,Z,G),A5(J))J=b4(J),J=y4(J,Y);J=W4(J,Y,Z,G),J=await Y7(J,Y,Z,G,Q),J=await F8(J,Y,Z,G,Q),J=x7(J,Y,Z,G);let{processDeferDirectives:W}=await Promise.resolve().then(() => JY);J=W(J,Y,Z);let{processTeleportDirectives:B}=await Promise.resolve().then(() => GY);J=B(J,Y,Z);let{processTransitionDirectives:j,processTransitionAttributes:z}=await Promise.resolve().then(() => _Y);J=j(J,Y,Z),J=z(J);let{processErrorBoundaryDirectives:O}=await Promise.resolve().then(() => BY);J=O(J,Y,Z);let{processSuspenseDirectives:L}=await Promise.resolve().then(() => zY);J=L(J,Y,Z);let{processAsyncDirectives:F}=await Promise.resolve().then(() => LY);J=F(J,Y,Z);let{processKeepAliveDirectives:H}=await Promise.resolve().then(() => VY);J=H(J,Y,Z);let{processVirtualListDirectives:V,processVirtualGridDirectives:N,processInfiniteListDirectives:R}=await Promise.resolve().then(() => (MY(),TY));J=V(J,Y,Z),J=N(J,Y,Z),J=R(J,Y,Z);let{processPartialHydrationDirectives:A,processStaticDirectives:w}=await Promise.resolve().then(() => (dY(),hY));J=A(J,Y,Z),J=w(J);let{processComputedDirectives:T,processWatchDirectives:I}=await Promise.resolve().then(() => (tY(),aY));J=T(J,Y,Z),J=I(J,Y,Z);let{processFormValidationDirectives:M}=await Promise.resolve().then(() => (XZ(),ZZ));J=M(J,Y,Z);let{processHeadDirective:E,processTitleDirective:D,processMetaDirective:P,resetHead:y}=await Promise.resolve().then(() => (o1(),e9));if(!Y.__stx_head_preset&&!Y.__stx_runtime_head)y();let S=E(J);if(J=S.content,J=D(J,Y),J=P(J,Y),J=q8(J),J=Z4(J,Y),J=k2(J),J=X8(J),J=await j4(J,Y,Z,G,Q),J=await Y7(J,Y,Z,G,Q),J=Z7(J),J=D1(J,Y,Z),J=X4(J,Y),J=J4(J,Y),J=z9(J,Y),J=x2(J,Y),J=f2(J,Y),J=await O2(J,Y,Z,G),J=await D3(J,Y,Z),J=await p2(J,Y,Z,G),J=k7(J,Y,Z,G),J=C6(J,Y,Z,G),J=v6(J,Y,Z),J=x6(J,Y,Z,G),J=I2(J,Y,Z,G),J=D9(J,Y),J=k9(J),J=e8(J),!G.skipEventDirectives)J=_2(J,Y,Z);if(J=j2(J,Y,Z),G.debug){let x=/\bx-data\s*=/.test(J),d=M9($);if(x&&d)console.warn(`[stx] ${Z}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
10500
+ @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,L,F)=>{return W[L]=F,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,L,F)=>{if(F.includes("@parent"))W[L]=F.replace("@parent",L1);else W[L]=F.trim();return""}),Y.__sections=W,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,L,F)=>{return W[L]||F||""}),!("slot"in Y)||Y.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return W.content||""});if(q=H4(q,U),B)try{let O=M0.isAbsolute(B)?B:await D1(()=>X$(B,Z,G,Q),null,()=>{throw new W1(`Failed to resolve layout path: ${B}`,Z,void 0,void 0,`Layout referenced from ${Z}`)});if(!O){let R=`Layout not found: ${B} (referenced from ${Z})`;if(S0.log(Error(R),{layoutPath:B,filePath:Z},"warning"),G.debug)throw new W1(R,Z);return q}let L=await D1(()=>Bun.file(O).text(),"",()=>{throw new W1(`Failed to read layout file: ${O}`,Z,void 0,void 0,"Layout content could not be loaded")}),F=L.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F){if(G.debug)console.log(`Found nested layout: ${F[1]} in ${O}`);let R={},A=L.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(I,M,E)=>{return R[M]=E.trim(),""});for(let[I,M]of Object.entries(R))if(W[I]&&W[I].includes(L1)){let E=W[I].indexOf(L1);W[I]=W[I].slice(0,E)+M+W[I].slice(E+L1.length)}else if(!W[I])W[I]=M;let w={...Y,__sections:W},T=`@layout('${F[1]}')${A}`;return await E5(T,w,O,G,Q)}let H=L.replace(/\{\{--[\s\S]*?--\}\}/g,""),V=O4(H,U),N={};return V=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(R,A,w)=>{return N[A]=w.trim(),`@slot('${A}')`}),V=V.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(R,A,w)=>{if(W[A]){let T=W[A];if(T.includes(L1)){let I=N[A]||"",M=T.indexOf(L1);T=T.slice(0,M)+I+T.slice(M+L1.length)}return T}return w||""}),V=V.replace(/\{\{\s*slot\s*\}\}/g,()=>{return W.content||""}),V=H4(V,U),Y.__originalFilePath=Z,q=await qZ(V,Y,O,G,Q),q=`<!-- stx-layout: ${B} -->
10501
+ ${q}`,q}catch(O){return S0.log(O instanceof Error?O:Error(String(O)),{layoutPath:B,filePath:Z},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return await qZ(q,Y,Z,G,Q)}async function qZ($,Y,Z,X,Q){let J=$;Y.__stx_sfc_mode=!0;let G=X;if(await D1(()=>W8(Z,Y),void 0,(x)=>{S0.log(x,{filePath:Z,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${Z}: ${x.message}`)}),Y.__stx_options=G,G.buildMode)Y.__stx_buildMode=G.buildMode;let K=G.envPrefix||"STX_PUBLIC_",q={};for(let[x,d]of Object.entries(process.env))if(x.startsWith(K)&&d!==void 0)q[x]=d;Y.$env=q,J=await D1(()=>G8(J,Y,Z,G),J,(x)=>{S0.log(x,{filePath:Z,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Z}: ${x.message}`)});let _=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,U;while((U=_.exec(J))!==null){let x=U[1],d=U[2];if(/\bserver\b/.test(x)&&d.trim())try{let{extractVariables:a}=await Promise.resolve().then(() => (r1(),I5));await a(d,Y,Z)}catch(a){let Z0=a instanceof Error?a:Error(String(a));S0.log(Z0,{filePath:Z,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Z}: ${Z0.message}`)}}try{let{interpolateScriptsInTemplate:x}=await Promise.resolve().then(() => (i0(),Z3));J=x(J,Y,{skipServer:!0})}catch(x){let d=x instanceof Error?x:Error(String(x));S0.log(d,{filePath:Z,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Z}: ${d.message}`)}if(J=await $8(J,Y,Z),J=await Y8(J,Y,Z),J=await S2(J,Y,Z,G),A5(J))J=S4(J),J=y4(J,Y);J=W4(J,Y,Z,G),J=await Y7(J,Y,Z,G,Q),J=await V8(J,Y,Z,G,Q),J=x7(J,Y,Z,G);let{processDeferDirectives:W}=await Promise.resolve().then(() => QY);J=W(J,Y,Z);let{processTeleportDirectives:B}=await Promise.resolve().then(() => KY);J=B(J,Y,Z);let{processTransitionDirectives:j,processTransitionAttributes:z}=await Promise.resolve().then(() => WY);J=j(J,Y,Z),J=z(J);let{processErrorBoundaryDirectives:O}=await Promise.resolve().then(() => zY);J=O(J,Y,Z);let{processSuspenseDirectives:L}=await Promise.resolve().then(() => jY);J=L(J,Y,Z);let{processAsyncDirectives:F}=await Promise.resolve().then(() => FY);J=F(J,Y,Z);let{processKeepAliveDirectives:H}=await Promise.resolve().then(() => RY);J=H(J,Y,Z);let{processVirtualListDirectives:V,processVirtualGridDirectives:N,processInfiniteListDirectives:R}=await Promise.resolve().then(() => (IY(),MY));J=V(J,Y,Z),J=N(J,Y,Z),J=R(J,Y,Z);let{processPartialHydrationDirectives:A,processStaticDirectives:w}=await Promise.resolve().then(() => (mY(),dY));J=A(J,Y,Z),J=w(J);let{processComputedDirectives:T,processWatchDirectives:I}=await Promise.resolve().then(() => (eY(),tY));J=T(J,Y,Z),J=I(J,Y,Z);let{processFormValidationDirectives:M}=await Promise.resolve().then(() => (JZ(),XZ));J=M(J,Y,Z);let{processHeadDirective:E,processTitleDirective:D,processMetaDirective:P,resetHead:y}=await Promise.resolve().then(() => (s1(),e9));if(!Y.__stx_head_preset&&!Y.__stx_runtime_head)y();let b=E(J);if(J=b.content,J=D(J,Y),J=P(J,Y),J=U8(J),J=Z4(J,Y),J=k2(J),J=J8(J),J=await j4(J,Y,Z,G,Q),J=await Y7(J,Y,Z,G,Q),J=Z7(J),J=z1(J,Y,Z),J=X4(J,Y),J=J4(J,Y),J=z9(J,Y),J=x2(J,Y),J=f2(J,Y),J=await O2(J,Y,Z,G),J=await D3(J,Y,Z),J=await p2(J,Y,Z,G),J=k7(J,Y,Z,G),J=C6(J,Y,Z,G),J=v6(J,Y,Z),J=x6(J,Y,Z,G),J=I2(J,Y,Z,G),J=D9(J,Y),J=k9(J),J=$Y(J),!G.skipEventDirectives)J=_2(J,Y,Z);if(J=j2(J,Y,Z),G.debug){let x=/\bx-data\s*=/.test(J),d=M9($);if(x&&d)console.warn(`[stx] ${Z}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
10497
10502
  Both work on the same page, but they manage separate scopes.
10498
- Prefer signals (state/derived/effect) for new components.`)}J=z8(J,Y),J=await Q1(J,Y,Z),J=$Y(J),J=Y2(J);let{processXElementDirectives:k}=await Promise.resolve().then(() => GZ);if(J=k(J),J=await P4(J,G,Z),J=await G8(J,Y,Z,G),G.seo?.enabled)J=f6(J,Y,G);let{renderHead:g,getHead:h}=await Promise.resolve().then(() => (o1(),e9)),n=Y.__stx_runtime_head,_0=n&&(n.title||n.meta?.length||n.link?.length)?n:h();if(_0.title||_0.meta?.length||_0.link?.length){let x=g(_0);if(x){if(J.includes("</head>"))J=J.replace("</head>",`${x}
10503
+ Prefer signals (state/derived/effect) for new components.`)}J=j8(J,Y),J=await c0(J,Y,Z),J=YY(J),J=Y2(J);let{processXElementDirectives:k}=await Promise.resolve().then(() => KZ);if(J=k(J),J=await P4(J,G,Z),J=await K8(J,Y,Z,G),G.seo?.enabled)J=f6(J,Y,G);let{renderHead:g,getHead:h}=await Promise.resolve().then(() => (s1(),e9)),n=Y.__stx_runtime_head,_0=n&&(n.title||n.meta?.length||n.link?.length)?n:h();if(_0.title||_0.meta?.length||_0.link?.length){let x=g(_0);if(x){if(J.includes("</head>"))J=J.replace("</head>",`${x}
10499
10504
  </head>`);else if(J.includes("<head>"))J=J.replace("<head>",`<head>
10500
- ${x}`)}}if(S.headContent){if(J.includes("</head>"))J=J.replace("</head>",`${S.headContent}
10505
+ ${x}`)}}if(b.headContent){if(J.includes("</head>"))J=J.replace("</head>",`${b.headContent}
10501
10506
  </head>`);else if(J.includes("<head>"))J=J.replace("<head>",`<head>
10502
- ${S.headContent}`)}if(G.csp?.enabled&&G.csp.addMetaTag)J=M2(J,G.csp,Y);if(G.analytics?.enabled)J=X2(J,G);if(G.heatmap?.enabled)J=m7(J,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:x}=await Promise.resolve().then(() => (F5(),I7));J=x(J,G)}let w0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(J),q0=/\bSTX\.\w+/.test(J),k0=/window\.STX\s*=/.test(J);if(w0&&q0&&!k0){let d=`<script data-stx-scoped>
10507
+ ${b.headContent}`)}if(G.csp?.enabled&&G.csp.addMetaTag)J=M2(J,G.csp,Y);if(G.analytics?.enabled)J=X2(J,G);if(G.heatmap?.enabled)J=m7(J,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:x}=await Promise.resolve().then(() => (F5(),I7));J=x(J,G)}let w0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(J),q0=/\bSTX\.\w+/.test(J),k0=/window\.STX\s*=/.test(J);if(w0&&q0&&!k0){let d=`<script data-stx-scoped>
10503
10508
  ${a6()}
10504
- </script>`;if(J.includes("</head>")){let K0=J.indexOf("</head>"),Z0=J.slice(0,K0).indexOf("<script");if(Z0!==-1){let F0=J.slice(0,Z0),F1=J.slice(Z0);J=F0+d+`
10505
- `+F1}else J=J.replace("</head>",`${d}
10509
+ </script>`;if(J.includes("</head>")){let K0=J.indexOf("</head>"),Z0=J.slice(0,K0).indexOf("<script");if(Z0!==-1){let F0=J.slice(0,Z0),V1=J.slice(Z0);J=F0+d+`
10510
+ `+V1}else J=J.replace("</head>",`${d}
10506
10511
  </head>`)}else if(J.includes("<body"))J=J.replace(/<body([^>]*)>/,`<body$1>
10507
10512
  ${d}`);else J=d+`
10508
- `+J}{let x=/<script\s+server\b[^>]*>/gi,d,K0=[];while((d=x.exec(J))!==null){let a=d.index+d[0].length,Z0=yU(J,a);if(Z0===-1)continue;let F0=Z0+9;while(F0<J.length&&/\s/.test(J[F0]))F0++;K0.push({start:d.index,end:F0})}for(let a=K0.length-1;a>=0;a--){let{start:Z0,end:F0}=K0[a];J=J.substring(0,Z0)+J.substring(F0)}}let y0=w5(J,Z);if(y0.hasScoped)J=y0.html;let O0=Y.__stx_event_bindings||[],C=!1,v=[],f=/\s:[a-z][\w.-]*\s*=/.test(J),{scanScriptTags:p}=await Promise.resolve().then(() => (C4(),y8));for(let x of p(J,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}))v.push({match:x.fullMatch,attrs:x.attrs,content:x.body});for(let{match:x,attrs:d,content:K0}of v){C=!0;let a=K0;S9(K0,Z,X.strict);let Z0=await V5(K0,{eventBindings:O0,attrs:d,hasColonDirectives:f,templateContent:$,filePath:Z,projectRoot:process.cwd(),production:X.buildMode==="compile"});J=J.replace(x,()=>Z0)}if(C)Y.__stx_event_bindings=[];return J}var H1="<!--PARENT_CONTENT_PLACEHOLDER-->";var J$=b(()=>{r6();m9();t6();Z2();J2();p9();u9();W2();n9();H2();_9();E2();S2();P2();u0();o1();c0();g2();c2();t2();Z8();B4();Q$();K8();w1();U8();p$();H0();W8();j8();L8();V8();t9();C4();o8();t8();X7();J7();X7();J7()});import gU from"fs";import K7 from"path";import LZ from"fs";import h0 from"path";var W7=[72,96,128,144,152,192,384,512],B7=[120,152,167,180],z7=[16,32];async function j7($,Y){let Z={success:!0,generatedFiles:[],errors:[],warnings:[]},X=$.pwa?.icons;if(!X?.src)return Z.errors.push("No source icon specified in pwa.icons.src"),Z.success=!1,Z;let Q=h0.isAbsolute(X.src)?X.src:h0.resolve(process.cwd(),X.src);if(!await Bun.file(Q).exists())return Z.errors.push(`Source icon not found: ${Q}`),Z.success=!1,Z;let J=h0.resolve(Y,X.outputDir||"pwa-icons");try{LZ.mkdirSync(J,{recursive:!0})}catch{return Z.errors.push(`Failed to create output directory: ${J}`),Z.success=!1,Z}let G=X.sizes||W7,K=X.generateWebP??!0,q=X.generateAppleIcons??!0;try{let _;try{_=await import("sharp")}catch{return Z.errors.push(`sharp is not installed. Install it with: bun add sharp
10509
- Icon generation requires the sharp package for image processing.`),Z.success=!1,Z}let W=await _.default(Q).metadata();if(W.width&&W.width<512)Z.warnings.push(`Source icon is ${W.width}x${W.height}. Recommend using at least 512x512 for best quality.`);for(let L of G){let F=h0.join(J,`icon-${L}x${L}.png`);if(await _.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Z.generatedFiles.push(F),K){let H=h0.join(J,`icon-${L}x${L}.webp`);await _.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(H),Z.generatedFiles.push(H)}}if(q){for(let F of B7){let H=h0.join(J,`apple-touch-icon-${F}x${F}.png`);await _.default(Q).resize(F,F,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(H),Z.generatedFiles.push(H)}let L=h0.join(J,"apple-touch-icon.png");await _.default(Q).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(L),Z.generatedFiles.push(L)}for(let L of z7){let F=h0.join(J,`favicon-${L}x${L}.png`);await _.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Z.generatedFiles.push(F)}let B=512,j=h0.join(J,`icon-maskable-${B}x${B}.png`),z=Math.floor(B*0.1),O=B-z*2;await _.default(Q).resize(O,O,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:z,bottom:z,left:z,right:z,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(j),Z.generatedFiles.push(j)}catch(_){let U=_ instanceof Error?_.message:String(_);Z.errors.push(`Icon generation failed: ${U}`),Z.success=!1}return Z}function lU($){let Y=$.sizes||W7,Z=$.outputDir?`/${$.outputDir}`:"/pwa-icons",X=$.generateWebP??!0,Q=$.generateAppleIcons??!0,J=[];for(let G of Y)if(J.push(`${Z}/icon-${G}x${G}.png`),X)J.push(`${Z}/icon-${G}x${G}.webp`);if(Q){J.push(`${Z}/apple-touch-icon.png`);for(let G of B7)J.push(`${Z}/apple-touch-icon-${G}x${G}.png`)}for(let G of z7)J.push(`${Z}/favicon-${G}x${G}.png`);return J.push(`${Z}/icon-maskable-512x512.png`),J}async function O7(){try{return await import("sharp"),!0}catch{return!1}}F5();function gZ($,Y,Z,X){let Q=[],J=X.join(" ");for(let G of $)if(Q.push({src:`${Y}/icon-${G}x${G}.png`,sizes:`${G}x${G}`,type:"image/png",purpose:J}),Z)Q.push({src:`${Y}/icon-${G}x${G}.webp`,sizes:`${G}x${G}`,type:"image/webp",purpose:J});return Q}function hZ($){return $.map((Y)=>({name:Y.name,short_name:Y.shortName,description:Y.description,url:Y.url,icons:Y.icons?.map((Z)=>({src:Z.src,sizes:Z.sizes,type:Z.type}))}))}function dZ($){let Y=$.pwa?.shareTarget;if(!Y?.enabled)return;let Z={action:Y.action||"/share",method:Y.method||"POST",enctype:Y.enctype||"multipart/form-data",params:{title:Y.params?.title||"title",text:Y.params?.text||"text",url:Y.params?.url||"url"}};if(Y.acceptFiles&&Y.acceptFiles.length>0)Z.params.files=Y.acceptFiles.map((X)=>({name:X.name,accept:X.accept}));return Z}function mZ($){let Y=$.pwa?.fileHandlers;if(!Y?.enabled||!Y.accept)return;let Z=[{action:Y.action||"/",accept:Y.accept,launch_type:Y.launchType||"single-client"}];if(Y.icons)Z[0].icons=Y.icons.map((X)=>({src:X.src,sizes:X.sizes,type:X.type}));return Z}function uZ($){let Y=$.pwa?.protocolHandlers;if(!Y||Y.length===0)return;return Y.map((Z)=>({protocol:Z.protocol,url:Z.url}))}function lZ($){let Y=$.pwa;if(!Y?.enabled||!Y.manifest)return null;let{manifest:Z,icons:X}=Y,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:Z.name,short_name:Z.shortName||Z.name,description:Z.description,start_url:Z.startUrl||"/",display:Z.display||"standalone",display_override:Z.displayOverride,orientation:Z.orientation,theme_color:Z.themeColor,background_color:Z.backgroundColor,scope:Z.scope||"/",lang:Z.lang,dir:Z.dir,id:Z.id,categories:Z.categories,icons:gZ(Q,J,G,K)};if(Z.shortcuts&&Z.shortcuts.length>0)q.shortcuts=hZ(Z.shortcuts);if(Z.screenshots&&Z.screenshots.length>0)q.screenshots=Z.screenshots.map((B)=>({src:B.src,sizes:B.sizes,type:B.type,label:B.label,form_factor:B.platform}));let _=dZ($);if(_)q.share_target=_;let U=mZ($);if(U)q.file_handlers=U;let W=uZ($);if(W)q.protocol_handlers=W;if(Z.launchHandler)q.launch_handler={client_mode:Z.launchHandler};if(Z.handleLinks)q.handle_links=Z.handleLinks;if(Z.edgeSidePanel?.enabled)q.edge_side_panel={preferred_width:Z.edgeSidePanel.preferredWidth};return q}function E7($){let Y=lZ($);if(!Y)return"";let Z=JSON.parse(JSON.stringify(Y));return JSON.stringify(Z,null,2)}function eU($,Y){return{...Y,...$,shortcuts:$.shortcuts||Y.shortcuts,screenshots:$.screenshots||Y.screenshots,categories:$.categories||Y.categories}}function $_($){let Y=[],Z=$.pwa;if(!Z?.enabled)return Y;let X=Z.manifest;if(!X)return Y.push("PWA manifest configuration is missing"),Y;if(!X.name)Y.push("Manifest name is required");let Q=["fullscreen","standalone","minimal-ui","browser"];if(X.display&&!Q.includes(X.display))Y.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))Y.push(`Invalid orientation: ${X.orientation}`);let G=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(X.themeColor&&!G.test(X.themeColor))Y.push(`Invalid theme color: ${X.themeColor}. Must be a valid hex color.`);if(X.backgroundColor&&!G.test(X.backgroundColor))Y.push(`Invalid background color: ${X.backgroundColor}. Must be a valid hex color.`);if(Z.shareTarget?.enabled){if(!Z.shareTarget.action)Y.push("Share target action URL is required")}if(Z.fileHandlers?.enabled){if(!Z.fileHandlers.accept||Object.keys(Z.fileHandlers.accept).length===0)Y.push("File handlers must specify accepted MIME types")}if(Z.protocolHandlers)for(let K of Z.protocolHandlers){if(!K.protocol)Y.push("Protocol handler missing protocol");if(!K.url||!K.url.includes("%s"))Y.push(`Protocol handler URL must contain %s placeholder: ${K.protocol}`)}return Y}import UZ from"path";async function _Z($){let Y=$.pwa?.offline;if(!Y?.enabled)return"";if(Y.page){let Z=UZ.isAbsolute(Y.page)?Y.page:UZ.resolve(process.cwd(),Y.page);if(await Bun.file(Z).exists())try{let{processDirectives:X}=await Promise.resolve().then(() => (J$(),qZ)),Q=await Bun.file(Z).text();return await X(Q,{},Z,$,new Set)}catch(X){console.warn(`[PWA] Failed to process custom offline page: ${X}`)}else console.warn(`[PWA] Custom offline page not found: ${Z}`)}return CU($)}function CU($){let Y=$.pwa?.offline,Z=$.pwa?.manifest,X=Y?.fallbackTitle||"You are offline",Q=Y?.fallbackMessage||"Please check your internet connection and try again.",J=Z?.themeColor||"#4f46e5",G=Z?.shortName||Z?.name||"App";return`<!DOCTYPE html>
10513
+ `+J}{let x=/<script\s+server\b[^>]*>/gi,d,K0=[];while((d=x.exec(J))!==null){let a=d.index+d[0].length,Z0=xU(J,a);if(Z0===-1)continue;let F0=Z0+9;while(F0<J.length&&/\s/.test(J[F0]))F0++;K0.push({start:d.index,end:F0})}for(let a=K0.length-1;a>=0;a--){let{start:Z0,end:F0}=K0[a];J=J.substring(0,Z0)+J.substring(F0)}}let y0=w5(J,Z);if(y0.hasScoped)J=y0.html;let O0=Y.__stx_event_bindings||[],C=!1,v=[],f=/\s:[a-z][\w.-]*\s*=/.test(J),{scanScriptTags:p}=await Promise.resolve().then(() => (C4(),P8));for(let x of p(J,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}))v.push({match:x.fullMatch,attrs:x.attrs,content:x.body});for(let{match:x,attrs:d,content:K0}of v){C=!0;let a=K0;b9(K0,Z,X.strict);let Z0=await V5(K0,{eventBindings:O0,attrs:d,hasColonDirectives:f,templateContent:$,filePath:Z,projectRoot:process.cwd(),production:X.buildMode==="compile"});J=J.replace(x,()=>Z0)}if(C)Y.__stx_event_bindings=[];return J}var L1="<!--PARENT_CONTENT_PLACEHOLDER-->";var J$=S(()=>{r6();m9();t6();Z2();J2();p9();u9();W2();n9();H2();_9();E2();b2();P2();u0();s1();i0();g2();c2();e2();X8();B4();Q$();q8();T1();_8();p$();H0();B8();O8();F8();R8();t9();C4();s8();e8();X7();J7();X7();J7()});import uU from"fs";import K7 from"path";import FZ from"fs";import h0 from"path";var W7=[72,96,128,144,152,192,384,512],B7=[120,152,167,180],z7=[16,32];async function j7($,Y){let Z={success:!0,generatedFiles:[],errors:[],warnings:[]},X=$.pwa?.icons;if(!X?.src)return Z.errors.push("No source icon specified in pwa.icons.src"),Z.success=!1,Z;let Q=h0.isAbsolute(X.src)?X.src:h0.resolve(process.cwd(),X.src);if(!await Bun.file(Q).exists())return Z.errors.push(`Source icon not found: ${Q}`),Z.success=!1,Z;let J=h0.resolve(Y,X.outputDir||"pwa-icons");try{FZ.mkdirSync(J,{recursive:!0})}catch{return Z.errors.push(`Failed to create output directory: ${J}`),Z.success=!1,Z}let G=X.sizes||W7,K=X.generateWebP??!0,q=X.generateAppleIcons??!0;try{let _;try{_=await import("sharp")}catch{return Z.errors.push(`sharp is not installed. Install it with: bun add sharp
10514
+ Icon generation requires the sharp package for image processing.`),Z.success=!1,Z}let W=await _.default(Q).metadata();if(W.width&&W.width<512)Z.warnings.push(`Source icon is ${W.width}x${W.height}. Recommend using at least 512x512 for best quality.`);for(let L of G){let F=h0.join(J,`icon-${L}x${L}.png`);if(await _.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Z.generatedFiles.push(F),K){let H=h0.join(J,`icon-${L}x${L}.webp`);await _.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(H),Z.generatedFiles.push(H)}}if(q){for(let F of B7){let H=h0.join(J,`apple-touch-icon-${F}x${F}.png`);await _.default(Q).resize(F,F,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(H),Z.generatedFiles.push(H)}let L=h0.join(J,"apple-touch-icon.png");await _.default(Q).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(L),Z.generatedFiles.push(L)}for(let L of z7){let F=h0.join(J,`favicon-${L}x${L}.png`);await _.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Z.generatedFiles.push(F)}let B=512,j=h0.join(J,`icon-maskable-${B}x${B}.png`),z=Math.floor(B*0.1),O=B-z*2;await _.default(Q).resize(O,O,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:z,bottom:z,left:z,right:z,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(j),Z.generatedFiles.push(j)}catch(_){let U=_ instanceof Error?_.message:String(_);Z.errors.push(`Icon generation failed: ${U}`),Z.success=!1}return Z}function nU($){let Y=$.sizes||W7,Z=$.outputDir?`/${$.outputDir}`:"/pwa-icons",X=$.generateWebP??!0,Q=$.generateAppleIcons??!0,J=[];for(let G of Y)if(J.push(`${Z}/icon-${G}x${G}.png`),X)J.push(`${Z}/icon-${G}x${G}.webp`);if(Q){J.push(`${Z}/apple-touch-icon.png`);for(let G of B7)J.push(`${Z}/apple-touch-icon-${G}x${G}.png`)}for(let G of z7)J.push(`${Z}/favicon-${G}x${G}.png`);return J.push(`${Z}/icon-maskable-512x512.png`),J}async function O7(){try{return await import("sharp"),!0}catch{return!1}}F5();function hZ($,Y,Z,X){let Q=[],J=X.join(" ");for(let G of $)if(Q.push({src:`${Y}/icon-${G}x${G}.png`,sizes:`${G}x${G}`,type:"image/png",purpose:J}),Z)Q.push({src:`${Y}/icon-${G}x${G}.webp`,sizes:`${G}x${G}`,type:"image/webp",purpose:J});return Q}function dZ($){return $.map((Y)=>({name:Y.name,short_name:Y.shortName,description:Y.description,url:Y.url,icons:Y.icons?.map((Z)=>({src:Z.src,sizes:Z.sizes,type:Z.type}))}))}function mZ($){let Y=$.pwa?.shareTarget;if(!Y?.enabled)return;let Z={action:Y.action||"/share",method:Y.method||"POST",enctype:Y.enctype||"multipart/form-data",params:{title:Y.params?.title||"title",text:Y.params?.text||"text",url:Y.params?.url||"url"}};if(Y.acceptFiles&&Y.acceptFiles.length>0)Z.params.files=Y.acceptFiles.map((X)=>({name:X.name,accept:X.accept}));return Z}function uZ($){let Y=$.pwa?.fileHandlers;if(!Y?.enabled||!Y.accept)return;let Z=[{action:Y.action||"/",accept:Y.accept,launch_type:Y.launchType||"single-client"}];if(Y.icons)Z[0].icons=Y.icons.map((X)=>({src:X.src,sizes:X.sizes,type:X.type}));return Z}function lZ($){let Y=$.pwa?.protocolHandlers;if(!Y||Y.length===0)return;return Y.map((Z)=>({protocol:Z.protocol,url:Z.url}))}function pZ($){let Y=$.pwa;if(!Y?.enabled||!Y.manifest)return null;let{manifest:Z,icons:X}=Y,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:Z.name,short_name:Z.shortName||Z.name,description:Z.description,start_url:Z.startUrl||"/",display:Z.display||"standalone",display_override:Z.displayOverride,orientation:Z.orientation,theme_color:Z.themeColor,background_color:Z.backgroundColor,scope:Z.scope||"/",lang:Z.lang,dir:Z.dir,id:Z.id,categories:Z.categories,icons:hZ(Q,J,G,K)};if(Z.shortcuts&&Z.shortcuts.length>0)q.shortcuts=dZ(Z.shortcuts);if(Z.screenshots&&Z.screenshots.length>0)q.screenshots=Z.screenshots.map((B)=>({src:B.src,sizes:B.sizes,type:B.type,label:B.label,form_factor:B.platform}));let _=mZ($);if(_)q.share_target=_;let U=uZ($);if(U)q.file_handlers=U;let W=lZ($);if(W)q.protocol_handlers=W;if(Z.launchHandler)q.launch_handler={client_mode:Z.launchHandler};if(Z.handleLinks)q.handle_links=Z.handleLinks;if(Z.edgeSidePanel?.enabled)q.edge_side_panel={preferred_width:Z.edgeSidePanel.preferredWidth};return q}function E7($){let Y=pZ($);if(!Y)return"";let Z=JSON.parse(JSON.stringify(Y));return JSON.stringify(Z,null,2)}function X_($,Y){return{...Y,...$,shortcuts:$.shortcuts||Y.shortcuts,screenshots:$.screenshots||Y.screenshots,categories:$.categories||Y.categories}}function J_($){let Y=[],Z=$.pwa;if(!Z?.enabled)return Y;let X=Z.manifest;if(!X)return Y.push("PWA manifest configuration is missing"),Y;if(!X.name)Y.push("Manifest name is required");let Q=["fullscreen","standalone","minimal-ui","browser"];if(X.display&&!Q.includes(X.display))Y.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))Y.push(`Invalid orientation: ${X.orientation}`);let G=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(X.themeColor&&!G.test(X.themeColor))Y.push(`Invalid theme color: ${X.themeColor}. Must be a valid hex color.`);if(X.backgroundColor&&!G.test(X.backgroundColor))Y.push(`Invalid background color: ${X.backgroundColor}. Must be a valid hex color.`);if(Z.shareTarget?.enabled){if(!Z.shareTarget.action)Y.push("Share target action URL is required")}if(Z.fileHandlers?.enabled){if(!Z.fileHandlers.accept||Object.keys(Z.fileHandlers.accept).length===0)Y.push("File handlers must specify accepted MIME types")}if(Z.protocolHandlers)for(let K of Z.protocolHandlers){if(!K.protocol)Y.push("Protocol handler missing protocol");if(!K.url||!K.url.includes("%s"))Y.push(`Protocol handler URL must contain %s placeholder: ${K.protocol}`)}return Y}import _Z from"path";async function WZ($){let Y=$.pwa?.offline;if(!Y?.enabled)return"";if(Y.page){let Z=_Z.isAbsolute(Y.page)?Y.page:_Z.resolve(process.cwd(),Y.page);if(await Bun.file(Z).exists())try{let{processDirectives:X}=await Promise.resolve().then(() => (J$(),UZ)),Q=await Bun.file(Z).text();return await X(Q,{},Z,$,new Set)}catch(X){console.warn(`[PWA] Failed to process custom offline page: ${X}`)}else console.warn(`[PWA] Custom offline page not found: ${Z}`)}return gU($)}function gU($){let Y=$.pwa?.offline,Z=$.pwa?.manifest,X=Y?.fallbackTitle||"You are offline",Q=Y?.fallbackMessage||"Please check your internet connection and try again.",J=Z?.themeColor||"#4f46e5",G=Z?.shortName||Z?.name||"App";return`<!DOCTYPE html>
10510
10515
  <html lang="en">
10511
10516
  <head>
10512
10517
  <meta charset="UTF-8">
@@ -10739,9 +10744,9 @@ Icon generation requires the sharp package for image processing.`),Z.success=!1,
10739
10744
  }, 5000);
10740
10745
  </script>
10741
10746
  </body>
10742
- </html>`}function P9($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}d1();m1();import L1 from"fs";import C9 from"path";function vU($){let Y=[],Z=$.pwa;if(Y.push({id:"pwa-enabled",name:"PWA Enabled",category:"required",passed:Z?.enabled===!0,message:Z?.enabled?"PWA is enabled":"PWA is not enabled in config"}),!Z?.enabled)return Y;Y.push({id:"manifest-name",name:"App Name",category:"required",passed:Boolean(Z.manifest?.name),message:Z.manifest?.name?`App name: "${Z.manifest.name}"`:"Missing required manifest name"}),Y.push({id:"manifest-short-name",name:"Short Name",category:"recommended",passed:Boolean(Z.manifest?.shortName),message:Z.manifest?.shortName?`Short name: "${Z.manifest.shortName}"`:"Short name not set (will use full name)"}),Y.push({id:"manifest-description",name:"App Description",category:"recommended",passed:Boolean(Z.manifest?.description),message:Z.manifest?.description?"Description is set":"App description not provided"}),Y.push({id:"manifest-theme-color",name:"Theme Color",category:"required",passed:Boolean(Z.manifest?.themeColor),message:Z.manifest?.themeColor?`Theme color: ${Z.manifest.themeColor}`:"Theme color not set"}),Y.push({id:"manifest-background-color",name:"Background Color",category:"required",passed:Boolean(Z.manifest?.backgroundColor),message:Z.manifest?.backgroundColor?`Background color: ${Z.manifest.backgroundColor}`:"Background color not set"}),Y.push({id:"manifest-display",name:"Display Mode",category:"required",passed:["standalone","fullscreen","minimal-ui"].includes(Z.manifest?.display||""),message:Z.manifest?.display?`Display mode: ${Z.manifest.display}`:"Display mode should be standalone, fullscreen, or minimal-ui"}),Y.push({id:"manifest-start-url",name:"Start URL",category:"required",passed:Boolean(Z.manifest?.startUrl),message:Z.manifest?.startUrl?`Start URL: ${Z.manifest.startUrl}`:"Start URL not set"}),Y.push({id:"icons-source",name:"Icon Source",category:"required",passed:Boolean(Z.icons?.src),message:Z.icons?.src?`Icon source: ${Z.icons.src}`:"No icon source configured"});let X=Z.icons?.sizes||[];Y.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)"}),Y.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)"}),Y.push({id:"icons-maskable",name:"Maskable Icon",category:"recommended",passed:Z.icons?.purpose?.includes("maskable")||!1,message:Z.icons?.purpose?.includes("maskable")?"Maskable icon purpose is set":"Consider adding maskable icon purpose for adaptive icons"}),Y.push({id:"sw-configured",name:"Service Worker",category:"required",passed:Boolean(Z.serviceWorker),message:Z.serviceWorker?"Service worker is configured":"Service worker configuration missing"}),Y.push({id:"sw-cache-version",name:"Cache Version",category:"recommended",passed:Boolean(Z.serviceWorker?.cacheVersion),message:Z.serviceWorker?.cacheVersion?`Cache version: ${Z.serviceWorker.cacheVersion}`:"Set cache version for proper cache busting"}),Y.push({id:"offline-enabled",name:"Offline Support",category:"required",passed:Z.offline?.enabled===!0,message:Z.offline?.enabled?"Offline support is enabled":"Offline support is disabled"});let Q=Z.routes||[];return Y.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"}),Y.push({id:"push-config",name:"Push Notifications",category:"optional",passed:!Z.push?.enabled||Boolean(Z.push?.vapidPublicKey),message:Z.push?.enabled?Z.push?.vapidPublicKey?"Push notifications configured with VAPID key":"Push enabled but missing VAPID key":"Push notifications not enabled"}),Y.push({id:"share-target",name:"Share Target",category:"optional",passed:!0,message:Z.shareTarget?.enabled?`Share target enabled at ${Z.shareTarget.action}`:"Share target not enabled"}),Y.push({id:"auto-inject",name:"Auto-injection",category:"recommended",passed:Z.autoInject!==!1,message:Z.autoInject!==!1?"PWA tags will be auto-injected":"Auto-injection disabled - manual tag insertion required"}),Y}function xU($){let Y=[],Z=C9.join($,"manifest.json"),X=L1.existsSync(Z);if(Y.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(L1.readFileSync(Z,"utf-8"));Y.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!0,message:"Manifest is valid JSON"}),Y.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{Y.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!1,message:"Manifest is not valid JSON"})}let Q=C9.join($,"sw.js"),J=L1.existsSync(Q);Y.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=C9.join($,"offline.html"),K=L1.existsSync(G);Y.push({id:"build-offline",name:"Offline Page",category:"recommended",passed:K,message:K?"Offline page exists":"No offline.html found"});let q=C9.join($,"pwa-icons");if(L1.existsSync(q)){let U=L1.readdirSync(q).filter((W)=>W.endsWith(".png")||W.endsWith(".webp"));Y.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 Y.push({id:"build-icons",name:"Generated Icons",category:"required",passed:!1,message:"Icons directory not found"});return Y}function fU($){let Y=$.filter((q)=>q.category==="required"),Z=$.filter((q)=>q.category==="recommended"),X=Y.filter((q)=>q.passed).length,Q=Z.filter((q)=>q.passed).length,J=Y.length>0?X/Y.length*70:70,G=Z.length>0?Q/Z.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 WL($,Y){let Z=vU($),X=Y&&L1.existsSync(Y)?xU(Y):[];return fU([...Z,...X])}function BL($){let Y=[];Y.push(`
10747
+ </html>`}function P9($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}m1();u1();import F1 from"fs";import C9 from"path";function hU($){let Y=[],Z=$.pwa;if(Y.push({id:"pwa-enabled",name:"PWA Enabled",category:"required",passed:Z?.enabled===!0,message:Z?.enabled?"PWA is enabled":"PWA is not enabled in config"}),!Z?.enabled)return Y;Y.push({id:"manifest-name",name:"App Name",category:"required",passed:Boolean(Z.manifest?.name),message:Z.manifest?.name?`App name: "${Z.manifest.name}"`:"Missing required manifest name"}),Y.push({id:"manifest-short-name",name:"Short Name",category:"recommended",passed:Boolean(Z.manifest?.shortName),message:Z.manifest?.shortName?`Short name: "${Z.manifest.shortName}"`:"Short name not set (will use full name)"}),Y.push({id:"manifest-description",name:"App Description",category:"recommended",passed:Boolean(Z.manifest?.description),message:Z.manifest?.description?"Description is set":"App description not provided"}),Y.push({id:"manifest-theme-color",name:"Theme Color",category:"required",passed:Boolean(Z.manifest?.themeColor),message:Z.manifest?.themeColor?`Theme color: ${Z.manifest.themeColor}`:"Theme color not set"}),Y.push({id:"manifest-background-color",name:"Background Color",category:"required",passed:Boolean(Z.manifest?.backgroundColor),message:Z.manifest?.backgroundColor?`Background color: ${Z.manifest.backgroundColor}`:"Background color not set"}),Y.push({id:"manifest-display",name:"Display Mode",category:"required",passed:["standalone","fullscreen","minimal-ui"].includes(Z.manifest?.display||""),message:Z.manifest?.display?`Display mode: ${Z.manifest.display}`:"Display mode should be standalone, fullscreen, or minimal-ui"}),Y.push({id:"manifest-start-url",name:"Start URL",category:"required",passed:Boolean(Z.manifest?.startUrl),message:Z.manifest?.startUrl?`Start URL: ${Z.manifest.startUrl}`:"Start URL not set"}),Y.push({id:"icons-source",name:"Icon Source",category:"required",passed:Boolean(Z.icons?.src),message:Z.icons?.src?`Icon source: ${Z.icons.src}`:"No icon source configured"});let X=Z.icons?.sizes||[];Y.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)"}),Y.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)"}),Y.push({id:"icons-maskable",name:"Maskable Icon",category:"recommended",passed:Z.icons?.purpose?.includes("maskable")||!1,message:Z.icons?.purpose?.includes("maskable")?"Maskable icon purpose is set":"Consider adding maskable icon purpose for adaptive icons"}),Y.push({id:"sw-configured",name:"Service Worker",category:"required",passed:Boolean(Z.serviceWorker),message:Z.serviceWorker?"Service worker is configured":"Service worker configuration missing"}),Y.push({id:"sw-cache-version",name:"Cache Version",category:"recommended",passed:Boolean(Z.serviceWorker?.cacheVersion),message:Z.serviceWorker?.cacheVersion?`Cache version: ${Z.serviceWorker.cacheVersion}`:"Set cache version for proper cache busting"}),Y.push({id:"offline-enabled",name:"Offline Support",category:"required",passed:Z.offline?.enabled===!0,message:Z.offline?.enabled?"Offline support is enabled":"Offline support is disabled"});let Q=Z.routes||[];return Y.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"}),Y.push({id:"push-config",name:"Push Notifications",category:"optional",passed:!Z.push?.enabled||Boolean(Z.push?.vapidPublicKey),message:Z.push?.enabled?Z.push?.vapidPublicKey?"Push notifications configured with VAPID key":"Push enabled but missing VAPID key":"Push notifications not enabled"}),Y.push({id:"share-target",name:"Share Target",category:"optional",passed:!0,message:Z.shareTarget?.enabled?`Share target enabled at ${Z.shareTarget.action}`:"Share target not enabled"}),Y.push({id:"auto-inject",name:"Auto-injection",category:"recommended",passed:Z.autoInject!==!1,message:Z.autoInject!==!1?"PWA tags will be auto-injected":"Auto-injection disabled - manual tag insertion required"}),Y}function dU($){let Y=[],Z=C9.join($,"manifest.json"),X=F1.existsSync(Z);if(Y.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(F1.readFileSync(Z,"utf-8"));Y.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!0,message:"Manifest is valid JSON"}),Y.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{Y.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!1,message:"Manifest is not valid JSON"})}let Q=C9.join($,"sw.js"),J=F1.existsSync(Q);Y.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=C9.join($,"offline.html"),K=F1.existsSync(G);Y.push({id:"build-offline",name:"Offline Page",category:"recommended",passed:K,message:K?"Offline page exists":"No offline.html found"});let q=C9.join($,"pwa-icons");if(F1.existsSync(q)){let U=F1.readdirSync(q).filter((W)=>W.endsWith(".png")||W.endsWith(".webp"));Y.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 Y.push({id:"build-icons",name:"Generated Icons",category:"required",passed:!1,message:"Icons directory not found"});return Y}function mU($){let Y=$.filter((q)=>q.category==="required"),Z=$.filter((q)=>q.category==="recommended"),X=Y.filter((q)=>q.passed).length,Q=Z.filter((q)=>q.passed).length,J=Y.length>0?X/Y.length*70:70,G=Z.length>0?Q/Z.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 OL($,Y){let Z=hU($),X=Y&&F1.existsSync(Y)?dU(Y):[];return mU([...Z,...X])}function HL($){let Y=[];Y.push(`
10743
10748
  === PWA Audit Report ===
10744
10749
  `);let Z=$.score>=90?"32":$.score>=70?"33":"31";Y.push(`Score: \x1B[${Z}m${$.score}/100\x1B[0m`),Y.push(`Passed: ${$.passed} | Failed: ${$.failed} | Warnings: ${$.warnings}
10745
10750
  `);let X=["required","recommended","optional"];for(let Q of X){let J=$.checks.filter((G)=>G.category===Q);if(J.length===0)continue;Y.push(`
10746
10751
  ${Q.toUpperCase()}:`);for(let G of J){let K=G.passed?"\x1B[32m\u2713\x1B[0m":"\x1B[31m\u2717\x1B[0m";if(Y.push(` ${K} ${G.name}: ${G.message}`),G.details)Y.push(` ${G.details}`)}}return Y.push(""),Y.join(`
10747
- `)}g$();F5();d1();m1();async function AL($,Y){let Z={success:!0,files:{icons:[]},errors:[],warnings:[]},X=$.pwa;if(!X?.enabled)return Z;try{gU.mkdirSync(Y,{recursive:!0})}catch{return Z.errors.push(`Failed to create output directory: ${Y}`),Z.success=!1,Z}try{let J=E7($);if(J){let G=K7.join(Y,"manifest.json");await Bun.write(G,J),Z.files.manifest=G}}catch(J){let G=J instanceof Error?J.message:String(J);Z.errors.push(`Failed to generate manifest.json: ${G}`),Z.success=!1}if(X.icons?.src)if(await O7()){let G=await j7($,Y);if(Z.files.icons=G.generatedFiles,Z.warnings.push(...G.warnings),!G.success)Z.errors.push(...G.errors),Z.success=!1}else Z.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(X.offline?.enabled)try{let J=await _Z($);if(J){let G=K7.join(Y,"offline.html");await Bun.write(G,J),Z.files.offlinePage=G}}catch(J){let G=J instanceof Error?J.message:String(J);Z.errors.push(`Failed to generate offline page: ${G}`),Z.success=!1}let Q;if(X.precache?.enabled){let J=$1(Y,$);Q={fileCount:J.fileCount,totalSize:J.totalSize},Z.precacheStats=Q}try{let J=H5($,Y);if(J){let G=V1($),K=K7.join(Y,G);await Bun.write(K,J),Z.files.serviceWorker=K}}catch(J){let G=J instanceof Error?J.message:String(J);Z.errors.push(`Failed to generate service worker: ${G}`),Z.success=!1}return Z}function wL($,Y){return d9($,Y)}function TL($){return $.pwa?.enabled===!0}export{$_ as validateManifest,WL as runPwaAudit,zB as registerPwaDirectives,VQ as pwaUpdateDirective,NQ as pwaPushDirective,RQ as pwaOfflineDirective,FQ as pwaInstallDirective,f$ as pwaDirectives,wL as processPwaHtml,eU as mergeManifestConfig,M7 as isWorkboxEnabled,O7 as isSharpAvailable,TL as isPwaEnabled,d9 as injectPwaTags,V1 as getServiceWorkerFileName,lU as getExpectedIconPaths,fZ as generateThemeColorMeta,vZ as generateSwRegistrationScript,CZ as generateServiceWorkerAuto,H5 as generateServiceWorker,L5 as generatePwaTags,j7 as generatePwaIcons,O5 as generatePrecacheManifestJs,$1 as generatePrecacheManifest,_Z as generateOfflinePage,xZ as generateManifestLink,E7 as generateManifestJson,lZ as generateManifest,L7 as formatSize,BL as formatAuditResult,fU as calculateAuditResult,AL as buildPwaAssets,vU as auditConfig,xU as auditBuildOutput,z7 as FAVICON_SIZES,W7 as DEFAULT_ICON_SIZES,B7 as APPLE_TOUCH_ICON_SIZES};
10752
+ `)}g$();F5();m1();u1();async function IL($,Y){let Z={success:!0,files:{icons:[]},errors:[],warnings:[]},X=$.pwa;if(!X?.enabled)return Z;try{uU.mkdirSync(Y,{recursive:!0})}catch{return Z.errors.push(`Failed to create output directory: ${Y}`),Z.success=!1,Z}try{let J=E7($);if(J){let G=K7.join(Y,"manifest.json");await Bun.write(G,J),Z.files.manifest=G}}catch(J){let G=J instanceof Error?J.message:String(J);Z.errors.push(`Failed to generate manifest.json: ${G}`),Z.success=!1}if(X.icons?.src)if(await O7()){let G=await j7($,Y);if(Z.files.icons=G.generatedFiles,Z.warnings.push(...G.warnings),!G.success)Z.errors.push(...G.errors),Z.success=!1}else Z.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(X.offline?.enabled)try{let J=await WZ($);if(J){let G=K7.join(Y,"offline.html");await Bun.write(G,J),Z.files.offlinePage=G}}catch(J){let G=J instanceof Error?J.message:String(J);Z.errors.push(`Failed to generate offline page: ${G}`),Z.success=!1}let Q;if(X.precache?.enabled){let J=Y1(Y,$);Q={fileCount:J.fileCount,totalSize:J.totalSize},Z.precacheStats=Q}try{let J=H5($,Y);if(J){let G=R1($),K=K7.join(Y,G);await Bun.write(K,J),Z.files.serviceWorker=K}}catch(J){let G=J instanceof Error?J.message:String(J);Z.errors.push(`Failed to generate service worker: ${G}`),Z.success=!1}return Z}function EL($,Y){return d9($,Y)}function DL($){return $.pwa?.enabled===!0}export{J_ as validateManifest,OL as runPwaAudit,LB as registerPwaDirectives,AQ as pwaUpdateDirective,TQ as pwaPushDirective,wQ as pwaOfflineDirective,NQ as pwaInstallDirective,f$ as pwaDirectives,EL as processPwaHtml,X_ as mergeManifestConfig,M7 as isWorkboxEnabled,O7 as isSharpAvailable,DL as isPwaEnabled,d9 as injectPwaTags,R1 as getServiceWorkerFileName,nU as getExpectedIconPaths,gZ as generateThemeColorMeta,xZ as generateSwRegistrationScript,vZ as generateServiceWorkerAuto,H5 as generateServiceWorker,L5 as generatePwaTags,j7 as generatePwaIcons,O5 as generatePrecacheManifestJs,Y1 as generatePrecacheManifest,WZ as generateOfflinePage,fZ as generateManifestLink,E7 as generateManifestJson,pZ as generateManifest,L7 as formatSize,HL as formatAuditResult,mU as calculateAuditResult,IL as buildPwaAssets,hU as auditConfig,dU as auditBuildOutput,z7 as FAVICON_SIZES,W7 as DEFAULT_ICON_SIZES,B7 as APPLE_TOUCH_ICON_SIZES};