@stacksjs/stx 0.2.12 → 0.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builtins/index.d.ts +4 -0
- package/dist/builtins/modal.d.ts +2 -0
- package/dist/builtins/toast.d.ts +2 -0
- package/dist/cli.js +1065 -769
- package/dist/index.js +945 -649
- package/dist/pwa.js +573 -277
- package/dist/ssg.js +689 -393
- package/dist/stx.d.ts +70 -0
- package/package.json +5 -5
- package/stx.d.ts +70 -0
package/dist/pwa.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var{defineProperty:
|
|
2
|
+
var{defineProperty:P$,getOwnPropertyNames:$X,getOwnPropertyDescriptor:ZX}=Object,YX=Object.prototype.hasOwnProperty;function XX($){return this[$]}var X6=($)=>{var Z=(Y6??=new WeakMap).get($),Y;if(Z)return Z;if(Z=P$({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function"){for(var X of $X($))if(!YX.call(Z,X))P$(Z,X,{get:XX.bind($,X),enumerable:!(Y=ZX($,X))||Y.enumerable})}return Y6.set($,Z),Z},Y6;var JX=($)=>$;function QX($,Z){this[$]=JX.bind(null,Z)}var o=($,Z)=>{for(var Y in Z)P$($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:QX.bind(Z,Y)})};var y=($,Z)=>()=>($&&(Z=$($=0)),Z);var e=import.meta.require;import _5 from"fs";import W5 from"path";function qX($){let Z=0;for(let Y=0;Y<$.length;Y++){let X=$[Y];Z=(Z<<5)-Z+X,Z=Z&Z}return Math.abs(Z).toString(16).padStart(8,"0")}function UX($,Z){let Y=W5.basename($);for(let X of Z)if(X.startsWith("*.")){let Q=X.slice(1);if(Y.endsWith(Q))return!0}else if(X.includes("*")){let Q=new RegExp(`^${X.replace(/\*/g,".*")}$`);if(Q.test(Y)||Q.test($))return!0}else if(Y===X||$.includes(X))return!0;return!1}function _X($,Z,Y){let X=W5.extname($).toLowerCase(),Q=KX[X],J=(Y.maxFileSizeKB||500)*1024;if(Z>J)return!1;if(Y.exclude&&UX($,Y.exclude))return!1;if(Y.include&&Y.include.length>0){for(let G of Y.include)if(G.startsWith("*.")){if($.endsWith(G.slice(1)))return!0}else if($.includes(G))return!0}if(Q&&Y[Q]===!0)return!0;if(!Q)return!1;return!1}function U6($,Z,Y,X){let Q=_5.readdirSync($,{withFileTypes:!0});for(let J of Q){let G=W5.join($,J.name);if(J.isDirectory()){if(["node_modules",".git",".stx"].includes(J.name))continue;U6(G,Z,Y,X)}else if(J.isFile()){let K=_5.statSync(G),q=W5.relative(Z,G);if(_X(q,K.size,Y)){let _=_5.readFileSync(G),U=qX(_),W=`/${q.replace(/\\/g,"/")}`;X.push({url:W,revision:U,size:K.size})}}}}function $1($,Z){let Y=Z.pwa?.precache,X=[];if(!Y?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!_5.existsSync($))return{entries:[],totalSize:0,fileCount:0};U6($,$,Y,X),X.sort((J,G)=>J.url.localeCompare(G.url));let Q=X.reduce((J,G)=>J+G.size,0);return{entries:X,totalSize:Q,fileCount:X.length}}function B5($){if($.entries.length===0)return"[]";return`[
|
|
3
3
|
${$.entries.map((Y)=>` { url: '${Y.url}', revision: '${Y.revision}' }`).join(`,
|
|
4
4
|
`)}
|
|
5
|
-
]`}function
|
|
5
|
+
]`}function _6($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1048576).toFixed(2)} MB`}var KX;var f1=y(()=>{KX={".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 WX($){let Z={"cache-first":{className:"CacheFirst",importFrom:"workbox-strategies"},"network-first":{className:"NetworkFirst",importFrom:"workbox-strategies"},"stale-while-revalidate":{className:"StaleWhileRevalidate",importFrom:"workbox-strategies"},"network-only":{className:"NetworkOnly",importFrom:"workbox-strategies"},"cache-only":{className:"CacheOnly",importFrom:"workbox-strategies"}};return Z[$]||Z["network-first"]}function C$($){return WX($).className}function W6($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.routes||[],X=Z.cacheStorage,Q=[];for(let J of Y){let G=C$(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=
|
|
11
|
+
})`);let q=BX(J.pattern);Q.push(`
|
|
12
12
|
// ${J.pattern}
|
|
13
13
|
registerRoute(
|
|
14
14
|
${q},
|
|
15
15
|
new ${G}({
|
|
16
|
-
cacheName: '${J.cacheName||
|
|
16
|
+
cacheName: '${J.cacheName||jX(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
|
|
23
|
+
`)}function BX($){if($.startsWith("*.")){let Z=$.slice(2);return`({ request }) => request.destination === '${zX(Z)}'`}if($.endsWith("/**"))return`({ url }) => url.pathname.startsWith('${$.slice(0,-3)}')`;if($.endsWith("/*")){let Z=$.slice(0,-2);return`({ url }) => url.pathname.startsWith('${Z}') && !url.pathname.slice(${Z.length+1}).includes('/')`}if($.includes("*")&&!$.startsWith("*")){let[Z,Y]=$.split("*");return`({ url }) => url.pathname.startsWith('${Z}') && url.pathname.endsWith('${Y}')`}if($==="/"||!$.includes("*"))return`({ url }) => url.pathname === '${$}'`;return`new RegExp('${OX($).replace(/\\\*/g,".*")}')`}function zX($){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 jX($){return"stx-"+$.replace(/[^\w]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase().slice(0,30)+"-cache"}function OX($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var O6={};o(O6,{isWorkboxEnabled:()=>j6,getServiceWorkerGenerator:()=>RX,generateWorkboxServiceWorker:()=>z6,generateWorkboxConfig:()=>B6});function B6($,Z){let Y=$.pwa;if(!Y?.enabled)return{mode:"generate",modules:[],skipWaiting:!0,clientsClaim:!0};let X=Y.serviceWorker||{},Q=Y.routes||[],J=[{name:"workbox-precaching",exports:["precacheAndRoute","cleanupOutdatedCaches"]},{name:"workbox-routing",exports:["registerRoute","NavigationRoute","setDefaultHandler"]}],G=new Set;for(let _ of Q)G.add(C$(_.strategy));if(G.size>0)J.push({name:"workbox-strategies",exports:Array.from(G)});if(Q.some((_)=>_.maxAgeSeconds||_.maxEntries)||Y.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(Y.backgroundSync?.enabled)J.push({name:"workbox-background-sync",exports:["BackgroundSyncPlugin","Queue"]});if(X.navigationPreload)J.push({name:"workbox-navigation-preload",exports:["enable"]});let q=Z?$1(Z,$):void 0;return{mode:"generate",modules:J,precacheManifest:q?.entries,skipWaiting:X.skipWaiting??!0,clientsClaim:X.clientsClaim??!0,offlineFallback:Y.offline?.enabled?"/offline.html":void 0,navigationPreload:X.navigationPreload??!1,cacheVersion:X.cacheVersion||"1.0.0"}}function z6($,Z){let Y=$.pwa;if(!Y?.enabled)return"";let X=B6($,Z),Q=Y.serviceWorker||{},J=Y.push,G=Y.backgroundSync,K=Z?$1(Z,$):null,q=K?B5(K):"[]",_=HX(X.modules),U=W6($);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?
|
|
172
|
+
${J?.enabled?FX(J):"// Push notifications disabled"}
|
|
173
173
|
|
|
174
|
-
${G?.enabled?
|
|
174
|
+
${G?.enabled?VX(G):"// Background sync disabled"}
|
|
175
175
|
|
|
176
176
|
console.log('[Workbox SW] Service Worker loaded - Version:', CACHE_VERSION);
|
|
177
|
-
`}function
|
|
178
|
-
`)}function
|
|
177
|
+
`}function HX($){let Z=[];for(let Y of $){let X=Y.name.replace("workbox-","");Z.push(`const { ${Y.exports.join(", ")} } = workbox.${LX(X)};`)}return Z.join(`
|
|
178
|
+
`)}function LX($){return $.replace(/-([a-z])/g,(Z,Y)=>Y.toUpperCase())}function FX($){return`
|
|
179
179
|
// ============================================================================
|
|
180
180
|
// Push Notifications
|
|
181
181
|
// ============================================================================
|
|
@@ -244,7 +244,7 @@ self.addEventListener('notificationclick', (event) => {
|
|
|
244
244
|
})
|
|
245
245
|
);
|
|
246
246
|
});
|
|
247
|
-
`}function
|
|
247
|
+
`}function VX($){return`
|
|
248
248
|
// ============================================================================
|
|
249
249
|
// Background Sync
|
|
250
250
|
// ============================================================================
|
|
@@ -306,7 +306,7 @@ self.addEventListener('message', (event) => {
|
|
|
306
306
|
event.waitUntil(syncQueue.pushRequest({ request }));
|
|
307
307
|
}
|
|
308
308
|
});
|
|
309
|
-
`}function
|
|
309
|
+
`}function j6($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function RX($){if(j6($))return z6;let{generateServiceWorker:Z}=(g1(),X6(L6));return Z}var H6=y(()=>{f1()});var L6={};o(L6,{isWorkboxEnabled:()=>F6,getServiceWorkerFileName:()=>V1,generateServiceWorkerAuto:()=>TX,generateServiceWorker:()=>z5});function z5($,Z){let Y=$.pwa;if(!Y?.enabled)return"";let X=Y.serviceWorker||{},Q=Y.routes||[],J=X.cacheVersion||"1.0.0",G=Y.offline,K=G?.page?"/offline.html":"/offline.html",q=Y.push,_=Y.backgroundSync,U=Y.cacheStorage,W=Z?$1(Z,$):null,B=W?B5(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
|
*
|
|
@@ -320,7 +320,7 @@ self.addEventListener('message', (event) => {
|
|
|
320
320
|
* Additional features:
|
|
321
321
|
* - Push notifications: ${q?.enabled?"enabled":"disabled"}
|
|
322
322
|
* - Background sync: ${_?.enabled?"enabled":"disabled"}
|
|
323
|
-
* - Cache limits: ${U?.maxSize?`${
|
|
323
|
+
* - Cache limits: ${U?.maxSize?`${_6(U.maxSize*1024*1024)}`:"unlimited"}
|
|
324
324
|
*/
|
|
325
325
|
|
|
326
326
|
const CACHE_VERSION = '${J}';
|
|
@@ -501,9 +501,9 @@ self.addEventListener('message', (event) => {
|
|
|
501
501
|
}
|
|
502
502
|
});
|
|
503
503
|
|
|
504
|
-
${q?.enabled?
|
|
504
|
+
${q?.enabled?NX():"// Push notifications disabled"}
|
|
505
505
|
|
|
506
|
-
${_?.enabled?
|
|
506
|
+
${_?.enabled?AX():"// 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
|
|
871
|
+
`}function NX(){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
|
|
953
|
+
`}function AX(){return`
|
|
954
954
|
/**
|
|
955
955
|
* Background sync queue storage (IndexedDB)
|
|
956
956
|
*/
|
|
@@ -1132,14 +1132,14 @@ self.addEventListener('message', (event) => {
|
|
|
1132
1132
|
event.waitUntil(registerFormSync(event.data.payload));
|
|
1133
1133
|
}
|
|
1134
1134
|
});
|
|
1135
|
-
`}function
|
|
1135
|
+
`}function V1($){return $.pwa?.serviceWorker?.fileName||"sw.js"}function F6($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function TX($,Z){if(!$.pwa?.enabled)return"";if(F6($)){let{generateWorkboxServiceWorker:Y}=(H6(),X6(O6));return Y($,Z)}return z5($,Z)}var g1=y(()=>{f1()});var V6={};o(V6,{injectPwaTags:()=>x$,generateThemeColorMeta:()=>IX,generateSwRegistrationScript:()=>wX,generatePwaTags:()=>j5,generateManifestLink:()=>MX});function j5($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,X=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",Q=V1($),J=`
|
|
1136
1136
|
<!-- stx PWA Meta Tags -->
|
|
1137
1137
|
<link rel="manifest" href="/manifest.json">
|
|
1138
|
-
<meta name="theme-color" content="${
|
|
1138
|
+
<meta name="theme-color" content="${v$(Y?.themeColor||"#000000")}">
|
|
1139
1139
|
<meta name="mobile-web-app-capable" content="yes">
|
|
1140
1140
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
1141
1141
|
<meta name="apple-mobile-web-app-status-bar-style" content="default">
|
|
1142
|
-
<meta name="apple-mobile-web-app-title" content="${
|
|
1142
|
+
<meta name="apple-mobile-web-app-title" content="${v$(Y?.shortName||Y?.name||"App")}">`;if(Z.icons?.generateAppleIcons!==!1)J+=`
|
|
1143
1143
|
<link rel="apple-touch-icon" href="${X}/apple-touch-icon.png">
|
|
1144
1144
|
<link rel="apple-touch-icon" sizes="120x120" href="${X}/apple-touch-icon-120x120.png">
|
|
1145
1145
|
<link rel="apple-touch-icon" sizes="152x152" href="${X}/apple-touch-icon-152x152.png">
|
|
@@ -1176,12 +1176,12 @@ if ('serviceWorker' in navigator) {
|
|
|
1176
1176
|
});
|
|
1177
1177
|
}
|
|
1178
1178
|
</script>
|
|
1179
|
-
<!-- End stx PWA -->`,J}function
|
|
1180
|
-
`+$.slice(Q)}return $+
|
|
1181
|
-
</head>`)}function
|
|
1179
|
+
<!-- End stx PWA -->`,J}function x$($,Z){let Y=Z.pwa;if(!Y?.enabled||Y.autoInject===!1)return $;if($.includes("<!-- stx PWA Meta Tags -->"))return $;if(!$.includes("</head>")){let Q=$.lastIndexOf("</body>");if(Q!==-1){let J=j5(Z);return $.slice(0,Q)+J+`
|
|
1180
|
+
`+$.slice(Q)}return $+j5(Z)}let X=j5(Z);return $.replace("</head>",`${X}
|
|
1181
|
+
</head>`)}function wX($){if(!$.pwa?.enabled)return"";return`<script>
|
|
1182
1182
|
if ('serviceWorker' in navigator) {
|
|
1183
1183
|
window.addEventListener('load', function() {
|
|
1184
|
-
navigator.serviceWorker.register('/${
|
|
1184
|
+
navigator.serviceWorker.register('/${V1($)}')
|
|
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
|
|
1193
|
+
</script>`}function MX(){return'<link rel="manifest" href="/manifest.json">'}function IX($){return`<meta name="theme-color" content="${v$($)}">`}function v$($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var O5=y(()=>{g1()});var U0;var N6=y(()=>{U0={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 A6($,Z,Y,X){let Q=$;Q=Q.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,q)=>{let U={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[K]||"Make this element accessible";return`<!-- a11y-hint: ${q||U} -->`});let J=/@screenReader\(([^@]*)\)@endScreenReader/g;return Q=Q.replace(J,(G,K)=>{return`<span class="sr-only">${K.trim()}</span>`}),Q=Q.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(G,K,q)=>{return`<span id="${`desc-${K}`}" class="sr-only">${q}</span>`}),Q}var T6,w6;var f$=y(()=>{T6={name:"a11y",handler:($,Z,Y,X)=>{if(!Z.length)return $;let Q=Z[0].replace(/['"]/g,""),J=Z.length>1?Z[1].replace(/['"]/g,""):"",K={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[Q]||"Make this element accessible";return`<!-- a11y-hint: ${J||K} -->${$}`},hasEndTag:!1},w6={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function PX($,Z={}){let{duration:Y,delay:X,ease:Q,direction:J,custom:G}={...h0,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${J==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":J==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
|
|
1194
1194
|
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
|
|
1195
1195
|
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${J==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":J==="out"?"transform: translateY(0); opacity: 1; animation: slideOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: translateY(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
|
|
1196
1196
|
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
|
|
@@ -1200,7 +1200,7 @@ if ('serviceWorker' in navigator) {
|
|
|
1200
1200
|
@keyframes flipIn { from { transform: perspective(400px) rotateX(-90deg); opacity: 0; } to { transform: perspective(400px) rotateX(0); opacity: 1; } }
|
|
1201
1201
|
@keyframes flipOut { from { transform: perspective(400px) rotateX(0); opacity: 1; } to { transform: perspective(400px) rotateX(90deg); opacity: 0; } }`;case"rotate":return`${J==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":J==="out"?"transform: rotate(0); opacity: 1; animation: rotateOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: rotate(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
|
|
1202
1202
|
@keyframes rotateIn { from { transform: rotate(-90deg); opacity: 0; } to { transform: rotate(0); opacity: 1; } }
|
|
1203
|
-
@keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function
|
|
1203
|
+
@keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function CX(){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
|
|
1231
|
+
`}function vX($){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((Y)=>Y.test($))}function xX($=0.1,Z="0px"){return`
|
|
1232
1232
|
<script data-stx-scoped>
|
|
1233
1233
|
// Intersection Observer for scroll animations
|
|
1234
1234
|
(function() {
|
|
@@ -1271,7 +1271,7 @@ else {
|
|
|
1271
1271
|
}
|
|
1272
1272
|
})();
|
|
1273
1273
|
</script>
|
|
1274
|
-
`}function
|
|
1274
|
+
`}function fX(){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
|
|
1389
|
+
`}function gX($,Z,Y={}){let{staggerDelay:X=50,sequence:Q=!1}=Y;return`
|
|
1390
1390
|
<script data-stx-scoped>
|
|
1391
1391
|
// Animation Group: ${$}
|
|
1392
1392
|
(function() {
|
|
@@ -1423,11 +1423,11 @@ else {
|
|
|
1423
1423
|
}
|
|
1424
1424
|
})();
|
|
1425
1425
|
</script>
|
|
1426
|
-
`}function
|
|
1427
|
-
</head>`)}if(Q.includes("stx-observe")){if(!Q.includes("Intersection Observer for scroll animations")){let q=
|
|
1428
|
-
`+Q.slice(_)}}return Q}var
|
|
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"},
|
|
1430
|
-
${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},
|
|
1426
|
+
`}function k6($,Z,Y,X){let Q=$;if(X.animation?.enabled===!1)return Q;let J=Y.includes("test")&&Y.includes("animation");if(!vX(Q)&&!J)return Q;if(!Q.includes('<style id="stx-animation-base">')){let K=fX();Q=Q.replace("</head>",`${K}
|
|
1427
|
+
</head>`)}if(Q.includes("stx-observe")){if(!Q.includes("Intersection Observer for scroll animations")){let q=xX(),_=Q.lastIndexOf("</body>");if(_!==-1)Q=Q.slice(0,_)+q+`
|
|
1428
|
+
`+Q.slice(_)}}return Q}var h0,M6,I6,E6,D6;var g$=y(()=>{h0={duration:300,delay:0,ease:"ease",direction:"both"};M6={name:"transition",handler:($,Z,Y,X)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let Q=Z[0],J=Z.length>1?Number.parseInt(Z[1],10)||h0.duration:h0.duration,G=Z.length>2?Z[2]||h0.ease:h0.ease,K=Z.length>3?Number.parseInt(Z[3],10)||h0.delay:h0.delay,q=Z.length>4?Z[4]||h0.direction:h0.direction,_=`stx-transition-${Math.random().toString(36).substr(2,9)}`,U=PX(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"},I6={name:"scrollAnimate",handler:($,Z,Y,X)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let Q=Z[0],J=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",K=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,q=Z.length>4?Number.parseInt(Z[4],10)||0:0,_=`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"},E6={name:"animationGroup",handler:($,Z,Y,X)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let Q=Z[0],J=Z.slice(1).map((_)=>_.startsWith("#")||_.startsWith(".")?_:`#${_}`),G=Y.staggerDelay||50,K=Y.sequence||!0,q=gX(Q,J,{staggerDelay:G,sequence:K});return`${$}
|
|
1430
|
+
${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},D6={name:"motion",handler:($,Z,Y,X)=>{let Q=Z.length>0?Z[0].toLowerCase()==="true":!0,J=CX();return`<div data-animate="${Q?"auto":"true"}">${$}</div>${J}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as S6}from"stx-router";var b6=y(()=>{h$()});async function hX($,Z,Y,X){let Q=Z[0]?.replace(/['"]/g,"")||"main",J=S6();if(Q!=="main")J=J.replace("container:'main'",`container:'${Q}'`);return`<script data-stx-router>${J}</script>`}var y6;var h$=y(()=>{b6();y6={name:"stxRouter",handler:hX,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function P6($){let Z=$.heatmap;if(!Z?.enabled)return"";let Y={...dX,...Z};return`
|
|
1431
1431
|
<!-- stx Heatmap - Privacy-Compliant Tracking -->
|
|
1432
1432
|
<script>
|
|
1433
1433
|
(function() {
|
|
@@ -1810,16 +1810,16 @@ else {
|
|
|
1810
1810
|
};
|
|
1811
1811
|
})();
|
|
1812
1812
|
</script>
|
|
1813
|
-
`}function
|
|
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
|
|
1815
|
-
`),Q=Q.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),Q=Q.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),Q=Q.replace(/<\/ul>\n<ul>/g,""),Q=Q.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),Q=Q.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),Q=Q.replace(/<\/ol>\n<ol>/g,""),Q=Q.replace(/<li data-ul>/g,"<li>"),Q=Q.replace(/<li data-ol>/g,"<li>"),Y)Q=Q.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(U,W,B)=>{let z=`<tr>${W.split("|").map((F)=>F.trim()).filter(Boolean).map((F)=>`<th>${
|
|
1816
|
-
`).map((F)=>{return`<tr>${F.split("|").map((
|
|
1813
|
+
`}function C6($,Z){let Y=P6(Z);if(!Y)return $;let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Y+$.slice(X);return $+Y}function mX($){let Z={},Y=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let X of Y){let[Q,J]=X.split("="),G=J?.replace(/["']/g,"");switch(Q){case"endpoint":Z.endpoint=G;break;case"samplingRate":Z.samplingRate=Number.parseInt(G,10);break;case"batchSize":Z.batchSize=Number.parseInt(G,10);break;case"trackMouse":Z.trackMouse=G==="true";break;case"trackClicks":Z.trackClicks=G==="true";break;case"trackScroll":Z.trackScroll=G==="true";break;case"honorDnt":Z.honorDnt=G==="true";break;case"debugOverlay":Z.debugOverlay=G==="true";break}}return Z}var dX,v6;var d$=y(()=>{dX={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};v6={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,Y,X)=>{let Q=Y.__stx_config||{};if(Z.length>0){let J=mX(Z.join(" "));Q.heatmap={...Q.heatmap,...J,enabled:!0}}return P6(Q)}}});function l0($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function x6($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function f6($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Y=$.match(Z);if(!Y)return{data:{},content:$.trim()};let X=Y[1],Q=$.slice(Y[0].length),J={};for(let G of X.split(`
|
|
1814
|
+
`)){let K=G.trim();if(!K||K.startsWith("#"))continue;let q=K.indexOf(":");if(q===-1)continue;let _=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 h1($,Z={}){let{gfm:Y=!0,breaks:X=!1}=Z,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>"),Y)Q=Q.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Q=Q.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(U,W,B)=>{return`<img src="${x6(B)?l0(B):""}" alt="${l0(W)}" />`}),Q=Q.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(U,W,B)=>{return`<a href="${x6(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
|
+
`),Q=Q.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),Q=Q.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),Q=Q.replace(/<\/ul>\n<ul>/g,""),Q=Q.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),Q=Q.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),Q=Q.replace(/<\/ol>\n<ol>/g,""),Q=Q.replace(/<li data-ul>/g,"<li>"),Q=Q.replace(/<li data-ol>/g,"<li>"),Y)Q=Q.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(U,W,B)=>{let z=`<tr>${W.split("|").map((F)=>F.trim()).filter(Boolean).map((F)=>`<th>${l0(F)}</th>`).join("")}</tr>`,O=B.trim().split(`
|
|
1816
|
+
`).map((F)=>{return`<tr>${F.split("|").map((H)=>H.trim()).filter(Boolean).map((H)=>`<td>${l0(H)}</td>`).join("")}</tr>`}).join(`
|
|
1817
1817
|
`);return`<table>
|
|
1818
1818
|
<thead>
|
|
1819
1819
|
${z}
|
|
1820
1820
|
</thead>
|
|
1821
1821
|
<tbody>
|
|
1822
|
-
${
|
|
1822
|
+
${O}
|
|
1823
1823
|
</tbody>
|
|
1824
1824
|
</table>`});if(Y)Q=Q.replace(/<li>\s*\[\s*\]\s*/g,'<li><input type="checkbox" disabled /> '),Q=Q.replace(/<li>\s*\[x\]\s*/gi,'<li><input type="checkbox" checked disabled /> ');let G=Q.split(`
|
|
1825
1825
|
`),K=[],q=!1,_=[];for(let U of G){let W=U.trim();if(/^<(?:h[1-6]|ul|ol|li|blockquote|pre|table|thead|tbody|tr|th|td|hr|div|p)/.test(W)||/^\0CODEBLOCK\d+\0$/.test(W)||W===""){if(q&&_.length>0)K.push(`<p>${_.join(X?`<br />
|
|
@@ -1828,13 +1828,13 @@ ${H}
|
|
|
1828
1828
|
`:`
|
|
1829
1829
|
`)}</p>`);if(Q=K.join(`
|
|
1830
1830
|
`),X)Q=Q.replace(/\n/g,`<br />
|
|
1831
|
-
`);for(let U=0;U<J.length;U++)Q=Q.replace(`\x00CODEBLOCK${U}\x00`,J[U]);return Q=Q.replace(/<p>\s*<\/p>/g,""),Q.trim()}function
|
|
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 Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(X,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
|
|
1832
1832
|
`});let Y=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(Y,(X,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
|
|
1833
|
-
`}),$}var
|
|
1834
|
-
export { ${z.join(", ")} }`:"";await Bun.write(W,$+
|
|
1833
|
+
`}),$}var m$={};o(m$,{hasUserImports:()=>uX,bundleClientScript:()=>pX});import C0 from"path";import Z1 from"fs";function uX($){let Z=/^\s*import\s+(?!type\s)/gm;if(!$.match(Z))return!1;let X=/^\s*import\s+(?!type\s).*?\s+from\s+['"]([^'"]+)['"]/gm,Q;while((Q=X.exec($))!==null){let G=Q[1];if(!g6.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(!g6.some((q)=>q.test(G)))return console.log("[stx:bundler] detected side-effect import:",G),!0}return!1}function lX($){return{name:"stx-client-bundle",setup(Z){Z.onResolve({filter:/^(stx|@stacksjs\/stx|@stacksjs\/browser)$/},(Y)=>({path:Y.path,external:!0})),Z.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(Y)=>({path:Y.path,external:!0})),Z.onResolve({filter:/^@\//},(Y)=>{let X=C0.resolve($,Y.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:",Y.path,"\u2192",J),{path:J};return console.warn("[stx:bundler] could not resolve @/ import:",Y.path),{path:X}})}}}async function pX($,Z,Y={}){let X=Y.projectRoot||process.cwd(),Q=Y.minify??!1,J=Y.cacheDir||C0.join(X,".stx","bundle-cache"),G=new Bun.CryptoHasher("md5");G.update($+Z);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(Z),z=[],O=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,F=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,L;while((L=O.exec($))!==null){if(L[1])continue;if(L[2])L[2].split(",").forEach((V)=>{let N=V.split(":")[0].trim();if(N)z.push(N)});else if(L[3])z.push(L[3])}while((L=F.exec($))!==null){if(L[1])continue;z.push(L[2])}let H=z.length>0?`
|
|
1834
|
+
export { ${z.join(", ")} }`:"";await Bun.write(W,$+H),console.log("[stx:bundler] bundling:",K,"from:",C0.basename(Z));try{let V=await Bun.build({entrypoints:[W],outdir:B,target:"browser",format:"esm",minify:Q,plugins:[lX(X)],define:{"process.env.NODE_ENV":Q?'"production"':'"development"'},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 g6;var u$=y(()=>{g6=[/^stx$/,/^@stacksjs\/stx$/,/^@stacksjs\/browser$/,/^@stores$/,/^stx\/stores$/,/^@composables$/]});function sX($){let Z=new Set,Y=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,X;while((X=Y.exec($))!==null)if(!nX.has(X[1]))Z.add(X[1]);return Array.from(Z)}function oX($){let Z=new Set,Y=new Set,X=$;X=X.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let Q=new Set,J=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|stx)['"]\s*;?\s*$/gm,G;while((G=J.exec($))!==null){let q=G[1],_=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")Z.add(W);else Y.add(W)}),X=X.replace(G[0],"// [auto-import processed]")}for(let q of cX){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\s*\\(`,"g").test(X))Z.add(q)}for(let q of iX){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(X))Y.add(q)}let K=sX(X);for(let q of K)if(!Q.has(q))Y.add(q);return{code:X,stxImports:Array.from(Z),browserImports:Array.from(Y)}}function rX($,Z){let Y=[];if($.length>0)Y.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)Y.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(Y.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
|
|
1835
1835
|
${Y.join(`
|
|
1836
1836
|
`)}
|
|
1837
|
-
`;return""}function
|
|
1837
|
+
`;return""}function tX($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let Y of $.systemKeys)Z.push(`if (!$event.${Y}Key) return`);if($.keys.length>0){let Y=$.keys.map((X)=>`$event.key === '${X}'`).join(" || ");Z.push(`if (!(${Y})) return`)}if($.mouse!==null){let Y=aX[$.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function eX($,Z){let{elementId:Y,event:X,handler:Q,modifiers:J}=$,G=tX(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,25 +1870,25 @@ else {
|
|
|
1870
1870
|
else {
|
|
1871
1871
|
${Q}
|
|
1872
1872
|
}
|
|
1873
|
-
}${q})`}function
|
|
1873
|
+
}${q})`}function $2($){if($.length===0)return"";return`
|
|
1874
1874
|
// STX: auto-generated event bindings
|
|
1875
|
-
${$.map((Y,X)=>
|
|
1876
|
-
`)}`}function
|
|
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("_")&&!Y.has(B))Z.push(B),Y.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(":"),
|
|
1875
|
+
${$.map((Y,X)=>eX(Y,X)).join(`
|
|
1876
|
+
`)}`}function h6($){let Z=[],Y=new Set,X=$.replace(/^\s*import\s+.*$/gm,""),Q=0,J=X.length,G=0;while(G<J){let K=X[G];if(K==="'"||K==='"'||K==="`"){let q=K;if(G++,q==="`"){let _=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("_")&&!Y.has(B))Z.push(B),Y.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("_")&&!Y.has(O))Z.push(O),Y.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("_")&&!Y.has(B))Z.push(B),Y.add(B);G+=W[0].length;continue}}G++}return Z}function Y2($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(B){let j;while((j=Y.exec(B))!==null){let z=j[0];if(!Z2.has(z))Z.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 Z}async function H5($,Z={}){let Y=$,X="",Q=!1,{hasUserImports:J,bundleClientScript:G}=await Promise.resolve().then(() => (u$(),m$));if(J(Y))console.log("[stx:bundler] user imports detected, bundling..."),Y=await G(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Q=!0;if(Z.autoImports!==!1){let z=oX(Y);Y=z.code,X=rX(z.stxImports,z.browserImports)}if(Y=p0(Y),!Q&&Y1(Z.attrs||""))Y=X1(Y);let K=$2(Z.eventBindings||[]),q=(Z.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}${Y}
|
|
1879
1879
|
${K}
|
|
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(Y),B=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function j(z){let
|
|
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(Y),B=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function j(z){let O=z.length>0?`
|
|
1881
1881
|
return { ${z.join(", ")} };`:"";return`<script data-stx-scoped>
|
|
1882
1882
|
window.stx.mount(function() {
|
|
1883
1883
|
'use strict';
|
|
1884
1884
|
${X}${Y}
|
|
1885
|
-
${K}${
|
|
1886
|
-
})</script>`}if(!B&&!W){if(U)return j(
|
|
1885
|
+
${K}${O}
|
|
1886
|
+
})</script>`}if(!B&&!W){if(U)return j(h6($));if(Z.templateContent){let z=h6($);if(z.length>0){let O=Y2(Z.templateContent);if(z.some((L)=>O.has(L)))return j(z)}}}return`<script data-stx-scoped>
|
|
1887
1887
|
;(function() {
|
|
1888
1888
|
'use strict';
|
|
1889
1889
|
${X}${Y}
|
|
1890
1890
|
${K}
|
|
1891
|
-
})()</script>`}var
|
|
1891
|
+
})()</script>`}var cX,iX,nX,aX,Z2;var l$=y(()=>{L0();cX=["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"],iX=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser"],nX=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"]);aX={left:0,middle:1,right:2};Z2=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 Q2($){let Z="",Y=null,X=!1;for(let Q=0;Q<$.length;Q++){let J=$[Q];if(X){X=!1;continue}if(J==="\\"&&Y){X=!0;continue}if(Y){if(Y==="`"&&J==="$"&&Q+1<$.length&&$[Q+1]==="{"){let G=1;Q+=2;while(Q<$.length&&G>0){if($[Q]==="{")G++;else if($[Q]==="}")G--;if(G>0)Z+=$[Q],Q++}continue}if(J===Y)Y=null;continue}if(J==='"'||J==="'"||J==="`"){Y=J;continue}Z+=J}return Z}function d1($){let Z=$.trim(),Y=Q2(Z);for(let X of m6)if(X.test(Y))throw Error(`Potentially unsafe expression (matched /${X.source}/): ${Z}`);if(!d6.allowBracketNotation&&J2.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function G2($){let Z={};Z.Math=Math,Z.JSON=JSON,Z.Date=Date,Z.String=String,Z.Number=Number,Z.Boolean=Boolean,Z.Array=Array,Z.parseInt=Number.parseInt,Z.parseFloat=Number.parseFloat,Z.isNaN=Number.isNaN,Z.isFinite=Number.isFinite,Z.encodeURIComponent=encodeURIComponent,Z.decodeURIComponent=decodeURIComponent;for(let[Y,X]of Object.entries($)){if(Y.startsWith("__")||m6.some((Q)=>Q.test(Y)))continue;if(X&&typeof X==="object"&&!Array.isArray(X))Z[Y]=p$(X);else Z[Y]=X}return Z}function p$($,Z=0){if(Z>=d6.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((X)=>p$(X,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Y={};for(let[X,Q]of Object.entries($)){if(X.startsWith("__")||X==="constructor"||X==="prototype")continue;if(Q&&typeof Q==="object")Y[X]=p$(Q,Z+1);else Y[X]=Q}return Y}function X0($,Z){try{let Y=d1($),X=G2(Z);return Function(...Object.keys(X),`
|
|
1892
1892
|
'use strict';
|
|
1893
1893
|
try {
|
|
1894
1894
|
return ${Y};
|
|
@@ -1899,7 +1899,7 @@ catch (e) {
|
|
|
1899
1899
|
}
|
|
1900
1900
|
throw e;
|
|
1901
1901
|
}
|
|
1902
|
-
`)(...Object.values(X))}catch{return}}function t($){try{return
|
|
1902
|
+
`)(...Object.values(X))}catch{return}}function t($){try{return d1($),!0}catch{return!1}}function z0($,Z){try{let Y=X0($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function $0($,Z){let Y=d1($);return Function(...Z,`
|
|
1903
1903
|
'use strict';
|
|
1904
1904
|
try {
|
|
1905
1905
|
return ${Y};
|
|
@@ -1910,7 +1910,7 @@ catch (e) {
|
|
|
1910
1910
|
}
|
|
1911
1911
|
throw e;
|
|
1912
1912
|
}
|
|
1913
|
-
`)}function L7($){let Z=$.trim(),Y=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let X of Y)if(X.test(Z))return!1;return!0}var oX,v8,x8,rX;var V4=C(()=>{oX={maxSanitizeDepth:10,allowBracketNotation:!1},v8={...oX},x8=[/\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/],rX=/[\w)\]]\s*\[\s*['"]/});function F7($,Z){let Y=eX++,X=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return $J.set(X,{type:$,expression:Z}),X}var eX=0,$J;var f8=C(()=>{$J=new Map});var p8={};o(p8,{usesSignalsInScript:()=>V7,unescapeHtml:()=>p6,registerFilters:()=>YJ,registerFilter:()=>d8,processExpressions:()=>J5,interpolateScriptsInTemplate:()=>JJ,interpolateScriptExpressions:()=>u8,getAllFilters:()=>m8,evaluateExpression:()=>d4,escapeHtml:()=>X5,defaultFilters:()=>u5,clearCustomFilters:()=>XJ,applyFilters:()=>l8});function ZJ($){let Z=g8.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),g8.set($,Z)}return Z.lastIndex=0,Z}function d8($,Z){if($ in u5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);m5[$]=Z}function YJ($){for(let[Z,Y]of Object.entries($))d8(Z,Y)}function m8(){return{...u5,...m5}}function XJ(){for(let $ of Object.keys(m5))delete m5[$]}function X5($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function V7($){let Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=Z.exec($))!==null){let X=Y[1];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(X))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;return!1}function h8($,Z){let Y=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],X=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Q="",J=!1,G=0;for(let _=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(!Y.includes(_)&&!(_ in Z))return!1}}return!0}function u8($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=d4(Q,Z);if(J===void 0)return X;return J===null?"":String(J)}catch{return X}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q)=>{let J=Q.trim();if(/^__[A-Z_]+__$/.test(J))return X;try{let G=d4(Q,Z);if(G===void 0)return X;return JSON.stringify(G)}catch{return X}}),Y}function JJ($,Z,Y={}){return $.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(X,Q,J)=>{if(/\bsrc\s*=/.test(Q))return X;if(/\bdata-raw\b/.test(Q))return X;if(/\btype\s*=\s*["']application\/json["']/.test(Q))return X;if(Y.skipServer&&/\bserver\b/.test(Q))return X;let G=u8(J,Z);return`<script${Q}>${G}</script>`})}function J5($,Z,Y){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=V7($);X=X.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(K,q,_)=>{try{let U=d4(q,Z);return U!==void 0&&U!==null?String(U):""}catch(U){let W=U instanceof Error?U.message:String(U);return J4("Expression",`Error evaluating: {{{ ${q.trim()}}}}: ${W}`,Y,$,_,K)}}),X=X.replace(/\{!!([\s\S]*?)!!\}/g,(K,q,_)=>{try{let U=d4(q,Z);if(U===void 0&&Z.__stx_buildMode==="compile")return F7("raw",q.trim());return U!==void 0&&U!==null?String(U):""}catch(U){if(Z.__stx_buildMode==="compile")return F7("raw",q.trim());let W=U instanceof Error?U.message:String(U);return J4("Expression",`Error evaluating: {!! ${q.trim()} !!}: ${W}`,Y,$,_,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],H=z&&((z in Z)||W.includes(z)),F=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,L=U.match(F),O=L&&!W.includes(L[1])&&!(L[1]in Z);if(/^__[A-Z_]+__$/.test(U))return"";try{let V=d4(q,Z);if(V===void 0&&G&&!h8(U,Z))return K;if(V===void 0&&Z.__stx_buildMode==="compile"&&!G)return F7("expr",U);return V!==void 0&&V!==null?X5(String(V)):""}catch(V){if(G&&!h8(U,Z))return K;if(O)return K;let N=V instanceof Error?V.message:String(V);return J4("Expression",`Error evaluating: {{ ${U} }}: ${N}`,Y,$,_,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 l8($,Z,Y){if(!Z.trim())return $;let X=$,Q=Z.trim();while(Q.length>0){let J=Q.match(/^(\w+)/);if(!J)break;let G=J[1];Q=Q.substring(G.length).trim();let K=m5[G]||u5[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(m8()).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=[d4(`(${W})`,Y,!0)];else{let B=[],j="",z=null,H=0,F=0,L=0,O=!1;for(let V=0;V<W.length;V++){let N=W[V];if(O){j+=N,O=!1;continue}if(N==="\\"){j+=N,O=!0;continue}if(z){if(j+=N,N===z)z=null;continue}if(N==='"'||N==="'"||N==="`"){z=N,j+=N;continue}if(N==="(")H++;else if(N===")")H--;else if(N==="[")F++;else if(N==="]")F--;else if(N==="{")L++;else if(N==="}")L--;if(N===","&&H===0&&F===0&&L===0){B.push(j),j="";continue}j+=N}if(j)B.push(j);q=B.map((V)=>{let N=V.trim();return d4(N,Y,!0)})}}catch{q=[W]}Q=Q.substring(U).trim()}}try{X=K(X,Y,...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 QJ($){let Z=!1,Y="",X=0,Q=0,J=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],_=$[K+1];if(Z&&G){G=!1;continue}if(Z&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Z)Z=!0,Y=q;else if(q===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&q==="$"&&_==="{"){let U=1;K+=2;while(K<$.length&&U>0){if($[K]==="{")U++;else if($[K]==="}")U--;if(U>0)K++}continue}if(Z)continue;if(q==="(")X++;else if(q===")")X--;else if(q==="[")Q++;else if(q==="]")Q--;else if(q==="{")J++;else if(q==="}")J--;if(q==="|"&&X===0&&Q===0&&J===0){if(_==="|"){K++;continue}if(_==="="){K++;continue}return K}}return-1}function d4($,Z,Y=!1){try{let X=$.trim(),Q=QJ(X);if(Q>0){let J=X.substring(0,Q).trim(),G=X.substring(Q+1).trim(),K=d4(J,Z,!0);return l8(K,G,Z)}if(!t(X)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${X}`);return X4(X,Z)}try{let J=Object.keys(Z),G=Object.values(Z);return $4(X,J)(...G)}catch{return X4(X,Z)}}catch(X){if(!Y)console.error(`Error evaluating expression: ${$}`,X);throw X}}function p6($){if(!$)return"";return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}var m5,g8,u5;var p4=C(()=>{V4();L4();f8();m5={},g8=new Map;u5={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let Y=String($);return Y.charAt(0).toUpperCase()+Y.slice(1)},number:($,Z,Y=0)=>{if($===void 0||$===null)return"";try{let X=Number($);return Number.isNaN(X)?"":X.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:($,Z,Y="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return X.toLocaleString(Y)}catch{return String($)}},join:($,Z,Y=",")=>{if(!Array.isArray($))return"";return $.join(String(Y))},escape:($,Z)=>{if($===void 0||$===null)return"";return X5(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let X=Z.__translations,Q=Z.__i18nConfig?.fallbackToKey??!0,J=String($).split("."),G=X;for(let q of J){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return Q?$:"";let K=String(G);return Object.entries(Y).forEach(([q,_])=>{K=K.replace(ZJ(q),String(_))}),K},t:($,Z,Y={})=>{return u5.translate($,Z,Y)},truncate:($,Z,Y=50,X="...")=>{if($===void 0||$===null)return"";let Q=String($);if(Q.length<=Y)return Q;if(Y<=X.length)return X.substring(0,Y);return Q.substring(0,Y-X.length)+X},date:($,Z,Y="short",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=$ instanceof Date?$:new Date($);if(Number.isNaN(Q.getTime()))return String($);let J={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Y==="iso")return Q.toISOString();return new Intl.DateTimeFormat(X,J[Y]||J.short).format(Q)}catch{return String($)}},currency:($,Z,Y="USD",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=Number($);if(Number.isNaN(Q))return String($);return new Intl.NumberFormat(X,{style:"currency",currency:Y}).format(Q)}catch{return String($)}},pluralize:($,Z,Y,X)=>{let Q=Number($);if(Number.isNaN(Q))return Y;let J=X||`${Y}s`;return Q===1?Y:J},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Y=String($);return Y.charAt(Y.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,Y=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Y?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,Y="")=>{return $===void 0||$===null||$===""?Y:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,Y=0,X)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,X);return $},replace:($,Z,Y,X="")=>{if($===void 0||$===null)return"";let Q=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Q,"g"),()=>X)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let Y=Number($);return Number.isNaN(Y)?0:Math.abs(Y)},round:($,Z,Y=0)=>{let X=Number($);if(Number.isNaN(X))return 0;let Q=10**Y;return Math.round(X*Q)/Q}}});class l5{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let Y=this.cache.keys().next().value;if(Y!==void 0)this.cache.delete(Y)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function N5($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!R5.has(Y)){if(R5.size>=GJ){let X=R5.keys().next().value;if(X)R5.delete(X)}R5.set(Y,new RegExp($,Z))}return R5.get(Y)}class c8{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),X=this.pool.find((K)=>K.context.join(",")===Y);if(X)return X.func;let Q=this.fnCache,J=this.fnCacheMaxSize,G=(...K)=>{return(q)=>{try{let _=`${Y}:${q}`,U=Q.get(_);if(!U){if(Q.size>=J){let W=Q.keys().next().value;if(W)Q.delete(W)}U=Function(...Z,`
|
|
1913
|
+
`)}function L5($){let Z=$.trim(),Y=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let X of Y)if(X.test(Z))return!1;return!0}var X2,d6,m6,J2;var V0=y(()=>{X2={maxSanitizeDepth:10,allowBracketNotation:!1},d6={...X2},m6=[/\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/],J2=/[\w)\]]\s*\[\s*['"]/});function F5($,Z){let Y=K2++,X=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return q2.set(X,{type:$,expression:Z}),X}var K2=0,q2;var u6=y(()=>{q2=new Map});var o6={};o(o6,{usesSignalsInScript:()=>V5,unescapeHtml:()=>c$,registerFilters:()=>_2,registerFilter:()=>c6,processExpressions:()=>Q1,interpolateScriptsInTemplate:()=>B2,interpolateScriptExpressions:()=>n6,getAllFilters:()=>i6,evaluateExpression:()=>d0,escapeHtml:()=>J1,defaultFilters:()=>u1,clearCustomFilters:()=>W2,applyFilters:()=>s6});function U2($){let Z=l6.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),l6.set($,Z)}return Z.lastIndex=0,Z}function c6($,Z){if($ in u1)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);m1[$]=Z}function _2($){for(let[Z,Y]of Object.entries($))c6(Z,Y)}function i6(){return{...u1,...m1}}function W2(){for(let $ of Object.keys(m1))delete m1[$]}function J1($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function V5($){let Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=Z.exec($))!==null){let X=Y[1];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(X))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;return!1}function p6($,Z){let Y=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],X=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Q="",J=!1,G=0;for(let _=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(!Y.includes(_)&&!(_ in Z))return!1}}return!0}function n6($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=d0(Q,Z);if(J===void 0)return X;return J===null?"":String(J)}catch{return X}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q)=>{let J=Q.trim();if(/^__[A-Z_]+__$/.test(J))return X;try{let G=d0(Q,Z);if(G===void 0)return X;return JSON.stringify(G)}catch{return X}}),Y}function B2($,Z,Y={}){return $.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(X,Q,J)=>{if(/\bsrc\s*=/.test(Q))return X;if(/\bdata-raw\b/.test(Q))return X;if(/\btype\s*=\s*["']application\/json["']/.test(Q))return X;if(Y.skipServer&&/\bserver\b/.test(Q))return X;let G=n6(J,Z);return`<script${Q}>${G}</script>`})}function Q1($,Z,Y){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=V5($);X=X.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(K,q,_)=>{try{let U=d0(q,Z);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}`,Y,$,_,K)}}),X=X.replace(/\{!!([\s\S]*?)!!\}/g,(K,q,_)=>{try{let U=d0(q,Z);if(U===void 0&&Z.__stx_buildMode==="compile")return F5("raw",q.trim());return U!==void 0&&U!==null?String(U):""}catch(U){if(Z.__stx_buildMode==="compile")return F5("raw",q.trim());let W=U instanceof Error?U.message:String(U);return J0("Expression",`Error evaluating: {!! ${q.trim()} !!}: ${W}`,Y,$,_,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 Z)||W.includes(z)),F=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,L=U.match(F),H=L&&!W.includes(L[1])&&!(L[1]in Z);if(/^__[A-Z_]+__$/.test(U))return"";try{let V=d0(q,Z);if(V===void 0&&G&&!p6(U,Z))return K;if(V===void 0&&Z.__stx_buildMode==="compile"&&!G)return F5("expr",U);return V!==void 0&&V!==null?J1(String(V)):""}catch(V){if(G&&!p6(U,Z))return K;if(H)return K;let N=V instanceof Error?V.message:String(V);return J0("Expression",`Error evaluating: {{ ${U} }}: ${N}`,Y,$,_,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 s6($,Z,Y){if(!Z.trim())return $;let X=$,Q=Z.trim();while(Q.length>0){let J=Q.match(/^(\w+)/);if(!J)break;let G=J[1];Q=Q.substring(G.length).trim();let K=m1[G]||u1[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(i6()).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=[d0(`(${W})`,Y,!0)];else{let B=[],j="",z=null,O=0,F=0,L=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==="[")F++;else if(N==="]")F--;else if(N==="{")L++;else if(N==="}")L--;if(N===","&&O===0&&F===0&&L===0){B.push(j),j="";continue}j+=N}if(j)B.push(j);q=B.map((V)=>{let N=V.trim();return d0(N,Y,!0)})}}catch{q=[W]}Q=Q.substring(U).trim()}}try{X=K(X,Y,...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 z2($){let Z=!1,Y="",X=0,Q=0,J=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],_=$[K+1];if(Z&&G){G=!1;continue}if(Z&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Z)Z=!0,Y=q;else if(q===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&q==="$"&&_==="{"){let U=1;K+=2;while(K<$.length&&U>0){if($[K]==="{")U++;else if($[K]==="}")U--;if(U>0)K++}continue}if(Z)continue;if(q==="(")X++;else if(q===")")X--;else if(q==="[")Q++;else if(q==="]")Q--;else if(q==="{")J++;else if(q==="}")J--;if(q==="|"&&X===0&&Q===0&&J===0){if(_==="|"){K++;continue}if(_==="="){K++;continue}return K}}return-1}function d0($,Z,Y=!1){try{let X=$.trim(),Q=z2(X);if(Q>0){let J=X.substring(0,Q).trim(),G=X.substring(Q+1).trim(),K=d0(J,Z,!0);return s6(K,G,Z)}if(!t(X)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${X}`);return X0(X,Z)}try{let J=Object.keys(Z),G=Object.values(Z);return $0(X,J)(...G)}catch{return X0(X,Z)}}catch(X){if(!Y)console.error(`Error evaluating expression: ${$}`,X);throw X}}function c$($){if(!$)return"";return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}var m1,l6,u1;var c0=y(()=>{V0();L0();u6();m1={},l6=new Map;u1={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let Y=String($);return Y.charAt(0).toUpperCase()+Y.slice(1)},number:($,Z,Y=0)=>{if($===void 0||$===null)return"";try{let X=Number($);return Number.isNaN(X)?"":X.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:($,Z,Y="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return X.toLocaleString(Y)}catch{return String($)}},join:($,Z,Y=",")=>{if(!Array.isArray($))return"";return $.join(String(Y))},escape:($,Z)=>{if($===void 0||$===null)return"";return J1(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let X=Z.__translations,Q=Z.__i18nConfig?.fallbackToKey??!0,J=String($).split("."),G=X;for(let q of J){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return Q?$:"";let K=String(G);return Object.entries(Y).forEach(([q,_])=>{K=K.replace(U2(q),String(_))}),K},t:($,Z,Y={})=>{return u1.translate($,Z,Y)},truncate:($,Z,Y=50,X="...")=>{if($===void 0||$===null)return"";let Q=String($);if(Q.length<=Y)return Q;if(Y<=X.length)return X.substring(0,Y);return Q.substring(0,Y-X.length)+X},date:($,Z,Y="short",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=$ instanceof Date?$:new Date($);if(Number.isNaN(Q.getTime()))return String($);let J={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Y==="iso")return Q.toISOString();return new Intl.DateTimeFormat(X,J[Y]||J.short).format(Q)}catch{return String($)}},currency:($,Z,Y="USD",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=Number($);if(Number.isNaN(Q))return String($);return new Intl.NumberFormat(X,{style:"currency",currency:Y}).format(Q)}catch{return String($)}},pluralize:($,Z,Y,X)=>{let Q=Number($);if(Number.isNaN(Q))return Y;let J=X||`${Y}s`;return Q===1?Y:J},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Y=String($);return Y.charAt(Y.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,Y=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Y?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,Y="")=>{return $===void 0||$===null||$===""?Y:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,Y=0,X)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,X);return $},replace:($,Z,Y,X="")=>{if($===void 0||$===null)return"";let Q=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Q,"g"),()=>X)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let Y=Number($);return Number.isNaN(Y)?0:Math.abs(Y)},round:($,Z,Y=0)=>{let X=Number($);if(Number.isNaN(X))return 0;let Q=10**Y;return Math.round(X*Q)/Q}}});class l1{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let Y=this.cache.keys().next().value;if(Y!==void 0)this.cache.delete(Y)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function N1($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!R1.has(Y)){if(R1.size>=j2){let X=R1.keys().next().value;if(X)R1.delete(X)}R1.set(Y,new RegExp($,Z))}return R1.get(Y)}class r6{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),X=this.pool.find((K)=>K.context.join(",")===Y);if(X)return X.func;let Q=this.fnCache,J=this.fnCacheMaxSize,G=(...K)=>{return(q)=>{try{let _=`${Y}:${q}`,U=Q.get(_);if(!U){if(Q.size>=J){let W=Q.keys().next().value;if(W)Q.delete(W)}U=Function(...Z,`
|
|
1914
1914
|
'use strict';
|
|
1915
1915
|
try {
|
|
1916
1916
|
return ${q};
|
|
@@ -1921,46 +1921,46 @@ 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:Z.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}class
|
|
1924
|
+
`),Q.set(_,U)}return U(...K)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Z.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}class a6{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,Y]of Object.entries($))this.setBudget(Z,Y)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,Y]of this.budgets.entries())$[Z]=Y;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),X}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=await Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),X}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let X=Z/Y.maxTime*100,Q=Y.warnThreshold!==void 0?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,J=Z>=Y.maxTime;if(!Q&&!J)return;let G={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:X,timestamp:new Date,isWarning:Q};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let q of this.violationHandlers)try{q(G)}catch{}let K=Q?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${X.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(X-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(J)throw Error(K);else console.warn(K);break}}recordTime($,Z){let Y=this.metrics.get($);if(Y)Y.count++,Y.totalTime+=Z,Y.maxTime=Math.max(Y.maxTime,Z),Y.minTime=Math.min(Y.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let Y=this.metrics.get($);if(!Y)return{};let X=this.budgets.get($);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:X?.maxTime,budgetUtilization:X?Y.totalTime/Y.count/X.maxTime*100:void 0}}let Z={};for(let[Y,X]of this.metrics.entries()){let Q=this.budgets.get(Y);Z[Y]={count:X.count,avgTime:X.totalTime/X.count,totalTime:X.totalTime,maxTime:X.maxTime,minTime:X.minTime,budget:Q?.maxTime,budgetUtilization:Q?X.totalTime/X.count/Q.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,Y=0;for(let X of this.violations)if($[X.label]=($[X.label]||0)+1,X.isWarning)Z++;else Y++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:Y}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function O2(){if(!i$)i$=new a6;return i$}var R1,j2=500,q_,i$=null,t6;var A1=y(()=>{R1=new Map;q_=new r6;t6=new Proxy({},{get($,Z){return O2()[Z]}})});function e6($,Z=""){let Y=`${$}${Z}`,X=0;for(let Q=0;Q<Y.length;Q++){let J=Y.charCodeAt(Q);X=(X<<5)-X+J,X=X&X}return`stx-${Math.abs(X).toString(36)}`}function $3($,Z,Y={}){let{prefix:X="",preserveHost:Q=!0,scopeKeyframes:J=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=n$($),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=`${Z}_${B}`;_.set(B,j)}}for(let U of K){let W=Z3(U,Z,X,Q,_,G);q.push(W)}return q.join(`
|
|
1925
1925
|
|
|
1926
|
-
`)}function
|
|
1927
|
-
`)})}else Z.push({selector:`@${U} ${W.trim()}`,declarations:B.trim()})}G="",J=!1}else if(Q.trim()){Q+=q;let _=Q.match(/([^{]+)\{([^}]*)\}/);if(_)Z.push({selector:_[1].trim(),declarations:_[2].trim()});Q=""}continue}}if(J)G+=q;else Q+=q}return Z}function
|
|
1926
|
+
`)}function n$($){let Z=[],Y=$.replace(/\/\*[\s\S]*?\*\//g,""),X=0,Q="",J=!1,G="";for(let K=0;K<Y.length;K++){let q=Y[K];if(q==="@"&&X===0)J=!0;if(q==="{")X++;else if(q==="}"){if(X--,X===0){if(J){G+=q;let _=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(_){let[,U,W,B]=_;if(U==="keyframes")Z.push({selector:`@keyframes ${W.trim()}`,declarations:B.trim()});else if(U==="media"||U==="supports"||U==="container"){let j=n$(B);Z.push({selector:`@${U} ${W.trim()}`,declarations:j.map((z)=>`${z.selector} { ${z.declarations} }`).join(`
|
|
1927
|
+
`)})}else Z.push({selector:`@${U} ${W.trim()}`,declarations:B.trim()})}G="",J=!1}else if(Q.trim()){Q+=q;let _=Q.match(/([^{]+)\{([^}]*)\}/);if(_)Z.push({selector:_[1].trim(),declarations:_[2].trim()});Q=""}continue}}if(J)G+=q;else Q+=q}return Z}function Z3($,Z,Y,X,Q,J){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let U=G.replace("@keyframes ","").trim();return`@keyframes ${Q.get(U)||U} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let W=n$(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((B)=>Z3(B,Z,Y,X,Q,J)).join(`
|
|
1928
1928
|
`);return`${G} {
|
|
1929
1929
|
${W}
|
|
1930
|
-
}`}return`${G} { ${K} }`}let q=
|
|
1931
|
-
`)}function
|
|
1932
|
-
`,""}),headContent:Z.trim()}}function
|
|
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==="{")Y++;else if(q==="}")Y--}if(Y===0){let K=Q.match(/(?:const|let|var)\s+(\w+)\s*=/);if(K)Z.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));Z.push(...U)}}}}return[...new Set(Z)]}function
|
|
1934
|
-
|
|
1935
|
-
`),Z}async function
|
|
1936
|
-
`),
|
|
1937
|
-
${
|
|
1938
|
-
${
|
|
1930
|
+
}`}return`${G} { ${K} }`}let q=H2(G,Z,Y,X),_=K;for(let[U,W]of Q)_=_.replace(new RegExp(`\\b${U}\\b`,"g"),W);if(J)_=_.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${q} { ${_} }`}function H2($,Z,Y,X){let Q=$.split(",").map((G)=>G.trim()),J=[];for(let G of Q){if(G.startsWith(":host")){if(X)J.push(G);else{let q=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);J.push(q)}continue}if(G.includes("::slotted")){J.push(G);continue}if(G===":root"){J.push(`:root .${Z}`);continue}let K=Y?`${Y} .${Z}`:`.${Z}`;J.push(`${K} ${G}`)}return J.join(", ")}function R5($,Z){if(!/<style\s+[^>]*\bscoped\b/i.test($))return{html:$,hasScoped:!1};let Y=e6(Z),X=`data-v-${Y}`,Q=$,J=/<style\s+([^>]*\bscoped\b[^>]*)>([\s\S]*?)<\/style>/gi,G=!1;if(Q=Q.replace(J,(K,q,_)=>{G=!0;let U=L2(_,X),W=q.replace(/\bscoped\b/gi,"").trim(),B=W?` ${W}`:"";return`<style data-stx-scoped="${Y}"${B}>${U}</style>`}),!G)return{html:$,hasScoped:!1};return Q=F2(Q,X),{html:Q,hasScoped:!0}}function L2($,Z){return $3($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function F2($,Z){let Y=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(X,Q,J)=>{if(Y.has(Q.toLowerCase()))return X;if(X.includes(Z))return X;if(Q.toLowerCase()==="style"||Q.toLowerCase()==="script")return X;if(J)return X.replace(`<${Q}${J}`,`<${Q} ${Z}${J}`);if(X.endsWith("/>"))return`<${Q} ${Z} />`;return`<${Q} ${Z}>`})}var s$=()=>{};var Y3=()=>{};function w0($,Z,Y,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(_===Z)Q++;else if(_===Y){if(Q--,Q===0)return J}J++}return-1}var o$={};o(o$,{useTitle:()=>w2,useSeoMeta:()=>A5,usePageTitle:()=>w2,useHead:()=>K1,resetHead:()=>N2,renderHtmlAttrs:()=>I2,renderHead:()=>M2,renderBodyAttrs:()=>E2,processTitleDirective:()=>S2,processMetaDirective:()=>b2,processHeadDirective:()=>k2,getPageMeta:()=>R2,getHead:()=>p1,definePageMeta:()=>T2,applyHead:()=>D2});function p1(){return i0}function R2(){return N5}function N2(){i0={},V2.length=0,N5={}}function K1($){i0=A2(i0,$)}function A2($,Z){return{title:Z.title??$.title,titleTemplate:Z.titleTemplate??$.titleTemplate,base:Z.base??$.base,meta:[...$.meta||[],...Z.meta||[]],link:[...$.link||[],...Z.link||[]],script:[...$.script||[],...Z.script||[]],style:[...$.style||[],...Z.style||[]],htmlAttrs:{...$.htmlAttrs,...Z.htmlAttrs},bodyAttrs:{...$.bodyAttrs,...Z.bodyAttrs}}}function A5($){let Z=[];if($.description)Z.push({name:"description",content:$.description});if($.keywords){let q=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Z.push({name:"keywords",content:q})}if($.author)Z.push({name:"author",content:$.author});if($.robots)Z.push({name:"robots",content:$.robots});let Y=$.ogTitle??$.title,X=$.ogDescription??$.description;if(Y)Z.push({property:"og:title",content:Y});if(X)Z.push({property:"og:description",content:X});if($.ogImage)Z.push({property:"og:image",content:$.ogImage});if($.ogUrl)Z.push({property:"og:url",content:$.ogUrl});if($.ogType)Z.push({property:"og:type",content:$.ogType});if($.ogSiteName)Z.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)Z.push({property:"og:locale",content:$.ogLocale});let Q=$.twitterTitle??$.title,J=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(Q)Z.push({name:"twitter:title",content:Q});if(J)Z.push({name:"twitter:description",content:J});if(G)Z.push({name:"twitter:image",content:G});if($.twitterSite)Z.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)Z.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)Z.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)Z.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)Z.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)Z.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let q of $.articleTags)Z.push({property:"article:tag",content:q});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});K1({title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K})}function T2($){if(N5={...N5,...$},$.title||$.description)A5({title:$.title,description:$.description})}function w2($){let Z=typeof $==="function"?$():$;K1({title:Z})}function M2($=i0){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${G1(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([X,Q])=>`${X}="${G1(Q)}"`).join(" ");Z.push(`<base ${Y}>`)}for(let Y of $.meta||[]){let X=Object.entries(Y).filter(([Q,J])=>J!==void 0).map(([Q,J])=>{return`${Q==="httpEquiv"?"http-equiv":Q}="${G1(String(J))}"`}).join(" ");Z.push(`<meta ${X}>`)}for(let Y of $.link||[]){let X=Object.entries(Y).filter(([Q,J])=>J!==void 0).map(([Q,J])=>`${Q}="${G1(String(J))}"`).join(" ");Z.push(`<link ${X}>`)}for(let Y of $.script||[]){let{content:X,...Q}=Y,J=Object.entries(Q).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${G1(String(K))}"`}).filter(Boolean).join(" ");if(X)Z.push(`<script ${J}>${X}</script>`);else Z.push(`<script ${J}></script>`)}for(let Y of $.style||[]){let X=Y.type?` type="${Y.type}"`:"";Z.push(`<style${X}>${Y.content}</style>`)}return Z.join(`
|
|
1931
|
+
`)}function I2($=i0){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${G1(Y)}"`).join(" ")}function E2($=i0){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${G1(Y)}"`).join(" ")}function G1($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function D2($=i0){if(typeof document>"u")return;if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);document.title=Z}for(let Z of $.meta||[]){let Y=Z.name?`meta[name="${Z.name}"]`:Z.property?`meta[property="${Z.property}"]`:null;if(Y){let X=document.querySelector(Y);if(!X){if(X=document.createElement("meta"),Z.name)X.setAttribute("name",Z.name);if(Z.property)X.setAttribute("property",Z.property);document.head.appendChild(X)}X.setAttribute("content",Z.content)}}for(let Z of $.link||[]){let Y=`link[rel="${Z.rel}"]${Z.href?`[href="${Z.href}"]`:""}`,X=document.querySelector(Y);if(!X)X=document.createElement("link"),document.head.appendChild(X);for(let[Q,J]of Object.entries(Z))if(J!==void 0)X.setAttribute(Q,String(J))}if($.htmlAttrs)for(let[Z,Y]of Object.entries($.htmlAttrs))document.documentElement.setAttribute(Z,Y);if($.bodyAttrs)for(let[Z,Y]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,Y)}function k2($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(X,Q)=>{return Z+=Q.trim()+`
|
|
1932
|
+
`,""}),headContent:Z.trim()}}function S2($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,X,Q,J)=>{let G=X?Q:Z[(J||"").trim()]??J;return K1({title:G}),""})}function b2($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Y,X,Q,J,G,K)=>{let q=J?G:K,_=J?q:Z[(q||"").trim()]??q,W=Q.includes(":")?{property:Q,content:_}:{name:Q,content:_};return K1({meta:[W]}),""})}var i0,V2,N5;var c1=y(()=>{i0={},V2=[],N5={}});var T5={};o(T5,{stripTypeScript:()=>G3,hasVariables:()=>B3,extractVariables:()=>K3,extractScriptFromTemplate:()=>W3,convertToCommonJS:()=>a$});import i1 from"path";function y2($){let Z=[],Y=0,X=$.split(`
|
|
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==="{")Y++;else if(q==="}")Y--}if(Y===0){let K=Q.match(/(?:const|let|var)\s+(\w+)\s*=/);if(K)Z.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));Z.push(...U)}}}}return[...new Set(Z)]}function G3($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Y(X){if(!X.includes(":"))return X;let Q=[],J="",G=0,K=0,q=null;for(let _=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 F=B.substring(0,j).trim().replace(/\?$/,""),L=B.substring(j+1),H=-1,V=0;for(let R=0;R<L.length;R++)if(L[R]==="<")V++;else if(L[R]===">")V--;else if(L[R]==="="&&V===0){H=R;break}let N=W?"...":"";if(H!==-1)return`${N}${F} = ${L.substring(H+1).trim()}`;return`${N}${F}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(X,Q,J)=>{if(!J.includes(":"))return X;return`${Q}(${Y(J)})`});{let X=/\b(function\s+\w*\s*)\(/g,Q,J=[];while((Q=X.exec(Z))!==null){let G=Q.index+Q[0].length-1,K=1,q=G+1,_=0,U=null;while(q<Z.length&&K>0){let j=Z[q];if(U){if(j===U)U=null;q++;continue}if(j==='"'||j==="'"||j==="`"){U=j,q++;continue}if(j==="<")_++;else if(j===">"&&_>0)_--;else if(_===0){if(j==="(")K++;else if(j===")")K--}if(K>0)q++}if(K!==0)continue;let W=Z.substring(G+1,q);if(!W.includes(":"))continue;let B=Y(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];Z=Z.substring(0,K)+_+Z.substring(q)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(X,Q)=>{if(!Q.includes(":"))return X;if(Q.includes("{")||Q.includes("}"))return X;return`(${Q.split(",").map((G)=>{let[K,...q]=G.split("="),_=K.split(":")[0].trim();if(q.length>0)return`${_} = ${q.join("=").trim()}`;return _}).join(", ")}) =>`}),Z=Z.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
|
|
1934
|
+
|
|
1935
|
+
`),Z}async function K3($,Z,Y){if(!$.trim())return;let X;try{let C=new Bun.Transpiler({loader:"ts",target:"browser"}),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=G3($)}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=i1.resolve(G,"node_modules",C),x=i1.join(v,"package.json"),p=JSON.parse(e("fs").readFileSync(x,"utf8")),f=p.main||"index.js";if(p.exports){let m=typeof p.exports==="string"?p.exports:p.exports["."];if(typeof m==="string")f=m;else if(m?.bun)f=m.bun;else if(m?.import)f=m.import;else if(m?.default)f=m.default}K[C]=await import(i1.resolve(v,f))}catch{}let _=(C)=>{if(K[C])return K[C];return e(C)},U=Z.props||{},W=Object.assign((C)=>{if(!C)return U;let v={};for(let[x,p]of Object.entries(C)){let f=U[x];if(f!==void 0)v[x]=f;else if(typeof p==="function")v[x]=p();else v[x]=p}return v},U),B=()=>U,j=(C,v)=>{let x={...C};for(let[p,f]of Object.entries(v))if(x[p]===void 0)if(typeof f==="function")x[p]=f();else x[p]=f;return x},z=(C)=>{let v=()=>C;return v.set=(x)=>{},v.update=(x)=>{},v},O=(C)=>{let v,x=!1;return()=>{if(!x)try{v=C(),x=!0}catch{v=void 0}return v}},F=(C)=>{},L=(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)=>{}}),T=(C)=>{K1(C);let v=Z.__stx_runtime_head||{},x=C||{};Z.__stx_runtime_head={...v,...x.title&&{title:x.title},meta:[...v.meta||[],...x.meta||[]],link:[...v.link||[],...x.link||[]],script:[...v.script||[],...x.script||[]],htmlAttrs:{...v.htmlAttrs||{},...x.htmlAttrs||{}},bodyAttrs:{...v.bodyAttrs||{},...x.bodyAttrs||{}}}},w=(C)=>{A5(C);let v=p1();Z.__stx_runtime_head={...Z.__stx_runtime_head||{},...v.title&&{title:v.title},meta:v.meta?[...v.meta]:[]}},E=(C)=>({value:C}),M=(C)=>C,I=(C)=>({value:typeof C==="function"?C():C}),D=(C,v)=>{},P=(C)=>{},b=(C)=>{},S=(C)=>C?C():Promise.resolve(),k=(C)=>(v,...x)=>{},g=(C)=>{},h=(C,v)=>{},i=(C,v)=>v,W0=()=>({value:"light"}),T0=()=>({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,x){return C[v]=x,!0}}),b0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},O0=console;try{let C=a$(X,Y),v=new Set(Object.keys(U)),x=Object.keys(Z).filter((a)=>!v.has(a)&&a!=="props"),p=x.map((a)=>Z[a]),f=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"]),m=[],K0=[];for(let[a,y$]of Object.entries(U)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(a))continue;if(f.has(a))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${a}\\b`).test(C))continue;m.push(a),K0.push(y$)}let Q0=y2(C).map((a)=>`module.exports.${a} = typeof ${a} !== 'undefined' ? ${a} : module.exports.${a};`).join(`
|
|
1936
|
+
`),H0=Z.params??{},y0=[],P0=[];for(let a=0;a<x.length;a++){if(x[a]==="params")continue;y0.push(x[a]),P0.push(p[a])}let b$=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",...m,...y0,`return (async () => {
|
|
1937
|
+
${C}
|
|
1938
|
+
${Q0}
|
|
1939
1939
|
return module.exports
|
|
1940
|
-
})()`)(Q,J,_,U,W,B,j,z,
|
|
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
|
|
1940
|
+
})()`)(Q,J,_,U,W,B,j,z,O,F,L,H,V,N,R,A,T,w,E,M,I,D,P,b,S,k,g,h,i,W0,T0,k0,b0,O0,q0.confirm,q0.alert,q0.fetch,H0,...K0,...P0);Object.assign(Z,b$);for(let[a,y$]of Object.entries(U))if(!(a in Z))Z[a]=y$}catch{try{await v2(X,Z,Y)}catch{}}}function a$($,Z){let Y=Z?i1.dirname(Z):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 i1.resolve(Y,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 F=O.trim().split(/\s+as\s+/).pop()?.trim();if(F)Q.push(`module.exports.${F} = ${F};`)}}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=X3(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=r$(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=X3(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=r$(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 _=r$(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
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
|
|
1943
|
+
`)}function q3($,Z){let Y=$[Z];if(Y!=="{"&&Y!=="[")return null;let Q=w0($,Y,Y==="{"?"}":"]",Z);if(Q===-1)return null;return{pattern:$.slice(Z,Q+1),endPos:Q+1}}function U3($){let Z=[],Y=$.slice(1,-1).trim();if(!Y)return Z;let X=0,Q=0,J="";while(X<Y.length){let G=Y[X];if(G==="{"||G==="["){if(Q++,Q===1){let K=q3(Y,X);if(K){let q=U3(K.pattern);Z.push(...q),X=K.endPos,J="";continue}}}else if(G==="}"||G==="]")Q--;if(Q>0){X++;continue}if(G===","){if(J.trim())Z.push(J.trim());J="",X++;continue}if(G===":"){J="",X++;continue}if(G==="="){if(J.trim())Z.push(J.trim());J="",X++;while(X<Y.length&&Y[X]!==","&&Q===0){if(Y[X]==="{"||Y[X]==="[")Q++;else if(Y[X]==="}"||Y[X]==="]")Q--;X++}continue}if(/[\w$]/.test(G))J+=G;X++}if(J.trim())Z.push(J.trim());return Z}function X3($,Z){let Y=$[Z].trim(),X=Y.match(/^(?:export\s+)?(const|let|var)\s+(\w+)\s*=\s*(.*)$/);if(!X){let _=Y.match(/^(?:export\s+)?(const|let|var)\s+/);if(_){let U=Y.slice(_[0].length),W=Z;if((U.startsWith("{")||U.startsWith("["))&&!U.includes(U.startsWith("{")?"}":"]")){let j=U.startsWith("{")?"}":"]",z=U;for(let O=Z+1;O<$.length;O++)if(z+=" "+$[O].trim(),W=O,$[O].includes(j))break;U=z}let B=q3(U,0);if(B){let j=_[1],z=B.pattern,O=U.slice(B.endPos).trim();if(O.startsWith("=")){let F=O.slice(1).trim(),L=F,H=Math.max(W,Z);if(J3(F)){let A=Q3($,H,F);L=A.value,H=A.nextIndex}else H=H+1;L=L.trim().replace(/;$/,"");let V=U3(z),N=`__stx_src_${Z}`,R=V.map((A)=>`module.exports.${A} = ${A};`).join(`
|
|
1944
1944
|
`);return{type:j,name:N,value:`${L}; ${j} ${z} = ${N};
|
|
1945
|
-
${R}`,nextIndex:
|
|
1946
|
-
${$[q]}`,q++;else break}return K=K.trim().replace(/;$/,""),{type:Q,name:J,value:K,nextIndex:q}}function
|
|
1945
|
+
${R}`,nextIndex:H}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}let[,Q,J,G]=X,K=G,q=Z;if(J3(G)){let _=Q3($,Z,G);K=_.value,q=_.nextIndex}else q=Z+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 r$($,Z){let Y=$[Z].trim(),X=Y.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!X)throw Error(`Failed to parse function declaration: ${Y}`);let[,Q]=X,J=Y.replace(/^export\s+/,""),G=Z;if(P2(Y)){let K=C2($,Z,J);J=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:Q,functionCode:J,nextIndex:G}}function J3($){let Z=$.trim();if(Z.startsWith("{"))return w0(Z,"{","}",0)===-1;if(Z.startsWith("["))return w0(Z,"[","]",0)===-1;return!_3(Z)}function _3($){let Z={paren:0,bracket:0,brace:0},Y=null,X=0;for(let Q=0;Q<$.length;Q++){let J=$[Q];if((Q>0?$[Q-1]:"")==="\\"&&Y)continue;if((J==='"'||J==="'")&&!Y){Y=J;continue}if(J===Y&&Y!=="`"){Y=null;continue}if(J==="`"&&!Y){Y="`";continue}if(J==="`"&&Y==="`"&&X===0){Y=null;continue}if(Y==="`"&&J==="$"&&$[Q+1]==="{"){X++,Q++;continue}if(X>0&&J==="{"){X++;continue}if(X>0&&J==="}"){X--;continue}if(Y)continue;if(J==="(")Z.paren++;else if(J===")")Z.paren--;else if(J==="[")Z.bracket++;else if(J==="]")Z.bracket--;else if(J==="{")Z.brace++;else if(J==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&Y===null}function P2($){let Z=$.indexOf("{");if(Z===-1)return!0;return w0($,"{","}",Z)===-1}function Q3($,Z,Y){let X=Y,Q=Z+1;while(Q<$.length&&!_3(X)){let J=$[Q];X+=`
|
|
1947
1947
|
${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
|
|
1949
|
-
${G}`,Q++}return{functionCode:X,nextIndex:Q}}async function
|
|
1948
|
+
${$[Q]}`,Q++;else break}return{value:X,nextIndex:Q}}function C2($,Z,Y){let X=Y,Q=Z+1;while(Q<$.length){let J=X.indexOf("{");if(J!==-1){if(w0(X,"{","}",J)!==-1)break}let G=$[Q];X+=`
|
|
1949
|
+
${G}`,Q++}return{functionCode:X,nextIndex:Q}}async function v2($,Z,Y){let X=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let J of X){let[,,G,K]=J;try{let q=K.trim().replace(/;$/,""),_=Function(`return ${q}`);Z[G]=_()}catch{try{let q=K.trim().replace(/;$/,""),_=Function(`return (${q})`);Z[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 Z))try{let q=K.trim().replace(/;$/,""),_=Function(`return ${q}`);Z[G]=_()}catch{}}try{let J=$.replace(/^export\s+/gm,""),K=Function(`
|
|
1950
1950
|
${J}
|
|
1951
1951
|
const result = {};
|
|
1952
1952
|
${Array.from($.matchAll(/(?:const|let|var)\s+(\w+)\s*=/g)).map((q)=>`if (typeof ${q[1]} !== 'undefined') result.${q[1]} = ${q[1]};`).join(`
|
|
1953
1953
|
`)}
|
|
1954
1954
|
return result;
|
|
1955
|
-
`)();Object.entries(K).forEach(([q,_])=>{if(_!==void 0&&!(q in Z))Z[q]=_})}catch{}}function
|
|
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((
|
|
1955
|
+
`)();Object.entries(K).forEach(([q,_])=>{if(_!==void 0&&!(q in Z))Z[q]=_})}catch{}}function W3($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1]:"",X=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Y,templateWithoutScript:X}}function B3($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var n1=y(()=>{c1()});var L3={};o(L3,{renderSlot:()=>j3,processSlots:()=>H3,parseSlots:()=>z3,parseSlotElement:()=>f2,extractSlotContent:()=>d2,applySlots:()=>m2});function x2($,Z){let Y=1,X=Z,Q="<template",J="</template";while(X<$.length&&Y>0){let G=$.indexOf("<",X);if(G===-1)break;if(X=G,$.startsWith(Q,X)&&(X+Q.length>=$.length||/[\s>\/]/.test($[X+Q.length]))){Y++,X+=Q.length;continue}if($.startsWith(J,X)){let K=$.indexOf(">",X+J.length);if(K!==-1){if(Y--,Y===0)return K+1;X=K+1;continue}}X++}return Y===0?X:-1}function z3($){let Z={default:"",named:new Map},Y=$,X=/<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>/gi,Q=[],J;while((J=X.exec($))!==null){let[U,W,B,j,z]=J,O=W||B||j,F=J.index+U.length,L=x2($,F);if(L!==-1){let H=$.slice(F,L-11).trim();Q.push({start:J.index,end:L,slotName:O,content:H,propsBinding:z||void 0}),Z.named.set(O,{name:O,content:H,propsBinding:z||void 0})}}Q.sort((U,W)=>W.start-U.start);for(let U of Q)Y=Y.slice(0,U.start)+Y.slice(U.end);let G=[],K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,q;while((q=K.exec(Y))!==null){let[U,W,B,j,z,O]=q,F=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(F+L).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(Y))!==null){let[U,W,B,j,z]=q,O=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=(O+F).trim(),H=`<${W}${L?" "+L:""} />`;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=Z.named.get(U.slotName);if(W)W.content+=U.element;else Z.named.set(U.slotName,{name:U.slotName,content:U.element});Y=Y.slice(0,U.start)+Y.slice(U.end)}return Z.default=Y.trim(),Z}function f2($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[1]:"",X={},Q=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,J;while((J=Q.exec($))!==null)X[J[1]]=J[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:Y,props:X,defaultContent:K}}async function j3($,Z,Y,X){if(!$)return Y;let Q=$.content;if($.propsBinding&&Object.keys(Z).length>0){let J=$.propsBinding.trim(),G={...X};if(J.startsWith("{")&&J.endsWith("}")){let K=J.slice(1,-1).split(",").map((q)=>q.trim()).filter(Boolean);for(let q of K){let[_,U]=q.split(":").map((B)=>B.trim()),W=U||_;if(Z[_]!==void 0)G[W]=Z[_]}}else G[J]=Z;Q=g2(Q,G)}return Q}function g2($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,X)=>{try{let Q=X.trim(),J=O3(Q,Z);return J1(String(J??""))}catch{return`{{ ${X} }}`}})}function O3($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let X=$.split("."),Q=Z;for(let J of X)if(Q&&typeof Q==="object"&&J in Q)Q=Q[J];else return;return Q}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,X,Q,J]=Y,G=Z[X],K=parseInt(J,10);if(typeof G==="number")switch(Q){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!t($))return;return $0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function H3($,Z,Y){let X=$;X=await h2(X,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,_)=>{let U=Z.named.get(K),W=_?.trim()||"",B=q||"",j={},z=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,O;while((O=z.exec(B))!==null){let F=O[1],L=O[2];j[F]=O3(L,Y)}return await j3(U,j,W,Y)});let J=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return X=X.replace(J,(G,K)=>{if(G.includes("name="))return G;let q=K?.trim()||"";return Z.default||q}),X}async function h2($,Z,Y){let X=[],Q=[];$.replace(Z,(K,...q)=>{let _=q[q.length-2];return Q.push({match:K,index:_}),X.push(Y(K,...q.slice(0,-2))),K});let J=await Promise.all(X),G=$;for(let K=Q.length-1;K>=0;K--){let{match:q,index:_}=Q[K];G=G.slice(0,_)+J[K]+G.slice(_+q.length)}return G}function d2($){let Z=z3($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function m2($,Z,Y,X){return await H3($,{default:Z,named:Y},X)}var F3=y(()=>{c0();V0()});import u2 from"fs";import r from"path";function p2($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function c2($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function Y1($){return!c2($)}function X1($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Y=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(J)=>{let G=Y.length;return Y.push(J),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(J)=>{let G=Y.length;return Y.push(J),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(J)=>{let G=Y.length;return Y.push(J),`"__STX_EXPR_${G}__"`});let Q=new Bun.Transpiler({loader:"ts",target:"browser"}).transformSync(Z);for(let J=0;J<Y.length;J++)Q=Q.replace(`"__STX_EXPR_${J}__"`,Y[J]),Q=Q.replace(`'__STX_EXPR_${J}__'`,Y[J]);return Q}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function i2($){let Z=[],Y=new Set,X=0,Q=0,J=$.length,G=(U)=>{Q++;while(Q<J){if($[Q]==="\\"){Q+=2;continue}if($[Q]===U){Q++;return}Q++}},K=()=>{Q++;while(Q<J){if($[Q]==="\\"){Q+=2;continue}if($[Q]==="`"){Q++;return}if($[Q]==="$"&&$[Q+1]==="{"){Q+=2;let U=1;while(Q<J&&U>0)if($[Q]==="{")U++;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 F=O.trim().split(":");return F[F.length-1].trim()});for(let O of z)if(O&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(O)&&!Y.has(O))Z.push(O),Y.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(!Y.has(z))Z.push(z),Y.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(!Y.has(z))Z.push(z),Y.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(!Y.has(z))Z.push(z),Y.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 Z}async function q1($,Z,Y,X,Q,J,G,K=new Set,q){let{extractVariables:_}=await Promise.resolve().then(() => (n1(),T5)),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,F=Q.__importedComponents;if(F){let C=[z,z.toLowerCase(),B(z),j(z)];for(let v of C)if(F.has(v)){O=F.get(v);break}}let L=[];if(!O){let C=[`${z}.stx`,`${B(z)}.stx`,`${j(z)}.stx`],v=[...new Set(C)],x=Q.__originalFilePath,p=[];if(x){let Z0=r.join(r.dirname(x),"components");p.push(Z0)}if(X)p.push(X);let f=r.join(r.dirname(J),"components");if(!p.includes(f))p.push(f);if(G.componentsDir&&G.componentsDir!==X&&!p.includes(G.componentsDir))p.push(G.componentsDir);let m=process.cwd(),K0=[r.resolve(m,"src/components"),r.resolve(m,"components"),r.resolve(import.meta.dir,"components")];for(let Z0 of K0)if(!p.includes(Z0))p.push(Z0);if(z.startsWith("./")||z.startsWith("../"))O=r.resolve(r.dirname(J),`${z}.stx`),L.push(O);else for(let Z0 of p){if(!Z0)continue;for(let Q0 of v){let H0=r.join(Z0,Q0);if(L.push(H0),await c(H0)){O=H0;break}}if(O)break;if(!O)try{let Q0=await import("fs");if(!Q0.statSync(Z0,{throwIfNoEntry:!1})?.isDirectory())continue;let y0=Q0.readdirSync(Z0,{withFileTypes:!0});for(let P0 of y0)if(P0.isDirectory()){let e0=r.join(Z0,P0.name);for(let b$ of v){let a=r.join(e0,b$);if(L.push(a),await c(a)){O=a;break}}if(O)break}}catch{}if(O)break}}if(!O||!await c(O)){let C=L.length>0?`
|
|
1957
1957
|
Searched paths:
|
|
1958
1958
|
${L.map((v)=>` - ${v}`).join(`
|
|
1959
|
-
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${
|
|
1959
|
+
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${C}`}q.add(O);let H;if(t$.has(O))H=t$.get(O);else try{H=await Bun.file(O).text(),t$.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,...Z,props:Z,slot:Y,__processedComponents:W,__sections:{}},A=H,T=A.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(T)A=T[1].trim();let w=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,E=[...H.matchAll(w)],M=[];for(let C of E){let v=C[1]||"",x=C[2]||"",p=v.includes("server");if(Y1(v)&&x.trim())x=X1(x);if(p&&x)try{await _(x,R,O)}catch(m){}if(!p){let m=x.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}>${m}</script>`)}}let I=H.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),D=I?I[1]:"",P=I?I[2]:"",b="",S=D&&/\bscoped\b/i.test(D);if(I)b=`<style${D}>${P}</style>`;let k=A;if(k=k.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),I)k=k.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");if(Y&&k.includes("{{ text || slot }}"))k=k.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{extractSlotContent:g,applySlots:h}=await Promise.resolve().then(() => (F3(),L3)),{defaultSlot:i,namedSlots:W0}=g(Y);k=await h(k,i||Y,W0,R);for(let[C,v]of Object.entries(R))if(typeof v==="string"){if(v.includes("<")&&v.includes(">")||v.includes("<")||v.includes(""")){let x=c$(v);R[C]=x}}let T0=M.some((C)=>/\b(state|derived|effect)\s*\(/.test(C)),q0={...G,componentsDir:r.dirname(O),skipSignalsRuntime:!0,skipEventDirectives:T0,defaultLayout:void 0};R.__stxProcessingDepth=(Q.__stxProcessingDepth||0)+1;let k0=await w5(k,R,O,q0,q),b0=`stx_${z.replace(/[^a-zA-Z0-9]/g,"_")}_${++l2}_${Math.random().toString(36).slice(2,8)}`,O0=k0;if(T0){let C="";if(Object.keys(Z).length>0)try{C=` data-stx-props="${p2(JSON.stringify(Z))}"`}catch{}if(O0=`<div data-stx-scope="${b0}"${C}>${k0}</div>`,O0=M.map((x)=>{let p=x.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!p)return x;let[,f,m]=p,K0=p0(m),Z0=`
|
|
1960
1960
|
(function() {
|
|
1961
1961
|
const { state, derived, effect, batch } = window.stx;
|
|
1962
1962
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
1963
|
-
const __scopeVars = __scope['${
|
|
1963
|
+
const __scopeVars = __scope['${b0}'] = __scope['${b0}'] || {};
|
|
1964
1964
|
|
|
1965
1965
|
// Scope-specific lifecycle callbacks
|
|
1966
1966
|
__scopeVars.__mountCallbacks = __scopeVars.__mountCallbacks || [];
|
|
@@ -1968,25 +1968,25 @@ ${L.map((v)=>` - ${v}`).join(`
|
|
|
1968
1968
|
const onMount = (fn) => __scopeVars.__mountCallbacks.push(fn);
|
|
1969
1969
|
const onDestroy = (fn) => __scopeVars.__destroyCallbacks.push(fn);
|
|
1970
1970
|
|
|
1971
|
-
${
|
|
1971
|
+
${K0}
|
|
1972
1972
|
|
|
1973
1973
|
// Register all defined signals and functions in this scope
|
|
1974
1974
|
const __localVars = {};
|
|
1975
1975
|
try {
|
|
1976
|
-
${
|
|
1976
|
+
${i2(K0).map((Q0)=>`if (typeof ${Q0} !== 'undefined') __localVars['${Q0}'] = ${Q0};`).join(`
|
|
1977
1977
|
`)}
|
|
1978
1978
|
}
|
|
1979
1979
|
catch (e) {}
|
|
1980
1980
|
Object.assign(__scopeVars, __localVars);
|
|
1981
|
-
})();`;return`<script data-stx-scoped${f}>${
|
|
1981
|
+
})();`;return`<script data-stx-scoped${f}>${Z0}</script>`}).join(`
|
|
1982
1982
|
`)+`
|
|
1983
|
-
`+
|
|
1984
|
-
`+b}else{if(b)
|
|
1985
|
-
`+b;if(M.length>0){let
|
|
1983
|
+
`+O0,b)O0+=`
|
|
1984
|
+
`+b}else{if(b)O0+=`
|
|
1985
|
+
`+b;if(M.length>0){let C=R.__stx_event_bindings||[],v=await Promise.all(M.map(async(x)=>{let p=x.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!p)return x;return await H5(p[1],{eventBindings:C,templateContent:O0,filePath:O,projectRoot:process.cwd()})}));O0+=`
|
|
1986
1986
|
`+v.join(`
|
|
1987
|
-
`),R.__stx_event_bindings=[]}}if(S){let
|
|
1987
|
+
`),R.__stx_event_bindings=[]}}if(S){let C=R5(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()}async function e$($,Z,Y,X){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Q=r.dirname(Z);if($.startsWith("/")){let W=r.join(process.cwd(),$);if(Y.debug)console.log(`Checking absolute path: ${W}`);if(await c(W)&&X)X.add(W);return W}let J=r.join(Q,$);if(await c(J)){if(Y.debug)console.log(`Found direct path: ${J}`);if(X)X.add(J);return J}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let W of[".stx",".tsx",".jsx"]){let B=`${J}${W}`;if(await c(B)){if(Y.debug)console.log(`Found direct path with extension: ${B}`);if(X)X.add(B);return B}}let G="",K=r.resolve(Q),q=process.cwd();for(let W=0;W<10;W++){let B=r.join(K,"layouts"),j=!1;try{j=u2.statSync(B,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){G=B;break}let z=r.dirname(K);if(z===K||z.length<q.length)break;K=z}if(G){let W=$.startsWith("layouts/")?$.slice(8):$,B=r.join(G,W);if(await c(B)){if(Y.debug)console.log(`Found in current layouts dir: ${B}`);if(X)X.add(B);return B}if(!W.endsWith(".stx")){let j=`${B}.stx`;if(await c(j)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${j}`);if(X)X.add(j);return j}}}if(Y.layoutsDir){let W=r.isAbsolute(Y.layoutsDir)?Y.layoutsDir:r.resolve(process.cwd(),Y.layoutsDir),B=$.startsWith("layouts/")?$.slice(8):$,j=r.join(W,B);if(await c(j)){if(Y.debug)console.log(`Found in options.layoutsDir: ${j}`);if(X)X.add(j);return j}if(!$.endsWith(".stx")){let z=`${j}.stx`;if(await c(z)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${z}`);if(X)X.add(z);return z}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let W=$.split("layouts/"),B=r.join(Y.partialsDir||Q,"layouts",W[1]);if(await c(B)){if(Y.debug)console.log(`Found in layouts path: ${B}`);if(X)X.add(B);return B}if(!B.endsWith(".stx")){let j=`${B}.stx`;if(await c(j)){if(Y.debug)console.log(`Found in layouts path with extension: ${j}`);if(X)X.add(j);return j}}}if(Y.partialsDir){if(G=r.join(Y.partialsDir,"layouts"),await c(G)){let W=r.join(G,$);if(await c(W)){if(Y.debug)console.log(`Found in partials layouts dir: ${W}`);if(X)X.add(W);return W}if(!$.endsWith(".stx")){let B=`${W}.stx`;if(await c(B)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${B}`);if(X)X.add(B);return B}}}}let _=Y.partialsDir||r.join(process.cwd(),"views"),U=r.join(_,$);if(await c(U)){if(Y.debug)console.log(`Found in views path: ${U}`);if(X)X.add(U);return U}if(!$.endsWith(".stx")){let W=`${U}.stx`;if(await c(W)){if(Y.debug)console.log(`Found in views path with extension: ${W}`);if(X)X.add(W);return W}}if(Q.includes("temp")){let W=r.join(r.dirname(Q),"layouts",$);if(await c(W)){if(Y.debug)console.log(`Found in temp layouts dir: ${W}`);if(X)X.add(W);return W}if(!$.endsWith(".stx")){let B=`${W}.stx`;if(await c(B)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${B}`);if(X)X.add(B);return B}}}if(Y.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function V3($,Z,Y){let X=0,Q="",J="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
|
|
1988
1988
|
`),K=0;for(let q=0;q<G.length;q++)if(K+=G[q].length+1,K>=Z){X=q+1,Q=G[q].trim();let _=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
|
-
`);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return
|
|
1989
|
+
`);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return V3($,G)}}catch{}return{lineNumber:X,lineContent:Q,context:J}}function J0($,Z,Y,X,Q,J){let{lineNumber:G,context:K}=V3(X,Q,J),q=Y.split("/").pop(),_=`
|
|
1990
1990
|
${n.bold}${n.red}\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E${n.reset}
|
|
1991
1991
|
`;if(_+=`${n.bold}${n.red}\u2502${n.reset} ${n.bold}${n.bgRed} ERROR ${n.reset} ${n.red}${$} Error${n.reset}${" ".repeat(Math.max(0,43-$.length))}${n.bold}${n.red}\u2502${n.reset}
|
|
1992
1992
|
`,_+=`${n.bold}${n.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${n.reset}
|
|
@@ -1996,8 +1996,8 @@ ${n.yellow}${n.bold}Message:${n.reset} ${Z}
|
|
|
1996
1996
|
`,K)_+=`
|
|
1997
1997
|
${n.blue}${n.bold}Context:${n.reset}
|
|
1998
1998
|
${n.dim}${K}${n.reset}
|
|
1999
|
-
`;return _}var
|
|
2000
|
-
`||
|
|
1999
|
+
`;return _}var t$,l2=0,n;var L0=y(()=>{l$();c0();A1();$4();s$();Y3();n1();t$=new l1(500);n={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 R3($,Z,Y=""){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 F=$.indexOf("@markdown",B),L=$.indexOf("@endmarkdown",B);if(L===-1)break;if(F!==-1&&F<L&&F!==K){let H=$[F+9];if(H==="("||H===`
|
|
2000
|
+
`||H==="\r"||H===" "||H===void 0)W++;B=F+9}else{if(W--,W===0){j=L;break}B=L+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=h1(_.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}`,Y,$,U,K);X=X.split(K).join(j)}return X}async function N3($,Z,Y,X){let Q={gfm:!0,breaks:!1};return Z.forEach((J)=>{let G=J.trim().replace(/['"]/g,"");if(G==="breaks")Q.breaks=!0;if(G==="no-gfm")Q.gfm=!1}),h1($.trim(),Q)}var Z4=y(()=>{L0()});function o2($){if(n2.set($.name,$),$.client)s2.set($.name,$.client)}function M5($){return o2($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,X,Q,J)=>{let G=r2(X,$.defaults);if($.validate){let q=$.validate(G);if(q!==!0){let _=typeof q==="string"?q:`Invalid parameters for @${$.name}`;throw Error(_)}}let K=Y;if($.transform)K=await $.transform(Y,G,Q,J);if($.clientScript){let q=$.clientScript(G);K+=`<script>${q}</script>`}if($.css){let q=$.css(G);K+=`<style>${q}</style>`}return K}}}function r2($,Z){let Y={...Z};for(let X of $){let Q=X.indexOf(":"),J=X.indexOf("="),G=Q>=0&&(J<0||Q<J)?Q:J;if(G>=0){let K=X.slice(0,G).trim(),q=X.slice(G+1).trim();if(q==="true")q=!0;else if(q==="false")q=!1;else if(q==="null")q=null;else if(!Number.isNaN(Number(q)))q=Number(q);else if(typeof q==="string"&&q.startsWith("{"))try{q=JSON.parse(q)}catch{}Y[K]=q}else{let K=Object.keys(Y).filter((q)=>!Z||!(q in Z)).length;Y[K===0?"value":`arg${K}`]=X}}return Y}var n2,s2;var Y4=y(()=>{n2=new Map,s2=new Map});function X4($,Z=T1,Y={},X){return Z.sort((Q,J)=>Q-J).map((Q)=>{return`${o1($,{...Y,w:Q,fm:X})} ${Q}w`}).join(", ")}function A3($,Z,Y=a2,X={},Q){return Y.sort((J,G)=>J-G).map((J)=>{let G=Math.round(Z*J);return`${o1($,{...X,w:G,dpr:J,fm:Q})} ${J}x`}).join(", ")}function J4($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let X=Object.entries($).map(([Q,J])=>{let G=/^\d+$/.test(Q)?`${Q}px`:Q;return{bp:G,size:J,numericBp:Number.parseInt(G)||0}}).sort((Q,J)=>Q.numericBp-J.numericBp).map(({bp:Q,size:J})=>`(max-width: ${Q}) ${J}`);return X.push(Z),X.join(", ")}function o1($,Z={}){let Y=Object.entries(Z).filter(([,J])=>J!==void 0&&J!==null).map(([J,G])=>{if(Array.isArray(G))return[J,G.join(",")];return[J,String(G)]});if(Y.length===0)return $;let X=Y.map(([J,G])=>`${J}=${encodeURIComponent(G)}`).join("&"),Q=$.includes("?")?"&":"?";return`${$}${Q}${X}`}function Q4($){return t2[$]||"application/octet-stream"}var T1,a2,s1,t2;var G4=y(()=>{T1=[320,480,640,768,1024,1280,1536,1920,2560],a2=[1,1.5,2,3],s1=["avif","webp","jpeg"],t2={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function $J(){try{return await import("ts-images")}catch{return null}}async function ZJ($,Z={}){let Y={...e2,...Z},X=await $J();if(X)try{return await YJ($,Y,X)}catch(Q){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Q}`)}return XJ($,Y)}async function YJ($,Z,Y){let{generatePlaceholder:X,generateThumbHash:Q}=Y,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await Q($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await X($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:K.dataURL,width:K.width,height:K.height,aspectRatio:K.aspectRatio,originalWidth:K.originalWidth,originalHeight:K.originalHeight,strategy:Z.strategy,dominantColor:K.dominantColor,css:K.css}}function XJ($,Z){let Y=Z.width||20,X=Z.height||Y,Q="#e5e7eb",J=`<svg xmlns="http://www.w3.org/2000/svg" width="${Y}" height="${X}" viewBox="0 0 ${Y} ${X}"><rect fill="#e5e7eb" width="${Y}" height="${X}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(J)}`,width:Y,height:X,aspectRatio:Y/X,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}function T3($,Z,Y={}){let X=Y.transitionDuration||300,Q=Y.easing||"ease-out";return`
|
|
2001
2001
|
#${$} {
|
|
2002
2002
|
--stx-img-transition-duration: ${X}ms;
|
|
2003
2003
|
--stx-img-transition-easing: ${Q};
|
|
@@ -2014,7 +2014,7 @@ ${n.dim}${K}${n.reset}
|
|
|
2014
2014
|
#${$}.stx-img-loaded img {
|
|
2015
2015
|
opacity: 1;
|
|
2016
2016
|
}
|
|
2017
|
-
`.trim()}async function
|
|
2017
|
+
`.trim()}async function w3($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if(K4.has(Y))return K4.get(Y);let X=await ZJ($,Z);return K4.set(Y,X),X}var e2,q4,K4;var M3=y(()=>{e2={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},q4=`
|
|
2018
2018
|
.stx-img-placeholder {
|
|
2019
2019
|
position: relative;
|
|
2020
2020
|
overflow: hidden;
|
|
@@ -2043,8 +2043,8 @@ ${n.dim}${K}${n.reset}
|
|
|
2043
2043
|
filter: blur(0);
|
|
2044
2044
|
transform: scale(1);
|
|
2045
2045
|
}
|
|
2046
|
-
`.trim();G0=new Map});import{createHash as AZ}from"crypto";import{readFile as rJ,stat as TZ}from"fs/promises";async function R4($){try{let Z=await rJ($);return AZ("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function NZ($){return AZ("sha256").update($).digest("hex").slice(0,16)}function I7($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${NZ($)}-${NZ(Y)}`}async function q0($){try{return(await TZ($)).mtimeMs}catch{return 0}}async function F4($){try{return await TZ($),!0}catch{return!1}}var q5=()=>{};import{mkdir as aJ,readFile as tJ,writeFile as eJ,readdir as g_,rm as $2,stat as h_}from"fs/promises";import{join as MZ,dirname as Z2}from"path";async function Y2($){try{await aJ($,{recursive:!0})}catch{}}function IZ($,Z,Y){return MZ($,Y,`${Z}.json`)}async function wZ($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await q0(Z)!==$.srcMtime)return!1;return!0}async function E7($,Z,Y,X=U0){if(!X.enabled)return null;let Q=I7($,Z),J=w5.get(Q);if(J){if(await wZ(J,$,X.maxAge))return J.lastAccessedAt=Date.now(),J.data;w5.delete(Q)}let G=IZ(X.directory,Q,Y);if(await F4(G))try{let K=await tJ(G,"utf-8"),q=JSON.parse(K);if(await wZ(q,$,X.maxAge))return q.lastAccessedAt=Date.now(),w5.set(Q,q),q.data}catch{}return null}async function D7($,Z,Y,X,Q=U0){if(!Q.enabled)return;let J=I7($,Z),G=await R4($),K=await q0($),q={key:J,src:$,srcHash:G,srcMtime:K,optionsHash:I7("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};w5.set(J,q);let _=IZ(Q.directory,J,X);try{await Y2(Z2(_)),await eJ(_,JSON.stringify(q,null,2))}catch(U){console.warn(`[stx-media] Failed to write cache: ${U}`)}}async function k7($,Z=U0){if($==="all")w5.clear();else w5.clear();let Y=$==="all"?["image","video"]:[$];for(let X of Y){let Q=MZ(Z.directory,X);try{await $2(Q,{recursive:!0,force:!0})}catch{}}}var w5,U0;var _0=C(()=>{q5();w5=new Map,U0={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class b7{config;constructor($={}){this.config={...X2,...$}}async get($,Z){return E7($,Z,"image",this.config)}async set($,Z,Y){return D7($,Z,Y,"image",this.config)}async clear(){return k7("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function W0($){if(!S7)S7=new b7($);else if($)S7.updateConfig($);return S7}async function y7($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return W0(X).get($,Z)}async function P7($,Z,Y,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return W0(Q).set($,Z,Y)}async function EZ(){return W0().clear()}var X2,S7=null;var B0=C(()=>{_0();X2={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as J2,basename as Q2,extname as G2,join as K2}from"path";import{mkdir as q2}from"fs/promises";async function z0(){try{return await import("ts-images")}catch{return null}}function DZ($){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 U2($,Z){let Y=Z?DZ(Z):DZ("web"),X=$.formatQuality||{};return{jpeg:{...Y.jpeg,...X.jpeg},png:{...Y.png,...X.png},webp:{...Y.webp,...X.webp},avif:{...Y.avif,...X.avif}}}async function kZ($,Z,Y){let X=await z0();if(!X)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Q=await y7($,Z,Y);if(Q)return Q;try{let J=J2($);if(!await F4(J))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=U2(Y,Z.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await q2(K,{recursive:!0});let _=await R4(J),U=Q2($,G2($)),W=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],B={src:$,processed:!0,variants:[],hash:_},j=null;if(Z.transformations&&Z.transformations.length>0)j=await j0(J,Z.transformations,X);for(let z of W){let H=G[z]||{},F=`${U}-${_}.${z}`,L=K2(K,F);try{let O=await X.optimizeImage({input:j||J,output:L,format:z,quality:H.quality,progressive:H.progressive});if(O){if(B.variants.push({path:L,url:`${q}/${F}`,width:O.width||0,height:O.height||0,format:z,size:O.outputSize||0}),!B.originalWidth&&O.width)B.originalWidth=O.width,B.originalHeight=O.height}}catch(O){B.errors=B.errors||[],B.errors.push(`Failed to optimize ${z}: ${O}`)}}if(Z.embedThumbhash||Z.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(Z.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 P7($,Z,B,Y),B}catch(J){return{src:$,processed:!1,errors:[`Processing failed: ${J}`]}}}async function SZ($,Z,Y,X){let Q=await z0();if(!Q)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await Q.optimizeImage({input:$,output:X,format:Z,quality:Y}))?.outputSize}}catch(J){return{success:!1,error:String(J)}}}async function j0($,Z,Y){let X=Y||await z0();if(!X)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let Q=await X.decode($);for(let J of Z){let G=J.options||{};switch(J.type){case"resize":if(G.width||G.height)Q=await X.resize(Q,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)Q=await X.blur(Q,G.sigma);break;case"sharpen":if(G.amount!==void 0)Q=await X.sharpen(Q,G.amount);break;case"grayscale":Q=await X.grayscale(Q);break;case"rotate":if(G.angle!==void 0)Q=await X.rotate(Q,G.angle);break;case"flip":Q=await X.flip(Q);break;case"flop":Q=await X.flop(Q);break;case"brightness":if(G.value!==void 0)Q=await X.brightness(Q,G.value);break;case"contrast":if(G.value!==void 0)Q=await X.contrast(Q,G.value);break;case"saturation":if(G.value!==void 0)Q=await X.saturation(Q,G.value);break}}return await X.encode(Q,"png")}catch(Q){return console.error(`[stx-media] Transformation failed: ${Q}`),null}}var bZ=C(()=>{q5();B0()});import{resolve as _2,basename as W2,extname as B2,join as z2}from"path";import{mkdir as j2}from"fs/promises";async function H2(){try{return await import("ts-images")}catch{return null}}async function yZ($,Z,Y){let X=await H2();if(!X)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Q=_2($);if(!await F4(Q))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let J=Z.responsiveWidths||Y.breakpoints||O2,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await j2(K,{recursive:!0});let _=await R4(Q),U=W2($,B2($)),W=Y.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 H=[];for(let F of J){let L=`${U}-${F}w-${_}.${z}`,O=z2(K,L),V=`${q}/${L}`;try{let N=W[z]?.quality||80;if(await F4(O)){B.byFormat[z].push({path:O,url:V,width:F,height:0,format:z,size:0}),H.push(`${V} ${F}w`);continue}let R=await X.processImage({input:Q,output:O,format:z,quality:N,resize:{width:F}});if(R)B.byFormat[z].push({path:O,url:V,width:F,height:R.height||Math.round(F*(R.height||1)/(R.width||1)),format:z,size:R.outputSize||0}),H.push(`${V} ${F}w`)}catch(N){console.warn(`[stx-media] Failed to generate ${z} at ${F}w: ${N}`)}}B.srcsets[z]=H.join(", ")}let j=Z.placeholder||Y.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=Z.sizes||L2(J),B}catch(J){return console.error(`[stx-media] Responsive generation failed: ${J}`),null}}function L2($){let Z=[...$].sort((X,Q)=>X-Q),Y=[];for(let X=0;X<Z.length-1;X++){let Q=Z[X];Y.push(`(max-width: ${Q}px) ${Q}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function PZ($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return $.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}var O2;var CZ=C(()=>{q5();O2=[320,480,640,768,1024,1280,1536,1920]});var vZ={};o(vZ,{setCachedImageResult:()=>P7,processImage:()=>kZ,optimizeImage:()=>SZ,getCachedImageResult:()=>y7,generateSrcset:()=>PZ,generateResponsiveVariants:()=>yZ,clearImageCache:()=>EZ,applyTransformations:()=>j0,ImageProcessorCache:()=>b7});var xZ=C(()=>{bZ();CZ();B0()});async function F2(){try{return await Promise.resolve().then(() => (xZ(),vZ))}catch($){if(!fZ)console.warn("[stx-media] Image processor not available, some features disabled:",$),fZ=!0;return null}}async function C7($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return A2(X,Y)}if(Y.processedResult?.processed)return F0($,Y.processedResult,Z);if(Y.responsiveVariants)return mZ($,Y.responsiveVariants,Z);let{src:Q,alt:J,width:G,height:K,sizes:q,widths:_=T5,dpr:U,formats:W=s5,quality:B=H0,params:j={},placeholder:z="none",placeholderOptions:H={},lazy:F=!0,priority:L=!1,loading:O=L?"eager":x7,decoding:V=v7,fetchpriority:N,objectFit:R,objectPosition:A,crossorigin:T,referrerpolicy:w}=$,E=$.class,M=$.style,I=$.id,D=$.data||{},{isDev:y=!1,baseUrl:b=""}=Z;if(y&&!Z.optimize)return N2($);let S,k,g=I||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(z!=="none"&&!L)try{S=await VZ(Q,{strategy:z,...H}),k=FZ(g,S,H)}catch{}let h=U!==void 0&&G!==void 0,i;if(h)i=R2($,g,S,Z);else i=await V2($,g,S,Z);let W4;if(L){let k4=W.includes("webp")?"webp":W[0],b4=Y0(Q,_,{...j,q:B},k4),H4=typeof q==="object"?X0(q):q||"100vw";W4=`<link rel="preload" as="image" imagesrcset="${b4}" imagesizes="${H4}" />`}let T4=[];if(!gZ&&z!=="none")T4.push(K0),gZ=!0;if(k)T4.push(k);let q4=F?dZ(g):void 0;return{html:i,preloadLink:W4,css:T4.length>0?T4.join(`
|
|
2047
|
-
`):void 0,script:
|
|
2046
|
+
`.trim();K4=new Map});import{createHash as E3}from"crypto";import{readFile as JJ,stat as D3}from"fs/promises";async function R0($){try{let Z=await JJ($);return E3("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function I3($){return E3("sha256").update($).digest("hex").slice(0,16)}function I5($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${I3($)}-${I3(Y)}`}async function U4($){try{return(await D3($)).mtimeMs}catch{return 0}}async function F0($){try{return await D3($),!0}catch{return!1}}var U1=()=>{};import{mkdir as QJ,readFile as GJ,writeFile as KJ,readdir as n_,rm as qJ,stat as s_}from"fs/promises";import{join as S3,dirname as UJ}from"path";async function _J($){try{await QJ($,{recursive:!0})}catch{}}function b3($,Z,Y){return S3($,Y,`${Z}.json`)}async function k3($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await U4(Z)!==$.srcMtime)return!1;return!0}async function E5($,Z,Y,X=_4){if(!X.enabled)return null;let Q=I5($,Z),J=w1.get(Q);if(J){if(await k3(J,$,X.maxAge))return J.lastAccessedAt=Date.now(),J.data;w1.delete(Q)}let G=b3(X.directory,Q,Y);if(await F0(G))try{let K=await GJ(G,"utf-8"),q=JSON.parse(K);if(await k3(q,$,X.maxAge))return q.lastAccessedAt=Date.now(),w1.set(Q,q),q.data}catch{}return null}async function D5($,Z,Y,X,Q=_4){if(!Q.enabled)return;let J=I5($,Z),G=await R0($),K=await U4($),q={key:J,src:$,srcHash:G,srcMtime:K,optionsHash:I5("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};w1.set(J,q);let _=b3(Q.directory,J,X);try{await _J(UJ(_)),await KJ(_,JSON.stringify(q,null,2))}catch(U){console.warn(`[stx-media] Failed to write cache: ${U}`)}}async function k5($,Z=_4){if($==="all")w1.clear();else w1.clear();let Y=$==="all"?["image","video"]:[$];for(let X of Y){let Q=S3(Z.directory,X);try{await qJ(Q,{recursive:!0,force:!0})}catch{}}}var w1,_4;var W4=y(()=>{U1();w1=new Map,_4={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class b5{config;constructor($={}){this.config={...WJ,...$}}async get($,Z){return E5($,Z,"image",this.config)}async set($,Z,Y){return D5($,Z,Y,"image",this.config)}async clear(){return k5("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function B4($){if(!S5)S5=new b5($);else if($)S5.updateConfig($);return S5}async function y5($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return B4(X).get($,Z)}async function P5($,Z,Y,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return B4(Q).set($,Z,Y)}async function y3(){return B4().clear()}var WJ,S5=null;var z4=y(()=>{W4();WJ={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as BJ,basename as zJ,extname as jJ,join as OJ}from"path";import{mkdir as HJ}from"fs/promises";async function j4(){try{return await import("ts-images")}catch{return null}}function P3($){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 LJ($,Z){let Y=Z?P3(Z):P3("web"),X=$.formatQuality||{};return{jpeg:{...Y.jpeg,...X.jpeg},png:{...Y.png,...X.png},webp:{...Y.webp,...X.webp},avif:{...Y.avif,...X.avif}}}async function C3($,Z,Y){let X=await j4();if(!X)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Q=await y5($,Z,Y);if(Q)return Q;try{let J=BJ($);if(!await F0(J))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=LJ(Y,Z.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await HJ(K,{recursive:!0});let _=await R0(J),U=zJ($,jJ($)),W=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],B={src:$,processed:!0,variants:[],hash:_},j=null;if(Z.transformations&&Z.transformations.length>0)j=await O4(J,Z.transformations,X);for(let z of W){let O=G[z]||{},F=`${U}-${_}.${z}`,L=OJ(K,F);try{let H=await X.optimizeImage({input:j||J,output:L,format:z,quality:O.quality,progressive:O.progressive});if(H){if(B.variants.push({path:L,url:`${q}/${F}`,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(Z.embedThumbhash||Z.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(Z.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 P5($,Z,B,Y),B}catch(J){return{src:$,processed:!1,errors:[`Processing failed: ${J}`]}}}async function v3($,Z,Y,X){let Q=await j4();if(!Q)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await Q.optimizeImage({input:$,output:X,format:Z,quality:Y}))?.outputSize}}catch(J){return{success:!1,error:String(J)}}}async function O4($,Z,Y){let X=Y||await j4();if(!X)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let Q=await X.decode($);for(let J of Z){let G=J.options||{};switch(J.type){case"resize":if(G.width||G.height)Q=await X.resize(Q,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)Q=await X.blur(Q,G.sigma);break;case"sharpen":if(G.amount!==void 0)Q=await X.sharpen(Q,G.amount);break;case"grayscale":Q=await X.grayscale(Q);break;case"rotate":if(G.angle!==void 0)Q=await X.rotate(Q,G.angle);break;case"flip":Q=await X.flip(Q);break;case"flop":Q=await X.flop(Q);break;case"brightness":if(G.value!==void 0)Q=await X.brightness(Q,G.value);break;case"contrast":if(G.value!==void 0)Q=await X.contrast(Q,G.value);break;case"saturation":if(G.value!==void 0)Q=await X.saturation(Q,G.value);break}}return await X.encode(Q,"png")}catch(Q){return console.error(`[stx-media] Transformation failed: ${Q}`),null}}var x3=y(()=>{U1();z4()});import{resolve as FJ,basename as VJ,extname as RJ,join as NJ}from"path";import{mkdir as AJ}from"fs/promises";async function TJ(){try{return await import("ts-images")}catch{return null}}async function f3($,Z,Y){let X=await TJ();if(!X)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Q=FJ($);if(!await F0(Q))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let J=Z.responsiveWidths||Y.breakpoints||wJ,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await AJ(K,{recursive:!0});let _=await R0(Q),U=VJ($,RJ($)),W=Y.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 F of J){let L=`${U}-${F}w-${_}.${z}`,H=NJ(K,L),V=`${q}/${L}`;try{let N=W[z]?.quality||80;if(await F0(H)){B.byFormat[z].push({path:H,url:V,width:F,height:0,format:z,size:0}),O.push(`${V} ${F}w`);continue}let R=await X.processImage({input:Q,output:H,format:z,quality:N,resize:{width:F}});if(R)B.byFormat[z].push({path:H,url:V,width:F,height:R.height||Math.round(F*(R.height||1)/(R.width||1)),format:z,size:R.outputSize||0}),O.push(`${V} ${F}w`)}catch(N){console.warn(`[stx-media] Failed to generate ${z} at ${F}w: ${N}`)}}B.srcsets[z]=O.join(", ")}let j=Z.placeholder||Y.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=Z.sizes||MJ(J),B}catch(J){return console.error(`[stx-media] Responsive generation failed: ${J}`),null}}function MJ($){let Z=[...$].sort((X,Q)=>X-Q),Y=[];for(let X=0;X<Z.length-1;X++){let Q=Z[X];Y.push(`(max-width: ${Q}px) ${Q}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function g3($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return $.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}var wJ;var h3=y(()=>{U1();wJ=[320,480,640,768,1024,1280,1536,1920]});var d3={};o(d3,{setCachedImageResult:()=>P5,processImage:()=>C3,optimizeImage:()=>v3,getCachedImageResult:()=>y5,generateSrcset:()=>g3,generateResponsiveVariants:()=>f3,clearImageCache:()=>y3,applyTransformations:()=>O4,ImageProcessorCache:()=>b5});var m3=y(()=>{x3();h3();z4()});async function IJ(){try{return await Promise.resolve().then(() => (m3(),d3))}catch($){if(!u3)console.warn("[stx-media] Image processor not available, some features disabled:",$),u3=!0;return null}}async function C5($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return SJ(X,Y)}if(Y.processedResult?.processed)return V4($,Y.processedResult,Z);if(Y.responsiveVariants)return i3($,Y.responsiveVariants,Z);let{src:Q,alt:J,width:G,height:K,sizes:q,widths:_=T1,dpr:U,formats:W=s1,quality:B=H4,params:j={},placeholder:z="none",placeholderOptions:O={},lazy:F=!0,priority:L=!1,loading:H=L?"eager":x5,decoding:V=v5,fetchpriority:N,objectFit:R,objectPosition:A,crossorigin:T,referrerpolicy:w}=$,E=$.class,M=$.style,I=$.id,D=$.data||{},{isDev:P=!1,baseUrl:b=""}=Z;if(P&&!Z.optimize)return kJ($);let S,k,g=I||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(z!=="none"&&!L)try{S=await w3(Q,{strategy:z,...O}),k=T3(g,S,O)}catch{}let h=U!==void 0&&G!==void 0,i;if(h)i=DJ($,g,S,Z);else i=await EJ($,g,S,Z);let W0;if(L){let k0=W.includes("webp")?"webp":W[0],b0=X4(Q,_,{...j,q:B},k0),O0=typeof q==="object"?J4(q):q||"100vw";W0=`<link rel="preload" as="image" imagesrcset="${b0}" imagesizes="${O0}" />`}let T0=[];if(!l3&&z!=="none")T0.push(q4),l3=!0;if(k)T0.push(k);let q0=F?c3(g):void 0;return{html:i,preloadLink:W0,css:T0.length>0?T0.join(`
|
|
2047
|
+
`):void 0,script:q0}}async function EJ($,Z,Y,X){let{src:Q,alt:J,width:G,height:K,sizes:q,widths:_=T1,formats:U=s1,quality:W=H4,params:B={},lazy:j=!0,priority:z=!1,loading:O=z?"eager":x5,decoding:F=v5,fetchpriority:L,objectFit:H,objectPosition:V,crossorigin:N,referrerpolicy:R}=$,A=$.class,T=$.style,w=$.data||{},E=typeof q==="object"?J4(q):q||"100vw",M=[];for(let P of U){let b=X4(Q,_,{...B,q:W},P),S=Q4(P);if(j&&!z)M.push(` <source type="${S}" data-srcset="${b}" data-sizes="${E}" />`);else M.push(` <source type="${S}" srcset="${b}" sizes="${E}" />`)}let I=L4({src:o1(Q,{...B,q:W}),alt:J,width:G,height:K,loading:z?void 0:O,decoding:F,fetchpriority:z?"high":L,objectFit:H,objectPosition:V,crossorigin:N,referrerpolicy:R,className:p3(A,Y),style:F4(T,H,V,Y),lazy:j&&!z,data:w}),D;if(Y){let P=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;D=`<div id="${Z}" class="stx-img-placeholder" style="${P}">
|
|
2048
2048
|
<picture>
|
|
2049
2049
|
${M.join(`
|
|
2050
2050
|
`)}
|
|
@@ -2054,9 +2054,9 @@ ${M.join(`
|
|
|
2054
2054
|
${M.join(`
|
|
2055
2055
|
`)}
|
|
2056
2056
|
<img ${I} />
|
|
2057
|
-
</picture>`;return D}function
|
|
2057
|
+
</picture>`;return D}function DJ($,Z,Y,X){let{src:Q,alt:J,width:G,height:K,dpr:q=[1,2,3],quality:_=H4,params:U={},lazy:W=!0,priority:B=!1,loading:j=B?"eager":x5,decoding:z=v5,fetchpriority:O,objectFit:F,objectPosition:L,crossorigin:H,referrerpolicy:V}=$,N=$.class,R=$.style,A=$.data||{},T=typeof G==="number"?G:Number.parseInt(String(G),10),w=A3(Q,T,q,{...U,q:_}),E=L4({src:o1(Q,{...U,w:T,q:_}),alt:J,width:G,height:K,loading:B?void 0:j,decoding:z,fetchpriority:B?"high":O,objectFit:F,objectPosition:L,crossorigin:H,referrerpolicy:V,className:p3(N,Y),style:F4(R,F,L,Y),lazy:W&&!B,data:A}),M=W&&!B?`data-srcset="${w}"`:`srcset="${w}"`;if(Y){let I=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${I}">
|
|
2058
2058
|
<img ${E} ${M} />
|
|
2059
|
-
</div>`}return`<img ${Z?`id="${Z}" `:""}${E} ${M} />`}function
|
|
2059
|
+
</div>`}return`<img ${Z?`id="${Z}" `:""}${E} ${M} />`}function kJ($){let{src:Z,alt:Y,width:X,height:Q,loading:J=x5,decoding:G=v5,fetchpriority:K,objectFit:q,objectPosition:_,crossorigin:U,referrerpolicy:W,priority:B=!1}=$,j=$.class,z=$.style,O=$.id,F=$.data||{};return{html:`<img ${L4({src:Z,alt:Y,width:X,height:Q,loading:B?"eager":J,decoding:G,fetchpriority:B?"high":K,objectFit:q,objectPosition:_,crossorigin:U,referrerpolicy:W,className:j,style:F4(z,q,_),id:O,data:F})} />`}}function L4($){let Z=[];if($.lazy)Z.push(`data-src="${S0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${S0($.src)}"`);if(Z.push(`alt="${S0($.alt)}"`),$.width)Z.push(`width="${$.width}"`);if($.height)Z.push(`height="${$.height}"`);if($.loading)Z.push(`loading="${$.loading}"`);if($.decoding)Z.push(`decoding="${$.decoding}"`);if($.fetchpriority)Z.push(`fetchpriority="${$.fetchpriority}"`);if($.crossorigin)Z.push(`crossorigin="${$.crossorigin}"`);if($.referrerpolicy)Z.push(`referrerpolicy="${$.referrerpolicy}"`);if($.className)Z.push(`class="${S0($.className)}"`);if($.style)Z.push(`style="${S0($.style)}"`);if($.id)Z.push(`id="${S0($.id)}"`);if($.data)for(let[Y,X]of Object.entries($.data))Z.push(`data-${Y}="${S0(X)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function p3($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function F4($,Z,Y,X){let Q=[];if(Z)Q.push(`object-fit: ${Z}`);if(Y)Q.push(`object-position: ${Y}`);if(X)Q.push("opacity: 0; transition: opacity 300ms ease-out");if($)Q.push($);return Q.join("; ")}function S0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function c3($){return`
|
|
2060
2060
|
(function() {
|
|
2061
2061
|
const container = document.getElementById('${$}');
|
|
2062
2062
|
if (!container) return;
|
|
@@ -2093,7 +2093,7 @@ ${M.join(`
|
|
|
2093
2093
|
|
|
2094
2094
|
observer.observe(container);
|
|
2095
2095
|
})();
|
|
2096
|
-
`.trim()}async function
|
|
2096
|
+
`.trim()}async function SJ($,Z){let Y=await IJ();if(!Y)return C5({...$,process:!1},Z);let X=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let J=await Y.generateResponsiveVariants($.src,$,X);if(J)return i3($,J,Z)}else{let J=await Y.processImage($.src,$,X);if(J.processed)return V4($,J,Z)}return C5({...$,process:!1},Z)}async function V4($,Z,Y){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||{},F=Z.variants||[],L=F.find((k)=>k.format==="jpeg")||F.find((k)=>k.format==="webp")||F[0],H=L?.url||$.src,V=F.filter((k)=>k.format===(L?.format||"jpeg")).map((k)=>`${k.url} ${k.width}w`).join(", "),N=new Map;for(let k of F){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((W0)=>`${W0.url} ${W0.width}w`).join(", "),i=Q4(k);if(G&&!K)R.push(` <source type="${i}" data-srcset="${h}" />`);else R.push(` <source type="${i}" srcset="${h}" />`)}}let T=[];if(G&&!K){if(T.push(`data-src="${S0(H)}"`),T.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)T.push(`data-srcset="${V}"`)}else if(T.push(`src="${S0(H)}"`),V)T.push(`srcset="${V}"`);T.push(`alt="${S0(X)}"`);let w=Q||Z.originalWidth,E=J||Z.originalHeight;if(w)T.push(`width="${w}"`);if(E)T.push(`height="${E}"`);if(!K)T.push(`loading="${G?"lazy":"eager"}"`);if(T.push('decoding="async"'),K)T.push('fetchpriority="high"');if(U)T.push(`crossorigin="${U}"`);if(W)T.push(`referrerpolicy="${W}"`);let M=[];if(q)M.push(`object-fit: ${q}`);if(_)M.push(`object-position: ${_}`);if(Z.placeholder&&G)M.push("opacity: 0; transition: opacity 300ms ease-out");if(j)M.push(j);if(M.length>0)T.push(`style="${M.join("; ")}"`);let I=[];if(B)I.push(B);if(Z.placeholder)I.push("stx-img-blur");if(I.length>0)T.push(`class="${I.join(" ")}"`);if(G&&!K)T.push("data-stx-lazy");for(let[k,g]of Object.entries(O))T.push(`data-${k}="${S0(g)}"`);let D;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let k=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;D=`<div id="${z}" class="stx-img-placeholder" style="${k}">
|
|
2097
2097
|
<picture>
|
|
2098
2098
|
${R.join(`
|
|
2099
2099
|
`)}
|
|
@@ -2103,12 +2103,12 @@ ${R.join(`
|
|
|
2103
2103
|
${R.join(`
|
|
2104
2104
|
`)}
|
|
2105
2105
|
<img ${T.join(" ")} />
|
|
2106
|
-
</picture>`;let
|
|
2107
|
-
`):void 0,script:b}}async function
|
|
2106
|
+
</picture>`;let P=[];if(Z.placeholder)P.push(q4);let b=G?c3(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(`
|
|
2107
|
+
`):void 0,script:b}}async function i3($,Z,Y){let X={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[Q,J]of Object.entries(Z.byFormat))if(J)X.variants.push(...J);return V4($,X,Y)}var u3=!1,H4=80,v5="async",x5="lazy",l3=!1;var n3=y(()=>{G4();M3()});function bJ(){return M5({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,Y,X)=>{let{src:Q,alt:J,options:G}=yJ($,Z,Y);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||s1,quality:G.quality,sizes:G.sizes,dpr:G.dpr,params:G.params,placeholder:G.placeholder,placeholderOptions:G.placeholderOptions,lazy:G.lazy!==!1,priority:G.priority||!1,loading:G.loading,decoding:G.decoding,fetchpriority:G.fetchpriority,objectFit:G.objectFit,objectPosition:G.objectPosition,class:G.class,style:G.style,id:G.id,width:G.width,height:G.height},q=Y.__isDev||!1,_=await C5(K,{isDev:q}),U=_.html;if(_.preloadLink)U=_.preloadLink+`
|
|
2108
2108
|
`+U;if(_.css)U+=`
|
|
2109
2109
|
<style>${_.css}</style>`;if(_.script)U+=`
|
|
2110
|
-
<script>${_.script}</script>`;return U},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function
|
|
2111
|
-
`)}async function
|
|
2110
|
+
<script>${_.script}</script>`;return U},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function yJ($,Z,Y){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let X=$.trim();if(X.startsWith("@img(")||X.startsWith("("))X=X.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=PJ(X),J=R4(Q[0],Y)||"",G=R4(Q[1],Y)||"",K={};if(Q[2]){let q=R4(Q[2],Y);if(typeof q==="object"&&q!==null)K=q;else if(typeof Q[2]==="string")try{K=JSON.parse(Q[2])}catch{}}return{src:J,alt:G,options:K}}function PJ($){let Z=[],Y="",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 Y+=q;continue}if(!X){if(q==="{")J++;if(q==="}")J--;if(q==="[")G++;if(q==="]")G--;if(q===","&&J===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function R4($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let X=Z[Y];if(X!==void 0)return X}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var s3;var o3=y(()=>{Y4();n3();G4();s3=bJ()});class g5{config;constructor($={}){this.config={...CJ,...$}}async get($,Z){return E5($,Z,"video",this.config)}async set($,Z,Y){return D5($,Z,Y,"video",this.config)}async clear(){return k5("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function N4($){if(!f5)f5=new g5($);else if($)f5.updateConfig($);return f5}async function h5($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return N4(X).get($,Z)}async function d5($,Z,Y,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return N4(Q).set($,Z,Y)}async function r3(){return N4().clear()}var CJ,f5=null;var A4=y(()=>{W4();CJ={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as T4,basename as w4,extname as M4,join as m5}from"path";import{mkdir as I4}from"fs/promises";async function E4(){try{return await import("ts-videos")}catch{return null}}async function u5($,Z,Y,X){let Q=await E4();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let J=T4($);if(!await F0(J))return null;await I4(Y,{recursive:!0});let G=await R0(J),K=w4($,M4($)),q=Z.format||"webp",_=Z.timestamp||0,U=`${K}-poster-${G}.${q}`,W=m5(Y,U),B=await Q.extractThumbnails(J,{timestamps:[_],width:Z.width||1280,height:Z.height,format:q,quality:Z.quality||85,outputDir:Y,outputPattern:U.replace(`.${q}`,"")});if(B&&B.length>0){let j=B[0];return{path:W,url:`${X}/${U}`,width:j.width||Z.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 l5($,Z,Y,X){let Q=await E4();if(!Q)return[];try{let J=T4($);if(!await F0(J))return[];await I4(Y,{recursive:!0});let G=await R0(J),K=w4($,M4($)),q=Z.format||"webp",W=(await new Q.Input(J).getInfo()).duration||60,B=Z.count||10,j=Z.interval||W/B,z=[];for(let F=0;F<B&&F*j<W;F++)z.push(F*j);let O=await Q.extractThumbnails(J,{timestamps:z,width:Z.width||320,format:q,quality:Z.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${G}`});if(O&&O.length>0)return O.map((F,L)=>({path:F.path||m5(Y,`${K}-thumb-${G}-${L}.${q}`),url:`${X}/${K}-thumb-${G}-${L}.${q}`,width:F.width||Z.width||320,height:F.height||180,timestamp:z[L],size:F.size||0}));return[]}catch(J){return console.warn(`[stx-media] Failed to generate thumbnails: ${J}`),[]}}async function a3($,Z,Y,X){let Q=await E4();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let J=T4($);if(!await F0(J))return null;await I4(Y,{recursive:!0});let G=await R0(J),K=w4($,M4($)),U=(await new Q.Input(J).getInfo()).duration||60,W=Z.columns||10,B=Z.interval||5,j=Z.thumbnailWidth||160,z=Z.thumbnailHeight||90,O=Z.format||"jpeg",F=Math.ceil(U/B),L=Math.ceil(F/W),H=`${K}-sprite-${G}.${O}`,V=m5(Y,H),N=[];for(let A=0;A<F;A++)N.push(A*B);let R=await Q.extractThumbnails(J,{timestamps:N,width:j,height:z,format:O,quality:Z.quality||70,outputDir:m5(Y,".temp")});if(!R||R.length===0)return null;try{let A=await import("ts-images"),T=W*j,w=L*z,E=await A.createSprite({images:R.map((M)=>M.path),columns:W,padding:0,outputPath:V,format:O,quality:Z.quality||70});return{url:`${X}/${H}`,path:V,columns:W,rows:L,thumbnailWidth:j,thumbnailHeight:z,interval:B,totalFrames:F}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(J){return console.warn(`[stx-media] Failed to generate sprite sheet: ${J}`),null}}var D4=y(()=>{U1()});import{resolve as e3,basename as $9,extname as Z9,join as _1}from"path";import{mkdir as p5,writeFile as Y9}from"fs/promises";async function X9(){try{return await import("ts-videos")}catch{return null}}async function c5($,Z,Y,X,Q){let J=await X9();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=e3($);if(!await F0(G))return null;let K=await R0(G),q=$9($,Z9($)),_=_1(Y,`${q}-${K}-hls`);await p5(_,{recursive:!0});let U=Z.length>0?Z:J9,W=Q?.segmentDuration||6,z=(await new J.Input(G).getInfo()).duration||0,O=[],F=0;for(let V of U){let N=_1(_,V.label);await p5(N,{recursive:!0});let R=`${V.label}.m3u8`,A=_1(N,R);try{let T=await J.generateHLS(G,{outputDir:N,segmentDuration:W,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(T)O.push({quality:V,url:`${X}/${q}-${K}-hls/${V.label}/${R}`,path:A}),F+=T.segmentCount||Math.ceil(z/W)}catch(T){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${T}`)}}if(O.length===0)return null;let L=_1(_,"master.m3u8"),H=vJ(O,X,q,K);return await Y9(L,H),{manifestUrl:`${X}/${q}-${K}-hls/master.m3u8`,manifestPath:L,playlists:O,segmentCount:F,duration:z}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function vJ($,Z,Y,X){let Q=["#EXTM3U","#EXT-X-VERSION:3"];for(let J of $){let{quality:G}=J,K=G.bitrate+(G.audioBitrate||128000),q=`${G.width}x${G.height||Math.round(G.width*9/16)}`;Q.push(`#EXT-X-STREAM-INF:BANDWIDTH=${K},RESOLUTION=${q},NAME="${G.label}"`,`${G.label}/${G.label}.m3u8`)}return Q.join(`
|
|
2111
|
+
`)}async function i5($,Z,Y,X,Q){let J=await X9();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=e3($);if(!await F0(G))return null;let K=await R0(G),q=$9($,Z9($)),_=_1(Y,`${q}-${K}-dash`);await p5(_,{recursive:!0});let U=Z.length>0?Z:J9,W=Q?.segmentDuration||4,B=Q?.minBufferTime||2,O=(await new J.Input(G).getInfo()).duration||0,F=[],L=[];for(let R of U){let A=_1(_,R.label);await p5(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(F.push({bandwidth:R.bitrate,width:R.width,height:R.height||Math.round(R.width*9/16),url:`${X}/${q}-${K}-dash/${R.label}/video`}),R.audioBitrate)L.push({bandwidth:R.audioBitrate,url:`${X}/${q}-${K}-dash/${R.label}/audio`})}}catch(T){console.warn(`[stx-media] Failed to generate DASH for ${R.label}: ${T}`)}}if(F.length===0)return null;let H=_1(_,"manifest.mpd"),V=xJ(F,L,O,W,B);await Y9(H,V);let N=[{type:"video",representations:F}];if(L.length>0)N.push({type:"audio",representations:L});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 xJ($,Z,Y,X,Q){let J=t3(Y),G=t3(Q),K=`<?xml version="1.0" encoding="UTF-8"?>
|
|
2112
2112
|
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
|
|
2113
2113
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
2114
2114
|
xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
|
|
@@ -2134,11 +2134,11 @@ ${R.join(`
|
|
|
2134
2134
|
</Representation>
|
|
2135
2135
|
`}K+=` </AdaptationSet>
|
|
2136
2136
|
`}return K+=` </Period>
|
|
2137
|
-
</MPD>`,K}function
|
|
2137
|
+
</MPD>`,K}function t3($){let Z=Math.floor($/3600),Y=Math.floor($%3600/60),X=Math.floor($%60),Q="PT";if(Z>0)Q+=`${Z}H`;if(Y>0)Q+=`${Y}M`;return Q+=`${X}S`,Q}var J9;var k4=y(()=>{U1();J9=[{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 Q9,basename as fJ,extname as gJ,join as hJ}from"path";import{mkdir as dJ}from"fs/promises";async function G9(){try{return await import("ts-videos")}catch{return null}}function mJ($){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 uJ($){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 S4($){let Z=await G9();if(!Z)return null;try{let Y=Q9($),Q=await new Z.Input(Y).getInfo();return{duration:Q.duration||0,width:Q.width||0,height:Q.height||0,frameRate:Q.frameRate||0,bitrate:Q.bitrate||0,codec:Q.videoCodec||"",audioCodec:Q.audioCodec}}catch(Y){return console.warn(`[stx-media] Failed to analyze video: ${Y}`),null}}async function K9($,Z,Y,X){let Q=await G9();if(!Q)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let J=await h5($,Z,Y);if(J)return J;try{let G=Q9($);if(!await F0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",q=Y.baseUrl||"/videos";await dJ(K,{recursive:!0});let _=await R0(G),U=fJ($,gJ($)),W={src:$,processed:!0,hash:_};X?.({percentage:5,stage:"analyzing"}),W.metadata=await S4(G)||void 0;let B={};if(Z.quality)B.bitrate=mJ(Z.quality);if(Z.platform)Object.assign(B,uJ(Z.platform));if(Z.transcode)Object.assign(B,Z.transcode);if(Object.keys(B).length>0||Z.process){X?.({percentage:10,stage:"transcoding"});let j=`${U}-${_}.mp4`,z=hJ(K,j);try{let O=await lJ(G,z,B,Q,(F)=>X?.({percentage:10+F*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(Z.generatePoster){X?.({percentage:65,stage:"generating-poster"});let j=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},z=await u5(G,j,K,q);if(z)W.poster=z}if(Y.thumbnails?.enabled){X?.({percentage:70,stage:"generating-thumbnails"});let j=await l5(G,Y.thumbnails,K,q);if(j.length>0)W.thumbnails=j}if(Z.streaming){X?.({percentage:80,stage:"generating-manifests"});let j=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(j.format==="hls"||j.format===void 0){let z=await c5(G,j.qualities||Y.streaming?.defaultQualities||[],K,q);if(z)W.streaming={...W.streaming,hls:z}}if(j.format==="dash"){let z=await i5(G,j.qualities||Y.streaming?.defaultQualities||[],K,q);if(z)W.streaming={...W.streaming,dash:z}}}if(Z.spriteSheet)X?.({percentage:90,stage:"generating-sprite-sheet"});return X?.({percentage:100,stage:"complete"}),await d5($,Z,W,Y),W}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function lJ($,Z,Y,X,Q){try{let G=await new X.Conversion($,Z,{videoCodec:Y.codec,videoBitrate:Y.bitrate,width:Y.maxWidth,height:Y.maxHeight,frameRate:Y.frameRate,audioCodec:Y.audioCodec,audioBitrate:Y.audioBitrate,sampleRate:Y.sampleRate,channels:Y.channels}).run((K)=>{Q?.(K.percentage/100)});return{duration:G.duration||0,size:G.size||0,width:G.width||Y.maxWidth||0,height:G.height||Y.maxHeight||0,bitrate:G.bitrate||Y.bitrate||0,frameRate:G.frameRate||Y.frameRate||30,audioCodec:G.audioCodec}}catch(J){return console.error(`[stx-media] Transcoding failed: ${J}`),null}}var q9=y(()=>{U1();A4();D4();k4()});var U9={};o(U9,{setCachedVideoResult:()=>d5,processVideo:()=>K9,getCachedVideoResult:()=>h5,generateThumbnails:()=>l5,generateSpriteSheet:()=>a3,generatePoster:()=>u5,generateHLSManifest:()=>c5,generateDASHManifest:()=>i5,clearVideoCache:()=>r3,analyzeVideo:()=>S4,VideoProcessorCache:()=>g5});var _9=y(()=>{q9();D4();k4();A4()});async function B9(){try{return await Promise.resolve().then(() => (_9(),U9))}catch($){if(!W9)console.warn("[stx-media] Video processor not available, some features disabled:",$),W9=!0;return null}}async function n5($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return oJ(X,Y)}if(Y.processedResult?.processed)return H9($,Y.processedResult,Z);let Q;if(X.generatePoster&&X.src&&!$.poster)Q=await rJ(X,Y);let{src:J,sources:G=[],poster:K,posterPlaceholder:q,controls:_=z9,autoplay:U=!1,muted:W=!1,loop:B=!1,preload:j=j9,playsinline:z=!0,lazy:O=!0,player:F="native",type:L,width:H,height:V,crossorigin:N,disablePictureInPicture:R=!1,disableRemotePlayback:A=!1}=$,T=Q||K,w=$.class,E=$.style,M=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(F==="ts-video")return iJ($,Z);if(L&&L!=="video")return cJ(J||"",L,$);let I=G.length>0?G:J?[{src:J,type:O9(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"'),T)D.push(`data-poster="${B0(T)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${j}"`),T)D.push(`poster="${B0(T)}"`);if(H)D.push(`width="${H}"`);if(V)D.push(`height="${V}"`);if(w)D.push(`class="${B0(w)}"`);if(E)D.push(`style="${B0(E)}"`);let P=I.map((k)=>{return` <source ${O?`data-src="${B0(k.src)}"`:`src="${B0(k.src)}"`} type="${k.type}"${k.media?` media="${k.media}"`:""} />`}).join(`
|
|
2138
2138
|
`),b=`<video ${D.join(" ")}>
|
|
2139
|
-
${
|
|
2139
|
+
${P}
|
|
2140
2140
|
Your browser does not support the video tag.
|
|
2141
|
-
</video>`,S;if(
|
|
2141
|
+
</video>`,S;if(O)S=`
|
|
2142
2142
|
(function() {
|
|
2143
2143
|
var video = document.getElementById('${M}');
|
|
2144
2144
|
if (!video) return;
|
|
@@ -2173,20 +2173,20 @@ ${y}
|
|
|
2173
2173
|
|
|
2174
2174
|
observer.observe(video);
|
|
2175
2175
|
})();
|
|
2176
|
-
`.trim();return{html:b,script:S}}function
|
|
2176
|
+
`.trim();return{html:b,script:S}}function cJ($,Z,Y){let{width:X=640,height:Q=360}=Y,J=Y.class,G=Y.style,K=Y.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,_=null;switch(Z){case"youtube":_=nJ($),q=_?`https://www.youtube-nocookie.com/embed/${_}`:$;break;case"vimeo":_=sJ($),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="${B0(q)}"`,`width="${X}"`,`height="${Q}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(J)U.push(`class="${B0(J)}"`);if(G)U.push(`style="${B0(G)}"`);if(Y.lazy)U.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
|
|
2177
2177
|
<iframe ${U.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
|
|
2178
|
-
</div>`}}function
|
|
2178
|
+
</div>`}}function iJ($,Z={}){let{src:Y,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,F=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,L={src:X.length>0?X:Y,autoplay:G,loop:q,muted:K,playsinline:U,preload:_,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=`
|
|
2179
2179
|
<div
|
|
2180
2180
|
id="${F}"
|
|
2181
|
-
class="ts-video-player${z?" "+
|
|
2182
|
-
style="${
|
|
2181
|
+
class="ts-video-player${z?" "+B0(z):""}"
|
|
2182
|
+
style="${H}"
|
|
2183
2183
|
data-ts-video-player
|
|
2184
2184
|
data-config='${JSON.stringify(L)}'
|
|
2185
2185
|
${W?"data-lazy":""}
|
|
2186
2186
|
>
|
|
2187
2187
|
<div class="ts-video-player__container">
|
|
2188
2188
|
${Q?`
|
|
2189
|
-
<div class="ts-video-player__placeholder" style="background-image: url('${
|
|
2189
|
+
<div class="ts-video-player__placeholder" style="background-image: url('${B0(Q)}');">
|
|
2190
2190
|
<button class="ts-video-player__play-button" aria-label="Play video">
|
|
2191
2191
|
<svg viewBox="0 0 24 24" fill="currentColor" width="64" height="64">
|
|
2192
2192
|
<path d="M8 5v14l11-7z"/>
|
|
@@ -2212,7 +2212,7 @@ ${y}
|
|
|
2212
2212
|
|
|
2213
2213
|
// Load ts-video-player from CDN
|
|
2214
2214
|
var script = document.createElement('script');
|
|
2215
|
-
script.src = '${
|
|
2215
|
+
script.src = '${pJ}';
|
|
2216
2216
|
script.onload = initPlayer;
|
|
2217
2217
|
script.onerror = function() {
|
|
2218
2218
|
console.error('[stx] Failed to load ts-video-player');
|
|
@@ -2342,10 +2342,10 @@ else {
|
|
|
2342
2342
|
.ts-video-player__play-button svg {
|
|
2343
2343
|
margin-left: 4px;
|
|
2344
2344
|
}
|
|
2345
|
-
`.trim();return{html:V,script:N,css:R}}function
|
|
2345
|
+
`.trim();return{html:V,script:N,css:R}}function O9($){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 nJ($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Y of Z){let X=$.match(Y);if(X)return X[1]}return null}function sJ($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function B0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'")}async function oJ($,Z){let Y=await B9();if(!Y)return n5({...$,process:!1},Z);let X=Z.tsVideosConfig,Q=await Y.processVideo($.src,$,X,$.onProcessProgress);if(Q.processed)return H9($,Q,Z);return n5({...$,process:!1},Z)}async function rJ($,Z){let Y=await B9();if(!Y||!$.src)return;let X=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Q=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Y.generatePoster($.src,X,Q.outputDir,Q.baseUrl||"/videos"))?.url}function H9($,Z,Y){let{controls:X=z9,autoplay:Q=!1,muted:J=!1,loop:G=!1,preload:K=j9,playsinline:q=!0,lazy:_=!0,width:U,height:W,crossorigin:B,disablePictureInPicture:j=!1,disableRemotePlayback:z=!1}=$,O=$.class,F=$.style,L=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,H=$.src,V=O9(H);if(Z.transcoded)H=Z.transcoded.url,V="video/mp4";let N=Z.streaming?.hls||Z.streaming?.dash;if(N){if(Z.streaming?.hls)H=Z.streaming.hls.manifestUrl,V="application/x-mpegURL";else if(Z.streaming?.dash)H=Z.streaming.dash.manifestUrl,V="application/dash+xml"}let R=Z.poster?.url||$.poster,A=[`id="${L}"`];if(X)A.push("controls");if(Q)A.push("autoplay");if(J)A.push("muted");if(G)A.push("loop");if(q)A.push("playsinline");if(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="${B0(R)}"`);A.push("data-stx-lazy")}else if(A.push(`preload="${K}"`),R)A.push(`poster="${B0(R)}"`);let T=U||Z.metadata?.width,w=W||Z.metadata?.height;if(T)A.push(`width="${T}"`);if(w)A.push(`height="${w}"`);if(O)A.push(`class="${B0(O)}"`);if(F)A.push(`style="${B0(F)}"`);let M=` <source ${_?`data-src="${B0(H)}"`:`src="${B0(H)}"`} type="${V}" />`,I=`<video ${A.join(" ")}>
|
|
2346
2346
|
${M}
|
|
2347
2347
|
Your browser does not support the video tag.
|
|
2348
|
-
</video>`;if(Z.spriteSheet)I=`<div class="stx-video-wrapper" data-sprite-sheet="${
|
|
2348
|
+
</video>`;if(Z.spriteSheet)I=`<div class="stx-video-wrapper" data-sprite-sheet="${B0(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
|
|
2349
2349
|
${I}
|
|
2350
2350
|
</div>`;let D;if(_)D=`
|
|
2351
2351
|
(function() {
|
|
@@ -2382,7 +2382,7 @@ ${I}
|
|
|
2382
2382
|
|
|
2383
2383
|
observer.observe(video);
|
|
2384
2384
|
})();
|
|
2385
|
-
`.trim();let
|
|
2385
|
+
`.trim();let P;if(N)P=`
|
|
2386
2386
|
.stx-video-wrapper {
|
|
2387
2387
|
position: relative;
|
|
2388
2388
|
width: 100%;
|
|
@@ -2391,9 +2391,9 @@ ${I}
|
|
|
2391
2391
|
width: 100%;
|
|
2392
2392
|
height: auto;
|
|
2393
2393
|
}
|
|
2394
|
-
`.trim();return{html:I,script:D,css:
|
|
2394
|
+
`.trim();return{html:I,script:D,css:P}}var W9=!1,z9=!0,j9="metadata",pJ="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var L9=y(()=>{y4()});function F9(){return M5({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,Y,X)=>{let{src:Q,options:J}=aJ($,Z,Y);if(!Q)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:Q,poster:J.poster,controls:J.controls!==!1,autoplay:J.autoplay||!1,muted:J.muted||!1,loop:J.loop||!1,preload:J.preload||"metadata",playsinline:J.playsinline!==!1,lazy:J.lazy!==!1,player:J.player||"native",type:J.type,width:J.width,height:J.height,class:J.class,style:J.style,id:J.id,crossorigin:J.crossorigin,disablePictureInPicture:J.disablePictureInPicture,disableRemotePlayback:J.disableRemotePlayback,title:J.title,quality:J.quality,platform:J.platform,process:J.process,generatePoster:J.generatePoster,streaming:J.streaming,transcode:J.transcode,spriteSheet:J.spriteSheet,waveform:J.waveform},q={isDev:Y.__isDev||!1,tsVideosConfig:Y.__tsVideosConfig},_=await n5(G,q),U=_.html;if(_.css)U+=`
|
|
2395
2395
|
<style>${_.css}</style>`;if(_.script)U+=`
|
|
2396
|
-
<script>${_.script}</script>`;return U},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function
|
|
2396
|
+
<script>${_.script}</script>`;return U},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function aJ($,Z,Y){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let X=$.trim();if(X.startsWith("@video(")||X.startsWith("("))X=X.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=tJ(X),J=V9(Q[0],Y)||"",G={};if(Q[1]){let K=V9(Q[1],Y);if(typeof K==="object"&&K!==null)G=K;else if(typeof Q[1]==="string")try{G=JSON.parse(Q[1])}catch{}}return{src:J,options:G}}function tJ($){let Z=[],Y="",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 Y+=q;continue}if(!X){if(q==="{")J++;if(q==="}")J--;if(q==="[")G++;if(q==="]")G--;if(q===","&&J===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function V9($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let X=Z[Y];if(X!==void 0)return X}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var b4;var y4=y(()=>{Y4();L9();b4=F9()});function eJ($,Z){let Y=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
|
|
2397
2397
|
${$}
|
|
2398
2398
|
</div>
|
|
2399
2399
|
<script>
|
|
@@ -2438,7 +2438,7 @@ ${I}
|
|
|
2438
2438
|
}
|
|
2439
2439
|
}
|
|
2440
2440
|
})();
|
|
2441
|
-
</script>`}function
|
|
2441
|
+
</script>`}function $Q($,Z){let Y=Z.pwa?.updates,X=Y?.message||"A new version is available. Reload to update?",Q=Y?.autoReload||!1,J=$.trim().length>0,G=`
|
|
2442
2442
|
<div class="stx-pwa-update-banner" style="
|
|
2443
2443
|
position: fixed;
|
|
2444
2444
|
bottom: 0;
|
|
@@ -2549,7 +2549,7 @@ else {
|
|
|
2549
2549
|
// Also listen for custom event
|
|
2550
2550
|
window.addEventListener('pwa-update-available', showUpdate);
|
|
2551
2551
|
})();
|
|
2552
|
-
</script>`}function
|
|
2552
|
+
</script>`}function ZQ($,Z){let Y=$.trim().length>0,X=`
|
|
2553
2553
|
<div class="stx-offline-indicator" style="
|
|
2554
2554
|
position: fixed;
|
|
2555
2555
|
top: 16px;
|
|
@@ -2610,7 +2610,7 @@ else {
|
|
|
2610
2610
|
window.addEventListener('offline', updateStatus);
|
|
2611
2611
|
updateStatus();
|
|
2612
2612
|
})();
|
|
2613
|
-
</script>`}function
|
|
2613
|
+
</script>`}function YQ($,Z){let Y=Z.pwa?.push,X=Y?.vapidPublicKey||"",Q=Y?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
|
|
2614
2614
|
${$}
|
|
2615
2615
|
</div>
|
|
2616
2616
|
<script>
|
|
@@ -2692,55 +2692,55 @@ catch (error) {
|
|
|
2692
2692
|
init();
|
|
2693
2693
|
}
|
|
2694
2694
|
})();
|
|
2695
|
-
</script>`}function
|
|
2696
|
-
${$.message}`),Z&&$.line){let J=
|
|
2695
|
+
</script>`}function nW($){return[...$,...P4]}var XQ,JQ,QQ,GQ,P4;var C4=y(()=>{XQ={name:"pwa.installButton",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return eJ($,Q)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},JQ={name:"pwa.updatePrompt",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return $Q($,Q)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},QQ={name:"pwa.offlineIndicator",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return ZQ($,Q)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},GQ={name:"pwa.pushSubscribe",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return YQ($,Q)},hasEndTag:!0,description:"Renders a push notification subscription button"},P4=[XQ,JQ,QQ,GQ]});function v4($){for(let[Z,Y]of Object.entries(l))if(Y===$)return Z;return}var l;var s5=y(()=>{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 KQ(){return!1}function r1(){return!KQ()||process.env.STX_DEBUG==="true"}import qQ from"path";function o5(){return{...x4}}function r5($){if(!x4.showRelativePaths||!$)return $;let Z=x4.baseDir||process.cwd();try{let Y=qQ.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var UQ,x4,a5,W1,t5;var e5=y(()=>{s5();UQ={showRelativePaths:!1,enableAutoRecovery:r1(),logRecoveryWarnings:!0},x4={...UQ};a5=class a5 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,X,Q,J,G){super($);this.code=Z;this.filePath=Y;this.line=X;this.column=Q;this.context=J;if(this.name="StxError",this.numericCode=G||l.EVALUATION_ERROR,this.filePath)this.filePath=r5(this.filePath)}};W1=class W1 extends a5{constructor($,Z,Y,X,Q,J){super($,"stx_RUNTIME_ERROR",Z,Y,X,Q,J||l.EVALUATION_ERROR);this.name="StxRuntimeError"}};t5=class t5 extends a5{isFatal=!0;constructor($,Z,Y,X,Q,J){super($,"stx_VALIDATION_ERROR",Z,Y,X,Q,J||l.DOM_API_VIOLATION);this.name="StxValidationError"}}});function N9($){let{type:Z,message:Y,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=OQ(K,q);B=H.line,j=H.column}let z=Q?r5(Q):void 0,O=X?v4(X):void 0,F={type:Z,code:X,codeName:O,message:Y,filePath:z,line:B,column:j,snippet:_,suggestion:U,timestamp:new Date().toISOString()},L;switch(W){case"html":L=WQ(F);break;case"json":L=JSON.stringify(F,null,2);break;case"console":L=BQ(F,K,q);break;case"text":default:L=_Q(F,K,q);break}return{formatted:L,data:F}}function _Q($,Z,Y){let X=[],Q=$.code?` [${$.codeName||$.code}]`:"";if(X.push(`[${$.type} Error${Q}]`),$.filePath){let J=$.filePath;if($.line){if(J+=`:${$.line}`,$.column)J+=`:${$.column}`}X.push(`at ${J}`)}if(X.push(`
|
|
2696
|
+
${$.message}`),Z&&$.line){let J=zQ(Z,$.line,2);if(J)X.push(`
|
|
2697
2697
|
${J}`)}if($.snippet)X.push(`
|
|
2698
2698
|
Snippet: ${$.snippet}`);if($.suggestion)X.push(`
|
|
2699
|
-
Suggestion: ${$.suggestion}`);return X.join(" ")}function
|
|
2699
|
+
Suggestion: ${$.suggestion}`);return X.join(" ")}function WQ($){let Z=$.code?` [${$.code}]`:"",Y=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",X=`<!-- [${$.type} Error${Z}]${Y}: ${R9($.message)}`;if($.suggestion)X+=` | Suggestion: ${R9($.suggestion)}`;return X+=" -->",X}function BQ($,Z,Y){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(`
|
|
2700
2700
|
\x1B[90mat\x1B[0m ${W}`)}if(_.push(`
|
|
2701
2701
|
|
|
2702
|
-
${$.message}`),Z&&$.line){let W=
|
|
2702
|
+
${$.message}`),Z&&$.line){let W=jQ(Z,$.line,2);if(W)_.push(`
|
|
2703
2703
|
|
|
2704
2704
|
\x1B[90mContext:\x1B[0m
|
|
2705
2705
|
${W}`)}if($.suggestion)_.push(`
|
|
2706
2706
|
|
|
2707
2707
|
\x1B[33mSuggestion:\x1B[0m ${$.suggestion}`);return _.push(`
|
|
2708
|
-
${"\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
|
|
2708
|
+
${"\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 zQ($,Z,Y){let X=$.split(`
|
|
2709
2709
|
`),Q=Math.max(0,Z-Y-1),J=Math.min(X.length-1,Z+Y-1),G=[];for(let K=Q;K<=J;K++){let q=(K+1).toString().padStart(4),_=K===Z-1?">":" ";G.push(`${_}${q} | ${X[K]}`)}return G.join(`
|
|
2710
|
-
`)}function
|
|
2710
|
+
`)}function jQ($,Z,Y){let X=$.split(`
|
|
2711
2711
|
`),Q=Math.max(0,Z-Y-1),J=Math.min(X.length-1,Z+Y-1),G="\x1B[90m",K="\x1B[31m",q="\x1B[0m",_=[];for(let U=Q;U<=J;U++){let W=(U+1).toString().padStart(4),B=U===Z-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(`
|
|
2712
|
-
`)}function
|
|
2713
|
-
`);return{line:X.length,column:X[X.length-1].length}}function s($,Z,Y){return
|
|
2712
|
+
`)}function R9($){return $.replace(/--/g,"- -").replace(/>/g,">")}function OQ($,Z){let X=$.substring(0,Z).split(`
|
|
2713
|
+
`);return{line:X.length,column:X[X.length-1].length}}function s($,Z,Y){return N9({type:$,message:Z,code:Y,format:"html"}).formatted}async function M1($,Z,Y){try{return await $()}catch(X){if(Y&&X instanceof Error)Y(X);return Z}}var A9=y(()=>{s5();e5()});class g4{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor($={}){this.maxErrors=$.maxErrors??1000,this.enableFileLogging=$.enableFileLogging??!1,this.logFilePath=$.logFilePath??".stx/errors.log",this.logFormat=$.logFormat??"json",this.maxFileSize=$.maxFileSize??10485760,this.maxLogFiles=$.maxLogFiles??5,this.minLevel=$.minLevel??"all"}configure($){if($.maxErrors!==void 0)this.maxErrors=$.maxErrors;if($.enableFileLogging!==void 0)this.enableFileLogging=$.enableFileLogging;if($.logFilePath!==void 0)this.logFilePath=$.logFilePath;if($.logFormat!==void 0)this.logFormat=$.logFormat;if($.maxFileSize!==void 0)this.maxFileSize=$.maxFileSize;if($.maxLogFiles!==void 0)this.maxLogFiles=$.maxLogFiles;if($.minLevel!==void 0)this.minLevel=$.minLevel}log($,Z,Y="error"){let X={timestamp:new Date,error:$,context:Z,level:Y};if(this.errors.push(X),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Y))this.writeToFile(X)}shouldLog($){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return $==="error"||$==="warning";if(this.minLevel==="error")return $==="error";return!0}formatEntry($){if(this.logFormat==="json")return JSON.stringify({timestamp:$.timestamp.toISOString(),level:$.level||"error",type:$.error.constructor.name,message:$.error.message,stack:$.error.stack,context:$.context});let Z=[`[${$.timestamp.toISOString()}] [${($.level||"error").toUpperCase()}] ${$.error.constructor.name}: ${$.error.message}`];if($.error.stack)Z.push(` Stack: ${$.error.stack.split(`
|
|
2714
2714
|
`).slice(1).join(`
|
|
2715
2715
|
`)}`);if($.context)Z.push(` Context: ${JSON.stringify($.context)}`);return Z.join(`
|
|
2716
2716
|
`)}writeToFile($){this.writeQueue=this.writeQueue.then(async()=>{try{let Z=await import("fs"),X=(await import("path")).dirname(this.logFilePath);if(!Z.existsSync(X))Z.mkdirSync(X,{recursive:!0});await this.rotateIfNeeded(Z);let Q=`${this.formatEntry($)}
|
|
2717
2717
|
`;Z.appendFileSync(this.logFilePath,Q,"utf-8")}catch(Z){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",Z)}})}async rotateIfNeeded($){try{if(!$.existsSync(this.logFilePath))return;if($.statSync(this.logFilePath).size<this.maxFileSize)return;for(let Y=this.maxLogFiles-1;Y>=1;Y--){let X=`${this.logFilePath}.${Y}`,Q=`${this.logFilePath}.${Y+1}`;if($.existsSync(X))if(Y>=this.maxLogFiles-1)$.unlinkSync(X);else $.renameSync(X,Q)}if(this.maxLogFiles<=1)$.writeFileSync(this.logFilePath,"");else $.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(Z){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",Z)}}getRecentErrors($=10){return this.errors.slice(-$)}getErrorsByType($){return this.errors.filter((Z)=>Z.error.constructor.name===$)}getErrorsByLevel($){return this.errors.filter((Z)=>Z.level===$)}clear(){this.errors.length=0}async clearLogFile(){try{let $=await import("fs");if($.existsSync(this.logFilePath))$.writeFileSync(this.logFilePath,"","utf-8")}catch($){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",$)}}getStats(){let $={},Z={error:0,warning:0,info:0};for(let Y of this.errors){let X=Y.error.constructor.name;$[X]=($[X]||0)+1;let Q=Y.level||"error";Z[Q]=(Z[Q]||0)+1}return{total:this.errors.length,byType:$,byLevel:Z}}async exportToFile($,Z="json"){let Y=await import("fs"),Q=(await import("path")).dirname($);if(!Y.existsSync(Q))Y.mkdirSync(Q,{recursive:!0});if(Z==="json"){let J=this.errors.map((G)=>({timestamp:G.timestamp.toISOString(),level:G.level||"error",type:G.error.constructor.name,message:G.error.message,stack:G.error.stack,context:G.context}));Y.writeFileSync($,JSON.stringify(J,null,2),"utf-8")}else{let J=this.errors.map((G)=>this.formatEntry(G));Y.writeFileSync($,J.join(`
|
|
2718
2718
|
|
|
2719
|
-
`),"utf-8")}}async flush(){await this.writeQueue}}var
|
|
2720
|
-
@end${K}`;X.push(`Added ${U} missing @end${K}`)}}if(X.length>0&&Z.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),X.forEach((K)=>console.warn(` - ${K}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Y,fixes:X}},createFallbackContent($,Z){if(
|
|
2721
|
-
`)}}});var
|
|
2722
|
-
`,V+=`<meta name="title" content="${d(
|
|
2723
|
-
`;if(
|
|
2724
|
-
`;if(
|
|
2725
|
-
`}if(
|
|
2726
|
-
`;if(
|
|
2727
|
-
`;if(
|
|
2728
|
-
`,N.title||
|
|
2729
|
-
`}if(N.description||
|
|
2730
|
-
`}if(N.url||
|
|
2719
|
+
`),"utf-8")}}async flush(){await this.writeQueue}}var f4,B1,h4;var T9=y(()=>{e5();f4={isEnabled(){return o5().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=o5();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let Y=$,X=[],Q=(Y.match(/\{\{/g)||[]).length,J=(Y.match(/\}\}/g)||[]).length;if(Q>J){let K=Q-J;Y+="}}".repeat(K),X.push(`Added ${K} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let K of G){let q=(Y.match(new RegExp(`@${K}\\b`,"g"))||[]).length,_=(Y.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(q>_){let U=q-_;for(let W=0;W<U;W++)Y+=`
|
|
2720
|
+
@end${K}`;X.push(`Added ${U} missing @end${K}`)}}if(X.length>0&&Z.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),X.forEach((K)=>console.warn(` - ${K}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Y,fixes:X}},createFallbackContent($,Z){if(r1())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};B1=new g4,h4={isDevelopment(){return r1()},logDetailedError($,Z){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",$.message),console.error("Stack:",$.stack),Z)console.error("Context:",Z);console.error("========================")},createErrorReport($,Z){let Y=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${$.message}`,`Type: ${$.constructor.name}`,`Stack: ${$.stack}`];if(Z)Y.push(`Context: ${JSON.stringify(Z,null,2)}`);return Y.push("========================"),Y.join(`
|
|
2721
|
+
`)}}});var w9=()=>{};var M9=y(()=>{s5();A9();T9();w9();e5()});var m0=y(()=>{M9()});function I9($,Z,Y,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&&Z[B])_=Z[B];else if(W.startsWith("og:")&&Z.openGraph&&Z.openGraph[U[1]])_=Z.openGraph[U[1]];else _="";return _?`<meta property="${d(W)}" content="${d(_)}">`:""}return _?`<meta name="${d(q)}" content="${d(_)}">`:""});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,Z);if(!z)return"";let O="<meta";if(z.name)O+=` name="${d(String(z.name))}"`;if(z.property)O+=` property="${d(String(z.property))}"`;if(z.httpEquiv)O+=` http-equiv="${d(String(z.httpEquiv))}"`;if(z.content)O+=` content="${d(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 E9($,Z,Y){let X=$,Q=/@structuredData\s*\(/g,J;while((J=Q.exec(X))!==null){let G=J.index,K=G+J[0].length-1,q=1,_=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,Z);if(!j)return"";if(!j["@context"])j["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(j).replace(/<\//g,"<\\/")}</script>`}catch(j){let 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 D9($,Z,Y,X){let Q=$,J=/@seo\s*\(\s*\{/g,G;while((G=J.exec(Q))!==null){let K=Q.indexOf("{",G.index+4),q=1,_=K+1,U=null,W=!1;while(_<Q.length&&q>0){let L=Q[_];if(W){W=!1,_++;continue}if(L==="\\"&&U){W=!0,_++;continue}if(U){if(L===U)U=null;_++;continue}if(L==='"'||L==="'"||L==="`"){U=L,_++;continue}if(L==="{")q++;else if(L==="}")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),F=((L)=>{try{let H=z0(L,Z);if(!H)return"";let V="";if(H.title)V+=`<title>${d(H.title)}</title>
|
|
2722
|
+
`,V+=`<meta name="title" content="${d(H.title)}">
|
|
2723
|
+
`;if(H.description)V+=`<meta name="description" content="${d(H.description)}">
|
|
2724
|
+
`;if(H.keywords){let N=Array.isArray(H.keywords)?H.keywords.join(", "):H.keywords;V+=`<meta name="keywords" content="${d(N)}">
|
|
2725
|
+
`}if(H.robots)V+=`<meta name="robots" content="${d(H.robots)}">
|
|
2726
|
+
`;if(H.canonical)V+=`<link rel="canonical" href="${d(H.canonical)}">
|
|
2727
|
+
`;if(H.openGraph){let N=H.openGraph;if(V+=`<meta property="og:type" content="${d(N.type||"website")}">
|
|
2728
|
+
`,N.title||H.title){let R=N.title||H.title||"";V+=`<meta property="og:title" content="${d(R)}">
|
|
2729
|
+
`}if(N.description||H.description){let R=N.description||H.description||"";V+=`<meta property="og:description" content="${d(R)}">
|
|
2730
|
+
`}if(N.url||H.canonical){let R=N.url||H.canonical||"";V+=`<meta property="og:url" content="${d(R)}">
|
|
2731
2731
|
`}if(N.image){if(V+=`<meta property="og:image" content="${d(N.image)}">
|
|
2732
2732
|
`,N.imageAlt)V+=`<meta property="og:image:alt" content="${d(N.imageAlt)}">
|
|
2733
2733
|
`;if(N.imageWidth)V+=`<meta property="og:image:width" content="${d(String(N.imageWidth))}">
|
|
2734
2734
|
`;if(N.imageHeight)V+=`<meta property="og:image:height" content="${d(String(N.imageHeight))}">
|
|
2735
2735
|
`}if(N.siteName)V+=`<meta property="og:site_name" content="${d(N.siteName)}">
|
|
2736
|
-
`}if(
|
|
2737
|
-
`,N.title||
|
|
2738
|
-
`}if(N.description||
|
|
2739
|
-
`}if(N.image||
|
|
2736
|
+
`}if(H.twitter){let N=H.twitter;if(V+=`<meta name="twitter:card" content="${d(N.card||"summary_large_image")}">
|
|
2737
|
+
`,N.title||H.title){let R=N.title||H.title||"";V+=`<meta name="twitter:title" content="${d(R)}">
|
|
2738
|
+
`}if(N.description||H.description){let R=N.description||H.description||"";V+=`<meta name="twitter:description" content="${d(R)}">
|
|
2739
|
+
`}if(N.image||H.openGraph&&H.openGraph.image){let R=N.image||(H.openGraph?H.openGraph.image:"")||"";V+=`<meta name="twitter:image" content="${d(R)}">
|
|
2740
2740
|
`}if(N.site)V+=`<meta name="twitter:site" content="${d(N.site)}">
|
|
2741
2741
|
`;if(N.creator)V+=`<meta name="twitter:creator" content="${d(N.creator)}">
|
|
2742
|
-
`}if(
|
|
2743
|
-
`}return V.trim()}catch(
|
|
2742
|
+
`}if(H.structuredData){let N=JSON.stringify(H.structuredData).replace(/<\//g,"<\\/");V+=`<script type="application/ld+json">${N}</script>
|
|
2743
|
+
`}return V.trim()}catch(H){let V=H instanceof Error?H.message:String(H);return s("SEO",`Error processing @seo directive: ${V}`,l.EVALUATION_ERROR)}})(z);Q=Q.substring(0,G.index)+F+Q.substring(j),J.lastIndex=G.index+F.length}return Q}function k9($,Z,Y){if(Y.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||Y.skipDefaultSeoTags===!0)return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=$.includes("<title>")||$.includes("</title>"),Q="";if(Z.title)Q=Z.title;else if(Z.meta&&Z.meta.title)Q=Z.meta.title;else if(Y.seo?.defaultConfig?.title)Q=Y.seo.defaultConfig.title;else Q=Y.defaultTitle||"stx Project";let J="";if(Z.description)J=Z.description;else if(Z.meta&&Z.meta.description)J=Z.meta.description;else if(Y.seo?.defaultConfig?.description)J=Y.seo.defaultConfig.description;else J=Y.defaultDescription||"A website built with stx templating engine";let G="";if(Z.image)G=Z.image;else if(Z.meta&&Z.meta.image)G=Z.meta.image;else if(Z.openGraph&&Z.openGraph.image)G=Z.openGraph.image;else if(Y.seo?.defaultImage)G=Y.seo.defaultImage;else if(Y.defaultImage)G=Y.defaultImage;let K=`
|
|
2744
2744
|
<!-- stx SEO Tags -->
|
|
2745
2745
|
<meta name="title" content="${d(Q)}">
|
|
2746
2746
|
<meta name="description" content="${d(J)}">
|
|
@@ -2756,7 +2756,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
|
|
|
2756
2756
|
`;let q=$;if(!X)q=q.replace(/<head[^>]*>/,`$&
|
|
2757
2757
|
<title>${d(Q)}</title>`);return q.replace(/<head[^>]*>/,`$&
|
|
2758
2758
|
${K}
|
|
2759
|
-
`)}function d($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var
|
|
2759
|
+
`)}function d($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var S9,b9;var d4=y(()=>{m0();V0();S9={name:"meta",handler:($,Z,Y,X)=>{if(Z.length<1)return s("Meta","meta directive requires at least the meta name",l.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),J=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${d(Q)}" content="${d(J)}">`},hasEndTag:!1},b9={name:"structuredData",handler:($,Z,Y,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 a1 from"path";function HQ($,Z){let Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=Y?Y[1].trim():"",Q=Z,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((F)=>F.trim().replace(/['"`]/g,"")).filter((F)=>F.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 LQ($){let{tag:Z,props:Y,template:X,styles:Q,shadowDOM:J}=$,G=Z.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,"\\`"),_=Y.map((W)=>`'${W}'`).join(", "),U=Y.map((W)=>`
|
|
2760
2760
|
get ${W}() {
|
|
2761
2761
|
return this.getAttribute('${W}') || '';
|
|
2762
2762
|
}
|
|
@@ -2807,16 +2807,16 @@ ${U}
|
|
|
2807
2807
|
}
|
|
2808
2808
|
|
|
2809
2809
|
customElements.define('${Z}', ${G});
|
|
2810
|
-
`}async function
|
|
2811
|
-
${
|
|
2812
|
-
</script>`}var D3=C(()=>{m4();L4()});var k3={};o(k3,{timingPlugin:()=>jQ,pluginManager:()=>_Q,definePlugin:()=>$6,debugPlugin:()=>zQ,createVariablesPlugin:()=>HQ,createFilterPlugin:()=>BQ,createDirectivePlugin:()=>WQ,PluginManager:()=>d0});function $6($){return $}class d0{plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Z){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Y of $.dependencies)if(!this.plugins.has(Y))throw Error(`Plugin "${$.name}" depends on "${Y}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Z);this.sortPlugins()}async unregister($){let Z=this.plugins.get($);if(!Z)return!1;for(let[Y,X]of this.plugins)if(X.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Y}" depends on it`);if(Z.onUnregister)await Z.onUnregister();return this.plugins.delete($),this.sortPlugins(),!0}get($){return this.plugins.get($)}has($){return this.plugins.has($)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let $=[];for(let Z of this.sortedPlugins)if(Z.registerDirectives)$.push(...Z.registerDirectives());return $}getAllFilters(){let $={};for(let Z of this.sortedPlugins)if(Z.registerFilters)Object.assign($,Z.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Z){return this.runDirectiveHooks("beforeDirective",$,Z)}async runAfterDirective($,Z){return this.runDirectiveHooks("afterDirective",$,Z)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Z of this.sortedPlugins)if(Z.onError)try{let Y=await Z.onError($);if(Y){if(Y.template!==void 0)$.template=Y.template;if(Y.context)$.context={...$.context,...Y.context};if(Y.metadata)$.metadata={...$.metadata,...Y.metadata};if(Y.skip)return $}}catch(Y){console.error(`Error in plugin "${Z.name}" onError hook:`,Y)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let Y={...Z};for(let X of this.sortedPlugins){let Q=X[$];if(Q)try{let J=await Q(Y);if(J){if(J.template!==void 0)Y.template=J.template;if(J.context)Y.context={...Y.context,...J.context};if(J.metadata)Y.metadata={...Y.metadata,...J.metadata};if(J.skip)break}}catch(J){console.error(`Error in plugin "${X.name}" ${$} hook:`,J)}}return Y}async runDirectiveHooks($,Z,Y){let X={...Y};for(let Q of this.sortedPlugins){let J=Q[$];if(J)try{let G=await J(Z,X);if(G){if(G.template!==void 0)X.template=G.template;if(G.context)X.context={...X.context,...G.context};if(G.metadata)X.metadata={...X.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${Q.name}" ${$} hook:`,G)}}return X}}function WQ($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function BQ($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function HQ($){return $6({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var _Q,zQ,jQ;var S3=C(()=>{_Q=new d0;zQ=$6({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess($){console.log("[stx-debug] beforeProcess:",$.filePath)},afterParse($){console.log("[stx-debug] afterParse:",$.template.length,"chars")},beforeDirective($,Z){console.log("[stx-debug] beforeDirective:",$)},afterDirective($,Z){console.log("[stx-debug] afterDirective:",$)},beforeRender($){console.log("[stx-debug] beforeRender")},afterRender($){console.log("[stx-debug] afterRender:",$.template.length,"chars")},onError($){console.error("[stx-debug] onError:",$.error.message,"in phase:",$.phase)}}),jQ=$6({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Z=$.metadata.startTime;if(Z){let Y=performance.now()-Z;console.log(`[stx-timing] Processing took ${Y.toFixed(2)}ms`)}}})});var y3={};o(y3,{validateConfig:()=>VQ,loadStxConfig:()=>Y6,defineStxConfig:()=>FQ,defaultConfig:()=>u0,config:()=>l0});import m0 from"fs";import N4 from"path";import{loadConfigWithResult as OQ}from"bunfig";function LQ($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let X=N4.join(process.cwd(),"resources","views"),Q=N4.join(process.cwd(),"resources","layouts");if(m0.existsSync(X)&&m0.existsSync(Q))return{root:"resources",pagesDir:"views"};let J=N4.join(process.cwd(),"resources","views","pages");if(m0.existsSync(J))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}async function Y6($){if(!$){if(I5)return I5;if(Z6)return Z6}let Z=$?N4.resolve($):process.cwd(),Y=b3.get(Z);if(Y)return Y;let X=(async()=>{let J=(await OQ({name:"stx",alias:"ui",cwd:Z,defaultConfig:u0,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&&!N4.isAbsolute(J.partialsDir))J.partialsDir=N4.join(K,J.partialsDir);if(J.componentsDir&&!N4.isAbsolute(J.componentsDir))J.componentsDir=N4.join(K,J.componentsDir);if(J.layoutsDir&&!N4.isAbsolute(J.layoutsDir))J.layoutsDir=N4.join(K,J.layoutsDir)}if(J.plugins&&J.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (S3(),k3)),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=N4.dirname(e.resolve(W))}catch{let F=N4.resolve(process.cwd(),W);j=await import(F),z=N4.dirname(F)}let H=j.default||j;if(K.register(H,J),H.components){let F=N4.resolve(z,H.components);q.push(F)}if(H.pages){let F=N4.resolve(z,H.pages),L=B.path||"/";_.push({dir:F,prefix:L})}if(H.setup){let F={addDirective:(L)=>{J.customDirectives=J.customDirectives||[],J.customDirectives.push(L)},addRoute:(L,O)=>{J.apiRoutes=J.apiRoutes||{},J.apiRoutes[L]=O},addMiddleware:(L)=>{J.middleware=J.middleware||[],J.middleware.push(L)},pluginDir:z,config:J};await H.setup(B,F)}console.log(`[stx] Plugin loaded: ${H.name||W}`)}catch(j){console.warn(`[stx] Failed to load plugin ${W}:`,j.message)}}J._pluginComponentDirs=q,J._pluginPageDirs=_}return J})();if(b3.set(Z,X),!$)Z6=X,X.then((Q)=>{I5=Q}).catch(()=>{});return X}function FQ($){return $}function VQ($){let Z=[],Y=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let X=["auto","manual","sections"];if(!X.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${X.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let X=["json","yaml","yml","js"];if(!X.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${X.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let X=["AA","AAA"];if(!X.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${X.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let X=["progressive","islands"];if(!X.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${X.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let X=["none","eager","lazy"];if(!X.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${X.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((X,Q)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${Q}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${Q}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((X,Q)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${Q}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${Q}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${Q}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Y.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)Y.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let X=["fullscreen","standalone","minimal-ui","browser"];if(!X.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let X=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!X.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.routes){let X=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Q,J)=>{if(!Q.pattern||typeof Q.pattern!=="string")Z.push({path:`pwa.routes[${J}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(Q.strategy))Z.push({path:`pwa.routes[${J}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(Q.maxAgeSeconds!==void 0&&(typeof Q.maxAgeSeconds!=="number"||Q.maxAgeSeconds<0))Z.push({path:`pwa.routes[${J}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Q.maxEntries!==void 0&&(typeof Q.maxEntries!=="number"||Q.maxEntries<1))Z.push({path:`pwa.routes[${J}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Q)=>typeof Q!=="number"||Q<16||Q>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let X=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((J)=>!X.includes(J)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Y.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Y.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:Y}}var u0,I5=null,b3,Z6=null,l0;var X6=C(()=>{x6();f6();g6();h6();$0();pZ();b0();P0();h0();D3();u0={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:OZ,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:E3,hasEndTag:!1,description:"Include a web component in the template"},F8,V8,M3,I3,R8,A8,T8,N8,E8,S8,lZ,S0,...y0],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}};b3=new Map;l0=new Proxy(u0,{get($,Z){if(I5&&Z in I5)return I5[Z];if(!Z6)Y6().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});import Y4 from"path";async function C3($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig}}catch{}return null}function RQ(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"",Y=process.cwd();while(Y!==Y4.dirname(Y))$.push(Y4.join(Y,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(Y4.join(Y,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(Y4.join(Y,"node_modules","@stacksjs","crosswind","dist","index.js")),Y=Y4.dirname(Y);if(Z){let X=[Y4.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),Y4.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),Y4.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),Y4.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),Y4.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),Y4.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...X)}return $.push(Y4.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(Y4.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function NQ(){if(P3)return t5;P3=!0;try{let $=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Y of $){let X=await C3(Y);if(X)return t5=X,console.log(`${U4.green}[Crosswind]${U4.reset} CSS engine loaded`),t5}let Z=RQ();for(let Y of Z)if(await Bun.file(Y).exists()){let X=await C3(Y);if(X)return t5=X,console.log(`${U4.green}[Crosswind]${U4.reset} CSS engine loaded from ${Y4.dirname(Y4.dirname(Y))}`),t5}throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${U4.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${U4.reset}`),console.warn(`${U4.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${U4.reset}`),null}}async function TQ($){let Z=null;for(let Y of AQ){let X=Y4.join($,Y);if(await Bun.file(X).exists()){Z=X;break}}if(!Z)return null;try{let{loadConfigWithResult:Y}=await import("bunfig"),X=await Y({name:"crosswind",cwd:$,defaultConfig:{},verbose:!1});if(X?.config&&Object.keys(X.config).length>0){let Q=X.path?Y4.relative($,X.path):Y4.relative($,Z);return console.log(`${U4.green}[Crosswind]${U4.reset} Loaded config from ${Q||Z}`),X.config}}catch{}try{let Y=await import(Z),X=Y.default||Y,Q=Y4.relative($,Z);return console.log(`${U4.green}[Crosswind]${U4.reset} Loaded config from ${Q||Z}`),X}catch(Y){return console.warn(`${U4.yellow}[Crosswind]${U4.reset} Failed to load ${Y4.basename(Z)}:`,Y instanceof Error?Y.message:Y),null}}function wQ($){let Z=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,X=Y.exec($);while(X!==null){for(let G of X[1].split(/\s+/))if(G.trim())Z.add(G.trim());X=Y.exec($)}let Q=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,J=Q.exec($);while(J!==null){let G=J[1].match(/'([^']+)'/g);if(G){for(let K of G)for(let q of K.slice(1,-1).split(/\s+/))if(q.trim())Z.add(q.trim())}J=Q.exec($)}return Z}async function MQ($,Z){try{let Y=await NQ();if(!Y)return"";let X=wQ($);if(X.size===0)return"";let Q=Z?Y4.resolve(Z):process.cwd();if(!p0){let L=null;try{let{loadStxConfig:O}=await Promise.resolve().then(() => (X6(),y3)),V=await O(Q);if(V.css)if(typeof V.css==="string"){let N=Y4.isAbsolute(V.css)?V.css:Y4.resolve(Q,V.css);if(await Bun.file(N).exists()){let R=await import(N);L=R.default||R,console.log(`${U4.green}[Crosswind]${U4.reset} Loaded config from stx.config.ts \u2192 ${V.css}`)}}else{if(L={content:V.css.content||[],preflight:V.css.preflight??!0,minify:V.css.minify??!1},V.css.config){let N=Y4.isAbsolute(V.css.config)?V.css.config:Y4.resolve(Q,V.css.config);if(await Bun.file(N).exists()){let R=await import(N);L={...R.default||R,...L}}}console.log(`${U4.green}[Crosswind]${U4.reset} Using inline CSS config from stx.config.ts`)}}catch{}p0=L||await TQ(Q)}let J=Y.defaultConfig||Y.config,G=p0||{},K=J.theme||{},_=(G.theme||{}).extend||{},U={...K};if(Object.keys(_).length>0)U.extend=_;let W=[...J.safelist||[],...G.safelist||[]],B={...J,...G,content:[],output:"",preflight:!0,minify:!1,theme:U,safelist:W},j=new Y.CSSGenerator(B);for(let L of W)j.generate(L);for(let L of X)j.generate(L);let z=j.toCSS(!0,!1),H=B.shortcuts||G.shortcuts||{};for(let[L,O]of Object.entries(H)){if(!X.has(L)&&!W.includes(L))continue;let V=O.split(/\s+/).filter(Boolean);for(let N of V)j.generate(N)}z=j.toCSS(!0,!1);let F=z.split(`
|
|
2813
|
-
`);for(let[L,
|
|
2810
|
+
`}async function y9($,Z,Y,X){if(Z.length<1)return s("WebComponent","@webcomponent directive requires at least the tag name parameter",l.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[a1.join(a1.dirname(X),G,`${Q}.stx`),a1.join(process.cwd(),G,`${Q}.stx`),a1.join(a1.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 _=HQ(q,Q);return`<script type="module">
|
|
2811
|
+
${LQ(_)}
|
|
2812
|
+
</script>`}var P9=y(()=>{m0();L0()});var C9={};o(C9,{timingPlugin:()=>AQ,pluginManager:()=>FQ,definePlugin:()=>$$,debugPlugin:()=>NQ,createVariablesPlugin:()=>TQ,createFilterPlugin:()=>RQ,createDirectivePlugin:()=>VQ,PluginManager:()=>m4});function $$($){return $}class m4{plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Z){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Y of $.dependencies)if(!this.plugins.has(Y))throw Error(`Plugin "${$.name}" depends on "${Y}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Z);this.sortPlugins()}async unregister($){let Z=this.plugins.get($);if(!Z)return!1;for(let[Y,X]of this.plugins)if(X.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Y}" depends on it`);if(Z.onUnregister)await Z.onUnregister();return this.plugins.delete($),this.sortPlugins(),!0}get($){return this.plugins.get($)}has($){return this.plugins.has($)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let $=[];for(let Z of this.sortedPlugins)if(Z.registerDirectives)$.push(...Z.registerDirectives());return $}getAllFilters(){let $={};for(let Z of this.sortedPlugins)if(Z.registerFilters)Object.assign($,Z.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Z){return this.runDirectiveHooks("beforeDirective",$,Z)}async runAfterDirective($,Z){return this.runDirectiveHooks("afterDirective",$,Z)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Z of this.sortedPlugins)if(Z.onError)try{let Y=await Z.onError($);if(Y){if(Y.template!==void 0)$.template=Y.template;if(Y.context)$.context={...$.context,...Y.context};if(Y.metadata)$.metadata={...$.metadata,...Y.metadata};if(Y.skip)return $}}catch(Y){console.error(`Error in plugin "${Z.name}" onError hook:`,Y)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let Y={...Z};for(let X of this.sortedPlugins){let Q=X[$];if(Q)try{let J=await Q(Y);if(J){if(J.template!==void 0)Y.template=J.template;if(J.context)Y.context={...Y.context,...J.context};if(J.metadata)Y.metadata={...Y.metadata,...J.metadata};if(J.skip)break}}catch(J){console.error(`Error in plugin "${X.name}" ${$} hook:`,J)}}return Y}async runDirectiveHooks($,Z,Y){let X={...Y};for(let Q of this.sortedPlugins){let J=Q[$];if(J)try{let G=await J(Z,X);if(G){if(G.template!==void 0)X.template=G.template;if(G.context)X.context={...X.context,...G.context};if(G.metadata)X.metadata={...X.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${Q.name}" ${$} hook:`,G)}}return X}}function VQ($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function RQ($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function TQ($){return $$({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var FQ,NQ,AQ;var v9=y(()=>{FQ=new m4;NQ=$$({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess($){console.log("[stx-debug] beforeProcess:",$.filePath)},afterParse($){console.log("[stx-debug] afterParse:",$.template.length,"chars")},beforeDirective($,Z){console.log("[stx-debug] beforeDirective:",$)},afterDirective($,Z){console.log("[stx-debug] afterDirective:",$)},beforeRender($){console.log("[stx-debug] beforeRender")},afterRender($){console.log("[stx-debug] afterRender:",$.template.length,"chars")},onError($){console.error("[stx-debug] onError:",$.error.message,"in phase:",$.phase)}}),AQ=$$({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Z=$.metadata.startTime;if(Z){let Y=performance.now()-Z;console.log(`[stx-timing] Processing took ${Y.toFixed(2)}ms`)}}})});var f9={};o(f9,{validateConfig:()=>EQ,loadStxConfig:()=>Y$,defineStxConfig:()=>IQ,defaultConfig:()=>l4,config:()=>p4});import u4 from"fs";import N0 from"path";import{loadConfigWithResult as wQ}from"bunfig";function MQ($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let X=N0.join(process.cwd(),"resources","views"),Q=N0.join(process.cwd(),"resources","layouts");if(u4.existsSync(X)&&u4.existsSync(Q))return{root:"resources",pagesDir:"views"};let J=N0.join(process.cwd(),"resources","views","pages");if(u4.existsSync(J))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}async function Y$($){if(!$){if(I1)return I1;if(Z$)return Z$}let Z=$?N0.resolve($):process.cwd(),Y=x9.get(Z);if(Y)return Y;let X=(async()=>{let J=(await wQ({name:"stx",alias:"ui",cwd:Z,defaultConfig:l4,verbose:!1})).config,G=MQ(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(() => (v9(),C9)),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(e.resolve(W))}catch{let F=N0.resolve(process.cwd(),W);j=await import(F),z=N0.dirname(F)}let O=j.default||j;if(K.register(O,J),O.components){let F=N0.resolve(z,O.components);q.push(F)}if(O.pages){let F=N0.resolve(z,O.pages),L=B.path||"/";_.push({dir:F,prefix:L})}if(O.setup){let F={addDirective:(L)=>{J.customDirectives=J.customDirectives||[],J.customDirectives.push(L)},addRoute:(L,H)=>{J.apiRoutes=J.apiRoutes||{},J.apiRoutes[L]=H},addMiddleware:(L)=>{J.middleware=J.middleware||[],J.middleware.push(L)},pluginDir:z,config:J};await O.setup(B,F)}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(x9.set(Z,X),!$)Z$=X,X.then((Q)=>{I1=Q}).catch(()=>{});return X}function IQ($){return $}function EQ($){let Z=[],Y=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let X=["auto","manual","sections"];if(!X.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${X.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let X=["json","yaml","yml","js"];if(!X.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${X.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let X=["AA","AAA"];if(!X.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${X.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let X=["progressive","islands"];if(!X.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${X.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let X=["none","eager","lazy"];if(!X.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${X.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((X,Q)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${Q}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${Q}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((X,Q)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${Q}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${Q}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${Q}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Y.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)Y.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let X=["fullscreen","standalone","minimal-ui","browser"];if(!X.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let X=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!X.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.routes){let X=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Q,J)=>{if(!Q.pattern||typeof Q.pattern!=="string")Z.push({path:`pwa.routes[${J}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(Q.strategy))Z.push({path:`pwa.routes[${J}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(Q.maxAgeSeconds!==void 0&&(typeof Q.maxAgeSeconds!=="number"||Q.maxAgeSeconds<0))Z.push({path:`pwa.routes[${J}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Q.maxEntries!==void 0&&(typeof Q.maxEntries!=="number"||Q.maxEntries<1))Z.push({path:`pwa.routes[${J}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Q)=>typeof Q!=="number"||Q<16||Q>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let X=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((J)=>!X.includes(J)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Y.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Y.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:Y}}var l4,I1=null,x9,Z$=null,p4;var X$=y(()=>{f$();g$();h$();d$();Z4();o3();y4();C4();d4();P9();l4={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:N3,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:y9,hasEndTag:!1,description:"Include a web component in the template"},T6,w6,S9,b9,M6,E6,D6,I6,y6,v6,s3,b4,...P4],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}};x9=new Map;p4=new Proxy(l4,{get($,Z){if(I1&&Z in I1)return I1[Z];if(!Z$)Y$().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});import Y0 from"path";async function h9($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig}}catch{}return null}function DQ(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"",Y=process.cwd();while(Y!==Y0.dirname(Y))$.push(Y0.join(Y,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(Y0.join(Y,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(Y0.join(Y,"node_modules","@stacksjs","crosswind","dist","index.js")),Y=Y0.dirname(Y);if(Z){let X=[Y0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),Y0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),Y0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),Y0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),Y0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),Y0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...X)}return $.push(Y0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(Y0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function kQ(){if(g9)return t1;g9=!0;try{let $=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Y of $){let X=await h9(Y);if(X)return t1=X,console.log(`${U0.green}[Crosswind]${U0.reset} CSS engine loaded`),t1}let Z=DQ();for(let Y of Z)if(await Bun.file(Y).exists()){let X=await h9(Y);if(X)return t1=X,console.log(`${U0.green}[Crosswind]${U0.reset} CSS engine loaded from ${Y0.dirname(Y0.dirname(Y))}`),t1}throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${U0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${U0.reset}`),console.warn(`${U0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${U0.reset}`),null}}async function bQ($){let Z=null;for(let Y of SQ){let X=Y0.join($,Y);if(await Bun.file(X).exists()){Z=X;break}}if(!Z)return null;try{let{loadConfigWithResult:Y}=await import("bunfig"),X=await Y({name:"crosswind",cwd:$,defaultConfig:{},verbose:!1});if(X?.config&&Object.keys(X.config).length>0){let Q=X.path?Y0.relative($,X.path):Y0.relative($,Z);return console.log(`${U0.green}[Crosswind]${U0.reset} Loaded config from ${Q||Z}`),X.config}}catch{}try{let Y=await import(Z),X=Y.default||Y,Q=Y0.relative($,Z);return console.log(`${U0.green}[Crosswind]${U0.reset} Loaded config from ${Q||Z}`),X}catch(Y){return console.warn(`${U0.yellow}[Crosswind]${U0.reset} Failed to load ${Y0.basename(Z)}:`,Y instanceof Error?Y.message:Y),null}}function yQ($){let Z=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,X=Y.exec($);while(X!==null){for(let G of X[1].split(/\s+/))if(G.trim())Z.add(G.trim());X=Y.exec($)}let Q=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,J=Q.exec($);while(J!==null){let G=J[1].match(/'([^']+)'/g);if(G){for(let K of G)for(let q of K.slice(1,-1).split(/\s+/))if(q.trim())Z.add(q.trim())}J=Q.exec($)}return Z}async function PQ($,Z){try{let Y=await kQ();if(!Y)return"";let X=yQ($);if(X.size===0)return"";let Q=Z?Y0.resolve(Z):process.cwd();if(!c4){let L=null;try{let{loadStxConfig:H}=await Promise.resolve().then(() => (X$(),f9)),V=await H(Q);if(V.css)if(typeof V.css==="string"){let N=Y0.isAbsolute(V.css)?V.css:Y0.resolve(Q,V.css);if(await Bun.file(N).exists()){let R=await import(N);L=R.default||R,console.log(`${U0.green}[Crosswind]${U0.reset} Loaded config from stx.config.ts \u2192 ${V.css}`)}}else{if(L={content:V.css.content||[],preflight:V.css.preflight??!0,minify:V.css.minify??!1},V.css.config){let N=Y0.isAbsolute(V.css.config)?V.css.config:Y0.resolve(Q,V.css.config);if(await Bun.file(N).exists()){let R=await import(N);L={...R.default||R,...L}}}console.log(`${U0.green}[Crosswind]${U0.reset} Using inline CSS config from stx.config.ts`)}}catch{}c4=L||await bQ(Q)}let J=Y.defaultConfig||Y.config,G=c4||{},K=J.theme||{},_=(G.theme||{}).extend||{},U={...K};if(Object.keys(_).length>0)U.extend=_;let W=[...J.safelist||[],...G.safelist||[]],B={...J,...G,content:[],output:"",preflight:!0,minify:!1,theme:U,safelist:W},j=new Y.CSSGenerator(B);for(let L of W)j.generate(L);for(let L of X)j.generate(L);let z=j.toCSS(!0,!1),O=B.shortcuts||G.shortcuts||{};for(let[L,H]of Object.entries(O)){if(!X.has(L)&&!W.includes(L))continue;let V=H.split(/\s+/).filter(Boolean);for(let N of V)j.generate(N)}z=j.toCSS(!0,!1);let F=z.split(`
|
|
2813
|
+
`);for(let[L,H]of Object.entries(O)){if(!X.has(L)&&!W.includes(L))continue;let V=H.split(/\s+/).filter(Boolean),N=[],R=[];for(let A of V){let T=A.startsWith("dark:"),M=`.${(T?A.slice(5):A).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let I=0;I<F.length;I++){let D=F[I].trim();if(D===`${M} {`||D.startsWith(`${M} {`)){let P=I,b="";while(P<F.length){if(b+=F[P],F[P].includes("}"))break;P++}let S=b.match(/\{([^}]+)\}/);if(S)if(T)R.push(S[1].trim());else N.push(S[1].trim());break}}}if(N.length)z+=`
|
|
2814
2814
|
.${L} { ${N.join(" ")} }`;if(R.length)z+=`
|
|
2815
|
-
@media (prefers-color-scheme: dark) { .dark .${L} { ${R.join(" ")} } }`}return z}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function
|
|
2815
|
+
@media (prefers-color-scheme: dark) { .dark .${L} { ${R.join(" ")} } }`}return z}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function d9($,Z){if($.includes('data-crosswind="generated"'))return $;let Y=await PQ($,Z);if(!Y)return $;let X=`<style data-crosswind="generated">
|
|
2816
2816
|
${Y}
|
|
2817
2817
|
</style>`;if($.includes("</head>"))return $.replace("</head>",`${X}
|
|
2818
2818
|
</head>`);if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
|
|
2819
|
-
${X}`);return X+$}var
|
|
2819
|
+
${X}`);return X+$}var t1=null,g9=!1,c4=null,SQ;var m9=y(()=>{N6();SQ=["crosswind.config.ts","crosswind.config.js","crosswind.config.mjs","crosswind.config.cjs"]});function u9(){return`
|
|
2820
2820
|
// STX Lifecycle Runtime
|
|
2821
2821
|
(function() {
|
|
2822
2822
|
if (typeof window === 'undefined') return;
|
|
@@ -3161,7 +3161,7 @@ else {
|
|
|
3161
3161
|
|
|
3162
3162
|
console.log('[stx] Lifecycle runtime initialized');
|
|
3163
3163
|
})();
|
|
3164
|
-
`}function
|
|
3164
|
+
`}function i4($){return Symbol($)}var Gz,Kz,qz;var l9=y(()=>{Gz=i4("theme"),Kz=i4("router"),qz=i4("i18n")});import*as c9 from"crypto";function p9($){let Z=/\$(\w+)\./g,Y=[],X;while((X=Z.exec($))!==null)if(!Y.includes(X[1]))Y.push(X[1]);return Y}function CQ(){return`stx-${c9.randomBytes(4).toString("hex")}`}function vQ($){return/\$\w+\./.test($)}function xQ($){let Z=[],Y=new Set,X=/<(\w+)([^>]*?)(\s*\/?>)/g,Q=$;return Q=Q.replace(X,(J,G,K,q)=>{if(["script","style","template"].includes(G.toLowerCase()))return J;let _=[],U=!1,W=K,B=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,j=[...K.matchAll(B)];for(let F of j){let L=F[0],H=F[1],V=F[2];if(vQ(V)){U=!0;let N=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(N){let R=N[1];if(_.push({attr:H,expr:R,fullMatch:L,originalAttr:H}),p9(R).forEach((T)=>Y.add(T)),H==="text")W=W.replace(L,"");else if(H==="class")W=W.replace(L,'class=""');else if(H==="disabled"||H==="hidden")W=W.replace(L,"");else W=W.replace(L,`${H}=""`)}}}if(!U)return J;let z=W.match(/\bid\s*=\s*"([^"]+)"/),O;if(z)O=z[1];else O=CQ(),W=` id="${O}"${W}`;for(let F of _)Z.push({elementId:O,attribute:F.attr,expression:F.expr,stores:p9(F.expr)});return`<${G}${W}${q}`}),{html:Q,bindings:Z,stores:Y}}function fQ($,Z){if($.length===0)return"";let Y=Array.from(Z),X=`
|
|
3165
3165
|
<script>
|
|
3166
3166
|
(function() {
|
|
3167
3167
|
'use strict';
|
|
@@ -3287,10 +3287,10 @@ else {
|
|
|
3287
3287
|
}
|
|
3288
3288
|
})();
|
|
3289
3289
|
</script>
|
|
3290
|
-
`,X}function
|
|
3290
|
+
`,X}function i9($){let{html:Z,bindings:Y,stores:X}=xQ($);if(Y.length===0)return $;let Q=fQ(Y,X),J=Z.lastIndexOf("</body>");if(J!==-1)return Z.slice(0,J)+Q+Z.slice(J);return Z+Q}var n9=()=>{};function gQ($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return hQ(Z);case"google-analytics":return dQ(Z);case"plausible":return mQ(Z);case"self-hosted":return uQ(Z);case"custom":return lQ(Z);default:return""}}function hQ($){let Z=$.fathom;if(!Z?.siteId)return"";let Y=Z.scriptUrl||"https://cdn.usefathom.com/script.js",X=Z.defer!==!1?" defer":"",Q=[`data-site="${I0(Z.siteId)}"`];if(Z.honorDnt)Q.push('data-honor-dnt="true"');if(Z.spa)Q.push('data-spa="auto"');if(Z.canonical)Q.push(`data-canonical="${I0(Z.canonical)}"`);if(Z.auto===!1)Q.push('data-auto="false"');return`
|
|
3291
3291
|
<!-- Fathom Analytics -->
|
|
3292
|
-
<script src="${
|
|
3293
|
-
`}function
|
|
3292
|
+
<script src="${I0(Y)}" ${Q.join(" ")}${X}></script>
|
|
3293
|
+
`}function dQ($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let Y=I0(Z.measurementId),X=Z.debug?`gtag('config', '${Y}', { 'debug_mode': true });`:"";return`
|
|
3294
3294
|
<!-- Google Analytics -->
|
|
3295
3295
|
<script async src="https://www.googletagmanager.com/gtag/js?id=${Y}"></script>
|
|
3296
3296
|
<script>
|
|
@@ -3300,10 +3300,10 @@ else {
|
|
|
3300
3300
|
gtag('config', '${Y}');
|
|
3301
3301
|
${X}
|
|
3302
3302
|
</script>
|
|
3303
|
-
`}function
|
|
3303
|
+
`}function mQ($){let Z=$.plausible;if(!Z?.domain)return"";let Y=Z.scriptUrl||"https://plausible.io/js/script.js",X=[`data-domain="${I0(Z.domain)}"`],Q=Y,J=[];if(Z.trackLocalhost)J.push("local");if(Z.hashMode)J.push("hash");if(J.length>0&&Y==="https://plausible.io/js/script.js")Q=`https://plausible.io/js/script.${J.join(".")}.js`;return`
|
|
3304
3304
|
<!-- Plausible Analytics -->
|
|
3305
|
-
<script defer data-domain="${
|
|
3306
|
-
`}function
|
|
3305
|
+
<script defer data-domain="${I0(Z.domain)}" src="${I0(Q)}"></script>
|
|
3306
|
+
`}function uQ($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let Y=I0(Z.siteId),X=I0(Z.apiEndpoint),Q=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",J=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
|
|
3307
3307
|
d.addEventListener('click',function(e){
|
|
3308
3308
|
var a=e.target.closest('a');
|
|
3309
3309
|
if(a&&a.hostname!==location.hostname){
|
|
@@ -3336,15 +3336,15 @@ else {
|
|
|
3336
3336
|
w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
|
|
3337
3337
|
})();
|
|
3338
3338
|
</script>
|
|
3339
|
-
`}function
|
|
3339
|
+
`}function lQ($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
|
|
3340
3340
|
<!-- Custom Analytics -->
|
|
3341
3341
|
<script>
|
|
3342
3342
|
${Z.inlineScript}
|
|
3343
3343
|
</script>
|
|
3344
|
-
`;if(!Z.scriptUrl)return"";let Y=[];if(Z.scriptId)Y.push(`id="${
|
|
3344
|
+
`;if(!Z.scriptUrl)return"";let Y=[];if(Z.scriptId)Y.push(`id="${I0(Z.scriptId)}"`);if(Z.attributes)for(let[Q,J]of Object.entries(Z.attributes))Y.push(`${I0(Q)}="${I0(J)}"`);return`
|
|
3345
3345
|
<!-- Custom Analytics -->
|
|
3346
|
-
<script${Y.length>0?` ${Y.join(" ")}`:""} src="${
|
|
3347
|
-
`}function
|
|
3346
|
+
<script${Y.length>0?` ${Y.join(" ")}`:""} src="${I0(Z.scriptUrl)}" defer></script>
|
|
3347
|
+
`}function s9($,Z){let Y=gQ(Z);if(!Y)return $;if(!$.includes("</head>")){let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Y+$.slice(X);return $+Y}return $.replace("</head>",`${Y}</head>`)}function I0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var o9=()=>{};function t9($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Y of $){let X=Y.toLowerCase();if(X==="prevent")Z.prevent=!0;else if(X==="stop")Z.stop=!0;else if(X==="once")Z.once=!0;else if(X==="capture")Z.capture=!0;else if(X==="self")Z.self=!0;else if(X==="passive")Z.passive=!0;else if(pQ.has(X))Z.systemKeys.push(X);else if(X in e9)Z.mouse=X;else if(X in a9||/^[a-z]$/.test(X))Z.keys.push(a9[X]||X.toUpperCase());else if(X.startsWith("debounce")){let Q=X.match(/debounce(?:\.(\d+))?/);Z.debounce=Q?.[1]?Number.parseInt(Q[1],10):300}else if(X.startsWith("throttle")){let Q=X.match(/throttle(?:\.(\d+))?/);Z.throttle=Q?.[1]?Number.parseInt(Q[1],10):300}}return Z}function $8($){let Z=[],Y=0,X=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Q;while((Q=X.exec($))!==null){let[J,G,K]=Q,q=Q.index,_=q+J.length,U=`__stx_evt_${Y++}`,W=[],B=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,j;while((j=B.exec(K))!==null){let[,O,F]=j,L=O.split("."),H=L[0];if(!r9.has(H))continue;W.push({attribute:`@${O}`,event:H,handler:F,modifiers:t9(L.slice(1)),elementId:U})}let z=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((j=z.exec(K))!==null){let[,O,F]=j,L=O.split("."),H=L[0];if(!r9.has(H))continue;W.push({attribute:`@${O}`,event:H,handler:F,modifiers:t9(L.slice(1)),elementId:U})}if(W.length>0)Z.push({originalTag:J,elementId:U,events:W,startIndex:q,endIndex:_})}return Z}function cQ($){let Z=[],{modifiers:Y}=$;if(Y.self)Z.push("if ($event.target !== $el) return");for(let X of Y.systemKeys)Z.push(`if (!$event.${X}Key) return`);if(Y.keys.length>0){let X=Y.keys.map((Q)=>`$event.key === '${Q}'`).join(" || ");Z.push(`if (!(${X})) return`)}if(Y.mouse!==null){let X=e9[Y.mouse];Z.push(`if ($event.button !== ${X}) return`)}if(Y.prevent)Z.push("$event.preventDefault()");if(Y.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function iQ($,Z){let Y=$;if(Z.debounce!==null)Y=`__stx_debounce(() => { ${Y} }, ${Z.debounce})`;else if(Z.throttle!==null)Y=`__stx_throttle(() => { ${Y} }, ${Z.throttle})`;return Y}function nQ($){let{modifiers:Z}=$,Y=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=cQ($),Q=iQ($.handler,Z),J=[];if(Z.once)J.push("once: true");if(Z.capture)J.push("capture: true");if(Z.passive)J.push("passive: true");let G=J.length>0?`, { ${J.join(", ")} }`:"",K=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
|
|
3348
3348
|
(function() {
|
|
3349
3349
|
var $el = document.getElementById('${Y}');
|
|
3350
3350
|
if (!$el) return;
|
|
@@ -3398,7 +3398,7 @@ else {
|
|
|
3398
3398
|
${Q}
|
|
3399
3399
|
}
|
|
3400
3400
|
}${G});
|
|
3401
|
-
})();`}function
|
|
3401
|
+
})();`}function sQ($){if($.length===0)return"";return`
|
|
3402
3402
|
<script data-stx-events>
|
|
3403
3403
|
(function() {
|
|
3404
3404
|
'use strict';
|
|
@@ -3426,11 +3426,11 @@ else {
|
|
|
3426
3426
|
}
|
|
3427
3427
|
|
|
3428
3428
|
// Event listeners
|
|
3429
|
-
${$.flatMap((Y)=>Y.events).map(
|
|
3429
|
+
${$.flatMap((Y)=>Y.events).map(nQ).join(`
|
|
3430
3430
|
`)}
|
|
3431
3431
|
})();
|
|
3432
|
-
</script>`}function
|
|
3433
|
-
`+J.slice(K);else J+=G;return J}var
|
|
3432
|
+
</script>`}function oQ($){let Z=$8($);if(Z.length===0)return{template:$,bindings:[]};let Y=$,X=[];for(let Q=Z.length-1;Q>=0;Q--){let J=Z[Q],G=J.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${J.elementId}"`);else{let K=G.match(/id=["']([^"']+)["']/);if(K)for(let q of J.events)q.elementId=K[1]}for(let K of J.events){let q=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),_=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),U=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");G=G.replace(_,""),G=G.replace(U,"")}Y=Y.slice(0,J.startIndex)+G+Y.slice(J.endIndex),X.push(...J.events)}return{template:Y,bindings:X}}function Z8($,Z,Y){if(/\b(?:state|derived|effect)\s*\(/.test($)||/@(?:model|show|for|if)\s*=/.test($)||/data-stx(?:-auto)?(?![-\w])/.test($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:q,bindings:_}=oQ($),U=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...U,..._],q}let Q=$8($);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=sQ(Q),K=J.lastIndexOf("</body>");if(K!==-1)J=J.slice(0,K)+G+`
|
|
3433
|
+
`+J.slice(K);else J+=G;return J}var r9,a9,pQ,e9;var Y8=y(()=>{r9=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"]),a9={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"},pQ=new Set(["ctrl","alt","shift","meta"]),e9={left:0,middle:1,right:2}});function J$($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function X8($,Z){let Y=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(Y)return Y[1];let X=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(X)return X[1];return null}function aQ($){let Z=[],Y=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,X;while((X=Y.exec($))!==null){let[Q,J,G]=X,K=X.index,q=X8(G,"x-data");if(!q)continue;let _=`__stx_scope_${J8++}`,U=X8(G,"x-init"),W=tQ($,J,K+Q.length),B=$.slice(K,W.endIndex),j=eQ(B);Z.push({id:_,selector:`[data-stx-scope="${_}"]`,stateExpr:q,initExpr:U,bindings:[],refs:j})}return Z}function tQ($,Z,Y){let X=1,Q=Y,J=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),K=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(X>0&&Q<$.length){J.lastIndex=Q,G.lastIndex=Q,K.lastIndex=Q;let q=J.exec($),_=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 eQ($){let Z=new Map,Y=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),X=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,Q;while((Q=X.exec(Y))!==null){let[,J,G]=Q,K=$G(J);Z.set(G,K)}return Z}function $G($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${rQ++}`}function ZG(){return`
|
|
3434
3434
|
// STX Reactive Runtime - x-cloak and transition CSS
|
|
3435
3435
|
(function() {
|
|
3436
3436
|
var style = document.createElement('style');
|
|
@@ -3634,7 +3634,7 @@ window.__stx_reactive = (function() {
|
|
|
3634
3634
|
|
|
3635
3635
|
return { initScope: initScope, reactive: reactive };
|
|
3636
3636
|
})();
|
|
3637
|
-
`}function
|
|
3637
|
+
`}function YG($){if($.length===0)return"";let Z=$.map((Y)=>{let X=JSON.stringify(Object.fromEntries(Y.refs)),Q=JSON.stringify(Y.stateExpr),J=Y.initExpr?JSON.stringify(Y.initExpr):"null";return`
|
|
3638
3638
|
(function() {
|
|
3639
3639
|
var scopeEl = document.querySelector('${Y.selector}');
|
|
3640
3640
|
if (!scopeEl) return;
|
|
@@ -3643,33 +3643,33 @@ window.__stx_reactive = (function() {
|
|
|
3643
3643
|
})();`}).join(`
|
|
3644
3644
|
`);return`
|
|
3645
3645
|
<script data-stx-scoped data-stx-reactive>
|
|
3646
|
-
${
|
|
3646
|
+
${ZG()}
|
|
3647
3647
|
${Z}
|
|
3648
|
-
</script>`}function
|
|
3649
|
-
`+Q.slice(G);else Q+=J;return Q}function oQ($,Z){let Y=$;for(let X of Z){let J=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${J6(X.stateExpr)}["']`,"gi").exec(Y);if(J)X.id=J[1],X.selector=`[data-stx-scope="${X.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${J6(X.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(Y);if(K)X.id=K[1],X.selector=`[data-stx-scope="${X.id}"]`;else Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${J6(X.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`),Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${J6(X.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`)}}return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Y=Y.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Y}function rQ($){return/x-data\s*=\s*["']/.test($)}var e3=0,uQ=0;import aQ from"fs";import i0 from"path";import{createHighlighter as tQ}from"ts-syntax-highlighter";async function eQ($,Z={}){try{if(!await c($))throw Error(`Markdown file not found: ${$}`);let X=(await aQ.promises.stat($)).mtime.getTime();if(Z.cache&&n0.has($)){let W=n0.get($);if(W.updatedAt>=X)return{content:W.content,data:W.data}}let Q=await Bun.file($).text(),{data:J,content:G}=y8(Q),K=Z.markdown||l0.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},_=h5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)_=await $G(_,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let U={content:_,data:J||{}};if(Z.cache)n0.set($,{...U,updatedAt:X});return U}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let X=Y instanceof Error?Y.message:String(Y);return{content:J4("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}async function $G($,Z,Y){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!Q6)try{Q6=await tQ({theme:Z||"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(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),B=_||(Y?"text":"");if(!B)return K;try{if(!Q6.getSupportedLanguages().includes(B))return K;return(await Q6.highlight(W,B,{theme:Z})).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 Z1($,Z,Y="",X={}){return await ZG($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,_)=>{try{let U=K;if(!i0.isAbsolute(K))U=i0.resolve(i0.dirname(Y),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 O=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of O){let N=V.indexOf(":");if(N>0){let R=V.substring(0,N).trim(),A=V.substring(N+1).trim(),T=A.startsWith('"')&&A.endsWith('"'),w=A.startsWith("'")&&A.endsWith("'");if(T||w)A=A.substring(1,A.length-1);W[R]=A}}}}catch(L){if(X.debug)console.error("Error parsing context in @markdown-file directive:",L)}let{content:B,data:j}=await eQ(U,X),z={...Z,...j,...W},H=B,F=/\{\{([^}]+)\}\}/g;return H=H.replace(F,(L,O)=>{let V=O.trim();return z[V]!==void 0?String(z[V]):L}),H}catch(U){let W=U instanceof Error?U.message:String(U);return J4("Markdown File",`Error including markdown file: ${W}`,Y,$,_,G)}})}async function ZG($,Z,Y){let X=[],Q;while((Q=Z.exec($))!==null){let K=Q[0],q=Q.index,_=Q;X.push(Y(..._).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 n0,Q6=null;var Y1=C(()=>{X6();L4();n0=new Map});function i4($,Z){try{let Y=$.trim();if(t(Y))return $4(Y,Object.keys(Z))(...Object.values(Z));else return X4(Y,Z)}catch{return!1}}var X1=C(()=>{V4()});function n4($,Z){let Y=YG($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function YG($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let X=w4($,"(",")",Y);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,X),endPos:X+1}}function B5($,Z,Y,X){let Q=1,J=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(J<$.length&&Q>0){G.lastIndex=J,K.lastIndex=J;let q=G.exec($),_=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 J1($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let X=Z+Y[0].length,Q=n4($,X);if(!Q)return null;let J=Q.endPos,G=B5($,"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 H=K.substring(z);if(/^@if\s*\(/.test(H)){j++,_++;continue}if(/^@endif(?![a-z])/.test(H)){j--,_+=6;continue}if(j===0){let F=H.match(/^@elseif\s*/);if(F){q.push({type:U,condition:W,content:K.substring(B,_),start:J+B,end:J+_});let L=_+F[0].length,O=n4(K,L);if(!O){_++;continue}U="elseif",W=O.expression,_=O.endPos,B=_;continue}else if(/^@else(?![a-z])/.test(H)){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(Z,G+6),branches:q,start:Z,end:G+6}}function s0($){let Z=[],Y=/@if\s*\(/g,X=Y.exec($);while(X!==null){if(Z.some((G)=>X.index>G.start&&X.index<G.end)){X=Y.exec($);continue}let J=J1($,X.index);if(J)Z.push(J),Y.lastIndex=J.end;X=Y.exec($)}return Z}function G6($,Z,Y){let X=[],Q=new RegExp(`@${Z}\\s*\\(`,"g"),J=Q.exec($);while(J!==null){if(X.some((H)=>J.index>H.start&&J.index<H.end)){J=Q.exec($);continue}let K=J.index,q=K+J[0].length-1,_=w4($,"(",")",q);if(_===-1){J=Q.exec($);continue}let U=$.slice(q+1,_),W=_+1,B=B5($,Z,Y,W);if(B===-1){J=Q.exec($);continue}let j=$.slice(W,B),z=B+`@${Y}`.length;X.push({fullMatch:$.slice(K,z),name:Z,params:U,content:j,start:K,end:z}),Q.lastIndex=z,J=Q.exec($)}return X}function o0($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let X=Z+Y[0].length,Q=n4($,X);if(!Q)return null;let J=Q.endPos,G=B5($,"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 H=B.match(/^@case\s*/),F=B.match(/^@default(?![a-z])/),L=B.match(/^@break(?![a-z])/);if(H&&B.startsWith("@case")){if(U)q.push(U);let O=_+H[0].length,V=n4(K,O);if(!V){_++;continue}U={type:"case",value:V.expression,content:""},_=V.endPos}else if(F&&B.startsWith("@default")){if(U)q.push(U);U={type:"default",content:""},_+=F[0].length}else if(L&&B.startsWith("@break"))_+=L[0].length;else{if(U)U.content+=K[_];_++}}if(U)q.push(U);return{fullMatch:$.slice(Z,G+10),expression:Q.expression,cases:q,start:Z,end:G+10}}var Q1=()=>{};var G1=()=>{};var r0=C(()=>{Q1();G1()});function GG($,Z,Y){let X=$,Q=!0;while(Q){Q=!1;let J=X.match(/@switch\s*\(/);if(!J||J.index===void 0)break;let G=J.index,K=o0(X,G);if(!K)break;try{let q;if(t(K.expression))q=$4(K.expression,Object.keys(Z))(...Object.values(Z));else q=X4(K.expression,Z);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&&t(W.value))B=$4(W.value,Object.keys(Z))(...Object.values(Z));else if(W.value)B=X4(W.value,Z);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 E5($,Z,Y){let X=$;X=GG(X,Z,Y);{let J=!0;while(J){J=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=n4(X,K+7);if(!q)break;let _=q.endPos,U=B5(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 H=0,F=/@(?:if|unless)\s*\(/g,L=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,V=[],N;while((N=F.exec(W))!==null)V.push({pos:N.index,type:"open"});while((N=L.exec(W))!==null)V.push({pos:N.index,type:"close"});while((N=O.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")H++;else if(R.type==="close")H--;else if(R.type==="else"&&H===0){j=R.pos;break}}let z;if(j!==-1){let H=W.slice(0,j),F=W.slice(j+5);z=`@if (${B})${F}@else ${H}@endif`}else z=`@if (!(${B}))${W}@endif`;X=X.substring(0,K)+z+X.substring(U+10),J=!0}}X=t0(X,Z,Y),X=e0(X,Z,Y),X=a0(X,Z);let Q=()=>{let J=s0(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&&t(U.condition))W=$4(U.condition,Object.keys(Z))(...Object.values(Z));else if(U.condition)W=X4(U.condition,Z);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 K1($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let Y=$[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let X=[];while(Z<$.length){let Q=$[Z];if(Q==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(Q===Y){Z++;break}X.push(Q),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function a0($,Z){let Y=$;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 H=j.exec(K),F=z.exec(K),L=H?H.index:1/0,O=F?F.index:1/0;if(L<O)W++,B=L+H[0].length;else if(O<1/0){if(W--,W===0)return O;B=O+F[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=[],H;while((H=W.exec(K))!==null)z.push({pos:H.index,type:"open"});while((H=B.exec(K))!==null)z.push({pos:H.index,type:"close"});while((H=j.exec(K))!==null)z.push({pos:H.index,type:"else"});z.sort((F,L)=>F.pos-L.pos);for(let F of z)if(F.type==="open")U++;else if(F.type==="close")U--;else if(F.type==="else"&&U===0)return F.pos;return-1}{let K=!0;while(K){K=!1;let q=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let _=q.index,U,W,B=Y.slice(_+5),j=K1(B);if(j)U=j.value,W=_+5+j.consumed;else W=_+5;let z=X(Y,"auth","endauth",W);if(z===-1){console.warn(`[stx] @auth directive at position ${_} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(W,z),F=Q(H,"auth","endauth"),L;if(!Z.auth)L=!1;else L=U?i4(`auth?.check && auth?.user?.[${U}]`,Z):i4("auth?.check",Z);let O;if(F!==-1){let V=H.slice(0,F),N=H.slice(F+5);O=L?V:N}else O=L?H:"";Y=Y.substring(0,_)+O+Y.substring(z+8),K=!0}}{let K=!0;while(K){K=!1;let q=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let _=q.index,U,W,B=Y.slice(_+6),j=K1(B);if(j)U=j.value,W=_+6+j.consumed;else W=_+6;let z=X(Y,"guest","endguest",W);if(z===-1){console.warn(`[stx] @guest directive at position ${_} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(W,z),F=Q(H,"guest","endguest"),L;if(!Z.auth)L=!0;else L=U?i4(`!auth?.check || !auth?.user?.[${U}]`,Z):i4("!auth?.check",Z);let O;if(F!==-1){let V=H.slice(0,F),N=H.slice(F+5);O=L?V:N}else O=L?H:"";Y=Y.substring(0,_)+O+Y.substring(z+9),K=!0}}function J(K,q,_){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let U=[K];if(q)U.push(q);if(_){let W=i4(_,Z);U.push(W)}return Z.permissions.check(...U)}catch{return!1}return!1}function G(K){let q=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let K of["can","cannot"]){let q=`end${K}`,_=K==="can"?"elsecan":"elsecannot",U=!0;while(U){U=!1;let W=Y.match(new RegExp(`@${K}\\s*\\(`));if(!W||W.index===void 0)break;let B=W.index,j=Y.slice(B+`@${K}`.length),z=G(j);if(!z)break;let H=B+`@${K}`.length+z.paramsEnd,F=X(Y,K,q,H);if(F===-1){console.warn(`[stx] @${K} directive at position ${B} has no matching @${q} \u2014 the block was skipped.`);break}let L=Y.slice(H,F),O=[],V=0,N=new RegExp(`@${K}\\s*\\(`,"g"),R=new RegExp(`@${q}(?![a-z])`,"g"),A=new RegExp(`@${_}\\s*\\(`,"g"),T=/@else(?![a-z])/g,w=[],E;while((E=N.exec(L))!==null)w.push({pos:E.index,type:"open"});while((E=R.exec(L))!==null)w.push({pos:E.index,type:"close"});while((E=A.exec(L))!==null)w.push({pos:E.index,type:"elseDirective"});while((E=T.exec(L))!==null)w.push({pos:E.index,type:"else"});w.sort((S,k)=>S.pos-k.pos);for(let S of w){if(S.type==="open"){V++;continue}if(S.type==="close"){V--;continue}if(V===0)O.push(S)}let M=[],I=0;for(let S=0;S<O.length;S++){let k=O[S];if(M.push({content:L.slice(I,k.pos),ability:void 0}),k.type==="elseDirective"){let g=L.slice(k.pos+`@${_}`.length),h=G(g);if(h){M[M.length-1]={content:L.slice(I,k.pos)},I=k.pos+`@${_}`.length+h.paramsEnd,M.push({content:"",ability:h.ability,type:h.type,id:h.id}),M.pop();let i=O[S+1],W4=i?i.pos:L.length;M.push({content:L.slice(I,W4),ability:h.ability,type:h.type,id:h.id}),I=W4}}else I=k.pos+5}if(I<L.length){let S=M[M.length-1];if(O.length>0&&O[O.length-1].type==="else")M.push({content:L.slice(I),isFinalElse:!0});else if(M.length===0)M.push({content:L.slice(I)})}let D=J(z.ability,z.type,z.id),y=K==="can"?D:!D,b="";if(y)b=M[0]?.content||"";else{let S=!1;for(let k=1;k<M.length;k++){let g=M[k];if(g.isFinalElse){b=g.content,S=!0;break}if(g.ability){let h=J(g.ability,g.type,g.id);if(K==="can"?h:!h){b=g.content,S=!0;break}}}if(!S&&M.length>0){let k=M[M.length-1];if(k.isFinalElse)b=k.content}}Y=Y.substring(0,B)+b+Y.substring(F+`@${q}`.length),U=!0}}return Y}function t0($,Z,Y){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=n4(J,j+`@${G}`.length);if(!z)break;let H=z.endPos,F=B5(J,G,K,H);if(F===-1){console.warn(`[stx] @${G} directive at position ${j} has no matching @${K} \u2014 the block was skipped.`);break}let L=J.slice(H,F),O=z.expression,V=-1,N=0,R=0;while(R<L.length){let A=L.indexOf("@",R);if(A===-1)break;let T=L.substring(A);if(/^@(?:if|unless|isset|empty)\s*\(/.test(T)){N++,R=A+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(T)){N--,R=A+1;continue}if(N===0&&/^@else(?![a-z])/.test(T)){V=A;break}R=A+1}try{let A=q(O.trim()),T;if(V!==-1){let w=L.slice(0,V),E=L.slice(V+5);T=A?w:E}else T=A?L:"";J=J.substring(0,j)+T+J.substring(F+`@${K}`.length),U=!0}catch(A){let T=A instanceof Error?A.message:String(A),w=s(_,`Error processing @${G} directive: ${T}`,l.EVALUATION_ERROR);J=J.substring(0,j)+w+J.substring(F+`@${K}`.length);break}}return J}return X=Q(X,"isset","endisset",(J)=>{let G=i4(J,Z);return G!==void 0&&G!==null},"Isset"),X=Q(X,"empty","endempty",(J)=>{let G=i4(J,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),X}function e0($,Z,Y){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,H=!0;while(H){H=!1,U.lastIndex=0;let F=U.exec(z);if(!F)break;let L=F.index,O=L+F[0].length;if(K==="env"){let D=z.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!D)break;O+=D[0].length,_=Q===D[2]}let V=1,N=O,R=-1;while(V>0&&N<z.length){U.lastIndex=N,W.lastIndex=N;let D=U.exec(z),y=W.exec(z),b=D?D.index:1/0,S=y?y.index:1/0;if(b<S)V++,N=b+D[0].length;else if(S<1/0){if(V--,V===0){R=S;break}N=S+y[0].length}else break}if(R===-1){console.warn(`[stx] @${K} directive at position ${L} has no matching @${q} \u2014 the block was skipped.`);break}let A=z.substring(O,R),T=-1,w=0,E=0;while(E<A.length){let D=A.indexOf("@",E);if(D===-1)break;let y=A.substring(D);if(B.test(y)){w++,E=D+1;continue}if(j.test(y)){w--,E=D+1;continue}if(w===0&&/^@else(?![a-z])/.test(y)){T=D;break}E=D+1}let M;if(T!==-1){let D=A.slice(0,T),y=A.slice(T+5);M=_?D:y}else M=_?A:"";let I=`@${q}`.length;z=z.substring(0,L)+M+z.substring(R+I),H=!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 K6=C(()=>{X1();m4();r0();V4()});function U1($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function q6($,Z){if(!$)return Z?.nonceGenerator?.()??U1();let Y=q1.get($);if(!Y)Y=Z?.nonceGenerator?.()??U1(),q1.set($,Y);return Y}function KG($,Z){let Y=[];for(let[X,Q]of Object.entries($)){if(Q===void 0||Q===null)continue;if(typeof Q==="boolean"){if(Q)Y.push(X);continue}if(Array.isArray(Q)){let J=[...Q];if(Z&&(X==="script-src"||X==="style-src"))J=J.filter((G)=>!G.startsWith("'nonce-")),J.push(`'nonce-${Z}'`);if(J.length>0)Y.push(`${X} ${J.join(" ")}`)}}return Y.join("; ")}function _1($,Z){return`<meta http-equiv="Content-Security-Policy" content="${KG($,Z).replace(/&/g,"&").replace(/"/g,""")}">`}function W1($,Z,Y){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=Z.useNonce?q6(Y,Z):void 0,Q=_1(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
|
|
3650
|
-
${Q}`)}function
|
|
3651
|
-
${
|
|
3652
|
-
${
|
|
3653
|
-
`),X=[{obj:Z,indent:-1}];for(let Q of Y){let J=Q.replace(/#.*$/,"").trimEnd();if(!J.trim())continue;let G=J.search(/\S/);if(G===-1)continue;while(X.length>1&&X[X.length-1].indent>=G)X.pop();let K=X[X.length-1].obj,q=J.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,_,U]=q,W=_.trim(),B=U.trim();if(B==="")K[W]={},X.push({obj:K[W],indent:G});else K[W]=NG(B)}}return Z}function NG($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Z=$.toLowerCase();if(Z==="true"||Z==="yes")return!0;if(Z==="false"||Z==="no")return!1;if(Z==="null"||Z==="~")return null;let Y=Number($);if(!Number.isNaN(Y))return Y;return $}function AG($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"json":default:return".json"}}function TG($,Z){for(let Y of $){let X=Y.trim(),Q=X.match(/^\{(\d+)\}\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10);if(Z===G)return Q[2];continue}let J=X.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(J){let G=Number.parseInt(J[1],10),K=J[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(J[2],10);if(Z>=G&&Z<=K)return J[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function wG($,Z={}){return k1($,Z)}function k1($,Z){let Y="",X=0;while(X<$.length)if($[X]==="{"){let Q=MG($,X);if(Q===-1){Y+=$[X],X++;continue}let J=$.slice(X+1,Q);Y+=IG(J,Z),X=Q+1}else if($[X]==="'"&&X+1<$.length)if($[X+1]==="'")Y+="'",X+=2;else if($[X+1]==="{"||$[X+1]==="}")Y+=$[X+1],X+=2;else Y+=$[X],X++;else Y+=$[X],X++;return Y}function MG($,Z){let Y=0;for(let X=Z;X<$.length;X++)if($[X]==="{")Y++;else if($[X]==="}"){if(Y--,Y===0)return X}return-1}function IG($,Z){let Y=EG($);if(Y.length===0)return`{${$}}`;let X=Y[0].trim(),Q=Z[X];if(Y.length===1)return Q!==void 0?String(Q):`{${X}}`;switch(Y[1].trim().toLowerCase()){case"plural":return DG(Q,Y.slice(2).join(","),Z);case"select":return SG(Q,Y.slice(2).join(","));case"selectordinal":return bG(Q,Y.slice(2).join(","));case"number":return PG(Q,Y[2]?.trim());case"date":return CG(Q,Y[2]?.trim());case"time":return vG(Q,Y[2]?.trim());default:return Q!==void 0?String(Q):`{${$}}`}}function EG($){let Z=[],Y="",X=0;for(let Q=0;Q<$.length;Q++){let J=$[Q];if(J==="{")X++,Y+=J;else if(J==="}")X--,Y+=J;else if(J===","&&X===0)Z.push(Y),Y="";else Y+=J}if(Y)Z.push(Y);return Z}function DG($,Z,Y){let X=Number($)||0,Q=Q$(Z),J=`=${X}`;if(Q[J])return Y$(Q[J],X,Y);let G=kG(X);if(Q[G])return Y$(Q[G],X,Y);if(Q.other)return Y$(Q.other,X,Y);return String(X)}function Y$($,Z,Y){let X=$.replace(/#/g,String(Z));return k1(X,Y)}function kG($){let Z=Math.abs($),Y=Math.floor(Z),X=String($).includes(".")?String($).split(".")[1].length:0;if(Y===1&&X===0)return"one";return"other"}function SG($,Z){let Y=String($||""),X=Q$(Z);if(X[Y])return X[Y];return X.other||String($)}function bG($,Z){let Y=Number($)||0,X=Q$(Z),Q=yG(Y);if(X[Q])return X[Q].replace(/#/g,String(Y));if(X.other)return X.other.replace(/#/g,String(Y));return String(Y)}function yG($){let Z=Math.abs($),Y=Z%10,X=Z%100;if(Y===1&&X!==11)return"one";if(Y===2&&X!==12)return"two";if(Y===3&&X!==13)return"few";return"other"}function Q$($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,X=Y.exec($);while(X!==null)Z[X[1]]=X[2],X=Y.exec($);return Z}function PG($,Z){let Y=Number($);if(Number.isNaN(Y))return String($);switch(Z){case"integer":return Math.floor(Y).toLocaleString();case"percent":return`${(Y*100).toFixed(0)}%`;case"currency":return Y.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Y.toLocaleString()}}function CG($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.dateStyle="short";break;case"medium":X.dateStyle="medium";break;case"long":X.dateStyle="long";break;case"full":X.dateStyle="full";break;default:X.dateStyle="medium"}return Y.toLocaleDateString(void 0,X)}function vG($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.timeStyle="short";break;case"medium":X.timeStyle="medium";break;case"long":X.timeStyle="long";break;case"full":X.timeStyle="full";break;default:X.timeStyle="short"}return Y.toLocaleTimeString(void 0,X)}function xG($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function I1($,Z,Y=!0,X={}){let Q=$.split("."),J=Z;for(let K of Q){if(J===void 0||J===null)break;J=J[K]}if(J===void 0||J===null)return Y?$:"";let G=String(J);if(xG(G))return wG(G,X);if(G.includes("|")&&"count"in X){let K=Number(X.count),q=G.split("|");G=TG(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 S1($,Z,Y,X){let Q=$,J=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...J$,...X.i18n},K=await VG(G.locale,X);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,Q=await E1(Q,J,async(U,W,B,j,z)=>{try{let H={};if(B)try{let L=[()=>JSON.parse(B),()=>{let O=`{"data":${B}}`,V=JSON.parse(O);return typeof V.data==="object"?V.data:{}},()=>{return z4(B,Z)}];for(let O of L)try{if(H=O(),Object.keys(H).length>0)break}catch{}}catch(L){if(X.debug)console.error("Error parsing parameters for @translate directive:",L)}return I1(W,K,G.fallbackToKey,H)||j.trim()}catch(H){if(X.debug)console.error("Error processing @translate directive:",H);return s("Translate",`Error in @translate('${W}'): ${H instanceof Error?H.message:String(H)}`,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 E1(Q,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(U,W,B,j)=>{try{let z={};if(B)try{let H=[()=>JSON.parse(B),()=>{let F=`{"data":${B}}`,L=JSON.parse(F);return typeof L.data==="object"?L.data:{}},()=>{return z4(B,Z)}];for(let F of H)try{if(z=F(),Object.keys(z).length>0)break}catch{}}catch(H){if(X.debug)console.error("Error parsing parameters for @translate directive:",H)}return I1(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 E1($,Z,Y){let X=[];return $.replace(Z,(J,...G)=>{let K=Y(J,...G).then((q)=>({match:J,replacement:q}));return X.push(K),J}),(await Promise.all(X)).reduce((J,{match:G,replacement:K})=>J.replace(G,K),$)}var J$,X$,Z7,Z$;var b1=C(()=>{m4();V4();J$={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},X$={},Z7={},Z$={}});var f1={};o(f1,{processLoops:()=>G$});function hG($,Z){let Y=/@component\s*\(/g,X=$,Q,J=[];while((Q=Y.exec(X))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,_=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),H=z.match(/^\s*,\s*/);if(!H)continue;let F=z.slice(H[0].length).trim();if(!F)continue;try{let L=z4(F,Z),O=JSON.stringify(L),V=`@component('${j}', ${O})`;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 W6($,Z,Y){let X=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),J;while((J=Q.exec(X))!==null){let G=J.index,K=G+J[0].length-1,q=1,_=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=Y(B);X=X.substring(0,G)+j+X.substring(_+1)}return X}function dG($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,Q)=>{if(Q in Z)return`:${Q}="${Q}"`;return X}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,Q,J)=>{try{let G=Object.keys(Z),K=Object.values(Z);d5(J);let _=$4(J,G)(...K),W=JSON.stringify(_).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");return`__stx_${Q}="${W}"`}catch(G){return X}}),Y}function mG($,Z){let Y=$;return Y=W6(Y,"@break",(X)=>{try{let J=`!!(${X.trim()})`,G;if(t(J)){let K=$4(J,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(X4(J,Z));return G?B6:""}catch{return""}}),Y=W6(Y,"@continue",(X)=>{try{let J=`!!(${X.trim()})`,G;if(t(J)){let K=$4(J,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(X4(J,Z));return G?z6:""}catch{return""}}),Y}function uG($){let Z=$;return Z=Z.replace(/@break(?!\()/g,B6),Z=Z.replace(/@continue(?!\()/g,z6),Z}function y1($){let Z=$.includes(B6),Y=Z?$.substring(0,$.indexOf(B6)):$;return{hasBreak:Z,content:Y}}function P1($){let Z=$.includes(z6),Y=Z?$.substring(0,$.indexOf(z6)):$;return{hasContinue:Z,content:Y}}function v1($){let Z=$;return Z=W6(Z,"@break",(Y)=>{let X=Y.trim();if(!L7(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=W6(Z,"@continue",(Y)=>{let X=Y.trim();if(!L7(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function lG($){let Z=/@forelse\s*\(/g,Y,X=[],Q=/@foreach\s*\(/g,J=/@endforeach/g,G;while((G=Q.exec($))!==null)X.push({pos:G.index,delta:1});while((G=J.exec($))!==null)X.push({pos:G.index,delta:-1});X.sort((U,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((Y=Z.exec($))!==null){if(_(Y.index)>0)continue;let U=Y.index,W=Y.index+Y[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 H=$.substring(W+1,z),F=H.indexOf(" as ");if(F===-1)continue;let L=H.substring(0,F).trim(),O=H.substring(F+4).trim(),V=z+1,N=1,R=V,A=/@forelse\s*\(/g,T=/@endforelse/g,w=-1;while(N>0&&R<$.length){A.lastIndex=R,T.lastIndex=R;let b=A.exec($),S=T.exec($);if(!S)break;if(b&&b.index<S.index)N++,R=b.index+b[0].length;else{if(N--,N===0){w=S.index;break}R=S.index+11}}if(w===-1)continue;let E=$.substring(V,w),M=w+11,I=-1,D=0,y=0;while(y<E.length){let b=E.indexOf("@",y);if(b===-1)break;let S=E.substring(b);if(/^@forelse\s*\(/.test(S))D++,y=b+1;else if(S.startsWith("@endforelse"))D--,y=b+11;else if(D===0&&S.startsWith("@empty")){if(E.length<=b+6||!/[a-z]/i.test(E[b+6])){I=b;break}y=b+1}else y=b+1}if(I===-1)continue;return{start:U,end:M,arrayExpr:L,itemVar:O,foreachContent:E.substring(0,I),emptyContent:E.substring(I+6)}}return null}function C1($,Z){let Y=$;while(!0){let X=lG(Y);if(!X)break;let{start:Q,end:J,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:_}=X;try{let U;if(t(G))U=$4(G,Object.keys(Z))(...Object.values(Z));else U=X4(G,Z);let W;if(!Array.isArray(U)||U.length===0)W=_;else W=`@foreach (${G} as ${K})${q}@endforeach`;Y=Y.substring(0,Q)+W+Y.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);Y=Y.substring(0,Q)+B+Y.substring(J)}}return Y}function G$($,Z,Y,X){let Q=$;Q=C1(Q,Z);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,H=-1;while(z<q.length&&j>0){if(q[z]==="(")j++;else if(q[z]===")"){if(j--,j===0){H=z;break}}z++}if(H===-1)continue;let F=q.substring(B+1,H),L=F.indexOf(" as ");if(L===-1)continue;let O=W,V=F.substring(0,L),N=F.substring(L+4),R=H+1,A=1,T=R,w=/@foreach\s*\(/g,E=/@endforeach/g;while(A>0&&T<q.length){w.lastIndex=T,E.lastIndex=T;let M=w.exec(q),I=E.exec(q);if(!I)break;if(M&&M.index<I.index)A++,T=M.index+M[0].length;else{if(A--,A===0){let D=q.substring(R,I.index),y=I.index+11;return{start:O,end:y,arrayExpr:V,itemVar:N,content:D}}T=I.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:H,content:F}=W;try{let L=z.trim(),O;if(t(L))O=$4(L,Object.keys(_))(...Object.values(_));else O=X4(L,_);let V=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),V=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),V=!0;else{let M=s("Foreach",`Error in @foreach: ${L} is not iterable`,l.TYPE_ERROR);U=U.substring(0,B)+M+U.substring(j);continue}let N=X?.loops?.useAltLoopVariable??gG,R=H.trim(),A=null,T;if(R.includes("=>")){let M=R.split("=>").map((I)=>I.trim());if(M.length===2)A=M[0],T=M[1];else T=R}else T=R;let w="",E=O;for(let M=0;M<E.length;M++){let I=E[M],D={index:M,iteration:M+1,first:M===0,last:M===E.length-1,count:E.length},y={..._,loop:D,$loop:D};if(T.startsWith("[")&&T.endsWith("]")){let g=T.slice(1,-1).split(",").map((h)=>h.trim());if(Array.isArray(I))g.forEach((h,i)=>{if(h)y[h]=I[i]});else y[T]=I}else y[T]=I;if(A)if(V&&Array.isArray(I)&&I.length===2)y[A]=I[0],y[T]=I[1];else y[A]=M;let b=mG(F,y),S=P1(b);if(S.hasContinue){w+=S.content;continue}let k=y1(b);if(k.hasBreak){w+=k.content;break}if(b=C1(b,y),b=G(b,y),b=E5(b,y,Y),b=uG(b),k=y1(b),k.hasBreak){w+=k.content;break}if(S=P1(b),S.hasContinue){w+=S.content;continue}b=J5(b,y,Y),b=dG(b,y),b=hG(b,y),w+=b}U=U.substring(0,B)+w+U.substring(j)}catch(L){let O=s("Foreach",`Error in @foreach(${z.trim()} as ${H.trim()}): ${L instanceof Error?L.message:String(L)}`,l.EVALUATION_ERROR);U=U.substring(0,B)+O+U.substring(j)}}return U}Q=G(Q,Z),Q=pG(Q,Z);let K=X?.loops?.maxWhileIterations??fG;return Q=cG(Q,Z,K),Q}function x1($){return L7($)}function pG($,Z){let Y=$,X=!0;while(X){X=!1;let Q=Y.match(/@for\s*\(/);if(!Q||Q.index===void 0)break;let J=Q.index,G=J+Q[0].length-1,K=w4(Y,"(",")",G);if(K===-1)break;let q=Y.slice(G+1,K),_=K+1,U=G6(Y.slice(J),"for","endfor");if(U.length===0)break;let W=U[0].content,B=J+U[0].end;if(!x1(q)){let j=s("For",`Unsafe expression in @for: ${q}`,l.UNSAFE_EXPRESSION);Y=Y.substring(0,J)+j+Y.substring(B),X=!0;continue}try{let j=Object.keys(Z),z=Object.values(Z),H=W.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,V)=>{return`\${${V}}`});H=v1(H);let L=Function(...j,`
|
|
3648
|
+
</script>`}function Q8($,Z,Y){if(J8=0,!JG($))return $;let X=aQ($);if(X.length===0)return $;let Q=XG($,X),J=YG(X),G=Q.lastIndexOf("</body>");if(G!==-1)Q=Q.slice(0,G)+J+`
|
|
3649
|
+
`+Q.slice(G);else Q+=J;return Q}function XG($,Z){let Y=$;for(let X of Z){let J=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${J$(X.stateExpr)}["']`,"gi").exec(Y);if(J)X.id=J[1],X.selector=`[data-stx-scope="${X.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${J$(X.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(Y);if(K)X.id=K[1],X.selector=`[data-stx-scope="${X.id}"]`;else Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${J$(X.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`),Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${J$(X.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`)}}return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Y=Y.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Y}function JG($){return/x-data\s*=\s*["']/.test($)}var J8=0,rQ=0;import QG from"fs";import n4 from"path";import{createHighlighter as GG}from"ts-syntax-highlighter";async function KG($,Z={}){try{if(!await c($))throw Error(`Markdown file not found: ${$}`);let X=(await QG.promises.stat($)).mtime.getTime();if(Z.cache&&s4.has($)){let W=s4.get($);if(W.updatedAt>=X)return{content:W.content,data:W.data}}let Q=await Bun.file($).text(),{data:J,content:G}=f6(Q),K=Z.markdown||p4.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},_=h1(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)_=await qG(_,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let U={content:_,data:J||{}};if(Z.cache)s4.set($,{...U,updatedAt:X});return U}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let X=Y instanceof Error?Y.message:String(Y);return{content:J0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}async function qG($,Z,Y){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!Q$)try{Q$=await GG({theme:Z||"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(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),B=_||(Y?"text":"");if(!B)return K;try{if(!Q$.getSupportedLanguages().includes(B))return K;return(await Q$.highlight(W,B,{theme:Z})).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 G8($,Z,Y="",X={}){return await UG($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,_)=>{try{let U=K;if(!n4.isAbsolute(K))U=n4.resolve(n4.dirname(Y),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(),T=A.startsWith('"')&&A.endsWith('"'),w=A.startsWith("'")&&A.endsWith("'");if(T||w)A=A.substring(1,A.length-1);W[R]=A}}}}catch(L){if(X.debug)console.error("Error parsing context in @markdown-file directive:",L)}let{content:B,data:j}=await KG(U,X),z={...Z,...j,...W},O=B,F=/\{\{([^}]+)\}\}/g;return O=O.replace(F,(L,H)=>{let V=H.trim();return z[V]!==void 0?String(z[V]):L}),O}catch(U){let W=U instanceof Error?U.message:String(U);return J0("Markdown File",`Error including markdown file: ${W}`,Y,$,_,G)}})}async function UG($,Z,Y){let X=[],Q;while((Q=Z.exec($))!==null){let K=Q[0],q=Q.index,_=Q;X.push(Y(..._).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 s4,Q$=null;var K8=y(()=>{X$();L0();s4=new Map});function n0($,Z){try{let Y=$.trim();if(t(Y))return $0(Y,Object.keys(Z))(...Object.values(Z));else return X0(Y,Z)}catch{return!1}}var q8=y(()=>{V0()});function s0($,Z){let Y=_G($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function _G($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let X=w0($,"(",")",Y);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,X),endPos:X+1}}function z1($,Z,Y,X){let Q=1,J=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(J<$.length&&Q>0){G.lastIndex=J,K.lastIndex=J;let q=G.exec($),_=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 U8($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let X=Z+Y[0].length,Q=s0($,X);if(!Q)return null;let J=Q.endPos,G=z1($,"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 F=O.match(/^@elseif\s*/);if(F){q.push({type:U,condition:W,content:K.substring(B,_),start:J+B,end:J+_});let L=_+F[0].length,H=s0(K,L);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(Z,G+6),branches:q,start:Z,end:G+6}}function o4($){let Z=[],Y=/@if\s*\(/g,X=Y.exec($);while(X!==null){if(Z.some((G)=>X.index>G.start&&X.index<G.end)){X=Y.exec($);continue}let J=U8($,X.index);if(J)Z.push(J),Y.lastIndex=J.end;X=Y.exec($)}return Z}function G$($,Z,Y){let X=[],Q=new RegExp(`@${Z}\\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,_=w0($,"(",")",q);if(_===-1){J=Q.exec($);continue}let U=$.slice(q+1,_),W=_+1,B=z1($,Z,Y,W);if(B===-1){J=Q.exec($);continue}let j=$.slice(W,B),z=B+`@${Y}`.length;X.push({fullMatch:$.slice(K,z),name:Z,params:U,content:j,start:K,end:z}),Q.lastIndex=z,J=Q.exec($)}return X}function r4($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let X=Z+Y[0].length,Q=s0($,X);if(!Q)return null;let J=Q.endPos,G=z1($,"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*/),F=B.match(/^@default(?![a-z])/),L=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(F&&B.startsWith("@default")){if(U)q.push(U);U={type:"default",content:""},_+=F[0].length}else if(L&&B.startsWith("@break"))_+=L[0].length;else{if(U)U.content+=K[_];_++}}if(U)q.push(U);return{fullMatch:$.slice(Z,G+10),expression:Q.expression,cases:q,start:Z,end:G+10}}var _8=()=>{};var W8=()=>{};var a4=y(()=>{_8();W8()});function jG($,Z,Y){let X=$,Q=!0;while(Q){Q=!1;let J=X.match(/@switch\s*\(/);if(!J||J.index===void 0)break;let G=J.index,K=r4(X,G);if(!K)break;try{let q;if(t(K.expression))q=$0(K.expression,Object.keys(Z))(...Object.values(Z));else q=X0(K.expression,Z);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&&t(W.value))B=$0(W.value,Object.keys(Z))(...Object.values(Z));else if(W.value)B=X0(W.value,Z);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 E1($,Z,Y){let X=$;X=jG(X,Z,Y);{let J=!0;while(J){J=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=s0(X,K+7);if(!q)break;let _=q.endPos,U=z1(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,F=/@(?:if|unless)\s*\(/g,L=/@(?:endif|endunless)(?![a-z])/g,H=/@else(?![a-z])/g,V=[],N;while((N=F.exec(W))!==null)V.push({pos:N.index,type:"open"});while((N=L.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),F=W.slice(j+5);z=`@if (${B})${F}@else ${O}@endif`}else z=`@if (!(${B}))${W}@endif`;X=X.substring(0,K)+z+X.substring(U+10),J=!0}}X=e4(X,Z,Y),X=$7(X,Z,Y),X=t4(X,Z);let Q=()=>{let J=o4(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&&t(U.condition))W=$0(U.condition,Object.keys(Z))(...Object.values(Z));else if(U.condition)W=X0(U.condition,Z);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 B8($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let Y=$[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let X=[];while(Z<$.length){let Q=$[Z];if(Q==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(Q===Y){Z++;break}X.push(Q),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function t4($,Z){let Y=$;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),F=z.exec(K),L=O?O.index:1/0,H=F?F.index:1/0;if(L<H)W++,B=L+O[0].length;else if(H<1/0){if(W--,W===0)return H;B=H+F[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((F,L)=>F.pos-L.pos);for(let F of z)if(F.type==="open")U++;else if(F.type==="close")U--;else if(F.type==="else"&&U===0)return F.pos;return-1}{let K=!0;while(K){K=!1;let q=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let _=q.index,U,W,B=Y.slice(_+5),j=B8(B);if(j)U=j.value,W=_+5+j.consumed;else W=_+5;let z=X(Y,"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=Y.slice(W,z),F=Q(O,"auth","endauth"),L;if(!Z.auth)L=!1;else L=U?n0(`auth?.check && auth?.user?.[${U}]`,Z):n0("auth?.check",Z);let H;if(F!==-1){let V=O.slice(0,F),N=O.slice(F+5);H=L?V:N}else H=L?O:"";Y=Y.substring(0,_)+H+Y.substring(z+8),K=!0}}{let K=!0;while(K){K=!1;let q=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let _=q.index,U,W,B=Y.slice(_+6),j=B8(B);if(j)U=j.value,W=_+6+j.consumed;else W=_+6;let z=X(Y,"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=Y.slice(W,z),F=Q(O,"guest","endguest"),L;if(!Z.auth)L=!0;else L=U?n0(`!auth?.check || !auth?.user?.[${U}]`,Z):n0("!auth?.check",Z);let H;if(F!==-1){let V=O.slice(0,F),N=O.slice(F+5);H=L?V:N}else H=L?O:"";Y=Y.substring(0,_)+H+Y.substring(z+9),K=!0}}function J(K,q,_){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let U=[K];if(q)U.push(q);if(_){let W=n0(_,Z);U.push(W)}return Z.permissions.check(...U)}catch{return!1}return!1}function G(K){let q=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let K of["can","cannot"]){let q=`end${K}`,_=K==="can"?"elsecan":"elsecannot",U=!0;while(U){U=!1;let W=Y.match(new RegExp(`@${K}\\s*\\(`));if(!W||W.index===void 0)break;let B=W.index,j=Y.slice(B+`@${K}`.length),z=G(j);if(!z)break;let O=B+`@${K}`.length+z.paramsEnd,F=X(Y,K,q,O);if(F===-1){console.warn(`[stx] @${K} directive at position ${B} has no matching @${q} \u2014 the block was skipped.`);break}let L=Y.slice(O,F),H=[],V=0,N=new RegExp(`@${K}\\s*\\(`,"g"),R=new RegExp(`@${q}(?![a-z])`,"g"),A=new RegExp(`@${_}\\s*\\(`,"g"),T=/@else(?![a-z])/g,w=[],E;while((E=N.exec(L))!==null)w.push({pos:E.index,type:"open"});while((E=R.exec(L))!==null)w.push({pos:E.index,type:"close"});while((E=A.exec(L))!==null)w.push({pos:E.index,type:"elseDirective"});while((E=T.exec(L))!==null)w.push({pos:E.index,type:"else"});w.sort((S,k)=>S.pos-k.pos);for(let S of w){if(S.type==="open"){V++;continue}if(S.type==="close"){V--;continue}if(V===0)H.push(S)}let M=[],I=0;for(let S=0;S<H.length;S++){let k=H[S];if(M.push({content:L.slice(I,k.pos),ability:void 0}),k.type==="elseDirective"){let g=L.slice(k.pos+`@${_}`.length),h=G(g);if(h){M[M.length-1]={content:L.slice(I,k.pos)},I=k.pos+`@${_}`.length+h.paramsEnd,M.push({content:"",ability:h.ability,type:h.type,id:h.id}),M.pop();let i=H[S+1],W0=i?i.pos:L.length;M.push({content:L.slice(I,W0),ability:h.ability,type:h.type,id:h.id}),I=W0}}else I=k.pos+5}if(I<L.length){let S=M[M.length-1];if(H.length>0&&H[H.length-1].type==="else")M.push({content:L.slice(I),isFinalElse:!0});else if(M.length===0)M.push({content:L.slice(I)})}let D=J(z.ability,z.type,z.id),P=K==="can"?D:!D,b="";if(P)b=M[0]?.content||"";else{let S=!1;for(let k=1;k<M.length;k++){let g=M[k];if(g.isFinalElse){b=g.content,S=!0;break}if(g.ability){let h=J(g.ability,g.type,g.id);if(K==="can"?h:!h){b=g.content,S=!0;break}}}if(!S&&M.length>0){let k=M[M.length-1];if(k.isFinalElse)b=k.content}}Y=Y.substring(0,B)+b+Y.substring(F+`@${q}`.length),U=!0}}return Y}function e4($,Z,Y){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,F=z1(J,G,K,O);if(F===-1){console.warn(`[stx] @${G} directive at position ${j} has no matching @${K} \u2014 the block was skipped.`);break}let L=J.slice(O,F),H=z.expression,V=-1,N=0,R=0;while(R<L.length){let A=L.indexOf("@",R);if(A===-1)break;let T=L.substring(A);if(/^@(?:if|unless|isset|empty)\s*\(/.test(T)){N++,R=A+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(T)){N--,R=A+1;continue}if(N===0&&/^@else(?![a-z])/.test(T)){V=A;break}R=A+1}try{let A=q(H.trim()),T;if(V!==-1){let w=L.slice(0,V),E=L.slice(V+5);T=A?w:E}else T=A?L:"";J=J.substring(0,j)+T+J.substring(F+`@${K}`.length),U=!0}catch(A){let T=A instanceof Error?A.message:String(A),w=s(_,`Error processing @${G} directive: ${T}`,l.EVALUATION_ERROR);J=J.substring(0,j)+w+J.substring(F+`@${K}`.length);break}}return J}return X=Q(X,"isset","endisset",(J)=>{let G=n0(J,Z);return G!==void 0&&G!==null},"Isset"),X=Q(X,"empty","endempty",(J)=>{let G=n0(J,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),X}function $7($,Z,Y){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 F=U.exec(z);if(!F)break;let L=F.index,H=L+F[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),b=D?D.index:1/0,S=P?P.index:1/0;if(b<S)V++,N=b+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 ${L} has no matching @${q} \u2014 the block was skipped.`);break}let A=z.substring(H,R),T=-1,w=0,E=0;while(E<A.length){let D=A.indexOf("@",E);if(D===-1)break;let P=A.substring(D);if(B.test(P)){w++,E=D+1;continue}if(j.test(P)){w--,E=D+1;continue}if(w===0&&/^@else(?![a-z])/.test(P)){T=D;break}E=D+1}let M;if(T!==-1){let D=A.slice(0,T),P=A.slice(T+5);M=_?D:P}else M=_?A:"";let I=`@${q}`.length;z=z.substring(0,L)+M+z.substring(R+I),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 K$=y(()=>{q8();m0();a4();V0()});function j8($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function q$($,Z){if(!$)return Z?.nonceGenerator?.()??j8();let Y=z8.get($);if(!Y)Y=Z?.nonceGenerator?.()??j8(),z8.set($,Y);return Y}function OG($,Z){let Y=[];for(let[X,Q]of Object.entries($)){if(Q===void 0||Q===null)continue;if(typeof Q==="boolean"){if(Q)Y.push(X);continue}if(Array.isArray(Q)){let J=[...Q];if(Z&&(X==="script-src"||X==="style-src"))J=J.filter((G)=>!G.startsWith("'nonce-")),J.push(`'nonce-${Z}'`);if(J.length>0)Y.push(`${X} ${J.join(" ")}`)}}return Y.join("; ")}function O8($,Z){return`<meta http-equiv="Content-Security-Policy" content="${OG($,Z).replace(/&/g,"&").replace(/"/g,""")}">`}function H8($,Z,Y){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=Z.useNonce?q$(Y,Z):void 0,Q=O8(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
|
|
3650
|
+
${Q}`)}function L8($,Z,Y,X){let Q=$,J=X.csp;if(Q=Q.replace(/@csp\b/g,()=>{if(!J?.enabled||!J.directives)return"<!-- CSP not configured -->";let G=J.useNonce?q$(Z,J):void 0;return O8(J.directives,G)}),Q=Q.replace(/@cspNonce\b/g,()=>{if(!J?.enabled||!J.useNonce)return"";return q$(Z,J)}),J?.enabled&&J.useNonce)Z.cspNonce=q$(Z,J);return Q}var z8;var F8=y(()=>{z8=new WeakMap});import HG from"crypto";function FG($=LG){let Z=HG.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return Z7=Z,Z}function VG(){if(!Z7)FG();return Z7}function RG($=V8){let Z=VG();return`<input type="hidden" name="${$}" value="${Z}">`}function R8($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,X)=>{return RG(X||V8)})}var LG=40,V8="_token",Z7=null;var N8=()=>{};async function A8($,Z,Y,X){if(!X.customDirectives||X.customDirectives.length===0)return $;let Q=$;for(let J of X.customDirectives){if(!J.name||typeof J.handler!=="function"){if(X.debug)console.warn("Invalid custom directive:",J);continue}if(J.hasEndTag)Q=await NG(Q,J,Z,Y,X);else Q=await AG(Q,J,Z,Y,X)}return Q}async function NG($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=`@${J}`,q=`@end${J}`,_=$,U=N1(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),W=[],B=U.exec(_);while(B!==null){let[j,z="",O=""]=B,F=B.index||0;try{let L=z?T8(z):[],H=O.trim(),V=await G(H,L,Y,X);W.push({original:j,processed:V,startIndex:F})}catch(L){let H=L instanceof Error?L.message:String(L);if(Q.debug)console.error(`Error processing custom directive @${J}:`,L);W.push({original:j,processed:s("CustomDirective",`Error in @${J}${z?`(${z})`:""}: ${H}`,l.EVALUATION_ERROR),startIndex:F})}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 AG($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=$,q=N1(`@${J}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),_=[],U=q.exec(K);while(U!==null){let[j,z=""]=U,O=U.index||0;try{let F=T8(z),L=await G("",F,Y,X);_.push({original:j,processed:L,startIndex:O})}catch(F){let L=F instanceof Error?F.message:String(F);if(Q.debug)console.error(`Error processing custom directive @${J}:`,F);_.push({original:j,processed:s("CustomDirective",`Error in @${J}(${z}): ${L}`,l.EVALUATION_ERROR),startIndex:O})}U=q.exec(K)}let W=N1(`@${J}(?!\\w)(?!\\s*\\()`,"g"),B=W.exec(K);while(B!==null){let[j]=B,z=B.index||0;try{let O=await G("",[],Y,X);_.push({original:j,processed:O,startIndex:z})}catch(O){let F=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}: ${F}`,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 T8($){if(!$.trim())return[];let Z=[],Y="",X=!1,Q="";for(let J=0;J<$.length;J++){let G=$[J];if((G==='"'||G==="'")&&(J===0||$[J-1]!=="\\"))if(!X)X=!0,Q=G;else if(G===Q)X=!1;else Y+=G;else if(G===","&&!X)Z.push(Y.trim()),Y="";else Y+=G}if(Y.trim())Z.push(Y.trim());return Z.map((J)=>{let G=J.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var w8=y(()=>{m0();A1()});import TG from"crypto";function j0($){return String($??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function U$($,Z,Y,X){let Q=$||Z;return Y?`${Q} ${X}`:Q}function wG(){return TG.randomUUID()}function _$($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=wG();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${j0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,Q)=>{let J=Q.toUpperCase();if(Q&&!["GET","POST"].includes(J))return`<input type="hidden" name="_method" value="${j0(J)}">`;return X}),Y}function E8($,Z,Y=I8){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=o0(_),j=U.toUpperCase(),z=["GET","POST"].includes(j)?j:"POST",O=`<form method="${j0(z)}" action="${j0(W)}"${B?` ${B}`:""}>`;if(O+=`
|
|
3651
|
+
${_$("@csrf",Z)}`,!["GET","POST"].includes(j))O+=`
|
|
3652
|
+
${_$(`@method('${j}')`,Z)}`;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=o0(_),j=e1(U,Z),z=j!==void 0&&j!==null?j:W||"",O=B.match(/type=['"]([^'"]+)['"]/i),F=O?O[1]:"text",L=$5(U,Z),H=B.match(/class=['"]([^'"]+)['"]/i),V=U$(H?H[1]:"",Y.input,L,Y.inputError),N=B.replace(/class=['"][^'"]+['"]/i,"");return N=N.replace(/type=['"][^'"]+['"]/i,""),`<input type="${j0(F)}" 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=o0(G),_=e1(J,Z)||K.trim(),U=$5(J,Z),W=q.match(/class=['"]([^'"]+)['"]/i),B=U$(W?W[1]:"",Y.input,U,Y.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=o0(G),_=e1(J,Z),U=$5(J,Z),W=q.match(/class=['"]([^'"]+)['"]/i),B=U$(W?W[1]:"",Y.input,U,Y.inputError),j=q.replace(/class=['"][^'"]+['"]/i,""),z=K;if(_!==void 0)z=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(O,F,L)=>{if((Array.isArray(_)?_.some((V)=>String(V)===L):String(_)===L)&&!F.includes("selected"))return F.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=o0(K),_=e1(J,Z),U=_!==void 0&&(Array.isArray(_)?_.some((z)=>String(z)===G):_===!0||String(_)===G),W=q.match(/class=['"]([^'"]+)['"]/i),B=W?W[1]:Y.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=o0(K),_=e1(J,Z),U=_!==void 0&&_===G,W=q.match(/class=['"]([^'"]+)['"]/i),B=W?W[1]:Y.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=o0(G),q=K.match(/accept=['"]([^'"]+)['"]/i),_=q?q[1]:"",U=K.includes("multiple"),W=$5(J,Z),B=K.match(/class=['"]([^'"]+)['"]/i),j=U$(B?B[1]:"",Y.input,W,Y.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=o0(G),_=q.match(/class=['"]([^'"]+)['"]/i),U=_?_[1]:Y.label,W=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${j0(J)}" class="${U}"${W?` ${W}`:""}>${K}</label>`}),X}function D8($,Z,Y=I8){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,Q,J)=>{try{if($5(Q,Z))return J.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return M8(Q,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Q);return M8(Q,Z)}let q=K.trim();if(t(q)){let _=X0(q,Z);return _!==void 0?String(_):q}return q}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function $5($,Z){if(!Z.errors)return!1;if(typeof Z.errors.has==="function")return Z.errors.has($);if(typeof Z.errors==="object")return Object.prototype.hasOwnProperty.call(Z.errors,$);return!1}function M8($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let Y=Z.errors[$];return Array.isArray(Y)?Y[0]:String(Y)}return""}function e1($,Z){let Y;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let X=$.slice(0,-2);if(Y=Z[X],Y!==void 0)return Y}return Z[$]}function o0($){if(!$.trim())return"";let Z=[],Y=$.trim(),X=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Q;while((Q=X.exec(Y))!==null){let[,J,,G]=Q;Z.push(`${J}="${G.trim()}"`)}return Z.join(" ")}var I8;var k8=y(()=>{V0();I8={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import S8 from"path";function MG($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function IG($,Z){if({...Q7,...Z.i18n}.cache&&J7[$]){let Q=J7[$],J=Z.i18n?.cacheMaxAge??0;if(!MG(Q,J))return Q.translations}if(Z5[$]?.state==="loading")return Z5[$].promise;Y7[$]="loading";let X=P8($,Z).then((Q)=>{return Y7[$]="loaded",delete Z5[$],Q}).catch((Q)=>{throw Y7[$]="error",Z5[$]={promise:X,state:"error",error:Q instanceof Error?Q:Error(String(Q))},Q});return Z5[$]={promise:X,state:"loading"},X}async function P8($,Z){let Y={...Q7,...Z.i18n},X=S8.resolve(import.meta.dir,"..",Y.translationsDir),Q=SG(Y.format),J=S8.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(Y.format==="yaml"||Y.format==="yml")G=DG(q);else if(Y.format==="json")G=JSON.parse(q);else throw K}if(Y.cache)J7[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(G){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,G);if($!==Y.defaultLocale)return P8(Y.defaultLocale,Z);return{}}}async function EG($,Z){return IG($,Z)}function DG($){let Z={},Y=$.split(`
|
|
3653
|
+
`),X=[{obj:Z,indent:-1}];for(let Q of Y){let J=Q.replace(/#.*$/,"").trimEnd();if(!J.trim())continue;let G=J.search(/\S/);if(G===-1)continue;while(X.length>1&&X[X.length-1].indent>=G)X.pop();let K=X[X.length-1].obj,q=J.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,_,U]=q,W=_.trim(),B=U.trim();if(B==="")K[W]={},X.push({obj:K[W],indent:G});else K[W]=kG(B)}}return Z}function kG($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Z=$.toLowerCase();if(Z==="true"||Z==="yes")return!0;if(Z==="false"||Z==="no")return!1;if(Z==="null"||Z==="~")return null;let Y=Number($);if(!Number.isNaN(Y))return Y;return $}function SG($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"json":default:return".json"}}function bG($,Z){for(let Y of $){let X=Y.trim(),Q=X.match(/^\{(\d+)\}\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10);if(Z===G)return Q[2];continue}let J=X.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(J){let G=Number.parseInt(J[1],10),K=J[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(J[2],10);if(Z>=G&&Z<=K)return J[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function yG($,Z={}){return C8($,Z)}function C8($,Z){let Y="",X=0;while(X<$.length)if($[X]==="{"){let Q=PG($,X);if(Q===-1){Y+=$[X],X++;continue}let J=$.slice(X+1,Q);Y+=CG(J,Z),X=Q+1}else if($[X]==="'"&&X+1<$.length)if($[X+1]==="'")Y+="'",X+=2;else if($[X+1]==="{"||$[X+1]==="}")Y+=$[X+1],X+=2;else Y+=$[X],X++;else Y+=$[X],X++;return Y}function PG($,Z){let Y=0;for(let X=Z;X<$.length;X++)if($[X]==="{")Y++;else if($[X]==="}"){if(Y--,Y===0)return X}return-1}function CG($,Z){let Y=vG($);if(Y.length===0)return`{${$}}`;let X=Y[0].trim(),Q=Z[X];if(Y.length===1)return Q!==void 0?String(Q):`{${X}}`;switch(Y[1].trim().toLowerCase()){case"plural":return xG(Q,Y.slice(2).join(","),Z);case"select":return gG(Q,Y.slice(2).join(","));case"selectordinal":return hG(Q,Y.slice(2).join(","));case"number":return mG(Q,Y[2]?.trim());case"date":return uG(Q,Y[2]?.trim());case"time":return lG(Q,Y[2]?.trim());default:return Q!==void 0?String(Q):`{${$}}`}}function vG($){let Z=[],Y="",X=0;for(let Q=0;Q<$.length;Q++){let J=$[Q];if(J==="{")X++,Y+=J;else if(J==="}")X--,Y+=J;else if(J===","&&X===0)Z.push(Y),Y="";else Y+=J}if(Y)Z.push(Y);return Z}function xG($,Z,Y){let X=Number($)||0,Q=G7(Z),J=`=${X}`;if(Q[J])return X7(Q[J],X,Y);let G=fG(X);if(Q[G])return X7(Q[G],X,Y);if(Q.other)return X7(Q.other,X,Y);return String(X)}function X7($,Z,Y){let X=$.replace(/#/g,String(Z));return C8(X,Y)}function fG($){let Z=Math.abs($),Y=Math.floor(Z),X=String($).includes(".")?String($).split(".")[1].length:0;if(Y===1&&X===0)return"one";return"other"}function gG($,Z){let Y=String($||""),X=G7(Z);if(X[Y])return X[Y];return X.other||String($)}function hG($,Z){let Y=Number($)||0,X=G7(Z),Q=dG(Y);if(X[Q])return X[Q].replace(/#/g,String(Y));if(X.other)return X.other.replace(/#/g,String(Y));return String(Y)}function dG($){let Z=Math.abs($),Y=Z%10,X=Z%100;if(Y===1&&X!==11)return"one";if(Y===2&&X!==12)return"two";if(Y===3&&X!==13)return"few";return"other"}function G7($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,X=Y.exec($);while(X!==null)Z[X[1]]=X[2],X=Y.exec($);return Z}function mG($,Z){let Y=Number($);if(Number.isNaN(Y))return String($);switch(Z){case"integer":return Math.floor(Y).toLocaleString();case"percent":return`${(Y*100).toFixed(0)}%`;case"currency":return Y.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Y.toLocaleString()}}function uG($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.dateStyle="short";break;case"medium":X.dateStyle="medium";break;case"long":X.dateStyle="long";break;case"full":X.dateStyle="full";break;default:X.dateStyle="medium"}return Y.toLocaleDateString(void 0,X)}function lG($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.timeStyle="short";break;case"medium":X.timeStyle="medium";break;case"long":X.timeStyle="long";break;case"full":X.timeStyle="full";break;default:X.timeStyle="short"}return Y.toLocaleTimeString(void 0,X)}function pG($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function b8($,Z,Y=!0,X={}){let Q=$.split("."),J=Z;for(let K of Q){if(J===void 0||J===null)break;J=J[K]}if(J===void 0||J===null)return Y?$:"";let G=String(J);if(pG(G))return yG(G,X);if(G.includes("|")&&"count"in X){let K=Number(X.count),q=G.split("|");G=bG(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 v8($,Z,Y,X){let Q=$,J=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...Q7,...X.i18n},K=await EG(G.locale,X);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,Q=await y8(Q,J,async(U,W,B,j,z)=>{try{let O={};if(B)try{let L=[()=>JSON.parse(B),()=>{let H=`{"data":${B}}`,V=JSON.parse(H);return typeof V.data==="object"?V.data:{}},()=>{return z0(B,Z)}];for(let H of L)try{if(O=H(),Object.keys(O).length>0)break}catch{}}catch(L){if(X.debug)console.error("Error parsing parameters for @translate directive:",L)}return b8(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 y8(Q,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(U,W,B,j)=>{try{let z={};if(B)try{let O=[()=>JSON.parse(B),()=>{let F=`{"data":${B}}`,L=JSON.parse(F);return typeof L.data==="object"?L.data:{}},()=>{return z0(B,Z)}];for(let F of O)try{if(z=F(),Object.keys(z).length>0)break}catch{}}catch(O){if(X.debug)console.error("Error parsing parameters for @translate directive:",O)}return b8(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 y8($,Z,Y){let X=[];return $.replace(Z,(J,...G)=>{let K=Y(J,...G).then((q)=>({match:J,replacement:q}));return X.push(K),J}),(await Promise.all(X)).reduce((J,{match:G,replacement:K})=>J.replace(G,K),$)}var Q7,J7,Z5,Y7;var x8=y(()=>{m0();V0();Q7={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},J7={},Z5={},Y7={}});var u8={};o(u8,{processLoops:()=>K7});function nG($,Z){let Y=/@component\s*\(/g,X=$,Q,J=[];while((Q=Y.exec(X))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,_=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 F=z.slice(O[0].length).trim();if(!F)continue;try{let L=z0(F,Z),H=JSON.stringify(L),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 W$($,Z,Y){let X=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),J;while((J=Q.exec(X))!==null){let G=J.index,K=G+J[0].length-1,q=1,_=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=Y(B);X=X.substring(0,G)+j+X.substring(_+1)}return X}function sG($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,Q)=>{if(Q in Z)return`:${Q}="${Q}"`;return X}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,Q,J)=>{try{let G=Object.keys(Z),K=Object.values(Z);d1(J);let _=$0(J,G)(...K),W=JSON.stringify(_).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");return`__stx_${Q}="${W}"`}catch(G){return X}}),Y}function oG($,Z){let Y=$;return Y=W$(Y,"@break",(X)=>{try{let J=`!!(${X.trim()})`,G;if(t(J)){let K=$0(J,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(X0(J,Z));return G?B$:""}catch{return""}}),Y=W$(Y,"@continue",(X)=>{try{let J=`!!(${X.trim()})`,G;if(t(J)){let K=$0(J,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(X0(J,Z));return G?z$:""}catch{return""}}),Y}function rG($){let Z=$;return Z=Z.replace(/@break(?!\()/g,B$),Z=Z.replace(/@continue(?!\()/g,z$),Z}function f8($){let Z=$.includes(B$),Y=Z?$.substring(0,$.indexOf(B$)):$;return{hasBreak:Z,content:Y}}function g8($){let Z=$.includes(z$),Y=Z?$.substring(0,$.indexOf(z$)):$;return{hasContinue:Z,content:Y}}function d8($){let Z=$;return Z=W$(Z,"@break",(Y)=>{let X=Y.trim();if(!L5(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=W$(Z,"@continue",(Y)=>{let X=Y.trim();if(!L5(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function aG($){let Z=/@forelse\s*\(/g,Y,X=[],Q=/@foreach\s*\(/g,J=/@endforeach/g,G;while((G=Q.exec($))!==null)X.push({pos:G.index,delta:1});while((G=J.exec($))!==null)X.push({pos:G.index,delta:-1});X.sort((U,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((Y=Z.exec($))!==null){if(_(Y.index)>0)continue;let U=Y.index,W=Y.index+Y[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),F=O.indexOf(" as ");if(F===-1)continue;let L=O.substring(0,F).trim(),H=O.substring(F+4).trim(),V=z+1,N=1,R=V,A=/@forelse\s*\(/g,T=/@endforelse/g,w=-1;while(N>0&&R<$.length){A.lastIndex=R,T.lastIndex=R;let b=A.exec($),S=T.exec($);if(!S)break;if(b&&b.index<S.index)N++,R=b.index+b[0].length;else{if(N--,N===0){w=S.index;break}R=S.index+11}}if(w===-1)continue;let E=$.substring(V,w),M=w+11,I=-1,D=0,P=0;while(P<E.length){let b=E.indexOf("@",P);if(b===-1)break;let S=E.substring(b);if(/^@forelse\s*\(/.test(S))D++,P=b+1;else if(S.startsWith("@endforelse"))D--,P=b+11;else if(D===0&&S.startsWith("@empty")){if(E.length<=b+6||!/[a-z]/i.test(E[b+6])){I=b;break}P=b+1}else P=b+1}if(I===-1)continue;return{start:U,end:M,arrayExpr:L,itemVar:H,foreachContent:E.substring(0,I),emptyContent:E.substring(I+6)}}return null}function h8($,Z){let Y=$;while(!0){let X=aG(Y);if(!X)break;let{start:Q,end:J,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:_}=X;try{let U;if(t(G))U=$0(G,Object.keys(Z))(...Object.values(Z));else U=X0(G,Z);let W;if(!Array.isArray(U)||U.length===0)W=_;else W=`@foreach (${G} as ${K})${q}@endforeach`;Y=Y.substring(0,Q)+W+Y.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);Y=Y.substring(0,Q)+B+Y.substring(J)}}return Y}function K7($,Z,Y,X){let Q=$;Q=h8(Q,Z);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 F=q.substring(B+1,O),L=F.indexOf(" as ");if(L===-1)continue;let H=W,V=F.substring(0,L),N=F.substring(L+4),R=O+1,A=1,T=R,w=/@foreach\s*\(/g,E=/@endforeach/g;while(A>0&&T<q.length){w.lastIndex=T,E.lastIndex=T;let M=w.exec(q),I=E.exec(q);if(!I)break;if(M&&M.index<I.index)A++,T=M.index+M[0].length;else{if(A--,A===0){let D=q.substring(R,I.index),P=I.index+11;return{start:H,end:P,arrayExpr:V,itemVar:N,content:D}}T=I.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:F}=W;try{let L=z.trim(),H;if(t(L))H=$0(L,Object.keys(_))(...Object.values(_));else H=X0(L,_);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: ${L} is not iterable`,l.TYPE_ERROR);U=U.substring(0,B)+M+U.substring(j);continue}let N=X?.loops?.useAltLoopVariable??iG,R=O.trim(),A=null,T;if(R.includes("=>")){let M=R.split("=>").map((I)=>I.trim());if(M.length===2)A=M[0],T=M[1];else T=R}else T=R;let w="",E=H;for(let M=0;M<E.length;M++){let I=E[M],D={index:M,iteration:M+1,first:M===0,last:M===E.length-1,count:E.length},P={..._,loop:D,$loop:D};if(T.startsWith("[")&&T.endsWith("]")){let g=T.slice(1,-1).split(",").map((h)=>h.trim());if(Array.isArray(I))g.forEach((h,i)=>{if(h)P[h]=I[i]});else P[T]=I}else P[T]=I;if(A)if(V&&Array.isArray(I)&&I.length===2)P[A]=I[0],P[T]=I[1];else P[A]=M;let b=oG(F,P),S=g8(b);if(S.hasContinue){w+=S.content;continue}let k=f8(b);if(k.hasBreak){w+=k.content;break}if(b=h8(b,P),b=G(b,P),b=E1(b,P,Y),b=rG(b),k=f8(b),k.hasBreak){w+=k.content;break}if(S=g8(b),S.hasContinue){w+=S.content;continue}b=Q1(b,P,Y),b=sG(b,P),b=nG(b,P),w+=b}U=U.substring(0,B)+w+U.substring(j)}catch(L){let H=s("Foreach",`Error in @foreach(${z.trim()} as ${O.trim()}): ${L instanceof Error?L.message:String(L)}`,l.EVALUATION_ERROR);U=U.substring(0,B)+H+U.substring(j)}}return U}Q=G(Q,Z),Q=tG(Q,Z);let K=X?.loops?.maxWhileIterations??cG;return Q=eG(Q,Z,K),Q}function m8($){return L5($)}function tG($,Z){let Y=$,X=!0;while(X){X=!1;let Q=Y.match(/@for\s*\(/);if(!Q||Q.index===void 0)break;let J=Q.index,G=J+Q[0].length-1,K=w0(Y,"(",")",G);if(K===-1)break;let q=Y.slice(G+1,K),_=K+1,U=G$(Y.slice(J),"for","endfor");if(U.length===0)break;let W=U[0].content,B=J+U[0].end;if(!m8(q)){let j=s("For",`Unsafe expression in @for: ${q}`,l.UNSAFE_EXPRESSION);Y=Y.substring(0,J)+j+Y.substring(B),X=!0;continue}try{let j=Object.keys(Z),z=Object.values(Z),O=W.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(H,V)=>{return`\${${V}}`});O=d8(O);let L=Function(...j,`
|
|
3654
3654
|
let result = '';
|
|
3655
3655
|
for (${q}) {
|
|
3656
|
-
result += \`${
|
|
3656
|
+
result += \`${O}\`;
|
|
3657
3657
|
}
|
|
3658
3658
|
return result;
|
|
3659
|
-
`)(...z);Y=Y.substring(0,J)+L+Y.substring(B),X=!0}catch(j){let z=s("For",`Error in @for(${q}): ${j instanceof Error?j.message:String(j)}`,l.EVALUATION_ERROR);Y=Y.substring(0,J)+z+Y.substring(B),X=!0}}return Y}function
|
|
3659
|
+
`)(...z);Y=Y.substring(0,J)+L+Y.substring(B),X=!0}catch(j){let z=s("For",`Error in @for(${q}): ${j instanceof Error?j.message:String(j)}`,l.EVALUATION_ERROR);Y=Y.substring(0,J)+z+Y.substring(B),X=!0}}return Y}function eG($,Z,Y){let X=$,Q=!0;while(Q){Q=!1;let J=X.match(/@while\s*\(/);if(!J||J.index===void 0)break;let G=J.index,K=G+J[0].length-1,q=w0(X,"(",")",K);if(q===-1)break;let _=X.slice(K+1,q),U=G$(X.slice(G),"while","endwhile");if(U.length===0)break;let W=U[0].content,B=G+U[0].end;if(!m8(_)){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(Z),z=Object.values(Z),O=W.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(H,V)=>{return`\${${V}}`});O=d8(O);let L=Function(...j,`
|
|
3660
3660
|
let result = '';
|
|
3661
3661
|
let maxIterations = ${Y}; // Configurable safety limit
|
|
3662
3662
|
let counter = 0;
|
|
3663
3663
|
while (${_} && counter < maxIterations) {
|
|
3664
3664
|
counter++;
|
|
3665
|
-
result += \`${
|
|
3665
|
+
result += \`${O}\`;
|
|
3666
3666
|
}
|
|
3667
3667
|
if (counter > maxIterations) {
|
|
3668
3668
|
result += '<!-- [While Error [1104]]: Maximum iterations (${Y}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
|
|
3669
3669
|
}
|
|
3670
3670
|
return result;
|
|
3671
|
-
`)(...z);X=X.substring(0,G)+L+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
|
|
3672
|
-
`)J++;return!0}if(Z[J]==="/"&&Z[J+1]==="*"){J+=2;while(J<G-1&&!(Z[J]==="*"&&Z[J+1]==="/"))J++;return J+=2,!0}return!1},U=()=>{if(Q!==0)return;let W=Z.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))Y.push(z),X.add(z);return}let B=Z.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let z=B[1];if(!X.has(z))Y.push(z),X.add(z);return}let j=Z.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))Y.push(z),X.add(z)}};while(J<G){if(_())continue;if(Z[J]==="'"||Z[J]==='"'){K(Z[J]);continue}if(Z[J]==="`"){q();continue}if(Z[J]==="{"){Q++,J++;continue}if(Z[J]==="}"){Q--,J++;continue}if(Q===0&&/[a-z]/i.test(Z[J])&&(J===0||/\s|[;{}()]/.test(Z[J-1])))U();J++}return Y.join(", ")}function
|
|
3671
|
+
`)(...z);X=X.substring(0,G)+L+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 cG=1000,iG=!1,B$="<!--__STX_BREAK__-->",z$="<!--__STX_CONTINUE__-->";var q7=y(()=>{K$();m0();c0();a4();V0()});import G0 from"path";function U7($,Z){let Y=0;for(let X=Z;X<$.length;X++){let Q=$[X];if(Q==="("||Q==="["||Q==="{")Y++;else if(Q===")"||Q==="]"||Q==="}")Y--;else if(Q===","&&Y===0)return X}return-1}function $K($,Z,Y){let X=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),J=Q.exec(X);while(J){let G=J.index,K=G+J[0].length-1,q=1,_=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=`${Y}(${U})`;X=X.substring(0,G)+W+X.substring(_),Q.lastIndex=G+W.length,J=Q.exec(X)}return X}function ZK($){return/\b(state|derived|effect)\s*\(/.test($)}function YK($){let Z=$,Y=[],X=new Set,Q=0,J=0,G=Z.length,K=(W)=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]===W){J++;return}J++}},q=()=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]==="`"){J++;return}if(Z[J]==="$"&&Z[J+1]==="{"){J+=2;let W=1;while(J<G&&W>0)if(Z[J]==="{")W++;else if(Z[J]==="}")W--;else if(Z[J]==="'"||Z[J]==='"')K(Z[J]);else if(Z[J]==="`")q();else J++;continue}J++}},_=()=>{if(Z[J]==="/"&&Z[J+1]==="/"){while(J<G&&Z[J]!==`
|
|
3672
|
+
`)J++;return!0}if(Z[J]==="/"&&Z[J+1]==="*"){J+=2;while(J<G-1&&!(Z[J]==="*"&&Z[J+1]==="/"))J++;return J+=2,!0}return!1},U=()=>{if(Q!==0)return;let W=Z.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))Y.push(z),X.add(z);return}let B=Z.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let z=B[1];if(!X.has(z))Y.push(z),X.add(z);return}let j=Z.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))Y.push(z),X.add(z)}};while(J<G){if(_())continue;if(Z[J]==="'"||Z[J]==='"'){K(Z[J]);continue}if(Z[J]==="`"){q();continue}if(Z[J]==="{"){Q++,J++;continue}if(Z[J]==="}"){Q--,J++;continue}if(Q===0&&/[a-z]/i.test(Z[J])&&(J===0||/\s|[;{}()]/.test(Z[J-1])))U();J++}return Y.join(", ")}function XK($,Z){let Y=YK($);return`
|
|
3673
3673
|
(function() {
|
|
3674
3674
|
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;
|
|
3675
3675
|
var __destroyHooks = [];
|
|
@@ -3682,38 +3682,38 @@ ${$}
|
|
|
3682
3682
|
if (!window.stx._scopes) window.stx._scopes = {};
|
|
3683
3683
|
window.stx._scopes['${Z}'] = { ${Y}, __destroyCallbacks: __destroyHooks };
|
|
3684
3684
|
})();
|
|
3685
|
-
`}function
|
|
3686
|
-
`;continue}if(i)try{let{extractVariables:
|
|
3687
|
-
`}}if(
|
|
3685
|
+
`}function JK($,Z){let Y=$.match(/^(\s*(?:<!--[\s\S]*?-->\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Y){let Q=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1]};let J=Y[1],G=Y[2],K=Y[3];return{html:`${J}${G} data-stx-scope="${Z}"${K}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function KK($){if($.__onceStore instanceof Set)return $.__onceStore;return GK}async function _7($,Z,Y,X,Q,J=new Set){let G=X.partialsDir||G0.join(G0.dirname(Y),"partials");if(G&&!G0.isAbsolute(G)){let z=G0.resolve(__dirname,"..");G=G0.resolve(z,G)}let K=$K($,"@partial","@include"),q=KK(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(z,O,F)=>{let L=O.trim(),H=`${Y}:${L}`;if(q.has(H))return"";return q.add(H),O});{let z=/@includeIf\s*\(/g,O;while((O=z.exec(K))!==null){let F=O.index,L=F+O[0].length-1,H=1,V=L+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(L+1,V-1),R=N.match(/^\s*['"]([^'"]+)['"]/);if(!R){z.lastIndex=V;continue}let A=R[1],T=_(A,G,Y),w="";if(T&&await Bun.file(T).exists())Q.add(T),w=`@include(${N})`;K=K.substring(0,F)+w+K.substring(V),z.lastIndex=0}}for(let[z,O]of[["@includeWhen",!1],["@includeUnless",!0]]){let F=new RegExp(`${z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),L;while((L=F.exec(K))!==null){let H=L.index,V=H+L[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),T=U7(A,0);if(T===-1){F.lastIndex=R;continue}let w=A.substring(0,T).trim(),E=A.substring(T+1).trim(),M=E.match(/^\s*['"]([^'"]+)['"]/);if(!M){F.lastIndex=R;continue}let I=M[1],D=E.substring(M[0].length),P,b=U7(D,0);if(b!==-1)P=D.substring(b+1).trim();try{let S=`Boolean(${w})`,k;if(t(S)){let i=$0(S,Object.keys(Z));k=Boolean(i(...Object.values(Z)))}else k=Boolean(X0(S,Z));let g=O?!k:k,h="";if(g){let i=_(I,G,Y);if(i&&await Bun.file(i).exists())Q.add(i);h=`@include('${I}'${P?`, ${P}`:""})`}K=K.substring(0,H)+h+K.substring(R),F.lastIndex=0}catch(S){let k=S instanceof Error?S.message:String(S),g=J0("Include",`Error evaluating ${z} condition: ${k}`,Y,$,H);K=K.substring(0,H)+g+K.substring(R),F.lastIndex=0}}}{let z=/@each\s*\(/g,O;while((O=z.exec(K))!==null){let F=O.index,L=F+O[0].length-1,H=1,V=L+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(L+1,V),R=K.substring(F,V+1),A=N.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!A){z.lastIndex=0,K=K.replace(R,"");continue}let[,T,w,E,M]=A;try{let I,D=w.trim();if(t(D))I=$0(D,Object.keys(Z))(...Object.values(Z));else I=X0(D,Z);let P="";if(Array.isArray(I)&&I.length>0)for(let b of I){let S={...Z,[E]:b},k=await W(T,S,$,F);P+=k}else if(M)P=await W(M,{},$,F);K=K.substring(0,F)+P+K.substring(V+1),z.lastIndex=0}catch(I){let D=I instanceof Error?I.message:String(I);K=K.substring(0,F)+J0("Each",`Error in @each: ${D}`,Y,$,F)+K.substring(V+1),z.lastIndex=0}}}{let z=/@includeFirst\s*\(/g,O;while((O=z.exec(K))!==null){let F=O.index,L=F+O[0].length-1,H=1,V=L+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(L+1,V),R=K.substring(F,V+1),A=N.match(/^\s*(\[[^\]]+\])/);if(!A){z.lastIndex=0,K=K.replace(R,"");continue}let T=A[1],w=N.slice(A[0].length),E,M=w.match(/^\s*,\s*\{/);if(M){w=w.slice(M[0].length-1);let P=1,b=1;while(b<w.length&&P>0){if(w[b]==="{")P++;else if(w[b]==="}"){if(P--,P===0)break}b++}E=w.substring(0,b+1),w=w.slice(b+1)}let I,D=w.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(D)I=D[1];try{let P=JSON.parse(T.replace(/'/g,'"')),b={};if(E)try{b=z0(E,Z)}catch(k){let g=k instanceof Error?k.message:String(k);if(X.debug){let h=J0("Include",`Error parsing includeFirst variables: ${g}`,Y,$,F,R);K=K.replace(R,()=>h)}else K=K.replace(R,()=>I||"");continue}let S=!1;for(let k of P){let g=_(k,G,Y);if(!g)continue;if(await c(g)){let h=await W(k,b,$,F);K=K.replace(R,()=>h),S=!0;break}}if(!S)if(I!==void 0)K=K.replace(R,()=>I);else if(X.debug){let k=J0("Include",`None of the includeFirst paths exist: ${T}`,Y,$,F,R);K=K.replace(R,()=>k)}else K=K.replace(R,"")}catch(P){let b=P instanceof Error?P.message:String(P),S=J0("Include",`Error processing @includeFirst: ${b}`,Y,$,F,R);K=K.replace(R,()=>S)}z.lastIndex=0}}function _(z,O,F){try{let L=z;if(!z.endsWith(".stx"))L=`${z}.stx`;let H=G0.resolve(O),V=G0.resolve(G0.dirname(F)),N;if(!L.startsWith("./")&&!L.startsWith("../"))N=G0.resolve(O,L);else N=G0.resolve(V,L);let R=G0.normalize(N),A=R.startsWith(H+G0.sep)||R===H,T=R.startsWith(V+G0.sep)||R===V,w=!1,E=G0.dirname(V);if(R.startsWith(E+G0.sep)){if(!G0.relative(E,R).split(G0.sep).some((P)=>P.startsWith(".")&&P!=="."&&P!==".."))w=!0}if(!A&&!T&&!w)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(L){return console.error(`Error resolving path ${z}: ${L}`),null}}let U=G0.resolve(Y);J.add(U);async function W(z,O={},F,L){let H=_(z,G,Y);if(!H)return J0("Include",`Could not resolve path for include: ${z}`,Y,F,L);let V=G0.resolve(H);if(J.has(V)){let N=[...J,V].map((R)=>G0.basename(R)).join(" -> ");return J0("Include",`Circular include detected: ${N}`,Y,F,L)}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}`,Y,F,L)}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 T=N.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),w="";if(T)w=`<style${T[1]}>${T[2]}</style>`;R=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),R=R.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let E={...Z};for(let[k,g]of Object.entries(O))E[k]=g;let M=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,I=[...N.matchAll(M)],D="",P=null;for(let k of I){let g=k[1]||"",h=k[2]||"",i=g.includes("server");if(Y1(g)&&h.trim())h=X1(h);let T0=ZK(h);if(T0&&!i){P=`stx_scope_${G0.basename(H,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++QK}`;let q0=p0(h),k0=XK(q0,P);D+=`<script data-stx-scoped>${k0}</script>
|
|
3686
|
+
`;continue}if(i)try{let{extractVariables:q0}=await Promise.resolve().then(() => (n1(),T5));await q0(h,E,H)}catch(q0){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${H}:`,q0)}if(!i&&!T0){let q0=g.replace(/\bclient\b/i,"").trim();D+=`<script data-stx-scoped${q0?` ${q0}`:""}>${h}</script>
|
|
3687
|
+
`}}if(P){let k=JK(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 _7(R,E,H,X,Q,J);let{processLoops:b}=await Promise.resolve().then(() => (q7(),u8)),S=b(R,E,H);if(S=E1(S,E,H),S=Q1(S,E,H),w)S+=`
|
|
3688
3688
|
`+w;if(D)S+=`
|
|
3689
|
-
`+D;return S}catch(N){let R=N instanceof Error?N.message:String(N);return
|
|
3690
|
-
`)})}var __dirname="/home/runner/work/stx/stx/packages/stx/src",
|
|
3689
|
+
`+D;return S}catch(N){let R=N instanceof Error?N.message:String(N);return J0("Include",`Error processing include ${z}: ${R}`,Y,F,L)}}let B=/@include\s*\(/g,j;while((j=B.exec(K))!==null){let z=j.index,O=z+j[0].length-1,F=1,L=O+1;while(L<K.length&&F>0){if(K[L]==="(")F++;else if(K[L]===")")F--;L++}if(F!==0)break;let H=K.substring(z,L),V=K.substring(O+1,L-1),N=V.match(/^\s*['"]([^'"]+)['"]/);if(!N){B.lastIndex=L;continue}let R=N[1],A,T=V.substring(N[0].length),w=U7(T,0);if(w!==-1)A=T.substring(w+1).trim();let E={};if(A)try{E=z0(A,Z)}catch(I){let D=I instanceof Error?I.message:String(I);K=K.replace(H,J0("Include",`Error parsing include variables for ${R}: ${D}`,Y,$,z)),B.lastIndex=0;continue}let M=await W(R,E,$,z);K=K.substring(0,z)+M+K.substring(L),B.lastIndex=0}return K}function W7($,Z){let Y=$;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}\\(`),F=new RegExp(`@${G}(?![a-z])`),L=1,H=z,V=-1;while(L>0&&H<q.length){let R=q.slice(H),A=R.match(O),T=R.match(F),w=A?H+A.index:1/0,E=T?H+T.index:1/0;if(w<E)L++,H=w+(A[0].length||1);else if(E<1/0){if(L--,L===0){V=E;break}H=E+G.length+1}else break}if(V===-1)break;let N=q.slice(z,V);if(!Z[j])Z[j]=[];if(K)Z[j].unshift(N);else Z[j].push(N);q=q.substring(0,B)+q.substring(V+`@${G}`.length),_=!0}return q}return Y=X(Y,"push","endpush",!1),Y=X(Y,"prepend","endprepend",!0),Y}function B7($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
|
|
3690
|
+
`)})}var __dirname="/home/runner/work/stx/stx/packages/stx/src",QK=0,zj,GK;var l8=y(()=>{K$();c0();A1();V0();L0();zj=new l1(500),GK=new Set});import*as z7 from"path";async function p8($,Z,Y=""){if(z7.basename(Y)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return i8($,Z,Y,"@js","@endjs")}async function c8($,Z,Y=""){if(z7.basename(Y)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((J)=>({...J,displayName:`User ${J.id}: ${J.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return i8($,Z,Y,"@ts","@endts")}async function i8($,Z,Y,X,Q){let J=$,G=N1(`${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(Z),j=Object.values(Z),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 F=(z.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((R)=>R.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),L=F.length>0?`return { ${F.join(", ")} };`:"return {};",H=`
|
|
3691
3691
|
${z}
|
|
3692
3692
|
${L}
|
|
3693
|
-
`,N=Function(...B,
|
|
3694
|
-
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${
|
|
3695
|
-
`)}}}return J}async function
|
|
3696
|
-
`,
|
|
3697
|
-
@endforeach`;Z=Z.slice(0,W.outerStart)+
|
|
3698
|
-
${
|
|
3699
|
-
${
|
|
3700
|
-
${
|
|
3701
|
-
`),j=J[0].outerStart,z=J[J.length-1].outerEnd;Z=Z.slice(0,j)+B+Z.slice(z),Y=j+B.length}return Z}function
|
|
3702
|
-
${
|
|
3703
|
-
@endonce`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function
|
|
3704
|
-
`),
|
|
3693
|
+
`,N=Function(...B,H)(...j);if(N&&typeof N==="object")Object.assign(Z,N);J=J.replace(_,"")}catch(B){console.error(`Error executing ${X} code block in ${Y}:`,B);let j=B instanceof Error?B.message:String(B),z=J0(`${X} Directive`,`Error executing code: ${j}`,Y,$,W,_);console.error(z),J=J.replace(_,"")}return J}var n8=y(()=>{A1();L0()});function qK($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function s8($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,X,Q,J)=>{return qK(X,J||"_method")})}async function o8($,Z,Y,X,Q){if(!X.middleware||X.middleware.length===0)return $;let J=$,G=X.middleware.filter((K)=>K.timing===Q);if(G.length===0)return J;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(X.debug)console.warn("Invalid middleware:",K);continue}try{let q=await K.handler(J,Z,Y,X);if(typeof q==="string")J=q;else if(X.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(q){if(X.debug)console.error(`Error in middleware ${K.name}:`,q);if(X.debug){let _=J0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Y,$);J=J.replace(/<body[^>]*>/,`$&
|
|
3694
|
+
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${J1(_)}</div>
|
|
3695
|
+
`)}}}return J}async function r8($,Z,Y,X){return o8($,Z,Y,X,"before")}async function a8($,Z,Y,X){return o8($,Z,Y,X,"after")}var t8=y(()=>{c0();L0()});import{defineRoute as Ij,defineRoutes as Ej,resetRoutes as Dj,route as kj,setAppUrl as Sj}from"stx-router";import{route as UK}from"stx-router";function e8($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,X,Q,J)=>{try{let G=Q?z0(Q,{}):{};return UK(X,G,J==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var $Z=y(()=>{V0()});async function ZZ($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(Y5.exact[$])for(let X of Y5.exact[$])await Promise.resolve(X(Z,$));if(Y5.exact[Y])for(let X of Y5.exact[Y])await Promise.resolve(X(Z,$));for(let{pattern:X,callback:Q}of Y5.patterns)if(X.test($)||X.test(Y))await Promise.resolve(Q(Z,$))}var Y5;var YZ=y(()=>{Y5={patterns:[],exact:{}}});function XZ($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>XZ(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function JZ($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Q=[],J;while((J=X.exec($))!==null)Q.push([J.index,J.index+J[0].length]);function G(_){return Q.some(([U,W])=>_>=U&&_<W)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((J=K.exec(Y))!==null){if(G(J.index))continue;let _=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],F=B[2];if(F.includes("()")&&!F.includes(".get(")||F.includes("$store")||F.includes("$ref"))continue;try{let L=Object.keys(Z),H=Object.values(Z),V=F.match(/^([a-zA-Z_$][\w$]*)/);if(V&&!L.includes(V[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(V[1]))continue;let R=Function(...L,`return (${F})`)(...H);if(O==="class"){let A=XZ(R);if(A){let T=j.match(/\sclass="([^"]*)"/);if(T)j=j.replace(T[0],` class="${T[1]} ${A}"`);else j=j.replace(B[0],` class="${A}"`)}else j=j.replace(B[0],"");z=!0;continue}if(_K.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,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");j=j.replace(B[0],` ${O}="${A}"`)}z=!0}catch{continue}}if(z){let O=_.endsWith("/>")?" /":"",L=`<${J[1]}${j}${O}>`;q.push({start:J.index,end:J.index+_.length,replacement:L})}}for(let _=q.length-1;_>=0;_--){let{start:U,end:W,replacement:B}=q[_];Y=Y.slice(0,U)+B+Y.slice(W)}return Y}var _K;var QZ=y(()=>{_K=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($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let X=Y.exec($);if(!X)return null;return{full:X[0],tag:X[1],attrs:X[2],selfClosing:X[3].includes("/")||WK.has(X[1].toLowerCase()),start:X.index,end:X.index+X[0].length}}function zK($,Z,Y){let X=1,Q=Y,J=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(X>0&&Q<$.length){J.lastIndex=Q,G.lastIndex=Q;let K=J.exec($),q=G.exec($);if(!q)return-1;if(K&&K.index<q.index)X++,Q=K.index+K[0].length;else{if(X--,X===0)return q.index+q[0].length;Q=q.index+q[0].length}}return-1}function v0($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=zK($,Z.tag,Z.end);if(Y===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:Y,innerHTML:$.slice(Z.end,Y-`</${Z.tag}>`.length)}}function GZ($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function D1($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return X?X[1]:null}function r0($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${Y}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Y}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Y}(?=\\s|$|>|/)`,"g"),"")}function a0($,Z,Y){let X=Z.selfClosing?" /":"",Q=`<${Z.tag}${Y}${X}>`;return $.slice(0,Z.start)+Q+$.slice(Z.end)}function jK($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function OK($){let Z=$,Y=0;while(Y<Z.length){let X=j1(Z,Y);if(!X)break;let Q=D1(X.attrs,"v-for");if(Q===null){Y=X.end;continue}let J=Q.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!J){Y=X.end;continue}let G=J[1].trim(),K=J[2].trim(),q;if(G.includes(",")){let F=G.split(",").map((V)=>V.trim()),L=F[0],H=F[1];q=`${K} as ${H} => ${L}`}else q=`${K} as ${G}`;let _=r0(X.attrs,"v-for"),U=r0(_,":key").replace(/\s*v-bind:key="[^"]*"/g,""),W=v0(Z,X),B=Z.slice(W.outerStart,W.outerEnd),j=a0(B,{...X,start:0,end:X.end-X.start},U),z=`@foreach(${q})
|
|
3696
|
+
`,O=`${z}${j}
|
|
3697
|
+
@endforeach`;Z=Z.slice(0,W.outerStart)+O+Z.slice(W.outerEnd),Y=W.outerStart+z.length}return Z}function HK($){let Z=$,Y=0;while(Y<Z.length){let X=j1(Z,Y);if(!X)break;let Q=D1(X.attrs,"v-if");if(Q===null){Y=X.end;continue}let J=[],G=v0(Z,X),K=r0(X.attrs,"v-if"),q=a0(Z.slice(G.outerStart,G.outerEnd),{...X,start:0,end:X.end-X.start},K);J.push({type:"if",expr:Q,outerStart:G.outerStart,outerEnd:G.outerEnd,element:q,parsedTag:X});let _=G.outerEnd,U=!0;while(U){let O=Z.slice(_).match(/^\s*/),F=O?O[0].length:0,L=j1(Z,_+F);if(!L){U=!1;break}let H=D1(L.attrs,"v-else-if"),V=GZ(L.attrs,"v-else");if(H!==null){let N=v0(Z,L),R=r0(L.attrs,"v-else-if"),A=a0(Z.slice(N.outerStart,N.outerEnd),{...L,start:0,end:L.end-L.start},R);J.push({type:"else-if",expr:H,outerStart:_,outerEnd:N.outerEnd,element:A,parsedTag:L}),_=N.outerEnd}else if(V){let N=v0(Z,L),R=r0(L.attrs,"v-else"),A=a0(Z.slice(N.outerStart,N.outerEnd),{...L,start:0,end:L.end-L.start},R);J.push({type:"else",outerStart:_,outerEnd:N.outerEnd,element:A,parsedTag:L}),U=!1}else U=!1}let W=[];for(let O of J)if(O.type==="if")W.push(`@if(${O.expr})
|
|
3698
|
+
${O.element}`);else if(O.type==="else-if")W.push(`@elseif(${O.expr})
|
|
3699
|
+
${O.element}`);else W.push(`@else
|
|
3700
|
+
${O.element}`);W.push("@endif");let B=W.join(`
|
|
3701
|
+
`),j=J[0].outerStart,z=J[J.length-1].outerEnd;Z=Z.slice(0,j)+B+Z.slice(z),Y=j+B.length}return Z}function LK($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function FK($){let Z=$,Y=0;while(Y<Z.length){let X=j1(Z,Y);if(!X)break;let Q=X.attrs,J=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=Q.match(G);while(K){J=!0;let U=K[1],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(Z,X),W=Z.slice(U.outerStart,U.outerEnd),B=a0(W,{...X,start:0,end:X.end-X.start},Q);Z=Z.slice(0,U.outerStart)+B+Z.slice(U.outerEnd),Y=U.outerStart+B.length;continue}let q=D1(X.attrs,"v-model");if(q===null){Y=X.end;continue}if(BK.has(X.tag.toLowerCase())){let U=X.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,W=v0(Z,X),B=Z.slice(W.outerStart,W.outerEnd),j=a0(B,{...X,start:0,end:X.end-X.start},U);Z=Z.slice(0,W.outerStart)+j+Z.slice(W.outerEnd),Y=W.outerStart+j.length}else{let U=X.attrs.replace(/\s*v-model="[^"]*"/g,"");U+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let W=v0(Z,X),B=Z.slice(W.outerStart,W.outerEnd),j=a0(B,{...X,start:0,end:X.end-X.start},U);Z=Z.slice(0,W.outerStart)+j+Z.slice(W.outerEnd),Y=W.outerStart+j.length}}return Z}function VK($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function RK($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function NK($){let Z=$,Y=0;while(Y<Z.length){let X=j1(Z,Y);if(!X)break;let Q=D1(X.attrs,"v-html");if(Q===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let J=v0(Z,X),G=r0(X.attrs,"v-html"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{!! ${Q} !!}</${X.tag}>`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function AK($){let Z=$,Y=0;while(Y<Z.length){let X=j1(Z,Y);if(!X)break;let Q=D1(X.attrs,"v-text");if(Q===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let J=v0(Z,X),G=r0(X.attrs,"v-text"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{{ ${Q} }}</${X.tag}>`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function TK($){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 wK($){let Z=$,Y=0;while(Y<Z.length){let X=j1(Z,Y);if(!X)break;if(!GZ(X.attrs,"v-once")){Y=X.end;continue}let Q=r0(X.attrs,"v-once"),J=v0(Z,X),G=Z.slice(J.outerStart,J.outerEnd),q=`@once
|
|
3702
|
+
${a0(G,{...X,start:0,end:X.end-X.start},Q)}
|
|
3703
|
+
@endonce`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function MK($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function IK($){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 KZ($){if(!jK($))return $;let Z=$;return Z=OK(Z),Z=HK(Z),Z=wK(Z),Z=VK(Z),Z=RK(Z),Z=FK(Z),Z=LK(Z),Z=IK(Z),Z=NK(Z),Z=AK(Z),Z=TK(Z),Z=MK(Z),Z}var WK,BK;var qZ=y(()=>{WK=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 UZ($,Z,Y,X,Q){let J=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],q;while((q=G.exec(J))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let _=K.length-1;_>=0;_--){let U=K[_];try{let W=X0(U.expr,Z);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,Z)}catch{j[H]=V}else j[H]=V}let F=X.componentsDir||"components",L=await q1(W,j,U.slotContent,F,Z,Y,X,new Set,Q??new Set);J=J.slice(0,U.index)+L+J.slice(U.index+U.full.length)}catch(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 EK(J,Z,Y,X,Q),J}async function EK($,Z,Y,X,Q){let J=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],q;while((q=G.exec(J))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let _=K.length-1;_>=0;_--){let U=K[_];try{let W=X0(U.expr,Z);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,Z,Y,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 _Z=y(()=>{L0();V0()});function DK($,Z={},Y={}){let{title:X="stx App",lang:Q="en",meta:J=[],link:G=[],script:K=[],headRaw:q="",bodyClass:_="",bodyAttrs:U={}}=Z,W=Y.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(([T,w])=>`${T}="${w}"`).join(" ")}>`}).join(`
|
|
3704
|
+
`),O=G.map((R)=>{return` <link ${Object.entries(R).map(([T,w])=>`${T}="${w}"`).join(" ")}>`}).join(`
|
|
3705
3705
|
`),F=K.map((R)=>{if(R.src)return` <script ${Object.entries(R).filter(([T])=>T!=="content").map(([T,w])=>`${T}="${w}"`).join(" ")}></script>`;if(R.content)return` <script>${R.content}</script>`;return""}).filter(Boolean).join(`
|
|
3706
|
-
`),L=Object.entries(U).map(([R,A])=>` ${R}="${A}"`).join(""),
|
|
3706
|
+
`),L=Object.entries(U).map(([R,A])=>` ${R}="${A}"`).join(""),H=_?` class="${_}"`:"",V=[z,` <title>${W}</title>`,O,F,q?` ${q}`:"",...(Y.styles||[]).map((R)=>` ${R}`),...(Y.headScripts||[]).map((R)=>` ${R}`),Y.headStack||""].filter(Boolean),N=[$,...(Y.bodyScripts||[]).map((R)=>R),Y.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
|
|
3707
3707
|
<html lang="${Q}">
|
|
3708
3708
|
<head>
|
|
3709
3709
|
${V.join(`
|
|
3710
3710
|
`)}
|
|
3711
3711
|
</head>
|
|
3712
|
-
<body${
|
|
3712
|
+
<body${H}${L}>
|
|
3713
3713
|
${N.join(`
|
|
3714
3714
|
`)}
|
|
3715
3715
|
</body>
|
|
3716
|
-
</html>`}function
|
|
3716
|
+
</html>`}function kK($){let Z=$.trim();while(Z.startsWith("<!--")){let Y=Z.indexOf("-->");if(Y===-1)break;Z=Z.slice(Y+3).trim()}return/^<!DOCTYPE\b/i.test(Z)||/^<html[\s>]/i.test(Z)}function WZ($,Z={},Y={}){if(kK($))return $;return DK($,Z,Y)}function j7($){let Z=$,Y=new Set,X=new Set,Q=()=>{if(E0)X.add(E0);return Z};return Q.set=(J)=>{if(!Object.is(J,Z)){let G=Z;if(Z=J,Y.forEach((K)=>K(Z,G)),X5)X.forEach((K)=>O$.add(K));else X.forEach((K)=>K())}},Q.update=(J)=>{Q.set(J(Z))},Q.subscribe=(J)=>{return Y.add(J),()=>Y.delete(J)},Object.defineProperty(Q,"_isSignal",{value:!0,writable:!1}),Q}function O7($){let Z,Y=!0,X=new Set,Q=()=>{if(!Y)if(Y=!0,X5)X.forEach((G)=>O$.add(G));else X.forEach((G)=>G())},J=()=>{if(E0)X.add(E0);if(Y){let G=E0;E0=Q,j$.push(Q);try{Z=$()}finally{j$.pop(),E0=G}Y=!1}return Z};return Object.defineProperty(J,"_isDerived",{value:!0,writable:!1}),J}function H7($,Z={}){let Y,X=!1,Q=()=>{if(X)return;if(Y)Y(),Y=void 0;let J=E0;E0=Q,j$.push(Q);try{Y=$()}finally{j$.pop(),E0=J}};if(Z.immediate!==!1)Q();return()=>{if(X=!0,Y)Y()}}function L7($){if(X5){$();return}X5=!0;try{$()}finally{X5=!1,O$.forEach((Z)=>Z()),O$.clear()}}function F7($){SK.push($)}function V7($){bK.push($)}function H$($){return typeof $==="function"&&$._isSignal===!0}function L$($){return typeof $==="function"&&$._isDerived===!0}function R7($){if(H$($)||L$($))return $();return $}function N7($){let Z=E0;E0=null;try{return $()}finally{E0=Z}}var E0=null,j$,X5=!1,O$,SK,bK;var A7=y(()=>{j$=[],O$=new Set,SK=[],bK=[]});var T7={};o(T7,{untrack:()=>R7,state:()=>j7,peek:()=>N7,onMount:()=>F7,onDestroy:()=>V7,isSignal:()=>H$,isDerived:()=>L$,generateSignalsRuntimeDev:()=>F$,generateSignalsRuntime:()=>BZ,effect:()=>H7,derived:()=>O7,default:()=>yK,batch:()=>L7});function BZ(){try{let Z=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(F$());return Z=Z.replace(/\}(var |let |const |function )/g,"};$1"),Z}catch{return F$()}}function F$(){return`
|
|
3717
3717
|
// STX Signals Runtime (Development Build)
|
|
3718
3718
|
console.log('[stx] signals runtime loading');
|
|
3719
3719
|
// Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
|
|
@@ -6550,6 +6550,277 @@ catch (e) {}
|
|
|
6550
6550
|
useHead({ title: config.title || config.ogTitle, meta: meta });
|
|
6551
6551
|
}
|
|
6552
6552
|
|
|
6553
|
+
// ==========================================================================
|
|
6554
|
+
// Toast notification system
|
|
6555
|
+
// ==========================================================================
|
|
6556
|
+
|
|
6557
|
+
var _toastId = 0;
|
|
6558
|
+
var _toastIcons = {
|
|
6559
|
+
success: '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#16a34a" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M9 12l2 2 4-4"/></svg>',
|
|
6560
|
+
error: '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#dc2626" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="15" y1="9" x2="9" y2="15"/><line x1="9" y1="9" x2="15" y2="15"/></svg>',
|
|
6561
|
+
info: '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#2563eb" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg>',
|
|
6562
|
+
warning: '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#d97706" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>'
|
|
6563
|
+
};
|
|
6564
|
+
var _toastColors = {
|
|
6565
|
+
success: '#16a34a',
|
|
6566
|
+
error: '#dc2626',
|
|
6567
|
+
info: '#2563eb',
|
|
6568
|
+
warning: '#d97706'
|
|
6569
|
+
};
|
|
6570
|
+
|
|
6571
|
+
function _getToastContainer() {
|
|
6572
|
+
return document.getElementById('stx-toast-container');
|
|
6573
|
+
}
|
|
6574
|
+
|
|
6575
|
+
function _getToastAnimClass(container) {
|
|
6576
|
+
if (!container) return { inAnim: 'stx-toast-in', outAnim: 'stx-toast-out' };
|
|
6577
|
+
var pos = container.getAttribute('data-stx-toast-position') || 'top-right';
|
|
6578
|
+
if (pos.indexOf('left') !== -1) return { inAnim: 'stx-toast-in-left', outAnim: 'stx-toast-out-left' };
|
|
6579
|
+
if (pos.indexOf('center') !== -1) return { inAnim: 'stx-toast-in-center', outAnim: 'stx-toast-out-center' };
|
|
6580
|
+
return { inAnim: 'stx-toast-in', outAnim: 'stx-toast-out' };
|
|
6581
|
+
}
|
|
6582
|
+
|
|
6583
|
+
function removeToast(id) {
|
|
6584
|
+
var el = document.getElementById('stx-toast-' + id);
|
|
6585
|
+
if (!el) return;
|
|
6586
|
+
var container = _getToastContainer();
|
|
6587
|
+
var anims = _getToastAnimClass(container);
|
|
6588
|
+
el.style.animation = anims.outAnim + ' 0.3s ease forwards';
|
|
6589
|
+
setTimeout(function() {
|
|
6590
|
+
if (el.parentNode) el.parentNode.removeChild(el);
|
|
6591
|
+
}, 300);
|
|
6592
|
+
}
|
|
6593
|
+
|
|
6594
|
+
function addToast(type, message, options) {
|
|
6595
|
+
var container = _getToastContainer();
|
|
6596
|
+
if (!container) {
|
|
6597
|
+
console.warn('[stx:toast] No <StxToast /> container found. Add <StxToast /> to your layout.');
|
|
6598
|
+
return -1;
|
|
6599
|
+
}
|
|
6600
|
+
var opts = options || {};
|
|
6601
|
+
var duration = opts.duration !== undefined ? opts.duration : 3000;
|
|
6602
|
+
var id = ++_toastId;
|
|
6603
|
+
var maxToasts = parseInt(container.getAttribute('data-stx-toast-max') || '5', 10);
|
|
6604
|
+
|
|
6605
|
+
// Enforce max toasts \u2014 remove oldest
|
|
6606
|
+
var existing = container.querySelectorAll('[data-stx-toast]');
|
|
6607
|
+
while (existing.length >= maxToasts && existing.length > 0) {
|
|
6608
|
+
var oldId = existing[0].getAttribute('data-stx-toast');
|
|
6609
|
+
removeToast(oldId);
|
|
6610
|
+
existing = container.querySelectorAll('[data-stx-toast]');
|
|
6611
|
+
}
|
|
6612
|
+
|
|
6613
|
+
var anims = _getToastAnimClass(container);
|
|
6614
|
+
var borderColor = _toastColors[type] || _toastColors.info;
|
|
6615
|
+
var icon = _toastIcons[type] || _toastIcons.info;
|
|
6616
|
+
var isDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
6617
|
+
var bg = isDark ? '#1f2937' : '#ffffff';
|
|
6618
|
+
var textColor = isDark ? '#f3f4f6' : '#1f2937';
|
|
6619
|
+
var shadow = isDark ? '0 4px 12px rgba(0,0,0,0.4)' : '0 4px 12px rgba(0,0,0,0.15)';
|
|
6620
|
+
|
|
6621
|
+
var el = document.createElement('div');
|
|
6622
|
+
el.id = 'stx-toast-' + id;
|
|
6623
|
+
el.setAttribute('data-stx-toast', String(id));
|
|
6624
|
+
el.setAttribute('role', 'alert');
|
|
6625
|
+
el.setAttribute('aria-live', 'assertive');
|
|
6626
|
+
el.style.cssText = 'pointer-events:auto;display:flex;align-items:flex-start;gap:0.75rem;padding:0.875rem 1rem;border-radius:0.5rem;border-left:4px solid ' + borderColor + ';background:' + bg + ';color:' + textColor + ';box-shadow:' + shadow + ';animation:' + anims.inAnim + ' 0.3s ease;font-family:system-ui,-apple-system,sans-serif;font-size:0.875rem;line-height:1.4;max-width:100%';
|
|
6627
|
+
|
|
6628
|
+
var iconSpan = document.createElement('span');
|
|
6629
|
+
iconSpan.style.cssText = 'flex-shrink:0;display:flex;align-items:center;margin-top:1px';
|
|
6630
|
+
iconSpan.innerHTML = icon;
|
|
6631
|
+
|
|
6632
|
+
var msgSpan = document.createElement('span');
|
|
6633
|
+
msgSpan.style.cssText = 'flex:1;word-wrap:break-word';
|
|
6634
|
+
msgSpan.textContent = message;
|
|
6635
|
+
|
|
6636
|
+
var closeBtn = document.createElement('button');
|
|
6637
|
+
closeBtn.type = 'button';
|
|
6638
|
+
closeBtn.setAttribute('aria-label', 'Dismiss notification');
|
|
6639
|
+
closeBtn.style.cssText = 'flex-shrink:0;background:none;border:none;cursor:pointer;padding:0;color:' + (isDark ? '#9ca3af' : '#6b7280') + ';font-size:1.125rem;line-height:1;display:flex;align-items:center';
|
|
6640
|
+
closeBtn.innerHTML = '<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor"><path d="M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"/></svg>';
|
|
6641
|
+
closeBtn.onclick = function() { removeToast(id); };
|
|
6642
|
+
|
|
6643
|
+
el.appendChild(iconSpan);
|
|
6644
|
+
el.appendChild(msgSpan);
|
|
6645
|
+
el.appendChild(closeBtn);
|
|
6646
|
+
container.appendChild(el);
|
|
6647
|
+
|
|
6648
|
+
if (duration > 0) {
|
|
6649
|
+
setTimeout(function() { removeToast(id); }, duration);
|
|
6650
|
+
}
|
|
6651
|
+
|
|
6652
|
+
return id;
|
|
6653
|
+
}
|
|
6654
|
+
|
|
6655
|
+
var toast = {
|
|
6656
|
+
success: function(message, options) { return addToast('success', message, options); },
|
|
6657
|
+
error: function(message, options) { return addToast('error', message, options); },
|
|
6658
|
+
info: function(message, options) { return addToast('info', message, options); },
|
|
6659
|
+
warning: function(message, options) { return addToast('warning', message, options); },
|
|
6660
|
+
dismiss: function(id) {
|
|
6661
|
+
if (id !== undefined) { removeToast(id); return; }
|
|
6662
|
+
var container = _getToastContainer();
|
|
6663
|
+
if (!container) return;
|
|
6664
|
+
var all = container.querySelectorAll('[data-stx-toast]');
|
|
6665
|
+
for (var i = 0; i < all.length; i++) {
|
|
6666
|
+
var tid = all[i].getAttribute('data-stx-toast');
|
|
6667
|
+
removeToast(tid);
|
|
6668
|
+
}
|
|
6669
|
+
}
|
|
6670
|
+
};
|
|
6671
|
+
|
|
6672
|
+
// \u2500\u2500 Modal system \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
6673
|
+
var modal = {
|
|
6674
|
+
open: function(id) {
|
|
6675
|
+
var el = document.querySelector('[data-stx-modal="' + id + '"]');
|
|
6676
|
+
if (!el) { console.warn('[stx:modal] Modal "' + id + '" not found'); return; }
|
|
6677
|
+
el.style.display = 'flex';
|
|
6678
|
+
// Force reflow then animate
|
|
6679
|
+
void el.offsetHeight;
|
|
6680
|
+
el.setAttribute('data-stx-modal-open', '');
|
|
6681
|
+
document.body.style.overflow = 'hidden';
|
|
6682
|
+
// Escape key handler
|
|
6683
|
+
if (el.getAttribute('data-close-escape') !== 'false') {
|
|
6684
|
+
var escHandler = function(e) {
|
|
6685
|
+
if (e.key === 'Escape') { modal.close(id); document.removeEventListener('keydown', escHandler); }
|
|
6686
|
+
};
|
|
6687
|
+
document.addEventListener('keydown', escHandler);
|
|
6688
|
+
el._stxEscHandler = escHandler;
|
|
6689
|
+
}
|
|
6690
|
+
// Backdrop click
|
|
6691
|
+
if (el.getAttribute('data-close-backdrop') !== 'false') {
|
|
6692
|
+
el.onclick = function(e) { if (e.target === el) modal.close(id); };
|
|
6693
|
+
}
|
|
6694
|
+
},
|
|
6695
|
+
close: function(id) {
|
|
6696
|
+
var el = document.querySelector('[data-stx-modal="' + id + '"]');
|
|
6697
|
+
if (!el) return;
|
|
6698
|
+
el.removeAttribute('data-stx-modal-open');
|
|
6699
|
+
if (el._stxEscHandler) { document.removeEventListener('keydown', el._stxEscHandler); el._stxEscHandler = null; }
|
|
6700
|
+
el.onclick = null;
|
|
6701
|
+
setTimeout(function() {
|
|
6702
|
+
el.style.display = 'none';
|
|
6703
|
+
// Restore scroll if no other modals are open
|
|
6704
|
+
if (!document.querySelector('[data-stx-modal-open]')) document.body.style.overflow = '';
|
|
6705
|
+
}, 200);
|
|
6706
|
+
},
|
|
6707
|
+
toggle: function(id) {
|
|
6708
|
+
var el = document.querySelector('[data-stx-modal="' + id + '"]');
|
|
6709
|
+
if (el && el.hasAttribute('data-stx-modal-open')) modal.close(id);
|
|
6710
|
+
else modal.open(id);
|
|
6711
|
+
}
|
|
6712
|
+
};
|
|
6713
|
+
|
|
6714
|
+
// \u2500\u2500 Alert & Confirm dialogs \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
6715
|
+
// Styled replacements for window.alert() and window.confirm().
|
|
6716
|
+
// Both return Promises and render into a temporary modal overlay.
|
|
6717
|
+
|
|
6718
|
+
var _dialogId = 0;
|
|
6719
|
+
var _dialogIcons = {
|
|
6720
|
+
info: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#2563eb" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg>',
|
|
6721
|
+
warning: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#d97706" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>',
|
|
6722
|
+
error: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#dc2626" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="15" y1="9" x2="9" y2="15"/><line x1="9" y1="9" x2="15" y2="15"/></svg>',
|
|
6723
|
+
success: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#16a34a" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M9 12l2 2 4-4"/></svg>',
|
|
6724
|
+
question: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#6366f1" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 015.83 1c0 2-3 3-3 3"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>'
|
|
6725
|
+
};
|
|
6726
|
+
|
|
6727
|
+
function _createDialog(message, options, isConfirm) {
|
|
6728
|
+
var opts = options || {};
|
|
6729
|
+
var type = opts.type || (isConfirm ? 'question' : 'info');
|
|
6730
|
+
var title = opts.title || '';
|
|
6731
|
+
var confirmText = opts.confirmText || 'OK';
|
|
6732
|
+
var cancelText = opts.cancelText || 'Cancel';
|
|
6733
|
+
var id = 'stx-dialog-' + (++_dialogId);
|
|
6734
|
+
var isDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
6735
|
+
var bg = isDark ? '#1f2937' : '#ffffff';
|
|
6736
|
+
var textColor = isDark ? '#f3f4f6' : '#1f2937';
|
|
6737
|
+
var subColor = isDark ? '#9ca3af' : '#6b7280';
|
|
6738
|
+
var icon = _dialogIcons[type] || _dialogIcons.info;
|
|
6739
|
+
|
|
6740
|
+
return new Promise(function(resolve) {
|
|
6741
|
+
var backdrop = document.createElement('div');
|
|
6742
|
+
backdrop.id = id;
|
|
6743
|
+
backdrop.style.cssText = 'position:fixed;inset:0;z-index:999999;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease;font-family:system-ui,-apple-system,sans-serif';
|
|
6744
|
+
backdrop.setAttribute('role', 'alertdialog');
|
|
6745
|
+
backdrop.setAttribute('aria-modal', 'true');
|
|
6746
|
+
|
|
6747
|
+
var panel = document.createElement('div');
|
|
6748
|
+
panel.style.cssText = 'max-width:24rem;width:calc(100% - 2rem);border-radius:0.75rem;padding:1.5rem;background:' + bg + ';color:' + textColor + ';box-shadow:0 20px 60px rgba(0,0,0,0.3);transform:scale(0.95);transition:transform 0.2s ease;text-align:center';
|
|
6749
|
+
|
|
6750
|
+
var iconDiv = document.createElement('div');
|
|
6751
|
+
iconDiv.style.cssText = 'display:flex;justify-content:center;margin-bottom:1rem';
|
|
6752
|
+
iconDiv.innerHTML = icon;
|
|
6753
|
+
panel.appendChild(iconDiv);
|
|
6754
|
+
|
|
6755
|
+
if (title) {
|
|
6756
|
+
var titleEl = document.createElement('h3');
|
|
6757
|
+
titleEl.style.cssText = 'margin:0 0 0.5rem;font-size:1.125rem;font-weight:600';
|
|
6758
|
+
titleEl.textContent = title;
|
|
6759
|
+
panel.appendChild(titleEl);
|
|
6760
|
+
}
|
|
6761
|
+
|
|
6762
|
+
var msgEl = document.createElement('p');
|
|
6763
|
+
msgEl.style.cssText = 'margin:0 0 1.25rem;font-size:0.875rem;line-height:1.5;color:' + subColor;
|
|
6764
|
+
msgEl.textContent = message;
|
|
6765
|
+
panel.appendChild(msgEl);
|
|
6766
|
+
|
|
6767
|
+
var btnRow = document.createElement('div');
|
|
6768
|
+
btnRow.style.cssText = 'display:flex;gap:0.75rem;justify-content:center';
|
|
6769
|
+
|
|
6770
|
+
function cleanup(result) {
|
|
6771
|
+
backdrop.style.opacity = '0';
|
|
6772
|
+
panel.style.transform = 'scale(0.95)';
|
|
6773
|
+
setTimeout(function() { backdrop.remove(); }, 200);
|
|
6774
|
+
resolve(result);
|
|
6775
|
+
}
|
|
6776
|
+
|
|
6777
|
+
if (isConfirm) {
|
|
6778
|
+
var cancelBtn = document.createElement('button');
|
|
6779
|
+
cancelBtn.textContent = cancelText;
|
|
6780
|
+
cancelBtn.style.cssText = 'padding:0.5rem 1.25rem;border-radius:0.5rem;font-size:0.875rem;font-weight:500;cursor:pointer;border:1px solid ' + (isDark ? '#374151' : '#d1d5db') + ';background:transparent;color:' + textColor + ';transition:background 0.15s';
|
|
6781
|
+
cancelBtn.onmouseover = function() { this.style.background = isDark ? '#374151' : '#f3f4f6'; };
|
|
6782
|
+
cancelBtn.onmouseout = function() { this.style.background = 'transparent'; };
|
|
6783
|
+
cancelBtn.onclick = function() { cleanup(false); };
|
|
6784
|
+
btnRow.appendChild(cancelBtn);
|
|
6785
|
+
}
|
|
6786
|
+
|
|
6787
|
+
var okBtn = document.createElement('button');
|
|
6788
|
+
okBtn.textContent = confirmText;
|
|
6789
|
+
var btnColor = type === 'error' ? '#dc2626' : type === 'warning' ? '#d97706' : '#5672cd';
|
|
6790
|
+
okBtn.style.cssText = 'padding:0.5rem 1.25rem;border-radius:0.5rem;font-size:0.875rem;font-weight:500;cursor:pointer;border:none;background:' + btnColor + ';color:#fff;transition:opacity 0.15s';
|
|
6791
|
+
okBtn.onmouseover = function() { this.style.opacity = '0.9'; };
|
|
6792
|
+
okBtn.onmouseout = function() { this.style.opacity = '1'; };
|
|
6793
|
+
okBtn.onclick = function() { cleanup(isConfirm ? true : undefined); };
|
|
6794
|
+
btnRow.appendChild(okBtn);
|
|
6795
|
+
|
|
6796
|
+
panel.appendChild(btnRow);
|
|
6797
|
+
backdrop.appendChild(panel);
|
|
6798
|
+
document.body.appendChild(backdrop);
|
|
6799
|
+
|
|
6800
|
+
// Animate in
|
|
6801
|
+
void backdrop.offsetHeight;
|
|
6802
|
+
backdrop.style.opacity = '1';
|
|
6803
|
+
panel.style.transform = 'scale(1)';
|
|
6804
|
+
|
|
6805
|
+
// Escape key
|
|
6806
|
+
var escHandler = function(e) {
|
|
6807
|
+
if (e.key === 'Escape') { cleanup(isConfirm ? false : undefined); document.removeEventListener('keydown', escHandler); }
|
|
6808
|
+
};
|
|
6809
|
+
document.addEventListener('keydown', escHandler);
|
|
6810
|
+
|
|
6811
|
+
// Focus the primary button
|
|
6812
|
+
okBtn.focus();
|
|
6813
|
+
});
|
|
6814
|
+
}
|
|
6815
|
+
|
|
6816
|
+
function stxAlert(message, options) {
|
|
6817
|
+
return _createDialog(message, options, false);
|
|
6818
|
+
}
|
|
6819
|
+
|
|
6820
|
+
function stxConfirm(message, options) {
|
|
6821
|
+
return _createDialog(message, options, true);
|
|
6822
|
+
}
|
|
6823
|
+
|
|
6553
6824
|
// Component mount system
|
|
6554
6825
|
var mountQueue = [];
|
|
6555
6826
|
|
|
@@ -6598,6 +6869,10 @@ catch (e) {}
|
|
|
6598
6869
|
useDark,
|
|
6599
6870
|
useHead,
|
|
6600
6871
|
useSeoMeta,
|
|
6872
|
+
toast,
|
|
6873
|
+
modal,
|
|
6874
|
+
alert: stxAlert,
|
|
6875
|
+
confirm: stxConfirm,
|
|
6601
6876
|
helpers: globalHelpers,
|
|
6602
6877
|
|
|
6603
6878
|
// Component composition API (Phase 4)
|
|
@@ -7053,6 +7328,10 @@ else {
|
|
|
7053
7328
|
window.useDark = useDark;
|
|
7054
7329
|
window.useHead = useHead;
|
|
7055
7330
|
window.useSeoMeta = useSeoMeta;
|
|
7331
|
+
window.toast = toast;
|
|
7332
|
+
window.modal = modal;
|
|
7333
|
+
window.stxAlert = stxAlert;
|
|
7334
|
+
window.stxConfirm = stxConfirm;
|
|
7056
7335
|
window.defineStore = window.stx.defineStore;
|
|
7057
7336
|
window.useStore = window.stx.useStore;
|
|
7058
7337
|
window.ref = state;
|
|
@@ -7440,7 +7719,7 @@ catch (e) { console.warn('[stx] mount callback error:', e); }
|
|
|
7440
7719
|
}
|
|
7441
7720
|
}
|
|
7442
7721
|
})();
|
|
7443
|
-
`}var
|
|
7722
|
+
`}var yK;var w7=y(()=>{A7();A7();yK={state:j7,derived:O7,effect:H7,batch:L7,onMount:F7,onDestroy:V7,isSignal:H$,isDerived:L$,untrack:R7,peek:N7,generateSignalsRuntime:BZ,generateSignalsRuntimeDev:F$}});var M7={};o(M7,{templateCache:()=>zZ,readFileCached:()=>PK,invalidateFileCacheByDir:()=>vK,invalidateFileCache:()=>CK,hashFilePath:()=>J5,getCachedSignalsRuntime:()=>fK,getCachedRouterScript:()=>gK,clearDevCaches:()=>hK,checkCache:()=>dK,cacheTemplate:()=>mK});import O1 from"fs";import k1 from"path";async function PK($){try{let Y=(await O1.promises.stat($)).mtime.getTime(),X=H1.get($);if(X&&X.mtime===Y)return X.content;let Q=await Bun.file($).text();return H1.set($,{content:Q,mtime:Y}),Q}catch{throw H1.delete($),Error(`File not found: ${$}`)}}function CK($){H1.delete($)}function vK($){for(let Z of H1.keys())if(Z.startsWith($))H1.delete(Z)}async function fK($=!1){if($){let{generateSignalsRuntimeDev:Z}=await Promise.resolve().then(() => (w7(),T7));return Z()}if(V$===null){let{generateSignalsRuntime:Z}=await Promise.resolve().then(() => (w7(),T7));V$=Z()}return V$}async function gK(){if(R$===null){let{getRouterScript:$}=await import("stx-router");R$=$()}return R$}function hK(){H1.clear(),V$=null,xK=null,R$=null}async function dK($,Z){try{if(!Z.cachePath)return null;let Y=k1.resolve(Z.cachePath),X=k1.join(Y,`${J5($)}.html`),Q=k1.join(Y,`${J5($)}.meta.json`);if(!await c(X)||!await c(Q))return null;let J=await Bun.file(Q).text(),G=JSON.parse(J);if(G.cacheVersion!==Z.cacheVersion)return null;if((await O1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await c(q)){if((await O1.promises.stat(q)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(X).text()}catch(Y){return console.warn(`Cache error for ${$}:`,Y),null}}async function mK($,Z,Y,X){try{if(!X.cachePath)return;let Q=k1.resolve(X.cachePath);await O1.promises.mkdir(Q,{recursive:!0});let J=k1.join(Q,`${J5($)}.html`),G=k1.join(Q,`${J5($)}.meta.json`),K=await O1.promises.stat($);await Bun.write(J,Z);let q={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:X.cacheVersion,generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),zZ.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(Q){console.warn(`Failed to cache template ${$}:`,Q)}}function J5($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,uK)}var zZ,H1,V$=null,xK=null,R$=null,uK=16;var I7=y(()=>{L0();zZ=new Map,H1=new Map});function jZ($){if($.includes("window.StacksBrowser")||$.includes("StacksBrowser ="))return $;let Z=/<script\b(?![^>]*\bserver\b)[^>]*>([\s\S]*?)<\/script>/gi,Y="",X;while((X=Z.exec($))!==null)Y+=X[1]+`
|
|
7444
7723
|
`;let Q=/\{\{([\s\S]*?)\}\}/g;while((X=Q.exec($))!==null)Y+=X[1]+`
|
|
7445
7724
|
`;if(!Y.trim())return $;let G=["browserQuery","BrowserQueryBuilder","configureBrowser","createBrowserModel"].some((B)=>{return new RegExp(`\\b${B}\\b`).test(Y)}),K=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process"]),q=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,_,U=!1;while((_=q.exec(Y))!==null)if(!K.has(_[1])){U=!0;break}if(!G&&!U)return $;let W=`<script type="module">
|
|
7446
7725
|
// STX: Auto-load @stacksjs/browser (auto-initializes API and loads models)
|
|
@@ -7449,21 +7728,21 @@ import '@stacksjs/browser'
|
|
|
7449
7728
|
`+$.slice(z);return $.replace("</head>",`${W}
|
|
7450
7729
|
</head>`)}if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
|
|
7451
7730
|
${W}`);return W+`
|
|
7452
|
-
`+$}async function
|
|
7731
|
+
`+$}async function OZ($,Z){if($.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="compile"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script src="/__stx/runtime.__STX_HASH__.js"></script>
|
|
7453
7732
|
`+$.slice(K);if($.includes("</head>")){let q=$.indexOf("</head>");return $.slice(0,q)+`<script src="/__stx/runtime.__STX_HASH__.js"></script>
|
|
7454
7733
|
`+$.slice(q)}return`<script src="/__stx/runtime.__STX_HASH__.js"></script>
|
|
7455
|
-
`+$}let{getCachedSignalsRuntime:Y}=await Promise.resolve().then(() => (
|
|
7734
|
+
`+$}let{getCachedSignalsRuntime:Y}=await Promise.resolve().then(() => (I7(),M7)),Q=`<script data-stx-scoped>${await Y(Z.debug)}</script>`,J=$.indexOf("<script");if(J!==-1)return $.slice(0,J)+Q+`
|
|
7456
7735
|
`+$.slice(J);if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Q+`
|
|
7457
7736
|
`+$.slice(G)}if($.includes("<body")){let G=$.indexOf("<body"),K=$.indexOf(">",G);return $.slice(0,K+1)+`
|
|
7458
7737
|
`+Q+$.slice(K+1)}return Q+`
|
|
7459
|
-
`+$}async function
|
|
7460
|
-
`}let{getCachedRouterScript:Q}=await Promise.resolve().then(() => (
|
|
7461
|
-
</body>`+$.slice(G+7)}var
|
|
7738
|
+
`+$}async function HZ($,Z){if(!$.includes("</body>"))return $;if($.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Y=Z?.router,X="";if(Y){let K={};if(Y.container)K.container=Y.container;if(Y.viewTransitions!==void 0)K.viewTransitions=Y.viewTransitions;if(Y.viewTransitionDuration!==void 0)K.viewTransitionDuration=Y.viewTransitionDuration;if(Y.viewTransitionEasing!==void 0)K.viewTransitionEasing=Y.viewTransitionEasing;if(Y.scrollToTop!==void 0)K.scrollToTop=Y.scrollToTop;if(Y.prefetch!==void 0)K.prefetch=Y.prefetch;if(Y.cache!==void 0)K.cache=Y.cache;if(Y.progressColor!==void 0)K.progressColor=Y.progressColor;if(Y.progressHeight!==void 0)K.progressHeight=Y.progressHeight;if(Object.keys(K).length>0)X=`<script>window.__stxRouterConfig=${JSON.stringify(K)};</script>
|
|
7739
|
+
`}let{getCachedRouterScript:Q}=await Promise.resolve().then(() => (I7(),M7)),J=Z?.buildMode==="compile"?'<script src="/__stx/router.__STX_HASH__.js"></script>':`<script>${await Q()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+X+J+`
|
|
7740
|
+
</body>`+$.slice(G+7)}var AZ={};o(AZ,{scanScriptTags:()=>FZ,processSignals:()=>k7,processScriptSetup:()=>RZ,parseLoopExpression:()=>VZ,hasSignalsSyntax:()=>N$,extractExports:()=>NZ,convertSignalLoopsToAttributes:()=>D7,convertSignalDirectivesToAttributes:()=>E7});function FZ($,Z={}){let Y=[],X=/<script\b([^>]*)>/gi,Q;while((Q=X.exec($))!==null){let J=Q[1],G=Q.index+Q[0].length,K=$.toLowerCase().indexOf("</script>",G);if(K===-1)break;let q=K+9;if(Z.skipAttrs&&Z.skipAttrs.test(J)){X.lastIndex=q;continue}Y.push({fullMatch:$.slice(Q.index,q),attrs:J,body:$.slice(G,K),start:Q.index,end:q}),X.lastIndex=q}return Y}function VZ($){let Z=$.trim(),Y=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Y){let Q=Y[1].trim(),J=Y[2].trim(),{itemVar:G,indexVar:K}=LZ(J);if(G)return{style:"as",iterable:Q,itemVar:G,indexVar:K}}let X=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(X){let Q=X[1].trim(),J=X[2].trim(),{itemVar:G,indexVar:K}=LZ(Q);if(G)return{style:"in",iterable:J,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function LZ($){let Z=$.trim(),Y=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(Y)return{itemVar:Y[2],indexVar:Y[1]};let X=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(X)return{itemVar:X[1],indexVar:X[2]||null};let Q=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:Q[2]};let J=Z.match(/^(\w+)$/);if(J)return{itemVar:J[1],indexVar:null};return{itemVar:null,indexVar:null}}function N$($){return[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/].some((Y)=>Y.test($))}function pK($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Y=0,X;while((X=Z.exec($))!==null){let Q=X[1];if(Q.startsWith("if"))Y++;else if(Q==="endif")Y--;else if(Y===0)return!0}return!1}function E7($){let Z=$,Y=/@if\s*\(/g,X,Q=[];while((X=Y.exec(Z))!==null){let J=X.index,G=J+X[0].length,K=1,q=G;while(q<Z.length&&K>0){if(Z[q]==="(")K++;else if(Z[q]===")")K--;q++}if(K!==0)continue;let _=Z.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(Z))!==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=Z.substring(U,B-6).trim();if(pK(O))continue;let F=O.match(/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s),L;if(F){let[,H,V,N]=F,R=_.replace(/"/g,""");L=`<${H}${V} @if="${R}">${N}</${H}>`}else L=`<template @if="${_.replace(/"/g,""")}">${O}</template>`;Q.push({start:J,end:B,replacement:L})}for(let J=Q.length-1;J>=0;J--){let{start:G,end:K,replacement:q}=Q[J];Z=Z.substring(0,G)+q+Z.substring(K)}return Z}function D7($,Z){let Y=$,X=/@(for|foreach)\s*\(/g,Q,J=[];while((Q=X.exec(Y))!==null){let G=Q[1],K=Q.index,q=K+Q[0].length,_=1,U=q;while(U<Y.length&&_>0){if(Y[U]==="(")_++;else if(Y[U]===")")_--;U++}if(_!==0)continue;let W=Y.substring(q,U-1).trim(),B=U,j=VZ(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(Z){let T=A.split(/[.[(]/)[0].trim();if(T&&T in Z)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,F=B,L=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");L.lastIndex=B;let H;while((H=L.exec(Y))!==null)if(H[1].startsWith(G))O++;else if(O--,O===0){F=H.index+H[0].length;break}if(O!==0)continue;let V=Y.substring(B,F-z.length).trim(),N=V.match(/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s),R;if(N){let[,A,T,w]=N;R=`<${A}${T} @for="${W}">${w}</${A}>`}else R=`<template @for="${W}">${V}</template>`;J.push({start:K,end:F,replacement:R})}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:_}=J[G];Y=Y.substring(0,K)+_+Y.substring(q)}return Y}function cK($){let Z=new Set,Y=[],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]!==`
|
|
7462
7741
|
`)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]!==`
|
|
7463
|
-
`)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();Y.push($.slice(X,W)),X=W;continue}if(U==="/"&&$[X+1]==="*"){let W=q();Y.push($.slice(X,W)),X=W;continue}if(U==='"'||U==="'"||U==="`"){let W=G(U);Y.push($.slice(X,W)),X=W;continue}if(U==="{"){Q++,Y.push(U),X++;continue}if(U==="}"){Q--,Y.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],
|
|
7464
|
-
${
|
|
7742
|
+
`)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();Y.push($.slice(X,W)),X=W;continue}if(U==="/"&&$[X+1]==="*"){let W=q();Y.push($.slice(X,W)),X=W;continue}if(U==='"'||U==="'"||U==="`"){let W=G(U);Y.push($.slice(X,W)),X=W;continue}if(U==="{"){Q++,Y.push(U),X++;continue}if(U==="}"){Q--,Y.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(Z.has(z)){Y.push(`/* stx: deduped const ${z} */`),X=O;continue}Z.add(z),Y.push($.slice(X,O)),X=O;continue}}}Y.push(U),X++}return Y.join("")}async function RZ($,Z){let Y=FZ($,{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 Y){let z=j.body;if(Y1(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()}_${lK++}`,{hasUserImports:G,bundleClientScript:K}=await Promise.resolve().then(() => (u$(),m$)),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,Z||"",{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
|
|
7743
|
+
${O}`)}let _=q.join(`
|
|
7465
7744
|
|
|
7466
|
-
`);_=
|
|
7745
|
+
`);_=cK(_);let U=NZ(_),W=`
|
|
7467
7746
|
<script data-stx-scoped>
|
|
7468
7747
|
function ${J}() {
|
|
7469
7748
|
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;
|
|
@@ -7471,40 +7750,57 @@ ${_}
|
|
|
7471
7750
|
return { ${U} };
|
|
7472
7751
|
}
|
|
7473
7752
|
if(window.stx)window.stx._latestSetup=${J};
|
|
7474
|
-
</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,
|
|
7475
|
-
`)J++;return!0}if(Z[J]==="/"&&Z[J+1]==="*"){J+=2;while(J<G-1&&!(Z[J]==="*"&&Z[J+1]==="/"))J++;return J+=2,!0}return!1},U=()=>{if(Q!==0)return;let W=Z.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))Y.push(z),X.add(z);return}let B=Z.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let z=B[1];if(!X.has(z))Y.push(z),X.add(z);return}let j=Z.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))Y.push(z),X.add(z)}};while(J<G){if(_())continue;if(Z[J]==="'"||Z[J]==='"'){K(Z[J]);continue}if(Z[J]==="`"){q();continue}if(Z[J]==="{"){Q++,J++;continue}if(Z[J]==="}"){Q--,J++;continue}if(Q===0&&/[a-z]/i.test(Z[J])&&(J===0||/\s|[;{}()]/.test(Z[J-1])))U();J++}return Y.join(", ")}async function
|
|
7753
|
+
</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,F)=>{if(j.includes(O.toLowerCase()))return z;return`<${O}${F} data-stx="${J}">`})}return{output:B,setupCode:W}}function NZ($){let Z=$,Y=[],X=new Set,Q=0,J=0,G=Z.length,K=(W)=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]===W){J++;return}J++}},q=()=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]==="`"){J++;return}if(Z[J]==="$"&&Z[J+1]==="{"){J+=2;let W=1;while(J<G&&W>0)if(Z[J]==="{")W++;else if(Z[J]==="}")W--;else if(Z[J]==="'"||Z[J]==='"')K(Z[J]);else if(Z[J]==="`")q();else J++;continue}J++}},_=()=>{if(Z[J]==="/"&&Z[J+1]==="/"){while(J<G&&Z[J]!==`
|
|
7754
|
+
`)J++;return!0}if(Z[J]==="/"&&Z[J+1]==="*"){J+=2;while(J<G-1&&!(Z[J]==="*"&&Z[J+1]==="/"))J++;return J+=2,!0}return!1},U=()=>{if(Q!==0)return;let W=Z.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))Y.push(z),X.add(z);return}let B=Z.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let z=B[1];if(!X.has(z))Y.push(z),X.add(z);return}let j=Z.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))Y.push(z),X.add(z)}};while(J<G){if(_())continue;if(Z[J]==="'"||Z[J]==='"'){K(Z[J]);continue}if(Z[J]==="`"){q();continue}if(Z[J]==="{"){Q++,J++;continue}if(Z[J]==="}"){Q--,J++;continue}if(Q===0&&/[a-z]/i.test(Z[J])&&(J===0||/\s|[;{}()]/.test(Z[J-1])))U();J++}return Y.join(", ")}async function k7($,Z,Y){if(!N$($))return $;let X=$;if(Z.skipSignalsRuntime)return X;let{output:Q,setupCode:J}=await RZ(X,Y);if(X=Q,X=await OZ(X,Z),X=jZ(X),J)if(X.includes("</head>"))X=X.replace("</head>",`${J}
|
|
7476
7755
|
</head>`);else if(X.includes("<body"))X=X.replace(/<body([^>]*)>/,`<body$1>
|
|
7477
7756
|
${J}`);else X=X+`
|
|
7478
|
-
`+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
|
|
7479
|
-
`}if(V){let b=[];if(U==="avif"||U==="auto"){let S=
|
|
7757
|
+
`+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 lK=0;var S7=y(()=>{L0()});import D0 from"path";import b7 from"fs";function TZ($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function wZ($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class MZ{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,Y,X){let Q=$.endsWith(".stx")?$.slice(0,-4):$,J=X?.__importedComponents;if(J){let j=[Q,Q.toLowerCase(),TZ(Q),wZ(Q)];for(let z of j)if(J.has(z))return J.get(z)}let G=[...new Set([`${Q}.stx`,`${TZ(Q)}.stx`,`${wZ(Q)}.stx`])];if(Q.startsWith("./")||Q.startsWith("../")){let j=D0.resolve(D0.dirname(Z),`${Q}.stx`);if(await c(j))return j;return null}let K=[],q=Y.componentsDir||"",_=X?.__originalFilePath;if(_)K.push(D0.join(D0.dirname(_),"components"));if(q)K.push(q);let U=D0.join(D0.dirname(Z),"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(!b7.statSync(j,{throwIfNoEntry:!1})?.isDirectory())continue;let O=b7.readdirSync(j,{withFileTypes:!0});for(let F of O)if(F.isDirectory()){let L=D0.join(j,F.name);for(let H of G){let V=D0.join(L,H);if(await c(V))return V}}}catch{}}return null}}var u0;var y7=y(()=>{L0();u0=new MZ});function x0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function iK($){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 P7;var C7=y(()=>{P7={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let X=iK($),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="${x0(X.value)}"`);else q.push(`href="${x0(X.value)}"`);if(Q)q.push(`class="${x0(Q)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${x0(J)}"`),q.push(`data-stx-exact-active-class="${x0(G)}"`),K)q.push("data-stx-prefetch");for(let[U,W]of Object.entries($.events))q.push(`@${x0(U)}="${x0(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(x0(U))}else q.push(`${x0(U)}="${x0(W)}"`)}return`<a ${q.join(" ")}>${Z}</a>`}}});function _0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function A0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function x7($,Z,Y=!1){let X=$.serverDynamic[Z];if(X!==void 0)return X!==!1&&X!=="false";let Q=$.static[Z];if(Q!==void 0)return Q!=="false"&&Q!==!1;return Y}function IZ($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let X of Z)if(X.includes(":")){let[Q,J]=X.split(":"),G=nK[Q];if(G)Y.push(`(max-width: ${G}px) ${J}`);else{let K=Number.parseInt(Q);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${J}`)}}else Y.push(X);return Y.join(", ")}function f7($,Z,Y,X){return Z.map((Q)=>`${Q5($,Q,void 0,Y,X)} ${Q}w`).join(", ")}function sK($,Z,Y,X,Q){return Z.map((J)=>{let G=Y?Y*J:void 0;return`${Q5($,G,void 0,X,Q)} ${J}x`}).join(", ")}function Q5($,Z,Y,X,Q){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let J=[];if(Z)J.push(`w_${Z}`);if(Y)J.push(`h_${Y}`);if(Q)J.push(`f_${Q}`);J.push("q_auto");let G=J.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(X==="imgix"){let J=new URLSearchParams;if(Z)J.set("w",String(Z));if(Y)J.set("h",String(Y));if(Q)J.set("fm",Q);J.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${J.toString()}`}if(X==="bunny"){let J=new URLSearchParams;if(Z)J.set("width",String(Z));if(Y)J.set("height",String(Y));if(Q)J.set("format",Q);let G=$.includes("?")?"&":"?";return`${$}${G}${J.toString()}`}return $}function oK($,Z,Y="#e5e7eb"){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${Y}"/></svg>`;return`data:image/svg+xml;base64,${btoa(X)}`}var nK,v7,g7;var h7=y(()=>{nK={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},v7=[320,640,768,1024,1280,1536,1920];g7={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){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")||"",F=A0($,"quality"),L=x7($,"lazy",!0),H=x7($,"preload",!1),V=x7($,"picture",!1)||!!U,N=J?Number.parseInt(J):void 0,R=G?Number.parseInt(G):void 0,A=q||"",T="";if(!A&&K)A=f7(X,v7,j,U),T=IZ(K);else if(!A&&_){let b=_.split(/\s+/).map((S)=>Number.parseFloat(S.replace("x","")));A=sK(X,b,N,j,U)}else if(K)T=IZ(K);let w=[];if(O)w.push(O);if(N&&R)w.push(`aspect-ratio:${N}/${R}`);if(W==="blur"||W==="color"){let b=oK(N||16,R||9,B);w.push(`background-image:url(${b})`),w.push("background-size:cover"),w.push("background-repeat:no-repeat")}else if(W&&W!=="empty"&&W!=="none")w.push(`background-image:url(${_0(W)})`),w.push("background-size:cover"),w.push("background-repeat:no-repeat");let E=Q5(X,N,R,j,U),M=[];if(M.push(`src="${_0(E)}"`),M.push(`alt="${_0(Q)}"`),J)M.push(`width="${_0(J)}"`);if(G)M.push(`height="${_0(G)}"`);if(L)M.push('loading="lazy"');if(M.push('decoding="async"'),z)M.push(`class="${_0(z)}"`);if(w.length>0)M.push(`style="${_0(w.join(";"))}"`);if(A)M.push(`srcset="${_0(A)}"`);if(T)M.push(`sizes="${_0(T)}"`);let I=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);for(let[b,S]of Object.entries($.static)){if(I.has(b))continue;if(typeof S==="boolean"){if(S)M.push(_0(b))}else M.push(`${_0(b)}="${_0(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="${_0(E)}"${S?` type="${S}"`:""}${A?` imagesrcset="${_0(A)}"`:""}${T?` imagesizes="${_0(T)}"`:""} />
|
|
7758
|
+
`}if(V){let b=[];if(U==="avif"||U==="auto"){let S=Q5(X,N,R,j,"avif"),k=A?f7(X,v7,j,"avif"):`${S}`;b.push(`<source type="image/avif" srcset="${_0(k)}"${T?` sizes="${_0(T)}"`:""} />`)}if(U==="webp"||U==="auto"){let S=Q5(X,N,R,j,"webp"),k=A?f7(X,v7,j,"webp"):`${S}`;b.push(`<source type="image/webp" srcset="${_0(k)}"${T?` sizes="${_0(T)}"`:""} />`)}return`${P}<picture>
|
|
7480
7759
|
${b.join(`
|
|
7481
7760
|
`)}
|
|
7482
7761
|
${D}
|
|
7483
|
-
</picture>`}return`${
|
|
7762
|
+
</picture>`}return`${P}${D}`}}});function d7($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function G5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function A$($,Z,Y){let X=G5($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Y}var m7;var u7=y(()=>{m7={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,Y){let X=d7(G5($,"color")||"#6366f1"),Q=d7(G5($,"initialColor")||G5($,"initial-color")||""),J=d7(G5($,"height")||"3px"),G=A$($,"duration",2000),K=A$($,"throttle",200),q=A$($,"zIndex",999999)||A$($,"z-index",999999),_=Q?`linear-gradient(to right, ${Q}, ${X})`:X;return`
|
|
7484
7763
|
<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">
|
|
7485
7764
|
<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>
|
|
7486
7765
|
</div>
|
|
7487
7766
|
<style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
|
|
7488
7767
|
<script>
|
|
7489
7768
|
(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()})})();
|
|
7490
|
-
</script>`}}});
|
|
7491
|
-
|
|
7769
|
+
</script>`}}});function DZ($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function rK($,Z,Y){let X=DZ($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Y}var EZ,l7;var p7=y(()=>{EZ={"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%)"},l7={name:"StxToast",aliases:["stx-toast"],render($,Z,Y){let X=DZ($,"position")||"top-right",Q=rK($,"max",5),J=EZ[X]||EZ["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>
|
|
7770
|
+
<style>
|
|
7771
|
+
@keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
|
|
7772
|
+
@keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
|
|
7773
|
+
@keyframes stx-toast-in-left{from{opacity:0;transform:translateX(-100%)}to{opacity:1;transform:translateX(0)}}
|
|
7774
|
+
@keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
|
|
7775
|
+
@keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
|
|
7776
|
+
@keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
|
|
7777
|
+
</style>`}}});function T$($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var kZ,c7;var i7=y(()=>{kZ={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)"},c7={name:"StxModal",aliases:["stx-modal"],render($,Z,Y){let X=T$($,"id");if(!X)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Q=T$($,"size")||"md",J=T$($,"closeOnBackdrop")!=="false",G=T$($,"closeOnEscape")!=="false",K=kZ[Q]||kZ.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">
|
|
7778
|
+
<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)">
|
|
7779
|
+
<div style="padding:1.5rem">${Z}</div>
|
|
7780
|
+
</div>
|
|
7781
|
+
</div>
|
|
7782
|
+
<style>
|
|
7783
|
+
@media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
|
|
7784
|
+
.stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
|
|
7785
|
+
.stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
|
|
7786
|
+
</style>`}}});async function aK($){if(K5.has($))return K5.get($);try{let Z=e.resolve(`@iconify/json/json/${$}.json`),Y=await Bun.file(Z).json();return K5.set($,Y.icons),Y.icons}catch{try{let Y=`${process.cwd()}/node_modules/@iconify/json/json/${$}.json`,X=Bun.file(Y);if(await X.exists()){let Q=await X.json();return K5.set($,Q.icons),Q.icons}}catch{}}return null}function S1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);if($.static[Z]!==void 0)return String($.static[Z]);if($.clientReactive[Z]!==void 0)return $.clientReactive[Z];return}var K5,n7;var s7=y(()=>{K5=new Map;n7={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let X=S1($,"name")??S1($,"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=S1($,"size")||"24",K=S1($,"color")||"currentColor",q=S1($,"class")||"",_=S1($,"style")||"",U=K5.get(Q);if(!U)return aK(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 F=q?` class="${q}"`:"",L=_?` style="${_}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${z}" fill="none"${F}${L}>${O}</svg>`}}});function SZ(){u0.registerBuiltin(P7),u0.registerBuiltin(g7),u0.registerBuiltin(m7),u0.registerBuiltin(l7),u0.registerBuiltin(c7),u0.registerBuiltin(n7)}var bZ=y(()=>{C7();h7();u7();p7();i7();s7();y7();C7();h7();u7();p7();i7();s7()});function yZ($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function PZ($,Z,Y){let X=[],Q=0;while(Q<$.length){let J=$.indexOf("<",Q);if(J===-1)break;let K=$.slice(J+1).match(new RegExp(`^(${Z.source})`));if(!K){Q=J+1;continue}let q=K[1];if(Y&&Y.has(q.toLowerCase())){let 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}`,F=`</${q}>`,L=1,H=B,V=-1;while(L>0&&H<$.length){let A=$.indexOf(O,H),T=$.indexOf(F,H);if(T===-1)break;if(A!==-1&&A<T){let w=$[A+O.length];if(w===" "||w===">"||w==="/"||w===`
|
|
7787
|
+
`||w==="\t")L++;H=A+O.length}else{if(L--,L===0){V=T;break}H=T+F.length}}if(V===-1){Q=B;continue}let N=$.slice(B,V),R=V+F.length;X.push({fullMatch:$.slice(J,R),tagName:q,attributes:z,content:N,startIndex:J,endIndex:R,isSelfClosing:!1}),Q=R}}return X}var CZ=y(()=>{V0();L0()});import b1 from"path";function eK($,Z,Y){let X={static:{},serverDynamic:{},clientReactive:{},events:{}},Q=new Set(["x-cloak","x-show","x-if","x-for","x-data","x-init","x-transition","x-ref","x-effect","x-model","x-text","x-html","x-class","x-style","x-on","x-bind"]);for(let[J,G]of Object.entries($)){let K=J.startsWith("x-")&&!Q.has(J)&&!J.startsWith("x-bind:")&&!J.startsWith("x-on:")?`:${J.slice(2)}`:J;if(K.startsWith("@")){X.events[K]=G;continue}if(K.startsWith("__stx_")){let q=K.slice(6);try{let _=G.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");X.serverDynamic[q]=JSON.parse(_)}catch(_){if(Y.debug)console.error(`Error parsing __stx_${q}:`,_);X.serverDynamic[q]=G}continue}if(K.startsWith(":")){let q=K.slice(1),_=G==="true"?q:G;try{if(!t(_)){if(Y.debug)console.error(`Unsafe expression in :${q} binding: ${_}`);X.clientReactive[q]=_;continue}let U=Object.keys(Z),B=$0(_,U)(...Object.values(Z));if(B===void 0){let j=_.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],z=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(j.some((F)=>!z.has(F)&&!U.includes(F))){X.clientReactive[q]=_;continue}}X.serverDynamic[q]=B}catch{X.clientReactive[q]=_}continue}if(typeof G==="string"&&G.includes("{{")&&G.includes("}}")){let q=G.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(q)try{let _=q[1];if(t(_)){let W=$0(_,Object.keys(Z))(...Object.values(Z));X.static[K]=W!=null?String(W):""}else{if(Y.debug)console.error(`Unsafe expression in ${K}: ${_}`);X.static[K]=G}}catch(_){if(Y.debug)console.error(`Error evaluating expression for ${K}:`,_);X.static[K]=G}else{let _=G,U=/\{\{\s*([\s\S]+?)\s*\}\}/g,W;while((W=U.exec(G))!==null)try{let B=W[1];if(!t(B)){if(Y.debug)console.error(`Unsafe expression in ${K}: ${B}`);continue}let z=$0(B,Object.keys(Z))(...Object.values(Z));_=_.replace(W[0],String(z??""))}catch(B){if(Y.debug)console.error(`Error evaluating expression in ${K}:`,B)}X.static[K]=_}continue}X.static[K]=G}return X}function $q($){let Z={},Y=0,X=$.length;while(Y<X){while(Y<X&&/\s/.test($[Y]))Y++;if(Y>=X)break;let Q="";while(Y<X&&!/[\s=]/.test($[Y]))Q+=$[Y],Y++;if(!Q)break;while(Y<X&&/\s/.test($[Y]))Y++;if(Y<X&&$[Y]==="="){Y++;while(Y<X&&/\s/.test($[Y]))Y++;let J="";if(Y<X&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<X){let K=$[Y];if(K==="\\"&&Y+1<X){Y++,J+=$[Y],Y++;continue}if(K===G){Y++;break}J+=K,Y++}}else while(Y<X&&!/\s/.test($[Y]))J+=$[Y],Y++;Z[Q]=J}else Z[Q]="true"}return Z}async function Zq($,Z,Y,X,Q){let J=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(J))!==null){let[_,U]=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$/,""),F=O.includes("-")?O.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):O.charAt(0).toUpperCase()+O.slice(1),L=null,H=[b1.resolve(b1.dirname(Y),`${B}.stx`),b1.resolve(b1.dirname(Y),B),b1.resolve(X.componentsDir||"components",`${B}.stx`),b1.resolve(X.componentsDir||"components",B),B.endsWith(".stx")?B:`${B}.stx`];for(let V of H)try{if(await Bun.file(V).exists()){L=V;break}}catch{}if(L){G.set(F,L),G.set(O,L),G.set(O.toLowerCase(),L);let V=F.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,L),Q.add(L),X.debug)console.log(`Imported component: ${F} -> ${L}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${B}`)}J=J.replace(_,""),K.lastIndex=0}return J}async function Yq($,Z,Y,X,Q){let J=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=/@component\s*\(/g,_;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,F=z.match(/^\s*['"]([^'"]+)['"]/);if(!F){q.lastIndex=0;continue}let L=F[1],H,V=z.slice(F[0].length),N=V.match(/^\s*,\s*/);if(N)H=V.slice(N[0].length).trim();let R={};if(H)try{R=z0(H,Z)}catch(I){let D=I instanceof Error?I.message:String(I);J=J.replace(J.substring(U,O),`[Error parsing component props: ${D}]`);continue}let A="",T=O,E=J.substring(O).match(/^([\s\S]*?)@endcomponent/);if(E)A=E[1].trim(),T=O+E[0].length;let M=await q1(L,R,A,G,Z,Y,X,K,Q);J=J.substring(0,U)+M+J.substring(T),q.lastIndex=0}return J}async function Xq($,Z,Y,X,Q){if(!$)return $;let J=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__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,tK),J;async function W(B,j,z,O){if(!B)return B;let F=B,L=PZ(F,j,O);for(let H=L.length-1;H>=0;H--){let V=L[H],N=z?yZ(V.tagName):V.tagName,R=$q(V.attributes),A=eK(R,Z,X),T=u0.getBuiltin(V.tagName);if(T){let I={context:Z,filePath:Y,options:X,dependencies:Q},D=T.render(A,V.content,I);if(Object.keys(A.clientReactive).length>0)D=xZ(D,A.clientReactive);if(Object.keys(A.events).length>0){let P=Object.entries(A.events).map(([b,S])=>`${b}="${S.replace(/"/g,""")}"`).join(" ");D=D.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${P}`)}F=F.substring(0,V.startIndex)+D+F.substring(V.endIndex);continue}let w={};for(let[I,D]of Object.entries(A.static))w[I]=D;for(let[I,D]of Object.entries(A.serverDynamic))w[I]=D;let M=await q1(N,w,V.content,G,Z,Y,X,K,Q);if(Object.keys(A.clientReactive).length>0)M=xZ(M,A.clientReactive);if(Object.keys(A.events).length>0){let I=M.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(I){let D=Object.entries(A.events).map(([b,S])=>`${b}="${S}"`).join(" "),P=I[1].length+I[2].length;M=M.substring(0,P)+" "+D+M.substring(P)}}F=F.substring(0,V.startIndex)+M+F.substring(V.endIndex)}return F}}function xZ($,Z){let Y=$.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(!Y)return $;let X=Object.entries(Z).map(([J,G])=>`:${J}="${G.replace(/"/g,""")}"`).join(" "),Q=Y[1].length+Y[2].length;return $.substring(0,Q)+" "+X+$.substring(Q)}async function o7($,Z,Y,X,Q){if(!vZ)SZ(),vZ=!0;let J=await Zq($,Z,Y,X,Q);J=await Yq(J,Z,Y,X,Q);for(let G=0;G<3;G++){let K=J;if(J=await Xq(J,Z,Y,X,Q),J===K)break}return J}var vZ=!1,tK;var fZ=y(()=>{y7();bZ();CZ();L0();V0();tK=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 y1 from"path";function gZ($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}function hZ($,Z,Y){try{let X;if($.startsWith("/")){let Q=Z;for(let J=0;J<5;J++){let G=y1.join(Q,$);if(e("fs").existsSync(G))return G;Q=y1.dirname(Q)}X=y1.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))X=y1.resolve(Z,$);else X=y1.resolve(Z,$);if(e("fs").existsSync(X))return X;return null}catch{return null}}async function dZ($,Z,Y){let X=$,Q=y1.dirname(Z),J=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=J.exec(X))!==null){let[_,U,W,B]=G;if(gZ(W))continue;let j=hZ(W,Q,Z);if(j)try{let z=await Bun.file(j).text();if(Y.add(j),W.endsWith(".ts")||W.endsWith(".tsx")){let F=await Bun.build({entrypoints:[j],target:"browser",minify:!1});if(F.outputs.length>0)z=await F.outputs[0].text()}let O=`<script>
|
|
7492
7788
|
// Source: ${W}
|
|
7493
7789
|
${z}
|
|
7494
|
-
</script>`;X=X.replace(_,
|
|
7790
|
+
</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(gZ(W))continue;if(/rel=["']stylesheet["']/.test(j)||W.endsWith(".css")){let O=hZ(W,Q,Z);if(O)try{let F=await Bun.file(O).text();Y.add(O);let L=`<style>
|
|
7495
7791
|
/* Source: ${W} */
|
|
7496
7792
|
${F}
|
|
7497
|
-
</style>`;X=X.replace(_,L),K.lastIndex=0}catch(F){}}}return X}var
|
|
7793
|
+
</style>`;X=X.replace(_,L),K.lastIndex=0}catch(F){}}}return X}var mZ=()=>{};function w$($,Z){let Y=$,X=/@json\s*\(/g,Q;while((Q=X.exec(Y))!==null){let J=Q.index,G=J+Q[0].length-1,K=1,q=G+1,_=null,U=!1;while(q<Y.length&&K>0){let V=Y[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=Y.substring(G+1,q).trim(),B=Y.substring(J,q+1),j=-1,z=0,O=null,F=!1;for(let V=0;V<W.length;V++){let N=W[V];if(F){F=!1;continue}if(N==="\\"&&O){F=!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 L=j>=0?W.substring(0,j).trim():W,H=j>=0?W.substring(j+1).trim():void 0;try{let V=L.trim(),N;if(t(V))N=$0(V,Object.keys(Z))(...Object.values(Z));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");Y=Y.substring(0,J)+A+Y.substring(q+1),X.lastIndex=J+A.length}catch(V){B1.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),X.lastIndex=J+B.length}}return Y}function M$($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function uZ($){let Z=$,Y=/@memo\s*\(/g,X,Q=[];while((X=Y.exec(Z))!==null){let J=X.index,G=J+X[0].length,K=1,q=G;while(q<Z.length&&K>0){if(Z[q]==="(")K++;else if(Z[q]===")")K--;q++}if(K!==0)continue;let _=Z.slice(G,q-1).trim(),U=q,W=Z.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*)*)/),F=O?O[0].length:0,L=j.slice(F),H=j.match(/(\s*)$/),V=H?H[0].length:0,N=L.slice(0,L.length-V),R=N.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),A;if(R){let[T,w,E="",M]=R,I=`<${w}${E} data-stx-memo="${_}"${M}>`;A=j.slice(0,F)+I+N.slice(T.length)+j.slice(F+N.length)}else A=`${j.slice(0,F)}<div data-stx-memo="${_}">${N}</div>${j.slice(F+N.length)}`;Q.push({start:J,end:z,replacement:A}),Y.lastIndex=z}for(let J=Q.length-1;J>=0;J--){let G=Q[J];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function r7($){let Z=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Z=Z.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Z}function lZ($){let Y=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),X="",Q=0,J;while((J=Y.exec($))!==null){let G=J.index,K=G+J[0].length,q=!1,_=!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 a7=y(()=>{m0();V0()});function I$($,Z,Y){let X=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},Q=X.allowPatterns??[],J=[];for(let{pattern:G,message:K,suggestion:q}of Jq){if(Q.some((U)=>K.includes(U)||G.source.includes(U)))continue;G.lastIndex=0;let _=$.match(G);if(_&&_.length>0){let U=$.split(`
|
|
7498
7794
|
`),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}
|
|
7499
7795
|
\u2192 ${q}`)}}if(J.length>0&&X.enabled){let K=`[STX] DOM API violation in ${Z.split("/").pop()||Z}:
|
|
7500
7796
|
${J.join(`
|
|
7501
7797
|
`)}
|
|
7502
|
-
Tip: prefer useRef(), navigate(), and composables for component code`;if(X.failOnViolation)throw Error(K);else console.warn(K)}}var
|
|
7503
|
-
${W.trim()}`)}catch(W){console.warn(`[stx] Failed to load store ${U}:`,W)}if(K.length===0)return
|
|
7798
|
+
Tip: prefer useRef(), navigate(), and composables for component code`;if(X.failOnViolation)throw Error(K);else console.warn(K)}}var Jq;var t7=y(()=>{Jq=[{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 pZ={};o(pZ,{getStoreScript:()=>Qq,clearStoreCache:()=>Gq});import E$ from"path";async function Qq($){let Z;if($)Z=E$.resolve($);else{let U=await Y$();Z=E$.resolve(U.root||process.cwd(),U.storesDir||"stores")}let Y=P1.get(Z);if(Y!==void 0)return Y||null;let X=new Bun.Glob("*.ts"),Q=[];try{for await(let U of X.scan({cwd:Z,absolute:!0})){let W=E$.basename(U,".ts");if(["index","types"].includes(W))continue;if(U.includes(".d.ts"))continue;Q.push(U)}}catch{return P1.set(Z,""),null}if(Q.length===0)return P1.set(Z,""),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"});for(let U of G)try{let W=await Bun.file(U).text(),B=E$.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}
|
|
7799
|
+
${W.trim()}`)}catch(W){console.warn(`[stx] Failed to load store ${U}:`,W)}if(K.length===0)return P1.set(Z,""),null;let _=`;(function(){
|
|
7504
7800
|
${K.join(`
|
|
7505
7801
|
|
|
7506
7802
|
`)}
|
|
7507
|
-
})();`;return
|
|
7803
|
+
})();`;return P1.set(Z,_),_}function Gq(){P1.clear()}var P1;var cZ=y(()=>{X$();P1=new Map});var nZ={};o(nZ,{processDeferDirectives:()=>Wq});function Kq(){return`stx-defer-${++iZ}`}function qq($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function Uq($,Z,Y){let{trigger:X,value:Q}=qq(Z),J=Y,G,K,q,_=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(_)G=_[1].trim(),J=J.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let U=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(U)K=U[1].trim(),J=J.replace(/@loading[\s\S]*?(?=@error|$)/,"");let W=Y.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 _q($,Z){let{trigger:Y,triggerValue:X}=Z,Q;switch(Y){case"visible":Q=`
|
|
7508
7804
|
const observer = new IntersectionObserver((entries) => {
|
|
7509
7805
|
if (entries[0].isIntersecting) {
|
|
7510
7806
|
observer.disconnect();
|
|
@@ -7577,7 +7873,7 @@ else {
|
|
|
7577
7873
|
${Q}
|
|
7578
7874
|
})();
|
|
7579
7875
|
</script>
|
|
7580
|
-
`}function
|
|
7876
|
+
`}function Wq($,Z,Y){iZ=0;let X=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(X,(Q,J,G)=>{let K=Kq(),q=Uq(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=_q(K,q);return`
|
|
7581
7877
|
<div id="${K}" class="stx-defer" data-defer-trigger="${q.trigger}">
|
|
7582
7878
|
${_}
|
|
7583
7879
|
${U}
|
|
@@ -7585,7 +7881,7 @@ else {
|
|
|
7585
7881
|
${W}
|
|
7586
7882
|
</div>
|
|
7587
7883
|
${j}
|
|
7588
|
-
`})}var
|
|
7884
|
+
`})}var iZ=0;var oZ={};o(oZ,{processTeleportDirectives:()=>Oq,ensureTeleportTargets:()=>Hq});function Bq(){return`stx-teleport-${++sZ}`}function zq($){let Z=$.split(",").map((Q)=>Q.trim()),Y=Z[0].replace(/['"]/g,""),X;for(let Q=1;Q<Z.length;Q++){let J=Z[Q].match(/disabled:\s*(.+)/);if(J)X=J[1].trim()}return{target:Y,disabled:X}}function jq($,Z){return`
|
|
7589
7885
|
<script>
|
|
7590
7886
|
(function() {
|
|
7591
7887
|
const source = document.getElementById('${$}');
|
|
@@ -7621,12 +7917,12 @@ else {
|
|
|
7621
7917
|
}));
|
|
7622
7918
|
})();
|
|
7623
7919
|
</script>
|
|
7624
|
-
`}function
|
|
7920
|
+
`}function Oq($,Z,Y){sZ=0;let X=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(X,(Q,J,G)=>{let K=Bq(),{target:q,disabled:_}=zq(J),U=G.trim();if(_)try{let B=!1;if(_==="true")B=!0;else if(_==="false")B=!1;else if(_ in Z)B=Boolean(Z[_]);if(B)return`<div class="stx-teleport-inline" data-teleport-disabled>${U}</div>`}catch{}let W=jq(K,q);return`
|
|
7625
7921
|
<div id="${K}" class="stx-teleport-source" style="display: none;">
|
|
7626
7922
|
<template>${U}</template>
|
|
7627
7923
|
</div>
|
|
7628
7924
|
${W}
|
|
7629
|
-
`})}function
|
|
7925
|
+
`})}function Hq(){return`
|
|
7630
7926
|
<script>
|
|
7631
7927
|
(function() {
|
|
7632
7928
|
// Common teleport targets
|
|
@@ -7643,7 +7939,7 @@ else {
|
|
|
7643
7939
|
});
|
|
7644
7940
|
})();
|
|
7645
7941
|
</script>
|
|
7646
|
-
`}var
|
|
7942
|
+
`}var sZ=0;var eZ={};o(eZ,{processTransitionDirectives:()=>Rq,processTransitionAttributes:()=>wq,performLeave:()=>Vq,performEnter:()=>Fq,generateTransitionRuntime:()=>Tq,generateTransitionCSS:()=>Aq});function rZ($,Z={}){return{enterFrom:Z.enterClass||`${$}-enter-from`,enterActive:Z.enterActiveClass||`${$}-enter-active`,enterTo:Z.enterToClass||`${$}-enter-to`,leaveFrom:Z.leaveClass||`${$}-leave-from`,leaveActive:Z.leaveActiveClass||`${$}-leave-active`,leaveTo:Z.leaveToClass||`${$}-leave-to`}}function Lq($){let Z=getComputedStyle($),Y=Z.transitionDuration||"0s",X=Z.animationDuration||"0s",Q=(J)=>{let G=J.match(/^([\d.]+)(s|ms)?$/);if(!G)return 0;let K=parseFloat(G[1]);return(G[2]||"s")==="ms"?K:K*1000};return Math.max(Q(Y),Q(X))}function aZ($,Z){return new Promise((Y)=>{let X=Z??Lq($);if(X===0){Y();return}let Q=!1,J=()=>{if(Q)return;Q=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),Y()},G=(K)=>{if(K.target===$)J()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(J,X+50)})}function tZ($){$.offsetHeight}async function Fq($,Z={}){let Y=Z.name||"stx",X=rZ(Y,Z),Q=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(X.enterFrom),$.classList.add(X.enterActive),tZ($),$.classList.remove(X.enterFrom),$.classList.add(X.enterTo),Z.onEnter)await new Promise((J)=>{Z.onEnter($,J)});else await aZ($,Q);$.classList.remove(X.enterActive),$.classList.remove(X.enterTo),Z.onAfterEnter?.($)}async function Vq($,Z={}){let Y=Z.name||"stx",X=rZ(Y,Z),Q=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(X.leaveFrom),$.classList.add(X.leaveActive),tZ($),$.classList.remove(X.leaveFrom),$.classList.add(X.leaveTo),Z.onLeave)await new Promise((J)=>{Z.onLeave($,J)});else await aZ($,Q);$.classList.remove(X.leaveActive),$.classList.remove(X.leaveTo),Z.onAfterLeave?.($)}function Rq($,Z={},Y){let X=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(X,(Q,J,G)=>{let K=Nq(J),q=K.name||"stx",_=K.duration||300,U=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
|
|
7647
7943
|
<div
|
|
7648
7944
|
class="stx-transition-wrapper"
|
|
7649
7945
|
data-transition="${q}"
|
|
@@ -7685,7 +7981,7 @@ else {
|
|
|
7685
7981
|
});
|
|
7686
7982
|
})();
|
|
7687
7983
|
</script>
|
|
7688
|
-
`})}function
|
|
7984
|
+
`})}function Nq($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3]||X[4]||X[5];switch(Q){case"name":Z.name=J;break;case"duration":Z.duration=parseInt(J,10);break;case"mode":Z.mode=J;break;case"easing":Z.easing=J;break}}return Z}function Aq(){return`
|
|
7689
7985
|
/* STX Transition Presets */
|
|
7690
7986
|
|
|
7691
7987
|
/* Fade */
|
|
@@ -7872,7 +8168,7 @@ else {
|
|
|
7872
8168
|
opacity: 1;
|
|
7873
8169
|
max-height: 1000px;
|
|
7874
8170
|
}
|
|
7875
|
-
`}function
|
|
8171
|
+
`}function Tq(){return`
|
|
7876
8172
|
// STX Transition Runtime
|
|
7877
8173
|
(function() {
|
|
7878
8174
|
if (typeof window === 'undefined') return;
|
|
@@ -7961,7 +8257,7 @@ else {
|
|
|
7961
8257
|
|
|
7962
8258
|
console.log('[stx] Transition runtime initialized');
|
|
7963
8259
|
})();
|
|
7964
|
-
`}function
|
|
8260
|
+
`}function wq($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(Y,X,Q,J)=>{let G=Q||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${X}" data-stx-transition-duration="${G}" data-stx-transition-condition="${J}" data-stx-transition-id="${K}"`})}var ZY={};o(ZY,{withErrorBoundary:()=>$Y,processErrorBoundaryDirectives:()=>Eq,generateErrorBoundaryRuntime:()=>yq,generateErrorBoundaryCSS:()=>bq,createErrorBoundary:()=>Sq});function Iq(){return`eb-${++Mq}-${Date.now().toString(36)}`}function Eq($,Z={},Y){let X=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(X,(Q,J,G,K)=>{let q=Iq(),_=Dq(J||"");return kq(q,G.trim(),K.trim(),_)})}function Dq($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3]||X[4];switch(Q){case"id":Z.id=J;break;case"logErrors":Z.logErrors=J==="true";break}}return Z}function kq($,Z,Y,X){let Q=X.logErrors!==!1;return`
|
|
7965
8261
|
<div class="stx-error-boundary" data-boundary-id="${$}" data-has-error="false">
|
|
7966
8262
|
<div class="stx-error-boundary-content" data-boundary-content="${$}">
|
|
7967
8263
|
${Z}
|
|
@@ -8081,7 +8377,7 @@ else {
|
|
|
8081
8377
|
};
|
|
8082
8378
|
})();
|
|
8083
8379
|
</script>
|
|
8084
|
-
`}async function
|
|
8380
|
+
`}async function $Y($,Z,Y){try{return await $()}catch(X){if(Y)Y(X instanceof Error?X:Error(String(X)));else console.error("[stx:errorBoundary] SSR Error:",X);return Z}}function Sq($,Z={}){let Y=Z.onError?(X)=>Z.onError(X,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(X)=>$Y(X,$,Y)}function bq(){return`
|
|
8085
8381
|
/* STX Error Boundary Styles */
|
|
8086
8382
|
.stx-error-boundary {
|
|
8087
8383
|
position: relative;
|
|
@@ -8125,7 +8421,7 @@ else {
|
|
|
8125
8421
|
color: #fecaca;
|
|
8126
8422
|
}
|
|
8127
8423
|
}
|
|
8128
|
-
`}function
|
|
8424
|
+
`}function yq(){return`
|
|
8129
8425
|
// STX Error Boundary Runtime
|
|
8130
8426
|
(function() {
|
|
8131
8427
|
if (typeof window === 'undefined') return;
|
|
@@ -8190,7 +8486,7 @@ else {
|
|
|
8190
8486
|
|
|
8191
8487
|
console.log('[stx] Error boundary runtime initialized');
|
|
8192
8488
|
})();
|
|
8193
|
-
`}var
|
|
8489
|
+
`}var Mq=0;var YY={};o(YY,{renderSSRSuspense:()=>hq,processSuspenseDirectives:()=>vq,generateSuspenseRuntime:()=>mq,generateSuspenseCSS:()=>dq,createSSRSuspense:()=>gq});function Cq(){return`suspense-${++Pq}-${Date.now().toString(36)}`}function vq($,Z={},Y){let X=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(X,(Q,J,G,K)=>{let q=Cq(),_=xq(J||"");return fq(q,G.trim(),K.trim(),_)})}function xq($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4];switch(Q){case"id":Z.id=J;break;case"timeout":Z.timeout=G?parseInt(G,10):void 0;break}}return Z}function fq($,Z,Y,X){let Q=X.timeout||30000,J=X.id||$;return`
|
|
8194
8490
|
<div class="stx-suspense" data-suspense-id="${$}" data-custom-id="${J}" data-status="pending">
|
|
8195
8491
|
<div class="stx-suspense-fallback" data-suspense-fallback="${$}">
|
|
8196
8492
|
${Y}
|
|
@@ -8380,7 +8676,7 @@ else {
|
|
|
8380
8676
|
}, 0);
|
|
8381
8677
|
})();
|
|
8382
8678
|
</script>
|
|
8383
|
-
`}function
|
|
8679
|
+
`}function gq($,Z,Y){return{id:$,fallback:Y,content:Z}}async function hq($){let Z=$.map((X)=>`
|
|
8384
8680
|
<div id="stx-ssr-suspense-${X.id}" class="stx-ssr-suspense">
|
|
8385
8681
|
${X.fallback}
|
|
8386
8682
|
</div>
|
|
@@ -8405,7 +8701,7 @@ else {
|
|
|
8405
8701
|
}
|
|
8406
8702
|
})();
|
|
8407
8703
|
</script>
|
|
8408
|
-
`}}return{initial:Z,streaming:Y()}}function
|
|
8704
|
+
`}}return{initial:Z,streaming:Y()}}function dq(){return`
|
|
8409
8705
|
/* STX Suspense Styles */
|
|
8410
8706
|
.stx-suspense {
|
|
8411
8707
|
position: relative;
|
|
@@ -8461,7 +8757,7 @@ else {
|
|
|
8461
8757
|
background-size: 200% 100%;
|
|
8462
8758
|
}
|
|
8463
8759
|
}
|
|
8464
|
-
`}function
|
|
8760
|
+
`}function mq(){return`
|
|
8465
8761
|
// STX Suspense Runtime
|
|
8466
8762
|
(function() {
|
|
8467
8763
|
if (typeof window === 'undefined') return;
|
|
@@ -8528,7 +8824,7 @@ else {
|
|
|
8528
8824
|
|
|
8529
8825
|
console.log('[stx] Suspense runtime initialized');
|
|
8530
8826
|
})();
|
|
8531
|
-
`}var
|
|
8827
|
+
`}var Pq=0;var GY={};o(GY,{processAsyncDirectives:()=>lq,isAsyncComponent:()=>cq,generateAsyncComponentRuntime:()=>nq,generateAsyncComponentCSS:()=>iq,defineAsyncComponent:()=>pq});function XY(){return`async-${++uq}-${Date.now().toString(36)}`}function lq($,Z={},Y){let X=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,Q=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,J=$;return J=J.replace(X,(G,K,q,_)=>{let U=XY(),W=JY(K);return QY(U,W,q.trim(),_.trim())}),J=J.replace(Q,(G,K,q)=>{let _=XY(),U=JY(K);return QY(_,U,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),J}function JY($){let Z={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4],K=X[5];switch(Q){case"component":Z.component=J||K||"";break;case"timeout":Z.timeout=G?parseInt(G,10):30000;break;case"delay":Z.delay=G?parseInt(G,10):200;break;case"suspensible":Z.suspensible=K==="true";break;case"retries":Z.retries=G?parseInt(G,10):0;break;case"loadingComponent":Z.loadingComponent=J||K;break;case"errorComponent":Z.errorComponent=J||K;break}}return Z}function QY($,Z,Y,X){let{component:Q,timeout:J,delay:G,suspensible:K,retries:q}=Z;return`
|
|
8532
8828
|
<div class="stx-async-component" data-async-id="${$}" data-component="${Q}" data-status="pending">
|
|
8533
8829
|
<div class="stx-async-loading" data-async-loading="${$}">
|
|
8534
8830
|
${Y}
|
|
@@ -8713,7 +9009,7 @@ catch (error) {
|
|
|
8713
9009
|
loadComponent();
|
|
8714
9010
|
})();
|
|
8715
9011
|
</script>
|
|
8716
|
-
`}function
|
|
9012
|
+
`}function pq($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function cq($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function iq(){return`
|
|
8717
9013
|
/* STX Async Component Styles */
|
|
8718
9014
|
.stx-async-component {
|
|
8719
9015
|
position: relative;
|
|
@@ -8787,7 +9083,7 @@ catch (error) {
|
|
|
8787
9083
|
background-size: 200% 100%;
|
|
8788
9084
|
}
|
|
8789
9085
|
}
|
|
8790
|
-
`}function
|
|
9086
|
+
`}function nq(){return`
|
|
8791
9087
|
// STX Async Component Runtime
|
|
8792
9088
|
(function() {
|
|
8793
9089
|
if (typeof window === 'undefined') return;
|
|
@@ -8841,7 +9137,7 @@ catch (error) {
|
|
|
8841
9137
|
|
|
8842
9138
|
console.log('[stx] Async component runtime initialized');
|
|
8843
9139
|
})();
|
|
8844
|
-
`}var
|
|
9140
|
+
`}var uq=0;var qY={};o(qY,{shouldCacheComponent:()=>eq,processKeepAliveDirectives:()=>oq,onDeactivated:()=>XU,onActivated:()=>YU,generateKeepAliveRuntime:()=>ZU,generateKeepAliveCSS:()=>$U,createKeepAliveCache:()=>tq});function KY(){return`keep-alive-${++sq}-${Date.now().toString(36)}`}function oq($,Z={},Y){let X=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(X,(Q,J,G)=>{let K=KY(),q=rq(J||"");return aq(K,G.trim(),q)})}function rq($){let Z={max:10},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4];switch(Q){case"max":Z.max=G?parseInt(G,10):10;break;case"include":Z.include=J;break;case"exclude":Z.exclude=J;break;case"id":Z.id=J;break}}return Z}function aq($,Z,Y){let{max:X,include:Q,exclude:J}=Y,G=Y.id||$;return`
|
|
8845
9141
|
<div class="stx-keep-alive" data-keep-alive-id="${$}" data-custom-id="${G}">
|
|
8846
9142
|
<div class="stx-keep-alive-content" data-keep-alive-content="${$}">
|
|
8847
9143
|
${Z}
|
|
@@ -9128,7 +9424,7 @@ else {
|
|
|
9128
9424
|
});
|
|
9129
9425
|
})();
|
|
9130
9426
|
</script>
|
|
9131
|
-
`}function
|
|
9427
|
+
`}function tq($={}){return{id:$.id||KY(),cache:new Map,max:$.max||10,include:$.include?$.include.split(",").map((Y)=>Y.trim()):null,exclude:$.exclude?$.exclude.split(",").map((Y)=>Y.trim()):null}}function eq($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function $U(){return`
|
|
9132
9428
|
/* STX Keep-Alive Styles */
|
|
9133
9429
|
.stx-keep-alive {
|
|
9134
9430
|
position: relative;
|
|
@@ -9153,7 +9449,7 @@ else {
|
|
|
9153
9449
|
.stx-keep-alive-content > [data-activated] {
|
|
9154
9450
|
opacity: 1;
|
|
9155
9451
|
}
|
|
9156
|
-
`}function
|
|
9452
|
+
`}function ZU(){return`
|
|
9157
9453
|
// STX Keep-Alive Runtime
|
|
9158
9454
|
(function() {
|
|
9159
9455
|
if (typeof window === 'undefined') return;
|
|
@@ -9189,10 +9485,10 @@ else {
|
|
|
9189
9485
|
|
|
9190
9486
|
console.log('[stx] Keep-alive runtime initialized');
|
|
9191
9487
|
})();
|
|
9192
|
-
`}function
|
|
9488
|
+
`}function YU($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function XU($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var sq=0;var zY={};o(zY,{useVirtualList:()=>_Y,processVirtualListDirectives:()=>$6,processVirtualGridDirectives:()=>BY,processInfiniteListDirectives:()=>WY,generateVirtualListCSS:()=>UY,default:()=>JU,createVirtualList:()=>e7});function e7($,Z){let{itemHeight:Y,containerHeight:X,overscan:Q=3,keyProperty:J="id",dynamicHeight:G=!1,estimatedItemHeight:K=Y,direction:q="vertical"}=Z,_=[...$],U=0,W=new Map;function B(){if(G)return j();let A=Math.max(0,Math.floor(U/Y)-Q),T=Math.ceil(X/Y),w=Math.min(_.length-1,A+T+Q*2);return{startIndex:A,endIndex:w}}function j(){let A=0,T=0,w=_.length-1;for(let E=0;E<_.length;E++){let M=W.get(E)||K;if(A+M>U){T=Math.max(0,E-Q);break}A+=M}A=0;for(let E=0;E<_.length;E++){let M=W.get(E)||K;if(A+=M,A>U+X){w=Math.min(_.length-1,E+Q);break}}return{startIndex:T,endIndex:w}}function z(){if(G){let A=0;for(let T=0;T<_.length;T++)A+=W.get(T)||K;return A}return _.length*Y}function O(A){if(G){let T=0;for(let w=0;w<A;w++)T+=W.get(w)||K;return T}return A*Y}function F(){let{startIndex:A,endIndex:T}=B();return{startIndex:A,endIndex:T,scrollTop:U,totalHeight:z(),visibleItems:_.slice(A,T+1),itemHeights:new Map(W)}}function L(A,T="auto"){let w=O(A);H(w,T)}function H(A,T="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:L,scrollToOffset:H,getState:F,refresh:V,setItems:N,destroy:R}}function $6($,Z={},Y){let X=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(X,(Q,J,G,K)=>{let q=J.trim(),_=Z[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),F="";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));F+=`
|
|
9193
9489
|
<div class="virtual-item ${U.itemClass||""}"
|
|
9194
|
-
style="position: absolute; top: ${
|
|
9195
|
-
data-index="${
|
|
9490
|
+
style="position: absolute; top: ${H*U.itemHeight}px; height: ${U.itemHeight}px; width: 100%;"
|
|
9491
|
+
data-index="${H}">
|
|
9196
9492
|
${N}
|
|
9197
9493
|
</div>`}let L=_.length*U.itemHeight;return`
|
|
9198
9494
|
<div id="${W}"
|
|
@@ -9266,7 +9562,7 @@ else {
|
|
|
9266
9562
|
};
|
|
9267
9563
|
})();
|
|
9268
9564
|
</script>
|
|
9269
|
-
`})}function
|
|
9565
|
+
`})}function UY(){return`
|
|
9270
9566
|
.virtual-list-container {
|
|
9271
9567
|
position: relative;
|
|
9272
9568
|
overflow-y: auto;
|
|
@@ -9314,7 +9610,7 @@ else {
|
|
|
9314
9610
|
0% { background-position: 200% 0; }
|
|
9315
9611
|
100% { background-position: -200% 0; }
|
|
9316
9612
|
}
|
|
9317
|
-
`}function
|
|
9613
|
+
`}function _Y($,Z){let Y=null,X=()=>{if(!Y)Y=e7($(),Z);return Y};return{visibleItems:()=>{return X().getState().visibleItems},totalHeight:()=>{return X().getState().totalHeight},containerProps:()=>({style:{height:`${Z.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(Q)=>{let J=Q.target;if(Y)Y.scrollToOffset(J.scrollTop)}}),itemProps:(Q)=>({style:{position:"absolute",top:`${Q*Z.itemHeight}px`,height:`${Z.itemHeight}px`,width:"100%"},"data-index":Q}),scrollToIndex:(Q)=>{X().scrollToIndex(Q)}}}function WY($,Z={},Y){let X=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(X,(Q,J,G,K,q)=>{let _=J.trim(),U=Z[_];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=$6(`@virtualList(${_}, ${JSON.stringify({itemHeight:W.itemHeight,containerHeight:W.containerHeight,overscan:W.overscan,containerClass:W.containerClass})})${K}@endvirtualList`,Z);return j=j.replace("</script>",`
|
|
9318
9614
|
// Infinite scroll detection
|
|
9319
9615
|
container.addEventListener('scroll', function() {
|
|
9320
9616
|
const scrollBottom = container.scrollTop + container.clientHeight;
|
|
@@ -9332,7 +9628,7 @@ else {
|
|
|
9332
9628
|
${q}
|
|
9333
9629
|
</div>
|
|
9334
9630
|
</div>
|
|
9335
|
-
`})}function
|
|
9631
|
+
`})}function BY($,Z={},Y){let X=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(X,(Q,J,G,K)=>{let q=J.trim(),_=Z[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,F=0,L=Math.min(B-1,z+O),H="";for(let V=F;V<=L;V++)for(let N=0;N<U.columns;N++){let R=V*U.columns+N;if(R>=_.length)break;let A=_[R],T=N*(100/U.columns),w=V*(U.rowHeight+(U.gap||0)),E=K.replace(/\{\{\s*item\s*\}\}/g,typeof A==="object"?JSON.stringify(A):String(A)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(M,I)=>{if(typeof A==="object"&&A!==null)return String(A[I]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(R));H+=`
|
|
9336
9632
|
<div class="virtual-grid-item"
|
|
9337
9633
|
style="position: absolute; top: ${w}px; left: ${T}%; width: calc(${100/U.columns}% - ${U.gap||0}px); height: ${U.rowHeight}px;"
|
|
9338
9634
|
data-index="${R}">
|
|
@@ -9343,7 +9639,7 @@ else {
|
|
|
9343
9639
|
style="position: relative; height: ${U.containerHeight}px; overflow-y: auto;">
|
|
9344
9640
|
<div class="virtual-grid-viewport"
|
|
9345
9641
|
style="position: relative; height: ${j}px; width: 100%;">
|
|
9346
|
-
${
|
|
9642
|
+
${H}
|
|
9347
9643
|
</div>
|
|
9348
9644
|
</div>
|
|
9349
9645
|
<script data-virtual-grid="${W}">
|
|
@@ -9356,7 +9652,7 @@ else {
|
|
|
9356
9652
|
const rowHeight = ${U.rowHeight};
|
|
9357
9653
|
const gap = ${U.gap||0};
|
|
9358
9654
|
const totalItems = ${_.length};
|
|
9359
|
-
const overscan = ${
|
|
9655
|
+
const overscan = ${O};
|
|
9360
9656
|
const containerHeight = ${U.containerHeight};
|
|
9361
9657
|
const items = ${JSON.stringify(_)};
|
|
9362
9658
|
const template = ${JSON.stringify(K.trim())};
|
|
@@ -9402,7 +9698,7 @@ else {
|
|
|
9402
9698
|
});
|
|
9403
9699
|
})();
|
|
9404
9700
|
</script>
|
|
9405
|
-
`})}var
|
|
9701
|
+
`})}var JU;var jY=y(()=>{JU={createVirtualList:e7,processVirtualListDirectives:$6,processInfiniteListDirectives:WY,processVirtualGridDirectives:BY,generateVirtualListCSS:UY,useVirtualList:_Y}});function OY(){return`<script data-stx-hydration-runtime>
|
|
9406
9702
|
(function() {
|
|
9407
9703
|
'use strict';
|
|
9408
9704
|
|
|
@@ -9562,7 +9858,7 @@ else {
|
|
|
9562
9858
|
stxIslands.initIslands();
|
|
9563
9859
|
}
|
|
9564
9860
|
})();
|
|
9565
|
-
</script>`}function
|
|
9861
|
+
</script>`}function HY($){let Z=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Z)return Z[1];let Y=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Y)return Y[1];return null}function LY($,Z){let Y={},X=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,Q;while((Q=X.exec($))!==null){let J=Q[1],G=Q[2];if(G in Z)Y[J]=Z[G];else Y[J]=G}return Y}var DY={};o(DY,{processStaticDirectives:()=>IY,processPartialHydrationDirectives:()=>VY,onHydrated:()=>MY,isHydrated:()=>wY,hydrateIsland:()=>NY,hydrateByStrategy:()=>AY,hydrateAll:()=>TY,generatePartialHydrationCSS:()=>RY,generateIslandManifest:()=>EY,default:()=>BU,createIslandRegistry:()=>FY});function FY(){let $=new Map;return{islands:$,register(Z){$.set(Z.id,Z)},get(Z){return $.get(Z)},async hydrate(Z){let Y=$.get(Z);if(!Y||Y.hydrated)return;if(Y.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:Z,component:Y.component}}))},async hydrateAll(){let Z=Array.from($.values()).filter((Y)=>!Y.hydrated).map((Y)=>this.hydrate(Y.id));await Promise.all(Z)}}}function QU($){return`
|
|
9566
9862
|
<script data-hydrate="${$}">
|
|
9567
9863
|
(function() {
|
|
9568
9864
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -9573,7 +9869,7 @@ else {
|
|
|
9573
9869
|
island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
|
|
9574
9870
|
})();
|
|
9575
9871
|
</script>
|
|
9576
|
-
`}function
|
|
9872
|
+
`}function GU($,Z){let Y=Z.timeout||2000,X=Z.priority||"low";return`
|
|
9577
9873
|
<script data-hydrate="${$}">
|
|
9578
9874
|
(function() {
|
|
9579
9875
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -9609,7 +9905,7 @@ else {
|
|
|
9609
9905
|
}
|
|
9610
9906
|
})();
|
|
9611
9907
|
</script>
|
|
9612
|
-
`}function
|
|
9908
|
+
`}function KU($,Z){let Y=Z.rootMargin||"0px",X=Z.threshold||0;return`
|
|
9613
9909
|
<script data-hydrate="${$}">
|
|
9614
9910
|
(function() {
|
|
9615
9911
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -9642,7 +9938,7 @@ else {
|
|
|
9642
9938
|
}
|
|
9643
9939
|
})();
|
|
9644
9940
|
</script>
|
|
9645
|
-
`}function
|
|
9941
|
+
`}function qU($,Z){let Y=Z.media||"(min-width: 768px)";return`
|
|
9646
9942
|
<script data-hydrate="${$}">
|
|
9647
9943
|
(function() {
|
|
9648
9944
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -9671,7 +9967,7 @@ else {
|
|
|
9671
9967
|
}
|
|
9672
9968
|
})();
|
|
9673
9969
|
</script>
|
|
9674
|
-
`}function
|
|
9970
|
+
`}function UU($){return`
|
|
9675
9971
|
<script data-hydrate="${$}">
|
|
9676
9972
|
(function() {
|
|
9677
9973
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -9693,7 +9989,7 @@ else {
|
|
|
9693
9989
|
events.forEach(e => island.addEventListener(e, handler, { once: true, passive: true }));
|
|
9694
9990
|
})();
|
|
9695
9991
|
</script>
|
|
9696
|
-
`}function
|
|
9992
|
+
`}function _U($,Z){let Y=Z.event||"stx:activate";return`
|
|
9697
9993
|
<script data-hydrate="${$}">
|
|
9698
9994
|
(function() {
|
|
9699
9995
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -9714,9 +10010,9 @@ else {
|
|
|
9714
10010
|
});
|
|
9715
10011
|
})();
|
|
9716
10012
|
</script>
|
|
9717
|
-
`}function
|
|
9718
|
-
`+
|
|
9719
|
-
<script type="application/json" data-island-props="${q}">${JSON.stringify(U)}</script>`:"",z="";switch(Z){case"load":z=
|
|
10013
|
+
`}function VY($,Z={},Y){let X=$,Q=!1,J=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(X=C1(X,"load",Z),X=C1(X,"idle",Z),X=C1(X,"visible",Z),X=C1(X,"media",Z),X=WU(X),X=C1(X,"hover",Z),X=C1(X,"event",Z),Q=J&&X!==$,Q)X+=`
|
|
10014
|
+
`+OY();return X}function C1($,Z,Y){let X=new RegExp(`@client:${Z}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(X,(Q,J,G)=>{let K={strategy:Z};if(J)try{let O=J.split(",").map((F)=>F.trim());for(let F of O){let[L,H]=F.split(":").map((V)=>V.trim());if(L&&H){let V=H.replace(/^['"]|['"]$/g,"");K[L]=V}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,_=HY(G.trim()),U=LY(G.trim(),Y),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?`
|
|
10015
|
+
<script type="application/json" data-island-props="${q}">${JSON.stringify(U)}</script>`:"",z="";switch(Z){case"load":z=QU(q);break;case"idle":z=GU(q,K);break;case"visible":z=KU(q,K);break;case"media":z=qU(q,K);break;case"hover":z=UU(q);break;case"event":z=_U(q,K);break}return`
|
|
9720
10016
|
<div data-island="${q}"
|
|
9721
10017
|
data-strategy="${Z}"
|
|
9722
10018
|
${W.join(`
|
|
@@ -9726,7 +10022,7 @@ else {
|
|
|
9726
10022
|
${G.trim()}${j}
|
|
9727
10023
|
</div>
|
|
9728
10024
|
${z}
|
|
9729
|
-
`})}function
|
|
10025
|
+
`})}function WU($){let Z=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(Z,(Y,X)=>{let Q=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
|
|
9730
10026
|
<div data-island="${Q}"
|
|
9731
10027
|
data-strategy="only"
|
|
9732
10028
|
class="stx-island stx-client-only">
|
|
@@ -9745,7 +10041,7 @@ else {
|
|
|
9745
10041
|
}
|
|
9746
10042
|
})();
|
|
9747
10043
|
</script>
|
|
9748
|
-
`})}function
|
|
10044
|
+
`})}function RY(){return`
|
|
9749
10045
|
/* Island base styles */
|
|
9750
10046
|
.stx-island {
|
|
9751
10047
|
display: contents;
|
|
@@ -9786,11 +10082,11 @@ else {
|
|
|
9786
10082
|
.stx-island.hydrated {
|
|
9787
10083
|
opacity: 1;
|
|
9788
10084
|
}
|
|
9789
|
-
`}function
|
|
10085
|
+
`}function NY($){if(typeof window>"u")return;let Z=document.querySelector(`[data-island="${$}"]`);if(!Z||Z.classList.contains("hydrated"))return;Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function AY($){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${$}"]:not(.hydrated)`).forEach((Y)=>{Y.classList.add("hydrated"),Y.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function TY(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach((Z)=>{Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function wY($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function MY($){return new Promise((Z)=>{if(typeof window>"u"){Z();return}let Y=document.querySelector(`[data-island="${$}"]`);if(!Y){Z();return}if(Y.classList.contains("hydrated")){Z();return}Y.addEventListener("stx:hydrated",()=>Z(),{once:!0})})}function IY($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,Y)=>{return`<div class="stx-static">${Y.trim()}</div>`})}function EY($){let Z=$.map((Y)=>({id:Y.id,component:Y.component,strategy:Y.options.strategy,props:Y.props}));return`
|
|
9790
10086
|
<script type="application/json" id="stx-island-manifest">
|
|
9791
10087
|
${JSON.stringify(Z)}
|
|
9792
10088
|
</script>
|
|
9793
|
-
`}var
|
|
10089
|
+
`}var BU;var kY=y(()=>{BU={processPartialHydrationDirectives:VY,processStaticDirectives:IY,generatePartialHydrationCSS:RY,generateIslandManifest:EY,createIslandRegistry:FY,hydrateIsland:NY,hydrateByStrategy:AY,hydrateAll:TY,isHydrated:wY,onHydrated:MY}});var dY={};o(dY,{watchMultiple:()=>CY,watchEffect:()=>vY,watch:()=>PY,unref:()=>SY,toRefs:()=>bY,throttledComputed:()=>hY,stxWatchMultiple:()=>CY,stxWatchEffect:()=>vY,stxWatch:()=>PY,stxUnref:()=>SY,stxToRefs:()=>bY,stxThrottledComputed:()=>hY,stxShallowRef:()=>yY,stxRef:()=>v1,stxIsRef:()=>t0,stxDebouncedComputed:()=>gY,stxComputed:()=>U5,shallowRef:()=>yY,ref:()=>v1,processWatchDirectives:()=>fY,processComputedDirectives:()=>xY,isRef:()=>t0,default:()=>zU,debouncedComputed:()=>gY,computed:()=>U5});function v1($){let Z=$,Y=new Set,X={get value(){if(f0){let Q=q5.get(X);if(!Q)Q=new Set,q5.set(X,Q);Q.add(f0)}return Z},set value(Q){if(!Object.is(Z,Q)){Z=Q,Y.forEach((G)=>G(Q));let J=q5.get(X);if(J)J.forEach((G)=>G())}},subscribe(Q){return Y.add(Q),()=>Y.delete(Q)},peek(){return Z}};return X}function t0($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function SY($){return t0($)?$.value:$}function bY($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=v1($[Y]);return Z}function yY($){return v1($)}function U5($){let Z=typeof $==="function",Y=Z?$:$.get,X=Z?void 0:$.set,Q=Z?Object.is:$.equals||Object.is,J,G=!0,K=new Set,q=new Set,_=()=>{if(G=!0,q.size>0){let B=W.value;q.forEach((j)=>j(B))}};function U(){K.clear();let B=f0;f0=_,D$.push(_);try{return Y()}finally{D$.pop(),f0=B}}let W={get value(){if(f0){let B=q5.get(W);if(!B)B=new Set,q5.set(W,B);B.add(f0)}if(G){let B=U();if(!Q(J,B))J=B;G=!1}return J},set value(B){if(X)X(B);else console.warn("Computed property is readonly")},subscribe(B){return q.add(B),()=>q.delete(B)},peek(){if(G)J=Y(),G=!1;return J},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return W}function PY($,Z,Y={}){let{immediate:X=!1,deep:Q=!1,flush:J="pre",once:G=!1}=Y,K,q=!0,_=!1,U=()=>{if(t0($))return Q?L1($.value):$.value;return $()},W=()=>{if(!q||_)return;let z=U();if(K!==void 0&&Object.is(K,z)&&!Q)return;let O=()=>{if(Z(z,K),K=Q?L1(z):z,G)j()};if(J==="sync")O();else if(J==="post")queueMicrotask(O);else Promise.resolve().then(O)},B=null;if(t0($))B=$.subscribe(()=>W());else B=U5($).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($,Z,Y={}){let{immediate:X=!1,once:Q=!1}=Y,J=$.map((W)=>t0(W)?W.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let W=$.map((B)=>t0(B)?B.value:void 0);if(Z(W,J),J=[...W],Q)U()},_=$.map((W)=>{if(t0(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 vY($,Z={}){let{flush:Y="pre"}=Z,X,Q=!0,J=!1,G=()=>{if(!Q||J)return;if(X)X();let q=f0;f0=G,D$.push(G);try{X=$()}finally{D$.pop(),f0=q}};if(Y==="sync")G();else if(Y==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(Q=!1,X)X()};return K.pause=()=>{J=!0},K.resume=()=>{J=!1},K}function xY($,Z={},Y){let X=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(X,(Q,J,G)=>{try{let q=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[J]=q,`<!-- computed: ${J} = ${q} -->`}catch(K){return`<!-- computed error: ${J} - ${K} -->`}})}function fY($,Z={},Y){let X=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(X,(Q,J,G)=>{return`
|
|
9794
10090
|
<script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
|
|
9795
10091
|
(function() {
|
|
9796
10092
|
// Watch implementation for ${J}
|
|
@@ -9802,9 +10098,9 @@ else {
|
|
|
9802
10098
|
}
|
|
9803
10099
|
})();
|
|
9804
10100
|
</script>
|
|
9805
|
-
`})}function
|
|
9806
|
-
`)}catch{return""}})}function
|
|
9807
|
-
`)}catch{return""}})}function
|
|
10101
|
+
`})}function L1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>L1(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((X,Q)=>Y.set(L1(Q),L1(X))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((X)=>Y.add(L1(X))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=L1($[Y]);return Z}function gY($,Z=100){let Y=v1($()),X=null,Q=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{Y.value=$()},Z)};return U5($).subscribe(()=>Q()),{get value(){return Y.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}function hY($,Z=100){let Y=v1($()),X=0,Q=()=>{let G=Date.now();if(G-X>=Z)X=G,Y.value=$()};return U5($).subscribe(()=>Q()),{get value(){return Y.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}var f0=null,D$,q5,zU;var mY=y(()=>{D$=[],q5=new WeakMap;zU={ref:v1,computed:U5,watch:PY,watchMultiple:CY,watchEffect:vY,isRef:t0,unref:SY,toRefs:bY,shallowRef:yY,debouncedComputed:gY,throttledComputed:hY,processComputedDirectives:xY,processWatchDirectives:fY}});var cY={};o(cY,{v:()=>jU,processHasErrorsDirective:()=>pY,processFormValidationDirectives:()=>HU,processErrorsDirective:()=>lY,processErrorDirective:()=>uY,defineForm:()=>OU,Validator:()=>x1});class x1{rules=[];defaultValue="";addRule($){let Z=new x1;return Z.rules=[...this.rules,$],Z.defaultValue=this.defaultValue,Z}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(Z)=>{if(Z===null||Z===void 0)return $;if(typeof Z==="string"&&Z.trim()==="")return $;if(Array.isArray(Z)&&Z.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(Z)=>{if(!Z)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(Z))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(Z)=>{if(!Z)return!0;try{return new URL(String(Z)),!0}catch{return $}}})}min($,Z){let Y=Z||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length>=$||Y}})}max($,Z){let Y=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length<=$||Y}})}length($,Z,Y){let X=Y||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:X,validate:(Q)=>{if(!Q)return!0;let J=String(Q).length;return J>=$&&J<=Z||X}})}pattern($,Z="Invalid format"){return this.addRule({name:"pattern",message:Z,validate:(Y)=>{if(!Y)return!0;return $.test(String(Y))||Z}})}hasUppercase($="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,$)}hasLowercase($="Must contain a lowercase letter"){return this.pattern(/[a-z]/,$)}hasNumber($="Must contain a number"){return this.pattern(/\d/,$)}hasSpecial($="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,$)}alphanumeric($="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,$)}startsWithLetter($="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,$)}noSpaces($="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:$,validate:(Z)=>{if(!Z)return!0;return!String(Z).includes(" ")||$}})}number($="Must be a number"){let Z=this.addRule({name:"number",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return!Number.isNaN(Number(Y))||$}});return Z.defaultValue=0,Z}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number.isInteger(Number(Z))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)<0||$}})}minValue($,Z){let Y=Z||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)>=$||Y}})}maxValue($,Z){let Y=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)<=$||Y}})}between($,Z,Y){let X=Y||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:X,validate:(Q)=>{if(!Q&&Q!==0)return!0;let J=Number(Q);return J>=$&&J<=Z||X}})}matches($,Z){let Y=Z||`Must match ${$}`;return this.addRule({name:"matches",message:Y,validate:(X,Q)=>{if(!Q)return!0;return X===Q[$]||Y}})}oneOf($,Z){let Y=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Y,validate:(X)=>{if(!X)return!0;return $.includes(X)||Y}})}notOneOf($,Z){let Y=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Y,validate:(X)=>{if(!X)return!0;return!$.includes(X)||Y}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Z)=>{if(!Z)return!0;let Y=new Date(String(Z));return!Number.isNaN(Y.getTime())||$}})}before($,Z){let Y=new Date($),X=Z||`Must be before ${Y.toLocaleDateString()}`;return this.addRule({name:"before",message:X,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))<Y||X}})}after($,Z){let Y=new Date($),X=Z||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:X,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))>Y||X}})}custom($,Z="Invalid value"){return this.addRule({name:"custom",message:Z,validate:$})}async($,Z="Invalid value"){return this.addRule({name:"async",message:Z,async:!0,validate:$})}when($,Z){let Y=new x1;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let X of Z.getRules())Y.rules.push({...X,validate:(Q,J)=>{if(!$(Q,J||{}))return!0;return X.validate(Q,J)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new x1;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let Y=[];for(let X of this.rules){let Q=await X.validate($,Z);if(Q!==!0)Y.push(Q)}return Y}validateSync($,Z){let Y=[];for(let X of this.rules){if(X.async)continue;let Q=X.validate($,Z);if(Q!==!0)Y.push(Q)}return Y}}function OU($,Z){let Y=Object.keys($),X={},Q={},J={},G={},K={};for(let H of Y)X[H]=Z?.[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(Y.map(_));return q=!1,H.every(Boolean)}function W(){for(let H of Y)X[H]=Z?.[H]??$[H].getDefaultValue(),Q[H]=[],J[H]=!1,G[H]=!1}function B(H){for(let V of Y)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 F(H){return async(V)=>{V?.preventDefault?.();for(let R of Y)J[R]=!0;if(await U())await H(X)}}return{values:X,errors:Q,touched:J,dirty:G,get isValid(){return Y.every((H)=>Q[H].length===0)},get isValidating(){return q||Y.some((H)=>K[H])},get isDirty(){return Y.some((H)=>G[H])},validate:U,validateField:_,reset:W,setValues:B,setFieldValue:j,setFieldTouched:z,getFieldState:O,handleSubmit:F}}function uY($,Z,Y){let X=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let _=q;if(!_||!Array.isArray(_)||_.length===0)return"";return _.map((U)=>{return G.replace(/\{\{\s*message\s*\}\}/g,U)}).join(`
|
|
10102
|
+
`)}catch{return""}})}function lY($,Z,Y){let X=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let _=q;if(!_||!Array.isArray(_)||_.length===0)return"";return _.map((U)=>G.replace(/\{\{\s*message\s*\}\}/g,U)).join(`
|
|
10103
|
+
`)}catch{return""}})}function pY($,Z,Y){let X=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let _=q;if(!_||!Array.isArray(_)||_.length===0)return"";return G}catch{return""}})}function HU($,Z,Y){let X=$;return X=uY(X,Z,Y),X=lY(X,Z,Y),X=pY(X,Z,Y),X}var jU;var iY=y(()=>{jU=new x1});var oY={};o(oY,{processXElementDirectives:()=>LU,hasXElementDirectives:()=>sY,generateXElementRuntime:()=>nY});function nY(){return`<script data-stx-scoped>
|
|
9808
10104
|
(function() {
|
|
9809
10105
|
'use strict';
|
|
9810
10106
|
|
|
@@ -10088,33 +10384,33 @@ else {
|
|
|
10088
10384
|
// Expose for manual initialization
|
|
10089
10385
|
window.XElement = XElement;
|
|
10090
10386
|
})();
|
|
10091
|
-
</script>`}function
|
|
10387
|
+
</script>`}function sY($){return/\bx-(data|model|text|show|init|html)\b/.test($)||/\s:[a-z]/.test($)}function LU($){if(!sY($))return $;let Z=nY(),Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+Z+`
|
|
10092
10388
|
`+$.slice(Y);return $+`
|
|
10093
|
-
`+Z}var
|
|
10094
|
-
<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(() => (
|
|
10095
|
-
`+U+G.slice(j)}}}}catch{}if(J)G=await
|
|
10389
|
+
`+Z}var aY={};o(aY,{validateClientScript:()=>I$,processOnceDirective:()=>M$,processJsonDirective:()=>w$,processDirectives:()=>w5,injectRouterScript:()=>HZ});import M0 from"path";async function w5($,Z,Y,X,Q){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;let J=!Z.__stxProcessingDepth;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;try{return await t6.timeAsync("template-processing",async()=>{let G=await FU($,Z,Y,X,Q);if(J)G=r7(G);if(J&&X.autoShell&&X.buildMode!=="compile"){let K=X.app?.head||{},_=(Z.__stx_runtime_head||null)??p1(),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=WZ(G,U);let W=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(W&&G.includes("<head")){let j=W[1];G=G.replace("<head>",`<head>
|
|
10390
|
+
<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(() => (cZ(),pZ)),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)+`
|
|
10391
|
+
`+U+G.slice(j)}}}}catch{}if(J)G=await d9(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof t5)throw G;let K=G instanceof Error?G.message:String(G),q=new W1(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(B1.log(q,{filePath:Y,context:Z}),h4.logDetailedError(q,{filePath:Y,template:$.substring(0,500)}),X.debug)throw q;return f4.createFallbackContent("Template Processing",q)}}async function FU($,Z,Y,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,F)=>{return`{{ ${F} }}`}),q=KZ(q),q=await dZ(q,Y,Q);let U={};q=W7(q,U);let W={...Z.__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),F=/@section\s*\(/.test(q);if(!O||F){let L="",H=M0.dirname(Y),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)){L=R;break}let A=M0.dirname(H);if(A===H||A.length<V.length)break;H=A}if(L)B=L;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&&!F)q=`@section('content')
|
|
10096
10392
|
${q.trim()}
|
|
10097
|
-
@endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(
|
|
10098
|
-
${q}`,q}catch(
|
|
10393
|
+
@endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,F,L)=>{return W[F]=L,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,F,L)=>{if(L.includes("@parent"))W[F]=L.replace("@parent","<!--PARENT_CONTENT_PLACEHOLDER-->");else W[F]=L.trim();return""}),Z.__sections=W,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,F,L)=>{return W[F]||L||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return W.content||""});if(q=B7(q,U),B)try{let O=M0.isAbsolute(B)?B:await M1(()=>e$(B,Y,G,Q),null,()=>{throw new W1(`Failed to resolve layout path: ${B}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!O){let R=`Layout not found: ${B} (referenced from ${Y})`;if(B1.log(Error(R),{layoutPath:B,filePath:Y},"warning"),G.debug)throw new W1(R,Y);return q}let F=await M1(()=>Bun.file(O).text(),"",()=>{throw new W1(`Failed to read layout file: ${O}`,Y,void 0,void 0,"Layout content could not be loaded")}),L=F.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(L){if(G.debug)console.log(`Found nested layout: ${L[1]} in ${O}`);let R={},A=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(E,M,I)=>{return R[M]=I.trim(),""});for(let[E,M]of Object.entries(R))if(W[E]&&W[E].includes("<!--PARENT_CONTENT_PLACEHOLDER-->")){let I=W[E].indexOf("<!--PARENT_CONTENT_PLACEHOLDER-->");W[E]=W[E].slice(0,I)+M+W[E].slice(I+33)}else if(!W[E])W[E]=M;let T={...Z,__sections:W},w=`@layout('${L[1]}')${A}`;return await w5(w,T,O,G,Q)}let H=F.replace(/\{\{--[\s\S]*?--\}\}/g,""),V=W7(H,U),N={};return V=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(R,A,T)=>{return N[A]=T.trim(),`@slot('${A}')`}),V=V.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(R,A,T)=>{if(W[A]){let w=W[A];if(w.includes("<!--PARENT_CONTENT_PLACEHOLDER-->")){let E=N[A]||"",M=w.indexOf("<!--PARENT_CONTENT_PLACEHOLDER-->");w=w.slice(0,M)+E+w.slice(M+33)}return w}return T||""}),V=V.replace(/\{\{\s*slot\s*\}\}/g,()=>{return W.content||""}),V=B7(V,U),Z.__originalFilePath=Y,q=await rY(V,Z,O,G,Q),q=`<!-- stx-layout: ${B} -->
|
|
10394
|
+
${q}`,q}catch(O){return B1.log(O instanceof Error?O:Error(String(O)),{layoutPath:B,filePath:Y},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return await rY(q,Z,Y,G,Q)}async function rY($,Z,Y,X,Q){let J=$;Z.__stx_sfc_mode=!0;let G=X;if(await M1(()=>ZZ(Y,Z),void 0,(f)=>{if(G.debug)console.warn(`View composer error for ${Y}:`,f.message)}),Z.__stx_options=G,G.buildMode)Z.__stx_buildMode=G.buildMode;let K=G.envPrefix||"STX_PUBLIC_",q={};for(let[f,m]of Object.entries(process.env))if(f.startsWith(K)&&m!==void 0)q[f]=m;Z.$env=q,J=await M1(()=>r8(J,Z,Y,G),J,(f)=>{if(G.debug)console.warn("Pre-processing middleware error:",f.message)});let _=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,U;while((U=_.exec(J))!==null){let f=U[1],m=U[2];if(/\bserver\b/.test(f)&&m.trim())try{let{extractVariables:Z0}=await Promise.resolve().then(() => (n1(),T5));await Z0(m,Z,Y)}catch(Z0){if(G.debug)console.warn("Script extraction error:",Z0)}}try{let{interpolateScriptsInTemplate:f}=await Promise.resolve().then(() => (c0(),o6));J=f(J,Z,{skipServer:!0})}catch(f){if(G.debug)console.warn("Script expression interpolation error:",f)}if(J=await p8(J,Z,Y),J=await c8(J,Z,Y),J=await A8(J,Z,Y,G),V5(J))J=E7(J),J=D7(J,Z);J=K7(J,Z,Y,G),J=await o7(J,Z,Y,G,Q),J=await UZ(J,Z,Y,G,Q),J=k6(J,Z,Y,G);let{processDeferDirectives:W}=await Promise.resolve().then(() => nZ);J=W(J,Z,Y);let{processTeleportDirectives:B}=await Promise.resolve().then(() => oZ);J=B(J,Z,Y);let{processTransitionDirectives:j,processTransitionAttributes:z}=await Promise.resolve().then(() => eZ);J=j(J,Z,Y),J=z(J);let{processErrorBoundaryDirectives:O}=await Promise.resolve().then(() => ZY);J=O(J,Z,Y);let{processSuspenseDirectives:F}=await Promise.resolve().then(() => YY);J=F(J,Z,Y);let{processAsyncDirectives:L}=await Promise.resolve().then(() => GY);J=L(J,Z,Y);let{processKeepAliveDirectives:H}=await Promise.resolve().then(() => qY);J=H(J,Z,Y);let{processVirtualListDirectives:V,processVirtualGridDirectives:N,processInfiniteListDirectives:R}=await Promise.resolve().then(() => (jY(),zY));J=V(J,Z,Y),J=N(J,Z,Y),J=R(J,Z,Y);let{processPartialHydrationDirectives:A,processStaticDirectives:T}=await Promise.resolve().then(() => (kY(),DY));J=A(J,Z,Y),J=T(J);let{processComputedDirectives:w,processWatchDirectives:E}=await Promise.resolve().then(() => (mY(),dY));J=w(J,Z,Y),J=E(J,Z,Y);let{processFormValidationDirectives:M}=await Promise.resolve().then(() => (iY(),cY));J=M(J,Z,Y);let{processHeadDirective:I,processTitleDirective:D,processMetaDirective:P,resetHead:b}=await Promise.resolve().then(() => (c1(),o$));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)b();let S=I(J);if(J=S.content,J=D(J,Z),J=P(J,Z),J=e8(J),J=t4(J,Z),J=R8(J),J=s8(J),J=await _7(J,Z,Y,G,Q),J=await o7(J,Z,Y,G,Q),J=r7(J),J=E1(J,Z,Y),J=e4(J,Z),J=$7(J,Z),J=_$(J,Z),J=E8(J,Z),J=D8(J,Z),J=await G8(J,Z,Y,G),J=await R3(J,Z,Y),J=await v8(J,Z,Y,G),J=A6(J,Z,Y,G),J=I9(J,Z,Y,G),J=E9(J,Z,Y),J=D9(J,Z,Y,G),J=L8(J,Z,Y,G),J=w$(J,Z),J=M$(J),J=uZ(J),!G.skipEventDirectives)J=Z8(J,Z,Y);if(J=Q8(J,Z,Y),G.debug){let f=/\bx-data\s*=/.test(J),m=N$($);if(f&&m)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
10099
10395
|
Both work on the same page, but they manage separate scopes.
|
|
10100
|
-
Prefer signals (state/derived/effect) for new components.`)}J=
|
|
10396
|
+
Prefer signals (state/derived/effect) for new components.`)}J=JZ(J,Z),J=await Q1(J,Z,Y),J=lZ(J),J=i9(J);let{processXElementDirectives:k}=await Promise.resolve().then(() => oY);if(J=k(J),J=await k7(J,G,Y),J=await a8(J,Z,Y,G),G.seo?.enabled)J=k9(J,Z,G);let{renderHead:g,getHead:h}=await Promise.resolve().then(() => (c1(),o$)),i=Z.__stx_runtime_head,W0=i&&(i.title||i.meta?.length||i.link?.length)?i:h();if(W0.title||W0.meta?.length||W0.link?.length){let f=g(W0);if(f){if(J.includes("</head>"))J=J.replace("</head>",`${f}
|
|
10101
10397
|
</head>`);else if(J.includes("<head>"))J=J.replace("<head>",`<head>
|
|
10102
10398
|
${f}`)}}if(S.headContent){if(J.includes("</head>"))J=J.replace("</head>",`${S.headContent}
|
|
10103
10399
|
</head>`);else if(J.includes("<head>"))J=J.replace("<head>",`<head>
|
|
10104
|
-
${S.headContent}`)}if(G.csp?.enabled&&G.csp.addMetaTag)J=
|
|
10105
|
-
${
|
|
10106
|
-
</script>`;if(J.includes("</head>")){let
|
|
10107
|
-
`+
|
|
10400
|
+
${S.headContent}`)}if(G.csp?.enabled&&G.csp.addMetaTag)J=H8(J,G.csp,Z);if(G.analytics?.enabled)J=s9(J,G);if(G.heatmap?.enabled)J=C6(J,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:f}=await Promise.resolve().then(() => (O5(),V6));J=f(J,G)}let T0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(J),q0=/\bSTX\.\w+/.test(J),k0=/window\.STX\s*=/.test(J);if(T0&&q0&&!k0){let m=`<script data-stx-scoped>
|
|
10401
|
+
${u9()}
|
|
10402
|
+
</script>`;if(J.includes("</head>")){let K0=J.indexOf("</head>"),Q0=J.slice(0,K0).indexOf("<script");if(Q0!==-1){let H0=J.slice(0,Q0),y0=J.slice(Q0);J=H0+m+`
|
|
10403
|
+
`+y0}else J=J.replace("</head>",`${m}
|
|
10108
10404
|
</head>`)}else if(J.includes("<body"))J=J.replace(/<body([^>]*)>/,`<body$1>
|
|
10109
10405
|
${m}`);else J=m+`
|
|
10110
|
-
`+J}{let f=/<script\s+server\b[^>]*>/gi,m,
|
|
10111
|
-
Icon generation requires the sharp package for image processing.`),Y.success=!1,Y}let W=await _.default(Q).metadata();if(W.width&&W.width<512)Y.warnings.push(`Source icon is ${W.width}x${W.height}. Recommend using at least 512x512 for best quality.`);for(let F of G){let L=
|
|
10406
|
+
`+J}{let f=/<script\s+server\b[^>]*>/gi,m,K0=[];while((m=f.exec(J))!==null){let Z0=m.index+m[0].length,Q0=1,H0=Z0;while(H0<J.length&&Q0>0){let y0=J.indexOf("<script",H0),P0=J.indexOf("</script>",H0);if(P0===-1)break;if(y0!==-1&&y0<P0)Q0++,H0=y0+7;else{if(Q0--,Q0===0){let e0=P0+9;while(e0<J.length&&/\s/.test(J[e0]))e0++;K0.push({start:m.index,end:e0});break}H0=P0+9}}}for(let Z0=K0.length-1;Z0>=0;Z0--){let{start:Q0,end:H0}=K0[Z0];J=J.substring(0,Q0)+J.substring(H0)}}let b0=R5(J,Y);if(b0.hasScoped)J=b0.html;let O0=Z.__stx_event_bindings||[],C=!1,v=[],x=/\s:[a-z][\w.-]*\s*=/.test(J),{scanScriptTags:p}=await Promise.resolve().then(() => (S7(),AZ));for(let f of p(J,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}))v.push({match:f.fullMatch,attrs:f.attrs,content:f.body});for(let{match:f,attrs:m,content:K0}of v){C=!0;let Z0=K0;I$(K0,Y,X.strict);let Q0=await H5(K0,{eventBindings:O0,attrs:m,hasColonDirectives:x,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:X.buildMode==="compile"});J=J.replace(f,()=>Q0)}if(C)Z.__stx_event_bindings=[];return J}var $4=y(()=>{m9();f$();l9();n9();o9();d$();g$();Y8();l$();K8();K$();F8();N8();w8();m0();c1();c0();k8();x8();l8();n8();q7();Z4();t8();A1();$Z();d4();L0();YZ();QZ();qZ();_Z();s$();S7();fZ();mZ();a7();t7();a7();t7()});import TU from"fs";import Z6 from"path";import GX from"fs";import g0 from"path";var J6=[72,96,128,144,152,192,384,512],Q6=[120,152,167,180],G6=[16,32];async function K6($,Z){let Y={success:!0,generatedFiles:[],errors:[],warnings:[]},X=$.pwa?.icons;if(!X?.src)return Y.errors.push("No source icon specified in pwa.icons.src"),Y.success=!1,Y;let Q=g0.isAbsolute(X.src)?X.src:g0.resolve(process.cwd(),X.src);if(!await Bun.file(Q).exists())return Y.errors.push(`Source icon not found: ${Q}`),Y.success=!1,Y;let J=g0.resolve(Z,X.outputDir||"pwa-icons");try{GX.mkdirSync(J,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${J}`),Y.success=!1,Y}let G=X.sizes||J6,K=X.generateWebP??!0,q=X.generateAppleIcons??!0;try{let _;try{_=await import("sharp")}catch{return Y.errors.push(`sharp is not installed. Install it with: bun add sharp
|
|
10407
|
+
Icon generation requires the sharp package for image processing.`),Y.success=!1,Y}let W=await _.default(Q).metadata();if(W.width&&W.width<512)Y.warnings.push(`Source icon is ${W.width}x${W.height}. Recommend using at least 512x512 for best quality.`);for(let F of G){let L=g0.join(J,`icon-${F}x${F}.png`);if(await _.default(Q).resize(F,F,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(L),Y.generatedFiles.push(L),K){let H=g0.join(J,`icon-${F}x${F}.webp`);await _.default(Q).resize(F,F,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(H),Y.generatedFiles.push(H)}}if(q){for(let L of Q6){let H=g0.join(J,`apple-touch-icon-${L}x${L}.png`);await _.default(Q).resize(L,L,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(H),Y.generatedFiles.push(H)}let F=g0.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(F),Y.generatedFiles.push(F)}for(let F of G6){let L=g0.join(J,`favicon-${F}x${F}.png`);await _.default(Q).resize(F,F,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(L),Y.generatedFiles.push(L)}let B=512,j=g0.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),Y.generatedFiles.push(j)}catch(_){let U=_ instanceof Error?_.message:String(_);Y.errors.push(`Icon generation failed: ${U}`),Y.success=!1}return Y}function DU($){let Z=$.sizes||J6,Y=$.outputDir?`/${$.outputDir}`:"/pwa-icons",X=$.generateWebP??!0,Q=$.generateAppleIcons??!0,J=[];for(let G of Z)if(J.push(`${Y}/icon-${G}x${G}.png`),X)J.push(`${Y}/icon-${G}x${G}.webp`);if(Q){J.push(`${Y}/apple-touch-icon.png`);for(let G of Q6)J.push(`${Y}/apple-touch-icon-${G}x${G}.png`)}for(let G of G6)J.push(`${Y}/favicon-${G}x${G}.png`);return J.push(`${Y}/icon-maskable-512x512.png`),J}async function q6(){try{return await import("sharp"),!0}catch{return!1}}O5();function EX($,Z,Y,X){let Q=[],J=X.join(" ");for(let G of $)if(Q.push({src:`${Z}/icon-${G}x${G}.png`,sizes:`${G}x${G}`,type:"image/png",purpose:J}),Y)Q.push({src:`${Z}/icon-${G}x${G}.webp`,sizes:`${G}x${G}`,type:"image/webp",purpose:J});return Q}function DX($){return $.map((Z)=>({name:Z.name,short_name:Z.shortName,description:Z.description,url:Z.url,icons:Z.icons?.map((Y)=>({src:Y.src,sizes:Y.sizes,type:Y.type}))}))}function kX($){let Z=$.pwa?.shareTarget;if(!Z?.enabled)return;let Y={action:Z.action||"/share",method:Z.method||"POST",enctype:Z.enctype||"multipart/form-data",params:{title:Z.params?.title||"title",text:Z.params?.text||"text",url:Z.params?.url||"url"}};if(Z.acceptFiles&&Z.acceptFiles.length>0)Y.params.files=Z.acceptFiles.map((X)=>({name:X.name,accept:X.accept}));return Y}function SX($){let Z=$.pwa?.fileHandlers;if(!Z?.enabled||!Z.accept)return;let Y=[{action:Z.action||"/",accept:Z.accept,launch_type:Z.launchType||"single-client"}];if(Z.icons)Y[0].icons=Z.icons.map((X)=>({src:X.src,sizes:X.sizes,type:X.type}));return Y}function bX($){let Z=$.pwa?.protocolHandlers;if(!Z||Z.length===0)return;return Z.map((Y)=>({protocol:Y.protocol,url:Y.url}))}function yX($){let Z=$.pwa;if(!Z?.enabled||!Z.manifest)return null;let{manifest:Y,icons:X}=Z,Q=X?.sizes||[72,96,128,144,152,192,384,512],J=X?.outputDir?`/${X.outputDir}`:"/pwa-icons",G=X?.generateWebP??!0,K=X?.purpose||["any","maskable"],q={name:Y.name,short_name:Y.shortName||Y.name,description:Y.description,start_url:Y.startUrl||"/",display:Y.display||"standalone",display_override:Y.displayOverride,orientation:Y.orientation,theme_color:Y.themeColor,background_color:Y.backgroundColor,scope:Y.scope||"/",lang:Y.lang,dir:Y.dir,id:Y.id,categories:Y.categories,icons:EX(Q,J,G,K)};if(Y.shortcuts&&Y.shortcuts.length>0)q.shortcuts=DX(Y.shortcuts);if(Y.screenshots&&Y.screenshots.length>0)q.screenshots=Y.screenshots.map((B)=>({src:B.src,sizes:B.sizes,type:B.type,label:B.label,form_factor:B.platform}));let _=kX($);if(_)q.share_target=_;let U=SX($);if(U)q.file_handlers=U;let W=bX($);if(W)q.protocol_handlers=W;if(Y.launchHandler)q.launch_handler={client_mode:Y.launchHandler};if(Y.handleLinks)q.handle_links=Y.handleLinks;if(Y.edgeSidePanel?.enabled)q.edge_side_panel={preferred_width:Y.edgeSidePanel.preferredWidth};return q}function R6($){let Z=yX($);if(!Z)return"";let Y=JSON.parse(JSON.stringify(Z));return JSON.stringify(Y,null,2)}function gU($,Z){return{...Z,...$,shortcuts:$.shortcuts||Z.shortcuts,screenshots:$.screenshots||Z.screenshots,categories:$.categories||Z.categories}}function hU($){let Z=[],Y=$.pwa;if(!Y?.enabled)return Z;let X=Y.manifest;if(!X)return Z.push("PWA manifest configuration is missing"),Z;if(!X.name)Z.push("Manifest name is required");let Q=["fullscreen","standalone","minimal-ui","browser"];if(X.display&&!Q.includes(X.display))Z.push(`Invalid display mode: ${X.display}. Must be one of: ${Q.join(", ")}`);let J=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(X.orientation&&!J.includes(X.orientation))Z.push(`Invalid orientation: ${X.orientation}`);let G=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(X.themeColor&&!G.test(X.themeColor))Z.push(`Invalid theme color: ${X.themeColor}. Must be a valid hex color.`);if(X.backgroundColor&&!G.test(X.backgroundColor))Z.push(`Invalid background color: ${X.backgroundColor}. Must be a valid hex color.`);if(Y.shareTarget?.enabled){if(!Y.shareTarget.action)Z.push("Share target action URL is required")}if(Y.fileHandlers?.enabled){if(!Y.fileHandlers.accept||Object.keys(Y.fileHandlers.accept).length===0)Z.push("File handlers must specify accepted MIME types")}if(Y.protocolHandlers)for(let K of Y.protocolHandlers){if(!K.protocol)Z.push("Protocol handler missing protocol");if(!K.url||!K.url.includes("%s"))Z.push(`Protocol handler URL must contain %s placeholder: ${K.protocol}`)}return Z}import tY from"path";async function eY($){let Z=$.pwa?.offline;if(!Z?.enabled)return"";if(Z.page){let Y=tY.isAbsolute(Z.page)?Z.page:tY.resolve(process.cwd(),Z.page);if(await Bun.file(Y).exists())try{let{processDirectives:X}=await Promise.resolve().then(() => ($4(),aY)),Q=await Bun.file(Y).text();return await X(Q,{},Y,$,new Set)}catch(X){console.warn(`[PWA] Failed to process custom offline page: ${X}`)}else console.warn(`[PWA] Custom offline page not found: ${Y}`)}return VU($)}function VU($){let Z=$.pwa?.offline,Y=$.pwa?.manifest,X=Z?.fallbackTitle||"You are offline",Q=Z?.fallbackMessage||"Please check your internet connection and try again.",J=Y?.themeColor||"#4f46e5",G=Y?.shortName||Y?.name||"App";return`<!DOCTYPE html>
|
|
10112
10408
|
<html lang="en">
|
|
10113
10409
|
<head>
|
|
10114
10410
|
<meta charset="UTF-8">
|
|
10115
10411
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
10116
10412
|
<meta name="theme-color" content="${J}">
|
|
10117
|
-
<title>${
|
|
10413
|
+
<title>${k$(X)} - ${k$(G)}</title>
|
|
10118
10414
|
<style>
|
|
10119
10415
|
:root {
|
|
10120
10416
|
--theme-color: ${J};
|
|
@@ -10284,8 +10580,8 @@ Icon generation requires the sharp package for image processing.`),Y.success=!1,
|
|
|
10284
10580
|
<circle cx="12" cy="20" r="1"/>
|
|
10285
10581
|
</svg>
|
|
10286
10582
|
|
|
10287
|
-
<h1>${
|
|
10288
|
-
<p>${
|
|
10583
|
+
<h1>${k$(X)}</h1>
|
|
10584
|
+
<p>${k$(Q)}</p>
|
|
10289
10585
|
|
|
10290
10586
|
<button class="retry-btn" onclick="window.location.reload()">
|
|
10291
10587
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
@@ -10341,9 +10637,9 @@ Icon generation requires the sharp package for image processing.`),Y.success=!1,
|
|
|
10341
10637
|
}, 5000);
|
|
10342
10638
|
</script>
|
|
10343
10639
|
</body>
|
|
10344
|
-
</html>`}function
|
|
10640
|
+
</html>`}function k$($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}f1();g1();import F1 from"fs";import S$ from"path";function RU($){let Z=[],Y=$.pwa;if(Z.push({id:"pwa-enabled",name:"PWA Enabled",category:"required",passed:Y?.enabled===!0,message:Y?.enabled?"PWA is enabled":"PWA is not enabled in config"}),!Y?.enabled)return Z;Z.push({id:"manifest-name",name:"App Name",category:"required",passed:Boolean(Y.manifest?.name),message:Y.manifest?.name?`App name: "${Y.manifest.name}"`:"Missing required manifest name"}),Z.push({id:"manifest-short-name",name:"Short Name",category:"recommended",passed:Boolean(Y.manifest?.shortName),message:Y.manifest?.shortName?`Short name: "${Y.manifest.shortName}"`:"Short name not set (will use full name)"}),Z.push({id:"manifest-description",name:"App Description",category:"recommended",passed:Boolean(Y.manifest?.description),message:Y.manifest?.description?"Description is set":"App description not provided"}),Z.push({id:"manifest-theme-color",name:"Theme Color",category:"required",passed:Boolean(Y.manifest?.themeColor),message:Y.manifest?.themeColor?`Theme color: ${Y.manifest.themeColor}`:"Theme color not set"}),Z.push({id:"manifest-background-color",name:"Background Color",category:"required",passed:Boolean(Y.manifest?.backgroundColor),message:Y.manifest?.backgroundColor?`Background color: ${Y.manifest.backgroundColor}`:"Background color not set"}),Z.push({id:"manifest-display",name:"Display Mode",category:"required",passed:["standalone","fullscreen","minimal-ui"].includes(Y.manifest?.display||""),message:Y.manifest?.display?`Display mode: ${Y.manifest.display}`:"Display mode should be standalone, fullscreen, or minimal-ui"}),Z.push({id:"manifest-start-url",name:"Start URL",category:"required",passed:Boolean(Y.manifest?.startUrl),message:Y.manifest?.startUrl?`Start URL: ${Y.manifest.startUrl}`:"Start URL not set"}),Z.push({id:"icons-source",name:"Icon Source",category:"required",passed:Boolean(Y.icons?.src),message:Y.icons?.src?`Icon source: ${Y.icons.src}`:"No icon source configured"});let X=Y.icons?.sizes||[];Z.push({id:"icons-192",name:"192x192 Icon",category:"required",passed:X.includes(192),message:X.includes(192)?"192x192 icon will be generated":"Missing 192x192 icon (required for Android)"}),Z.push({id:"icons-512",name:"512x512 Icon",category:"required",passed:X.includes(512),message:X.includes(512)?"512x512 icon will be generated":"Missing 512x512 icon (required for splash screen)"}),Z.push({id:"icons-maskable",name:"Maskable Icon",category:"recommended",passed:Y.icons?.purpose?.includes("maskable")||!1,message:Y.icons?.purpose?.includes("maskable")?"Maskable icon purpose is set":"Consider adding maskable icon purpose for adaptive icons"}),Z.push({id:"sw-configured",name:"Service Worker",category:"required",passed:Boolean(Y.serviceWorker),message:Y.serviceWorker?"Service worker is configured":"Service worker configuration missing"}),Z.push({id:"sw-cache-version",name:"Cache Version",category:"recommended",passed:Boolean(Y.serviceWorker?.cacheVersion),message:Y.serviceWorker?.cacheVersion?`Cache version: ${Y.serviceWorker.cacheVersion}`:"Set cache version for proper cache busting"}),Z.push({id:"offline-enabled",name:"Offline Support",category:"required",passed:Y.offline?.enabled===!0,message:Y.offline?.enabled?"Offline support is enabled":"Offline support is disabled"});let Q=Y.routes||[];return Z.push({id:"caching-strategies",name:"Caching Strategies",category:"recommended",passed:Q.length>0,message:Q.length>0?`${Q.length} route caching strategies configured`:"No custom caching strategies defined"}),Z.push({id:"push-config",name:"Push Notifications",category:"optional",passed:!Y.push?.enabled||Boolean(Y.push?.vapidPublicKey),message:Y.push?.enabled?Y.push?.vapidPublicKey?"Push notifications configured with VAPID key":"Push enabled but missing VAPID key":"Push notifications not enabled"}),Z.push({id:"share-target",name:"Share Target",category:"optional",passed:!0,message:Y.shareTarget?.enabled?`Share target enabled at ${Y.shareTarget.action}`:"Share target not enabled"}),Z.push({id:"auto-inject",name:"Auto-injection",category:"recommended",passed:Y.autoInject!==!1,message:Y.autoInject!==!1?"PWA tags will be auto-injected":"Auto-injection disabled - manual tag insertion required"}),Z}function NU($){let Z=[],Y=S$.join($,"manifest.json"),X=F1.existsSync(Y);if(Z.push({id:"build-manifest",name:"Manifest File",category:"required",passed:X,message:X?"manifest.json exists":"manifest.json not found in build output"}),X)try{let U=JSON.parse(F1.readFileSync(Y,"utf-8"));Z.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!0,message:"Manifest is valid JSON"}),Z.push({id:"build-manifest-icons",name:"Manifest Icons",category:"required",passed:Array.isArray(U.icons)&&U.icons.length>0,message:U.icons?.length?`${U.icons.length} icons defined in manifest`:"No icons defined in manifest"})}catch{Z.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!1,message:"Manifest is not valid JSON"})}let Q=S$.join($,"sw.js"),J=F1.existsSync(Q);Z.push({id:"build-sw",name:"Service Worker File",category:"required",passed:J,message:J?"Service worker (sw.js) exists":"Service worker not found in build output"});let G=S$.join($,"offline.html"),K=F1.existsSync(G);Z.push({id:"build-offline",name:"Offline Page",category:"recommended",passed:K,message:K?"Offline page exists":"No offline.html found"});let q=S$.join($,"pwa-icons");if(F1.existsSync(q)){let U=F1.readdirSync(q).filter((W)=>W.endsWith(".png")||W.endsWith(".webp"));Z.push({id:"build-icons",name:"Generated Icons",category:"required",passed:U.length>0,message:U.length>0?`${U.length} icon files generated`:"No icon files found"})}else Z.push({id:"build-icons",name:"Generated Icons",category:"required",passed:!1,message:"Icons directory not found"});return Z}function AU($){let Z=$.filter((q)=>q.category==="required"),Y=$.filter((q)=>q.category==="recommended"),X=Z.filter((q)=>q.passed).length,Q=Y.filter((q)=>q.passed).length,J=Z.length>0?X/Z.length*70:70,G=Y.length>0?Q/Y.length*30:30;return{score:Math.round(J+G),passed:$.filter((q)=>q.passed).length,failed:$.filter((q)=>!q.passed&&q.category==="required").length,warnings:$.filter((q)=>!q.passed&&q.category!=="required").length,checks:$}}function fH($,Z){let Y=RU($),X=Z&&F1.existsSync(Z)?NU(Z):[];return AU([...Y,...X])}function gH($){let Z=[];Z.push(`
|
|
10345
10641
|
=== PWA Audit Report ===
|
|
10346
10642
|
`);let Y=$.score>=90?"32":$.score>=70?"33":"31";Z.push(`Score: \x1B[${Y}m${$.score}/100\x1B[0m`),Z.push(`Passed: ${$.passed} | Failed: ${$.failed} | Warnings: ${$.warnings}
|
|
10347
10643
|
`);let X=["required","recommended","optional"];for(let Q of X){let J=$.checks.filter((G)=>G.category===Q);if(J.length===0)continue;Z.push(`
|
|
10348
10644
|
${Q.toUpperCase()}:`);for(let G of J){let K=G.passed?"\x1B[32m\u2713\x1B[0m":"\x1B[31m\u2717\x1B[0m";if(Z.push(` ${K} ${G.name}: ${G.message}`),G.details)Z.push(` ${G.details}`)}}return Z.push(""),Z.join(`
|
|
10349
|
-
`)}
|
|
10645
|
+
`)}C4();O5();f1();g1();async function sH($,Z){let Y={success:!0,files:{icons:[]},errors:[],warnings:[]},X=$.pwa;if(!X?.enabled)return Y;try{TU.mkdirSync(Z,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${Z}`),Y.success=!1,Y}try{let J=R6($);if(J){let G=Z6.join(Z,"manifest.json");await Bun.write(G,J),Y.files.manifest=G}}catch(J){let G=J instanceof Error?J.message:String(J);Y.errors.push(`Failed to generate manifest.json: ${G}`),Y.success=!1}if(X.icons?.src)if(await q6()){let G=await K6($,Z);if(Y.files.icons=G.generatedFiles,Y.warnings.push(...G.warnings),!G.success)Y.errors.push(...G.errors),Y.success=!1}else Y.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(X.offline?.enabled)try{let J=await eY($);if(J){let G=Z6.join(Z,"offline.html");await Bun.write(G,J),Y.files.offlinePage=G}}catch(J){let G=J instanceof Error?J.message:String(J);Y.errors.push(`Failed to generate offline page: ${G}`),Y.success=!1}let Q;if(X.precache?.enabled){let J=$1(Z,$);Q={fileCount:J.fileCount,totalSize:J.totalSize},Y.precacheStats=Q}try{let J=z5($,Z);if(J){let G=V1($),K=Z6.join(Z,G);await Bun.write(K,J),Y.files.serviceWorker=K}}catch(J){let G=J instanceof Error?J.message:String(J);Y.errors.push(`Failed to generate service worker: ${G}`),Y.success=!1}return Y}function oH($,Z){return x$($,Z)}function rH($){return $.pwa?.enabled===!0}export{hU as validateManifest,fH as runPwaAudit,nW as registerPwaDirectives,JQ as pwaUpdateDirective,GQ as pwaPushDirective,QQ as pwaOfflineDirective,XQ as pwaInstallDirective,P4 as pwaDirectives,oH as processPwaHtml,gU as mergeManifestConfig,F6 as isWorkboxEnabled,q6 as isSharpAvailable,rH as isPwaEnabled,x$ as injectPwaTags,V1 as getServiceWorkerFileName,DU as getExpectedIconPaths,IX as generateThemeColorMeta,wX as generateSwRegistrationScript,TX as generateServiceWorkerAuto,z5 as generateServiceWorker,j5 as generatePwaTags,K6 as generatePwaIcons,B5 as generatePrecacheManifestJs,$1 as generatePrecacheManifest,eY as generateOfflinePage,MX as generateManifestLink,R6 as generateManifestJson,yX as generateManifest,_6 as formatSize,gH as formatAuditResult,AU as calculateAuditResult,sH as buildPwaAssets,RU as auditConfig,NU as auditBuildOutput,G6 as FAVICON_SIZES,J6 as DEFAULT_ICON_SIZES,Q6 as APPLE_TOUCH_ICON_SIZES};
|