@stacksjs/stx 0.2.131 → 0.2.132
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/cli.js +7 -4
- package/dist/craft.js +98 -95
- package/dist/pwa.js +6 -3
- package/dist/runtime-injection.js +16 -3
- package/dist/ssg.js +65 -62
- package/package.json +5 -5
package/dist/ssg.js
CHANGED
|
@@ -734,7 +734,7 @@ ${U}${F}
|
|
|
734
734
|
'use strict';
|
|
735
735
|
${J}${Y}
|
|
736
736
|
${U}
|
|
737
|
-
})()</script>`}var NQ,kQ,A9,bQ,vQ,hQ;var h5=S(()=>{M0();NQ=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;kQ=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useFetch","useQuery","useMutation","useOptimistic","useId","useReactiveProp","useLocalStorage","useSessionStorage","useCookie","useWebSocket","useHead","useSeoMeta","definePageMeta","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","ref","reactive","computed","watch","watchEffect","watchMultiple","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","defineProps","withDefaults","defineEmits","defineExpose","defineSlots","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","registerStoresClient","useStore","action","createSelector","h","Fragment"],A9=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"];bQ=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process","Modal","Intl"]);vQ={left:0,middle:1,right:2};hQ=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 lQ($){let Z="",Y=null,J=!1;for(let X=0;X<$.length;X++){let Q=$[X];if(J){J=!1;continue}if(Q==="\\"&&Y){J=!0;continue}if(Y){if(Y==="`"&&Q==="$"&&X+1<$.length&&$[X+1]==="{"){let G=1;X+=2;while(X<$.length&&G>0){if($[X]==="{")G++;else if($[X]==="}")G--;if(G>0)Z+=$[X],X++}continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}Z+=Q}return Z}function cQ($,Z){let Y=/[$A-Z_a-z][$\w]*/g,J;while((J=Y.exec($))!==null){let X=J[0],Q=$[J.index-1];if(
|
|
737
|
+
})()</script>`}var NQ,kQ,A9,bQ,vQ,hQ;var h5=S(()=>{M0();NQ=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;kQ=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useFetch","useQuery","useMutation","useOptimistic","useId","useReactiveProp","useLocalStorage","useSessionStorage","useCookie","useWebSocket","useHead","useSeoMeta","definePageMeta","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","ref","reactive","computed","watch","watchEffect","watchMultiple","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","defineProps","withDefaults","defineEmits","defineExpose","defineSlots","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","registerStoresClient","useStore","action","createSelector","h","Fragment"],A9=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"];bQ=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process","Modal","Intl"]);vQ={left:0,middle:1,right:2};hQ=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 lQ($){let Z="",Y=null,J=!1;for(let X=0;X<$.length;X++){let Q=$[X];if(J){J=!1;continue}if(Q==="\\"&&Y){J=!0;continue}if(Y){if(Y==="`"&&Q==="$"&&X+1<$.length&&$[X+1]==="{"){let G=1;X+=2;while(X<$.length&&G>0){if($[X]==="{")G++;else if($[X]==="}")G--;if(G>0)Z+=$[X],X++}continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}Z+=Q}return Z}function cQ($,Z){let Y=/[$A-Z_a-z][$\w]*/g,J;while((J=Y.exec($))!==null){let X=J[0],Q=$[J.index-1];if(mQ.has(X))throw Error(`Potentially unsafe expression (matched /\\b${X}\\b/; identifier ${X}): ${Z}`);if(Q==="."&&D9.has(X))throw Error(`Potentially unsafe expression (matched /.${X}/; property ${X}): ${Z}`)}}function iQ($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let J=Y[2];if(!D9.has(J))continue;let X=$.slice(0,Y.index).match(/\S(?=\s*$)/)?.[0],Q=$.slice(Y.index+Y[0].length).match(/^\s*(\S)/)?.[1];if(!((X==="{"||X===",")&&Q===":"))throw Error(`Potentially unsafe expression (bracket key ${Y[2]}): ${$}`)}}function N$($){let Z=$.trim(),Y=lQ(Z);cQ(Y,Z),iQ(Z);for(let J of I9)if(J.test(Y))throw Error(`Potentially unsafe expression (matched /${J.source}/): ${Z}`);if(!T9.allowBracketNotation&&pQ.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function nQ($){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,J]of Object.entries($)){if(Y.startsWith("__")||I9.some((X)=>X.test(Y)))continue;if(J&&typeof J==="object"&&!Array.isArray(J))Z[Y]=U7(J);else Z[Y]=J}return Z}function U7($,Z=0){if(Z>=T9.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((J)=>U7(J,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Y={};for(let[J,X]of Object.entries($)){if(J.startsWith("__")||J==="constructor"||J==="prototype")continue;if(X&&typeof X==="object")Y[J]=U7(X,Z+1);else Y[J]=X}return Y}function $0($,Z){try{let Y=nQ(Z),J=Object.keys(Y),X=Object.values(Y);return W0($,J)(...X)}catch{return}}function K0($){try{return N$($),!0}catch{return!1}}function T0($,Z){try{let Y=$0($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function W0($,Z){let Y=N$($),J=/^[A-Za-z_$][\w$]*$/,X=[],Q=[];for(let z=0;z<Z.length;z++){let q=Z[z];if(!J.test(q))continue;if(E9.has(q))continue;X.push(z),Q.push(q)}let G=(z)=>Function(...Q,...z,`
|
|
738
738
|
'use strict';
|
|
739
739
|
try {
|
|
740
740
|
return ${Y};
|
|
@@ -745,7 +745,7 @@ catch (e) {
|
|
|
745
745
|
}
|
|
746
746
|
throw e;
|
|
747
747
|
}
|
|
748
|
-
`),K=G([]);if(Q.length===Z.length)return M9(K,Q,G);return M9((...z)=>{let q=Array(X.length);for(let U=0;U<X.length;U++)q[U]=z[X[U]];return K(...q)},Q,G,(z)=>{K=G(z)})}function M9($,Z,Y,J){let Q=/^(\w+) is not defined$/,G=$,K=[],W=new Set(Z);return(...z)=>{for(let q=0;q<=8;q++)try{return G(...z)}catch(U){let j=U instanceof Error?U.message:"",_=Q.exec(j);if(!(U instanceof ReferenceError)||!_)return;let B=_[1];if(W.has(B)||E9.has(B))return;W.add(B),K.push(B),G=Y(K),J?.(K)}return}}function M$($){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 J of Y)if(J.test(Z))return!1;return!0}var mQ,T9,I9,uQ,D9,pQ,E9;var w0=S(()=>{mQ={maxSanitizeDepth:10,allowBracketNotation:!1},T9={...mQ},I9=[/\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/],uQ=new Set(["eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this"]),D9=new Set(["__proto__","constructor","prototype"]),pQ=/[\w)\]]\s*\[\s*['"]/;E9=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"])});function T$($,Z){let Y=oQ++,J=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return sQ.set(J,{type:$,expression:Z}),J}var oQ=0,sQ;var k9=S(()=>{sQ=new Map});function C9($,Z,Y,J){Y.lastIndex=Z;let X=Y.exec($);if(!X||X.index!==Z)return-1;J.lastIndex=Y.lastIndex;let Q=J.exec($);if(!Q)return-1;return Q.index+Q[0].length}function O1($,Z){return C9($,Z,b9,S9)}function Y5($,Z){return C9($,Z,y9,P9)}function d5($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function rQ($,Z){if($.startsWith("<!--",Z)){let Y=d5($,Z);return Y===-1?$.length:Y}for(let[Y,J]of[[b9,S9],[y9,P9]]){Y.lastIndex=Z;let X=Y.exec($);if(!X||X.index!==Z)continue;J.lastIndex=Y.lastIndex;let Q=J.exec($);return Q?Q.index+Q[0].length:$.length}return-1}function j7($,Z){let Y=[],J=0,X=$.length,Q=!1,G=null;while(J<X){let K=$[J];if(Q){if(G){if(K===G)G=null}else if(K==='"'||K==="'")G=K;else if(K===">")Q=!1;J++;continue}if(K!=="<"){J++;continue}let W=Z($,J);if(W>J){Y.push({start:J,end:W,token:$.slice(J,W)}),J=W;continue}let z=rQ($,J);if(z>J){J=z;continue}if(/^<\/?[a-zA-Z]/.test($.slice(J,J+2)))Q=!0;J++}return Y}function Z1($,Z,Y){let J=j7($,Z);if(J.length===0)return{output:$,tokens:[]};let X=J.map((K)=>K.token),Q="",G=0;for(let K=0;K<J.length;K++){let W=J[K];Q+=$.slice(G,W.start),Q+=Y(W.token,K),G=W.end}return Q+=$.slice(G),{output:Q,tokens:X}}function L1($){let{output:Z,tokens:Y}=Z1($,O1,(J,X)=>`\x00STX_SCRIPT_${X}\x00`);return{output:Z,scripts:Y}}function m5($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,J)=>Z[+J]??"")}var b9,S9,y9,P9;var C1=S(()=>{b9=/<script\b[^>]*>/iy,S9=/<\/script\s*>/ig,y9=/<style\b[^>]*>/iy,P9=/<\/style\s*>/ig});var d9={};a(d9,{usesSignalsInScript:()=>J5,unescapeHtml:()=>_7,registerFilters:()=>tQ,registerFilter:()=>f9,processExpressions:()=>F1,interpolateScriptsInTemplate:()=>$G,interpolateScriptExpressions:()=>I$,getAllFilters:()=>g9,evaluateExpression:()=>c0,escapeHtml:()=>r0,defaultFilters:()=>p5,clearCustomFilters:()=>eQ,applyFilters:()=>h9});function aQ($){let Z=v9.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),v9.set($,Z)}return Z.lastIndex=0,Z}function f9($,Z){if($ in p5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);u5[$]=Z}function tQ($){for(let[Z,Y]of Object.entries($))f9(Z,Y)}function g9(){return{...p5,...u5}}function eQ(){for(let $ of Object.keys(u5))delete u5[$]}function r0($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function J5($){let{scripts:Z}=L1($);for(let Y of Z){let J=Y.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!J||/\bserver\b|\bsrc\s*=/.test(J[1]))continue;let X=J[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(X))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function x9($,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"],J=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),X="",Q=!1,G=0;for(let z=0;z<J.length;z++){let q=J[z];if(!Q&&q==="`"){Q=!0,G=0;continue}if(Q){if(q==="`"&&G===0){Q=!1;continue}if(q==="$"&&J[z+1]==="{"){G++,z++,X+=" ";continue}if(q==="}"&&G>0){G--;continue}if(G>0){X+=q;continue}continue}X+=q}J=X;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,W;while((W=K.exec(J))!==null){let z=W[1];if(!J.substring(0,W.index).trimEnd().endsWith(".")){if(!Y.includes(z)&&!(z in Z))return!1}}return!0}function I$($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(J,X)=>{try{let Q=c0(X,Z);if(Q===void 0)return J;return Q===null?"":String(Q)}catch{return J}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(J,X)=>{let Q=X.trim();if(/^__[A-Z_]+__$/.test(Q))return J;try{let G=c0(X,Z);if(G===void 0)return J;return JSON.stringify(G)}catch{return J}}),Y}function $G($,Z,Y={}){let{output:J,scripts:X}=L1($),Q=X.map((G)=>{let K=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),W=G.match(/^<script\b[^>]*>/i),z=G.search(/<\/script\s*>$/i);if(!K||!W||z===-1)return G;let q=K[1],U=K[2];if(/\bsrc\s*=/.test(q))return G;if(/\bdata-raw\b/.test(q))return G;if(/\btype\s*=\s*["']application\/json["']/.test(q))return G;if(Y.skipServer&&/\bserver\b/.test(q))return G;let j=I$(U,Z);return W[0]+j+G.slice(z)});return m5(J,Q)}function F1($,Z,Y,J){let X=$,Q=(j,_)=>{let B=Y5(j,_);if(B===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(j.slice(_,B))?-1:B},G=(j,_,B,H)=>{let L=B.length,{output:V,tokens:O}=Z1(j,_,(F,w)=>H(L+w));return B.push(...O),V},K=[];X=G(X,Q,K,(j)=>`<!--__STX_STYLE_${j}__-->`);let W=[];X=G(X,O1,W,(j)=>`<!--__STX_SCRIPT_EXPR_${j}__-->`);let z=J?.forceSignals===!0||Z?.__stx_force_signals===!0||Array.isArray(Z?.__stx_client_signal_names)||J5($),q=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),U=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);X=X.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(j,_,B)=>{try{let H=c0(_,Z);return H!==void 0&&H!==null?String(H):""}catch(H){let L=H instanceof Error?H.message:String(H);return q0("Expression",`Error evaluating: {{{ ${_.trim()}}}}: ${L}`,Y,$,B,j)}}),X=X.replace(/\{!!([\s\S]*?)!!\}/g,(j,_,B)=>{try{let H=c0(_,Z);if(H===void 0&&Z.__stx_buildMode==="compile")return T$("raw",_.trim());return H!==void 0&&H!==null?String(H):""}catch(H){if(Z.__stx_buildMode==="compile")return T$("raw",_.trim());let L=H instanceof Error?H.message:String(H);return q0("Expression",`Error evaluating: {!! ${_.trim()} !!}: ${L}`,Y,$,B,j)}}),X=G(X,O1,W,(j)=>`<!--__STX_SCRIPT_EXPR_${j}__-->`),X=G(X,Q,K,(j)=>`<!--__STX_STYLE_${j}__-->`),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(j,_,B)=>{let H=_.trim();if(U.has(H))return j;let L=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],V=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,F=H.match(V)?.[1],w=F&&((F in Z)||L.includes(F)),A=Boolean(F&&q.has(F)),R=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,N=H.match(R),M=N&&!L.includes(N[1])&&!(N[1]in Z);if(/^__[A-Z_]+__$/.test(H))return"";try{let T=c0(_,Z);if(A)return j;if(z&&!x9(H,Z))return j;if(T===void 0&&Z.__stx_buildMode==="compile"&&!z)return T$("expr",H);return T!==void 0&&T!==null?r0(String(T)):""}catch(T){if(A)return j;if(z&&!x9(H,Z))return j;if(M)return j;let I=T instanceof Error?T.message:String(T);return q0("Expression",`Error evaluating: {{ ${H} }}: ${I}`,Y,$,B,j)}});for(let j=0;j<W.length;j++)X=X.replace(`<!--__STX_SCRIPT_EXPR_${j}__-->`,()=>W[j]);for(let j=0;j<K.length;j++)X=X.replace(`<!--__STX_STYLE_${j}__-->`,()=>K[j]);return X}function h9($,Z,Y){if(!Z.trim())return $;let J=$,X=Z.trim();while(X.length>0){let Q=X.match(/^(\w+)/);if(!Q)break;let G=Q[1];X=X.substring(G.length).trim();let K=u5[G]||p5[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(g9()).join(", ")}`);let W=[];if(X.startsWith(":")){let z=X.match(/^:([^|\s]+)/);if(z){let q=z[1].trim();try{let U=Number(q);W=[Number.isNaN(U)?q:U]}catch{W=[q]}X=X.substring(z[0].length).trim()}}else if(X.startsWith("(")){let z=1,q=1;while(z>0&&q<X.length){if(X[q]==="(")z++;if(X[q]===")")z--;q++}if(z===0){let U=X.substring(1,q-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))W=[c0(`(${U})`,Y,!0)];else{let j=[],_="",B=null,H=0,L=0,V=0,O=!1;for(let F=0;F<U.length;F++){let w=U[F];if(O){_+=w,O=!1;continue}if(w==="\\"){_+=w,O=!0;continue}if(B){if(_+=w,w===B)B=null;continue}if(w==='"'||w==="'"||w==="`"){B=w,_+=w;continue}if(w==="(")H++;else if(w===")")H--;else if(w==="[")L++;else if(w==="]")L--;else if(w==="{")V++;else if(w==="}")V--;if(w===","&&H===0&&L===0&&V===0){j.push(_),_="";continue}_+=w}if(_)j.push(_);W=j.map((F)=>{let w=F.trim();return c0(w,Y,!0)})}}catch{W=[U]}X=X.substring(q).trim()}}try{J=K(J,Y,...W)}catch(z){let q=z instanceof Error?z.message:String(z);throw Error(`Error applying filter '${G}': ${q}`)}if(X.startsWith("|"))X=X.substring(1).trim();else break}return J}function ZG($){let Z=!1,Y="",J=0,X=0,Q=0,G=!1;for(let K=0;K<$.length;K++){let W=$[K],z=$[K+1];if(Z&&G){G=!1;continue}if(Z&&W==="\\"){G=!0;continue}if(G=!1,(W==='"'||W==="'"||W==="`")&&!G){if(!Z)Z=!0,Y=W;else if(W===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&W==="$"&&z==="{"){let q=1;K+=2;while(K<$.length&&q>0){if($[K]==="{")q++;else if($[K]==="}")q--;if(q>0)K++}continue}if(Z)continue;if(W==="(")J++;else if(W===")")J--;else if(W==="[")X++;else if(W==="]")X--;else if(W==="{")Q++;else if(W==="}")Q--;if(W==="|"&&J===0&&X===0&&Q===0){if(z==="|"){K++;continue}if(z==="="){K++;continue}return K}}return-1}function c0($,Z,Y=!1){try{let J=$.trim(),X=ZG(J);if(X>0){let Q=J.substring(0,X).trim(),G=J.substring(X+1).trim(),K=c0(Q,Z,!0);return h9(K,G,Z)}if(!K0(J)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return $0(J,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return W0(J,Q)(...G)}catch{return $0(J,Z)}}catch(J){if(J instanceof ReferenceError){let X=/(\b\w+)\s+is not defined/.exec(J.message);if(X){let Q=X[1],G=YG(Q,Object.keys(Z));if(G&&G!==Q)J.message=`${J.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,J);throw J}}function YG($,Z){let Y=null;for(let X of Z){if(X===$)continue;let Q=JG($,X);if(Y===null||Q<Y.dist)Y={key:X,dist:Q}}if(!Y)return null;let J=Math.max($.length,Y.key.length);if(Y.dist<=2||Y.dist/J<=0.35)return Y.key;return null}function JG($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[Y,J]=$.length<Z.length?[$,Z]:[Z,$],X=Array(Y.length+1),Q=Array(Y.length+1);for(let G=0;G<=Y.length;G++)X[G]=G;for(let G=1;G<=J.length;G++){Q[0]=G;for(let K=1;K<=Y.length;K++){let W=Y[K-1]===J[G-1]?0:1;Q[K]=Math.min(Q[K-1]+1,X[K]+1,X[K-1]+W)}for(let K=0;K<=Y.length;K++)X[K]=Q[K]}return X[Y.length]}function _7($){if(!$)return"";return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}var u5,v9,p5;var Y1=S(()=>{w0();M0();k9();C1();u5={},v9=new Map;p5={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 J=Number($);return Number.isNaN(J)?"":J.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:($,Z,Y="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return J.toLocaleString(Y)}catch{return String($)}},join:($,Z,Y=",")=>{if(!Array.isArray($))return"";return $.join(String(Y))},escape:($,Z)=>{if($===void 0||$===null)return"";return r0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let J=Z.__translations,X=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=J;for(let W of Q){if(G===void 0||G===null)break;G=G[W]}if(G===void 0||G===null)return X?$:"";let K=String(G);return Object.entries(Y).forEach(([W,z])=>{K=K.replace(aQ(W),String(z))}),K},t:($,Z,Y={})=>{return p5.translate($,Z,Y)},truncate:($,Z,Y=50,J="...")=>{if($===void 0||$===null)return"";let X=String($);if(X.length<=Y)return X;if(Y<=J.length)return J.substring(0,Y);return X.substring(0,Y-J.length)+J},date:($,Z,Y="short",J="en-US")=>{if($===void 0||$===null)return"";try{let X=$ instanceof Date?$:new Date($);if(Number.isNaN(X.getTime()))return String($);let Q={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 X.toISOString();return new Intl.DateTimeFormat(J,Q[Y]||Q.short).format(X)}catch{return String($)}},currency:($,Z,Y="USD",J="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return new Intl.NumberFormat(J,{style:"currency",currency:Y}).format(X)}catch{return String($)}},pluralize:($,Z,Y,J)=>{let X=Number($);if(Number.isNaN(X))return Y;let Q=J||`${Y}s`;return X===1?Y:Q},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,J)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,J);return $},replace:($,Z,Y,J="")=>{if($===void 0||$===null)return"";let X=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(X,"g"),()=>J)},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 J=Number($);if(Number.isNaN(J))return 0;let X=10**Y;return Math.round(J*X)/X}}});function X5($="const",Z=[],Y){let J=Z.length?D$.filter((X)=>!Z.includes(X)):D$;if(Y!==void 0)J=J.filter((X)=>{let Q=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${Q}(?![\\w$])`).test(Y)});return`${$} { ${J.join(", ")} } = window.stx;`}var D$,m9;var l5=S(()=>{D$=["batch","computed","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","navigate","nextTick","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","provide","reactive","ref","registerStoresClient","state","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","withDefaults"],m9=["onMount","onDestroy"]});class v1{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 G5($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!Q5.has(Y)){if(Q5.size>=XG){let J=Q5.keys().next().value;if(J)Q5.delete(J)}Q5.set(Y,new RegExp($,Z))}return Q5.get(Y)}class u9{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),J=this.pool.find((K)=>K.context.join(",")===Y);if(J)return J.func;let X=this.fnCache,Q=this.fnCacheMaxSize,G=(...K)=>{return(W)=>{try{let z=`${Y}:${W}`,q=X.get(z);if(!q){if(X.size>=Q){let U=X.keys().next().value;if(U)X.delete(U)}q=Function(...Z,`
|
|
748
|
+
`),K=G([]);if(Q.length===Z.length)return M9(K,Q,G);return M9((...z)=>{let q=Array(X.length);for(let U=0;U<X.length;U++)q[U]=z[X[U]];return K(...q)},Q,G,(z)=>{K=G(z)})}function M9($,Z,Y,J){let Q=/^(\w+) is not defined$/,G=$,K=[],W=new Set(Z);return(...z)=>{for(let q=0;q<=8;q++)try{return G(...z)}catch(U){let j=U instanceof Error?U.message:"",_=Q.exec(j);if(!(U instanceof ReferenceError)||!_)return;let B=_[1];if(W.has(B)||E9.has(B))return;W.add(B),K.push(B),G=Y(K),J?.(K)}return}}function M$($){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 J of Y)if(J.test(Z))return!1;return!0}var uQ,T9,I9,mQ,D9,pQ,E9;var w0=S(()=>{uQ={maxSanitizeDepth:10,allowBracketNotation:!1},T9={...uQ},I9=[/\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/],mQ=new Set(["eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this"]),D9=new Set(["__proto__","constructor","prototype"]),pQ=/[\w)\]]\s*\[\s*['"]/;E9=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"])});function T$($,Z){let Y=oQ++,J=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return sQ.set(J,{type:$,expression:Z}),J}var oQ=0,sQ;var k9=S(()=>{sQ=new Map});function C9($,Z,Y,J){Y.lastIndex=Z;let X=Y.exec($);if(!X||X.index!==Z)return-1;J.lastIndex=Y.lastIndex;let Q=J.exec($);if(!Q)return-1;return Q.index+Q[0].length}function O1($,Z){return C9($,Z,b9,S9)}function Y5($,Z){return C9($,Z,y9,P9)}function d5($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function rQ($,Z){if($.startsWith("<!--",Z)){let Y=d5($,Z);return Y===-1?$.length:Y}for(let[Y,J]of[[b9,S9],[y9,P9]]){Y.lastIndex=Z;let X=Y.exec($);if(!X||X.index!==Z)continue;J.lastIndex=Y.lastIndex;let Q=J.exec($);return Q?Q.index+Q[0].length:$.length}return-1}function j7($,Z){let Y=[],J=0,X=$.length,Q=!1,G=null;while(J<X){let K=$[J];if(Q){if(G){if(K===G)G=null}else if(K==='"'||K==="'")G=K;else if(K===">")Q=!1;J++;continue}if(K!=="<"){J++;continue}let W=Z($,J);if(W>J){Y.push({start:J,end:W,token:$.slice(J,W)}),J=W;continue}let z=rQ($,J);if(z>J){J=z;continue}if(/^<\/?[a-zA-Z]/.test($.slice(J,J+2)))Q=!0;J++}return Y}function Z1($,Z,Y){let J=j7($,Z);if(J.length===0)return{output:$,tokens:[]};let X=J.map((K)=>K.token),Q="",G=0;for(let K=0;K<J.length;K++){let W=J[K];Q+=$.slice(G,W.start),Q+=Y(W.token,K),G=W.end}return Q+=$.slice(G),{output:Q,tokens:X}}function L1($){let{output:Z,tokens:Y}=Z1($,O1,(J,X)=>`\x00STX_SCRIPT_${X}\x00`);return{output:Z,scripts:Y}}function u5($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,J)=>Z[+J]??"")}var b9,S9,y9,P9;var C1=S(()=>{b9=/<script\b[^>]*>/iy,S9=/<\/script\s*>/ig,y9=/<style\b[^>]*>/iy,P9=/<\/style\s*>/ig});var d9={};a(d9,{usesSignalsInScript:()=>J5,unescapeHtml:()=>_7,registerFilters:()=>tQ,registerFilter:()=>f9,processExpressions:()=>F1,interpolateScriptsInTemplate:()=>$G,interpolateScriptExpressions:()=>I$,getAllFilters:()=>g9,evaluateExpression:()=>c0,escapeHtml:()=>r0,defaultFilters:()=>p5,clearCustomFilters:()=>eQ,applyFilters:()=>h9});function aQ($){let Z=v9.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),v9.set($,Z)}return Z.lastIndex=0,Z}function f9($,Z){if($ in p5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);m5[$]=Z}function tQ($){for(let[Z,Y]of Object.entries($))f9(Z,Y)}function g9(){return{...p5,...m5}}function eQ(){for(let $ of Object.keys(m5))delete m5[$]}function r0($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function J5($){let{scripts:Z}=L1($);for(let Y of Z){let J=Y.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!J||/\bserver\b|\bsrc\s*=/.test(J[1]))continue;let X=J[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(X))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function x9($,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"],J=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),X="",Q=!1,G=0;for(let z=0;z<J.length;z++){let q=J[z];if(!Q&&q==="`"){Q=!0,G=0;continue}if(Q){if(q==="`"&&G===0){Q=!1;continue}if(q==="$"&&J[z+1]==="{"){G++,z++,X+=" ";continue}if(q==="}"&&G>0){G--;continue}if(G>0){X+=q;continue}continue}X+=q}J=X;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,W;while((W=K.exec(J))!==null){let z=W[1];if(!J.substring(0,W.index).trimEnd().endsWith(".")){if(!Y.includes(z)&&!(z in Z))return!1}}return!0}function I$($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(J,X)=>{try{let Q=c0(X,Z);if(Q===void 0)return J;return Q===null?"":String(Q)}catch{return J}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(J,X)=>{let Q=X.trim();if(/^__[A-Z_]+__$/.test(Q))return J;try{let G=c0(X,Z);if(G===void 0)return J;return JSON.stringify(G)}catch{return J}}),Y}function $G($,Z,Y={}){let{output:J,scripts:X}=L1($),Q=X.map((G)=>{let K=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),W=G.match(/^<script\b[^>]*>/i),z=G.search(/<\/script\s*>$/i);if(!K||!W||z===-1)return G;let q=K[1],U=K[2];if(/\bsrc\s*=/.test(q))return G;if(/\bdata-raw\b/.test(q))return G;if(/\btype\s*=\s*["']application\/json["']/.test(q))return G;if(Y.skipServer&&/\bserver\b/.test(q))return G;let j=I$(U,Z);return W[0]+j+G.slice(z)});return u5(J,Q)}function F1($,Z,Y,J){let X=$,Q=(j,_)=>{let B=Y5(j,_);if(B===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(j.slice(_,B))?-1:B},G=(j,_,B,H)=>{let L=B.length,{output:V,tokens:O}=Z1(j,_,(F,w)=>H(L+w));return B.push(...O),V},K=[];X=G(X,Q,K,(j)=>`<!--__STX_STYLE_${j}__-->`);let W=[];X=G(X,O1,W,(j)=>`<!--__STX_SCRIPT_EXPR_${j}__-->`);let z=J?.forceSignals===!0||Z?.__stx_force_signals===!0||Array.isArray(Z?.__stx_client_signal_names)||J5($),q=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),U=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);X=X.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(j,_,B)=>{try{let H=c0(_,Z);return H!==void 0&&H!==null?String(H):""}catch(H){let L=H instanceof Error?H.message:String(H);return q0("Expression",`Error evaluating: {{{ ${_.trim()}}}}: ${L}`,Y,$,B,j)}}),X=X.replace(/\{!!([\s\S]*?)!!\}/g,(j,_,B)=>{try{let H=c0(_,Z);if(H===void 0&&Z.__stx_buildMode==="compile")return T$("raw",_.trim());return H!==void 0&&H!==null?String(H):""}catch(H){if(Z.__stx_buildMode==="compile")return T$("raw",_.trim());let L=H instanceof Error?H.message:String(H);return q0("Expression",`Error evaluating: {!! ${_.trim()} !!}: ${L}`,Y,$,B,j)}}),X=G(X,O1,W,(j)=>`<!--__STX_SCRIPT_EXPR_${j}__-->`),X=G(X,Q,K,(j)=>`<!--__STX_STYLE_${j}__-->`),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(j,_,B)=>{let H=_.trim();if(U.has(H))return j;let L=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],V=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,F=H.match(V)?.[1],w=F&&((F in Z)||L.includes(F)),A=Boolean(F&&q.has(F)),R=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,N=H.match(R),M=N&&!L.includes(N[1])&&!(N[1]in Z);if(/^__[A-Z_]+__$/.test(H))return"";try{let T=c0(_,Z);if(A)return j;if(z&&!x9(H,Z))return j;if(T===void 0&&Z.__stx_buildMode==="compile"&&!z)return T$("expr",H);return T!==void 0&&T!==null?r0(String(T)):""}catch(T){if(A)return j;if(z&&!x9(H,Z))return j;if(M)return j;let I=T instanceof Error?T.message:String(T);return q0("Expression",`Error evaluating: {{ ${H} }}: ${I}`,Y,$,B,j)}});for(let j=0;j<W.length;j++)X=X.replace(`<!--__STX_SCRIPT_EXPR_${j}__-->`,()=>W[j]);for(let j=0;j<K.length;j++)X=X.replace(`<!--__STX_STYLE_${j}__-->`,()=>K[j]);return X}function h9($,Z,Y){if(!Z.trim())return $;let J=$,X=Z.trim();while(X.length>0){let Q=X.match(/^(\w+)/);if(!Q)break;let G=Q[1];X=X.substring(G.length).trim();let K=m5[G]||p5[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(g9()).join(", ")}`);let W=[];if(X.startsWith(":")){let z=X.match(/^:([^|\s]+)/);if(z){let q=z[1].trim();try{let U=Number(q);W=[Number.isNaN(U)?q:U]}catch{W=[q]}X=X.substring(z[0].length).trim()}}else if(X.startsWith("(")){let z=1,q=1;while(z>0&&q<X.length){if(X[q]==="(")z++;if(X[q]===")")z--;q++}if(z===0){let U=X.substring(1,q-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))W=[c0(`(${U})`,Y,!0)];else{let j=[],_="",B=null,H=0,L=0,V=0,O=!1;for(let F=0;F<U.length;F++){let w=U[F];if(O){_+=w,O=!1;continue}if(w==="\\"){_+=w,O=!0;continue}if(B){if(_+=w,w===B)B=null;continue}if(w==='"'||w==="'"||w==="`"){B=w,_+=w;continue}if(w==="(")H++;else if(w===")")H--;else if(w==="[")L++;else if(w==="]")L--;else if(w==="{")V++;else if(w==="}")V--;if(w===","&&H===0&&L===0&&V===0){j.push(_),_="";continue}_+=w}if(_)j.push(_);W=j.map((F)=>{let w=F.trim();return c0(w,Y,!0)})}}catch{W=[U]}X=X.substring(q).trim()}}try{J=K(J,Y,...W)}catch(z){let q=z instanceof Error?z.message:String(z);throw Error(`Error applying filter '${G}': ${q}`)}if(X.startsWith("|"))X=X.substring(1).trim();else break}return J}function ZG($){let Z=!1,Y="",J=0,X=0,Q=0,G=!1;for(let K=0;K<$.length;K++){let W=$[K],z=$[K+1];if(Z&&G){G=!1;continue}if(Z&&W==="\\"){G=!0;continue}if(G=!1,(W==='"'||W==="'"||W==="`")&&!G){if(!Z)Z=!0,Y=W;else if(W===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&W==="$"&&z==="{"){let q=1;K+=2;while(K<$.length&&q>0){if($[K]==="{")q++;else if($[K]==="}")q--;if(q>0)K++}continue}if(Z)continue;if(W==="(")J++;else if(W===")")J--;else if(W==="[")X++;else if(W==="]")X--;else if(W==="{")Q++;else if(W==="}")Q--;if(W==="|"&&J===0&&X===0&&Q===0){if(z==="|"){K++;continue}if(z==="="){K++;continue}return K}}return-1}function c0($,Z,Y=!1){try{let J=$.trim(),X=ZG(J);if(X>0){let Q=J.substring(0,X).trim(),G=J.substring(X+1).trim(),K=c0(Q,Z,!0);return h9(K,G,Z)}if(!K0(J)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return $0(J,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return W0(J,Q)(...G)}catch{return $0(J,Z)}}catch(J){if(J instanceof ReferenceError){let X=/(\b\w+)\s+is not defined/.exec(J.message);if(X){let Q=X[1],G=YG(Q,Object.keys(Z));if(G&&G!==Q)J.message=`${J.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,J);throw J}}function YG($,Z){let Y=null;for(let X of Z){if(X===$)continue;let Q=JG($,X);if(Y===null||Q<Y.dist)Y={key:X,dist:Q}}if(!Y)return null;let J=Math.max($.length,Y.key.length);if(Y.dist<=2||Y.dist/J<=0.35)return Y.key;return null}function JG($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[Y,J]=$.length<Z.length?[$,Z]:[Z,$],X=Array(Y.length+1),Q=Array(Y.length+1);for(let G=0;G<=Y.length;G++)X[G]=G;for(let G=1;G<=J.length;G++){Q[0]=G;for(let K=1;K<=Y.length;K++){let W=Y[K-1]===J[G-1]?0:1;Q[K]=Math.min(Q[K-1]+1,X[K]+1,X[K-1]+W)}for(let K=0;K<=Y.length;K++)X[K]=Q[K]}return X[Y.length]}function _7($){if(!$)return"";return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}var m5,v9,p5;var Y1=S(()=>{w0();M0();k9();C1();m5={},v9=new Map;p5={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 J=Number($);return Number.isNaN(J)?"":J.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:($,Z,Y="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return J.toLocaleString(Y)}catch{return String($)}},join:($,Z,Y=",")=>{if(!Array.isArray($))return"";return $.join(String(Y))},escape:($,Z)=>{if($===void 0||$===null)return"";return r0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let J=Z.__translations,X=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=J;for(let W of Q){if(G===void 0||G===null)break;G=G[W]}if(G===void 0||G===null)return X?$:"";let K=String(G);return Object.entries(Y).forEach(([W,z])=>{K=K.replace(aQ(W),String(z))}),K},t:($,Z,Y={})=>{return p5.translate($,Z,Y)},truncate:($,Z,Y=50,J="...")=>{if($===void 0||$===null)return"";let X=String($);if(X.length<=Y)return X;if(Y<=J.length)return J.substring(0,Y);return X.substring(0,Y-J.length)+J},date:($,Z,Y="short",J="en-US")=>{if($===void 0||$===null)return"";try{let X=$ instanceof Date?$:new Date($);if(Number.isNaN(X.getTime()))return String($);let Q={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 X.toISOString();return new Intl.DateTimeFormat(J,Q[Y]||Q.short).format(X)}catch{return String($)}},currency:($,Z,Y="USD",J="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return new Intl.NumberFormat(J,{style:"currency",currency:Y}).format(X)}catch{return String($)}},pluralize:($,Z,Y,J)=>{let X=Number($);if(Number.isNaN(X))return Y;let Q=J||`${Y}s`;return X===1?Y:Q},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,J)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,J);return $},replace:($,Z,Y,J="")=>{if($===void 0||$===null)return"";let X=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(X,"g"),()=>J)},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 J=Number($);if(Number.isNaN(J))return 0;let X=10**Y;return Math.round(J*X)/X}}});function X5($="const",Z=[],Y){let J=Z.length?D$.filter((X)=>!Z.includes(X)):D$;if(Y!==void 0)J=J.filter((X)=>{let Q=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${Q}(?![\\w$])`).test(Y)});return`${$} { ${J.join(", ")} } = window.stx;`}var D$,u9;var l5=S(()=>{D$=["batch","computed","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","navigate","nextTick","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","provide","reactive","ref","registerStoresClient","state","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","withDefaults"],u9=["onMount","onDestroy"]});class v1{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 G5($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!Q5.has(Y)){if(Q5.size>=XG){let J=Q5.keys().next().value;if(J)Q5.delete(J)}Q5.set(Y,new RegExp($,Z))}return Q5.get(Y)}class m9{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),J=this.pool.find((K)=>K.context.join(",")===Y);if(J)return J.func;let X=this.fnCache,Q=this.fnCacheMaxSize,G=(...K)=>{return(W)=>{try{let z=`${Y}:${W}`,q=X.get(z);if(!q){if(X.size>=Q){let U=X.keys().next().value;if(U)X.delete(U)}q=Function(...Z,`
|
|
749
749
|
'use strict';
|
|
750
750
|
try {
|
|
751
751
|
return ${W};
|
|
@@ -756,7 +756,7 @@ catch (e) {
|
|
|
756
756
|
}
|
|
757
757
|
throw e;
|
|
758
758
|
}
|
|
759
|
-
`),X.set(z,q)}return q(...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 p9{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(),J=Z(),X=performance.now()-Y;return this.recordTime($,X),this.checkBudget($,X),J}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),J=await Z(),X=performance.now()-Y;return this.recordTime($,X),this.checkBudget($,X),J}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let J=Z/Y.maxTime*100,X=Y.warnThreshold!==void 0?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,Q=Z>=Y.maxTime;if(!X&&!Q)return;let G={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:J,timestamp:new Date,isWarning:X};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let W of this.violationHandlers)try{W(G)}catch{}let K=X?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${J.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(J-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(Q)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 J=this.budgets.get($);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:J?.maxTime,budgetUtilization:J?Y.totalTime/Y.count/J.maxTime*100:void 0}}let Z={};for(let[Y,J]of this.metrics.entries()){let X=this.budgets.get(Y);Z[Y]={count:J.count,avgTime:J.totalTime/J.count,totalTime:J.totalTime,maxTime:J.maxTime,minTime:J.minTime,budget:X?.maxTime,budgetUtilization:X?J.totalTime/J.count/X.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 J of this.violations)if($[J.label]=($[J.label]||0)+1,J.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 QG(){if(!B7)B7=new p9;return B7}var Q5,XG=500,rB,B7=null,l9;var K5=S(()=>{Q5=new Map;rB=new
|
|
759
|
+
`),X.set(z,q)}return q(...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 p9{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(),J=Z(),X=performance.now()-Y;return this.recordTime($,X),this.checkBudget($,X),J}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),J=await Z(),X=performance.now()-Y;return this.recordTime($,X),this.checkBudget($,X),J}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let J=Z/Y.maxTime*100,X=Y.warnThreshold!==void 0?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,Q=Z>=Y.maxTime;if(!X&&!Q)return;let G={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:J,timestamp:new Date,isWarning:X};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let W of this.violationHandlers)try{W(G)}catch{}let K=X?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${J.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(J-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(Q)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 J=this.budgets.get($);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:J?.maxTime,budgetUtilization:J?Y.totalTime/Y.count/J.maxTime*100:void 0}}let Z={};for(let[Y,J]of this.metrics.entries()){let X=this.budgets.get(Y);Z[Y]={count:J.count,avgTime:J.totalTime/J.count,totalTime:J.totalTime,maxTime:J.maxTime,minTime:J.minTime,budget:X?.maxTime,budgetUtilization:X?J.totalTime/J.count/X.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 J of this.violations)if($[J.label]=($[J.label]||0)+1,J.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 QG(){if(!B7)B7=new p9;return B7}var Q5,XG=500,rB,B7=null,l9;var K5=S(()=>{Q5=new Map;rB=new m9;l9=new Proxy({},{get($,Z){return QG()[Z]}})});function c9($,Z=""){let Y=`${$}${Z}`,J=0;for(let X=0;X<Y.length;X++){let Q=Y.charCodeAt(X);J=(J<<5)-J+Q,J=J&J}return`stx-${Math.abs(J).toString(36)}`}function i9($,Z,Y={}){let{prefix:J="",preserveHost:X=!0,scopeKeyframes:Q=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=H7($),W=[],z=new Map;if(Q)for(let q of K){let U=q.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(U){let j=U[1],_=`${Z}_${j}`;z.set(j,_)}}for(let q of K){let U=n9(q,Z,J,X,z,G);W.push(U)}return W.join(`
|
|
760
760
|
|
|
761
761
|
`)}function H7($){let Z=[],Y=$.replace(/\/\*[\s\S]*?\*\//g,""),J=0,X="",Q=!1,G="";for(let K=0;K<Y.length;K++){let W=Y[K];if(W==="@"&&J===0)Q=!0;if(W==="{")J++;else if(W==="}"){if(J--,J===0){if(Q){G+=W;let z=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(z){let[,q,U,j]=z;if(q==="keyframes")Z.push({selector:`@keyframes ${U.trim()}`,declarations:j.trim()});else if(q==="media"||q==="supports"||q==="container"){let _=H7(j);Z.push({selector:`@${q} ${U.trim()}`,declarations:_.map((B)=>`${B.selector} { ${B.declarations} }`).join(`
|
|
762
762
|
`)})}else Z.push({selector:`@${q} ${U.trim()}`,declarations:j.trim()})}G="",Q=!1}else if(X.trim()){X+=W;let z=X.match(/([^{]+)\{([^}]*)\}/);if(z)Z.push({selector:z[1].trim(),declarations:z[2].trim()});X=""}continue}}if(Q)G+=W;else X+=W}return Z}function n9($,Z,Y,J,X,Q){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let q=G.replace("@keyframes ","").trim();return`@keyframes ${X.get(q)||q} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let U=H7(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((j)=>n9(j,Z,Y,J,X,Q)).join(`
|
|
@@ -767,8 +767,8 @@ catch (e) {
|
|
|
767
767
|
`,""}),headContent:Z.trim()}}function TG($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,J,X,Q)=>{let G=J?X:Z[(Q||"").trim()]??Q,K=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=W5(K,{title:G}),""})}function IG($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Y,J,X,Q,G,K)=>{let W=Q?G:K,z=Q?W:Z[(W||"").trim()]??W,U=X.includes(":")?{property:X,content:z}:{name:X,content:z},j=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=W5(j,{meta:[U]}),""})}var V1,HG,b$;var i5=S(()=>{V1={},HG=[],b$={}});var y$={};a(y$,{stripTypeScript:()=>Z8,splitDeclaration:()=>Q8,isCompleteImport:()=>Y8,hasVariables:()=>W8,extractVariables:()=>f1,extractScriptFromTemplate:()=>K8,convertToCommonJS:()=>N7});import z5 from"path";import n5 from"process";function DG($){let Z=[],Y=0,J=$.split(`
|
|
768
768
|
`);for(let X of J){let Q=Y,G=null,K=!1;for(let W=0;W<X.length;W++){let z=X[W];if(K){K=!1;continue}if(z==="\\"){K=!0;continue}if(G){if(z===G)G=null;continue}if(z==="'"||z==='"'||z==="`"){G=z;continue}if(z==="/"&&W+1<X.length&&X[W+1]==="/")break;if(z==="{")Y++;else if(z==="}")Y--}if(Q===0){let W=X.match(/(?:const|let|var)\s+(\w+)\s*=/);if(W)Z.push(W[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(X)){let z=X.match(/(?:const|let|var)\s+(\w+)/);if(z)Z.push(z[1])}else{let z=X.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(z){let U=z[1].slice(1,-1).split(",").map((j)=>{let _=j.split(":");return(_.length>1?_[1]:_[0]).trim()}).filter((j)=>/^\w+$/.test(j));Z.push(...U)}}}}return[...new Set(Z)]}function Z8($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Y(J){if(!J.includes(":"))return J;let X=[],Q="",G=0,K=0,W=null;for(let z=0;z<J.length;z++){let q=J[z];if(W){if(Q+=q,q===W)W=null;continue}if(q==='"'||q==="'"||q==="`"){W=q,Q+=q;continue}if(q==="<")G++;else if(q===">"&&G>0)G--;else if(q==="(")K++;else if(q===")")K--;if(q===","&&G===0&&K===0){X.push(Q),Q="";continue}Q+=q}if(Q)X.push(Q);return X.map((z)=>{let q=z.trim(),U=q.startsWith("..."),j=U?q.slice(3):q,_=-1,B=0;for(let A=0;A<j.length;A++)if(j[A]==="<")B++;else if(j[A]===">")B--;else if(j[A]===":"&&B===0){_=A;break}if(_===-1)return z;let L=j.substring(0,_).trim().replace(/\?$/,""),V=j.substring(_+1),O=-1,F=0;for(let A=0;A<V.length;A++)if(V[A]==="<")F++;else if(V[A]===">")F--;else if(V[A]==="="&&F===0){O=A;break}let w=U?"...":"";if(O!==-1)return`${w}${L} = ${V.substring(O+1).trim()}`;return`${w}${L}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(J,X,Q)=>{if(!Q.includes(":"))return J;return`${X}(${Y(Q)})`});{let J=/\b(function\s+\w*\s*)\(/g,X,Q=[];while((X=J.exec(Z))!==null){let G=X.index+X[0].length-1,K=1,W=G+1,z=0,q=null;while(W<Z.length&&K>0){let _=Z[W];if(q){if(_===q)q=null;W++;continue}if(_==='"'||_==="'"||_==="`"){q=_,W++;continue}if(_==="<")z++;else if(_===">"&&z>0)z--;else if(z===0){if(_==="(")K++;else if(_===")")K--}if(K>0)W++}if(K!==0)continue;let U=Z.substring(G+1,W);if(!U.includes(":"))continue;let j=Y(U);Q.push({start:G+1,end:W,replacement:j})}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:z}=Q[G];Z=Z.substring(0,K)+z+Z.substring(W)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(J,X)=>{if(!X.includes(":"))return J;if(X.includes("{")||X.includes("}"))return J;return`(${X.split(",").map((G)=>{let[K,...W]=G.split("="),z=K.split(":")[0].trim();if(W.length>0)return`${z} = ${W.join("=").trim()}`;return z}).join(", ")}) =>`}),Z=Z.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
|
|
769
769
|
|
|
770
|
-
`),Z}async function f1($,Z,Y,J={}){if(!$.trim())return;let X;try{let C=new Bun.Transpiler({loader:"ts",target:"browser",define:l0()}),P=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");P=P.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),X=C.transformSync(P)}catch{X=Z8($)}let Q={exports:{}},G=Q.exports,K=n5.cwd(),W={},z=[...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 z)try{let P=z5.resolve(K,"node_modules",C),x=z5.join(P,"package.json"),
|
|
771
|
-
`),o0=Z.params??{},E1=[],_1=[];for(let i=0;i<
|
|
770
|
+
`),Z}async function f1($,Z,Y,J={}){if(!$.trim())return;let X;try{let C=new Bun.Transpiler({loader:"ts",target:"browser",define:l0()}),P=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");P=P.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),X=C.transformSync(P)}catch{X=Z8($)}let Q={exports:{}},G=Q.exports,K=n5.cwd(),W={},z=[...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 z)try{let P=z5.resolve(K,"node_modules",C),x=z5.join(P,"package.json"),m=JSON.parse(j0("fs").readFileSync(x,"utf8")),u=m.main||"index.js";if(m.exports){let U0=typeof m.exports==="string"?m.exports:m.exports["."];if(typeof U0==="string")u=U0;else if(U0?.bun)u=U0.bun;else if(U0?.import)u=U0.import;else if(U0?.default)u=U0.default}W[C]=await import(z5.resolve(P,u))}catch{}let q=(C)=>{if(W[C])return W[C];return j0(C)},U=Z.props||{},j=(C)=>{if(!C)return U;let P={};for(let[x,m]of Object.entries(C)){let u=U[x];if(u!==void 0)P[x]=u;else if(typeof m==="function")P[x]=m();else P[x]=m}return P};for(let[C,P]of Object.entries(U))Object.defineProperty(j,C,{value:P,enumerable:!0,configurable:!0,writable:!0});for(let C of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(U,C))continue;try{Object.defineProperty(j,C,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let _=(C)=>{if(!C)return U;let P={...U};for(let[x,m]of Object.entries(C)){let u=m&&typeof m==="object"&&!Array.isArray(m)?m:{type:m};if(P[x]===void 0&&u.default!==void 0)P[x]=typeof u.default==="function"?u.default():u.default}return P},B=()=>Z.slots||{},H=(C,P)=>{let x={...C};for(let[m,u]of Object.entries(P))if(x[m]===void 0)if(typeof u==="function")x[m]=u();else x[m]=u;return x},L=(C)=>{let P=()=>C;return P.set=(x)=>{},P.update=(x)=>{},P},V=(C)=>{let P,x=!1;return()=>{if(!x)try{P=C(),x=!0}catch{P=void 0}return P}},O=(C)=>{},F=(C)=>C(),w=(C)=>{},A=(C)=>{},R=(C)=>{},N=()=>{let C=Z.__stxServeContext,P=Z.__stxServeSearch??C?.search??"",x=C?.path??"";return{params:Z.params??{},query:Object.fromEntries(new URLSearchParams(P)),path:x,name:"",fullPath:x+P,hash:"",matched:[]}},M=()=>({push:(C)=>{},replace:(C)=>{},back:()=>{},forward:()=>{},go:(C)=>{}}),T=(C)=>{let P=Z.__stx_runtime_head||{};Z.__stx_runtime_head=W5(P,C||{})},I=(C)=>{T(S$(C||{}))},E=(C)=>({value:C}),D=(C)=>C,y=(C)=>({value:typeof C==="function"?C():C}),b=(C,P)=>{},k=(C)=>{},v=(C)=>{},g=(C)=>C?C():Promise.resolve(),f=(C)=>(P,...x)=>{},d=(C)=>{},p=(C,P)=>{},X0=(C,P)=>P,Z0=()=>({value:"light"}),V0=()=>L(!1),r=(C)=>L(!1),Q0=()=>L(!1),k0=()=>r("(prefers-color-scheme: dark)"),n0=()=>r("(prefers-color-scheme: light)"),j1=()=>r("(prefers-reduced-motion: reduce)"),t1=()=>r("(prefers-contrast: more)"),n={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},J0=new Proxy(n,{get(C,P){if(P in C)return C[P];return},set(C,P,x){return C[P]=x,!0}}),B0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},R0=console;try{let C=N7(X,Y),P=new Set(Object.keys(U)),x=(i)=>/^[a-z_$][\w$]*$/i.test(i),m=Object.keys(Z).filter((i)=>!P.has(i)&&i!=="props"&&x(i)),u=m.map((i)=>Z[i]),U0=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","let","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","await","async","module","exports","require","params","window","document","console","state","derived","effect"]),N0=[],G1=[];for(let[i,h0]of Object.entries(U)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(i))continue;if(U0.has(i))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${i}\\b`).test(C))continue;N0.push(i),G1.push(h0)}let C0=DG(C).map((i)=>`module.exports.${i} = typeof ${i} !== 'undefined' ? ${i} : module.exports.${i};`).join(`
|
|
771
|
+
`),o0=Z.params??{},E1=[],_1=[];for(let i=0;i<m.length;i++){if(m[i]==="params")continue;E1.push(m[i]),_1.push(u[i])}let z0=await Function("module","exports","require","props","$props","defineProps","withDefaults","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params",...N0,...E1,`return (async () => {
|
|
772
772
|
${C}
|
|
773
773
|
${C0}
|
|
774
774
|
return module.exports
|
|
@@ -782,7 +782,7 @@ ${R}`,nextIndex:F}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}l
|
|
|
782
782
|
${$[z]}`,z++;else break}return W=W.trim().replace(/;$/,""),{type:Q,name:G,value:W,nextIndex:z}}function R7($,Z){let Y=$[Z].trim(),J=Y.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!J)throw Error(`Failed to parse function declaration: ${Y}`);let[,X]=J,Q=Y.replace(/^export\s+/,""),G=Z;if(bG(Y)){let K=SG($,Z,Q);Q=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:X,functionCode:Q,nextIndex:G}}function t9($){let Z=$.trim();if(Z.startsWith("{"))return x0(Z,"{","}",0)===-1;if(Z.startsWith("["))return x0(Z,"[","]",0)===-1;return!G8(Z)}function G8($){let Z={paren:0,bracket:0,brace:0},Y=null,J=0;for(let X=0;X<$.length;X++){let Q=$[X];if((X>0?$[X-1]:"")==="\\"&&Y)continue;if((Q==='"'||Q==="'")&&!Y){Y=Q;continue}if(Q===Y&&Y!=="`"){Y=null;continue}if(Q==="`"&&!Y){Y="`";continue}if(Q==="`"&&Y==="`"&&J===0){Y=null;continue}if(Y==="`"&&Q==="$"&&$[X+1]==="{"){J++,X++;continue}if(J>0&&Q==="{"){J++;continue}if(J>0&&Q==="}"){J--;continue}if(Y)continue;if(Q==="(")Z.paren++;else if(Q===")")Z.paren--;else if(Q==="[")Z.bracket++;else if(Q==="]")Z.bracket--;else if(Q==="{")Z.brace++;else if(Q==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&Y===null}function bG($){let Z=$.indexOf("{");if(Z===-1)return!0;return x0($,"{","}",Z)===-1}function e9($,Z,Y){let J=Y,X=Z+1;while(X<$.length&&!G8(J)){let Q=$[X];J+=`
|
|
783
783
|
${Q}`,X++}while(X<$.length){let Q=$[X].trim();if(Q.startsWith(".")||Q.startsWith("?."))J+=`
|
|
784
784
|
${$[X]}`,X++;else break}return{value:J,nextIndex:X}}function SG($,Z,Y){let J=Y,X=Z+1;while(X<$.length){let Q=J.indexOf("{");if(Q!==-1){if(x0(J,"{","}",Q)!==-1)break}let G=$[X];J+=`
|
|
785
|
-
${G}`,X++}return{functionCode:J,nextIndex:X}}function $8($,Z){let Y=$0($,Z)??$0(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let J={...Z,process:Object.freeze({env:{...n5.env}})};try{return Function(...Object.keys(J),`'use strict'; return (${$});`)(...Object.values(J))}catch{try{return Function(...Object.keys(J),`'use strict'; return ${$};`)(...Object.values(J))}catch{return}}}async function yG($,Z,Y){let J=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of J){let[,,G,K]=Q;try{let W=K.trim().replace(/;$/,""),z=$8(W,Z);if(z!==void 0)Z[G]=z}catch(W){console.warn(`Failed to parse export ${G} in fallback:`,W)}}let X=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of X){let[,,G,K]=Q;if(!(G in Z))try{let W=K.trim().replace(/;$/,""),z=$8(W,Z);if(z!==void 0)Z[G]=z}catch{}}}function K8($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1]:"",J=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Y,templateWithoutScript:J}}function W8($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var o5=S(()=>{i5();b1();w0()});var M7={};a(M7,{renderSlot:()=>q8,processSlots:()=>j8,parseSlots:()=>z8,parseSlotElement:()=>fG,extractSlotContent:()=>dG,applySlots:()=>mG});function PG($,Z){let Y=1,J=Z,X="<template",Q="</template";while(J<$.length&&Y>0){let G=$.indexOf("<",J);if(G===-1)break;if(J=G,$.startsWith(X,J)&&(J+X.length>=$.length||/[\s>\/]/.test($[J+X.length]))){Y++,J+=X.length;continue}if($.startsWith(Q,J)){let K=$.indexOf(">",J+Q.length);if(K!==-1){if(Y--,Y===0)return K+1;J=K+1;continue}}J++}return Y===0?J:-1}function vG($,Z){let Y=null;for(let J=Z;J<$.length;J++){let X=$[J];if(Y){if(X==="\\"){J++;continue}if(X===Y)Y=null;continue}if(X==='"'||X==="'"){Y=X;continue}if(X===">")return J+1}return-1}function xG($){let Z=[],Y=[],J=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,X=0;while(X<$.length){let Q=$.indexOf("<",X);if(Q===-1)break;if($.startsWith("<!--",Q)){let j=$.indexOf("-->",Q+4);X=j===-1?$.length:j+3;continue}let G=vG($,Q+1);if(G===-1)break;let K=$.slice(Q,G),W=K.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!W){X=G;continue}let z=W[1]==="/",q=W[2].toLowerCase();if(z){let j=Y.lastIndexOf(q);if(j!==-1)Y.splice(j);X=G;continue}if(q==="template"&&Y.length===0){let j=K.match(J);if(j){let _=PG($,G);if(_!==-1){let B=j[1]||j[2]||j[3];Z.push({start:Q,end:_,slotName:B,content:$.slice(G,_-11).trim(),propsBinding:j[4]||void 0}),X=_;continue}}}if(!/\/\s*>$/.test(K)&&!CG.has(q)){if(Y.push(q),q==="script"||q==="style"){let j=$.toLowerCase().indexOf(`</${q}>`,G);if(j!==-1){X=j;continue}}}X=G}return Z}function z8($){let Z={default:"",named:new Map},Y=$,J=xG($);for(let W of J)Z.named.set(W.slotName,{name:W.slotName,content:W.content,propsBinding:W.propsBinding});J.sort((W,z)=>z.start-W.start);for(let W of J)Y=Y.slice(0,W.start)+Y.slice(W.end);let X=[],Q=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,G;while((G=Q.exec(Y))!==null){let[W,z,q,U,j,_]=G,B=q.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=(B+H).trim(),V=`<${z}${L?" "+L:""}>${_}</${z}>`;X.push({start:G.index,end:G.index+W.length,slotName:U,element:V})}let K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((G=K.exec(Y))!==null){let[W,z,q,U,j]=G,_=q.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),B=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(_+B).trim(),L=`<${z}${H?" "+H:""} />`;X.push({start:G.index,end:G.index+W.length,slotName:U,element:L})}X.sort((W,z)=>z.start-W.start);for(let W of X){let z=Z.named.get(W.slotName);if(z)z.content+=W.element;else Z.named.set(W.slotName,{name:W.slotName,content:W.element});Y=Y.slice(0,W.start)+Y.slice(W.end)}return Z.default=Y.trim(),Z}function fG($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[1]:"",J={},X=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,Q;while((Q=X.exec($))!==null)J[Q[1]]=Q[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:Y,props:J,defaultContent:K}}async function q8($,Z,Y,J){if(!$)return Y;let X=$.content;if($.propsBinding&&Object.keys(Z).length>0){let Q=$.propsBinding.trim(),G={...J};if(Q.startsWith("{")&&Q.endsWith("}")){let K=Q.slice(1,-1).split(",").map((W)=>W.trim()).filter(Boolean);for(let W of K){let[z,q]=W.split(":").map((j)=>j.trim()),U=q||z;if(Z[z]!==void 0)G[U]=Z[z]}}else G[Q]=Z;X=gG(X,G)}return X}function gG($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,J)=>{try{let X=J.trim(),Q=U8(X,Z);return r0(String(Q??""))}catch{return`{{ ${J} }}`}})}function U8($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let J=$.split("."),X=Z;for(let Q of J)if(X&&typeof X==="object"&&Q in X)X=X[Q];else return;return X}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,J,X,Q]=Y,G=Z[J],K=parseInt(Q,10);if(typeof G==="number")switch(X){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!K0($))return;return W0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function j8($,Z,Y){let J=$;J=await hG(J,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,W,z)=>{let q=Z.named.get(K),U=z?.trim()||"",j=W||"",_={},B=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=B.exec(j))!==null){let L=H[1],V=H[2];_[L]=U8(V,Y)}return await q8(q,_,U,Y)});let Q=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return J=J.replace(Q,(G,K)=>{if(G.includes("name="))return G;let W=K?.trim()||"";return Z.default||W}),J}async function hG($,Z,Y){let J=[],X=[];$.replace(Z,(K,...W)=>{let z=W[W.length-2];return X.push({match:K,index:z}),J.push(Y(K,...W.slice(0,-2))),K});let Q=await Promise.all(J),G=$;for(let K=X.length-1;K>=0;K--){let{match:W,index:z}=X[K];G=G.slice(0,z)+Q[K]+G.slice(z+W.length)}return G}function dG($){let Z=z8($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function mG($,Z,Y,J){return await j8($,{default:Z,named:Y},J)}var CG;var T7=S(()=>{Y1();w0();CG=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function w1($,Z){let Y=uG($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function uG($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let J=x0($,"(",")",Y);if(J===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,J),endPos:J+1}}function pG($,Z){let Y=$.lastIndexOf("<",Z);if(Y===-1)return!1;return Y>$.lastIndexOf(">",Z)}function g1($,Z,Y,J){let X=1,Q=J,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(Q<$.length&&X>0){G.lastIndex=Q,K.lastIndex=Q;let W=G.exec($),z=K.exec($),q=W?W.index:1/0,U=z?z.index:1/0;if(q<U)X++,Q=q+W[0].length;else if(U<1/0){if(X--,X===0)return U;Q=U+z[0].length}else break}return-1}function _8($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let J=Z+Y[0].length,X=w1($,J);if(!X)return null;let Q=X.endPos,G=g1($,"if","endif",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],z=0,q="if",U=X.expression,j=0,_=0;while(z<K.length){let B=K.indexOf("@",z);if(B===-1)break;z=B;let H=K.substring(B);if(pG(K,B)){z++;continue}if(/^@if\s*\(/.test(H)){_++,z++;continue}if(/^@endif(?![a-z])/.test(H)){_--,z+=6;continue}if(_===0){let L=H.match(/^@elseif\s*/);if(L){W.push({type:q,condition:U,content:K.substring(j,z),start:Q+j,end:Q+z});let V=z+L[0].length,O=w1(K,V);if(!O){z++;continue}q="elseif",U=O.expression,z=O.endPos,j=z;continue}else if(/^@else(?![a-z])/.test(H)){W.push({type:q,condition:U,content:K.substring(j,z),start:Q+j,end:Q+z}),q="else",U=void 0,z+=5,j=z;continue}}z++}return W.push({type:q,condition:U,content:K.slice(j),start:Q+j,end:Q+K.length}),{fullMatch:$.slice(Z,G+6),branches:W,start:Z,end:G+6}}function s5($){let Z=[],Y=/@if\s*\(/g,J=Y.exec($);while(J!==null){if(Z.some((G)=>J.index>G.start&&J.index<G.end)){J=Y.exec($);continue}let Q=_8($,J.index);if(Q)Z.push(Q),Y.lastIndex=Q.end;J=Y.exec($)}return Z}function P$($,Z,Y){let J=[],X=new RegExp(`@${Z}\\s*\\(`,"g"),Q=X.exec($);while(Q!==null){if(J.some((H)=>Q.index>H.start&&Q.index<H.end)){Q=X.exec($);continue}let K=Q.index,W=K+Q[0].length-1,z=x0($,"(",")",W);if(z===-1){Q=X.exec($);continue}let q=$.slice(W+1,z),U=z+1,j=g1($,Z,Y,U);if(j===-1){Q=X.exec($);continue}let _=$.slice(U,j),B=j+`@${Y}`.length;J.push({fullMatch:$.slice(K,B),name:Z,params:q,content:_,start:K,end:B}),X.lastIndex=B,Q=X.exec($)}return J}function I7($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let J=Z+Y[0].length,X=w1($,J);if(!X)return null;let Q=X.endPos,G=g1($,"switch","endswitch",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],z=0,q=null,U=0;while(z<K.length){let j=K.slice(z),_=j.match(/^@switch\s*\(/),B=j.match(/^@endswitch(?![a-z])/);if(_){if(U++,q)q.content+=_[0];z+=_[0].length;continue}if(B){if(U--,q)q.content+=B[0];z+=B[0].length;continue}if(U>0){if(q)q.content+=K[z];z++;continue}let H=j.match(/^@case\s*/),L=j.match(/^@default(?![a-z])/),V=j.match(/^@break(?![a-z])/);if(H&&j.startsWith("@case")){if(q)W.push(q);let O=z+H[0].length,F=w1(K,O);if(!F){z++;continue}q={type:"case",value:F.expression,content:""},z=F.endPos}else if(L&&j.startsWith("@default")){if(q)W.push(q);q={type:"default",content:""},z+=L[0].length}else if(V&&j.startsWith("@break"))z+=V[0].length;else{if(q)q.content+=K[z];z++}}if(q)W.push(q);return{fullMatch:$.slice(Z,G+10),expression:X.expression,cases:W,start:Z,end:G+10}}var B8=()=>{};var H8=()=>{};var C$=S(()=>{B8();H8()});function f$($){let Z=$,Y=new Set,J=new Set,X=()=>{if(d0)J.add(d0);return Z};return X.set=(Q)=>{if(!Object.is(Q,Z)){let G=Z;if(Z=Q,Y.forEach((K)=>K(Z,G)),r5)J.forEach((K)=>x$.add(K));else J.forEach((K)=>K())}},X.update=(Q)=>{X.set(Q(Z))},X.subscribe=(Q)=>{return Y.add(Q),()=>Y.delete(Q)},Object.defineProperty(X,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(X,"value",{get:()=>X(),set:(Q)=>X.set(Q),configurable:!0}),X}function g$($){let Z,Y=!0,J=new Set,X=()=>{if(!Y)if(Y=!0,r5)J.forEach((G)=>x$.add(G));else J.forEach((G)=>G())},Q=()=>{if(d0)J.add(d0);if(Y){let G=d0;d0=X,v$.push(X);try{Z=$()}finally{v$.pop(),d0=G}Y=!1}return Z};return Object.defineProperty(Q,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(Q,"value",{get:()=>Q(),configurable:!0}),Q}function h$($,Z={}){let Y,J=!1,X=()=>{if(J)return;if(Y)Y(),Y=void 0;let Q=d0;d0=X,v$.push(X);try{Y=$()}finally{v$.pop(),d0=Q}};if(Z.immediate!==!1)X();return()=>{if(J=!0,Y)Y()}}function D7($){if(r5){$();return}r5=!0;try{$()}finally{r5=!1,x$.forEach((Z)=>Z()),x$.clear()}}function E7($){nG.push($)}function k7($){oG.push($)}function d$($){return typeof $==="function"&&$._isSignal===!0}function m$($){return typeof $==="function"&&$._isDerived===!0}function b7($){if(d$($)||m$($))return $();return $}function u$($){let Z=d0;d0=null;try{return $()}finally{d0=Z}}function sG($,Z){let Y=typeof $==="function"?$:()=>$,J=f$([]),X=g$(()=>J().reduce((K,W)=>Z(K,W.action),Y())),Q=!1;return h$(()=>{if(Y(),!Q){Q=!0;return}if(u$(()=>J().length))J.set([])}),[X,(K,W)=>{let z={action:K};J.set([...J(),z]);let q=()=>{let U=J().filter((j)=>j!==z);if(U.length!==J().length)J.set(U)};if(W&&typeof W.then==="function")Promise.resolve(W).then(q,q);return q}]}var d0=null,v$,r5=!1,x$,nG,oG;var S7=S(()=>{v$=[],x$=new Set,nG=[],oG=[]});var L8={};a(L8,{useOptimistic:()=>sG,untrack:()=>b7,state:()=>f$,peek:()=>u$,onMount:()=>E7,onDestroy:()=>k7,isSignal:()=>d$,isDerived:()=>m$,generateSignalsRuntimeDev:()=>p$,generateSignalsRuntime:()=>O8,effect:()=>h$,derived:()=>g$,default:()=>aG,batch:()=>D7});function O8(){try{let $=rG(p$()),Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return p$()}}function rG($){let Z=[],Y=0,J="console.log(";while(Y<$.length){let X=$.indexOf(J,Y);if(X===-1){Z.push($.slice(Y));break}Z.push($.slice(Y,X));let Q=1,G=X+J.length;while(G<$.length&&Q>0){let K=$[G];if(K==='"'||K==="'"||K==="`"){let W=K;G++;while(G<$.length&&$[G]!==W){if($[G]==="\\")G++;G++}G++;continue}if(K==="(")Q++;else if(K===")")Q--;G++}Z.push("0"),Y=G}return Z.join("")}function p$(){return`
|
|
785
|
+
${G}`,X++}return{functionCode:J,nextIndex:X}}function $8($,Z){let Y=$0($,Z)??$0(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let J={...Z,process:Object.freeze({env:{...n5.env}})};try{return Function(...Object.keys(J),`'use strict'; return (${$});`)(...Object.values(J))}catch{try{return Function(...Object.keys(J),`'use strict'; return ${$};`)(...Object.values(J))}catch{return}}}async function yG($,Z,Y){let J=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of J){let[,,G,K]=Q;try{let W=K.trim().replace(/;$/,""),z=$8(W,Z);if(z!==void 0)Z[G]=z}catch(W){console.warn(`Failed to parse export ${G} in fallback:`,W)}}let X=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of X){let[,,G,K]=Q;if(!(G in Z))try{let W=K.trim().replace(/;$/,""),z=$8(W,Z);if(z!==void 0)Z[G]=z}catch{}}}function K8($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1]:"",J=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Y,templateWithoutScript:J}}function W8($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var o5=S(()=>{i5();b1();w0()});var M7={};a(M7,{renderSlot:()=>q8,processSlots:()=>j8,parseSlots:()=>z8,parseSlotElement:()=>fG,extractSlotContent:()=>dG,applySlots:()=>uG});function PG($,Z){let Y=1,J=Z,X="<template",Q="</template";while(J<$.length&&Y>0){let G=$.indexOf("<",J);if(G===-1)break;if(J=G,$.startsWith(X,J)&&(J+X.length>=$.length||/[\s>\/]/.test($[J+X.length]))){Y++,J+=X.length;continue}if($.startsWith(Q,J)){let K=$.indexOf(">",J+Q.length);if(K!==-1){if(Y--,Y===0)return K+1;J=K+1;continue}}J++}return Y===0?J:-1}function vG($,Z){let Y=null;for(let J=Z;J<$.length;J++){let X=$[J];if(Y){if(X==="\\"){J++;continue}if(X===Y)Y=null;continue}if(X==='"'||X==="'"){Y=X;continue}if(X===">")return J+1}return-1}function xG($){let Z=[],Y=[],J=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,X=0;while(X<$.length){let Q=$.indexOf("<",X);if(Q===-1)break;if($.startsWith("<!--",Q)){let j=$.indexOf("-->",Q+4);X=j===-1?$.length:j+3;continue}let G=vG($,Q+1);if(G===-1)break;let K=$.slice(Q,G),W=K.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!W){X=G;continue}let z=W[1]==="/",q=W[2].toLowerCase();if(z){let j=Y.lastIndexOf(q);if(j!==-1)Y.splice(j);X=G;continue}if(q==="template"&&Y.length===0){let j=K.match(J);if(j){let _=PG($,G);if(_!==-1){let B=j[1]||j[2]||j[3];Z.push({start:Q,end:_,slotName:B,content:$.slice(G,_-11).trim(),propsBinding:j[4]||void 0}),X=_;continue}}}if(!/\/\s*>$/.test(K)&&!CG.has(q)){if(Y.push(q),q==="script"||q==="style"){let j=$.toLowerCase().indexOf(`</${q}>`,G);if(j!==-1){X=j;continue}}}X=G}return Z}function z8($){let Z={default:"",named:new Map},Y=$,J=xG($);for(let W of J)Z.named.set(W.slotName,{name:W.slotName,content:W.content,propsBinding:W.propsBinding});J.sort((W,z)=>z.start-W.start);for(let W of J)Y=Y.slice(0,W.start)+Y.slice(W.end);let X=[],Q=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,G;while((G=Q.exec(Y))!==null){let[W,z,q,U,j,_]=G,B=q.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=(B+H).trim(),V=`<${z}${L?" "+L:""}>${_}</${z}>`;X.push({start:G.index,end:G.index+W.length,slotName:U,element:V})}let K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((G=K.exec(Y))!==null){let[W,z,q,U,j]=G,_=q.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),B=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(_+B).trim(),L=`<${z}${H?" "+H:""} />`;X.push({start:G.index,end:G.index+W.length,slotName:U,element:L})}X.sort((W,z)=>z.start-W.start);for(let W of X){let z=Z.named.get(W.slotName);if(z)z.content+=W.element;else Z.named.set(W.slotName,{name:W.slotName,content:W.element});Y=Y.slice(0,W.start)+Y.slice(W.end)}return Z.default=Y.trim(),Z}function fG($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[1]:"",J={},X=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,Q;while((Q=X.exec($))!==null)J[Q[1]]=Q[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:Y,props:J,defaultContent:K}}async function q8($,Z,Y,J){if(!$)return Y;let X=$.content;if($.propsBinding&&Object.keys(Z).length>0){let Q=$.propsBinding.trim(),G={...J};if(Q.startsWith("{")&&Q.endsWith("}")){let K=Q.slice(1,-1).split(",").map((W)=>W.trim()).filter(Boolean);for(let W of K){let[z,q]=W.split(":").map((j)=>j.trim()),U=q||z;if(Z[z]!==void 0)G[U]=Z[z]}}else G[Q]=Z;X=gG(X,G)}return X}function gG($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,J)=>{try{let X=J.trim(),Q=U8(X,Z);return r0(String(Q??""))}catch{return`{{ ${J} }}`}})}function U8($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let J=$.split("."),X=Z;for(let Q of J)if(X&&typeof X==="object"&&Q in X)X=X[Q];else return;return X}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,J,X,Q]=Y,G=Z[J],K=parseInt(Q,10);if(typeof G==="number")switch(X){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!K0($))return;return W0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function j8($,Z,Y){let J=$;J=await hG(J,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,W,z)=>{let q=Z.named.get(K),U=z?.trim()||"",j=W||"",_={},B=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=B.exec(j))!==null){let L=H[1],V=H[2];_[L]=U8(V,Y)}return await q8(q,_,U,Y)});let Q=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return J=J.replace(Q,(G,K)=>{if(G.includes("name="))return G;let W=K?.trim()||"";return Z.default||W}),J}async function hG($,Z,Y){let J=[],X=[];$.replace(Z,(K,...W)=>{let z=W[W.length-2];return X.push({match:K,index:z}),J.push(Y(K,...W.slice(0,-2))),K});let Q=await Promise.all(J),G=$;for(let K=X.length-1;K>=0;K--){let{match:W,index:z}=X[K];G=G.slice(0,z)+Q[K]+G.slice(z+W.length)}return G}function dG($){let Z=z8($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function uG($,Z,Y,J){return await j8($,{default:Z,named:Y},J)}var CG;var T7=S(()=>{Y1();w0();CG=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function w1($,Z){let Y=mG($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function mG($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let J=x0($,"(",")",Y);if(J===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,J),endPos:J+1}}function pG($,Z){let Y=$.lastIndexOf("<",Z);if(Y===-1)return!1;return Y>$.lastIndexOf(">",Z)}function g1($,Z,Y,J){let X=1,Q=J,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(Q<$.length&&X>0){G.lastIndex=Q,K.lastIndex=Q;let W=G.exec($),z=K.exec($),q=W?W.index:1/0,U=z?z.index:1/0;if(q<U)X++,Q=q+W[0].length;else if(U<1/0){if(X--,X===0)return U;Q=U+z[0].length}else break}return-1}function _8($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let J=Z+Y[0].length,X=w1($,J);if(!X)return null;let Q=X.endPos,G=g1($,"if","endif",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],z=0,q="if",U=X.expression,j=0,_=0;while(z<K.length){let B=K.indexOf("@",z);if(B===-1)break;z=B;let H=K.substring(B);if(pG(K,B)){z++;continue}if(/^@if\s*\(/.test(H)){_++,z++;continue}if(/^@endif(?![a-z])/.test(H)){_--,z+=6;continue}if(_===0){let L=H.match(/^@elseif\s*/);if(L){W.push({type:q,condition:U,content:K.substring(j,z),start:Q+j,end:Q+z});let V=z+L[0].length,O=w1(K,V);if(!O){z++;continue}q="elseif",U=O.expression,z=O.endPos,j=z;continue}else if(/^@else(?![a-z])/.test(H)){W.push({type:q,condition:U,content:K.substring(j,z),start:Q+j,end:Q+z}),q="else",U=void 0,z+=5,j=z;continue}}z++}return W.push({type:q,condition:U,content:K.slice(j),start:Q+j,end:Q+K.length}),{fullMatch:$.slice(Z,G+6),branches:W,start:Z,end:G+6}}function s5($){let Z=[],Y=/@if\s*\(/g,J=Y.exec($);while(J!==null){if(Z.some((G)=>J.index>G.start&&J.index<G.end)){J=Y.exec($);continue}let Q=_8($,J.index);if(Q)Z.push(Q),Y.lastIndex=Q.end;J=Y.exec($)}return Z}function P$($,Z,Y){let J=[],X=new RegExp(`@${Z}\\s*\\(`,"g"),Q=X.exec($);while(Q!==null){if(J.some((H)=>Q.index>H.start&&Q.index<H.end)){Q=X.exec($);continue}let K=Q.index,W=K+Q[0].length-1,z=x0($,"(",")",W);if(z===-1){Q=X.exec($);continue}let q=$.slice(W+1,z),U=z+1,j=g1($,Z,Y,U);if(j===-1){Q=X.exec($);continue}let _=$.slice(U,j),B=j+`@${Y}`.length;J.push({fullMatch:$.slice(K,B),name:Z,params:q,content:_,start:K,end:B}),X.lastIndex=B,Q=X.exec($)}return J}function I7($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let J=Z+Y[0].length,X=w1($,J);if(!X)return null;let Q=X.endPos,G=g1($,"switch","endswitch",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],z=0,q=null,U=0;while(z<K.length){let j=K.slice(z),_=j.match(/^@switch\s*\(/),B=j.match(/^@endswitch(?![a-z])/);if(_){if(U++,q)q.content+=_[0];z+=_[0].length;continue}if(B){if(U--,q)q.content+=B[0];z+=B[0].length;continue}if(U>0){if(q)q.content+=K[z];z++;continue}let H=j.match(/^@case\s*/),L=j.match(/^@default(?![a-z])/),V=j.match(/^@break(?![a-z])/);if(H&&j.startsWith("@case")){if(q)W.push(q);let O=z+H[0].length,F=w1(K,O);if(!F){z++;continue}q={type:"case",value:F.expression,content:""},z=F.endPos}else if(L&&j.startsWith("@default")){if(q)W.push(q);q={type:"default",content:""},z+=L[0].length}else if(V&&j.startsWith("@break"))z+=V[0].length;else{if(q)q.content+=K[z];z++}}if(q)W.push(q);return{fullMatch:$.slice(Z,G+10),expression:X.expression,cases:W,start:Z,end:G+10}}var B8=()=>{};var H8=()=>{};var C$=S(()=>{B8();H8()});function f$($){let Z=$,Y=new Set,J=new Set,X=()=>{if(d0)J.add(d0);return Z};return X.set=(Q)=>{if(!Object.is(Q,Z)){let G=Z;if(Z=Q,Y.forEach((K)=>K(Z,G)),r5)J.forEach((K)=>x$.add(K));else J.forEach((K)=>K())}},X.update=(Q)=>{X.set(Q(Z))},X.subscribe=(Q)=>{return Y.add(Q),()=>Y.delete(Q)},Object.defineProperty(X,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(X,"value",{get:()=>X(),set:(Q)=>X.set(Q),configurable:!0}),X}function g$($){let Z,Y=!0,J=new Set,X=()=>{if(!Y)if(Y=!0,r5)J.forEach((G)=>x$.add(G));else J.forEach((G)=>G())},Q=()=>{if(d0)J.add(d0);if(Y){let G=d0;d0=X,v$.push(X);try{Z=$()}finally{v$.pop(),d0=G}Y=!1}return Z};return Object.defineProperty(Q,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(Q,"value",{get:()=>Q(),configurable:!0}),Q}function h$($,Z={}){let Y,J=!1,X=()=>{if(J)return;if(Y)Y(),Y=void 0;let Q=d0;d0=X,v$.push(X);try{Y=$()}finally{v$.pop(),d0=Q}};if(Z.immediate!==!1)X();return()=>{if(J=!0,Y)Y()}}function D7($){if(r5){$();return}r5=!0;try{$()}finally{r5=!1,x$.forEach((Z)=>Z()),x$.clear()}}function E7($){nG.push($)}function k7($){oG.push($)}function d$($){return typeof $==="function"&&$._isSignal===!0}function u$($){return typeof $==="function"&&$._isDerived===!0}function b7($){if(d$($)||u$($))return $();return $}function m$($){let Z=d0;d0=null;try{return $()}finally{d0=Z}}function sG($,Z){let Y=typeof $==="function"?$:()=>$,J=f$([]),X=g$(()=>J().reduce((K,W)=>Z(K,W.action),Y())),Q=!1;return h$(()=>{if(Y(),!Q){Q=!0;return}if(m$(()=>J().length))J.set([])}),[X,(K,W)=>{let z={action:K};J.set([...J(),z]);let q=()=>{let U=J().filter((j)=>j!==z);if(U.length!==J().length)J.set(U)};if(W&&typeof W.then==="function")Promise.resolve(W).then(q,q);return q}]}var d0=null,v$,r5=!1,x$,nG,oG;var S7=S(()=>{v$=[],x$=new Set,nG=[],oG=[]});var L8={};a(L8,{useOptimistic:()=>sG,untrack:()=>b7,state:()=>f$,peek:()=>m$,onMount:()=>E7,onDestroy:()=>k7,isSignal:()=>d$,isDerived:()=>u$,generateSignalsRuntimeDev:()=>p$,generateSignalsRuntime:()=>O8,effect:()=>h$,derived:()=>g$,default:()=>aG,batch:()=>D7});function O8(){try{let $=rG(p$()),Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return p$()}}function rG($){let Z=[],Y=0,J="console.log(";while(Y<$.length){let X=$.indexOf(J,Y);if(X===-1){Z.push($.slice(Y));break}Z.push($.slice(Y,X));let Q=1,G=X+J.length;while(G<$.length&&Q>0){let K=$[G];if(K==='"'||K==="'"||K==="`"){let W=K;G++;while(G<$.length&&$[G]!==W){if($[G]==="\\")G++;G++}G++;continue}if(K==="(")Q++;else if(K===")")Q--;G++}Z.push("0"),Y=G}return Z.join("")}function p$(){return`
|
|
786
786
|
// STX Signals Runtime (Development Build)
|
|
787
787
|
console.log('[stx] signals runtime loading');
|
|
788
788
|
// Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
|
|
@@ -7324,7 +7324,7 @@ catch (e) { console.warn('[stx] mount callback error:', e); }
|
|
|
7324
7324
|
}
|
|
7325
7325
|
}
|
|
7326
7326
|
})();
|
|
7327
|
-
`}var aG;var F8=S(()=>{S7();S7();aG={state:f$,derived:g$,effect:h$,batch:D7,onMount:E7,onDestroy:k7,isSignal:d$,isDerived:
|
|
7327
|
+
`}var aG;var F8=S(()=>{S7();S7();aG={state:f$,derived:g$,effect:h$,batch:D7,onMount:E7,onDestroy:k7,isSignal:d$,isDerived:u$,untrack:b7,peek:m$,generateSignalsRuntime:O8,generateSignalsRuntimeDev:p$}});var y7={};a(y7,{templateCache:()=>V8,readFileCached:()=>tG,invalidateFileCacheByDir:()=>$K,invalidateFileCache:()=>eG,hashFilePath:()=>a5,getCachedSignalsRuntime:()=>JK,getCachedRouterScript:()=>XK,clearDevCaches:()=>QK,checkCache:()=>GK,cacheTemplate:()=>KK,__setSignalsGeneratorsForTest:()=>YK});import A1 from"fs";import q5 from"path";async function tG($){let Y;for(let J=0;J<3;J++)try{let Q=(await A1.promises.stat($)).mtime.getTime(),G=h1.get($);if(G&&G.mtime===Q)return G.content;let K=await Bun.file($).text(),z=(await A1.promises.stat($)).mtime.getTime();if(z!==Q)continue;return h1.set($,{content:K,mtime:z}),K}catch(X){Y=X;break}throw h1.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function eG($){h1.delete($)}function $K($){for(let Z of h1.keys())if(Z.startsWith($))h1.delete(Z)}function YK($){w8=$}async function JK($=!1){let Z=w8??await Promise.resolve().then(() => (F8(),L8));if($)return Z.generateSignalsRuntimeDev();if(l$===null)l$=Z.generateSignalsRuntime();return l$}async function XK(){if(c$===null){let{getRouterScript:$}=await import("stx-router");c$=$()}return c$}function QK(){h1.clear(),R8(),l$=null,ZK=null,c$=null}function A8($){let Z={debug:$.debug===!0,middleware:($.middleware??[]).map((Y)=>({name:Y.name,timing:Y.timing,handler:String(Y.handler)})),customDirectives:($.customDirectives??[]).map((Y)=>({name:Y.name,hasEndTag:Y.hasEndTag===!0,handler:String(Y.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(Z)).digest("hex")}async function GK($,Z){try{if(!Z.cachePath)return null;let Y=q5.resolve(Z.cachePath),J=q5.join(Y,`${a5($)}.html`),X=q5.join(Y,`${a5($)}.meta.json`);if(!await c(J)||!await c(X))return null;let Q=await Bun.file(X).text(),G=JSON.parse(Q);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==A8(Z))return null;if((await A1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let W of G.dependencies)if(await c(W)){if((await A1.promises.stat(W)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(J).text()}catch(Y){return console.warn(`Cache error for ${$}:`,Y),null}}async function KK($,Z,Y,J){try{if(!J.cachePath)return;let X=q5.resolve(J.cachePath);await A1.promises.mkdir(X,{recursive:!0});let Q=q5.join(X,`${a5($)}.html`),G=q5.join(X,`${a5($)}.meta.json`),K=await A1.promises.stat($);await Bun.write(Q,Z);let W={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:J.cacheVersion,optionsSignature:A8(J),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(W,null,2)),V8.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(X){console.warn(`Failed to cache template ${$}:`,X)}}function a5($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,WK)}var V8,h1,l$=null,ZK=null,w8=null,c$=null,WK=16;var P7=S(()=>{M0();V8=new Map,h1=new Map});function N8($){if($.includes("window.StacksBrowser")||$.includes("StacksBrowser ="))return $;let Z=/<script\b(?![^>]*\bserver\b)[^>]*>([\s\S]*?)<\/script>/gi,Y="",J;while((J=Z.exec($))!==null)Y+=J[1]+`
|
|
7328
7328
|
`;let X=/\{\{([\s\S]*?)\}\}/g;while((J=X.exec($))!==null)Y+=J[1]+`
|
|
7329
7329
|
`;if(!Y.trim())return $;let G=["browserQuery","BrowserQueryBuilder","configureBrowser","createBrowserModel","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"].some((j)=>{return new RegExp(`\\b${j}\\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"]),W=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,z,q=!1;while((z=W.exec(Y))!==null)if(!K.has(z[1])){q=!0;break}if(!G&&!q)return $;let U=`<script type="module">
|
|
7330
7330
|
// STX: Auto-load @stacksjs/browser (auto-initializes API and loads models)
|
|
@@ -7333,15 +7333,18 @@ import '@stacksjs/browser'
|
|
|
7333
7333
|
`+$.slice(B);return $.replace("</head>",`${U}
|
|
7334
7334
|
</head>`)}if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
|
|
7335
7335
|
${U}`);return U+`
|
|
7336
|
-
`+$}async function M8($,Z){if($.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="
|
|
7336
|
+
`+$}async function M8($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script data-stx-runtime src="/_stx/runtime.js"></script>
|
|
7337
|
+
`+$.slice(K);if($.includes("</head>")){let W=$.indexOf("</head>");return $.slice(0,W)+`<script data-stx-runtime src="/_stx/runtime.js"></script>
|
|
7338
|
+
`+$.slice(W)}return`<script data-stx-runtime src="/_stx/runtime.js"></script>
|
|
7339
|
+
`+$}if(Z.buildMode==="compile"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
|
|
7337
7340
|
`+$.slice(K);if($.includes("</head>")){let W=$.indexOf("</head>");return $.slice(0,W)+`<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
|
|
7338
7341
|
`+$.slice(W)}return`<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
|
|
7339
7342
|
`+$}let{getCachedSignalsRuntime:Y}=await Promise.resolve().then(() => (P7(),y7)),X=`<script data-stx-scoped data-stx-runtime>${await Y(Z.debug)}</script>`,Q=$.indexOf("<script");if(Q!==-1)return $.slice(0,Q)+X+`
|
|
7340
7343
|
`+$.slice(Q);if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+X+`
|
|
7341
7344
|
`+$.slice(G)}if($.includes("<body")){let G=$.indexOf("<body"),K=$.indexOf(">",G);return $.slice(0,K+1)+`
|
|
7342
7345
|
`+X+$.slice(K+1)}return X+`
|
|
7343
|
-
`+$}async function C7($,Z){if(!$.includes("</body>"))return $;if($.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Y=Z?.router,J="";if(Y){let K={};if(Y.container)K.container=Y.container;if(Y.interceptAllLinks!==void 0)K.interceptAllLinks=Y.interceptAllLinks;if(Y.progress!==void 0)K.progress=Y.progress;if(Y.viewTransitions!==void 0)K.viewTransitions=Y.viewTransitions;if(Y.viewTransitionDuration!==void 0)K.viewTransitionDuration=Y.viewTransitionDuration;if(Y.viewTransitionEasing!==void 0)K.viewTransitionEasing=Y.viewTransitionEasing;if(Y.scrollToTop!==void 0)K.scrollToTop=Y.scrollToTop;if(Y.prefetch!==void 0)K.prefetch=Y.prefetch;if(Y.cache!==void 0)K.cache=Y.cache;if(Y.progressColor!==void 0)K.progressColor=Y.progressColor;if(Y.progressHeight!==void 0)K.progressHeight=Y.progressHeight;if(Object.keys(K).length>0)J=`<script>window.__stxRouterConfig=${JSON.stringify(K)};</script>
|
|
7344
|
-
`}let{getCachedRouterScript:X}=await Promise.resolve().then(() => (P7(),y7)),Q=Z?.buildMode==="compile"?'<script src="/__stx/router.__STX_HASH__.js"></script>':`<script>${await X()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+J+Q+`
|
|
7346
|
+
`+$}async function C7($,Z){if(!$.includes("</body>"))return $;if($.includes("data-stx-router")||$.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Y=Z?.router,J="";if(Y){let K={};if(Y.container)K.container=Y.container;if(Y.interceptAllLinks!==void 0)K.interceptAllLinks=Y.interceptAllLinks;if(Y.progress!==void 0)K.progress=Y.progress;if(Y.viewTransitions!==void 0)K.viewTransitions=Y.viewTransitions;if(Y.viewTransitionDuration!==void 0)K.viewTransitionDuration=Y.viewTransitionDuration;if(Y.viewTransitionEasing!==void 0)K.viewTransitionEasing=Y.viewTransitionEasing;if(Y.scrollToTop!==void 0)K.scrollToTop=Y.scrollToTop;if(Y.prefetch!==void 0)K.prefetch=Y.prefetch;if(Y.cache!==void 0)K.cache=Y.cache;if(Y.progressColor!==void 0)K.progressColor=Y.progressColor;if(Y.progressHeight!==void 0)K.progressHeight=Y.progressHeight;if(Object.keys(K).length>0)J=`<script>window.__stxRouterConfig=${JSON.stringify(K)};</script>
|
|
7347
|
+
`}let{getCachedRouterScript:X}=await Promise.resolve().then(() => (P7(),y7)),Q=Z?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':Z?.buildMode==="serve"?'<script data-stx-router src="/_stx/router.js"></script>':`<script data-stx-router>${await X()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+J+Q+`
|
|
7345
7348
|
</body>`+$.slice(G+7)}var s$={};a(s$,{scanScriptTags:()=>S8,rewriteStxImportSpecifiers:()=>v8,processSignals:()=>h7,processScriptSetup:()=>P8,preEvalLiteralReactiveIfs:()=>f7,parseLoopExpression:()=>y8,hasSignalsSyntax:()=>o$,findMarkupIndexOutsideScripts:()=>n$,extractExports:()=>C8,convertSignalLoopsToAttributes:()=>g7,convertSignalDirectivesToAttributes:()=>x7});function S8($,Z={}){let Y=[];for(let J of j7($,O1)){let X=J.token.match(/^<script\b([^>]*)>/i),Q=J.token.match(/<\/script\s*>$/i);if(!X||!Q)continue;let G=X[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let K=X[0].length,W=J.token.length-Q[0].length;Y.push({fullMatch:J.token,attrs:G,body:J.token.slice(K,W),start:J.start,end:J.end})}return Y}function y8($){let Z=$.trim(),Y=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Y){let X=Y[1].trim(),Q=Y[2].trim(),{itemVar:G,indexVar:K}=I8(Q);if(G)return{style:"as",iterable:X,itemVar:G,indexVar:K}}let J=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(J){let X=J[1].trim(),Q=J[2].trim(),{itemVar:G,indexVar:K}=I8(X);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function I8($){let Z=$.trim(),Y=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(Y)return{itemVar:Y[2],indexVar:Y[1]};let J=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(J)return{itemVar:J[1],indexVar:J[2]||null};let X=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(X)return{itemVar:X[1],indexVar:X[2]};let Q=Z.match(/^(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:null};return{itemVar:null,indexVar:null}}function o$($){return[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\buseId\s*\(/,/\buseReactiveProp\s*(?:<[^>]*>)?\s*\(/,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/].some((Y)=>Y.test($))}function qK($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Y=0,J;while((J=Z.exec($))!==null){let X=J[1];if(X.startsWith("if"))Y++;else if(X==="endif")Y--;else if(Y===0)return!0}return!1}function UK($){let Z=new Set,Y=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,X;while((X=Y.exec($))!==null){let Q=X[1],G;while((G=J.exec(Q))!==null)Z.add(G[1])}return Z}function jK($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function E8($,Z,Y){if(!$)return!1;let J=jK($),X=!1,Q=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,W;while((W=K.exec(J))!==null){let j=W[1];if(J.slice(0,W.index).trimEnd().endsWith("."))continue;if(D8.has(j))continue;if(Z.has(j))X=!0;else if(Y&&j in Y)Q=!0}let z=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,q;while((q=z.exec(J))!==null){let j=q[1];if(J.slice(0,q.index).trimEnd().endsWith("."))continue;if(D8.has(j)||Y&&j in Y)continue;G=!0}return(X||G)&&!Q}function i$($,Z,Y){let J=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,""")}"`,X=$.trim(),Q=X.match(b8);if(Q&&_K(Q[3],Q[1])){let[,G,K,W]=Q;return`<${G}${K}${J}>${W}</${G}>`}return`<template${J}>${X}</template>`}function _K($,Z){let Y=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),J=0,X;while((X=Y.exec($))!==null)if(X[1]){if(J--,J<0)return!1}else J++;return!0}function x7($,Z){let Y=UK($);function J(X){let Q=X,G=/@if\s*\(/g,K,W=[];while((K=G.exec(Q))!==null){let z=K.index,q=z+K[0].length,U=1,j=q;while(j<Q.length&&U>0){if(Q[j]==="(")U++;else if(Q[j]===")")U--;j++}if(U!==0)continue;let _=Q.substring(q,j-1).trim(),B=j,H=1,L=B,V=/@(if\s*\(|endif)/g;V.lastIndex=B;let O;while((O=V.exec(Q))!==null)if(O[1].startsWith("if"))H++;else if(O[1]==="endif"){if(H--,H===0){L=O.index+O[0].length;break}}if(H!==0)continue;let F=Q.substring(B,L-6).trim(),w;if(qK(F)){let A=s5(Q.substring(z,L));if(A.length===0)continue;let R=A[0].branches.filter((T)=>T.type!=="else");if(!(R.length>0&&R.every((T)=>E8(T.condition,Y,Z))))continue;w=A[0].branches.map((T)=>{let I=J(T.content);if(T.type==="elseif")return i$(I,"@else-if",T.condition??"");if(T.type==="else")return i$(I,"@else");return i$(I,"@if",T.condition??"")}).join(`
|
|
7346
7349
|
`)}else{if(!E8(_,Y,Z))continue;w=i$(J(F),"@if",_)}W.push({start:z,end:L,replacement:w}),G.lastIndex=L}for(let z=W.length-1;z>=0;z--){let{start:q,end:U,replacement:j}=W[z];Q=Q.substring(0,q)+j+Q.substring(U)}return Q}return J($)}function BK($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let X=Number(Z);return X!==0&&!Number.isNaN(X)}let Y=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(Y)return Y[1].length>0;let J=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(J)return J[1].length>0;return}function HK($,Z,Y,J){if(v7.has(Y.toLowerCase()))return J;let X=Y.toLowerCase(),Q=$.toLowerCase(),G=$.length,K=1,W=J;while(W<G){let z=$.indexOf("<",W);if(z===-1)return-1;if(W=z,$.startsWith("<!--",W)){let _=$.indexOf("-->",W+4);if(_===-1)return-1;W=_+3;continue}let q=/^<(script|style)\b/i.exec($.slice(W,W+8));if(q){let _=$.indexOf(">",W);if(_===-1)return-1;if($[_-1]==="/"){W=_+1;continue}let B=Q.indexOf(`</${q[1].toLowerCase()}`,W);if(B===-1)return-1;let H=$.indexOf(">",B);if(H===-1)return-1;W=H+1;continue}if($[W+1]==="/"){let _=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(W,W+64));if(!_){W++;continue}if(_[1].toLowerCase()===X){if(K--,W+=_[0].length,K===0)return W;continue}W+=_[0].length;continue}let U=/^<([a-z][\w-]*)\b/i.exec($.slice(W,W+64));if(!U){W++;continue}let j=$.indexOf(">",W);if(j===-1)return-1;if(U[1].toLowerCase()===X){let _=$.slice(W,j+1);if(!(/\/\s*>$/.test(_)||v7.has(X)))K++}W=j+1}return-1}function LK($,Z){let Y=Z,J=$.length;for(;;){while(Y<J&&$[Y]!=="<")Y++;if(Y>=J)return!1;if($.startsWith("<!--",Y)){let G=$.indexOf("-->",Y+4);if(G===-1)return!1;Y=G+3;continue}break}if($[Y+1]==="/")return!1;let X=$.indexOf(">",Y);if(X===-1)return!1;let Q=$.slice(Y,X+1);return OK.test(Q)}function f7($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,J;while((J=Y.exec($))!==null)Z.push([J.index,J.index+J[0].length]);let X=(U)=>Z.some(([j,_])=>U>=j&&U<_),Q=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],K;while((K=Q.exec($))!==null){if(X(K.index))continue;let[U,j,_,B,H,L,V]=K,O=BK(H);if(O===void 0)continue;let F=K.index,w=F+U.length,N=!!V||/\/\s*>$/.test(U)||v7.has(j.toLowerCase())?w:HK($,F,j,w);if(N===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&LK($,N)){Q.lastIndex=w;continue}if(O===!0){let T=`<${j}${_}${L}${V}>`;G.push({start:F,end:w,replacement:T});continue}G.push({start:F,end:N,replacement:""}),Q.lastIndex=N}if(G.length===0)return $;G.sort((U,j)=>U.start-j.start);let W=[],z=-1;for(let U of G){if(U.start<z)continue;W.push(U),z=U.end}let q=$;for(let U=W.length-1;U>=0;U--){let{start:j,end:_,replacement:B}=W[U];q=q.substring(0,j)+B+q.substring(_)}return q}function g7($,Z){let Y=$,J=/@(for|foreach)\s*\(/g,X,Q=[];while((X=J.exec(Y))!==null){let G=X[1],K=X.index,W=K+X[0].length,z=1,q=W;while(q<Y.length&&z>0){if(Y[q]==="(")z++;else if(Y[q]===")")z--;q++}if(z!==0)continue;let U=Y.substring(W,q-1).trim(),j=q,_=y8(U);if(_.iterable){let R=_.iterable.trim();if(R.startsWith("[")||R.startsWith("{")||R.startsWith("'")||R.startsWith('"')||R.startsWith("`")||/^-?\d/.test(R))continue;if(Z){let N=R.split(/[.[(]/)[0].trim();if(N&&N in Z)continue}}if(_.style==="as")U=_.indexVar?`(${_.itemVar}, ${_.indexVar}) in ${_.iterable}`:`${_.itemVar} in ${_.iterable}`;let B=G==="for"?"@endfor":"@endforeach",H=1,L=j,V=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");V.lastIndex=j;let O;while((O=V.exec(Y))!==null)if(O[1].startsWith(G))H++;else if(H--,H===0){L=O.index+O[0].length;break}if(H!==0)continue;let F=Y.substring(j,L-B.length).trim(),w=F.match(b8),A;if(w){let[,R,N,M]=w;A=`<${R}${N} @for="${U}">${M}</${R}>`}else A=`<template @for="${U}">${F}</template>`;Q.push({start:K,end:L,replacement:A})}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:z}=Q[G];Y=Y.substring(0,K)+z+Y.substring(W)}return Y}function FK($){let Z=new Set,Y=[],J=0,X=0,Q=$.length,G=(q)=>{let U=J+1;while(U<Q){let j=$[U];if(j==="\\"){U+=2;continue}if(j===q)return U+1;U++}return Q},K=()=>{let q=J+2;while(q<Q&&$[q]!==`
|
|
7347
7350
|
`)q++;return q},W=()=>{let q=J+2;while(q<Q-1){if($[q]==="*"&&$[q+1]==="/")return q+2;q++}return Q},z=(q)=>{let U=q,j=0;while(U<Q){let _=$[U];if(_==="/"&&$[U+1]==="/"){let B=U+2;while(B<Q&&$[B]!==`
|
|
@@ -7363,13 +7366,13 @@ if(window.stx)window.stx._latestSetup=${G};
|
|
|
7363
7366
|
${X.slice(q)}`;else if(U!==-1){let j=/<body[^>]*>/i.exec(X.slice(U))[0],_=U+j.length;X=`${X.slice(0,_)}
|
|
7364
7367
|
${G}${X.slice(_)}`}else X=`${X}
|
|
7365
7368
|
${G}`}let W=X.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),z=W&&/data-stx/.test(W[1]);if(!G&&!z&&W&&!/data-stx-auto/.test(W[1])){let q=/<body[^>]*>/i,U=n$(X,q);if(U!==-1){let j=X.slice(0,U),_=X.slice(U).replace(q,(B)=>B.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));X=j+_}}return X}function n$($,Z){let Y=/<(script|style)\b[\s\S]*?<\/\1>/gi,J=[],X;while((X=Y.exec($))!==null)J.push([X.index,X.index+X[0].length]);let Q=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let K=Q.exec($.slice(G));if(!K)return-1;let W=G+K.index;if(!J.some(([q,U])=>W>=q&&W<U))return W;G=W+Math.max(K[0].length,1)}return-1}function v8($){let Z=[];for(let Y of $.split(",")){let J=Y.trim();if(!J||J.startsWith("type "))continue;let X=J.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(X&&X[1]!==X[2])Z.push(`${X[2]} = ${X[1]}`)}if(Z.length===0)return k8;return`var ${Z.join(", ")}; ${k8}`}var zK=0,T8=`(?:"[^"]*"|'[^']*'|[^>"'])*`,b8,D8,v7,OK,k8="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var t5=S(()=>{h5();C$();l5();M0();C1();b8=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;D8=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);v7=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);OK=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import VK from"fs";import h from"path";function AK($){let Z=new WeakSet;try{let Y=(J)=>{if(J===void 0)return{__stxType:"undefined"};if(typeof J==="bigint")return{__stxType:"bigint",value:J.toString()};if(typeof J==="function"||typeof J==="symbol")throw TypeError("Non-serializable component input");if(J===null||typeof J!=="object")return J;if(Z.has(J))throw TypeError("Circular component input");if(Z.add(J),J instanceof Date)return{__stxType:"date",value:J.toISOString()};if(Array.isArray(J))return J.map(Y);let X={};for(let Q of Object.keys(J).sort())X[Q]=Y(J[Q]);return X};return JSON.stringify(Y($))}catch{return null}}function x8($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function RK($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function y1($){return!RK($)}function P1($){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,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`});let X=new Bun.Transpiler({loader:"ts",target:"browser",define:l0()}).transformSync(Z);for(let Q=0;Q<Y.length;Q++)X=X.replace(`"__STX_EXPR_${Q}__"`,Y[Q]),X=X.replace(`'__STX_EXPR_${Q}__'`,Y[Q]);return X}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function NK($){let Z=[],Y=new Set,J=0,X=0,Q=$.length,G=(q)=>{X++;while(X<Q){if($[X]==="\\"){X+=2;continue}if($[X]===q){X++;return}X++}},K=()=>{X++;while(X<Q){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;return}if($[X]==="$"&&$[X+1]==="{"){X+=2;let q=1;while(X<Q&&q>0)if($[X]==="{")q++,X++;else if($[X]==="}")q--,X++;else if($[X]==="'"||$[X]==='"')G($[X]);else if($[X]==="`")K();else X++;continue}X++}},W=()=>{if($[X]==="/"&&$[X+1]==="/"){while(X<Q&&$[X]!==`
|
|
7366
|
-
`)X++;return!0}if($[X]==="/"&&$[X+1]==="*"){X+=2;while(X<Q-1&&!($[X]==="*"&&$[X+1]==="/"))X++;return X+=2,!0}return!1},z=()=>{if(J!==0)return;let q=$.slice(X).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(q){let B=q[2].split(",").map((H)=>{let L=H.trim().split(":");return L[L.length-1].trim()});for(let H of B)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!Y.has(H))Z.push(H),Y.add(H);return}let U=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let B=U[2];if(!Y.has(B))Z.push(B),Y.add(B);return}let j=$.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!Y.has(B))Z.push(B),Y.add(B);return}let _=$.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let B=_[1];if(!Y.has(B))Z.push(B),Y.add(B)}};while(X<Q){if(W())continue;if($[X]==="'"||$[X]==='"'){G($[X]);continue}if($[X]==="`"){K();continue}if($[X]==="{"){J++,X++;continue}if($[X]==="}"){J--,X++;continue}if(J===0&&/[a-z]/i.test($[X])&&(X===0||/\s|[;{}()]/.test($[X-1])))z();X++}return Z}function MK($){let Z=[],Y=0,J=0,X=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(X){if(G==="\\"){Q++;continue}if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="("||G==="["||G==="{")Y++;else if(G===")"||G==="]"||G==="}")Y--;else if(G===","&&Y===0)Z.push($.slice(J,Q)),J=Q+1}if(J<$.length)Z.push($.slice(J));return Z}function TK($){let Z=0,Y=null;for(let J=0;J<$.length;J++){let X=$[J];if(Y){if(X==="\\"){J++;continue}if(X===Y)Y=null;continue}if(X==='"'||X==="'"||X==="`"){Y=X;continue}if(X==="("||X==="["||X==="{")Z++;else if(X===")"||X==="]"||X==="}")Z--;else if(X==="="&&Z===0){let Q=$[J-1],G=$[J+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return J}}return-1}function IK($,Z){try{let Y=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!Y)return;let J=Y.index-1;while(J>=0&&/\s/.test($[J]))J--;if($[J]!=="}")return;let X=J,Q=0,G=-1;for(;J>=0;J--){let W=$[J];if(W==="}")Q++;else if(W==="{"){if(Q--,Q===0){G=J;break}}}if(G===-1)return;let K=$.slice(G+1,X);for(let W of MK(K)){let z=W.trim();if(!z||z.startsWith("..."))continue;let q=TK(z);if(q===-1)continue;let U=z.slice(0,q).trim();if(!/^[A-Z_$][\w$]*$/i.test(U))continue;if(Z[U]!==void 0)continue;let j=z.slice(q+1).trim();if(!j)continue;try{let _=Object.keys(Z),B=Function(..._,`"use strict"; return (${j});`);Z[U]=B(..._.map((H)=>Z[H]))}catch{}}}catch{}}async function t$($,Z,Y,J,X){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""),K=(L)=>L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),W=Y.__importedComponents;if(W){for(let L of[Q,Q.toLowerCase(),G(Q),K(Q)])if(W.has(L))return!0}let z=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${K(Q)}.stx`])],q=typeof X.root==="string"?h.resolve(X.root):void 0,U=q??h.dirname(J),j=[],_=(L)=>{if(L&&!j.includes(L))j.push(L)},B=Y.__originalFilePath;if(B)_(h.join(h.dirname(B),"components"));_(Z),_(X._rootComponentsDir),_(h.join(h.dirname(J),"components")),_(X.componentsDir);let H=X._pluginComponentDirs;if(Array.isArray(H))for(let L of H)_(typeof L==="string"?L:null);if(q)_(h.resolve(q,"resources/views/components")),_(h.resolve(q,"resources/components")),_(h.resolve(q,"src/components")),_(h.resolve(q,"components"));if(Q.startsWith("./")||Q.startsWith("../"))return c(h.resolve(h.dirname(J),`${Q}.stx`));for(let L of j){let V=h.isAbsolute(L)?L:h.resolve(U,L);for(let O of z)if(await c(h.join(V,O)))return!0}return!1}function DK($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function EK($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function kK($){let Z=new Set,Y=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let J of $){let X;while((X=Y.exec(J))!==null)Z.add(X[1]);Y.lastIndex=0}return[...Z]}async function d1($,Z,Y,J,X,Q,G,K=new Set,W){let{extractVariables:z}=await Promise.resolve().then(() => (o5(),y$)),q=K??new Set;if(q.has($))return`[Circular component reference: ${$}]`;let U=new Set(q);U.add($);let j=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let _=j&&j!=="load"&&DK(j)?j:"";try{let B=(P)=>P.split("-").map((x)=>x.charAt(0).toUpperCase()+x.slice(1)).join(""),H=(P)=>P.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=$.endsWith(".stx")?$.slice(0,-4):$,V=null,O=X.__importedComponents;if(O){let P=[L,L.toLowerCase(),B(L),H(L)];for(let x of P)if(O.has(x)){V=O.get(x);break}}let F=[];if(!V){let P=[`${L}.stx`,`${B(L)}.stx`,`${H(L)}.stx`],x=[...new Set(P)],
|
|
7369
|
+
`)X++;return!0}if($[X]==="/"&&$[X+1]==="*"){X+=2;while(X<Q-1&&!($[X]==="*"&&$[X+1]==="/"))X++;return X+=2,!0}return!1},z=()=>{if(J!==0)return;let q=$.slice(X).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(q){let B=q[2].split(",").map((H)=>{let L=H.trim().split(":");return L[L.length-1].trim()});for(let H of B)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!Y.has(H))Z.push(H),Y.add(H);return}let U=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let B=U[2];if(!Y.has(B))Z.push(B),Y.add(B);return}let j=$.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!Y.has(B))Z.push(B),Y.add(B);return}let _=$.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let B=_[1];if(!Y.has(B))Z.push(B),Y.add(B)}};while(X<Q){if(W())continue;if($[X]==="'"||$[X]==='"'){G($[X]);continue}if($[X]==="`"){K();continue}if($[X]==="{"){J++,X++;continue}if($[X]==="}"){J--,X++;continue}if(J===0&&/[a-z]/i.test($[X])&&(X===0||/\s|[;{}()]/.test($[X-1])))z();X++}return Z}function MK($){let Z=[],Y=0,J=0,X=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(X){if(G==="\\"){Q++;continue}if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="("||G==="["||G==="{")Y++;else if(G===")"||G==="]"||G==="}")Y--;else if(G===","&&Y===0)Z.push($.slice(J,Q)),J=Q+1}if(J<$.length)Z.push($.slice(J));return Z}function TK($){let Z=0,Y=null;for(let J=0;J<$.length;J++){let X=$[J];if(Y){if(X==="\\"){J++;continue}if(X===Y)Y=null;continue}if(X==='"'||X==="'"||X==="`"){Y=X;continue}if(X==="("||X==="["||X==="{")Z++;else if(X===")"||X==="]"||X==="}")Z--;else if(X==="="&&Z===0){let Q=$[J-1],G=$[J+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return J}}return-1}function IK($,Z){try{let Y=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!Y)return;let J=Y.index-1;while(J>=0&&/\s/.test($[J]))J--;if($[J]!=="}")return;let X=J,Q=0,G=-1;for(;J>=0;J--){let W=$[J];if(W==="}")Q++;else if(W==="{"){if(Q--,Q===0){G=J;break}}}if(G===-1)return;let K=$.slice(G+1,X);for(let W of MK(K)){let z=W.trim();if(!z||z.startsWith("..."))continue;let q=TK(z);if(q===-1)continue;let U=z.slice(0,q).trim();if(!/^[A-Z_$][\w$]*$/i.test(U))continue;if(Z[U]!==void 0)continue;let j=z.slice(q+1).trim();if(!j)continue;try{let _=Object.keys(Z),B=Function(..._,`"use strict"; return (${j});`);Z[U]=B(..._.map((H)=>Z[H]))}catch{}}}catch{}}async function t$($,Z,Y,J,X){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""),K=(L)=>L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),W=Y.__importedComponents;if(W){for(let L of[Q,Q.toLowerCase(),G(Q),K(Q)])if(W.has(L))return!0}let z=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${K(Q)}.stx`])],q=typeof X.root==="string"?h.resolve(X.root):void 0,U=q??h.dirname(J),j=[],_=(L)=>{if(L&&!j.includes(L))j.push(L)},B=Y.__originalFilePath;if(B)_(h.join(h.dirname(B),"components"));_(Z),_(X._rootComponentsDir),_(h.join(h.dirname(J),"components")),_(X.componentsDir);let H=X._pluginComponentDirs;if(Array.isArray(H))for(let L of H)_(typeof L==="string"?L:null);if(q)_(h.resolve(q,"resources/views/components")),_(h.resolve(q,"resources/components")),_(h.resolve(q,"src/components")),_(h.resolve(q,"components"));if(Q.startsWith("./")||Q.startsWith("../"))return c(h.resolve(h.dirname(J),`${Q}.stx`));for(let L of j){let V=h.isAbsolute(L)?L:h.resolve(U,L);for(let O of z)if(await c(h.join(V,O)))return!0}return!1}function DK($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function EK($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function kK($){let Z=new Set,Y=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let J of $){let X;while((X=Y.exec(J))!==null)Z.add(X[1]);Y.lastIndex=0}return[...Z]}async function d1($,Z,Y,J,X,Q,G,K=new Set,W){let{extractVariables:z}=await Promise.resolve().then(() => (o5(),y$)),q=K??new Set;if(q.has($))return`[Circular component reference: ${$}]`;let U=new Set(q);U.add($);let j=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let _=j&&j!=="load"&&DK(j)?j:"";try{let B=(P)=>P.split("-").map((x)=>x.charAt(0).toUpperCase()+x.slice(1)).join(""),H=(P)=>P.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=$.endsWith(".stx")?$.slice(0,-4):$,V=null,O=X.__importedComponents;if(O){let P=[L,L.toLowerCase(),B(L),H(L)];for(let x of P)if(O.has(x)){V=O.get(x);break}}let F=[];if(!V){let P=[`${L}.stx`,`${B(L)}.stx`,`${H(L)}.stx`],x=[...new Set(P)],m=X.__originalFilePath,u=[];if(m){let z0=h.join(h.dirname(m),"components");u.push(z0)}if(J)u.push(J);let U0=G._rootComponentsDir;if(typeof U0==="string"&&!u.includes(U0))u.push(U0);let N0=h.join(h.dirname(Q),"components");if(!u.includes(N0))u.push(N0);if(G.componentsDir&&G.componentsDir!==J&&!u.includes(G.componentsDir))u.push(G.componentsDir);let G1=G._pluginComponentDirs;if(Array.isArray(G1)){for(let z0 of G1)if(typeof z0==="string"&&!u.includes(z0))u.push(z0)}let p0=typeof G.root==="string"?h.resolve(G.root):void 0,C0=p0??h.dirname(Q),o0=[];if(p0)o0.push(h.resolve(p0,"resources/views/components")),o0.push(h.resolve(p0,"resources/components")),o0.push(h.resolve(p0,"src/components")),o0.push(h.resolve(p0,"components"));o0.push(h.resolve(import.meta.dir,"components"));for(let z0 of o0)if(!u.includes(z0))u.push(z0);let E1=[...new Set(u.map((z0)=>{if(!z0)return z0;return h.isAbsolute(z0)?z0:h.resolve(C0,z0)}))];u.length=0,u.push(...E1);let _1=`${L}\x00${Q}\x00${E1.join("\x00")}`,e1=a$.get(_1);if(e1)if(await c(e1))V=e1;else a$.delete(_1);if(!V&&(L.startsWith("./")||L.startsWith("../")))V=h.resolve(h.dirname(Q),`${L}.stx`),F.push(V);else if(!V)for(let z0 of u){if(!z0)continue;for(let i of x){let h0=h.join(z0,i);if(F.push(h0),await c(h0)){V=h0;break}}if(V)break;if(!V)try{let i=await import("fs");if(!i.statSync(z0,{throwIfNoEntry:!1})?.isDirectory())continue;let k1=8,E5=[{path:z0,depth:0}];while(E5.length>0&&!V){let F$=E5.pop();if(F$.depth>=k1)continue;let o6;try{o6=i.readdirSync(F$.path,{withFileTypes:!0})}catch{continue}for(let V$ of o6){if(!V$.isDirectory())continue;if(V$.name==="node_modules"||V$.name.startsWith("."))continue;let s6=h.join(F$.path,V$.name);for(let YQ of x){let J7=h.join(s6,YQ);if(F.push(J7),await c(J7)){V=J7;break}}if(V)break;E5.push({path:s6,depth:F$.depth+1})}}}catch{}if(V)break}if(V)a$.set(_1,V)}if(!V||!await c(V)){let P=F.length>0?`
|
|
7367
7370
|
Searched paths:
|
|
7368
7371
|
${F.map((x)=>` - ${x}`).join(`
|
|
7369
|
-
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${P}`}W.add(V);let w;if(r$.has(V))w=r$.get(V);else try{w=await Bun.file(V).text(),r$.set(V,w)}catch(P){return`[Error loading component: ${P instanceof Error?P.message:String(P)}]`}let A=new Set(["__originalFilePath","__importedComponents"]),R={};for(let[P,x]of Object.entries(X))if(!P.startsWith("__")||A.has(P))R[P]=x;let{extractSlotContent:N}=await Promise.resolve().then(() => (T7(),M7)),M=N(Y),T={};if(M.defaultSlot?.trim())T.default=M.defaultSlot;for(let[P,x]of M.namedSlots)T[P]=x.content;let I={...R,...Z,props:Z,slot:Y,$slots:T,__processedComponents:U,__sections:{},...EK(Y)&&{__stx_force_signals:!0}};IK(w,I);let E=w,D=k$(E);if(D)E=D.content.trim();let y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,b=[...w.matchAll(y)],k=[],v=b.some((P)=>/\bserver\b/.test(P[1]||"")&&/\bcache\b/.test(P[1]||""))&&b.every((P)=>/\bserver\b/.test(P[1]||"")),g=null,f=null;if(v){let P=AK({props:Z,slot:Y,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0});if(P!==null){g=`${V}\x00${P}`;let x=d7.get(g);if(x){for(let
|
|
7370
|
-
`)}`}if(Y&&r.includes("{{ text || slot }}"))r=r.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:Q0}=await Promise.resolve().then(() => (T7(),M7)),{defaultSlot:k0,namedSlots:n0}=M;r=await Q0(r,k0,n0,I);for(let[P,x]of Object.entries(I))if(typeof x==="string"){if(x.includes("<")&&x.includes(">")||x.includes("<")||x.includes(""")){let
|
|
7372
|
+
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${P}`}W.add(V);let w;if(r$.has(V))w=r$.get(V);else try{w=await Bun.file(V).text(),r$.set(V,w)}catch(P){return`[Error loading component: ${P instanceof Error?P.message:String(P)}]`}let A=new Set(["__originalFilePath","__importedComponents"]),R={};for(let[P,x]of Object.entries(X))if(!P.startsWith("__")||A.has(P))R[P]=x;let{extractSlotContent:N}=await Promise.resolve().then(() => (T7(),M7)),M=N(Y),T={};if(M.defaultSlot?.trim())T.default=M.defaultSlot;for(let[P,x]of M.namedSlots)T[P]=x.content;let I={...R,...Z,props:Z,slot:Y,$slots:T,__processedComponents:U,__sections:{},...EK(Y)&&{__stx_force_signals:!0}};IK(w,I);let E=w,D=k$(E);if(D)E=D.content.trim();let y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,b=[...w.matchAll(y)],k=[],v=b.some((P)=>/\bserver\b/.test(P[1]||"")&&/\bcache\b/.test(P[1]||""))&&b.every((P)=>/\bserver\b/.test(P[1]||"")),g=null,f=null;if(v){let P=AK({props:Z,slot:Y,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0});if(P!==null){g=`${V}\x00${P}`;let x=d7.get(g);if(x){for(let m of x.dependencies)W.add(m);return x.output}f=new Set(W)}}for(let P of b){let x=P[1]||"",m=P[2]||"",u=x.includes("server");if(y1(x)&&m.trim())m=P1(m);if(u&&m)try{await z(m,I,V)}catch(N0){}if(!u){let N0=m.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),G1=N0.includes("{{")&&N0.includes("}}"),p0=N0.includes("{!!")&&N0.includes("!!}");if(G1||p0)N0=I$(N0,I);let C0=x.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");k.push(`<script${C0}>${N0}</script>`)}}let d=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),p=d?d[1]:"",X0=d?d[2]:"",Z0="",V0=p&&/\bscoped\b/i.test(p);if(d)Z0=`<style${p}>${X0}</style>`;let r=E;if(r=r.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),d)r=r.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let P=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,x=[];if(r=r.replace(P,(m,u)=>{let U0=u.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(U0)x.push(`<style${U0[1]}>${U0[2]}</style>`);return""}),r=r.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),x.length>0)Z0=`${Z0}${x.join(`
|
|
7373
|
+
`)}`}if(Y&&r.includes("{{ text || slot }}"))r=r.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:Q0}=await Promise.resolve().then(() => (T7(),M7)),{defaultSlot:k0,namedSlots:n0}=M;r=await Q0(r,k0,n0,I);for(let[P,x]of Object.entries(I))if(typeof x==="string"){if(x.includes("<")&&x.includes(">")||x.includes("<")||x.includes(""")){let m=_7(x);I[P]=m}}let j1=k.some((P)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(P)),t1=kK(k);if(t1.length>0)I.__stx_client_signal_names=t1;let n={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:h.dirname(V),skipSignalsRuntime:!0,skipEventDirectives:j1||k.length===0,defaultLayout:void 0};I.__stxProcessingDepth=(X.__stxProcessingDepth||0)+1;let J0=await O0(r,I,V,n,W),B0=new Set(Array.isArray(X.__stx_preserved_client_expressions)?X.__stx_preserved_client_expressions:[]);for(let P of J0.matchAll(/\{\{([\s\S]*?)\}\}/g))B0.add(P[1].trim());if(B0.size>0)X.__stx_preserved_client_expressions=[...B0];let R0=`stx_${L.replace(/[^a-zA-Z0-9]/g,"_")}_${++wK}_${Math.random().toString(36).slice(2,8)}`,C=J0;if(j1){let P="";if(Object.keys(Z).length>0)try{P=` data-stx-props="${x8(JSON.stringify(Z))}"`}catch{}let x=_?` stx-hydrate="${x8(_)}"`:"";C=`<div data-stx-scope="${R0}"${P}${x}>${J0}</div>`;let m=await Promise.all(k.map(async(u)=>{let U0=u.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!U0)return u;let[,N0,G1]=U0,p0=w$(G1,{filePath:V,projectRoot:process.cwd()}),C0=p0.code,o0=A$(p0.styles);C0=Z5(C0).code;let{hasUserImports:E1,bundleClientScript:_1}=await Promise.resolve().then(() => (v5(),C5));if(E1(C0))C0=await _1(C0,V,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:e1}=await Promise.resolve().then(() => (t5(),s$));C0=C0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(k1,E5)=>e1(E5));let z0=s0(C0),i=NK(z0),h0=`
|
|
7371
7374
|
(function() {
|
|
7372
|
-
${X5("const",[...
|
|
7375
|
+
${X5("const",[...u9,...i],z0)}
|
|
7373
7376
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
7374
7377
|
const __scopeVars = __scope['${R0}'] = __scope['${R0}'] || {};
|
|
7375
7378
|
const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
|
|
@@ -7397,12 +7400,12 @@ finally {
|
|
|
7397
7400
|
window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
|
|
7398
7401
|
}
|
|
7399
7402
|
})();`;if(_)return`${o0}<script type="stx/island" data-stx-island="${R0}" data-stx-scoped${N0}>${h0}</script>`;return`${o0}<script data-stx-scoped${N0}>${h0}</script>`}));if(C=C+`
|
|
7400
|
-
`+
|
|
7403
|
+
`+m.join(`
|
|
7401
7404
|
`),Z0)C+=`
|
|
7402
7405
|
`+Z0}else{if(Z0)C+=`
|
|
7403
|
-
`+Z0;if(k.length>0){let P=I.__stx_event_bindings||[],x=f5(I),
|
|
7404
|
-
`+
|
|
7405
|
-
`),I.__stx_event_bindings=[]}}if(V0){let P=E$(C,V);if(P.hasScoped)C=P.html}if(g&&f)d7.set(g,{output:C,dependencies:[...W].filter((P)=>!f.has(P))});return C}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{q.delete($)}}async function c($){return Bun.file($).exists()}function
|
|
7406
|
+
`+Z0;if(k.length>0){let P=I.__stx_event_bindings||[],x=f5(I),m=await Promise.all(k.map(async(u)=>{let U0=u.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!U0)return u;return await g5(U0[1],{eventBindings:P,templateContent:C,filePath:V,projectRoot:process.cwd(),serverData:x})}));C+=`
|
|
7407
|
+
`+m.join(`
|
|
7408
|
+
`),I.__stx_event_bindings=[]}}if(V0){let P=E$(C,V);if(P.hasScoped)C=P.html}if(g&&f)d7.set(g,{output:C,dependencies:[...W].filter((P)=>!f.has(P))});return C}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{q.delete($)}}async function c($){return Bun.file($).exists()}function u7($,Z){let Y=h.resolve(Z),J=h.resolve($),X=Y.endsWith(h.sep)?Y:Y+h.sep;if(J===Y||J.startsWith(X))return J;return null}async function m7($,Z,Y,J){let X=await bK($,Z,Y,J);if(X===null)return null;let Q=u7(X,process.cwd());if(Q)return Q;let G=[Y.root,Y.layoutsDir,Y.componentsDir,Y.partialsDir,Y.pagesDir].filter((K)=>typeof K==="string"&&K.length>0);for(let K of G){let W=h.isAbsolute(K)?K:h.resolve(process.cwd(),K);if(u7(X,W))return h.resolve(X)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${X} (template: ${$}, from: ${Z})`),null}async function bK($,Z,Y,J){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let X=h.dirname(Z),Q=process.cwd();if($.startsWith("/")){let j=h.join(Q,$),_=u7(j,Q);if(!_)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${_}`);if(await c(_)&&J)J.add(_);return _}let G=h.join(X,$);if(await c(G)){if(Y.debug)console.log(`Found direct path: ${G}`);if(J)J.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let j of[".stx",".tsx",".jsx"]){let _=`${G}${j}`;if(await c(_)){if(Y.debug)console.log(`Found direct path with extension: ${_}`);if(J)J.add(_);return _}}let K="",W=h.resolve(X),z=process.cwd();for(let j=0;j<10;j++){let _=h.join(W,"layouts"),B=!1;try{B=VK.statSync(_,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){K=_;break}let H=h.dirname(W);if(H===W||H.length<z.length)break;W=H}if(K){let j=$.startsWith("layouts/")?$.slice(8):$,_=h.join(K,j);if(await c(_)){if(Y.debug)console.log(`Found in current layouts dir: ${_}`);if(J)J.add(_);return _}if(!j.endsWith(".stx")){let B=`${_}.stx`;if(await c(B)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${B}`);if(J)J.add(B);return B}}}if(Y.layoutsDir){let j=h.isAbsolute(Y.layoutsDir)?Y.layoutsDir:h.resolve(process.cwd(),Y.layoutsDir),_=$.startsWith("layouts/")?$.slice(8):$,B=h.join(j,_);if(await c(B)){if(Y.debug)console.log(`Found in options.layoutsDir: ${B}`);if(J)J.add(B);return B}if(!$.endsWith(".stx")){let H=`${B}.stx`;if(await c(H)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${H}`);if(J)J.add(H);return H}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let j=$.split("layouts/"),_=h.join(Y.partialsDir||X,"layouts",j[1]);if(await c(_)){if(Y.debug)console.log(`Found in layouts path: ${_}`);if(J)J.add(_);return _}if(!_.endsWith(".stx")){let B=`${_}.stx`;if(await c(B)){if(Y.debug)console.log(`Found in layouts path with extension: ${B}`);if(J)J.add(B);return B}}}if(Y.partialsDir){if(K=h.join(Y.partialsDir,"layouts"),await c(K)){let j=h.join(K,$);if(await c(j)){if(Y.debug)console.log(`Found in partials layouts dir: ${j}`);if(J)J.add(j);return j}if(!$.endsWith(".stx")){let _=`${j}.stx`;if(await c(_)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${_}`);if(J)J.add(_);return _}}}}let q=Y.partialsDir||h.join(process.cwd(),"views"),U=h.join(q,$);if(await c(U)){if(Y.debug)console.log(`Found in views path: ${U}`);if(J)J.add(U);return U}if(!$.endsWith(".stx")){let j=`${U}.stx`;if(await c(j)){if(Y.debug)console.log(`Found in views path with extension: ${j}`);if(J)J.add(j);return j}}if(X.includes("temp")){let j=h.join(h.dirname(X),"layouts",$);if(await c(j)){if(Y.debug)console.log(`Found in temp layouts dir: ${j}`);if(J)J.add(j);return j}if(!$.endsWith(".stx")){let _=`${j}.stx`;if(await c(_)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${_}`);if(J)J.add(_);return _}}}if(Y.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function f8($,Z,Y){let J=0,X="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
|
|
7406
7409
|
`),K=0;for(let W=0;W<G.length;W++)if(K+=G[W].length+1,K>=Z){J=W+1,X=G[W].trim();let z=Math.max(0,W-2),q=Math.min(G.length,W+3);Q=G.slice(z,q).map((U,j)=>{let _=z+j+1;return`${_===J?"> ":" "}${_}: ${U}`}).join(`
|
|
7407
7410
|
`);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return f8($,G)}}catch{}return{lineNumber:J,lineContent:X,context:Q}}function q0($,Z,Y,J,X,Q){let{lineNumber:G,context:K}=f8(J,X,Q),W=Y.split("/").pop(),z=0;if(typeof X==="number"&&X>=0&&J){let U=J.lastIndexOf(`
|
|
7408
7411
|
`,Math.max(0,X-1));z=X-(U+1)+1}let q="";if(G>0)q+=`
|
|
@@ -7418,7 +7421,7 @@ ${t.yellow}${t.bold}Message:${t.reset} ${Z}
|
|
|
7418
7421
|
${t.blue}${t.bold}Context:${t.reset}
|
|
7419
7422
|
${t.dim}${K}${t.reset}
|
|
7420
7423
|
`;return q}function R8(){r$.clear(),a$.clear(),d7.clear()}var r$,a$,d7,wK=0,t;var M0=S(()=>{h5();Y1();l5();K5();e$();b1();L7();F7();s9();o5();r$=new v1(500),a$=new v1(1000),d7=new v1(2000);t={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"}});async function g8($,Z,Y=""){let J=$,X=[],Q=/@markdown(?:\([^)]*\))?/g,G;while((G=Q.exec($))!==null){let K=G.index,W=G[0].match(/@markdown\(([^)]*)\)/),z=W?W[1]:"",q=K+G[0].length,U=1,j=q,_=-1;while(U>0&&j<$.length){let L=$.indexOf("@markdown",j),V=$.indexOf("@endmarkdown",j);if(V===-1)break;if(L!==-1&&L<V&&L!==K){let O=$[L+9];if(O==="("||O===`
|
|
7421
|
-
`||O==="\r"||O===" "||O===void 0)U++;j=L+9}else{if(U--,U===0){_=V;break}j=V+12}}if(_===-1)continue;let B=$.slice(q,_),H=$.slice(K,_+12);X.push({fullMatch:H,options:z,content:B,index:K}),Q.lastIndex=_+12}for(let{fullMatch:K,options:W,content:z,index:q}of X)try{let U={};if(W)W.split(",").forEach((B)=>{let H=B.trim();if(H)U[H]=!0});let j={gfm:U.gfm??!0,breaks:U.breaks??!1},_=P5(z.trim(),j);J=J.split(K).join(_)}catch(U){let j=U instanceof Error?U.message:String(U),_=q0("Markdown Directive",`Error processing markdown: ${j}`,Y,$,q,K);J=J.split(K).join(_)}return J}async function h8($,Z,Y,J){let X={gfm:!0,breaks:!1};return Z.forEach((Q)=>{let G=Q.trim().replace(/['"]/g,"");if(G==="breaks")X.breaks=!0;if(G==="no-gfm")X.gfm=!1}),P5($.trim(),X)}var p7=S(()=>{M0()});function PK($){if(SK.set($.name,$),$.client)yK.set($.name,$.client)}function $4($){return PK($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,J,X,Q)=>{let G=CK(J,$.defaults);if($.validate){let W=$.validate(G);if(W!==!0){let z=typeof W==="string"?W:`Invalid parameters for @${$.name}`;throw Error(z)}}let K=Y;if($.transform)K=await $.transform(Y,G,X,Q);if($.clientScript){let W=$.clientScript(G);K+=`<script>${W}</script>`}if($.css){let W=$.css(G);K+=`<style>${W}</style>`}return K}}}function CK($,Z){let Y={...Z};for(let J of $){let X=J.indexOf(":"),Q=J.indexOf("="),G=X>=0&&(Q<0||X<Q)?X:Q;if(G>=0){let K=J.slice(0,G).trim(),W=J.slice(G+1).trim();if(W==="true")W=!0;else if(W==="false")W=!1;else if(W==="null")W=null;else if(!Number.isNaN(Number(W)))W=Number(W);else if(typeof W==="string"&&W.startsWith("{"))try{W=JSON.parse(W)}catch{}Y[K]=W}else{let K=Object.keys(Y).filter((W)=>!Z||!(W in Z)).length;Y[K===0?"value":`arg${K}`]=J}}return Y}var SK,yK;var l7=S(()=>{SK=new Map,yK=new Map});function c7($,Z=U5,Y={},J){return Z.sort((X,Q)=>X-Q).map((X)=>{return`${$$($,{...Y,w:X,fm:J})} ${X}w`}).join(", ")}function d8($,Z,Y=vK,J={},X){return Y.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${$$($,{...J,w:G,dpr:Q,fm:X})} ${Q}x`}).join(", ")}function i7($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let J=Object.entries($).map(([X,Q])=>{let G=/^\d+$/.test(X)?`${X}px`:X;return{bp:G,size:Q,numericBp:Number.parseInt(G)||0}}).sort((X,Q)=>X.numericBp-Q.numericBp).map(({bp:X,size:Q})=>`(max-width: ${X}) ${Q}`);return J.push(Z),J.join(", ")}function $$($,Z={}){let Y=Object.entries(Z).filter(([,Q])=>Q!==void 0&&Q!==null).map(([Q,G])=>{if(Array.isArray(G))return[Q,G.join(",")];return[Q,String(G)]});if(Y.length===0)return $;let J=Y.map(([Q,G])=>`${Q}=${encodeURIComponent(G)}`).join("&"),X=$.includes("?")?"&":"?";return`${$}${X}${J}`}function n7($){return xK[$]||"application/octet-stream"}var U5,vK,e5,xK;var o7=S(()=>{U5=[320,480,640,768,1024,1280,1536,1920,2560],vK=[1,1.5,2,3],e5=["avif","webp","jpeg"],xK={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function gK(){try{return await import("ts-images")}catch{return null}}async function hK($,Z={}){let Y={...fK,...Z},J=await gK();if(J)try{return await dK($,Y,J)}catch(X){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${X}`)}return
|
|
7424
|
+
`||O==="\r"||O===" "||O===void 0)U++;j=L+9}else{if(U--,U===0){_=V;break}j=V+12}}if(_===-1)continue;let B=$.slice(q,_),H=$.slice(K,_+12);X.push({fullMatch:H,options:z,content:B,index:K}),Q.lastIndex=_+12}for(let{fullMatch:K,options:W,content:z,index:q}of X)try{let U={};if(W)W.split(",").forEach((B)=>{let H=B.trim();if(H)U[H]=!0});let j={gfm:U.gfm??!0,breaks:U.breaks??!1},_=P5(z.trim(),j);J=J.split(K).join(_)}catch(U){let j=U instanceof Error?U.message:String(U),_=q0("Markdown Directive",`Error processing markdown: ${j}`,Y,$,q,K);J=J.split(K).join(_)}return J}async function h8($,Z,Y,J){let X={gfm:!0,breaks:!1};return Z.forEach((Q)=>{let G=Q.trim().replace(/['"]/g,"");if(G==="breaks")X.breaks=!0;if(G==="no-gfm")X.gfm=!1}),P5($.trim(),X)}var p7=S(()=>{M0()});function PK($){if(SK.set($.name,$),$.client)yK.set($.name,$.client)}function $4($){return PK($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,J,X,Q)=>{let G=CK(J,$.defaults);if($.validate){let W=$.validate(G);if(W!==!0){let z=typeof W==="string"?W:`Invalid parameters for @${$.name}`;throw Error(z)}}let K=Y;if($.transform)K=await $.transform(Y,G,X,Q);if($.clientScript){let W=$.clientScript(G);K+=`<script>${W}</script>`}if($.css){let W=$.css(G);K+=`<style>${W}</style>`}return K}}}function CK($,Z){let Y={...Z};for(let J of $){let X=J.indexOf(":"),Q=J.indexOf("="),G=X>=0&&(Q<0||X<Q)?X:Q;if(G>=0){let K=J.slice(0,G).trim(),W=J.slice(G+1).trim();if(W==="true")W=!0;else if(W==="false")W=!1;else if(W==="null")W=null;else if(!Number.isNaN(Number(W)))W=Number(W);else if(typeof W==="string"&&W.startsWith("{"))try{W=JSON.parse(W)}catch{}Y[K]=W}else{let K=Object.keys(Y).filter((W)=>!Z||!(W in Z)).length;Y[K===0?"value":`arg${K}`]=J}}return Y}var SK,yK;var l7=S(()=>{SK=new Map,yK=new Map});function c7($,Z=U5,Y={},J){return Z.sort((X,Q)=>X-Q).map((X)=>{return`${$$($,{...Y,w:X,fm:J})} ${X}w`}).join(", ")}function d8($,Z,Y=vK,J={},X){return Y.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${$$($,{...J,w:G,dpr:Q,fm:X})} ${Q}x`}).join(", ")}function i7($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let J=Object.entries($).map(([X,Q])=>{let G=/^\d+$/.test(X)?`${X}px`:X;return{bp:G,size:Q,numericBp:Number.parseInt(G)||0}}).sort((X,Q)=>X.numericBp-Q.numericBp).map(({bp:X,size:Q})=>`(max-width: ${X}) ${Q}`);return J.push(Z),J.join(", ")}function $$($,Z={}){let Y=Object.entries(Z).filter(([,Q])=>Q!==void 0&&Q!==null).map(([Q,G])=>{if(Array.isArray(G))return[Q,G.join(",")];return[Q,String(G)]});if(Y.length===0)return $;let J=Y.map(([Q,G])=>`${Q}=${encodeURIComponent(G)}`).join("&"),X=$.includes("?")?"&":"?";return`${$}${X}${J}`}function n7($){return xK[$]||"application/octet-stream"}var U5,vK,e5,xK;var o7=S(()=>{U5=[320,480,640,768,1024,1280,1536,1920,2560],vK=[1,1.5,2,3],e5=["avif","webp","jpeg"],xK={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function gK(){try{return await import("ts-images")}catch{return null}}async function hK($,Z={}){let Y={...fK,...Z},J=await gK();if(J)try{return await dK($,Y,J)}catch(X){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${X}`)}return uK($,Y)}async function dK($,Z,Y){let{generatePlaceholder:J,generateThumbHash:X}=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 X($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await J($,{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 uK($,Z){let Y=Z.width||20,J=Z.height||Y,X="#e5e7eb",Q=`<svg xmlns="http://www.w3.org/2000/svg" width="${Y}" height="${J}" viewBox="0 0 ${Y} ${J}"><rect fill="#e5e7eb" width="${Y}" height="${J}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Q)}`,width:Y,height:J,aspectRatio:Y/J,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}function u8($,Z,Y={}){let J=Y.transitionDuration||300,X=Y.easing||"ease-out";return`
|
|
7422
7425
|
#${$} {
|
|
7423
7426
|
--stx-img-transition-duration: ${J}ms;
|
|
7424
7427
|
--stx-img-transition-easing: ${X};
|
|
@@ -7435,7 +7438,7 @@ ${t.dim}${K}${t.reset}
|
|
|
7435
7438
|
#${$}.stx-img-loaded img {
|
|
7436
7439
|
opacity: 1;
|
|
7437
7440
|
}
|
|
7438
|
-
`.trim()}async function
|
|
7441
|
+
`.trim()}async function m8($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if(s7.has(Y))return s7.get(Y);let J=await hK($,Z);return s7.set(Y,J),J}var fK,r7,s7;var p8=S(()=>{fK={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},r7=`
|
|
7439
7442
|
.stx-img-placeholder {
|
|
7440
7443
|
position: relative;
|
|
7441
7444
|
overflow: hidden;
|
|
@@ -7464,7 +7467,7 @@ ${t.dim}${K}${t.reset}
|
|
|
7464
7467
|
filter: blur(0);
|
|
7465
7468
|
transform: scale(1);
|
|
7466
7469
|
}
|
|
7467
|
-
`.trim();s7=new Map});import{createHash as c8}from"crypto";import{readFile as uK,stat as i8}from"fs/promises";async function b0($){try{let Z=await uK($);return c8("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function l8($){return c8("sha256").update($).digest("hex").slice(0,16)}function Z4($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${l8($)}-${l8(Y)}`}async function a7($){try{return(await i8($)).mtimeMs}catch{return 0}}async function D0($){try{return await i8($),!0}catch{return!1}}var m1=()=>{};import{mkdir as pK,readFile as lK,writeFile as cK,readdir as FO,rm as iK,stat as VO}from"fs/promises";import{join as o8,dirname as nK}from"path";async function oK($){try{await pK($,{recursive:!0})}catch{}}function s8($,Z,Y){return o8($,Y,`${Z}.json`)}async function n8($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await a7(Z)!==$.srcMtime)return!1;return!0}async function Y4($,Z,Y,J=t7){if(!J.enabled)return null;let X=Z4($,Z),Q=j5.get(X);if(Q){if(await n8(Q,$,J.maxAge))return Q.lastAccessedAt=Date.now(),Q.data;j5.delete(X)}let G=s8(J.directory,X,Y);if(await D0(G))try{let K=await lK(G,"utf-8"),W=JSON.parse(K);if(await n8(W,$,J.maxAge))return W.lastAccessedAt=Date.now(),j5.set(X,W),W.data}catch{}return null}async function J4($,Z,Y,J,X=t7){if(!X.enabled)return;let Q=Z4($,Z),G=await b0($),K=await a7($),W={key:Q,src:$,srcHash:G,srcMtime:K,optionsHash:Z4("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};j5.set(Q,W);let z=s8(X.directory,Q,J);try{await oK(nK(z)),await cK(z,JSON.stringify(W,null,2))}catch(q){console.warn(`[stx-media] Failed to write cache: ${q}`)}}async function X4($,Z=t7){if($==="all")j5.clear();else j5.clear();let Y=$==="all"?["image","video"]:[$];for(let J of Y){let X=o8(Z.directory,J);try{await iK(X,{recursive:!0,force:!0})}catch{}}}var j5,t7;var e7=S(()=>{m1();j5=new Map,t7={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class G4{config;constructor($={}){this.config={...sK,...$}}async get($,Z){return Y4($,Z,"image",this.config)}async set($,Z,Y){return J4($,Z,Y,"image",this.config)}async clear(){return X4("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function $3($){if(!Q4)Q4=new G4($);else if($)Q4.updateConfig($);return Q4}async function K4($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return $3(J).get($,Z)}async function W4($,Z,Y,J){let X=J?{directory:`${J.outputDir}/../.cache`}:{};return $3(X).set($,Z,Y)}async function r8(){return $3().clear()}var sK,Q4=null;var Z3=S(()=>{e7();sK={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as rK,basename as aK,extname as tK,join as eK}from"path";import{mkdir as $W}from"fs/promises";async function Y3(){try{return await import("ts-images")}catch{return null}}function a8($){switch($){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function ZW($,Z){let Y=Z?a8(Z):a8("web"),J=$.formatQuality||{};return{jpeg:{...Y.jpeg,...J.jpeg},png:{...Y.png,...J.png},webp:{...Y.webp,...J.webp},avif:{...Y.avif,...J.avif}}}async function t8($,Z,Y){let J=await Y3();if(!J)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let X=await K4($,Z,Y);if(X)return X;try{let Q=rK($);if(!await D0(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=ZW(Y,Z.preset),K=Y.outputDir||"dist/images",W=Y.baseUrl||"/images";await $W(K,{recursive:!0});let z=await b0(Q),q=aK($,tK($)),U=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],j={src:$,processed:!0,variants:[],hash:z},_=null;if(Z.transformations&&Z.transformations.length>0)_=await J3(Q,Z.transformations,J);for(let B of U){let H=G[B]||{},L=`${q}-${z}.${B}`,V=eK(K,L);try{let O=await J.optimizeImage({input:_||Q,output:V,format:B,quality:H.quality,progressive:H.progressive});if(O){if(j.variants.push({path:V,url:`${W}/${L}`,width:O.width||0,height:O.height||0,format:B,size:O.outputSize||0}),!j.originalWidth&&O.width)j.originalWidth=O.width,j.originalHeight=O.height}}catch(O){j.errors=j.errors||[],j.errors.push(`Failed to optimize ${B}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let B=await J.generateThumbHash(Q);j.placeholder=B.dataUrl}catch(B){j.errors=j.errors||[],j.errors.push(`Failed to generate thumbhash: ${B}`)}if(Z.useDominantColor)try{let B=await J.generatePlaceholder(Q,{strategy:"dominant-color"});j.dominantColor=B.dominantColor}catch(B){j.errors=j.errors||[],j.errors.push(`Failed to extract dominant color: ${B}`)}return await W4($,Z,j,Y),j}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function e8($,Z,Y,J){let X=await Y3();if(!X)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await X.optimizeImage({input:$,output:J,format:Z,quality:Y}))?.outputSize}}catch(Q){return{success:!1,error:String(Q)}}}async function J3($,Z,Y){let J=Y||await Y3();if(!J)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let X=await J.decode($);for(let Q of Z){let G=Q.options||{};switch(Q.type){case"resize":if(G.width||G.height)X=await J.resize(X,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)X=await J.blur(X,G.sigma);break;case"sharpen":if(G.amount!==void 0)X=await J.sharpen(X,G.amount);break;case"grayscale":X=await J.grayscale(X);break;case"rotate":if(G.angle!==void 0)X=await J.rotate(X,G.angle);break;case"flip":X=await J.flip(X);break;case"flop":X=await J.flop(X);break;case"brightness":if(G.value!==void 0)X=await J.brightness(X,G.value);break;case"contrast":if(G.value!==void 0)X=await J.contrast(X,G.value);break;case"saturation":if(G.value!==void 0)X=await J.saturation(X,G.value);break}}return await J.encode(X,"png")}catch(X){return console.error(`[stx-media] Transformation failed: ${X}`),null}}var $Z=S(()=>{m1();Z3()});import{resolve as YW,basename as JW,extname as XW,join as QW}from"path";import{mkdir as GW}from"fs/promises";async function KW(){try{return await import("ts-images")}catch{return null}}async function ZZ($,Z,Y){let J=await KW();if(!J)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let X=YW($);if(!await D0(X))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let Q=Z.responsiveWidths||Y.breakpoints||WW,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",W=Y.baseUrl||"/images";await GW(K,{recursive:!0});let z=await b0(X),q=JW($,XW($)),U=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},j={src:$,byFormat:{},srcsets:{}};for(let B of G){j.byFormat[B]=[];let H=[];for(let L of Q){let V=`${q}-${L}w-${z}.${B}`,O=QW(K,V),F=`${W}/${V}`;try{let w=U[B]?.quality||80;if(await D0(O)){j.byFormat[B].push({path:O,url:F,width:L,height:0,format:B,size:0}),H.push(`${F} ${L}w`);continue}let A=await J.processImage({input:X,output:O,format:B,quality:w,resize:{width:L}});if(A)j.byFormat[B].push({path:O,url:F,width:L,height:A.height||Math.round(L*(A.height||1)/(A.width||1)),format:B,size:A.outputSize||0}),H.push(`${F} ${L}w`)}catch(w){console.warn(`[stx-media] Failed to generate ${B} at ${L}w: ${w}`)}}j.srcsets[B]=H.join(", ")}let _=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(_!=="none")try{if(_==="thumbhash"){let B=await J.generateThumbHash(X);j.placeholder={dataURL:B.dataUrl,width:B.width||32,height:B.height||32,strategy:"thumbhash"}}else{let B=await J.generatePlaceholder(X,{strategy:_,width:20});j.placeholder={dataURL:B.dataURL,width:B.width,height:B.height,strategy:_}}}catch(B){console.warn(`[stx-media] Failed to generate placeholder: ${B}`)}return j.sizes=Z.sizes||zW(Q),j}catch(Q){return console.error(`[stx-media] Responsive generation failed: ${Q}`),null}}function zW($){let Z=[...$].sort((J,X)=>J-X),Y=[];for(let J=0;J<Z.length-1;J++){let X=Z[J];Y.push(`(max-width: ${X}px) ${X}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function YZ($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return $.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}var WW;var JZ=S(()=>{m1();WW=[320,480,640,768,1024,1280,1536,1920]});var XZ={};a(XZ,{setCachedImageResult:()=>W4,processImage:()=>t8,optimizeImage:()=>e8,getCachedImageResult:()=>K4,generateSrcset:()=>YZ,generateResponsiveVariants:()=>ZZ,clearImageCache:()=>r8,applyTransformations:()=>J3,ImageProcessorCache:()=>G4});var QZ=S(()=>{$Z();JZ();Z3()});async function qW(){try{return await Promise.resolve().then(() => (QZ(),XZ))}catch($){if(!GZ)console.warn("[stx-media] Image processor not available, some features disabled:",$),GZ=!0;return null}}async function z4($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return BW(J,Y)}if(Y.processedResult?.processed)return K3($,Y.processedResult,Z);if(Y.responsiveVariants)return qZ($,Y.responsiveVariants,Z);let{src:X,alt:Q,width:G,height:K,sizes:W,widths:z=U5,dpr:q,formats:U=e5,quality:j=X3,params:_={},placeholder:B="none",placeholderOptions:H={},lazy:L=!0,priority:V=!1,loading:O=V?"eager":U4,decoding:F=q4,fetchpriority:w,objectFit:A,objectPosition:R,crossorigin:N,referrerpolicy:M}=$,T=$.class,I=$.style,E=$.id,D=$.data||{},{isDev:y=!1,baseUrl:b=""}=Z;if(y&&!Z.optimize)return _W($);let k,v,g=E||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!V)try{k=await u8(X,{strategy:B,...H}),v=m8(g,k,H)}catch{}let f=q!==void 0&&G!==void 0,d;if(f)d=jW($,g,k,Z);else d=await UW($,g,k,Z);let p;if(V){let V0=U.includes("webp")?"webp":U[0],r=c7(X,z,{..._,q:j},V0),Q0=typeof W==="object"?i7(W):W||"100vw";p=`<link rel="preload" as="image" imagesrcset="${r}" imagesizes="${Q0}" />`}let X0=[];if(!KZ&&B!=="none")X0.push(r7),KZ=!0;if(v)X0.push(v);let Z0=L?zZ(g):void 0;return{html:d,preloadLink:p,css:X0.length>0?X0.join(`
|
|
7470
|
+
`.trim();s7=new Map});import{createHash as c8}from"crypto";import{readFile as mK,stat as i8}from"fs/promises";async function b0($){try{let Z=await mK($);return c8("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function l8($){return c8("sha256").update($).digest("hex").slice(0,16)}function Z4($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${l8($)}-${l8(Y)}`}async function a7($){try{return(await i8($)).mtimeMs}catch{return 0}}async function D0($){try{return await i8($),!0}catch{return!1}}var u1=()=>{};import{mkdir as pK,readFile as lK,writeFile as cK,readdir as FO,rm as iK,stat as VO}from"fs/promises";import{join as o8,dirname as nK}from"path";async function oK($){try{await pK($,{recursive:!0})}catch{}}function s8($,Z,Y){return o8($,Y,`${Z}.json`)}async function n8($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await a7(Z)!==$.srcMtime)return!1;return!0}async function Y4($,Z,Y,J=t7){if(!J.enabled)return null;let X=Z4($,Z),Q=j5.get(X);if(Q){if(await n8(Q,$,J.maxAge))return Q.lastAccessedAt=Date.now(),Q.data;j5.delete(X)}let G=s8(J.directory,X,Y);if(await D0(G))try{let K=await lK(G,"utf-8"),W=JSON.parse(K);if(await n8(W,$,J.maxAge))return W.lastAccessedAt=Date.now(),j5.set(X,W),W.data}catch{}return null}async function J4($,Z,Y,J,X=t7){if(!X.enabled)return;let Q=Z4($,Z),G=await b0($),K=await a7($),W={key:Q,src:$,srcHash:G,srcMtime:K,optionsHash:Z4("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};j5.set(Q,W);let z=s8(X.directory,Q,J);try{await oK(nK(z)),await cK(z,JSON.stringify(W,null,2))}catch(q){console.warn(`[stx-media] Failed to write cache: ${q}`)}}async function X4($,Z=t7){if($==="all")j5.clear();else j5.clear();let Y=$==="all"?["image","video"]:[$];for(let J of Y){let X=o8(Z.directory,J);try{await iK(X,{recursive:!0,force:!0})}catch{}}}var j5,t7;var e7=S(()=>{u1();j5=new Map,t7={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class G4{config;constructor($={}){this.config={...sK,...$}}async get($,Z){return Y4($,Z,"image",this.config)}async set($,Z,Y){return J4($,Z,Y,"image",this.config)}async clear(){return X4("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function $3($){if(!Q4)Q4=new G4($);else if($)Q4.updateConfig($);return Q4}async function K4($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return $3(J).get($,Z)}async function W4($,Z,Y,J){let X=J?{directory:`${J.outputDir}/../.cache`}:{};return $3(X).set($,Z,Y)}async function r8(){return $3().clear()}var sK,Q4=null;var Z3=S(()=>{e7();sK={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as rK,basename as aK,extname as tK,join as eK}from"path";import{mkdir as $W}from"fs/promises";async function Y3(){try{return await import("ts-images")}catch{return null}}function a8($){switch($){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function ZW($,Z){let Y=Z?a8(Z):a8("web"),J=$.formatQuality||{};return{jpeg:{...Y.jpeg,...J.jpeg},png:{...Y.png,...J.png},webp:{...Y.webp,...J.webp},avif:{...Y.avif,...J.avif}}}async function t8($,Z,Y){let J=await Y3();if(!J)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let X=await K4($,Z,Y);if(X)return X;try{let Q=rK($);if(!await D0(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=ZW(Y,Z.preset),K=Y.outputDir||"dist/images",W=Y.baseUrl||"/images";await $W(K,{recursive:!0});let z=await b0(Q),q=aK($,tK($)),U=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],j={src:$,processed:!0,variants:[],hash:z},_=null;if(Z.transformations&&Z.transformations.length>0)_=await J3(Q,Z.transformations,J);for(let B of U){let H=G[B]||{},L=`${q}-${z}.${B}`,V=eK(K,L);try{let O=await J.optimizeImage({input:_||Q,output:V,format:B,quality:H.quality,progressive:H.progressive});if(O){if(j.variants.push({path:V,url:`${W}/${L}`,width:O.width||0,height:O.height||0,format:B,size:O.outputSize||0}),!j.originalWidth&&O.width)j.originalWidth=O.width,j.originalHeight=O.height}}catch(O){j.errors=j.errors||[],j.errors.push(`Failed to optimize ${B}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let B=await J.generateThumbHash(Q);j.placeholder=B.dataUrl}catch(B){j.errors=j.errors||[],j.errors.push(`Failed to generate thumbhash: ${B}`)}if(Z.useDominantColor)try{let B=await J.generatePlaceholder(Q,{strategy:"dominant-color"});j.dominantColor=B.dominantColor}catch(B){j.errors=j.errors||[],j.errors.push(`Failed to extract dominant color: ${B}`)}return await W4($,Z,j,Y),j}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function e8($,Z,Y,J){let X=await Y3();if(!X)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await X.optimizeImage({input:$,output:J,format:Z,quality:Y}))?.outputSize}}catch(Q){return{success:!1,error:String(Q)}}}async function J3($,Z,Y){let J=Y||await Y3();if(!J)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let X=await J.decode($);for(let Q of Z){let G=Q.options||{};switch(Q.type){case"resize":if(G.width||G.height)X=await J.resize(X,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)X=await J.blur(X,G.sigma);break;case"sharpen":if(G.amount!==void 0)X=await J.sharpen(X,G.amount);break;case"grayscale":X=await J.grayscale(X);break;case"rotate":if(G.angle!==void 0)X=await J.rotate(X,G.angle);break;case"flip":X=await J.flip(X);break;case"flop":X=await J.flop(X);break;case"brightness":if(G.value!==void 0)X=await J.brightness(X,G.value);break;case"contrast":if(G.value!==void 0)X=await J.contrast(X,G.value);break;case"saturation":if(G.value!==void 0)X=await J.saturation(X,G.value);break}}return await J.encode(X,"png")}catch(X){return console.error(`[stx-media] Transformation failed: ${X}`),null}}var $Z=S(()=>{u1();Z3()});import{resolve as YW,basename as JW,extname as XW,join as QW}from"path";import{mkdir as GW}from"fs/promises";async function KW(){try{return await import("ts-images")}catch{return null}}async function ZZ($,Z,Y){let J=await KW();if(!J)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let X=YW($);if(!await D0(X))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let Q=Z.responsiveWidths||Y.breakpoints||WW,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",W=Y.baseUrl||"/images";await GW(K,{recursive:!0});let z=await b0(X),q=JW($,XW($)),U=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},j={src:$,byFormat:{},srcsets:{}};for(let B of G){j.byFormat[B]=[];let H=[];for(let L of Q){let V=`${q}-${L}w-${z}.${B}`,O=QW(K,V),F=`${W}/${V}`;try{let w=U[B]?.quality||80;if(await D0(O)){j.byFormat[B].push({path:O,url:F,width:L,height:0,format:B,size:0}),H.push(`${F} ${L}w`);continue}let A=await J.processImage({input:X,output:O,format:B,quality:w,resize:{width:L}});if(A)j.byFormat[B].push({path:O,url:F,width:L,height:A.height||Math.round(L*(A.height||1)/(A.width||1)),format:B,size:A.outputSize||0}),H.push(`${F} ${L}w`)}catch(w){console.warn(`[stx-media] Failed to generate ${B} at ${L}w: ${w}`)}}j.srcsets[B]=H.join(", ")}let _=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(_!=="none")try{if(_==="thumbhash"){let B=await J.generateThumbHash(X);j.placeholder={dataURL:B.dataUrl,width:B.width||32,height:B.height||32,strategy:"thumbhash"}}else{let B=await J.generatePlaceholder(X,{strategy:_,width:20});j.placeholder={dataURL:B.dataURL,width:B.width,height:B.height,strategy:_}}}catch(B){console.warn(`[stx-media] Failed to generate placeholder: ${B}`)}return j.sizes=Z.sizes||zW(Q),j}catch(Q){return console.error(`[stx-media] Responsive generation failed: ${Q}`),null}}function zW($){let Z=[...$].sort((J,X)=>J-X),Y=[];for(let J=0;J<Z.length-1;J++){let X=Z[J];Y.push(`(max-width: ${X}px) ${X}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function YZ($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return $.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}var WW;var JZ=S(()=>{u1();WW=[320,480,640,768,1024,1280,1536,1920]});var XZ={};a(XZ,{setCachedImageResult:()=>W4,processImage:()=>t8,optimizeImage:()=>e8,getCachedImageResult:()=>K4,generateSrcset:()=>YZ,generateResponsiveVariants:()=>ZZ,clearImageCache:()=>r8,applyTransformations:()=>J3,ImageProcessorCache:()=>G4});var QZ=S(()=>{$Z();JZ();Z3()});async function qW(){try{return await Promise.resolve().then(() => (QZ(),XZ))}catch($){if(!GZ)console.warn("[stx-media] Image processor not available, some features disabled:",$),GZ=!0;return null}}async function z4($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return BW(J,Y)}if(Y.processedResult?.processed)return K3($,Y.processedResult,Z);if(Y.responsiveVariants)return qZ($,Y.responsiveVariants,Z);let{src:X,alt:Q,width:G,height:K,sizes:W,widths:z=U5,dpr:q,formats:U=e5,quality:j=X3,params:_={},placeholder:B="none",placeholderOptions:H={},lazy:L=!0,priority:V=!1,loading:O=V?"eager":U4,decoding:F=q4,fetchpriority:w,objectFit:A,objectPosition:R,crossorigin:N,referrerpolicy:M}=$,T=$.class,I=$.style,E=$.id,D=$.data||{},{isDev:y=!1,baseUrl:b=""}=Z;if(y&&!Z.optimize)return _W($);let k,v,g=E||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!V)try{k=await m8(X,{strategy:B,...H}),v=u8(g,k,H)}catch{}let f=q!==void 0&&G!==void 0,d;if(f)d=jW($,g,k,Z);else d=await UW($,g,k,Z);let p;if(V){let V0=U.includes("webp")?"webp":U[0],r=c7(X,z,{..._,q:j},V0),Q0=typeof W==="object"?i7(W):W||"100vw";p=`<link rel="preload" as="image" imagesrcset="${r}" imagesizes="${Q0}" />`}let X0=[];if(!KZ&&B!=="none")X0.push(r7),KZ=!0;if(v)X0.push(v);let Z0=L?zZ(g):void 0;return{html:d,preloadLink:p,css:X0.length>0?X0.join(`
|
|
7468
7471
|
`):void 0,script:Z0}}async function UW($,Z,Y,J){let{src:X,alt:Q,width:G,height:K,sizes:W,widths:z=U5,formats:q=e5,quality:U=X3,params:j={},lazy:_=!0,priority:B=!1,loading:H=B?"eager":U4,decoding:L=q4,fetchpriority:V,objectFit:O,objectPosition:F,crossorigin:w,referrerpolicy:A}=$,R=$.class,N=$.style,M=$.data||{},T=typeof W==="object"?i7(W):W||"100vw",I=[];for(let y of q){let b=c7(X,z,{...j,q:U},y),k=n7(y);if(_&&!B)I.push(` <source type="${k}" data-srcset="${b}" data-sizes="${T}" />`);else I.push(` <source type="${k}" srcset="${b}" sizes="${T}" />`)}let E=Q3({src:$$(X,{...j,q:U}),alt:Q,width:G,height:K,loading:B?void 0:H,decoding:L,fetchpriority:B?"high":V,objectFit:O,objectPosition:F,crossorigin:w,referrerpolicy:A,className:WZ(R,Y),style:G3(N,O,F,Y),lazy:_&&!B,data:M}),D;if(Y){let y=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;D=`<div id="${Z}" class="stx-img-placeholder" style="${y}">
|
|
7469
7472
|
<picture>
|
|
7470
7473
|
${I.join(`
|
|
@@ -7528,8 +7531,8 @@ ${A.join(`
|
|
|
7528
7531
|
`):void 0,script:b}}async function qZ($,Z,Y){let J={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[X,Q]of Object.entries(Z.byFormat))if(Q)J.variants.push(...Q);return K3($,J,Y)}var GZ=!1,X3=80,q4="async",U4="lazy",KZ=!1;var UZ=S(()=>{o7();p8()});function HW(){return $4({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,Y,J)=>{let{src:X,alt:Q,options:G}=OW($,Z,Y);if(!X)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:X,alt:Q||"",widths:G.widths||U5,formats:G.formats||e5,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},W=Y.__isDev||!1,z=await z4(K,{isDev:W}),q=z.html;if(z.preloadLink)q=z.preloadLink+`
|
|
7529
7532
|
`+q;if(z.css)q+=`
|
|
7530
7533
|
<style>${z.css}</style>`;if(z.script)q+=`
|
|
7531
|
-
<script>${z.script}</script>`;return q},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function OW($,Z,Y){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let J=$.trim();if(J.startsWith("@img(")||J.startsWith("("))J=J.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let X=LW(J),Q=W3(X[0],Y)||"",G=W3(X[1],Y)||"",K={};if(X[2]){let W=W3(X[2],Y);if(typeof W==="object"&&W!==null)K=W;else if(typeof X[2]==="string")try{K=JSON.parse(X[2])}catch{}}return{src:Q,alt:G,options:K}}function LW($){let Z=[],Y="",J=!1,X="",Q=0,G=0;for(let K=0;K<$.length;K++){let W=$[K],z=K>0?$[K-1]:"";if((W==='"'||W==="'"||W==="`")&&z!=="\\"){if(!J)J=!0,X=W;else if(W===X)J=!1,X="";else Y+=W;continue}if(!J){if(W==="{")Q++;if(W==="}")Q--;if(W==="[")G++;if(W==="]")G--;if(W===","&&Q===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=W}if(Y.trim())Z.push(Y.trim());return Z}function W3($,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 J=Z[Y];if(J!==void 0)return J}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var jZ;var _Z=S(()=>{l7();UZ();o7();jZ=HW()});class _4{config;constructor($={}){this.config={...FW,...$}}async get($,Z){return Y4($,Z,"video",this.config)}async set($,Z,Y){return J4($,Z,Y,"video",this.config)}async clear(){return X4("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function z3($){if(!j4)j4=new _4($);else if($)j4.updateConfig($);return j4}async function B4($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return z3(J).get($,Z)}async function H4($,Z,Y,J){let X=J?{directory:`${J.outputDir}/../.cache`}:{};return z3(X).set($,Z,Y)}async function BZ(){return z3().clear()}var FW,j4=null;var q3=S(()=>{e7();FW={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as U3,basename as j3,extname as _3,join as O4}from"path";import{mkdir as B3}from"fs/promises";async function H3(){try{return await import("ts-videos")}catch{return null}}async function L4($,Z,Y,J){let X=await H3();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let Q=U3($);if(!await D0(Q))return null;await B3(Y,{recursive:!0});let G=await b0(Q),K=j3($,_3($)),W=Z.format||"webp",z=Z.timestamp||0,q=`${K}-poster-${G}.${W}`,U=O4(Y,q),j=await X.extractThumbnails(Q,{timestamps:[z],width:Z.width||1280,height:Z.height,format:W,quality:Z.quality||85,outputDir:Y,outputPattern:q.replace(`.${W}`,"")});if(j&&j.length>0){let _=j[0];return{path:U,url:`${J}/${q}`,width:_.width||Z.width||1280,height:_.height||720,timestamp:z,size:_.size||0}}return null}catch(Q){return console.warn(`[stx-media] Failed to generate poster: ${Q}`),null}}async function F4($,Z,Y,J){let X=await H3();if(!X)return[];try{let Q=U3($);if(!await D0(Q))return[];await B3(Y,{recursive:!0});let G=await b0(Q),K=j3($,_3($)),W=Z.format||"webp",U=(await new X.Input(Q).getInfo()).duration||60,j=Z.count||10,_=Z.interval||U/j,B=[];for(let L=0;L<j&&L*_<U;L++)B.push(L*_);let H=await X.extractThumbnails(Q,{timestamps:B,width:Z.width||320,format:W,quality:Z.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${G}`});if(H&&H.length>0)return H.map((L,V)=>({path:L.path||O4(Y,`${K}-thumb-${G}-${V}.${W}`),url:`${J}/${K}-thumb-${G}-${V}.${W}`,width:L.width||Z.width||320,height:L.height||180,timestamp:B[V],size:L.size||0}));return[]}catch(Q){return console.warn(`[stx-media] Failed to generate thumbnails: ${Q}`),[]}}async function HZ($,Z,Y,J){let X=await H3();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let Q=U3($);if(!await D0(Q))return null;await B3(Y,{recursive:!0});let G=await b0(Q),K=j3($,_3($)),q=(await new X.Input(Q).getInfo()).duration||60,U=Z.columns||10,j=Z.interval||5,_=Z.thumbnailWidth||160,B=Z.thumbnailHeight||90,H=Z.format||"jpeg",L=Math.ceil(q/j),V=Math.ceil(L/U),O=`${K}-sprite-${G}.${H}`,F=O4(Y,O),w=[];for(let R=0;R<L;R++)w.push(R*j);let A=await X.extractThumbnails(Q,{timestamps:w,width:_,height:B,format:H,quality:Z.quality||70,outputDir:O4(Y,".temp")});if(!A||A.length===0)return null;try{let R=await import("ts-images"),N=U*_,M=V*B,T=await R.createSprite({images:A.map((I)=>I.path),columns:U,padding:0,outputPath:F,format:H,quality:Z.quality||70});return{url:`${J}/${O}`,path:F,columns:U,rows:V,thumbnailWidth:_,thumbnailHeight:B,interval:j,totalFrames:L}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(Q){return console.warn(`[stx-media] Failed to generate sprite sheet: ${Q}`),null}}var O3=S(()=>{
|
|
7532
|
-
`)}async function A4($,Z,Y,J,X){let Q=await AZ();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=LZ($);if(!await D0(G))return null;let K=await b0(G),W=FZ($,VZ($)),z=
|
|
7534
|
+
<script>${z.script}</script>`;return q},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function OW($,Z,Y){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let J=$.trim();if(J.startsWith("@img(")||J.startsWith("("))J=J.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let X=LW(J),Q=W3(X[0],Y)||"",G=W3(X[1],Y)||"",K={};if(X[2]){let W=W3(X[2],Y);if(typeof W==="object"&&W!==null)K=W;else if(typeof X[2]==="string")try{K=JSON.parse(X[2])}catch{}}return{src:Q,alt:G,options:K}}function LW($){let Z=[],Y="",J=!1,X="",Q=0,G=0;for(let K=0;K<$.length;K++){let W=$[K],z=K>0?$[K-1]:"";if((W==='"'||W==="'"||W==="`")&&z!=="\\"){if(!J)J=!0,X=W;else if(W===X)J=!1,X="";else Y+=W;continue}if(!J){if(W==="{")Q++;if(W==="}")Q--;if(W==="[")G++;if(W==="]")G--;if(W===","&&Q===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=W}if(Y.trim())Z.push(Y.trim());return Z}function W3($,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 J=Z[Y];if(J!==void 0)return J}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var jZ;var _Z=S(()=>{l7();UZ();o7();jZ=HW()});class _4{config;constructor($={}){this.config={...FW,...$}}async get($,Z){return Y4($,Z,"video",this.config)}async set($,Z,Y){return J4($,Z,Y,"video",this.config)}async clear(){return X4("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function z3($){if(!j4)j4=new _4($);else if($)j4.updateConfig($);return j4}async function B4($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return z3(J).get($,Z)}async function H4($,Z,Y,J){let X=J?{directory:`${J.outputDir}/../.cache`}:{};return z3(X).set($,Z,Y)}async function BZ(){return z3().clear()}var FW,j4=null;var q3=S(()=>{e7();FW={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as U3,basename as j3,extname as _3,join as O4}from"path";import{mkdir as B3}from"fs/promises";async function H3(){try{return await import("ts-videos")}catch{return null}}async function L4($,Z,Y,J){let X=await H3();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let Q=U3($);if(!await D0(Q))return null;await B3(Y,{recursive:!0});let G=await b0(Q),K=j3($,_3($)),W=Z.format||"webp",z=Z.timestamp||0,q=`${K}-poster-${G}.${W}`,U=O4(Y,q),j=await X.extractThumbnails(Q,{timestamps:[z],width:Z.width||1280,height:Z.height,format:W,quality:Z.quality||85,outputDir:Y,outputPattern:q.replace(`.${W}`,"")});if(j&&j.length>0){let _=j[0];return{path:U,url:`${J}/${q}`,width:_.width||Z.width||1280,height:_.height||720,timestamp:z,size:_.size||0}}return null}catch(Q){return console.warn(`[stx-media] Failed to generate poster: ${Q}`),null}}async function F4($,Z,Y,J){let X=await H3();if(!X)return[];try{let Q=U3($);if(!await D0(Q))return[];await B3(Y,{recursive:!0});let G=await b0(Q),K=j3($,_3($)),W=Z.format||"webp",U=(await new X.Input(Q).getInfo()).duration||60,j=Z.count||10,_=Z.interval||U/j,B=[];for(let L=0;L<j&&L*_<U;L++)B.push(L*_);let H=await X.extractThumbnails(Q,{timestamps:B,width:Z.width||320,format:W,quality:Z.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${G}`});if(H&&H.length>0)return H.map((L,V)=>({path:L.path||O4(Y,`${K}-thumb-${G}-${V}.${W}`),url:`${J}/${K}-thumb-${G}-${V}.${W}`,width:L.width||Z.width||320,height:L.height||180,timestamp:B[V],size:L.size||0}));return[]}catch(Q){return console.warn(`[stx-media] Failed to generate thumbnails: ${Q}`),[]}}async function HZ($,Z,Y,J){let X=await H3();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let Q=U3($);if(!await D0(Q))return null;await B3(Y,{recursive:!0});let G=await b0(Q),K=j3($,_3($)),q=(await new X.Input(Q).getInfo()).duration||60,U=Z.columns||10,j=Z.interval||5,_=Z.thumbnailWidth||160,B=Z.thumbnailHeight||90,H=Z.format||"jpeg",L=Math.ceil(q/j),V=Math.ceil(L/U),O=`${K}-sprite-${G}.${H}`,F=O4(Y,O),w=[];for(let R=0;R<L;R++)w.push(R*j);let A=await X.extractThumbnails(Q,{timestamps:w,width:_,height:B,format:H,quality:Z.quality||70,outputDir:O4(Y,".temp")});if(!A||A.length===0)return null;try{let R=await import("ts-images"),N=U*_,M=V*B,T=await R.createSprite({images:A.map((I)=>I.path),columns:U,padding:0,outputPath:F,format:H,quality:Z.quality||70});return{url:`${J}/${O}`,path:F,columns:U,rows:V,thumbnailWidth:_,thumbnailHeight:B,interval:j,totalFrames:L}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(Q){return console.warn(`[stx-media] Failed to generate sprite sheet: ${Q}`),null}}var O3=S(()=>{u1()});import{resolve as LZ,basename as FZ,extname as VZ,join as m1}from"path";import{mkdir as V4,writeFile as wZ}from"fs/promises";async function AZ(){try{return await import("ts-videos")}catch{return null}}async function w4($,Z,Y,J,X){let Q=await AZ();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=LZ($);if(!await D0(G))return null;let K=await b0(G),W=FZ($,VZ($)),z=m1(Y,`${W}-${K}-hls`);await V4(z,{recursive:!0});let q=Z.length>0?Z:RZ,U=X?.segmentDuration||6,B=(await new Q.Input(G).getInfo()).duration||0,H=[],L=0;for(let F of q){let w=m1(z,F.label);await V4(w,{recursive:!0});let A=`${F.label}.m3u8`,R=m1(w,A);try{let N=await Q.generateHLS(G,{outputDir:w,segmentDuration:U,width:F.width,height:F.height,videoBitrate:F.bitrate,audioBitrate:F.audioBitrate,playlistName:F.label});if(N)H.push({quality:F,url:`${J}/${W}-${K}-hls/${F.label}/${A}`,path:R}),L+=N.segmentCount||Math.ceil(B/U)}catch(N){console.warn(`[stx-media] Failed to generate HLS for ${F.label}: ${N}`)}}if(H.length===0)return null;let V=m1(z,"master.m3u8"),O=VW(H,J,W,K);return await wZ(V,O),{manifestUrl:`${J}/${W}-${K}-hls/master.m3u8`,manifestPath:V,playlists:H,segmentCount:L,duration:B}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function VW($,Z,Y,J){let X=["#EXTM3U","#EXT-X-VERSION:3"];for(let Q of $){let{quality:G}=Q,K=G.bitrate+(G.audioBitrate||128000),W=`${G.width}x${G.height||Math.round(G.width*9/16)}`;X.push(`#EXT-X-STREAM-INF:BANDWIDTH=${K},RESOLUTION=${W},NAME="${G.label}"`,`${G.label}/${G.label}.m3u8`)}return X.join(`
|
|
7535
|
+
`)}async function A4($,Z,Y,J,X){let Q=await AZ();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=LZ($);if(!await D0(G))return null;let K=await b0(G),W=FZ($,VZ($)),z=m1(Y,`${W}-${K}-dash`);await V4(z,{recursive:!0});let q=Z.length>0?Z:RZ,U=X?.segmentDuration||4,j=X?.minBufferTime||2,H=(await new Q.Input(G).getInfo()).duration||0,L=[],V=[];for(let A of q){let R=m1(z,A.label);await V4(R,{recursive:!0});try{if(await Q.generateDASH(G,{outputDir:R,segmentDuration:U,width:A.width,height:A.height,videoBitrate:A.bitrate,audioBitrate:A.audioBitrate})){if(L.push({bandwidth:A.bitrate,width:A.width,height:A.height||Math.round(A.width*9/16),url:`${J}/${W}-${K}-dash/${A.label}/video`}),A.audioBitrate)V.push({bandwidth:A.audioBitrate,url:`${J}/${W}-${K}-dash/${A.label}/audio`})}}catch(N){console.warn(`[stx-media] Failed to generate DASH for ${A.label}: ${N}`)}}if(L.length===0)return null;let O=m1(z,"manifest.mpd"),F=wW(L,V,H,U,j);await wZ(O,F);let w=[{type:"video",representations:L}];if(V.length>0)w.push({type:"audio",representations:V});return{manifestUrl:`${J}/${W}-${K}-dash/manifest.mpd`,manifestPath:O,adaptationSets:w,duration:H}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function wW($,Z,Y,J,X){let Q=OZ(Y),G=OZ(X),K=`<?xml version="1.0" encoding="UTF-8"?>
|
|
7533
7536
|
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
|
|
7534
7537
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
7535
7538
|
xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
|
|
@@ -7555,7 +7558,7 @@ ${A.join(`
|
|
|
7555
7558
|
</Representation>
|
|
7556
7559
|
`}K+=` </AdaptationSet>
|
|
7557
7560
|
`}return K+=` </Period>
|
|
7558
|
-
</MPD>`,K}function OZ($){let Z=Math.floor($/3600),Y=Math.floor($%3600/60),J=Math.floor($%60),X="PT";if(Z>0)X+=`${Z}H`;if(Y>0)X+=`${Y}M`;return X+=`${J}S`,X}var RZ;var L3=S(()=>{
|
|
7561
|
+
</MPD>`,K}function OZ($){let Z=Math.floor($/3600),Y=Math.floor($%3600/60),J=Math.floor($%60),X="PT";if(Z>0)X+=`${Z}H`;if(Y>0)X+=`${Y}M`;return X+=`${J}S`,X}var RZ;var L3=S(()=>{u1();RZ=[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000},{label:"360p",width:640,height:360,bitrate:600000,audioBitrate:64000}]});import{resolve as NZ,basename as AW,extname as RW,join as NW}from"path";import{mkdir as MW}from"fs/promises";async function MZ(){try{return await import("ts-videos")}catch{return null}}function TW($){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 IW($){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 F3($){let Z=await MZ();if(!Z)return null;try{let Y=NZ($),X=await new Z.Input(Y).getInfo();return{duration:X.duration||0,width:X.width||0,height:X.height||0,frameRate:X.frameRate||0,bitrate:X.bitrate||0,codec:X.videoCodec||"",audioCodec:X.audioCodec}}catch(Y){return console.warn(`[stx-media] Failed to analyze video: ${Y}`),null}}async function TZ($,Z,Y,J){let X=await MZ();if(!X)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let Q=await B4($,Z,Y);if(Q)return Q;try{let G=NZ($);if(!await D0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",W=Y.baseUrl||"/videos";await MW(K,{recursive:!0});let z=await b0(G),q=AW($,RW($)),U={src:$,processed:!0,hash:z};J?.({percentage:5,stage:"analyzing"}),U.metadata=await F3(G)||void 0;let j={};if(Z.quality)j.bitrate=TW(Z.quality);if(Z.platform)Object.assign(j,IW(Z.platform));if(Z.transcode)Object.assign(j,Z.transcode);if(Object.keys(j).length>0||Z.process){J?.({percentage:10,stage:"transcoding"});let _=`${q}-${z}.mp4`,B=NW(K,_);try{let H=await DW(G,B,j,X,(L)=>J?.({percentage:10+L*0.5,stage:"transcoding"}));if(H)U.transcoded={path:B,url:`${W}/${_}`,duration:H.duration,size:H.size,video:{codec:j.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:j.audioCodec||"aac",bitrate:j.audioBitrate||128000,sampleRate:j.sampleRate||48000,channels:j.channels||2}:void 0}}catch(H){U.errors=U.errors||[],U.errors.push(`Transcoding failed: ${H}`)}}if(Z.generatePoster){J?.({percentage:65,stage:"generating-poster"});let _=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},B=await L4(G,_,K,W);if(B)U.poster=B}if(Y.thumbnails?.enabled){J?.({percentage:70,stage:"generating-thumbnails"});let _=await F4(G,Y.thumbnails,K,W);if(_.length>0)U.thumbnails=_}if(Z.streaming){J?.({percentage:80,stage:"generating-manifests"});let _=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(_.format==="hls"||_.format===void 0){let B=await w4(G,_.qualities||Y.streaming?.defaultQualities||[],K,W);if(B)U.streaming={...U.streaming,hls:B}}if(_.format==="dash"){let B=await A4(G,_.qualities||Y.streaming?.defaultQualities||[],K,W);if(B)U.streaming={...U.streaming,dash:B}}}if(Z.spriteSheet)J?.({percentage:90,stage:"generating-sprite-sheet"});return J?.({percentage:100,stage:"complete"}),await H4($,Z,U,Y),U}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function DW($,Z,Y,J,X){try{let G=await new J.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)=>{X?.(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(Q){return console.error(`[stx-media] Transcoding failed: ${Q}`),null}}var IZ=S(()=>{u1();q3();O3();L3()});var DZ={};a(DZ,{setCachedVideoResult:()=>H4,processVideo:()=>TZ,getCachedVideoResult:()=>B4,generateThumbnails:()=>F4,generateSpriteSheet:()=>HZ,generatePoster:()=>L4,generateHLSManifest:()=>w4,generateDASHManifest:()=>A4,clearVideoCache:()=>BZ,analyzeVideo:()=>F3,VideoProcessorCache:()=>_4});var EZ=S(()=>{IZ();O3();L3();q3()});async function bZ(){try{return await Promise.resolve().then(() => (EZ(),DZ))}catch($){if(!kZ)console.warn("[stx-media] Video processor not available, some features disabled:",$),kZ=!0;return null}}async function R4($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return PW(J,Y)}if(Y.processedResult?.processed)return CZ($,Y.processedResult,Z);let X;if(J.generatePoster&&J.src&&!$.poster)X=await CW(J,Y);let{src:Q,sources:G=[],poster:K,posterPlaceholder:W,controls:z=SZ,autoplay:q=!1,muted:U=!1,loop:j=!1,preload:_=yZ,playsinline:B=!0,lazy:H=!0,player:L="native",type:V,width:O,height:F,crossorigin:w,disablePictureInPicture:A=!1,disableRemotePlayback:R=!1}=$,N=X||K,M=$.class,T=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(L==="ts-video")return bW($,Z);if(V&&V!=="video")return kW(Q||"",V,$);let E=G.length>0?G:Q?[{src:Q,type:PZ(Q)}]:[],D=[`id="${I}"`];if(z)D.push("controls");if(q)D.push("autoplay");if(U)D.push("muted");if(j)D.push("loop");if(B)D.push("playsinline");if(A)D.push("disablepictureinpicture");if(R)D.push("disableremoteplayback");if(w)D.push(`crossorigin="${w}"`);if(H){if(D.push(`data-preload="${_}"`),D.push('preload="none"'),N)D.push(`data-poster="${A0(N)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${_}"`),N)D.push(`poster="${A0(N)}"`);if(O)D.push(`width="${O}"`);if(F)D.push(`height="${F}"`);if(M)D.push(`class="${A0(M)}"`);if(T)D.push(`style="${A0(T)}"`);let y=E.map((v)=>{return` <source ${H?`data-src="${A0(v.src)}"`:`src="${A0(v.src)}"`} type="${v.type}"${v.media?` media="${v.media}"`:""} />`}).join(`
|
|
7559
7562
|
`),b=`<video ${D.join(" ")}>
|
|
7560
7563
|
${y}
|
|
7561
7564
|
Your browser does not support the video tag.
|
|
@@ -8113,7 +8116,7 @@ catch (error) {
|
|
|
8113
8116
|
init();
|
|
8114
8117
|
}
|
|
8115
8118
|
})();
|
|
8116
|
-
</script>`}var mW,
|
|
8119
|
+
</script>`}var uW,mW,pW,lW,gZ;var hZ=S(()=>{uW={name:"pwa.installButton",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return fW($,X)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},mW={name:"pwa.updatePrompt",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return gW($,X)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},pW={name:"pwa.offlineIndicator",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return hW($,X)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},lW={name:"pwa.pushSubscribe",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return dW($,X)},hasEndTag:!0,description:"Renders a push notification subscription button"},gZ=[uW,mW,pW,lW]});function A3($){for(let[Z,Y]of Object.entries(s))if(Y===$)return Z;return}var s;var N4=S(()=>{s={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 Z$(){return!1}function Y$(){return!Z$()||process.env.STX_DEBUG==="true"}function M4(){return!1}import cW from"path";function T4(){return{...R3}}function I4($){if(!R3.showRelativePaths||!$)return $;let Z=R3.baseDir||process.cwd();try{let Y=cW.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var iW,R3,D4,p1,E4;var k4=S(()=>{N4();iW={showRelativePaths:!1,enableAutoRecovery:Y$(),logRecoveryWarnings:!0},R3={...iW};D4=class D4 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,J,X,Q,G){super($);this.code=Z;this.filePath=Y;this.line=J;this.column=X;this.context=Q;if(this.name="StxError",this.numericCode=G||s.EVALUATION_ERROR,this.filePath)this.filePath=I4(this.filePath)}};p1=class p1 extends D4{constructor($,Z,Y,J,X,Q){super($,"stx_RUNTIME_ERROR",Z,Y,J,X,Q||s.EVALUATION_ERROR);this.name="StxRuntimeError"}};E4=class E4 extends D4{isFatal=!0;constructor($,Z,Y,J,X,Q){super($,"stx_VALIDATION_ERROR",Z,Y,J,X,Q||s.DOM_API_VIOLATION);this.name="StxValidationError"}}});function uZ($){let{type:Z,message:Y,code:J,filePath:X,line:Q,column:G,template:K,offset:W,snippet:z,suggestion:q,format:U="text"}=$,j=Q,_=G;if(!j&&K&&W!==void 0){let O=tW(K,W);j=O.line,_=O.column}let B=X?I4(X):void 0,H=J?A3(J):void 0,L={type:Z,code:J,codeName:H,message:Y,filePath:B,line:j,column:_,snippet:z,suggestion:q,timestamp:new Date().toISOString()},V;switch(U){case"html":V=oW(L);break;case"json":V=JSON.stringify(L,null,2);break;case"console":V=sW(L,K,W);break;case"text":default:V=nW(L,K,W);break}return{formatted:V,data:L}}function nW($,Z,Y){let J=[],X=$.code?` [${$.codeName||$.code}]`:"";if(J.push(`[${$.type} Error${X}]`),$.filePath){let Q=$.filePath;if($.line){if(Q+=`:${$.line}`,$.column)Q+=`:${$.column}`}J.push(`at ${Q}`)}if(J.push(`
|
|
8117
8120
|
${$.message}`),Z&&$.line){let Q=rW(Z,$.line,2);if(Q)J.push(`
|
|
8118
8121
|
${Q}`)}if($.snippet)J.push(`
|
|
8119
8122
|
Snippet: ${$.snippet}`);if($.suggestion)J.push(`
|
|
@@ -8131,7 +8134,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
|
|
|
8131
8134
|
`)}function aW($,Z,Y){let J=$.split(`
|
|
8132
8135
|
`),X=Math.max(0,Z-Y-1),Q=Math.min(J.length-1,Z+Y-1),G="\x1B[90m",K="\x1B[31m",W="\x1B[0m",z=[];for(let q=X;q<=Q;q++){let U=(q+1).toString().padStart(4),j=q===Z-1,_=j?"\x1B[31m>\x1B[0m":" ",B=j?`\x1B[31m${J[q]}\x1B[0m`:`\x1B[90m${J[q]}\x1B[0m`;z.push(`${_}\x1B[90m${U}\x1B[0m | ${B}`)}return z.join(`
|
|
8133
8136
|
`)}function dZ($){return $.replace(/--/g,"- -").replace(/>/g,">")}function tW($,Z){let J=$.substring(0,Z).split(`
|
|
8134
|
-
`);return{line:J.length,column:J[J.length-1].length}}function e($,Z,Y){return
|
|
8137
|
+
`);return{line:J.length,column:J[J.length-1].length}}function e($,Z,Y){return uZ({type:$,message:Z,code:Y,format:"html"}).formatted}async function _5($,Z,Y){try{return await $()}catch(J){if(Y&&J instanceof Error)Y(J);return Z}}var mZ=S(()=>{N4();k4()});class M3{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 J={timestamp:new Date,error:$,context:Z,level:Y};if(this.errors.push(J),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Y))this.writeToFile(J)}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(`
|
|
8135
8138
|
`).slice(1).join(`
|
|
8136
8139
|
`)}`);if($.context)Z.push(` Context: ${JSON.stringify($.context)}`);return Z.join(`
|
|
8137
8140
|
`)}writeToFile($){this.writeQueue=this.writeQueue.then(async()=>{try{let Z=await import("fs"),J=(await import("path")).dirname(this.logFilePath);if(!Z.existsSync(J))Z.mkdirSync(J,{recursive:!0});await this.rotateIfNeeded(Z);let X=`${this.formatEntry($)}
|
|
@@ -8139,7 +8142,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
|
|
|
8139
8142
|
|
|
8140
8143
|
`),"utf-8")}}async flush(){await this.writeQueue}}var N3,t0,T3;var pZ=S(()=>{k4();N3={isEnabled(){return T4().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=T4();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let Y=$,J=[],X=(Y.match(/\{\{/g)||[]).length,Q=(Y.match(/\}\}/g)||[]).length;if(X>Q){let K=X-Q;Y+="}}".repeat(K),J.push(`Added ${K} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let K of G){let W=(Y.match(new RegExp(`@${K}\\b`,"g"))||[]).length,z=(Y.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(W>z){let q=W-z;for(let U=0;U<q;U++)Y+=`
|
|
8141
8144
|
@end${K}`;J.push(`Added ${q} missing @end${K}`)}}if(J.length>0&&Z.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),J.forEach((K)=>console.warn(` - ${K}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Y,fixes:J}},createFallbackContent($,Z){if(Y$())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};t0=new M3,T3={isDevelopment(){return Y$()},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(`
|
|
8142
|
-
`)}}});var lZ=()=>{};var cZ=S(()=>{N4();
|
|
8145
|
+
`)}}});var lZ=()=>{};var cZ=S(()=>{N4();mZ();pZ();lZ();k4()});var W1=S(()=>{cZ()});function iZ($,Z,Y,J){let X=$;X=X.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,W,z)=>{if(!z&&W.includes(":")){let q=W.split(":"),U=W,j=q.length>1?q[1]:"";if(j&&Z[j])z=Z[j];else if(U.startsWith("og:")&&Z.openGraph&&Z.openGraph[q[1]])z=Z.openGraph[q[1]];else z="";return z?`<meta property="${l(U)}" content="${l(z)}">`:""}return z?`<meta name="${l(W)}" content="${l(z)}">`:""});let Q=/@metaTag\s*\(/g,G;while((G=Q.exec(X))!==null){let K=G.index,W=K+G[0].length-1,z=1,q=W+1;while(q<X.length&&z>0){if(X[q]==="(")z++;else if(X[q]===")"){if(z--,z===0)break}q++}if(z!==0)break;let U=X.substring(W+1,q).trim(),j=q+1,_=(()=>{try{let B=T0(U,Z);if(!B)return"";let H="<meta";if(B.name)H+=` name="${l(String(B.name))}"`;if(B.property)H+=` property="${l(String(B.property))}"`;if(B.httpEquiv)H+=` http-equiv="${l(String(B.httpEquiv))}"`;if(B.content)H+=` content="${l(String(B.content))}"`;return H+=">",H}catch(B){let H=B instanceof Error?B.message:String(B);return e("MetaTag",H,s.EVALUATION_ERROR)}})();X=X.substring(0,K)+_+X.substring(j),Q.lastIndex=0}return X}function nZ($,Z,Y){let J=$,X=/@structuredData\s*\(/g,Q;while((Q=X.exec(J))!==null){let G=Q.index,K=G+Q[0].length-1,W=1,z=K+1;while(z<J.length&&W>0){if(J[z]==="(")W++;else if(J[z]===")"){if(W--,W===0)break}z++}if(W!==0)break;let q=J.substring(K+1,z).trim(),U=z+1,j=(()=>{try{let _=T0(q,Z);if(!_)return"";if(!_["@context"])_["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(_).replace(/<\//g,"<\\/")}</script>`}catch(_){let B=_ instanceof Error?_.message:String(_);return e("StructuredData",B,s.EVALUATION_ERROR)}})();J=J.substring(0,G)+j+J.substring(U),X.lastIndex=0}return J}function oZ($,Z,Y,J){let X=$,Q=/@seo\s*\(\s*\{/g,G;while((G=Q.exec(X))!==null){let K=X.indexOf("{",G.index+4),W=1,z=K+1,q=null,U=!1;while(z<X.length&&W>0){let V=X[z];if(U){U=!1,z++;continue}if(V==="\\"&&q){U=!0,z++;continue}if(q){if(V===q)q=null;z++;continue}if(V==='"'||V==="'"||V==="`"){q=V,z++;continue}if(V==="{")W++;else if(V==="}")W--;z++}if(W!==0)break;let j=X.substring(z).match(/^\s*\)/);if(!j)break;let _=z+j[0].length,B=X.substring(K,z),H=X.substring(G.index,_),L=((V)=>{try{let O=T0(V,Z);if(!O)return"";let F="";if(O.title)F+=`<title>${l(O.title)}</title>
|
|
8143
8146
|
`,F+=`<meta name="title" content="${l(O.title)}">
|
|
8144
8147
|
`;if(O.description)F+=`<meta name="description" content="${l(O.description)}">
|
|
8145
8148
|
`;if(O.keywords){let w=Array.isArray(O.keywords)?O.keywords.join(", "):O.keywords;F+=`<meta name="keywords" content="${l(w)}">
|
|
@@ -8740,10 +8743,10 @@ else {
|
|
|
8740
8743
|
}
|
|
8741
8744
|
})();
|
|
8742
8745
|
</script>
|
|
8743
|
-
`,J}function _2($){let{html:Z,bindings:Y,stores:J}=Mz($);if(Y.length===0)return $;let X=Tz(Y,J),Q=Z.lastIndexOf("</body>");if(Q!==-1)return Z.slice(0,Q)+X+Z.slice(Q);return Z+X}var B2=()=>{};function Iz($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return Dz(Z);case"google-analytics":return Ez(Z);case"plausible":return kz(Z);case"self-hosted":return bz(Z);case"custom":return Sz(Z);default:return""}}function Dz($){let Z=$.fathom;if(!Z?.siteId)return"";let Y=Z.scriptUrl||"https://cdn.usefathom.com/script.js",J=Z.defer!==!1?" defer":"",X=[`data-site="${
|
|
8746
|
+
`,J}function _2($){let{html:Z,bindings:Y,stores:J}=Mz($);if(Y.length===0)return $;let X=Tz(Y,J),Q=Z.lastIndexOf("</body>");if(Q!==-1)return Z.slice(0,Q)+X+Z.slice(Q);return Z+X}var B2=()=>{};function Iz($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return Dz(Z);case"google-analytics":return Ez(Z);case"plausible":return kz(Z);case"self-hosted":return bz(Z);case"custom":return Sz(Z);default:return""}}function Dz($){let Z=$.fathom;if(!Z?.siteId)return"";let Y=Z.scriptUrl||"https://cdn.usefathom.com/script.js",J=Z.defer!==!1?" defer":"",X=[`data-site="${u0(Z.siteId)}"`];if(Z.honorDnt)X.push('data-honor-dnt="true"');if(Z.spa)X.push('data-spa="auto"');if(Z.canonical)X.push(`data-canonical="${u0(Z.canonical)}"`);if(Z.auto===!1)X.push('data-auto="false"');return`
|
|
8744
8747
|
<!-- Fathom Analytics -->
|
|
8745
|
-
<script src="${
|
|
8746
|
-
`}function Ez($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let Y=
|
|
8748
|
+
<script src="${u0(Y)}" ${X.join(" ")}${J}></script>
|
|
8749
|
+
`}function Ez($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let Y=u0(Z.measurementId),J=Z.debug?`gtag('config', '${Y}', { 'debug_mode': true });`:"";return`
|
|
8747
8750
|
<!-- Google Analytics -->
|
|
8748
8751
|
<script async src="https://www.googletagmanager.com/gtag/js?id=${Y}"></script>
|
|
8749
8752
|
<script>
|
|
@@ -8753,10 +8756,10 @@ else {
|
|
|
8753
8756
|
gtag('config', '${Y}');
|
|
8754
8757
|
${J}
|
|
8755
8758
|
</script>
|
|
8756
|
-
`}function kz($){let Z=$.plausible;if(!Z?.domain)return"";let Y=Z.scriptUrl||"https://plausible.io/js/script.js",J=[`data-domain="${
|
|
8759
|
+
`}function kz($){let Z=$.plausible;if(!Z?.domain)return"";let Y=Z.scriptUrl||"https://plausible.io/js/script.js",J=[`data-domain="${u0(Z.domain)}"`],X=Y,Q=[];if(Z.trackLocalhost)Q.push("local");if(Z.hashMode)Q.push("hash");if(Q.length>0&&Y==="https://plausible.io/js/script.js")X=`https://plausible.io/js/script.${Q.join(".")}.js`;return`
|
|
8757
8760
|
<!-- Plausible Analytics -->
|
|
8758
|
-
<script defer data-domain="${
|
|
8759
|
-
`}function bz($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let Y=
|
|
8761
|
+
<script defer data-domain="${u0(Z.domain)}" src="${u0(X)}"></script>
|
|
8762
|
+
`}function bz($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let Y=u0(Z.siteId),J=u0(Z.apiEndpoint),X=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",Q=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
|
|
8760
8763
|
d.addEventListener('click',function(e){
|
|
8761
8764
|
var a=e.target.closest('a');
|
|
8762
8765
|
if(a&&a.hostname!==location.hostname){
|
|
@@ -8794,10 +8797,10 @@ else {
|
|
|
8794
8797
|
<script>
|
|
8795
8798
|
${Z.inlineScript}
|
|
8796
8799
|
</script>
|
|
8797
|
-
`;if(!Z.scriptUrl)return"";let Y=[];if(Z.scriptId)Y.push(`id="${
|
|
8800
|
+
`;if(!Z.scriptUrl)return"";let Y=[];if(Z.scriptId)Y.push(`id="${u0(Z.scriptId)}"`);if(Z.attributes)for(let[X,Q]of Object.entries(Z.attributes))Y.push(`${u0(X)}="${u0(Q)}"`);return`
|
|
8798
8801
|
<!-- Custom Analytics -->
|
|
8799
|
-
<script${Y.length>0?` ${Y.join(" ")}`:""} src="${
|
|
8800
|
-
`}function H2($,Z){let Y=Iz(Z);if(!Y)return $;if(!$.includes("</head>")){let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Y+$.slice(J);return $+Y}return $.replace("</head>",`${Y}</head>`)}function
|
|
8802
|
+
<script${Y.length>0?` ${Y.join(" ")}`:""} src="${u0(Z.scriptUrl)}" defer></script>
|
|
8803
|
+
`}function H2($,Z){let Y=Iz(Z);if(!Y)return $;if(!$.includes("</head>")){let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Y+$.slice(J);return $+Y}return $.replace("</head>",`${Y}</head>`)}function u0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var O2=()=>{};function V2($){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 J=Y.toLowerCase();if(J==="prevent")Z.prevent=!0;else if(J==="stop")Z.stop=!0;else if(J==="once")Z.once=!0;else if(J==="capture")Z.capture=!0;else if(J==="self")Z.self=!0;else if(J==="passive")Z.passive=!0;else if(yz.has(J))Z.systemKeys.push(J);else if(J in w2)Z.mouse=J;else if(J in F2||/^[a-z]$/.test(J))Z.keys.push(F2[J]||J.toUpperCase());else if(J.startsWith("debounce")){let X=J.match(/debounce(?:\.(\d+))?/);Z.debounce=X?.[1]?Number.parseInt(X[1],10):300}else if(J.startsWith("throttle")){let X=J.match(/throttle(?:\.(\d+))?/);Z.throttle=X?.[1]?Number.parseInt(X[1],10):300}}return Z}function A2($){let Z=[],Y=0,J=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,X;while((X=J.exec($))!==null){let[Q,G,K]=X,W=X.index,z=W+Q.length,q=`__stx_evt_${Y++}`,U=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,_;while((_=j.exec(K))!==null){let[,H,L]=_,V=H.split("."),O=V[0];if(!L2.has(O))continue;U.push({attribute:`@${H}`,event:O,handler:L,modifiers:V2(V.slice(1)),elementId:q})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((_=B.exec(K))!==null){let[,H,L]=_,V=H.split("."),O=V[0];if(!L2.has(O))continue;U.push({attribute:`@${H}`,event:O,handler:L,modifiers:V2(V.slice(1)),elementId:q})}if(U.length>0)Z.push({originalTag:Q,elementId:q,events:U,startIndex:W,endIndex:z})}return Z}function Pz($){let Z=[],{modifiers:Y}=$;if(Y.self)Z.push("if ($event.target !== $el) return");for(let J of Y.systemKeys)Z.push(`if (!$event.${J}Key) return`);if(Y.keys.length>0){let J=Y.keys.map((X)=>`$event.key === '${X}'`).join(" || ");Z.push(`if (!(${J})) return`)}if(Y.mouse!==null){let J=w2[Y.mouse];Z.push(`if ($event.button !== ${J}) return`)}if(Y.prevent)Z.push("$event.preventDefault()");if(Y.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function Cz($,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 vz($){let{modifiers:Z}=$,Y=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=Pz($),X=Cz($.handler,Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(Z.passive)Q.push("passive: true");let G=Q.length>0?`, { ${Q.join(", ")} }`:"",K=X.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
|
|
8801
8804
|
(function() {
|
|
8802
8805
|
var $el = document.getElementById('${Y}');
|
|
8803
8806
|
if (!$el) return;
|
|
@@ -8903,7 +8906,7 @@ else {
|
|
|
8903
8906
|
`)}
|
|
8904
8907
|
})();
|
|
8905
8908
|
</script>`}function fz($){let Z=A2($);if(Z.length===0)return{template:$,bindings:[]};let Y=$,J=[];for(let X=Z.length-1;X>=0;X--){let Q=Z[X],G=Q.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${Q.elementId}"`);else{let K=G.match(/id=["']([^"']+)["']/);if(K)for(let W of Q.events)W.elementId=K[1]}for(let K of Q.events){let W=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),z=new RegExp(`\\s*${W}\\s*=\\s*"[^"]*"`,"g"),q=new RegExp(`\\s*${W}\\s*=\\s*'[^']*'`,"g");G=G.replace(z,""),G=G.replace(q,"")}Y=Y.slice(0,Q.startIndex)+G+Y.slice(Q.endIndex),J.push(...Q.events)}return{template:Y,bindings:J}}function R2($,Z,Y){if(/\b(?:state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)||/@(?:model|show|for|if)\s*=/.test($)||/data-stx(?:-auto)?(?![-\w])/.test($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:W,bindings:z}=fz($),q=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...q,...z],W}let X=A2($);if(X.length===0)return $;let Q=$;for(let W=X.length-1;W>=0;W--){let z=X[W],q=z.originalTag;if(!q.includes(" id="))q=q.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${z.elementId}"`);else{let U=q.match(/id=["']([^"']+)["']/);if(U)for(let j of z.events)j.elementId=U[1]}for(let U of z.events){let j=U.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),_=new RegExp(`\\s*${j}\\s*=\\s*"[^"]*"`,"g"),B=new RegExp(`\\s*${j}\\s*=\\s*'[^']*'`,"g");q=q.replace(_,""),q=q.replace(B,"")}Q=Q.slice(0,z.startIndex)+q+Q.slice(z.endIndex)}let G=xz(X),K=Q.lastIndexOf("</body>");if(K!==-1)Q=Q.slice(0,K)+G+`
|
|
8906
|
-
`+Q.slice(K);else Q+=G;return Q}var L2,F2,yz,w2;var N2=S(()=>{L2=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"]),F2={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"},yz=new Set(["ctrl","alt","shift","meta"]),w2={left:0,middle:1,right:2}});function C4($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function M2($,Z){let Y=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(Y)return Y[1];let J=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(J)return J[1];return null}function hz($){let Z=[],Y=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,J;while((J=Y.exec($))!==null){let[X,Q,G]=J,K=J.index,W=M2(G,"x-data");if(!W)continue;let z=`__stx_scope_${I2++}`,q=M2(G,"x-init"),U=dz($,Q,K+X.length),j=$.slice(K,U.endIndex),_=
|
|
8909
|
+
`+Q.slice(K);else Q+=G;return Q}var L2,F2,yz,w2;var N2=S(()=>{L2=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"]),F2={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"},yz=new Set(["ctrl","alt","shift","meta"]),w2={left:0,middle:1,right:2}});function C4($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function M2($,Z){let Y=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(Y)return Y[1];let J=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(J)return J[1];return null}function hz($){let Z=[],Y=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,J;while((J=Y.exec($))!==null){let[X,Q,G]=J,K=J.index,W=M2(G,"x-data");if(!W)continue;let z=`__stx_scope_${I2++}`,q=M2(G,"x-init"),U=dz($,Q,K+X.length),j=$.slice(K,U.endIndex),_=uz(j);Z.push({id:z,selector:`[data-stx-scope="${z}"]`,stateExpr:W,initExpr:q,bindings:[],refs:_})}return Z}function dz($,Z,Y){let J=1,X=Y,Q=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),K=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(J>0&&X<$.length){Q.lastIndex=X,G.lastIndex=X,K.lastIndex=X;let W=Q.exec($),z=G.exec($),q=K.exec($);if(q&&q.index<(W?.index??1/0)){X=q.index+q[0].length;continue}if(!z)return{endIndex:$.length};if(W&&W.index<z.index)J++,X=W.index+W[0].length;else{if(J--,J===0)return{endIndex:z.index+z[0].length};X=z.index+z[0].length}}return{endIndex:$.length}}function uz($){let Z=new Map,Y=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),J=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,X;while((X=J.exec(Y))!==null){let[,Q,G]=X,K=mz(Q);Z.set(G,K)}return Z}function mz($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${gz++}`}function pz(){return`
|
|
8907
8910
|
// STX Reactive Runtime - x-cloak and transition CSS
|
|
8908
8911
|
(function() {
|
|
8909
8912
|
var style = document.createElement('style');
|
|
@@ -9123,10 +9126,10 @@ ${pz()}
|
|
|
9123
9126
|
${Y}
|
|
9124
9127
|
</script>`}function D2($,Z,Y){if(I2=0,!iz($))return $;let J=hz($);if(J.length===0)return $;let X=cz($,J),Q=lz(J,Z),G=X.lastIndexOf("</body>");if(G!==-1)X=X.slice(0,G)+Q+`
|
|
9125
9128
|
`+X.slice(G);else X+=Q;return X}function cz($,Z){let Y=$;for(let J of Z){let Q=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${C4(J.stateExpr)}["']`,"gi").exec(Y);if(Q)J.id=Q[1],J.selector=`[data-stx-scope="${J.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${C4(J.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(Y);if(K)J.id=K[1],J.selector=`[data-stx-scope="${J.id}"]`;else Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${C4(J.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${J.id}" $2$3$4`),Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${C4(J.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${J.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 iz($){return/x-data\s*=\s*["']/.test($)}var I2=0,gz=0;var E2=S(()=>{Y1()});import nz from"fs";import x3 from"path";import{createHighlighter as oz}from"ts-syntax-highlighter";async function sz($,Z={}){try{if(!await c($))throw Error(`Markdown file not found: ${$}`);let J=(await nz.promises.stat($)).mtime.getTime();if(Z.cache&&f3.has($)){let U=f3.get($);if(U.updatedAt>=J)return{content:U.content,data:U.data}}let X=await Bun.file($).text(),{data:Q,content:G}=B9(X),K=Z.markdown||k3.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},z=P5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)z=await rz(z,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let q={content:z,data:Q||{}};if(Z.cache)f3.set($,{...q,updatedAt:J});return q}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let J=Y instanceof Error?Y.message:String(Y);return{content:q0("Markdown File",`Error reading/parsing markdown file: ${J}`,$,"",0,""),data:{}}}}async function rz($,Z,Y){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!v4)try{v4=await oz({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let X=async(K,W,z,q)=>{let U=q.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),j=z||(Y?"text":"");if(!j)return K;try{if(!v4.getSupportedLanguages().includes(j))return K;return(await v4.highlight(U,j,{theme:Z})).html}catch(_){console.error(`Error highlighting code block with language ${z}:`,_)}return K},Q=$,G=$.matchAll(J);for(let K of G){let[W,z,q,U]=K,j=await X(W,z,q,U);Q=Q.replace(W,j)}return Q}async function k2($,Z,Y="",J={}){return await az($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,W,z)=>{try{let q=K;if(!x3.isAbsolute(K))q=x3.resolve(x3.dirname(Y),K);let U={};if(W)try{try{U=JSON.parse(W)}catch{if(J.debug)console.warn("Using safer alternative for parsing JS object literal");let O=W.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let F of O){let w=F.indexOf(":");if(w>0){let A=F.substring(0,w).trim(),R=F.substring(w+1).trim(),N=R.startsWith('"')&&R.endsWith('"'),M=R.startsWith("'")&&R.endsWith("'");if(N||M)R=R.substring(1,R.length-1);U[A]=R}}}}catch(V){if(J.debug)console.error("Error parsing context in @markdown-file directive:",V)}let{content:j,data:_}=await sz(q,J),B={...Z,..._,...U},H=j,L=/\{\{([^}]+)\}\}/g;return H=H.replace(L,(V,O)=>{let F=O.trim();return B[F]!==void 0?String(B[F]):V}),H}catch(q){let U=q instanceof Error?q.message:String(q);return q0("Markdown File",`Error including markdown file: ${U}`,Y,$,z,G)}})}async function az($,Z,Y){let J=[],X;while((X=Z.exec($))!==null){let K=X[0],W=X.index,z=X;J.push(Y(...z).then((q)=>({match:K,replacement:q,index:W})))}let Q=await Promise.all(J);Q.sort((K,W)=>W.index-K.index);let G=$;for(let{match:K,replacement:W}of Q)G=G.replace(K,()=>W);return G}var f3,v4=null;var b2=S(()=>{c1();M0();f3=new Map});function N1($,Z){try{let Y=$.trim();if(K0(Y))return W0(Y,Object.keys(Z))(...Object.values(Z));else return $0(Y,Z)}catch{return!1}}var S2=S(()=>{w0()});function tz($,Z,Y){let J=$,X=!0;while(X){X=!1;let Q=J.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=I7(J,G);if(!K)break;try{let W;if(K0(K.expression))W=W0(K.expression,Object.keys(Z))(...Object.values(Z));else W=$0(K.expression,Z);let z="",q=!1;for(let U of K.cases)if(U.type==="default"){if(!q)z=U.content.trim()}else try{let j;if(U.value&&K0(U.value))j=W0(U.value,Object.keys(Z))(...Object.values(Z));else if(U.value)j=$0(U.value,Z);if(W===j){z=U.content.trim(),q=!0;break}}catch{continue}J=J.substring(0,G)+z+J.substring(K.end),X=!0}catch(W){let z=W instanceof Error?W.message:String(W),q=e("Switch",`Error evaluating @switch expression: ${z}`,s.EVALUATION_ERROR);J=J.substring(0,G)+q+J.substring(K.end);break}}return J}function i1($,Z,Y){let J=$;J=tz(J,Z,Y);{let Q=!0;while(Q){Q=!1;let G=J.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,W=w1(J,K+7);if(!W)break;let z=W.endPos,q=g1(J,"unless","endunless",z);if(q===-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 U=J.slice(z,q),j=W.expression,_=-1;{let H=0,L=/@(?:if|unless)\s*\(/g,V=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,F=[],w;while((w=L.exec(U))!==null)F.push({pos:w.index,type:"open"});while((w=V.exec(U))!==null)F.push({pos:w.index,type:"close"});while((w=O.exec(U))!==null)F.push({pos:w.index,type:"else"});F.sort((A,R)=>A.pos-R.pos);for(let A of F)if(A.type==="open")H++;else if(A.type==="close")H--;else if(A.type==="else"&&H===0){_=A.pos;break}}let B;if(_!==-1){let H=U.slice(0,_),L=U.slice(_+5);B=`@if (${j})${L}@else ${H}@endif`}else B=`@if (!(${j}))${U}@endif`;J=J.substring(0,K)+B+J.substring(q+10),Q=!0}}J=h3(J,Z,Y),J=d3(J,Z,Y),J=g3(J,Z);let X=()=>{let Q=s5(J);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let K=Q[G];try{let W="",z=!1;for(let q of K.branches){if(z)break;if(q.type==="else")W=q.content,z=!0;else try{let U;if(q.condition&&K0(q.condition))U=W0(q.condition,Object.keys(Z))(...Object.values(Z));else if(q.condition)U=$0(q.condition,Z);if(U)W=q.content,z=!0}catch(U){W=e(q.type==="if"?"If":"Elseif",`Error in @${q.type}(${q.condition}): ${U instanceof Error?U.message:String(U)}`,s.EVALUATION_ERROR),z=!0}}J=J.substring(0,K.start)+W+J.substring(K.end)}catch(W){let z=W instanceof Error?W.message:String(W),q=e("If",`Error processing @if block: ${z}`,s.EVALUATION_ERROR);J=J.substring(0,K.start)+q+J.substring(K.end)}}return!0};while(!0){let Q=J;if(!X())break;if(J===Q)break}return J}function y2($){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 J=[];while(Z<$.length){let X=$[Z];if(X==="\\"&&Z+1<$.length){J.push($[Z+1]),Z+=2;continue}if(X===Y){Z++;break}J.push(X),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:J.join(""),consumed:Z}}function g3($,Z){let Y=$;function J(K,W,z,q){let U=1,j=q,_=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${z}(?![a-z])`,"g");while(j<K.length&&U>0){_.lastIndex=j,B.lastIndex=j;let H=_.exec(K),L=B.exec(K),V=H?H.index:1/0,O=L?L.index:1/0;if(V<O)U++,j=V+H[0].length;else if(O<1/0){if(U--,U===0)return O;j=O+L[0].length}else break}return-1}function X(K,W,z){let q=0,U=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${z}(?![a-z])`,"g"),_=/@else(?![a-z])/g,B=[],H;while((H=U.exec(K))!==null)B.push({pos:H.index,type:"open"});while((H=j.exec(K))!==null)B.push({pos:H.index,type:"close"});while((H=_.exec(K))!==null)B.push({pos:H.index,type:"else"});B.sort((L,V)=>L.pos-V.pos);for(let L of B)if(L.type==="open")q++;else if(L.type==="close")q--;else if(L.type==="else"&&q===0)return L.pos;return-1}{let K=!0;while(K){K=!1;let W=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let z=W.index,q,U,j=Y.slice(z+5),_=y2(j);if(_)q=_.value,U=z+5+_.consumed;else U=z+5;let B=J(Y,"auth","endauth",U);if(B===-1){console.warn(`[stx] @auth directive at position ${z} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(U,B),L=X(H,"auth","endauth"),V;if(!Z.auth)V=!1;else V=q?N1(`auth?.check && auth?.user?.[${q}]`,Z):N1("auth?.check",Z);let O;if(L!==-1){let F=H.slice(0,L),w=H.slice(L+5);O=V?F:w}else O=V?H:"";Y=Y.substring(0,z)+O+Y.substring(B+8),K=!0}}{let K=!0;while(K){K=!1;let W=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let z=W.index,q,U,j=Y.slice(z+6),_=y2(j);if(_)q=_.value,U=z+6+_.consumed;else U=z+6;let B=J(Y,"guest","endguest",U);if(B===-1){console.warn(`[stx] @guest directive at position ${z} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(U,B),L=X(H,"guest","endguest"),V;if(!Z.auth)V=!0;else V=q?N1(`!auth?.check || !auth?.user?.[${q}]`,Z):N1("!auth?.check",Z);let O;if(L!==-1){let F=H.slice(0,L),w=H.slice(L+5);O=V?F:w}else O=V?H:"";Y=Y.substring(0,z)+O+Y.substring(B+9),K=!0}}function Q(K,W,z){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let q=[K];if(W)q.push(W);if(z){let U=N1(z,Z);q.push(U)}return Z.permissions.check(...q)}catch{return!1}return!1}function G(K){let W=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!W)return null;return{ability:W[1],type:W[2],id:W[3]?.trim(),paramsEnd:W[0].length}}for(let K of["can","cannot"]){let W=`end${K}`,z=K==="can"?"elsecan":"elsecannot",q=!0;while(q){q=!1;let U=Y.match(new RegExp(`@${K}\\s*\\(`));if(!U||U.index===void 0)break;let j=U.index,_=Y.slice(j+`@${K}`.length),B=G(_);if(!B)break;let H=j+`@${K}`.length+B.paramsEnd,L=J(Y,K,W,H);if(L===-1){console.warn(`[stx] @${K} directive at position ${j} has no matching @${W} \u2014 the block was skipped.`);break}let V=Y.slice(H,L),O=[],F=0,w=new RegExp(`@${K}\\s*\\(`,"g"),A=new RegExp(`@${W}(?![a-z])`,"g"),R=new RegExp(`@${z}\\s*\\(`,"g"),N=/@else(?![a-z])/g,M=[],T;while((T=w.exec(V))!==null)M.push({pos:T.index,type:"open"});while((T=A.exec(V))!==null)M.push({pos:T.index,type:"close"});while((T=R.exec(V))!==null)M.push({pos:T.index,type:"elseDirective"});while((T=N.exec(V))!==null)M.push({pos:T.index,type:"else"});M.sort((k,v)=>k.pos-v.pos);for(let k of M){if(k.type==="open"){F++;continue}if(k.type==="close"){F--;continue}if(F===0)O.push(k)}let I=[],E=0;for(let k=0;k<O.length;k++){let v=O[k];if(I.push({content:V.slice(E,v.pos),ability:void 0}),v.type==="elseDirective"){let g=V.slice(v.pos+`@${z}`.length),f=G(g);if(f){I[I.length-1]={content:V.slice(E,v.pos)},E=v.pos+`@${z}`.length+f.paramsEnd,I.push({content:"",ability:f.ability,type:f.type,id:f.id}),I.pop();let d=O[k+1],p=d?d.pos:V.length;I.push({content:V.slice(E,p),ability:f.ability,type:f.type,id:f.id}),E=p}}else E=v.pos+5}if(E<V.length){let k=I[I.length-1];if(O.length>0&&O[O.length-1].type==="else")I.push({content:V.slice(E),isFinalElse:!0});else if(I.length===0)I.push({content:V.slice(E)})}let D=Q(B.ability,B.type,B.id),y=K==="can"?D:!D,b="";if(y)b=I[0]?.content||"";else{let k=!1;for(let v=1;v<I.length;v++){let g=I[v];if(g.isFinalElse){b=g.content,k=!0;break}if(g.ability){let f=Q(g.ability,g.type,g.id);if(K==="can"?f:!f){b=g.content,k=!0;break}}}if(!k&&I.length>0){let v=I[I.length-1];if(v.isFinalElse)b=v.content}}Y=Y.substring(0,j)+b+Y.substring(L+`@${W}`.length),q=!0}}return Y}function h3($,Z,Y){let J=$;function X(Q,G,K,W,z){let q=!0;while(q){q=!1;let U=new RegExp(`@${G}\\s*\\(`),j=Q.match(U);if(!j||j.index===void 0)break;let _=j.index,B=w1(Q,_+`@${G}`.length);if(!B)break;let H=B.endPos,L=g1(Q,G,K,H);if(L===-1){console.warn(`[stx] @${G} directive at position ${_} has no matching @${K} \u2014 the block was skipped.`);break}let V=Q.slice(H,L),O=B.expression,F=-1,w=0,A=0;while(A<V.length){let R=V.indexOf("@",A);if(R===-1)break;let N=V.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(N)){w++,A=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(N)){w--,A=R+1;continue}if(w===0&&/^@else(?![a-z])/.test(N)){F=R;break}A=R+1}try{let R=W(O.trim()),N;if(F!==-1){let M=V.slice(0,F),T=V.slice(F+5);N=R?M:T}else N=R?V:"";Q=Q.substring(0,_)+N+Q.substring(L+`@${K}`.length),q=!0}catch(R){let N=R instanceof Error?R.message:String(R),M=e(z,`Error processing @${G} directive: ${N}`,s.EVALUATION_ERROR);Q=Q.substring(0,_)+M+Q.substring(L+`@${K}`.length);break}}return Q}return J=X(J,"isset","endisset",(Q)=>{let G=N1(Q,Z);return G!==void 0&&G!==null},"Isset"),J=X(J,"empty","endempty",(Q)=>{let G=N1(Q,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"),J}function d3($,Z,Y){let J=$,X="development";function Q(G,K,W,z){let q=new RegExp(`@${K}(?![a-z])`,"g"),U=new RegExp(`@${W}(?![a-z])`,"g"),j=new RegExp(`^@${K}(?![a-z])`),_=new RegExp(`^@${W}(?![a-z])`),B=G,H=!0;while(H){H=!1,q.lastIndex=0;let L=q.exec(B);if(!L)break;let V=L.index,O=V+L[0].length;if(K==="env"){let D=B.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!D)break;O+=D[0].length,z=X===D[2]}let F=1,w=O,A=-1;while(F>0&&w<B.length){q.lastIndex=w,U.lastIndex=w;let D=q.exec(B),y=U.exec(B),b=D?D.index:1/0,k=y?y.index:1/0;if(b<k)F++,w=b+D[0].length;else if(k<1/0){if(F--,F===0){A=k;break}w=k+y[0].length}else break}if(A===-1){console.warn(`[stx] @${K} directive at position ${V} has no matching @${W} \u2014 the block was skipped.`);break}let R=B.substring(O,A),N=-1,M=0,T=0;while(T<R.length){let D=R.indexOf("@",T);if(D===-1)break;let y=R.substring(D);if(j.test(y)){M++,T=D+1;continue}if(_.test(y)){M--,T=D+1;continue}if(M===0&&/^@else(?![a-z])/.test(y)){N=D;break}T=D+1}let I;if(N!==-1){let D=R.slice(0,N),y=R.slice(N+5);I=z?D:y}else I=z?R:"";let E=`@${W}`.length;B=B.substring(0,V)+I+B.substring(A+E),H=!0}return B}return J=Q(J,"env","endenv",!1),J=Q(J,"production","endproduction",X==="production"),J=Q(J,"development","enddevelopment",X==="development"),J=Q(J,"staging","endstaging",X==="staging"),J=Q(J,"testing","endtesting",X==="testing"),J}var x4=S(()=>{S2();W1();C$();w0()});function C2($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function f4($,Z){if(!$)return Z?.nonceGenerator?.()??C2();let Y=P2.get($);if(!Y)Y=Z?.nonceGenerator?.()??C2(),P2.set($,Y);return Y}function ez($,Z){let Y=[];for(let[J,X]of Object.entries($)){if(X===void 0||X===null)continue;if(typeof X==="boolean"){if(X)Y.push(J);continue}if(Array.isArray(X)){let Q=[...X];if(Z&&(J==="script-src"||J==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)Y.push(`${J} ${Q.join(" ")}`)}}return Y.join("; ")}function v2($,Z){return`<meta http-equiv="Content-Security-Policy" content="${ez($,Z).replace(/&/g,"&").replace(/"/g,""")}">`}function x2($,Z,Y){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let J=Z.useNonce?f4(Y,Z):void 0,X=v2(Z.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
|
|
9126
|
-
${X}`)}function f2($,Z){let Y=$;return Y=Y.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(J,X)=>{if(X.includes("nonce="))return J;return`<script nonce="${Z}"${X}>`}),Y=Y.replace(/<style([^>]*)>/gi,(J,X)=>{if(X.includes("nonce="))return J;return`<style nonce="${Z}"${X}>`}),Y}function g2($,Z,Y,J){let X=$,Q=J.csp;if(X=X.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?f4(Z,Q):void 0;return v2(Q.directives,G)}),X=X.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return f4(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=f4(Z,Q);return X}var P2;var h2=S(()=>{P2=new WeakMap});import $q from"crypto";function Yq($=Zq){let Z=$q.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return
|
|
9129
|
+
${X}`)}function f2($,Z){let Y=$;return Y=Y.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(J,X)=>{if(X.includes("nonce="))return J;return`<script nonce="${Z}"${X}>`}),Y=Y.replace(/<style([^>]*)>/gi,(J,X)=>{if(X.includes("nonce="))return J;return`<style nonce="${Z}"${X}>`}),Y}function g2($,Z,Y,J){let X=$,Q=J.csp;if(X=X.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?f4(Z,Q):void 0;return v2(Q.directives,G)}),X=X.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return f4(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=f4(Z,Q);return X}var P2;var h2=S(()=>{P2=new WeakMap});import $q from"crypto";function Yq($=Zq){let Z=$q.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return u3=Z,Z}function Jq(){if(!u3)Yq();return u3}function Xq($=d2){let Z=Jq();return`<input type="hidden" name="${$}" value="${Z}">`}function u2($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,J)=>{return Xq(J||d2)})}var Zq=40,d2="_token",u3=null;var m2=()=>{};async function p2($,Z,Y,J){if(!J.customDirectives||J.customDirectives.length===0)return $;let X=$;for(let Q of J.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(J.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)X=await Qq(X,Q,Z,Y,J);else X=await Gq(X,Q,Z,Y,J)}return X}async function Qq($,Z,Y,J,X){let{name:Q,handler:G}=Z,K=`@${Q}`,W=`@end${Q}`,z=$,q=G5(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${W}`,"g"),U=[],j=q.exec(z);while(j!==null){let[_,B="",H=""]=j,L=j.index||0;try{let V=B?l2(B):[],O=H.trim(),F=await G(O,V,Y,J);U.push({original:_,processed:F,startIndex:L})}catch(V){let O=V instanceof Error?V.message:String(V);if(X.debug)console.error(`Error processing custom directive @${Q}:`,V);U.push({original:_,processed:e("CustomDirective",`Error in @${Q}${B?`(${B})`:""}: ${O}`,s.EVALUATION_ERROR),startIndex:L})}j=q.exec(z)}for(let _=U.length-1;_>=0;_--){let{original:B,processed:H}=U[_];z=z.replace(B,H)}return z}async function Gq($,Z,Y,J,X){let{name:Q,handler:G}=Z,K=$,W=G5(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),z=[],q=W.exec(K);while(q!==null){let[_,B=""]=q,H=q.index||0;try{let L=l2(B),V=await G("",L,Y,J);z.push({original:_,processed:V,startIndex:H})}catch(L){let V=L instanceof Error?L.message:String(L);if(X.debug)console.error(`Error processing custom directive @${Q}:`,L);z.push({original:_,processed:e("CustomDirective",`Error in @${Q}(${B}): ${V}`,s.EVALUATION_ERROR),startIndex:H})}q=W.exec(K)}let U=G5(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),j=U.exec(K);while(j!==null){let[_]=j,B=j.index||0;try{let H=await G("",[],Y,J);z.push({original:_,processed:H,startIndex:B})}catch(H){let L=H instanceof Error?H.message:String(H);if(X.debug)console.error(`Error processing custom directive @${Q}:`,H);z.push({original:_,processed:e("CustomDirective",`Error in @${Q}: ${L}`,s.EVALUATION_ERROR),startIndex:B})}j=U.exec(K)}for(let _=z.length-1;_>=0;_--){let{original:B,processed:H}=z[_];K=K.replace(B,H)}return K}function l2($){if(!$.trim())return[];let Z=[],Y="",J=!1,X="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!J)J=!0,X=G;else if(G===X)J=!1;else Y+=G;else if(G===","&&!J)Z.push(Y.trim()),Y="";else Y+=G}if(Y.trim())Z.push(Y.trim());return Z.map((Q)=>{let G=Q.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var c2=S(()=>{W1();K5()});function n1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function Wq($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,Y=Z.appearance,J=Z.colorMode;if(n1(Z.storageKey,"storageKey"),!Y||typeof Y!=="object"||Array.isArray(Y))throw Error("@appearanceBootstrap appearance must be an object");if(!J||typeof J!=="object"||Array.isArray(J))throw Error("@appearanceBootstrap colorMode must be an object");if(n1(Y.key,"appearance.key"),n1(Y.attribute,"appearance.attribute"),n1(Y.default,"appearance.default"),n1(J.key,"colorMode.key"),n1(J.attribute,"colorMode.attribute"),n1(J.default,"colorMode.default"),!n2.test(Y.key)||!n2.test(J.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!i2.test(Y.attribute)||!i2.test(J.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Y.allowed)||Y.allowed.length===0||Y.allowed.some((X)=>typeof X!=="string"||X.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!Y.allowed.includes(Y.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!Kq.has(J.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:Y.key,attribute:Y.attribute,allowed:[...new Set(Y.allowed)],default:Y.default},colorMode:{key:J.key,attribute:J.attribute,default:J.default}}}function zq($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function qq($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${zq($)};const root=document.documentElement;let stored={};try{const raw=localStorage.getItem(config.storageKey);const parsed=raw?JSON.parse(raw):{};if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed))stored=parsed}catch{}const selectedAppearance=config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default;const selectedMode=["light","dark","system"].includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default;root.setAttribute("data-"+config.appearance.attribute,selectedAppearance);root.setAttribute("data-"+config.colorMode.attribute,selectedMode);let dark=selectedMode==="dark";if(selectedMode==="system"){try{dark=matchMedia("(prefers-color-scheme: dark)").matches}catch{dark=false}}root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light"}());</script>`}function Uq($,Z){let Y=1,J=null,X=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(X){X=!1;continue}if(J){if(G==="\\")X=!0;else if(G===J)J=null;continue}if(G==='"'||G==="'"||G==="`"){J=G;continue}if(G==="(")Y++;else if(G===")"&&--Y===0)return Q}return-1}function o2($,Z){let Y=$,J=/@appearanceBootstrap\s*\(/g,X;while((X=J.exec(Y))!==null){let Q=X.index+X[0].length-1,G=Uq(Y,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let K=Y.slice(Q+1,G).trim(),W=$0(`(${K})`,Z),z=qq(Wq(W));Y=Y.slice(0,X.index)+z+Y.slice(G+1),J.lastIndex=X.index+z.length}return Y}var i2,n2,Kq;var s2=S(()=>{w0();i2=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,n2=/^[A-Za-z_$][\w$]*$/,Kq=new Set(["light","dark","system"])});import jq from"crypto";function I0($){return String($??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function g4($,Z,Y,J){let X=$||Z;return Y?`${X} ${J}`:X}function _q(){return jq.randomUUID()}function h4($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let J=_q();Z.csrf={token:J}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${I0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(J,X)=>{let Q=X.toUpperCase();if(X&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${I0(Q)}">`;return J}),Y}function t2($,Z,Y=a2){let J=$;return J=J.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(X,Q,G,K,W,z="")=>{let q=Q||G||"POST",U=K||W||"",j=M1(z),_=q.toUpperCase(),B=["GET","POST"].includes(_)?_:"POST",H=`<form method="${I0(B)}" action="${I0(U)}"${j?` ${j}`:""}>`;if(H+=`
|
|
9127
9130
|
${h4("@csrf",Z)}`,!["GET","POST"].includes(_))H+=`
|
|
9128
|
-
${h4(`@method('${_}')`,Z)}`;return H}),J=J.replace(/@endform/g,"</form>"),J=J.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(X,Q,G,K,W,z="")=>{let q=Q||G||"",U=K||W||"",j=M1(z),_=G$(q,Z),B=_!==void 0&&_!==null?_:U||"",H=j.match(/type=['"]([^'"]+)['"]/i),L=H?H[1]:"text",V=K$(q,Z),O=j.match(/class=['"]([^'"]+)['"]/i),F=g4(O?O[1]:"",Y.input,V,Y.inputError),w=j.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${I0(L)}" name="${I0(q)}" value="${I0(B)}" class="${F}"${w?` ${w}`:""}>`}),J=J.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(X,Q,G="",K="")=>{let W=M1(G),z=G$(Q,Z)||K.trim(),q=K$(Q,Z),U=W.match(/class=['"]([^'"]+)['"]/i),j=g4(U?U[1]:"",Y.input,q,Y.inputError),_=W.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${I0(Q)}" class="${j}"${_?` ${_}`:""}>${I0(z)}</textarea>`}),J=J.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(X,Q,G="",K)=>{let W=M1(G),z=G$(Q,Z),q=K$(Q,Z),U=W.match(/class=['"]([^'"]+)['"]/i),j=g4(U?U[1]:"",Y.input,q,Y.inputError),_=W.replace(/class=['"][^'"]+['"]/i,""),B=K;if(z!==void 0)B=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,L,V)=>{if((Array.isArray(z)?z.some((F)=>String(F)===V):String(z)===V)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return H});return`<select name="${I0(Q)}" class="${j}"${_?` ${_}`:""}>${B}</select>`}),J=J.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G="1",K="")=>{let W=M1(K),z=G$(Q,Z),q=z!==void 0&&(Array.isArray(z)?z.some((B)=>String(B)===G):z===!0||String(z)===G),U=W.match(/class=['"]([^'"]+)['"]/i),j=U?U[1]:Y.checkInput,_=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${I0(Q)}" value="${I0(G)}" class="${j}"${q?" checked":""}${_?` ${_}`:""}>`}),J=J.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G,K="")=>{let W=M1(K),z=G$(Q,Z),q=z!==void 0&&z===G,U=W.match(/class=['"]([^'"]+)['"]/i),j=U?U[1]:Y.checkInput,_=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${I0(Q)}" value="${I0(G)}" class="${j}"${q?" checked":""}${_?` ${_}`:""}>`}),J=J.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G="")=>{let K=M1(G),W=K.match(/accept=['"]([^'"]+)['"]/i),z=W?W[1]:"",q=K.includes("multiple"),U=K$(Q,Z),j=K.match(/class=['"]([^'"]+)['"]/i),_=g4(j?j[1]:"",Y.input,U,Y.inputError),B=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${I0(Q)}"`,`class="${_}"`];if(z)H.push(`accept="${I0(z)}"`);if(q)H.push("multiple");if(B)H.push(B);return`${H.join(" ")}>`}),J=J.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(X,Q,G="",K)=>{let W=M1(G),z=W.match(/class=['"]([^'"]+)['"]/i),q=z?z[1]:Y.label,U=W.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${I0(Q)}" class="${q}"${U?` ${U}`:""}>${K}</label>`}),J}function e2($,Z,Y=a2){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,X,Q)=>{try{if(K$(X,Z))return Q.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return r2(X,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(X);return r2(X,Z)}let W=K.trim();if(K0(W)){let z=$0(W,Z);return z!==void 0?String(z):W}return W}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),J}})}function K$($,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 r2($,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 G$($,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 J=$.slice(0,-2);if(Y=Z[J],Y!==void 0)return Y}return Z[$]}function M1($){if(!$.trim())return"";let Z=[],Y=$.trim(),J=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,X;while((X=J.exec(Y))!==null){let[,Q,,G]=X;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}var a2;var $Y=S(()=>{w0();a2={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import l3 from"path";async function Bq(){if(W$!==void 0)return W$;try{W$=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{W$=null}return W$}function Hq($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function Oq($,Z){if({...n3,...Z.i18n}.cache&&c3[$]){let X=c3[$],Q=Z.i18n?.cacheMaxAge??0;if(!Hq(X,Q))return X.translations}if(z$[$]?.state==="loading")return z$[$].promise;
|
|
9129
|
-
`),J=[{obj:Z,indent:-1}];for(let X of Y){let Q=X.replace(/#.*$/,"").trimEnd();if(!Q.trim())continue;let G=Q.search(/\S/);if(G===-1)continue;while(J.length>1&&J[J.length-1].indent>=G)J.pop();let K=J[J.length-1].obj,W=Q.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(W){let[,,z,q]=W,U=z.trim(),j=q.trim();if(j==="")K[U]={},J.push({obj:K[U],indent:G});else K[U]=wq(j)}}return Z}function wq($){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 Aq($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function Rq($,Z){return Oq($,Z)}function Nq($,Z){for(let Y of $){let J=Y.trim(),X=J.match(/^\{(\d+)\}\s*(.*)$/);if(X){let G=Number.parseInt(X[1],10);if(Z===G)return X[2];continue}let Q=J.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10),K=Q[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(Q[2],10);if(Z>=G&&Z<=K)return Q[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function Mq($,Z={}){return JY($,Z)}function JY($,Z){let Y="",J=0;while(J<$.length)if($[J]==="{"){let X=Tq($,J);if(X===-1){Y+=$[J],J++;continue}let Q=$.slice(J+1,X);Y+=Iq(Q,Z),J=X+1}else if($[J]==="'"&&J+1<$.length)if($[J+1]==="'")Y+="'",J+=2;else if($[J+1]==="{"||$[J+1]==="}")Y+=$[J+1],J+=2;else Y+=$[J],J++;else Y+=$[J],J++;return Y}function Tq($,Z){let Y=0;for(let J=Z;J<$.length;J++)if($[J]==="{")Y++;else if($[J]==="}"){if(Y--,Y===0)return J}return-1}function Iq($,Z){let Y=Dq($);if(Y.length===0)return`{${$}}`;let J=Y[0].trim(),X=Z[J];if(Y.length===1)return X!==void 0?String(X):`{${J}}`;switch(Y[1].trim().toLowerCase()){case"plural":return Eq(X,Y.slice(2).join(","),Z);case"select":return bq(X,Y.slice(2).join(","));case"selectordinal":return Sq(X,Y.slice(2).join(","));case"number":return Pq(X,Y[2]?.trim());case"date":return Cq(X,Y[2]?.trim());case"time":return vq(X,Y[2]?.trim());default:return X!==void 0?String(X):`{${$}}`}}function Dq($){let Z=[],Y="",J=0;for(let X=0;X<$.length;X++){let Q=$[X];if(Q==="{")J++,Y+=Q;else if(Q==="}")J--,Y+=Q;else if(Q===","&&J===0)Z.push(Y),Y="";else Y+=Q}if(Y)Z.push(Y);return Z}function Eq($,Z,Y){let J=Number($)||0,X=o3(Z),Q=`=${J}`;if(X[Q])return p3(X[Q],J,Y);let G=kq(J);if(X[G])return p3(X[G],J,Y);if(X.other)return p3(X.other,J,Y);return String(J)}function p3($,Z,Y){let J=$.replace(/#/g,String(Z));return JY(J,Y)}function kq($){let Z=Math.abs($),Y=Math.floor(Z),J=String($).includes(".")?String($).split(".")[1].length:0;if(Y===1&&J===0)return"one";return"other"}function bq($,Z){let Y=String($||""),J=o3(Z);if(J[Y])return J[Y];return J.other||String($)}function Sq($,Z){let Y=Number($)||0,J=o3(Z),X=yq(Y);if(J[X])return J[X].replace(/#/g,String(Y));if(J.other)return J.other.replace(/#/g,String(Y));return String(Y)}function yq($){let Z=Math.abs($),Y=Z%10,J=Z%100;if(Y===1&&J!==11)return"one";if(Y===2&&J!==12)return"two";if(Y===3&&J!==13)return"few";return"other"}function o3($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,J=Y.exec($);while(J!==null)Z[J[1]]=J[2],J=Y.exec($);return Z}function Pq($,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 Cq($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let J={};switch(Z){case"short":J.dateStyle="short";break;case"medium":J.dateStyle="medium";break;case"long":J.dateStyle="long";break;case"full":J.dateStyle="full";break;default:J.dateStyle="medium"}return Y.toLocaleDateString(void 0,J)}function vq($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let J={};switch(Z){case"short":J.timeStyle="short";break;case"medium":J.timeStyle="medium";break;case"long":J.timeStyle="long";break;case"full":J.timeStyle="full";break;default:J.timeStyle="short"}return Y.toLocaleTimeString(void 0,J)}function xq($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function ZY($,Z,Y=!0,J={}){let X=$.split("."),Q=Z;for(let K of X){if(Q===void 0||Q===null)break;Q=Q[K]}if(Q===void 0||Q===null)return Y?$:"";let G=String(Q);if(xq(G))return Mq(G,J);if(G.includes("|")&&"count"in J){let K=Number(J.count),W=G.split("|");G=Nq(W,K)}for(let[K,W]of Object.entries(J)){let z=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${z}`,"g"),String(W))}return G}async function XY($,Z,Y,J){let X=$,Q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...n3,...J.i18n},K=await Rq(G.locale,J);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,X=await YY(X,Q,async(q,U,j,_,B)=>{try{let H={};if(j)try{let V=[()=>JSON.parse(j),()=>{let O=`{"data":${j}}`,F=JSON.parse(O);return typeof F.data==="object"?F.data:{}},()=>{return T0(j,Z)}];for(let O of V)try{if(H=O(),Object.keys(H).length>0)break}catch{}}catch(V){if(J.debug)console.error("Error parsing parameters for @translate directive:",V)}return ZY(U,K,G.fallbackToKey,H)||_.trim()}catch(H){if(J.debug)console.error("Error processing @translate directive:",H);return e("Translate",`Error in @translate('${U}'): ${H instanceof Error?H.message:String(H)}`,s.EVALUATION_ERROR)}});let W=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(J.debug){console.warn(`Processing translations in template. Sections: ${X.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let q=[...X.matchAll(W)];console.warn(`Found ${q.length} @translate matches`),q.forEach((U,j)=>console.warn(`Match ${j}: ${U[0]}, Key: ${U[1]}, Params: ${U[2]||"none"}`))}return X=await YY(X,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(q,U,j,_)=>{try{let B={};if(j)try{let H=[()=>JSON.parse(j),()=>{let L=`{"data":${j}}`,V=JSON.parse(L);return typeof V.data==="object"?V.data:{}},()=>{return T0(j,Z)}];for(let L of H)try{if(B=L(),Object.keys(B).length>0)break}catch{}}catch(H){if(J.debug)console.error("Error parsing parameters for @translate directive:",H)}return ZY(U,K,G.fallbackToKey,B)}catch(B){if(J.debug)console.error("Error processing @translate directive:",B);return e("Translate",`Error in @translate('${U}'): ${B instanceof Error?B.message:String(B)}`,s.EVALUATION_ERROR)}}),X}async function YY($,Z,Y){let J=[];return $.replace(Z,(Q,...G)=>{let K=Y(Q,...G).then((W)=>({match:Q,replacement:W}));return J.push(K),Q}),(await Promise.all(J)).reduce((Q,{match:G,replacement:K})=>Q.replace(G,K),$)}var W$,n3,c3,z$,
|
|
9131
|
+
${h4(`@method('${_}')`,Z)}`;return H}),J=J.replace(/@endform/g,"</form>"),J=J.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(X,Q,G,K,W,z="")=>{let q=Q||G||"",U=K||W||"",j=M1(z),_=G$(q,Z),B=_!==void 0&&_!==null?_:U||"",H=j.match(/type=['"]([^'"]+)['"]/i),L=H?H[1]:"text",V=K$(q,Z),O=j.match(/class=['"]([^'"]+)['"]/i),F=g4(O?O[1]:"",Y.input,V,Y.inputError),w=j.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${I0(L)}" name="${I0(q)}" value="${I0(B)}" class="${F}"${w?` ${w}`:""}>`}),J=J.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(X,Q,G="",K="")=>{let W=M1(G),z=G$(Q,Z)||K.trim(),q=K$(Q,Z),U=W.match(/class=['"]([^'"]+)['"]/i),j=g4(U?U[1]:"",Y.input,q,Y.inputError),_=W.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${I0(Q)}" class="${j}"${_?` ${_}`:""}>${I0(z)}</textarea>`}),J=J.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(X,Q,G="",K)=>{let W=M1(G),z=G$(Q,Z),q=K$(Q,Z),U=W.match(/class=['"]([^'"]+)['"]/i),j=g4(U?U[1]:"",Y.input,q,Y.inputError),_=W.replace(/class=['"][^'"]+['"]/i,""),B=K;if(z!==void 0)B=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,L,V)=>{if((Array.isArray(z)?z.some((F)=>String(F)===V):String(z)===V)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return H});return`<select name="${I0(Q)}" class="${j}"${_?` ${_}`:""}>${B}</select>`}),J=J.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G="1",K="")=>{let W=M1(K),z=G$(Q,Z),q=z!==void 0&&(Array.isArray(z)?z.some((B)=>String(B)===G):z===!0||String(z)===G),U=W.match(/class=['"]([^'"]+)['"]/i),j=U?U[1]:Y.checkInput,_=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${I0(Q)}" value="${I0(G)}" class="${j}"${q?" checked":""}${_?` ${_}`:""}>`}),J=J.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G,K="")=>{let W=M1(K),z=G$(Q,Z),q=z!==void 0&&z===G,U=W.match(/class=['"]([^'"]+)['"]/i),j=U?U[1]:Y.checkInput,_=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${I0(Q)}" value="${I0(G)}" class="${j}"${q?" checked":""}${_?` ${_}`:""}>`}),J=J.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G="")=>{let K=M1(G),W=K.match(/accept=['"]([^'"]+)['"]/i),z=W?W[1]:"",q=K.includes("multiple"),U=K$(Q,Z),j=K.match(/class=['"]([^'"]+)['"]/i),_=g4(j?j[1]:"",Y.input,U,Y.inputError),B=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${I0(Q)}"`,`class="${_}"`];if(z)H.push(`accept="${I0(z)}"`);if(q)H.push("multiple");if(B)H.push(B);return`${H.join(" ")}>`}),J=J.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(X,Q,G="",K)=>{let W=M1(G),z=W.match(/class=['"]([^'"]+)['"]/i),q=z?z[1]:Y.label,U=W.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${I0(Q)}" class="${q}"${U?` ${U}`:""}>${K}</label>`}),J}function e2($,Z,Y=a2){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,X,Q)=>{try{if(K$(X,Z))return Q.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return r2(X,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(X);return r2(X,Z)}let W=K.trim();if(K0(W)){let z=$0(W,Z);return z!==void 0?String(z):W}return W}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),J}})}function K$($,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 r2($,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 G$($,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 J=$.slice(0,-2);if(Y=Z[J],Y!==void 0)return Y}return Z[$]}function M1($){if(!$.trim())return"";let Z=[],Y=$.trim(),J=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,X;while((X=J.exec(Y))!==null){let[,Q,,G]=X;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}var a2;var $Y=S(()=>{w0();a2={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import l3 from"path";async function Bq(){if(W$!==void 0)return W$;try{W$=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{W$=null}return W$}function Hq($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function Oq($,Z){if({...n3,...Z.i18n}.cache&&c3[$]){let X=c3[$],Q=Z.i18n?.cacheMaxAge??0;if(!Hq(X,Q))return X.translations}if(z$[$]?.state==="loading")return z$[$].promise;m3[$]="loading";let J=i3($,Z).then((X)=>{return m3[$]="loaded",delete z$[$],X}).catch((X)=>{throw m3[$]="error",z$[$]={promise:J,state:"error",error:X instanceof Error?X:Error(String(X))},X});return z$[$]={promise:J,state:"loading"},J}async function i3($,Z){let Y={...n3,...Z.i18n},J=l3.isAbsolute(Y.translationsDir)?Y.translationsDir:l3.resolve(Z.root||process.cwd(),Y.translationsDir);try{let X=await Bq(),Q=X?await X($,{translationsDir:J,defaultLocale:Y.defaultLocale,sources:Aq(Y.format)}):await Lq($,Y,J);if(Q===void 0){if($!==Y.defaultLocale)return i3(Y.defaultLocale,Z);return{}}let G=Q;if(Y.cache)c3[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(X){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,X);if($!==Y.defaultLocale)return i3(Y.defaultLocale,Z);return{}}}async function Lq($,Z,Y){let J=l3.join(Y,`${$}${Fq(Z.format)}`);try{let X=await import(J);return X.default||X}catch(X){try{let Q=await Bun.file(J).text();if(Z.format==="yaml"||Z.format==="yml")return Vq(Q);if(Z.format==="json")return JSON.parse(Q);throw X}catch{return}}}function Fq($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function Vq($){let Z={},Y=$.split(`
|
|
9132
|
+
`),J=[{obj:Z,indent:-1}];for(let X of Y){let Q=X.replace(/#.*$/,"").trimEnd();if(!Q.trim())continue;let G=Q.search(/\S/);if(G===-1)continue;while(J.length>1&&J[J.length-1].indent>=G)J.pop();let K=J[J.length-1].obj,W=Q.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(W){let[,,z,q]=W,U=z.trim(),j=q.trim();if(j==="")K[U]={},J.push({obj:K[U],indent:G});else K[U]=wq(j)}}return Z}function wq($){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 Aq($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function Rq($,Z){return Oq($,Z)}function Nq($,Z){for(let Y of $){let J=Y.trim(),X=J.match(/^\{(\d+)\}\s*(.*)$/);if(X){let G=Number.parseInt(X[1],10);if(Z===G)return X[2];continue}let Q=J.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10),K=Q[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(Q[2],10);if(Z>=G&&Z<=K)return Q[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function Mq($,Z={}){return JY($,Z)}function JY($,Z){let Y="",J=0;while(J<$.length)if($[J]==="{"){let X=Tq($,J);if(X===-1){Y+=$[J],J++;continue}let Q=$.slice(J+1,X);Y+=Iq(Q,Z),J=X+1}else if($[J]==="'"&&J+1<$.length)if($[J+1]==="'")Y+="'",J+=2;else if($[J+1]==="{"||$[J+1]==="}")Y+=$[J+1],J+=2;else Y+=$[J],J++;else Y+=$[J],J++;return Y}function Tq($,Z){let Y=0;for(let J=Z;J<$.length;J++)if($[J]==="{")Y++;else if($[J]==="}"){if(Y--,Y===0)return J}return-1}function Iq($,Z){let Y=Dq($);if(Y.length===0)return`{${$}}`;let J=Y[0].trim(),X=Z[J];if(Y.length===1)return X!==void 0?String(X):`{${J}}`;switch(Y[1].trim().toLowerCase()){case"plural":return Eq(X,Y.slice(2).join(","),Z);case"select":return bq(X,Y.slice(2).join(","));case"selectordinal":return Sq(X,Y.slice(2).join(","));case"number":return Pq(X,Y[2]?.trim());case"date":return Cq(X,Y[2]?.trim());case"time":return vq(X,Y[2]?.trim());default:return X!==void 0?String(X):`{${$}}`}}function Dq($){let Z=[],Y="",J=0;for(let X=0;X<$.length;X++){let Q=$[X];if(Q==="{")J++,Y+=Q;else if(Q==="}")J--,Y+=Q;else if(Q===","&&J===0)Z.push(Y),Y="";else Y+=Q}if(Y)Z.push(Y);return Z}function Eq($,Z,Y){let J=Number($)||0,X=o3(Z),Q=`=${J}`;if(X[Q])return p3(X[Q],J,Y);let G=kq(J);if(X[G])return p3(X[G],J,Y);if(X.other)return p3(X.other,J,Y);return String(J)}function p3($,Z,Y){let J=$.replace(/#/g,String(Z));return JY(J,Y)}function kq($){let Z=Math.abs($),Y=Math.floor(Z),J=String($).includes(".")?String($).split(".")[1].length:0;if(Y===1&&J===0)return"one";return"other"}function bq($,Z){let Y=String($||""),J=o3(Z);if(J[Y])return J[Y];return J.other||String($)}function Sq($,Z){let Y=Number($)||0,J=o3(Z),X=yq(Y);if(J[X])return J[X].replace(/#/g,String(Y));if(J.other)return J.other.replace(/#/g,String(Y));return String(Y)}function yq($){let Z=Math.abs($),Y=Z%10,J=Z%100;if(Y===1&&J!==11)return"one";if(Y===2&&J!==12)return"two";if(Y===3&&J!==13)return"few";return"other"}function o3($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,J=Y.exec($);while(J!==null)Z[J[1]]=J[2],J=Y.exec($);return Z}function Pq($,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 Cq($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let J={};switch(Z){case"short":J.dateStyle="short";break;case"medium":J.dateStyle="medium";break;case"long":J.dateStyle="long";break;case"full":J.dateStyle="full";break;default:J.dateStyle="medium"}return Y.toLocaleDateString(void 0,J)}function vq($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let J={};switch(Z){case"short":J.timeStyle="short";break;case"medium":J.timeStyle="medium";break;case"long":J.timeStyle="long";break;case"full":J.timeStyle="full";break;default:J.timeStyle="short"}return Y.toLocaleTimeString(void 0,J)}function xq($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function ZY($,Z,Y=!0,J={}){let X=$.split("."),Q=Z;for(let K of X){if(Q===void 0||Q===null)break;Q=Q[K]}if(Q===void 0||Q===null)return Y?$:"";let G=String(Q);if(xq(G))return Mq(G,J);if(G.includes("|")&&"count"in J){let K=Number(J.count),W=G.split("|");G=Nq(W,K)}for(let[K,W]of Object.entries(J)){let z=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${z}`,"g"),String(W))}return G}async function XY($,Z,Y,J){let X=$,Q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...n3,...J.i18n},K=await Rq(G.locale,J);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,X=await YY(X,Q,async(q,U,j,_,B)=>{try{let H={};if(j)try{let V=[()=>JSON.parse(j),()=>{let O=`{"data":${j}}`,F=JSON.parse(O);return typeof F.data==="object"?F.data:{}},()=>{return T0(j,Z)}];for(let O of V)try{if(H=O(),Object.keys(H).length>0)break}catch{}}catch(V){if(J.debug)console.error("Error parsing parameters for @translate directive:",V)}return ZY(U,K,G.fallbackToKey,H)||_.trim()}catch(H){if(J.debug)console.error("Error processing @translate directive:",H);return e("Translate",`Error in @translate('${U}'): ${H instanceof Error?H.message:String(H)}`,s.EVALUATION_ERROR)}});let W=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(J.debug){console.warn(`Processing translations in template. Sections: ${X.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let q=[...X.matchAll(W)];console.warn(`Found ${q.length} @translate matches`),q.forEach((U,j)=>console.warn(`Match ${j}: ${U[0]}, Key: ${U[1]}, Params: ${U[2]||"none"}`))}return X=await YY(X,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(q,U,j,_)=>{try{let B={};if(j)try{let H=[()=>JSON.parse(j),()=>{let L=`{"data":${j}}`,V=JSON.parse(L);return typeof V.data==="object"?V.data:{}},()=>{return T0(j,Z)}];for(let L of H)try{if(B=L(),Object.keys(B).length>0)break}catch{}}catch(H){if(J.debug)console.error("Error parsing parameters for @translate directive:",H)}return ZY(U,K,G.fallbackToKey,B)}catch(B){if(J.debug)console.error("Error processing @translate directive:",B);return e("Translate",`Error in @translate('${U}'): ${B instanceof Error?B.message:String(B)}`,s.EVALUATION_ERROR)}}),X}async function YY($,Z,Y){let J=[];return $.replace(Z,(Q,...G)=>{let K=Y(Q,...G).then((W)=>({match:Q,replacement:W}));return J.push(K),Q}),(await Promise.all(J)).reduce((Q,{match:G,replacement:K})=>Q.replace(G,K),$)}var W$,n3,c3,z$,m3;var QY=S(()=>{W1();w0();n3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},c3={},z$={},m3={}});var a3={};a(a3,{streamingSuspenseDirective:()=>WY,streamToResponse:()=>oq,streamTemplateSimple:()=>lq,streamTemplate:()=>gq,renderStreamingPage:()=>dq,registerStreamingDirectives:()=>iq,processStreamDirectives:()=>mq,processSectionDirectives:()=>nq,islandDirective:()=>zY,generateHydrationRuntime:()=>sq,extractStreamBoundaries:()=>pq,createStreamRenderer:()=>cq,buildSuspenseResolveScript:()=>r3,SUSPENSE_RESOLVER_RUNTIME:()=>KY});import d4 from"path";function fq($){let Z=[],Y=0,J;GY.lastIndex=0;while((J=GY.exec($))!==null){if(J.index>Y){let G=$.slice(Y,J.index);if(G.trim())Z.push({type:Z.length===0?"shell":"content",content:G})}let X=J[1],Q=J[2];Z.push({type:"suspense",name:X,content:Q}),Y=J.index+J[0].length}if(Y<$.length){let X=$.slice(Y);if(X.trim())Z.push({type:Z.length===0?"shell":"content",content:X})}if(Z.length===0)Z.push({type:"shell",content:$});return Z}async function gq($,Z={},Y={}){let J={...l1,...Y,streaming:{...s3,...Y.streaming}},X=J.streaming?.bufferSize||16384;return new ReadableStream({async start(Q){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),W=K?K[1]:"",z=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),q={...Z,__filename:$,__dirname:d4.dirname($)};if(W.trim())await f1(W,q,$);let U=fq(z),j=new Set;if(!U.some((B)=>B.type==="suspense")){let B=J.streaming?.strategy||"auto",H=new RegExp(o1.source,"g");if(!(B!=="manual"&&H.test(z))){let V=await O0(z,q,$,J,j);for(let O=0;O<V.length;O+=X)Q.enqueue(V.slice(O,O+X)),await new Promise((F)=>setTimeout(F,0))}else{let V=[],O=new RegExp(o1.source,"g"),F;while((F=O.exec(z))!==null)V.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let w=0;for(let A of V){if(A.start>w){let N=z.slice(w,A.start);if(N.trim()){let M=await O0(N,q,$,J,j);Q.enqueue(M),await new Promise((T)=>setTimeout(T,0))}}let R=await O0(A.content,q,$,J,j);Q.enqueue(R),await new Promise((N)=>setTimeout(N,0)),w=A.end}if(w<z.length){let A=z.slice(w);if(A.trim()){let R=await O0(A,q,$,J,j);Q.enqueue(R)}}}}else{let B=new Map;for(let L of U)if(L.type==="shell"||L.type==="content"){let V=await O0(L.content,q,$,J,j);Q.enqueue(V)}else if(L.type==="suspense"&&L.name){let V=`stx-suspense-${L.name}`;Q.enqueue(`<div id="${V}" data-suspense="${L.name}" style="display:contents;">
|
|
9130
9133
|
<template data-suspense-fallback>Loading...</template>
|
|
9131
9134
|
</div>`),B.set(L.name,O0(L.content,q,$,J,j))}Q.enqueue(`
|
|
9132
9135
|
<script>
|
|
@@ -9150,7 +9153,7 @@ window.__stxSuspense.resolve('${$}', \`${J}\`);
|
|
|
9150
9153
|
</script>`}catch(Y){let J=Y instanceof Error?Y.message:String(Y);return`
|
|
9151
9154
|
<script>
|
|
9152
9155
|
window.__stxSuspense.resolve('${$}', '<div class="stx-error">Error loading content: ${r0(J)}</div>');
|
|
9153
|
-
</script>`}}function hq($,Z,Y){if(!Z||Z<=0)return $;let J,X=new Promise((Q,G)=>{J=setTimeout(()=>G(Error(`streaming boundary "${Y}" timed out after ${Z}ms`)),Z)});return Promise.race([$,X]).finally(()=>clearTimeout(J))}function dq($,Z=[],Y={}){let J=Y.timeoutMs??0;return new ReadableStream({async start(X){try{if(X.enqueue($),Z.length>0)X.enqueue(KY),await Promise.all(Z.map(async(Q)=>{let G=hq(Q.render(),J,Q.id);X.enqueue(await r3(Q.id,G))}));X.close()}catch(Q){X.error(Q)}}})}function
|
|
9156
|
+
</script>`}}function hq($,Z,Y){if(!Z||Z<=0)return $;let J,X=new Promise((Q,G)=>{J=setTimeout(()=>G(Error(`streaming boundary "${Y}" timed out after ${Z}ms`)),Z)});return Promise.race([$,X]).finally(()=>clearTimeout(J))}function dq($,Z=[],Y={}){let J=Y.timeoutMs??0;return new ReadableStream({async start(X){try{if(X.enqueue($),Z.length>0)X.enqueue(KY),await Promise.all(Z.map(async(Q)=>{let G=hq(Q.render(),J,Q.id);X.enqueue(await r3(Q.id,G))}));X.close()}catch(Q){X.error(Q)}}})}function mq($,Z){return $.replace(uq,(Y,J,X)=>{let Q=J.trim(),G=X.split(/@fallback/i),K=G[0].trim(),W=G.length>1?G.slice(1).join("@fallback").trim():"";if(!Z.__streamTemplates)Z.__streamTemplates={};return Z.__streamTemplates[Q]=K,`<div data-suspense="${Q}">${W}</div>`})}function pq($){let Z=$?.streamBoundaries;if(!Z||typeof Z!=="object")return;let Y=Object.entries(Z).filter(([,J])=>typeof J==="function");return Y.length>0?Y.map(([J,X])=>({id:J,render:X})):void 0}async function lq($,Z={},Y={}){let J={...l1,...Y,streaming:{...s3,...Y.streaming}},X=J.streaming?.bufferSize||16384;return new ReadableStream({async start(Q){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),W=K?K[1]:"",z=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),q={...Z,__filename:$,__dirname:d4.dirname($)};if(W.trim())await f1(W,q,$);let U=new Set,j=J.streaming?.strategy||"auto",_=new RegExp(o1.source,"g");if(!(j!=="manual"&&_.test(z))){let H=await O0(z,q,$,J,U);for(let L=0;L<H.length;L+=X)Q.enqueue(H.slice(L,L+X))}else{let H=[],L=new RegExp(o1.source,"g"),V;while((V=L.exec(z))!==null)H.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let O=0;for(let F of H){if(F.start>O){let A=z.slice(O,F.start);if(A.trim()){let R=await O0(A,q,$,J,U);Q.enqueue(R)}}let w=await O0(F.content,q,$,J,U);Q.enqueue(w),O=F.end}if(O<z.length){let F=z.slice(O);if(F.trim()){let w=await O0(F,q,$,J,U);Q.enqueue(w)}}}Q.close()}catch(G){Q.error(G)}}})}async function cq($,Z={}){let Y={...l1,...Z,streaming:{...s3,...Z.streaming}},J=await Bun.file($).text(),X=J.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),Q=X?X[1]:"",G=J.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K=G,W={},z;o1.lastIndex=0;while((z=o1.exec(G))!==null){let j=z[1],_=z[2];W[j]=_}let q=G.replace(o1,"");return{renderShell:async(j={})=>{let _={...j,__filename:$,__dirname:d4.dirname($)};return await f1(Q,_,$),O0(q,_,$,Y,new Set)},renderSection:async(j,_={})=>{try{if(!W[j])return`<div class="error-message">Section "${r0(j)}" not found in template "${r0($)}"</div>`;let B={..._,__filename:$,__dirname:d4.dirname($)};await f1(Q,B,$);let H=new Set;return await O0(W[j],B,$,Y,H)}catch(B){let H=B instanceof Error?B.message:String(B);return q0("Expression",H,$,W[j]||"",0,W[j]||"")}},getSections:()=>{return Object.keys(W)},getTemplate:()=>{return K}}}function iq($={}){let Z=[];if($.streaming?.enabled)Z.push(WY);if($.hydration?.enabled)Z.push(zY);return Z}async function nq($,Z,Y,J={}){return $}function oq($,Z={}){let Y=new TextEncoder,J=$.pipeThrough(new TransformStream({transform(Q,G){G.enqueue(Y.encode(Q))}})),X=new Headers(Z.headers);if(!X.has("Content-Type"))X.set("Content-Type","text/html; charset=utf-8");if(!X.has("Transfer-Encoding"))X.set("Transfer-Encoding","chunked");if(!X.has("X-Content-Type-Options"))X.set("X-Content-Type-Options","nosniff");if(!X.has("X-Accel-Buffering"))X.set("X-Accel-Buffering","no");return new Response(J,{...Z,headers:X})}function sq($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:J=!0}=$,X=Object.entries(Y).map(([Q,G])=>`'${Q}': ${J?`() => import('${G}')`:`require('${G}')`}`).join(`,
|
|
9154
9157
|
`);if(Z==="loader")return`
|
|
9155
9158
|
(function() {
|
|
9156
9159
|
window.__stx = window.__stx || {};
|
|
@@ -9312,18 +9315,18 @@ else {
|
|
|
9312
9315
|
}
|
|
9313
9316
|
};
|
|
9314
9317
|
})();
|
|
9315
|
-
</script>`,
|
|
9318
|
+
</script>`,uq,WY,zY;var t3=S(()=>{c1();Y1();e$();M0();s3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},o1=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,GY=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;uq=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;WY={name:"suspense",hasEndTag:!0,handler:($,Z,Y,J)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let X=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${X} -->${$}<!-- @endsuspense:${X} -->`}},zY={name:"island",hasEndTag:!0,handler:($,Z,Y,J)=>{if(!Z||Z.length===0)throw Error("Island directive requires a name parameter");let X=Z[0].replace(/['"`]/g,""),Q=Z[1]?Z[1].replace(/['"`]/g,""):"lazy",G=`island-${X}-${Math.random().toString(36).substring(2,9)}`,K=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),W=K?K[1].trim():"",z=K?$.replace(K[0],""):$;return`<div data-island="${X}" data-island-id="${G}" data-priority="${Q}">
|
|
9316
9319
|
${z}
|
|
9317
9320
|
<script type="application/json" data-island-props="${G}">
|
|
9318
9321
|
${W?`{${W}}`:"{}"}
|
|
9319
9322
|
</script>
|
|
9320
9323
|
</div>`}}});var jY={};a(jY,{warnUnbalancedTags:()=>e3,findUnbalancedTags:()=>UY});function O5($){return $.replace(/[^\n]/g," ")}function UY($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,O5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,O5).replace(/<!--[\s\S]*?-->/g,O5).replace(/\{\{\{[\s\S]*?\}\}\}/g,O5).replace(/\{\{[\s\S]*?\}\}/g,O5).replace(/\{!![\s\S]*?!!\}/g,O5),Y=new Map,J=new Map,X=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,Q;while((Q=X.exec(Z))!==null){let K=Q[1]==="/",W=Q[2],z=Q[3]==="/";if(rq.has(W.toLowerCase()))continue;if(z)continue;if(K)J.set(W,(J.get(W)??0)+1);else{let q=Y.get(W);if(q)q.count++;else{let U=Z.slice(0,Q.index).split(`
|
|
9321
|
-
`).length;Y.set(W,{count:1,firstLine:U})}}}let G=[];for(let K of new Set([...Y.keys(),...J.keys()])){if(aq.has(K.toLowerCase()))continue;let W=Y.get(K)?.count??0,z=J.get(K)??0;if(W!==z)G.push({tag:K,opened:W,closed:z,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function e3($,Z){let Y;try{Y=UY($)}catch{return}if(Y.length===0)return;let J=`${Z}:${$.length}`;if(qY.has(J))return;qY.add(J);let X=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:Q,opened:G,closed:K,firstOpenLine:W}of Y)if(G>K){let z=W?` (first opened at line ${W})`:"";console.warn(`[stx] ${X}: <${Q}> ${G} opened, ${K} closed \u2014 an unclosed <${Q}>${z} may swallow the content that follows it.`)}else console.warn(`[stx] ${X}: <${Q}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${Q}>.`)}var rq,aq,qY;var $6=S(()=>{rq=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),aq=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);qY=new Set});import i0 from"path";import Z6 from"fs";function _Y($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function BY($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class HY{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,J){let X=$.endsWith(".stx")?$.slice(0,-4):$,Q=J?.__importedComponents;if(Q){let _=[X,X.toLowerCase(),_Y(X),BY(X)];for(let B of _)if(Q.has(B))return Q.get(B)}let G=[...new Set([`${X}.stx`,`${_Y(X)}.stx`,`${BY(X)}.stx`])];if(X.startsWith("./")||X.startsWith("../")){let _=i0.resolve(i0.dirname(Z),`${X}.stx`);if(await c(_))return _;return null}let K=[],W=Y.componentsDir||"",z=J?.__originalFilePath;if(z)K.push(i0.join(i0.dirname(z),"components"));if(W)K.push(W);let q=i0.join(i0.dirname(Z),"components");if(!K.includes(q))K.push(q);let U=process.cwd(),j=[i0.resolve(U,"src/components"),i0.resolve(U,"components"),i0.resolve(import.meta.dir,"components")];for(let _ of j)if(!K.includes(_))K.push(_);for(let _ of K){if(!_)continue;for(let B of G){let H=i0.join(_,B);if(await c(H))return H}try{if(!Z6.statSync(_,{throwIfNoEntry:!1})?.isDirectory())continue;let H=Z6.readdirSync(_,{withFileTypes:!0});for(let L of H)if(L.isDirectory()){let V=i0.join(_,L.name);for(let O of G){let F=i0.join(V,O);if(await c(F))return F}}}catch{}}return null}}var f0;var Y6=S(()=>{M0();f0=new HY});function y0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function L5($,Z){let Y=[];for(let[J,X]of Object.entries($.static)){if(Z.has(J))continue;let Q=$.staticNames?.[J]??J;if(typeof X==="boolean"){if(X)Y.push(y0(Q));continue}Y.push(`${y0(Q)}="${y0(X)}"`)}return Y}var
|
|
9324
|
+
`).length;Y.set(W,{count:1,firstLine:U})}}}let G=[];for(let K of new Set([...Y.keys(),...J.keys()])){if(aq.has(K.toLowerCase()))continue;let W=Y.get(K)?.count??0,z=J.get(K)??0;if(W!==z)G.push({tag:K,opened:W,closed:z,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function e3($,Z){let Y;try{Y=UY($)}catch{return}if(Y.length===0)return;let J=`${Z}:${$.length}`;if(qY.has(J))return;qY.add(J);let X=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:Q,opened:G,closed:K,firstOpenLine:W}of Y)if(G>K){let z=W?` (first opened at line ${W})`:"";console.warn(`[stx] ${X}: <${Q}> ${G} opened, ${K} closed \u2014 an unclosed <${Q}>${z} may swallow the content that follows it.`)}else console.warn(`[stx] ${X}: <${Q}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${Q}>.`)}var rq,aq,qY;var $6=S(()=>{rq=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),aq=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);qY=new Set});import i0 from"path";import Z6 from"fs";function _Y($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function BY($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class HY{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,J){let X=$.endsWith(".stx")?$.slice(0,-4):$,Q=J?.__importedComponents;if(Q){let _=[X,X.toLowerCase(),_Y(X),BY(X)];for(let B of _)if(Q.has(B))return Q.get(B)}let G=[...new Set([`${X}.stx`,`${_Y(X)}.stx`,`${BY(X)}.stx`])];if(X.startsWith("./")||X.startsWith("../")){let _=i0.resolve(i0.dirname(Z),`${X}.stx`);if(await c(_))return _;return null}let K=[],W=Y.componentsDir||"",z=J?.__originalFilePath;if(z)K.push(i0.join(i0.dirname(z),"components"));if(W)K.push(W);let q=i0.join(i0.dirname(Z),"components");if(!K.includes(q))K.push(q);let U=process.cwd(),j=[i0.resolve(U,"src/components"),i0.resolve(U,"components"),i0.resolve(import.meta.dir,"components")];for(let _ of j)if(!K.includes(_))K.push(_);for(let _ of K){if(!_)continue;for(let B of G){let H=i0.join(_,B);if(await c(H))return H}try{if(!Z6.statSync(_,{throwIfNoEntry:!1})?.isDirectory())continue;let H=Z6.readdirSync(_,{withFileTypes:!0});for(let L of H)if(L.isDirectory()){let V=i0.join(_,L.name);for(let O of G){let F=i0.join(V,O);if(await c(F))return F}}}catch{}}return null}}var f0;var Y6=S(()=>{M0();f0=new HY});function y0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function L5($,Z){let Y=[];for(let[J,X]of Object.entries($.static)){if(Z.has(J))continue;let Q=$.staticNames?.[J]??J;if(typeof X==="boolean"){if(X)Y.push(y0(Q));continue}Y.push(`${y0(Q)}="${y0(X)}"`)}return Y}var u4=()=>{};function q$($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function tq($){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 J6;var X6=S(()=>{u4();J6={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let J=tq($),X=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),Q=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,W=[];if(J.reactive)W.push(`:href="${q$(J.value)}"`);else W.push(`href="${q$(J.value)}"`);if(X)W.push(`class="${q$(X)}"`);if(W.push("data-stx-link"),W.push(`data-stx-active-class="${q$(Q)}"`),W.push(`data-stx-exact-active-class="${q$(G)}"`),K)W.push("data-stx-prefetch");let z=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return W.push(...L5($,z)),`<a ${W.join(" ")}>${Z}</a>`}}});function E0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function P0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function G6($,Z,Y=!1){let J=$.serverDynamic[Z];if(J!==void 0)return J!==!1&&J!=="false";let X=$.static[Z];if(X!==void 0)return X!=="false"&&X!==!1;return Y}function OY($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let J of Z)if(J.includes(":")){let[X,Q]=J.split(":"),G=eq[X];if(G)Y.push(`(max-width: ${G}px) ${Q}`);else{let K=Number.parseInt(X);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${Q}`)}}else Y.push(J);return Y.join(", ")}function K6($,Z,Y,J){return Z.map((X)=>`${U$($,X,void 0,Y,J)} ${X}w`).join(", ")}function $U($,Z,Y,J,X){return Z.map((Q)=>{let G=Y?Y*Q:void 0;return`${U$($,G,void 0,J,X)} ${Q}x`}).join(", ")}function U$($,Z,Y,J,X){if(!J||J==="local"||J==="static")return $;if(J==="cloudinary"){let Q=[];if(Z)Q.push(`w_${Z}`);if(Y)Q.push(`h_${Y}`);if(X)Q.push(`f_${X}`);Q.push("q_auto");let G=Q.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(J==="imgix"){let Q=new URLSearchParams;if(Z)Q.set("w",String(Z));if(Y)Q.set("h",String(Y));if(X)Q.set("fm",X);Q.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}if(J==="bunny"){let Q=new URLSearchParams;if(Z)Q.set("width",String(Z));if(Y)Q.set("height",String(Y));if(X)Q.set("format",X);let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}return $}function ZU($,Z,Y="#e5e7eb"){let J=`<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(J)}`}var eq,Q6,W6;var z6=S(()=>{u4();eq={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Q6=[320,640,768,1024,1280,1536,1920];W6={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let J=P0($,"src")||"",X=P0($,"alt")||"",Q=P0($,"width"),G=P0($,"height"),K=P0($,"sizes"),W=P0($,"srcset"),z=P0($,"densities"),q=P0($,"format"),U=P0($,"placeholder"),j=P0($,"placeholderColor")||"#e5e7eb",_=P0($,"provider"),B=P0($,"class")||P0($,"className")||"",H=P0($,"style")||"",L=P0($,"quality"),V=G6($,"lazy",!0),O=G6($,"preload",!1),F=G6($,"picture",!1)||!!q,w=Q?Number.parseInt(Q):void 0,A=G?Number.parseInt(G):void 0,R=W||"",N="";if(!R&&K)R=K6(J,Q6,_,q),N=OY(K);else if(!R&&z){let b=z.split(/\s+/).map((k)=>Number.parseFloat(k.replace("x","")));R=$U(J,b,w,_,q)}else if(K)N=OY(K);let M=[];if(H)M.push(H);if(w&&A)M.push(`aspect-ratio:${w}/${A}`);if(U==="blur"||U==="color"||U==="thumbhash"){let b=ZU(w||16,A||9,j);M.push(`background-image:url(${b})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat")}else if(U&&U!=="empty"&&U!=="none")M.push(`background-image:url(${E0(U)})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat");let T=U$(J,w,A,_,q),I=[];if(I.push(`src="${E0(T)}"`),I.push(`alt="${E0(X)}"`),Q)I.push(`width="${E0(Q)}"`);if(G)I.push(`height="${E0(G)}"`);if(V)I.push('loading="lazy"');if(I.push('decoding="async"'),B)I.push(`class="${E0(B)}"`);if(M.length>0)I.push(`style="${E0(M.join(";"))}"`);if(R)I.push(`srcset="${E0(R)}"`);if(N)I.push(`sizes="${E0(N)}"`);let E=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);I.push(...L5($,E));let D=`<img ${I.join(" ")} />`,y="";if(O){let k=q==="webp"?"image/webp":q==="avif"?"image/avif":"";y=`<link rel="preload" as="image" href="${E0(T)}"${k?` type="${k}"`:""}${R?` imagesrcset="${E0(R)}"`:""}${N?` imagesizes="${E0(N)}"`:""} />
|
|
9322
9325
|
`}if(F){let b=[];if(q==="avif"||q==="auto"){let k=U$(J,w,A,_,"avif"),v=R?K6(J,Q6,_,"avif"):`${k}`;b.push(`<source type="image/avif" srcset="${E0(v)}"${N?` sizes="${E0(N)}"`:""} />`)}if(q==="webp"||q==="auto"){let k=U$(J,w,A,_,"webp"),v=R?K6(J,Q6,_,"webp"):`${k}`;b.push(`<source type="image/webp" srcset="${E0(v)}"${N?` sizes="${E0(N)}"`:""} />`)}return`${y}<picture>
|
|
9323
9326
|
${b.join(`
|
|
9324
9327
|
`)}
|
|
9325
9328
|
${D}
|
|
9326
|
-
</picture>`}return`${y}${D}`}}});function j$($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function F5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var LY="/images/safe-image-default.svg",YU,q6;var U6=S(()=>{
|
|
9329
|
+
</picture>`}return`${y}${D}`}}});function j$($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function F5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var LY="/images/safe-image-default.svg",YU,q6;var U6=S(()=>{u4();YU=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${LY}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,q6={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,Y){let J=F5($,"src")||"",X=F5($,"alt")||"",Q=F5($,"fallback")||LY,G=F5($,"class")||F5($,"className")||"",K=F5($,"fallbackClassName")||"",W=[];if(W.push(`src="${j$(J)}"`),W.push(`alt="${j$(X)}"`),G)W.push(`class="${j$(G)}"`);if(W.push(`data-fallback="${j$(Q)}"`),K)W.push(`data-fallback-class="${j$(K)}"`);W.push('onerror="window.__stxSafeImageHandler(this)"');let z=new Set(["src","alt","fallback","class","className","fallbackClassName"]);W.push(...L5($,z));let q=`<img ${W.join(" ")} />`,U=Y.context;if(!U.__safeImageHandlerEmitted)return U.__safeImageHandlerEmitted=!0,`${YU}${q}`;return q}}});function j6($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function _$($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function m4($,Z,Y){let J=_$($,Z);if(J!==void 0){let X=Number.parseInt(J,10);if(!Number.isNaN(X))return X}return Y}var _6;var B6=S(()=>{_6={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,Y){let J=j6(_$($,"color")||"#6366f1"),X=j6(_$($,"initialColor")||_$($,"initial-color")||""),Q=j6(_$($,"height")||"3px"),G=m4($,"duration",2000),K=m4($,"throttle",200),W=m4($,"zIndex",999999)||m4($,"z-index",999999),z=X?`linear-gradient(to right, ${X}, ${J})`:J;return`
|
|
9327
9330
|
<div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${Q};background:${z};z-index:${W};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
|
|
9328
9331
|
<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>
|
|
9329
9332
|
</div>
|
|
@@ -9357,7 +9360,7 @@ ${D}
|
|
|
9357
9360
|
.stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
|
|
9358
9361
|
.stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
|
|
9359
9362
|
</style>`}}});import{existsSync as XU,readFileSync as QU}from"fs";function GU($){if(RY.has($))return;RY.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function KU($){let Z=process.cwd();for(let Y of[`${Z}/node_modules/@iconify-json/${$}/icons.json`,`${Z}/pantry/@iconify-json/${$}/icons.json`,`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(XU(Y))return Y;for(let Y of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return j0.resolve(Y)}catch{}return null}function WU($){if(l4.has($))return l4.get($);let Z=KU($);if(!Z)return GU($),null;try{let Y=JSON.parse(QU(Z,"utf8"));return l4.set($,Y.icons),Y.icons}catch{return null}}function w5($,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 l4,RY,A6;var R6=S(()=>{l4=new Map,RY=new Set;A6={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let J=w5($,"name")??w5($,"icon");if(!J)return"<!-- Icon: missing name/icon prop -->";let X="lucide",Q=J;if(J.includes(":")){let O=J.split(":");X=O[0],Q=O[1]}let G=y0(w5($,"size")||"24"),K=y0(w5($,"color")||"currentColor"),W=y0(w5($,"class")||""),z=y0(w5($,"style")||""),q=l4.get(X)??WU(X);if(!q)return`<!-- Icon: collection "${X}" not loaded -->`;let U=q[Q];if(!U)return`<!-- Icon: "${Q}" not found in ${X} -->`;let j=U.width||24,_=U.height||24,B=`0 0 ${j} ${_}`,H=U.body;if(K!=="currentColor")H=H.replace(/currentColor/g,K);let L=W?` class="${W}"`:"",V=z?` style="${z}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${B}" fill="none"${L}${V}>${H}</svg>`}}});function NY($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let J=$.static[Y];if(typeof J==="string")return J}return}function MY($,Z){let Y=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),J=$.match(Y);if(!J)return{region:null,rest:$};return{region:J[2],rest:$.replace(J[0],"")}}var N6;var M6=S(()=>{N6={name:"Suspense",aliases:["suspense"],render($,Z,Y){let J=MY(Z,"fallback"),X=J.rest,Q=MY(X,"error"),G=Q.rest,K=J.region??NY($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',W=Q.region??NY($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${K}</div><div data-stx-suspense-error hidden>${W}</div><div data-stx-suspense-content hidden>${G}</div></div>`}}});function c4($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let J=$.static[Y];if(typeof J==="string")return J}return}var T6;var I6=S(()=>{T6={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let J=(c4($,"name")||"v").replace(/["'<>]/g,""),X=(c4($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=c4($,"class"),G=c4($,"id"),K=[`data-stx-transition-group="${J}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${X} ${K}>${Z}</${X}>`}}});function TY(){f0.registerBuiltin(J6),f0.registerBuiltin(W6),f0.registerBuiltin(q6),f0.registerBuiltin(_6),f0.registerBuiltin(H6),f0.registerBuiltin(L6),f0.registerBuiltin(V6),f0.registerBuiltin(A6),f0.registerBuiltin(N6),f0.registerBuiltin(T6)}var IY=S(()=>{X6();z6();U6();B6();O6();F6();w6();R6();M6();I6();Y6();X6();z6();U6();B6();O6();F6();w6();R6();M6();I6()});function i4($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function DY($,Z,Y){let J=[],X=0;while(X<$.length){let Q=$.indexOf("<",X);if(Q===-1)break;let K=$.slice(Q+1).match(new RegExp(`^(${Z.source})`));if(!K){X=Q+1;continue}let W=K[1];if(Y&&Y.has(W.toLowerCase())){let H=Q+1+W.length;while(H<$.length&&$[H]!==">")H++;X=H+1;continue}let z=Q+1+W.length,q=null,U=z,j=-1,_=!1;while(z<$.length){let H=$[z];if(q){if(H==="\\"&&z+1<$.length){z+=2;continue}if(H===q)q=null;z++;continue}if(H==='"'||H==="'"){q=H,z++;continue}if(H==="/"&&z+1<$.length&&$[z+1]===">"){j=z+2,_=!0;break}if(H===">"){j=z+1;break}z++}if(j===-1){X=Q+1;continue}let B=$.slice(U,_?j-2:j-1).trim();if(_)J.push({fullMatch:$.slice(Q,j),tagName:W,attributes:B,content:"",startIndex:Q,endIndex:j,isSelfClosing:!0}),X=j;else{let H=`<${W}`,L=`</${W}>`,V=1,O=j,F=-1;while(V>0&&O<$.length){let R=$.indexOf(H,O),N=$.indexOf(L,O);if(N===-1)break;if(R!==-1&&R<N){let M=$[R+H.length];if(M===" "||M===">"||M==="/"||M===`
|
|
9360
|
-
`||M==="\t")V++;O=R+H.length}else{if(V--,V===0){F=N;break}O=N+L.length}}if(F===-1){X=j;continue}let w=$.slice(j,F),A=F+L.length;J.push({fullMatch:$.slice(Q,A),tagName:W,attributes:B,content:w,startIndex:Q,endIndex:A,isSelfClosing:!1}),X=A}}return J}function EY($,Z){try{let Y=Buffer.from($,"base64").toString("utf8");return JSON.parse(Y)}catch{}try{let Y=$.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(Y)}catch(Y){if(Z?.debug)console.error("Error decoding __stx_ prop:",Y);return $}}var kY=S(()=>{w0();M0();C1()});var xY={};a(xY,{processESImports:()=>CY,processComponents:()=>o4});import n4 from"fs";import u0 from"path";function qU($,Z,Y){let J={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},X=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"]),Q=(K)=>{if(!K.includes("-")||K.startsWith("@")||K.startsWith(":")||K.startsWith("x-")||K.startsWith("__"))return K;if(K.startsWith("aria-")||K.startsWith("data-"))return K;return K.replace(/-([a-z0-9])/g,(W,z)=>z.toUpperCase())},G=(K,W)=>{let z=Q(K);if(J.static[z]=W,z!==K)J.staticNames[z]=K};for(let[K,W]of Object.entries($)){let z=K.startsWith("x-")&&!X.has(K)&&!K.startsWith("x-bind:")&&!K.startsWith("x-on:")?`:${K.slice(2)}`:K;if(z.startsWith("@")){J.events[z]=W;continue}if(z.startsWith("__stx_")){let q=Q(z.slice(6));J.serverDynamic[q]=EY(W,Y);continue}if(z.startsWith(":")){let q=Q(z.slice(1)),U=W===D6?q:W;if(q==="if"||q==="for"||q==="show"){J.clientReactive[q]=U;continue}try{if(!K0(U)){if(Y.debug)console.error(`Unsafe expression in :${q} binding: ${U}`);J.clientReactive[q]=U;continue}let j=Object.keys(Z),B=W0(U,j)(...Object.values(Z));if(B===void 0){let H=U.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],L=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(H.some((O)=>!L.has(O)&&!j.includes(O))){J.clientReactive[q]=U;continue}}J.serverDynamic[q]=B}catch{J.clientReactive[q]=U}continue}if(typeof W==="string"&&W.includes("{{")&&W.includes("}}")){let q=W.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(q)try{let U=q[1];if(K0(U)){let _=W0(U,Object.keys(Z))(...Object.values(Z));G(z,_!=null?String(_):"")}else{if(Y.debug)console.error(`Unsafe expression in ${z}: ${U}`);G(z,W)}}catch(U){if(Y.debug)console.error(`Error evaluating expression for ${z}:`,U);G(z,W)}else{let U=W,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=j.exec(W))!==null)try{let B=_[1];if(!K0(B)){if(Y.debug)console.error(`Unsafe expression in ${z}: ${B}`);continue}let L=W0(B,Object.keys(Z))(...Object.values(Z));U=U.replace(_[0],String(L??""))}catch(B){if(Y.debug)console.error(`Error evaluating expression in ${z}:`,B)}G(z,U)}continue}G(z,W===D6?"true":W)}return J}function UU($){let Z={},Y=0,J=$.length;while(Y<J){while(Y<J&&/\s/.test($[Y]))Y++;if(Y>=J)break;let X="";while(Y<J&&!/[\s=]/.test($[Y]))X+=$[Y],Y++;if(!X)break;while(Y<J&&/\s/.test($[Y]))Y++;if(Y<J&&$[Y]==="="){Y++;while(Y<J&&/\s/.test($[Y]))Y++;let Q="";if(Y<J&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<J){let K=$[Y];if(K==="\\"&&Y+1<J){Y++,Q+=$[Y],Y++;continue}if(K===G){Y++;break}Q+=K,Y++}}else while(Y<J&&!/\s/.test($[Y]))Q+=$[Y],Y++;Z[X]=Q}else Z[X]=D6}return Z}function SY($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function jU($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,J;while((J=Y.exec($))!==null){let X=J[1];if(f0.isBuiltin(X))Z.add(X)}return[...Z].sort()}function _U($){let Z=yY.get($);if(Z)return Z;let Y=new Map,J=[u0.join($,"src"),u0.join($,"dist"),$];function X(Q,G){if(G>6)return;let K;try{K=n4.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let W of K){let z=u0.join(Q,W.name);if(W.isDirectory()){if(W.name==="node_modules"||W.name.startsWith("."))continue;X(z,G+1)}else if(W.isFile()&&W.name.endsWith(".stx")){let q=W.name.slice(0,-4);if(!Y.has(q))Y.set(q,z);let U=q.toLowerCase();if(!Y.has(U))Y.set(U,z);let j=q.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(j))Y.set(j,z)}}}for(let Q of J)if(X(Q,0),Y.size>0)break;return yY.set($,Y),Y}function BU($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let J=u0.join(Y,"node_modules",$);try{if(n4.statSync(J).isDirectory())return J}catch{}let X=u0.dirname(Y);if(X===Y)return null;Y=X}}async function CY($,Z,Y,J,X){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=u0.dirname(Y),K=$,W=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(W,(z,q,U)=>{let j=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,_=U,B,H=[];while((B=j.exec(U))!==null){let[L,V,O,F]=B,w=null,A=null;if(F.startsWith(".")||F.startsWith("/")){let M=u0.resolve(G,F);if(M.endsWith(".stx"))A=M;else{let T=`${M}.stx`;try{if(n4.statSync(T).isFile())A=T}catch{try{if(n4.statSync(M).isDirectory())w=M}catch{}}}}else w=BU(F,G);if(!w&&!A)continue;let R=!1,N=(M,T)=>{Q.set(M,T),Q.set(M.toLowerCase(),T);let I=M.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(I,T),X.add(T)};if(O&&A)N(O,A),R=!0;else if(V){let M=V.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let E=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(E)return{source:E[1],local:E[2]};return{source:I,local:I}}),T=w?_U(w):null;for(let{source:I,local:E}of M){let D=null;if(A)D=A;else if(T)D=T.get(I)??T.get(I.toLowerCase())??T.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(D)N(E,D),R=!0}}if(R)H.push({start:B.index,end:B.index+L.length})}if(H.length===0)return z;for(let L=H.length-1;L>=0;L--)_=_.slice(0,H[L].start)+_.slice(H[L].end);return`<script${q}>${_}</script>`}),K}async function HU($,Z,Y,J,X){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,W;while((W=K.exec(Q))!==null){let[z,q]=W,U=q.split(",").map((j)=>j.trim().replace(/^['"]|['"]$/g,"")).filter((j)=>j.length>0);for(let j of U){let _=j.split("/"),H=_[_.length-1].replace(/\.stx$/,""),L=H.includes("-")?H.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),V=null,O=[u0.resolve(u0.dirname(Y),`${j}.stx`),u0.resolve(u0.dirname(Y),j),u0.resolve(J.componentsDir||"components",`${j}.stx`),u0.resolve(J.componentsDir||"components",j),j.endsWith(".stx")?j:`${j}.stx`];for(let F of O)try{if(await Bun.file(F).exists()){V=F;break}}catch{}if(V){G.set(L,V),G.set(H,V),G.set(H.toLowerCase(),V);let F=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(F,V),X.add(V),J.debug)console.log(`Imported component: ${L} -> ${V}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${j}`)}Q=Q.replace(z,""),K.lastIndex=0}return Q}async function OU($,Z,Y,J,X){let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,W=/@component\s*\(/g,z;while((z=W.exec(Q))!==null){let q=z.index,U=q+z[0].length-1,j=1,_=U+1;while(_<Q.length&&j>0){if(Q[_]==="(")j++;else if(Q[_]===")"){if(j--,j===0)break}_++}if(j!==0)break;let B=Q.substring(U+1,_),H=_+1,L=B.match(/^\s*['"]([^'"]+)['"]/);if(!L){W.lastIndex=0;continue}let V=L[1],O,F=B.slice(L[0].length),w=F.match(/^\s*,\s*/);if(w)O=F.slice(w[0].length).trim();let A={};if(O)try{A=T0(O,Z)}catch(E){let D=E instanceof Error?E.message:String(E);Q=Q.replace(Q.substring(q,H),`[Error parsing component props: ${D}]`);continue}let R="",N=H,T=Q.substring(H).match(/^([\s\S]*?)@endcomponent/);if(T)R=T[1].trim(),N=H+T[0].length;let I=await d1(V,A,R,G,Z,Y,J,K,X);Q=Q.substring(0,q)+I+Q.substring(N),W.lastIndex=0}return Q}async function LU($,Z,Y,J,X){if(!$)return $;let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,W=L1(Q);return Q=W.output,Q=await j(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await j(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await j(Q,/[a-z][a-z0-9]*/,!1,zU),Q=m5(Q,W.scripts),Q;async function j(_,B,H,L){if(!_)return _;let V=_,O=DY(V,B,L);for(let F=O.length-1;F>=0;F--){let w=O[F],A=H?i4(w.tagName):w.tagName,R=UU(w.attributes),N=qU(R,Z,J),M=f0.getBuiltin(w.tagName),T=M?await t$(A,G,Z,Y,J):!1;if(M&&!T){let y={context:Z,filePath:Y,options:J,dependencies:X},b=M.render(N,w.content,y);if(Object.keys(N.clientReactive).length>0)b=PY(b,N.clientReactive);if(Object.keys(N.events).length>0){let k=Object.entries(N.events).map(([v,g])=>`${v}="${SY(g)}"`).join(" ");b=b.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${k}`)}V=V.substring(0,w.startIndex)+b+V.substring(w.endIndex);continue}if(!H&&w.tagName.includes("-")&&!await t$(A,G,Z,Y,J))continue;let I={};for(let[y,b]of Object.entries(N.static))I[y]=b;for(let[y,b]of Object.entries(N.serverDynamic))I[y]=b;let D=await d1(A,I,w.content,G,Z,Y,J,K,X);if(Object.keys(N.clientReactive).length>0)D=PY(D,N.clientReactive);if(Object.keys(N.events).length>0){let y=vY(D);if(y){let b=Object.entries(N.events).map(([v,g])=>`${v}="${SY(g)}"`).join(" "),k=Object.keys(N.events).map((v)=>v.replace(/^@/,"").split(".")[0]).join(" ");D=D.substring(0,y.insertPos)+` data-stx-parent-events="${k}" ${b}`+D.substring(y.insertPos)}}V=V.substring(0,w.startIndex)+D+V.substring(w.endIndex)}return V}}function PY($,Z){let Y=new Set(["if","for"]),J=new Set(["show"]),X=Object.entries(Z).filter(([q])=>!Y.has(q)),Q=X.filter(([q])=>!J.has(q)).map(([q])=>i4(q)).join(" "),G=$,K=X.length>0?vY(G):null;if(K){let q=X.map(([j,_])=>`:${i4(j)}="${_.replace(/"/g,""")}"`).join(" "),U=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,K.insertPos)+`${U} ${q}`+G.substring(K.insertPos)}let W=Z.if;if(W)G=`<template :if="${W.replace(/"/g,""")}">${G}</template>`;let z=Z.for;if(z)G=`<template :for="${z.replace(/"/g,""")}">${G}</template>`;return G}function vY($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let Y=0;while(Y<$.length){let J=$.slice(Y),X=J.match(/^\s+/);if(X){Y+=X[0].length;continue}if(J.startsWith("<!--")){let K=$.indexOf("-->",Y+4);if(K===-1)return null;Y=K+3;continue}let Q=J.match(/^<(script|style)\b[^>]*>/i);if(Q){let K=`</${Q[1].toLowerCase()}>`,W=$.toLowerCase().indexOf(K,Y+Q[0].length);if(W===-1)return null;Y=W+K.length;continue}let G=J.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:Y+1+G[1].length}}return null}async function o4($,Z,Y,J,X){if(!bY)TY(),bY=!0;let Q=await CY($,Z,Y,J,X);Q=await HU(Q,Z,Y,J,X),Q=await OU(Q,Z,Y,J,X);let G=[];for(let K=0;K<3;K++){let W=Z1(Q,d5,(q,U)=>`\x00STX_COMPONENT_COMMENT_${G.length+U}\x00`);G.push(...W.tokens);let z=Q;if(Q=await LU(W.output,Z,Y,J,X),Q===z)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(K,W)=>G[Number(W)]??"");if(J.debug){let K=jU(Q);if(K.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${K.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}var bY=!1,D6="\x00stx-boolean-attribute",zU,yY;var E6=S(()=>{Y6();IY();kY();C1();M0();w0();zU=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"]);yY=new Map});var pY={};a(pY,{processLoops:()=>k6});function wU($,Z){let Y=/@component\s*\(/g,J=$,X,Q=[];while((X=Y.exec(J))!==null){let G=X.index,K=G+X[0].length-1,W=1,z=K+1;while(z<J.length&&W>0){if(J[z]==="(")W++;else if(J[z]===")"){if(W--,W===0)break}z++}if(W!==0)continue;let q=J.substring(K+1,z),U=z+1,j=q.match(/^\s*['"]([^'"]+)['"]/);if(!j)continue;let _=j[1],B=q.slice(j[0].length),H=B.match(/^\s*,\s*/);if(!H)continue;let L=B.slice(H[0].length).trim();if(!L)continue;try{let V=T0(L,Z),O=JSON.stringify(V),F=`@component('${_}', ${O})`;Q.push({start:G,end:U,replacement:F})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:z}=Q[G];J=J.substring(0,K)+z+J.substring(W)}return J}function s4($,Z,Y){let J=$,X=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=X.exec(J))!==null){let G=Q.index,K=G+Q[0].length-1,W=1,z=K+1,q=null,U=!1;while(z<J.length&&W>0){let B=J[z];if(U){U=!1,z++;continue}if(B==="\\"&&q){U=!0,z++;continue}if(q){if(B===q)q=null;z++;continue}if(B==='"'||B==="'"||B==="`"){q=B,z++;continue}if(B==="(")W++;else if(B===")"){if(W--,W===0)break}z++}if(W!==0)break;let j=J.substring(K+1,z),_=Y(j);J=J.substring(0,G)+_+J.substring(z+1)}return J}function AU($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(J,X)=>{if(X in Z)return`:${X}="${X}"`;return J}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(J,X,Q)=>{try{let G=Object.keys(Z),K=Object.values(Z);N$(Q);let z=W0(Q,G)(...K),q=JSON.stringify(z),U=Buffer.from(q,"utf8").toString("base64");return`__stx_${X}="${U}"`}catch(G){return J}}),Y}function RU($,Z){let Y=$;return Y=s4(Y,"@break",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(K0(Q)){let K=W0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean($0(Q,Z));return G?r4:""}catch{return""}}),Y=s4(Y,"@continue",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(K0(Q)){let K=W0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean($0(Q,Z));return G?a4:""}catch{return""}}),Y}function NU($){let Z=$;return Z=Z.replace(/@break(?!\()/g,r4),Z=Z.replace(/@continue(?!\()/g,a4),Z}function fY($){let Z=$.includes(r4),Y=Z?$.substring(0,$.indexOf(r4)):$;return{hasBreak:Z,content:Y}}function gY($){let Z=$.includes(a4),Y=Z?$.substring(0,$.indexOf(a4)):$;return{hasContinue:Z,content:Y}}function dY($){let Z=$;return Z=s4(Z,"@break",(Y)=>{let J=Y.trim();if(!M$(J))return"";return`\`; if (${J}) { break; } result += \``}),Z=s4(Z,"@continue",(Y)=>{let J=Y.trim();if(!M$(J))return"";return`\`; if (${J}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function MU($){let Z=/@forelse\s*\(/g,Y,J=[],X=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=X.exec($))!==null)J.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)J.push({pos:G.index,delta:-1});J.sort((q,U)=>q.pos-U.pos);let K=[],W=0;for(let q of J)W+=q.delta,K.push({pos:q.pos,depth:W});function z(q){let U=0,j=K.length-1,_=0;while(U<=j){let B=U+j>>1;if(K[B].pos<=q)_=K[B].depth,U=B+1;else j=B-1}return _}while((Y=Z.exec($))!==null){if(z(Y.index)>0)continue;let q=Y.index,U=Y.index+Y[0].length-1,j=1,_=U+1,B=-1;while(_<$.length&&j>0){if($[_]==="(")j++;else if($[_]===")"){if(j--,j===0){B=_;break}}_++}if(B===-1)continue;let H=$.substring(U+1,B),L=H.indexOf(" as ");if(L===-1)continue;let V=H.substring(0,L).trim(),O=H.substring(L+4).trim(),F=B+1,w=1,A=F,R=/@forelse\s*\(/g,N=/@endforelse/g,M=-1;while(w>0&&A<$.length){R.lastIndex=A,N.lastIndex=A;let b=R.exec($),k=N.exec($);if(!k)break;if(b&&b.index<k.index)w++,A=b.index+b[0].length;else{if(w--,w===0){M=k.index;break}A=k.index+11}}if(M===-1)continue;let T=$.substring(F,M),I=M+11,E=-1,D=0,y=0;while(y<T.length){let b=T.indexOf("@",y);if(b===-1)break;let k=T.substring(b);if(/^@forelse\s*\(/.test(k))D++,y=b+1;else if(k.startsWith("@endforelse"))D--,y=b+11;else if(D===0&&k.startsWith("@empty")){if(T.length<=b+6||!/[a-z]/i.test(T[b+6])){E=b;break}y=b+1}else y=b+1}if(E===-1)continue;return{start:q,end:I,arrayExpr:V,itemVar:O,foreachContent:T.substring(0,E),emptyContent:T.substring(E+6)}}return null}function hY($,Z){let Y=$;while(!0){let J=MU(Y);if(!J)break;let{start:X,end:Q,arrayExpr:G,itemVar:K,foreachContent:W,emptyContent:z}=J;try{let q;if(K0(G))q=W0(G,Object.keys(Z))(...Object.values(Z));else q=$0(G,Z);let U;if(!Array.isArray(q)||q.length===0)U=z;else U=`@foreach (${G} as ${K})${W}@endforeach`;Y=Y.substring(0,X)+U+Y.substring(Q)}catch(q){let U=q instanceof Error?q.message:String(q),j=e("Forelse",`Error in @forelse(${G} as ${K}): ${U}`,s.EVALUATION_ERROR);Y=Y.substring(0,X)+j+Y.substring(Q)}}return Y}function k6($,Z,Y,J){let X=$;X=hY(X,Z);function Q(W){let z=/@foreach\s*\(/g,q;while((q=z.exec(W))!==null){let U=q.index,j=q.index+q[0].length-1,_=1,B=j+1,H=-1;while(B<W.length&&_>0){if(W[B]==="(")_++;else if(W[B]===")"){if(_--,_===0){H=B;break}}B++}if(H===-1)continue;let L=W.substring(j+1,H),V=L.indexOf(" as ");if(V===-1)continue;let O=U,F=L.substring(0,V),w=L.substring(V+4),A=H+1,R=1,N=A,M=/@foreach\s*\(/g,T=/@endforeach/g;while(R>0&&N<W.length){M.lastIndex=N,T.lastIndex=N;let I=M.exec(W),E=T.exec(W);if(!E)break;if(I&&I.index<E.index)R++,N=I.index+I[0].length;else{if(R--,R===0){let D=W.substring(A,E.index),y=E.index+11;return{start:O,end:y,arrayExpr:F,itemVar:w,content:D}}N=E.index+11}}}return null}function G(W,z){let q=W;while(!0){let U=Q(q);if(!U)break;let{start:j,end:_,arrayExpr:B,itemVar:H,content:L}=U;try{let V=B.trim(),O;if(K0(V))O=W0(V,Object.keys(z))(...Object.values(z));else O=$0(V,z);let F=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),F=!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),F=!0;else{let E=e("Foreach",`Error in @foreach: ${V} is not iterable`,s.TYPE_ERROR);q=q.substring(0,j)+E+q.substring(_);continue}let w=J?.loops?.useAltLoopVariable??VU,A=H.trim(),R=null,N,M=!1;if(A.includes("=>")){let E=A.split("=>").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])R=E[0],N=E[1];else N=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let E=A.split(",").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])N=E[0],R=E[1],M=!0;else N=A}else N=A;let T="",I=O;for(let E=0;E<I.length;E++){let D=I[E],y={index:E,iteration:E+1,first:E===0,last:E===I.length-1,count:I.length},b={...z,loop:y,$loop:y};if(N.startsWith("[")&&N.endsWith("]")){let f=N.slice(1,-1).split(",").map((d)=>d.trim());if(Array.isArray(D))f.forEach((d,p)=>{if(d)b[d]=D[p]});else b[N]=D}else b[N]=D;if(R)if(!M&&F&&Array.isArray(D)&&D.length===2)b[R]=D[0],b[N]=D[1];else b[R]=E;let k=RU(L,b),v=gY(k);if(v.hasContinue){T+=v.content;continue}let g=fY(k);if(g.hasBreak){T+=g.content;break}if(k=hY(k,b),k=G(k,b),k=i1(k,b,Y),k=NU(k),g=fY(k),g.hasBreak){T+=g.content;break}if(v=gY(k),v.hasContinue){T+=v.content;continue}k=F1(k,b,Y),k=AU(k,b),k=wU(k,b),T+=k}q=q.substring(0,j)+T+q.substring(_)}catch(V){let O=e("Foreach",`Error in @foreach(${B.trim()} as ${H.trim()}): ${V instanceof Error?V.message:String(V)}`,s.EVALUATION_ERROR);q=q.substring(0,j)+O+q.substring(_)}}return q}X=G(X,Z),X=uY(X,Z,Y,J);let K=J?.loops?.maxWhileIterations??FU;return X=DU(X,Z,K),X}function mY($){return M$($)}function uY($,Z,Y,J){let X=$,Q=!0;while(Q){Q=!1;let G=X.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,W=K+G[0].length-1,z=x0(X,"(",")",W);if(z===-1)break;let q=X.slice(W+1,z),U=z+1,j=P$(X.slice(K),"for","endfor");if(j.length===0)break;let _=j[0].content,B=K+j[0].end;if(!mY(q)){let H=e("For",`Unsafe expression in @for: ${q}`,s.UNSAFE_EXPRESSION);X=X.substring(0,K)+H+X.substring(B),Q=!0;continue}try{let H=TU(q),L=/@(?:for|foreach|if|unless)\s*\(/.test(_);if(H.length>0&&L){let R=IU({forExpr:q,content:_,iterVarNames:H,context:Z,filePath:Y,options:J});X=X.substring(0,K)+R+X.substring(B),Q=!0;continue}let V=Object.keys(Z),O=Object.values(Z),F=_.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(R,N)=>{return`\${${N}}`});F=dY(F);let A=Function(...V,`
|
|
9363
|
+
`||M==="\t")V++;O=R+H.length}else{if(V--,V===0){F=N;break}O=N+L.length}}if(F===-1){X=j;continue}let w=$.slice(j,F),A=F+L.length;J.push({fullMatch:$.slice(Q,A),tagName:W,attributes:B,content:w,startIndex:Q,endIndex:A,isSelfClosing:!1}),X=A}}return J}function EY($,Z){try{let Y=Buffer.from($,"base64").toString("utf8");return JSON.parse(Y)}catch{}try{let Y=$.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(Y)}catch(Y){if(Z?.debug)console.error("Error decoding __stx_ prop:",Y);return $}}var kY=S(()=>{w0();M0();C1()});var xY={};a(xY,{processESImports:()=>CY,processComponents:()=>o4});import n4 from"fs";import m0 from"path";function qU($,Z,Y){let J={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},X=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"]),Q=(K)=>{if(!K.includes("-")||K.startsWith("@")||K.startsWith(":")||K.startsWith("x-")||K.startsWith("__"))return K;if(K.startsWith("aria-")||K.startsWith("data-"))return K;return K.replace(/-([a-z0-9])/g,(W,z)=>z.toUpperCase())},G=(K,W)=>{let z=Q(K);if(J.static[z]=W,z!==K)J.staticNames[z]=K};for(let[K,W]of Object.entries($)){let z=K.startsWith("x-")&&!X.has(K)&&!K.startsWith("x-bind:")&&!K.startsWith("x-on:")?`:${K.slice(2)}`:K;if(z.startsWith("@")){J.events[z]=W;continue}if(z.startsWith("__stx_")){let q=Q(z.slice(6));J.serverDynamic[q]=EY(W,Y);continue}if(z.startsWith(":")){let q=Q(z.slice(1)),U=W===D6?q:W;if(q==="if"||q==="for"||q==="show"){J.clientReactive[q]=U;continue}try{if(!K0(U)){if(Y.debug)console.error(`Unsafe expression in :${q} binding: ${U}`);J.clientReactive[q]=U;continue}let j=Object.keys(Z),B=W0(U,j)(...Object.values(Z));if(B===void 0){let H=U.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],L=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(H.some((O)=>!L.has(O)&&!j.includes(O))){J.clientReactive[q]=U;continue}}J.serverDynamic[q]=B}catch{J.clientReactive[q]=U}continue}if(typeof W==="string"&&W.includes("{{")&&W.includes("}}")){let q=W.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(q)try{let U=q[1];if(K0(U)){let _=W0(U,Object.keys(Z))(...Object.values(Z));G(z,_!=null?String(_):"")}else{if(Y.debug)console.error(`Unsafe expression in ${z}: ${U}`);G(z,W)}}catch(U){if(Y.debug)console.error(`Error evaluating expression for ${z}:`,U);G(z,W)}else{let U=W,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=j.exec(W))!==null)try{let B=_[1];if(!K0(B)){if(Y.debug)console.error(`Unsafe expression in ${z}: ${B}`);continue}let L=W0(B,Object.keys(Z))(...Object.values(Z));U=U.replace(_[0],String(L??""))}catch(B){if(Y.debug)console.error(`Error evaluating expression in ${z}:`,B)}G(z,U)}continue}G(z,W===D6?"true":W)}return J}function UU($){let Z={},Y=0,J=$.length;while(Y<J){while(Y<J&&/\s/.test($[Y]))Y++;if(Y>=J)break;let X="";while(Y<J&&!/[\s=]/.test($[Y]))X+=$[Y],Y++;if(!X)break;while(Y<J&&/\s/.test($[Y]))Y++;if(Y<J&&$[Y]==="="){Y++;while(Y<J&&/\s/.test($[Y]))Y++;let Q="";if(Y<J&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<J){let K=$[Y];if(K==="\\"&&Y+1<J){Y++,Q+=$[Y],Y++;continue}if(K===G){Y++;break}Q+=K,Y++}}else while(Y<J&&!/\s/.test($[Y]))Q+=$[Y],Y++;Z[X]=Q}else Z[X]=D6}return Z}function SY($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function jU($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,J;while((J=Y.exec($))!==null){let X=J[1];if(f0.isBuiltin(X))Z.add(X)}return[...Z].sort()}function _U($){let Z=yY.get($);if(Z)return Z;let Y=new Map,J=[m0.join($,"src"),m0.join($,"dist"),$];function X(Q,G){if(G>6)return;let K;try{K=n4.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let W of K){let z=m0.join(Q,W.name);if(W.isDirectory()){if(W.name==="node_modules"||W.name.startsWith("."))continue;X(z,G+1)}else if(W.isFile()&&W.name.endsWith(".stx")){let q=W.name.slice(0,-4);if(!Y.has(q))Y.set(q,z);let U=q.toLowerCase();if(!Y.has(U))Y.set(U,z);let j=q.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(j))Y.set(j,z)}}}for(let Q of J)if(X(Q,0),Y.size>0)break;return yY.set($,Y),Y}function BU($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let J=m0.join(Y,"node_modules",$);try{if(n4.statSync(J).isDirectory())return J}catch{}let X=m0.dirname(Y);if(X===Y)return null;Y=X}}async function CY($,Z,Y,J,X){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=m0.dirname(Y),K=$,W=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(W,(z,q,U)=>{let j=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,_=U,B,H=[];while((B=j.exec(U))!==null){let[L,V,O,F]=B,w=null,A=null;if(F.startsWith(".")||F.startsWith("/")){let M=m0.resolve(G,F);if(M.endsWith(".stx"))A=M;else{let T=`${M}.stx`;try{if(n4.statSync(T).isFile())A=T}catch{try{if(n4.statSync(M).isDirectory())w=M}catch{}}}}else w=BU(F,G);if(!w&&!A)continue;let R=!1,N=(M,T)=>{Q.set(M,T),Q.set(M.toLowerCase(),T);let I=M.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(I,T),X.add(T)};if(O&&A)N(O,A),R=!0;else if(V){let M=V.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let E=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(E)return{source:E[1],local:E[2]};return{source:I,local:I}}),T=w?_U(w):null;for(let{source:I,local:E}of M){let D=null;if(A)D=A;else if(T)D=T.get(I)??T.get(I.toLowerCase())??T.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(D)N(E,D),R=!0}}if(R)H.push({start:B.index,end:B.index+L.length})}if(H.length===0)return z;for(let L=H.length-1;L>=0;L--)_=_.slice(0,H[L].start)+_.slice(H[L].end);return`<script${q}>${_}</script>`}),K}async function HU($,Z,Y,J,X){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,W;while((W=K.exec(Q))!==null){let[z,q]=W,U=q.split(",").map((j)=>j.trim().replace(/^['"]|['"]$/g,"")).filter((j)=>j.length>0);for(let j of U){let _=j.split("/"),H=_[_.length-1].replace(/\.stx$/,""),L=H.includes("-")?H.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),V=null,O=[m0.resolve(m0.dirname(Y),`${j}.stx`),m0.resolve(m0.dirname(Y),j),m0.resolve(J.componentsDir||"components",`${j}.stx`),m0.resolve(J.componentsDir||"components",j),j.endsWith(".stx")?j:`${j}.stx`];for(let F of O)try{if(await Bun.file(F).exists()){V=F;break}}catch{}if(V){G.set(L,V),G.set(H,V),G.set(H.toLowerCase(),V);let F=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(F,V),X.add(V),J.debug)console.log(`Imported component: ${L} -> ${V}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${j}`)}Q=Q.replace(z,""),K.lastIndex=0}return Q}async function OU($,Z,Y,J,X){let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,W=/@component\s*\(/g,z;while((z=W.exec(Q))!==null){let q=z.index,U=q+z[0].length-1,j=1,_=U+1;while(_<Q.length&&j>0){if(Q[_]==="(")j++;else if(Q[_]===")"){if(j--,j===0)break}_++}if(j!==0)break;let B=Q.substring(U+1,_),H=_+1,L=B.match(/^\s*['"]([^'"]+)['"]/);if(!L){W.lastIndex=0;continue}let V=L[1],O,F=B.slice(L[0].length),w=F.match(/^\s*,\s*/);if(w)O=F.slice(w[0].length).trim();let A={};if(O)try{A=T0(O,Z)}catch(E){let D=E instanceof Error?E.message:String(E);Q=Q.replace(Q.substring(q,H),`[Error parsing component props: ${D}]`);continue}let R="",N=H,T=Q.substring(H).match(/^([\s\S]*?)@endcomponent/);if(T)R=T[1].trim(),N=H+T[0].length;let I=await d1(V,A,R,G,Z,Y,J,K,X);Q=Q.substring(0,q)+I+Q.substring(N),W.lastIndex=0}return Q}async function LU($,Z,Y,J,X){if(!$)return $;let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,W=L1(Q);return Q=W.output,Q=await j(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await j(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await j(Q,/[a-z][a-z0-9]*/,!1,zU),Q=u5(Q,W.scripts),Q;async function j(_,B,H,L){if(!_)return _;let V=_,O=DY(V,B,L);for(let F=O.length-1;F>=0;F--){let w=O[F],A=H?i4(w.tagName):w.tagName,R=UU(w.attributes),N=qU(R,Z,J),M=f0.getBuiltin(w.tagName),T=M?await t$(A,G,Z,Y,J):!1;if(M&&!T){let y={context:Z,filePath:Y,options:J,dependencies:X},b=M.render(N,w.content,y);if(Object.keys(N.clientReactive).length>0)b=PY(b,N.clientReactive);if(Object.keys(N.events).length>0){let k=Object.entries(N.events).map(([v,g])=>`${v}="${SY(g)}"`).join(" ");b=b.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${k}`)}V=V.substring(0,w.startIndex)+b+V.substring(w.endIndex);continue}if(!H&&w.tagName.includes("-")&&!await t$(A,G,Z,Y,J))continue;let I={};for(let[y,b]of Object.entries(N.static))I[y]=b;for(let[y,b]of Object.entries(N.serverDynamic))I[y]=b;let D=await d1(A,I,w.content,G,Z,Y,J,K,X);if(Object.keys(N.clientReactive).length>0)D=PY(D,N.clientReactive);if(Object.keys(N.events).length>0){let y=vY(D);if(y){let b=Object.entries(N.events).map(([v,g])=>`${v}="${SY(g)}"`).join(" "),k=Object.keys(N.events).map((v)=>v.replace(/^@/,"").split(".")[0]).join(" ");D=D.substring(0,y.insertPos)+` data-stx-parent-events="${k}" ${b}`+D.substring(y.insertPos)}}V=V.substring(0,w.startIndex)+D+V.substring(w.endIndex)}return V}}function PY($,Z){let Y=new Set(["if","for"]),J=new Set(["show"]),X=Object.entries(Z).filter(([q])=>!Y.has(q)),Q=X.filter(([q])=>!J.has(q)).map(([q])=>i4(q)).join(" "),G=$,K=X.length>0?vY(G):null;if(K){let q=X.map(([j,_])=>`:${i4(j)}="${_.replace(/"/g,""")}"`).join(" "),U=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,K.insertPos)+`${U} ${q}`+G.substring(K.insertPos)}let W=Z.if;if(W)G=`<template :if="${W.replace(/"/g,""")}">${G}</template>`;let z=Z.for;if(z)G=`<template :for="${z.replace(/"/g,""")}">${G}</template>`;return G}function vY($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let Y=0;while(Y<$.length){let J=$.slice(Y),X=J.match(/^\s+/);if(X){Y+=X[0].length;continue}if(J.startsWith("<!--")){let K=$.indexOf("-->",Y+4);if(K===-1)return null;Y=K+3;continue}let Q=J.match(/^<(script|style)\b[^>]*>/i);if(Q){let K=`</${Q[1].toLowerCase()}>`,W=$.toLowerCase().indexOf(K,Y+Q[0].length);if(W===-1)return null;Y=W+K.length;continue}let G=J.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:Y+1+G[1].length}}return null}async function o4($,Z,Y,J,X){if(!bY)TY(),bY=!0;let Q=await CY($,Z,Y,J,X);Q=await HU(Q,Z,Y,J,X),Q=await OU(Q,Z,Y,J,X);let G=[];for(let K=0;K<3;K++){let W=Z1(Q,d5,(q,U)=>`\x00STX_COMPONENT_COMMENT_${G.length+U}\x00`);G.push(...W.tokens);let z=Q;if(Q=await LU(W.output,Z,Y,J,X),Q===z)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(K,W)=>G[Number(W)]??"");if(J.debug){let K=jU(Q);if(K.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${K.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}var bY=!1,D6="\x00stx-boolean-attribute",zU,yY;var E6=S(()=>{Y6();IY();kY();C1();M0();w0();zU=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"]);yY=new Map});var pY={};a(pY,{processLoops:()=>k6});function wU($,Z){let Y=/@component\s*\(/g,J=$,X,Q=[];while((X=Y.exec(J))!==null){let G=X.index,K=G+X[0].length-1,W=1,z=K+1;while(z<J.length&&W>0){if(J[z]==="(")W++;else if(J[z]===")"){if(W--,W===0)break}z++}if(W!==0)continue;let q=J.substring(K+1,z),U=z+1,j=q.match(/^\s*['"]([^'"]+)['"]/);if(!j)continue;let _=j[1],B=q.slice(j[0].length),H=B.match(/^\s*,\s*/);if(!H)continue;let L=B.slice(H[0].length).trim();if(!L)continue;try{let V=T0(L,Z),O=JSON.stringify(V),F=`@component('${_}', ${O})`;Q.push({start:G,end:U,replacement:F})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:z}=Q[G];J=J.substring(0,K)+z+J.substring(W)}return J}function s4($,Z,Y){let J=$,X=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=X.exec(J))!==null){let G=Q.index,K=G+Q[0].length-1,W=1,z=K+1,q=null,U=!1;while(z<J.length&&W>0){let B=J[z];if(U){U=!1,z++;continue}if(B==="\\"&&q){U=!0,z++;continue}if(q){if(B===q)q=null;z++;continue}if(B==='"'||B==="'"||B==="`"){q=B,z++;continue}if(B==="(")W++;else if(B===")"){if(W--,W===0)break}z++}if(W!==0)break;let j=J.substring(K+1,z),_=Y(j);J=J.substring(0,G)+_+J.substring(z+1)}return J}function AU($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(J,X)=>{if(X in Z)return`:${X}="${X}"`;return J}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(J,X,Q)=>{try{let G=Object.keys(Z),K=Object.values(Z);N$(Q);let z=W0(Q,G)(...K),q=JSON.stringify(z),U=Buffer.from(q,"utf8").toString("base64");return`__stx_${X}="${U}"`}catch(G){return J}}),Y}function RU($,Z){let Y=$;return Y=s4(Y,"@break",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(K0(Q)){let K=W0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean($0(Q,Z));return G?r4:""}catch{return""}}),Y=s4(Y,"@continue",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(K0(Q)){let K=W0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean($0(Q,Z));return G?a4:""}catch{return""}}),Y}function NU($){let Z=$;return Z=Z.replace(/@break(?!\()/g,r4),Z=Z.replace(/@continue(?!\()/g,a4),Z}function fY($){let Z=$.includes(r4),Y=Z?$.substring(0,$.indexOf(r4)):$;return{hasBreak:Z,content:Y}}function gY($){let Z=$.includes(a4),Y=Z?$.substring(0,$.indexOf(a4)):$;return{hasContinue:Z,content:Y}}function dY($){let Z=$;return Z=s4(Z,"@break",(Y)=>{let J=Y.trim();if(!M$(J))return"";return`\`; if (${J}) { break; } result += \``}),Z=s4(Z,"@continue",(Y)=>{let J=Y.trim();if(!M$(J))return"";return`\`; if (${J}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function MU($){let Z=/@forelse\s*\(/g,Y,J=[],X=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=X.exec($))!==null)J.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)J.push({pos:G.index,delta:-1});J.sort((q,U)=>q.pos-U.pos);let K=[],W=0;for(let q of J)W+=q.delta,K.push({pos:q.pos,depth:W});function z(q){let U=0,j=K.length-1,_=0;while(U<=j){let B=U+j>>1;if(K[B].pos<=q)_=K[B].depth,U=B+1;else j=B-1}return _}while((Y=Z.exec($))!==null){if(z(Y.index)>0)continue;let q=Y.index,U=Y.index+Y[0].length-1,j=1,_=U+1,B=-1;while(_<$.length&&j>0){if($[_]==="(")j++;else if($[_]===")"){if(j--,j===0){B=_;break}}_++}if(B===-1)continue;let H=$.substring(U+1,B),L=H.indexOf(" as ");if(L===-1)continue;let V=H.substring(0,L).trim(),O=H.substring(L+4).trim(),F=B+1,w=1,A=F,R=/@forelse\s*\(/g,N=/@endforelse/g,M=-1;while(w>0&&A<$.length){R.lastIndex=A,N.lastIndex=A;let b=R.exec($),k=N.exec($);if(!k)break;if(b&&b.index<k.index)w++,A=b.index+b[0].length;else{if(w--,w===0){M=k.index;break}A=k.index+11}}if(M===-1)continue;let T=$.substring(F,M),I=M+11,E=-1,D=0,y=0;while(y<T.length){let b=T.indexOf("@",y);if(b===-1)break;let k=T.substring(b);if(/^@forelse\s*\(/.test(k))D++,y=b+1;else if(k.startsWith("@endforelse"))D--,y=b+11;else if(D===0&&k.startsWith("@empty")){if(T.length<=b+6||!/[a-z]/i.test(T[b+6])){E=b;break}y=b+1}else y=b+1}if(E===-1)continue;return{start:q,end:I,arrayExpr:V,itemVar:O,foreachContent:T.substring(0,E),emptyContent:T.substring(E+6)}}return null}function hY($,Z){let Y=$;while(!0){let J=MU(Y);if(!J)break;let{start:X,end:Q,arrayExpr:G,itemVar:K,foreachContent:W,emptyContent:z}=J;try{let q;if(K0(G))q=W0(G,Object.keys(Z))(...Object.values(Z));else q=$0(G,Z);let U;if(!Array.isArray(q)||q.length===0)U=z;else U=`@foreach (${G} as ${K})${W}@endforeach`;Y=Y.substring(0,X)+U+Y.substring(Q)}catch(q){let U=q instanceof Error?q.message:String(q),j=e("Forelse",`Error in @forelse(${G} as ${K}): ${U}`,s.EVALUATION_ERROR);Y=Y.substring(0,X)+j+Y.substring(Q)}}return Y}function k6($,Z,Y,J){let X=$;X=hY(X,Z);function Q(W){let z=/@foreach\s*\(/g,q;while((q=z.exec(W))!==null){let U=q.index,j=q.index+q[0].length-1,_=1,B=j+1,H=-1;while(B<W.length&&_>0){if(W[B]==="(")_++;else if(W[B]===")"){if(_--,_===0){H=B;break}}B++}if(H===-1)continue;let L=W.substring(j+1,H),V=L.indexOf(" as ");if(V===-1)continue;let O=U,F=L.substring(0,V),w=L.substring(V+4),A=H+1,R=1,N=A,M=/@foreach\s*\(/g,T=/@endforeach/g;while(R>0&&N<W.length){M.lastIndex=N,T.lastIndex=N;let I=M.exec(W),E=T.exec(W);if(!E)break;if(I&&I.index<E.index)R++,N=I.index+I[0].length;else{if(R--,R===0){let D=W.substring(A,E.index),y=E.index+11;return{start:O,end:y,arrayExpr:F,itemVar:w,content:D}}N=E.index+11}}}return null}function G(W,z){let q=W;while(!0){let U=Q(q);if(!U)break;let{start:j,end:_,arrayExpr:B,itemVar:H,content:L}=U;try{let V=B.trim(),O;if(K0(V))O=W0(V,Object.keys(z))(...Object.values(z));else O=$0(V,z);let F=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),F=!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),F=!0;else{let E=e("Foreach",`Error in @foreach: ${V} is not iterable`,s.TYPE_ERROR);q=q.substring(0,j)+E+q.substring(_);continue}let w=J?.loops?.useAltLoopVariable??VU,A=H.trim(),R=null,N,M=!1;if(A.includes("=>")){let E=A.split("=>").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])R=E[0],N=E[1];else N=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let E=A.split(",").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])N=E[0],R=E[1],M=!0;else N=A}else N=A;let T="",I=O;for(let E=0;E<I.length;E++){let D=I[E],y={index:E,iteration:E+1,first:E===0,last:E===I.length-1,count:I.length},b={...z,loop:y,$loop:y};if(N.startsWith("[")&&N.endsWith("]")){let f=N.slice(1,-1).split(",").map((d)=>d.trim());if(Array.isArray(D))f.forEach((d,p)=>{if(d)b[d]=D[p]});else b[N]=D}else b[N]=D;if(R)if(!M&&F&&Array.isArray(D)&&D.length===2)b[R]=D[0],b[N]=D[1];else b[R]=E;let k=RU(L,b),v=gY(k);if(v.hasContinue){T+=v.content;continue}let g=fY(k);if(g.hasBreak){T+=g.content;break}if(k=hY(k,b),k=G(k,b),k=i1(k,b,Y),k=NU(k),g=fY(k),g.hasBreak){T+=g.content;break}if(v=gY(k),v.hasContinue){T+=v.content;continue}k=F1(k,b,Y),k=AU(k,b),k=wU(k,b),T+=k}q=q.substring(0,j)+T+q.substring(_)}catch(V){let O=e("Foreach",`Error in @foreach(${B.trim()} as ${H.trim()}): ${V instanceof Error?V.message:String(V)}`,s.EVALUATION_ERROR);q=q.substring(0,j)+O+q.substring(_)}}return q}X=G(X,Z),X=mY(X,Z,Y,J);let K=J?.loops?.maxWhileIterations??FU;return X=DU(X,Z,K),X}function uY($){return M$($)}function mY($,Z,Y,J){let X=$,Q=!0;while(Q){Q=!1;let G=X.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,W=K+G[0].length-1,z=x0(X,"(",")",W);if(z===-1)break;let q=X.slice(W+1,z),U=z+1,j=P$(X.slice(K),"for","endfor");if(j.length===0)break;let _=j[0].content,B=K+j[0].end;if(!uY(q)){let H=e("For",`Unsafe expression in @for: ${q}`,s.UNSAFE_EXPRESSION);X=X.substring(0,K)+H+X.substring(B),Q=!0;continue}try{let H=TU(q),L=/@(?:for|foreach|if|unless)\s*\(/.test(_);if(H.length>0&&L){let R=IU({forExpr:q,content:_,iterVarNames:H,context:Z,filePath:Y,options:J});X=X.substring(0,K)+R+X.substring(B),Q=!0;continue}let V=Object.keys(Z),O=Object.values(Z),F=_.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(R,N)=>{return`\${${N}}`});F=dY(F);let A=Function(...V,`
|
|
9361
9364
|
let result = '';
|
|
9362
9365
|
for (${q}) {
|
|
9363
9366
|
result += \`${F}\`;
|
|
@@ -9367,7 +9370,7 @@ ${D}
|
|
|
9367
9370
|
for (${Z}) {
|
|
9368
9371
|
__pushIter([${J.join(", ")}])
|
|
9369
9372
|
}
|
|
9370
|
-
`),q=[];z(...W,(_)=>{q.push(_)});let U=Q??"inline.stx",j="";for(let _ of q){let B={...X};J.forEach((L,V)=>{B[L]=_[V]});let H=
|
|
9373
|
+
`),q=[];z(...W,(_)=>{q.push(_)});let U=Q??"inline.stx",j="";for(let _ of q){let B={...X};J.forEach((L,V)=>{B[L]=_[V]});let H=mY(Y,B,Q,G);H=i1(H,B,U),H=F1(H,B,U),j+=H}return j}function DU($,Z,Y){let J=$,X=!0;while(X){X=!1;let Q=J.match(/@while\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=G+Q[0].length-1,W=x0(J,"(",")",K);if(W===-1)break;let z=J.slice(K+1,W),q=P$(J.slice(G),"while","endwhile");if(q.length===0)break;let U=q[0].content,j=G+q[0].end;if(!uY(z)){let _=e("While",`Unsafe expression in @while: ${z}`,s.UNSAFE_EXPRESSION);J=J.substring(0,G)+_+J.substring(j),X=!0;continue}try{let _=Object.keys(Z),B=Object.values(Z),H=U.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,F)=>{return`\${${F}}`});H=dY(H);let V=Function(..._,`
|
|
9371
9374
|
let result = '';
|
|
9372
9375
|
let maxIterations = ${Y}; // Configurable safety limit
|
|
9373
9376
|
let counter = 0;
|
|
@@ -9424,15 +9427,15 @@ ${cY($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
|
|
|
9424
9427
|
${V}
|
|
9425
9428
|
`,w=Function(...j,O)(..._);if(w&&typeof w==="object")Object.assign(Z,w);Q=Q.replace(z,"")}catch(j){console.error(`Error executing ${J} code block in ${Y}:`,j);let _=j instanceof Error?j.message:String(j),B=q0(`${J} Directive`,`Error executing code: ${_}`,Y,$,U,z);console.error(B),Q=Q.replace(z,"")}return Q}var tY=S(()=>{K5();M0()});function CU($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function eY($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,J,X,Q)=>{return CU(J,Q||"_method")})}async function $J($,Z,Y,J,X){if(!J.middleware||J.middleware.length===0)return $;let Q=$,G=J.middleware.filter((K)=>K.timing===X);if(G.length===0)return Q;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(J.debug)console.warn("Invalid middleware:",K);continue}try{let W=await K.handler(Q,Z,Y,J);if(typeof W==="string")Q=W;else if(J.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(W){if(J.debug)console.error(`Error in middleware ${K.name}:`,W);if(J.debug){let z=q0("Middleware",`Error in middleware '${K.name}': ${W instanceof Error?W.message:String(W)}`,Y,$);Q=Q.replace(/<body[^>]*>/,`$&
|
|
9426
9429
|
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${r0(z)}</div>
|
|
9427
|
-
`)}}}return Q}async function ZJ($,Z,Y,J){return $J($,Z,Y,J,"before")}async function YJ($,Z,Y,J){return $J($,Z,Y,J,"after")}var JJ=S(()=>{Y1();M0()});import{defineRoute as GA,defineRoutes as KA,resetRoutes as WA,route as zA,setAppUrl as qA}from"stx-router";import{route as vU}from"stx-router";function XJ($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,J,X,Q)=>{try{let G=X?T0(X,{}):{};return vU(J,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var QJ=S(()=>{w0()});async function GJ($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(B$.exact[$])for(let J of B$.exact[$])await Promise.resolve(J(Z,$));if(B$.exact[Y])for(let J of B$.exact[Y])await Promise.resolve(J(Z,$));for(let{pattern:J,callback:X}of B$.patterns)if(J.test($)||J.test(Y))await Promise.resolve(X(Z,$))}var B$;var KJ=S(()=>{B$={patterns:[],exact:{}}});function WJ($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>WJ(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function zJ($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,X=[],Q;while((Q=J.exec($))!==null)X.push([Q.index,Q.index+Q[0].length]);function G(z){return X.some(([q,U])=>z>=q&&z<U)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,W=[];while((Q=K.exec(Y))!==null){if(G(Q.index))continue;let z=Q[0],q=Q[2];if(!q||!q.includes(":"))continue;let U=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,j,_=q,B=!1;while((j=U.exec(q))!==null){let H=j[1],L=j[2];if(L.includes("()")&&!L.includes(".get(")||L.includes("$store")||L.includes("$ref"))continue;try{let V=Object.keys(Z),O=Object.values(Z),F=L.match(/^([a-zA-Z_$][\w$]*)/);if(F&&!V.includes(F[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(F[1]))continue;let A=Function(...V,`return (${L})`)(...O);if(H==="class"){let R=WJ(A);if(R){let N=_.match(/\sclass="([^"]*)"/);if(N)_=_.replace(N[0],` class="${N[1]} ${R}"`);else _=_.replace(j[0],` class="${R}"`)}else _=_.replace(j[0],"");B=!0;continue}if(xU.has(H)){if(A)_=_.replace(j[0],` ${H}`);else _=_.replace(j[0],"");B=!0;continue}if(A===null||A===void 0||A===!1)_=_.replace(j[0],"");else{let R=String(A).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");_=_.replace(j[0],` ${H}="${R}"`)}B=!0}catch{continue}}if(B){let H=z.endsWith("/>")?" /":"",V=`<${Q[1]}${_}${H}>`;W.push({start:Q.index,end:Q.index+z.length,replacement:V})}}for(let z=W.length-1;z>=0;z--){let{start:q,end:U,replacement:j}=W[z];Y=Y.slice(0,q)+j+Y.slice(U)}return Y}var xU;var qJ=S(()=>{xU=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function s1($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let J=Y.exec($);if(!J)return null;let X=/\/\s*>$/.test(J[0])||fU.has(J[1].toLowerCase()),Q=X?J[2].replace(/\/\s*$/,""):J[2];return{full:J[0],tag:J[1],attrs:Q,selfClosing:X,start:J.index,end:J.index+J[0].length}}function hU($,Z,Y){let J=1,X=Y,Q=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(J>0&&X<$.length){Q.lastIndex=X,G.lastIndex=X;let K=Q.exec($),W=G.exec($);if(!W)return-1;if(K&&K.index<W.index)J++,X=K.index+K[0].length;else{if(J--,J===0)return W.index+W[0].length;X=W.index+W[0].length}}return-1}function X1($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=hU($,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 UJ($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function A5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return J?J[1]:null}function T1($,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 I1($,Z,Y){let J=Z.selfClosing?" /":"",X=`<${Z.tag}${Y}${J}>`;return $.slice(0,Z.start)+X+$.slice(Z.end)}function dU($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function
|
|
9430
|
+
`)}}}return Q}async function ZJ($,Z,Y,J){return $J($,Z,Y,J,"before")}async function YJ($,Z,Y,J){return $J($,Z,Y,J,"after")}var JJ=S(()=>{Y1();M0()});import{defineRoute as GA,defineRoutes as KA,resetRoutes as WA,route as zA,setAppUrl as qA}from"stx-router";import{route as vU}from"stx-router";function XJ($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,J,X,Q)=>{try{let G=X?T0(X,{}):{};return vU(J,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var QJ=S(()=>{w0()});async function GJ($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(B$.exact[$])for(let J of B$.exact[$])await Promise.resolve(J(Z,$));if(B$.exact[Y])for(let J of B$.exact[Y])await Promise.resolve(J(Z,$));for(let{pattern:J,callback:X}of B$.patterns)if(J.test($)||J.test(Y))await Promise.resolve(X(Z,$))}var B$;var KJ=S(()=>{B$={patterns:[],exact:{}}});function WJ($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>WJ(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function zJ($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,X=[],Q;while((Q=J.exec($))!==null)X.push([Q.index,Q.index+Q[0].length]);function G(z){return X.some(([q,U])=>z>=q&&z<U)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,W=[];while((Q=K.exec(Y))!==null){if(G(Q.index))continue;let z=Q[0],q=Q[2];if(!q||!q.includes(":"))continue;let U=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,j,_=q,B=!1;while((j=U.exec(q))!==null){let H=j[1],L=j[2];if(L.includes("()")&&!L.includes(".get(")||L.includes("$store")||L.includes("$ref"))continue;try{let V=Object.keys(Z),O=Object.values(Z),F=L.match(/^([a-zA-Z_$][\w$]*)/);if(F&&!V.includes(F[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(F[1]))continue;let A=Function(...V,`return (${L})`)(...O);if(H==="class"){let R=WJ(A);if(R){let N=_.match(/\sclass="([^"]*)"/);if(N)_=_.replace(N[0],` class="${N[1]} ${R}"`);else _=_.replace(j[0],` class="${R}"`)}else _=_.replace(j[0],"");B=!0;continue}if(xU.has(H)){if(A)_=_.replace(j[0],` ${H}`);else _=_.replace(j[0],"");B=!0;continue}if(A===null||A===void 0||A===!1)_=_.replace(j[0],"");else{let R=String(A).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");_=_.replace(j[0],` ${H}="${R}"`)}B=!0}catch{continue}}if(B){let H=z.endsWith("/>")?" /":"",V=`<${Q[1]}${_}${H}>`;W.push({start:Q.index,end:Q.index+z.length,replacement:V})}}for(let z=W.length-1;z>=0;z--){let{start:q,end:U,replacement:j}=W[z];Y=Y.slice(0,q)+j+Y.slice(U)}return Y}var xU;var qJ=S(()=>{xU=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function s1($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let J=Y.exec($);if(!J)return null;let X=/\/\s*>$/.test(J[0])||fU.has(J[1].toLowerCase()),Q=X?J[2].replace(/\/\s*$/,""):J[2];return{full:J[0],tag:J[1],attrs:Q,selfClosing:X,start:J.index,end:J.index+J[0].length}}function hU($,Z,Y){let J=1,X=Y,Q=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(J>0&&X<$.length){Q.lastIndex=X,G.lastIndex=X;let K=Q.exec($),W=G.exec($);if(!W)return-1;if(K&&K.index<W.index)J++,X=K.index+K[0].length;else{if(J--,J===0)return W.index+W[0].length;X=W.index+W[0].length}}return-1}function X1($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=hU($,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 UJ($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function A5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return J?J[1]:null}function T1($,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 I1($,Z,Y){let J=Z.selfClosing?" /":"",X=`<${Z.tag}${Y}${J}>`;return $.slice(0,Z.start)+X+$.slice(Z.end)}function dU($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function uU($){let Z=$,Y=0;while(Y<Z.length){let J=s1(Z,Y);if(!J)break;let X=A5(J.attrs,"v-for");if(X===null){Y=J.end;continue}let Q=X.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!Q){Y=J.end;continue}let G=Q[1].trim(),K=Q[2].trim(),W;if(G.includes(",")){let L=G.split(",").map((F)=>F.trim()),V=L[0],O=L[1];W=`${K} as ${O} => ${V}`}else W=`${K} as ${G}`;let z=T1(J.attrs,"v-for"),q=T1(z,":key").replace(/\s*v-bind:key="[^"]*"/g,""),U=X1(Z,J),j=Z.slice(U.outerStart,U.outerEnd),_=I1(j,{...J,start:0,end:J.end-J.start},q),B=`@foreach(${W})
|
|
9428
9431
|
`,H=`${B}${_}
|
|
9429
|
-
@endforeach`;Z=Z.slice(0,U.outerStart)+H+Z.slice(U.outerEnd),Y=U.outerStart+B.length}return Z}function
|
|
9432
|
+
@endforeach`;Z=Z.slice(0,U.outerStart)+H+Z.slice(U.outerEnd),Y=U.outerStart+B.length}return Z}function mU($){let Z=$,Y=0;while(Y<Z.length){let J=s1(Z,Y);if(!J)break;let X=A5(J.attrs,"v-if");if(X===null){Y=J.end;continue}let Q=[],G=X1(Z,J),K=T1(J.attrs,"v-if"),W=I1(Z.slice(G.outerStart,G.outerEnd),{...J,start:0,end:J.end-J.start},K);Q.push({type:"if",expr:X,outerStart:G.outerStart,outerEnd:G.outerEnd,element:W,parsedTag:J});let z=G.outerEnd,q=!0;while(q){let H=Z.slice(z).match(/^\s*/),L=H?H[0].length:0,V=s1(Z,z+L);if(!V){q=!1;break}let O=A5(V.attrs,"v-else-if"),F=UJ(V.attrs,"v-else");if(O!==null){let w=X1(Z,V),A=T1(V.attrs,"v-else-if"),R=I1(Z.slice(w.outerStart,w.outerEnd),{...V,start:0,end:V.end-V.start},A);Q.push({type:"else-if",expr:O,outerStart:z,outerEnd:w.outerEnd,element:R,parsedTag:V}),z=w.outerEnd}else if(F){let w=X1(Z,V),A=T1(V.attrs,"v-else"),R=I1(Z.slice(w.outerStart,w.outerEnd),{...V,start:0,end:V.end-V.start},A);Q.push({type:"else",outerStart:z,outerEnd:w.outerEnd,element:R,parsedTag:V}),q=!1}else q=!1}let U=[];for(let H of Q)if(H.type==="if")U.push(`@if(${H.expr})
|
|
9430
9433
|
${H.element}`);else if(H.type==="else-if")U.push(`@elseif(${H.expr})
|
|
9431
9434
|
${H.element}`);else U.push(`@else
|
|
9432
9435
|
${H.element}`);U.push("@endif");let j=U.join(`
|
|
9433
9436
|
`),_=Q[0].outerStart,B=Q[Q.length-1].outerEnd;Z=Z.slice(0,_)+j+Z.slice(B),Y=_+j.length}return Z}function pU($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function lU($){let Z=$,Y=0;while(Y<Z.length){let J=s1(Z,Y);if(!J)break;let X=J.attrs,Q=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=X.match(G);while(K){Q=!0;let q=K[1],U=K[2],j=K[3];X=X.replace(K[0],""),X+=` :${q}="${j}" @update:${q}="${j} = $event"`,K=X.match(G)}if(Q){let q=X1(Z,J),U=Z.slice(q.outerStart,q.outerEnd),j=I1(U,{...J,start:0,end:J.end-J.start},X);Z=Z.slice(0,q.outerStart)+j+Z.slice(q.outerEnd),Y=q.outerStart+j.length;continue}let W=A5(J.attrs,"v-model");if(W===null){Y=J.end;continue}if(gU.has(J.tag.toLowerCase())){let q=J.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${W}"`,U=X1(Z,J),j=Z.slice(U.outerStart,U.outerEnd),_=I1(j,{...J,start:0,end:J.end-J.start},q);Z=Z.slice(0,U.outerStart)+_+Z.slice(U.outerEnd),Y=U.outerStart+_.length}else{let q=J.attrs.replace(/\s*v-model="[^"]*"/g,"");q+=` :modelValue="${W}" @update:modelValue="${W} = $event"`;let U=X1(Z,J),j=Z.slice(U.outerStart,U.outerEnd),_=I1(j,{...J,start:0,end:J.end-J.start},q);Z=Z.slice(0,U.outerStart)+_+Z.slice(U.outerEnd),Y=U.outerStart+_.length}}return Z}function cU($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function iU($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function nU($){let Z=$,Y=0;while(Y<Z.length){let J=s1(Z,Y);if(!J)break;let X=A5(J.attrs,"v-html");if(X===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let Q=X1(Z,J),G=T1(J.attrs,"v-html"),K=J.selfClosing?" /":"",W=`<${J.tag}${G}${K}>{!! ${X} !!}</${J.tag}>`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function oU($){let Z=$,Y=0;while(Y<Z.length){let J=s1(Z,Y);if(!J)break;let X=A5(J.attrs,"v-text");if(X===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let Q=X1(Z,J),G=T1(J.attrs,"v-text"),K=J.selfClosing?" /":"",W=`<${J.tag}${G}${K}>{{ ${X} }}</${J.tag}>`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function sU($){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 rU($){let Z=$,Y=0;while(Y<Z.length){let J=s1(Z,Y);if(!J)break;if(!UJ(J.attrs,"v-once")){Y=J.end;continue}let X=T1(J.attrs,"v-once"),Q=X1(Z,J),G=Z.slice(Q.outerStart,Q.outerEnd),W=`@once
|
|
9434
9437
|
${I1(G,{...J,start:0,end:J.end-J.start},X)}
|
|
9435
|
-
@endonce`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function aU($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function tU($){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 jJ($){if(!dU($))return $;let Z=$;return Z=
|
|
9438
|
+
@endonce`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function aU($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function tU($){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 jJ($){if(!dU($))return $;let Z=$;return Z=uU(Z),Z=mU(Z),Z=rU(Z),Z=cU(Z),Z=iU(Z),Z=lU(Z),Z=pU(Z),Z=tU(Z),Z=nU(Z),Z=oU(Z),Z=sU(Z),Z=aU(Z),Z}var fU,gU;var _J=S(()=>{fU=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),gU=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"])});function t4($){return $.replace(/--/g,"- -").replace(/</g,"<").replace(/>/g,">")}async function BJ($,Z,Y,J,X){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],W;while((W=G.exec(Q))!==null)K.push({full:W[0],expr:W[1],attrs:W[2],slotContent:W[3],index:W.index});for(let z=K.length-1;z>=0;z--){let q=K[z];try{let U=$0(q.expr,Z);if(!U||typeof U!=="string"){let O=`<!-- dynamic component: could not resolve "${t4(q.expr)}" -->`;Q=Q.slice(0,q.index)+O+Q.slice(q.index+q.full.length);continue}let j=q.attrs.trim(),_={},B=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=B.exec(j))!==null){let O=H[1]||H[2],F=H[3];if(H[1])try{_[O]=$0(F,Z)}catch{_[O]=F}else _[O]=F}let L=J.componentsDir||"components",V=await d1(U,_,q.slotContent,L,Z,Y,J,new Set,X??new Set);Q=Q.slice(0,q.index)+V+Q.slice(q.index+q.full.length)}catch(U){let j=U instanceof Error?U.message:String(U),_=`<!-- dynamic component error: ${t4(j)} -->`;Q=Q.slice(0,q.index)+_+Q.slice(q.index+q.full.length)}}return Q=await eU(Q,Z,Y,J,X),Q}async function eU($,Z,Y,J,X){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],W;while((W=G.exec(Q))!==null)K.push({full:W[0],expr:W[1],attrs:W[2],index:W.index});for(let z=K.length-1;z>=0;z--){let q=K[z];try{let U=$0(q.expr,Z);if(!U||typeof U!=="string"){let B=`<!-- dynamic component: could not resolve "${t4(q.expr)}" -->`;Q=Q.slice(0,q.index)+B+Q.slice(q.index+q.full.length);continue}let j=J.componentsDir||"components",_=await d1(U,{},"",j,Z,Y,J,new Set,X??new Set);Q=Q.slice(0,q.index)+_+Q.slice(q.index+q.full.length)}catch(U){let j=U instanceof Error?U.message:String(U),_=`<!-- dynamic component error: ${t4(j)} -->`;Q=Q.slice(0,q.index)+_+Q.slice(q.index+q.full.length)}}return Q}var HJ=S(()=>{M0();w0()});function OJ($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}<style data-stx-cloak>[x-cloak]{display:none !important}</style>
|
|
9436
9439
|
${$.slice(Z)}`}function $j($){let Z=[],Y=0;while(Y<$.length){let Q=$.slice(Y),G=Q.match(/^\s+/);if(G){Y+=G[0].length;continue}if(Q.startsWith("<!--")){let U=$.indexOf("-->",Y);if(U===-1)break;Y=U+3;continue}let K=Q.match(/^<script\b[^>]*>/i);if(K){let U=$.toLowerCase().indexOf("</script>",Y+K[0].length);if(U===-1)break;Y=U+9;continue}let W=Q.match(/^<link\b[^>]*>/i);if(W){Z.push(W[0]),Y+=W[0].length;continue}let z=Q.match(/^<meta\b[^>]*>/i);if(z){Z.push(z[0]),Y+=z[0].length;continue}let q=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(q){Z.push(q[0]),Y+=q[0].length;continue}break}if(Z.length===0)return{body:$,hoisted:Z};let J="",X=0;while(X<$.length&&X<Y){let Q=$.slice(X),G=Q.match(/^<link\b[^>]*>/i);if(G&&Z.includes(G[0])){X+=G[0].length;continue}let K=Q.match(/^<meta\b[^>]*>/i);if(K&&Z.includes(K[0])){X+=K[0].length;continue}let W=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(W&&Z.includes(W[0])){X+=W[0].length;continue}J+=$[X],X++}return J+=$.slice(Y),{body:J,hoisted:Z}}function Zj($,Z={},Y={}){let{title:J="stx App",lang:X="en",meta:Q=[],link:G=[],script:K=[],headRaw:W="",bodyClass:z="",bodyAttrs:q={}}=Z,U=Y.title||J,B=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...Q].map((N)=>{return` <meta ${Object.entries(N).map(([T,I])=>`${T}="${I}"`).join(" ")}>`}).join(`
|
|
9437
9440
|
`),H=G.map((N)=>{return` <link ${Object.entries(N).map(([T,I])=>`${T}="${I}"`).join(" ")}>`}).join(`
|
|
9438
9441
|
`),L=K.map((N)=>{if(N.src)return` <script ${Object.entries(N).filter(([T])=>T!=="content").map(([T,I])=>`${T}="${I}"`).join(" ")}></script>`;if(N.content)return` <script>${N.content}</script>`;return""}).filter(Boolean).join(`
|
|
@@ -9454,12 +9457,12 @@ ${B}
|
|
|
9454
9457
|
</script>`;J=J.replace(z,H),Q.lastIndex=0}catch(B){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,W;while((W=K.exec(J))!==null){let[z,q,U,j]=W,_=q+j;if(VJ(U))continue;if(/rel=["']stylesheet["']/.test(_)||U.endsWith(".css")){let H=await wJ(U,X,Z);if(H)try{let L=await Bun.file(H).text();Y.add(H);let V=`<style>
|
|
9455
9458
|
/* Source: ${U} */
|
|
9456
9459
|
${L}
|
|
9457
|
-
</style>`;J=J.replace(z,V),K.lastIndex=0}catch(L){}}}return J}var RJ=S(()=>{b1()});function f6($,Z){let Y=$,J=/@json\s*\(/g,X;while((X=J.exec(Y))!==null){let Q=X.index,G=Q+X[0].length-1,K=1,W=G+1,z=null,q=!1;while(W<Y.length&&K>0){let F=Y[W];if(q){q=!1,W++;continue}if(F==="\\"&&z){q=!0,W++;continue}if(z){if(F===z)z=null;W++;continue}if(F==='"'||F==="'"||F==="`"){z=F,W++;continue}if(F==="(")K++;else if(F===")"){if(K--,K===0)break}W++}if(K!==0)break;let U=Y.substring(G+1,W).trim(),j=Y.substring(Q,W+1),_=-1,B=0,H=null,L=!1;for(let F=0;F<U.length;F++){let w=U[F];if(L){L=!1;continue}if(w==="\\"&&H){L=!0;continue}if(H){if(w===H)H=null;continue}if(w==='"'||w==="'"||w==="`"){H=w;continue}if(w==="("||w==="["||w==="{")B++;else if(w===")"||w==="]"||w==="}")B--;if(w===","&&B===0){_=F;break}}let V=_>=0?U.substring(0,_).trim():U,O=_>=0?U.substring(_+1).trim():void 0;try{let F=V.trim(),w;if(K0(F))w=W0(F,Object.keys(Z))(...Object.values(Z));else w=void 0;let A;if(O==="true")A=JSON.stringify(w,null,2);else A=JSON.stringify(w);let R=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,Q)+R+Y.substring(W+1),J.lastIndex=Q+R.length}catch(F){t0.log(F instanceof Error?F:Error(String(F)),{directive:"@json"},"error"),J.lastIndex=Q+j.length}}return Y}function g6($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function NJ($){let Z=$,Y=/@memo\s*\(/g,J,X=[];while((J=Y.exec(Z))!==null){let Q=J.index,G=Q+J[0].length,K=1,W=G;while(W<Z.length&&K>0){if(Z[W]==="(")K++;else if(Z[W]===")")K--;W++}if(K!==0)continue;let z=Z.slice(G,W-1).trim(),q=W,U=Z.slice(q),j=U.indexOf("@endmemo");if(j===-1)continue;let _=U.slice(0,j),B=q+j+8,H=_.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),L=H?H[0].length:0,V=_.slice(L),O=_.match(/(\s*)$/),F=O?O[0].length:0,w=V.slice(0,V.length-F),A=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),R;if(A){let[N,M,T="",I]=A,E=`<${M}${T} data-stx-memo="${z}"${I}>`;R=_.slice(0,L)+E+w.slice(N.length)+_.slice(L+w.length)}else R=`${_.slice(0,L)}<div data-stx-memo="${z}">${w}</div>${_.slice(L+w.length)}`;X.push({start:Q,end:B,replacement:R}),Y.lastIndex=B}for(let Q=X.length-1;Q>=0;Q--){let G=X[Q];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function h6($){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 MJ($){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"),J="",X=0,Q;while((Q=Y.exec($))!==null){let G=Q.index,K=G+Q[0].length,W=!1,z=!1,q=-1;while(K<$.length){let H=$[K];if(W){if(H==="'")W=!1}else if(z){if(H==='"')z=!1}else if(H==="'")W=!0;else if(H==='"')z=!0;else if(H===">"){q=K;break}K++}if(q===-1)continue;if($.slice(G,q+1).includes("x-cloak"))continue;let j=$.slice(q+1),_=j.indexOf("</"),B=_>=0?j.slice(0,_):j.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(B))J+=$.slice(X,q)+" x-cloak>",X=q+1}return J+=$.slice(X),J}function TJ($){let Z=/<[a-z][\w-]*/gi,Y="",J=0,X;while((X=Z.exec($))!==null){let Q=X.index,G=X[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let B=`</${G}>`,H=$.toLowerCase().indexOf(B,Q);if(H!==-1)Z.lastIndex=H+B.length;continue}let K=Q+X[0].length,W=!1,z=!1,q=-1;while(K<$.length){let B=$[K];if(W){if(B==="'")W=!1}else if(z){if(B==='"')z=!1}else if(B==="'")W=!0;else if(B==='"')z=!0;else if(B===">"){q=K;break}K++}if(q===-1)continue;let U=$.slice(Q+X[0].length,q);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(U))continue;if(!Yj.test(U))continue;let j=$[q-1]==="/",_=j?q-1:q;Y+=`${$.slice(J,_)} x-cloak${j?" ":""}`,J=_}return Y+=$.slice(J),Y}var Yj;var d6=S(()=>{W1();w0();Yj=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function
|
|
9460
|
+
</style>`;J=J.replace(z,V),K.lastIndex=0}catch(L){}}}return J}var RJ=S(()=>{b1()});function f6($,Z){let Y=$,J=/@json\s*\(/g,X;while((X=J.exec(Y))!==null){let Q=X.index,G=Q+X[0].length-1,K=1,W=G+1,z=null,q=!1;while(W<Y.length&&K>0){let F=Y[W];if(q){q=!1,W++;continue}if(F==="\\"&&z){q=!0,W++;continue}if(z){if(F===z)z=null;W++;continue}if(F==='"'||F==="'"||F==="`"){z=F,W++;continue}if(F==="(")K++;else if(F===")"){if(K--,K===0)break}W++}if(K!==0)break;let U=Y.substring(G+1,W).trim(),j=Y.substring(Q,W+1),_=-1,B=0,H=null,L=!1;for(let F=0;F<U.length;F++){let w=U[F];if(L){L=!1;continue}if(w==="\\"&&H){L=!0;continue}if(H){if(w===H)H=null;continue}if(w==='"'||w==="'"||w==="`"){H=w;continue}if(w==="("||w==="["||w==="{")B++;else if(w===")"||w==="]"||w==="}")B--;if(w===","&&B===0){_=F;break}}let V=_>=0?U.substring(0,_).trim():U,O=_>=0?U.substring(_+1).trim():void 0;try{let F=V.trim(),w;if(K0(F))w=W0(F,Object.keys(Z))(...Object.values(Z));else w=void 0;let A;if(O==="true")A=JSON.stringify(w,null,2);else A=JSON.stringify(w);let R=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,Q)+R+Y.substring(W+1),J.lastIndex=Q+R.length}catch(F){t0.log(F instanceof Error?F:Error(String(F)),{directive:"@json"},"error"),J.lastIndex=Q+j.length}}return Y}function g6($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function NJ($){let Z=$,Y=/@memo\s*\(/g,J,X=[];while((J=Y.exec(Z))!==null){let Q=J.index,G=Q+J[0].length,K=1,W=G;while(W<Z.length&&K>0){if(Z[W]==="(")K++;else if(Z[W]===")")K--;W++}if(K!==0)continue;let z=Z.slice(G,W-1).trim(),q=W,U=Z.slice(q),j=U.indexOf("@endmemo");if(j===-1)continue;let _=U.slice(0,j),B=q+j+8,H=_.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),L=H?H[0].length:0,V=_.slice(L),O=_.match(/(\s*)$/),F=O?O[0].length:0,w=V.slice(0,V.length-F),A=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),R;if(A){let[N,M,T="",I]=A,E=`<${M}${T} data-stx-memo="${z}"${I}>`;R=_.slice(0,L)+E+w.slice(N.length)+_.slice(L+w.length)}else R=`${_.slice(0,L)}<div data-stx-memo="${z}">${w}</div>${_.slice(L+w.length)}`;X.push({start:Q,end:B,replacement:R}),Y.lastIndex=B}for(let Q=X.length-1;Q>=0;Q--){let G=X[Q];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function h6($){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 MJ($){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"),J="",X=0,Q;while((Q=Y.exec($))!==null){let G=Q.index,K=G+Q[0].length,W=!1,z=!1,q=-1;while(K<$.length){let H=$[K];if(W){if(H==="'")W=!1}else if(z){if(H==='"')z=!1}else if(H==="'")W=!0;else if(H==='"')z=!0;else if(H===">"){q=K;break}K++}if(q===-1)continue;if($.slice(G,q+1).includes("x-cloak"))continue;let j=$.slice(q+1),_=j.indexOf("</"),B=_>=0?j.slice(0,_):j.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(B))J+=$.slice(X,q)+" x-cloak>",X=q+1}return J+=$.slice(X),J}function TJ($){let Z=/<[a-z][\w-]*/gi,Y="",J=0,X;while((X=Z.exec($))!==null){let Q=X.index,G=X[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let B=`</${G}>`,H=$.toLowerCase().indexOf(B,Q);if(H!==-1)Z.lastIndex=H+B.length;continue}let K=Q+X[0].length,W=!1,z=!1,q=-1;while(K<$.length){let B=$[K];if(W){if(B==="'")W=!1}else if(z){if(B==='"')z=!1}else if(B==="'")W=!0;else if(B==='"')z=!0;else if(B===">"){q=K;break}K++}if(q===-1)continue;let U=$.slice(Q+X[0].length,q);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(U))continue;if(!Yj.test(U))continue;let j=$[q-1]==="/",_=j?q-1:q;Y+=`${$.slice(J,_)} x-cloak${j?" ":""}`,J=_}return Y+=$.slice(J),Y}var Yj;var d6=S(()=>{W1();w0();Yj=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function u6($,Z,Y){let J=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},X=J.allowPatterns??[],Q=[];for(let{pattern:G,message:K,suggestion:W}of Jj){if(X.some((q)=>K.includes(q)||G.source.includes(q)))continue;G.lastIndex=0;let z=$.match(G);if(z&&z.length>0){let q=$.split(`
|
|
9458
9461
|
`),U=[];q.forEach((_,B)=>{if(G.lastIndex=0,G.test(_))U.push(B+1)});let j=U.length>0?` (line${U.length>1?"s":""}: ${U.join(", ")})`:"";Q.push(` \u2717 ${K}${j}
|
|
9459
9462
|
\u2192 ${W}`)}}if(Q.length>0&&J.enabled){let K=`[STX] DOM API violation in ${Z.split("/").pop()||Z}:
|
|
9460
9463
|
${Q.join(`
|
|
9461
9464
|
`)}
|
|
9462
|
-
Tip: prefer useRef(), navigate(), and composables for component code`;if(J.failOnViolation)throw Error(K);else console.warn(K)}}var Jj;var
|
|
9465
|
+
Tip: prefer useRef(), navigate(), and composables for component code`;if(J.failOnViolation)throw Error(K);else console.warn(K)}}var Jj;var m6=S(()=>{Jj=[{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 IJ={};a(IJ,{getStoreScript:()=>Xj,clearStoreCache:()=>Qj});import e4 from"path";async function Xj($){let Z;if($)Z=e4.resolve($);else{let q=await z1();Z=e4.resolve(q.root||process.cwd(),q.storesDir||"stores")}let Y=N5.get(Z);if(Y!==void 0)return Y||null;let J=new Bun.Glob("*.ts"),X=[];try{for await(let q of J.scan({cwd:Z,absolute:!0})){let U=e4.basename(q,".ts");if(["index","types"].includes(U))continue;if(q.includes(".d.ts"))continue;X.push(q)}}catch{return N5.set(Z,""),null}if(X.length===0)return N5.set(Z,""),null;let Q=[];for(let q of X){let U=await Bun.file(q).text();Q.push({file:q,hasUseStore:/useStore\s*\(/.test(U)})}Q.sort((q,U)=>{if(q.hasUseStore===U.hasUseStore)return 0;return q.hasUseStore?1:-1});let G=Q.map((q)=>q.file),K=[],W=new Bun.Transpiler({loader:"ts",target:"browser",define:l0()});for(let q of G)try{let U=await Bun.file(q).text(),j=e4.basename(q,".ts");U=U.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),U=U.replace(/^export\s+(default\s+)?/gm,""),U=W.transformSync(U),K.push(`// Store: ${j}
|
|
9463
9466
|
${U.trim()}`)}catch(U){console.warn(`[stx] Failed to load store ${q}:`,U)}if(K.length===0)return N5.set(Z,""),null;let z=`;(function(){
|
|
9464
9467
|
${K.join(`
|
|
9465
9468
|
|
|
@@ -10185,7 +10188,7 @@ else {
|
|
|
10185
10188
|
|
|
10186
10189
|
console.log('[stx] Error boundary runtime initialized');
|
|
10187
10190
|
})();
|
|
10188
|
-
`}var kj=0;var
|
|
10191
|
+
`}var kj=0;var uJ={};a(uJ,{renderSSRSuspense:()=>pj,processSuspenseDirectives:()=>hj,generateSuspenseRuntime:()=>cj,generateSuspenseCSS:()=>lj,createSSRSuspense:()=>mj});function gj(){return`suspense-${++fj}-${Date.now().toString(36)}`}function hj($,Z={},Y){let J=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(J,(X,Q,G,K)=>{let W=gj(),z=dj(Q||"");return uj(W,G.trim(),K.trim(),z)})}function dj($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3],G=J[4];switch(X){case"id":Z.id=Q;break;case"timeout":Z.timeout=G?parseInt(G,10):void 0;break}}return Z}function uj($,Z,Y,J){let X=J.timeout||30000,Q=J.id||$;return`
|
|
10189
10192
|
<div class="stx-suspense" data-suspense-id="${$}" data-custom-id="${Q}" data-status="pending">
|
|
10190
10193
|
<div class="stx-suspense-fallback" data-suspense-fallback="${$}">
|
|
10191
10194
|
${Y}
|
|
@@ -10375,7 +10378,7 @@ else {
|
|
|
10375
10378
|
}, 0);
|
|
10376
10379
|
})();
|
|
10377
10380
|
</script>
|
|
10378
|
-
`}function
|
|
10381
|
+
`}function mj($,Z,Y){return{id:$,fallback:Y,content:Z}}async function pj($){let Z=$.map((J)=>`
|
|
10379
10382
|
<div id="stx-ssr-suspense-${J.id}" class="stx-ssr-suspense">
|
|
10380
10383
|
${J.fallback}
|
|
10381
10384
|
</div>
|
|
@@ -10523,7 +10526,7 @@ else {
|
|
|
10523
10526
|
|
|
10524
10527
|
console.log('[stx] Suspense runtime initialized');
|
|
10525
10528
|
})();
|
|
10526
|
-
`}var fj=0;var cJ={};a(cJ,{processAsyncDirectives:()=>nj,isAsyncComponent:()=>sj,generateAsyncComponentRuntime:()=>aj,generateAsyncComponentCSS:()=>rj,defineAsyncComponent:()=>oj});function
|
|
10529
|
+
`}var fj=0;var cJ={};a(cJ,{processAsyncDirectives:()=>nj,isAsyncComponent:()=>sj,generateAsyncComponentRuntime:()=>aj,generateAsyncComponentCSS:()=>rj,defineAsyncComponent:()=>oj});function mJ(){return`async-${++ij}-${Date.now().toString(36)}`}function nj($,Z={},Y){let J=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,X=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,Q=$;return Q=Q.replace(J,(G,K,W,z)=>{let q=mJ(),U=pJ(K);return lJ(q,U,W.trim(),z.trim())}),Q=Q.replace(X,(G,K,W)=>{let z=mJ(),q=pJ(K);return lJ(z,q,W.trim(),'<div class="stx-async-error">Failed to load component</div>')}),Q}function pJ($){let Z={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3],G=J[4],K=J[5];switch(X){case"component":Z.component=Q||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=Q||K;break;case"errorComponent":Z.errorComponent=Q||K;break}}return Z}function lJ($,Z,Y,J){let{component:X,timeout:Q,delay:G,suspensible:K,retries:W}=Z;return`
|
|
10527
10530
|
<div class="stx-async-component" data-async-id="${$}" data-component="${X}" data-status="pending">
|
|
10528
10531
|
<div class="stx-async-loading" data-async-loading="${$}">
|
|
10529
10532
|
${Y}
|
|
@@ -12185,23 +12188,23 @@ if ('serviceWorker' in navigator) {
|
|
|
12185
12188
|
});
|
|
12186
12189
|
});
|
|
12187
12190
|
}
|
|
12188
|
-
</script>`}function y_(){return'<link rel="manifest" href="/manifest.json">'}function P_($){return`<meta name="theme-color" content="${n6($)}">`}function n6($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var dX=S(()=>{gX()});import g0 from"path";import{deriveLayoutGroup as C_}from"stx-router/layout-metadata";function
|
|
12191
|
+
</script>`}function y_(){return'<link rel="manifest" href="/manifest.json">'}function P_($){return`<meta name="theme-color" content="${n6($)}">`}function n6($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var dX=S(()=>{gX()});import g0 from"path";import{deriveLayoutGroup as C_}from"stx-router/layout-metadata";function uX($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function v_($,Z){let Y=$.length,J=Z,X=!0,Q=[],G=(K)=>K+9<=Y&&$[K]==="<"&&$[K+1]==="/"&&($[K+2]==="s"||$[K+2]==="S")&&($[K+3]==="c"||$[K+3]==="C")&&($[K+4]==="r"||$[K+4]==="R")&&($[K+5]==="i"||$[K+5]==="I")&&($[K+6]==="p"||$[K+6]==="P")&&($[K+7]==="t"||$[K+7]==="T")&&($[K+8]===">"||/\s/.test($[K+8]));while(J<Y){let K=$[J];if(G(J))return J;if(K==="/"&&$[J+1]==="/"){if(J=$.indexOf(`
|
|
12189
12192
|
`,J+2),J===-1)return-1;J+=1,X=!0;continue}if(K==="/"&&$[J+1]==="*"){let W=$.indexOf("*/",J+2);if(W===-1)return-1;J=W+2,X=!0;continue}if(K==="/"&&X){let W=J+1,z=!1;while(W<Y){let q=$[W];if(q==="\\"){W+=2;continue}if(q==="[")z=!0;else if(q==="]")z=!1;else if(q==="/"&&!z){W++;break}else if(q===`
|
|
12190
12193
|
`){W=-1;break}W++}if(W===-1){J++,X=!1;continue}while(W<Y&&/[a-z]/.test($[W]))W++;J=W,X=!1;continue}if(K==="'"||K==='"'){let W=K;J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]===W){J++;break}if($[J]===`
|
|
12191
|
-
`)break;J++}X=!1;continue}if(K==="`"){J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,X=!0;break}J++}if(Q.length===0)X=!1;continue}if(K==="}"&&Q.length>0){Q.pop(),J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++,X=!1;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,X=!0;break}J++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))X=!1;else X=!0;J++}return-1}function Y7($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=new RegExp(`<script\\b(?=[^>]*\\b${Y}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!J)return null;let X=J.index+J[0].length,Q=$.indexOf("</script>",X);if(Q===-1)return null;let G=$.indexOf(">",Q);if(G===-1)return null;return{start:J.index,end:G+1}}function
|
|
12194
|
+
`)break;J++}X=!1;continue}if(K==="`"){J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,X=!0;break}J++}if(Q.length===0)X=!1;continue}if(K==="}"&&Q.length>0){Q.pop(),J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++,X=!1;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,X=!0;break}J++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))X=!1;else X=!0;J++}return-1}function Y7($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=new RegExp(`<script\\b(?=[^>]*\\b${Y}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!J)return null;let X=J.index+J[0].length,Q=$.indexOf("</script>",X);if(Q===-1)return null;let G=$.indexOf(">",Q);if(G===-1)return null;return{start:J.index,end:G+1}}function mX($){let Z=0;while(Z<$.length){let Y=$.indexOf("<",Z);if(Y===-1)return-1;if($.startsWith("<!--",Y)){let Q=$.indexOf("-->",Y+4);Z=Q===-1?$.length:Q+3;continue}let J=$.slice(Y),X=/^<style\b[^>]*>/i.exec(J);if(X){let Q=$.toLowerCase().indexOf("</style>",Y+X[0].length);Z=Q===-1?$.length:Q+8;continue}if(/^<script\b[^>]*>/i.test(J))return Y;Z=Y+1}return-1}function x_($){let Z=Y7($,"data-stx-runtime");if(!Z)return $;let Y=mX($);if(Y===-1||Y===Z.start)return $;let J=$.slice(Z.start,Z.end),X=$.slice(0,Z.start)+$.slice(Z.end),Q=mX(X);if(Q===-1)return J+`
|
|
12192
12195
|
`+X;return X.slice(0,Q)+J+`
|
|
12193
12196
|
`+X.slice(Q)}async function O0($,Z,Y,J,X){if(J.ssr===!1&&!J.autoShell&&J.buildMode==="spa")return $;let Q=!Z.__stxProcessingDepth;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((J.debug||!Z$()&&!M4())&&Y&&Y.endsWith(".stx"))e3($,Y);try{return await l9.timeAsync("template-processing",async()=>{let G=await f_($,Z,Y,J,X);if(Q)G=h6(G);if(Q&&J.autoShell&&J.buildMode!=="compile"){let K=J.app?.head||{},z=(Z.__stx_runtime_head||null)??V7(),q=(Z.__stx_head_raw||"").trim(),U,j=q.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(j)U=j[1].trim(),q=q.replace(j[0],"").trim();let _=Z.__sections?.title,B=z.title||U||_,H={...K,...B&&{title:B},meta:[...K.meta||[],...z.meta||[]],link:[...K.link||[],...z.link||[]],script:[...K.script||[],...z.script||[]],headRaw:[K.headRaw,q].filter(Boolean).join(`
|
|
12194
12197
|
`),...z.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},...z.htmlAttrs}},...z.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...z.bodyAttrs}}},L=x6(G);if(G=FJ(G,H),L)G=LJ(G,K);let V=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(V&&G.includes("<head")){let F=V[1],w=C_(F);G=G.replace("<head>",`<head>
|
|
12195
|
-
<meta name="stx-layout" content="${
|
|
12196
|
-
<meta name="stx-layout-group" content="${
|
|
12198
|
+
<meta name="stx-layout" content="${uX(F)}">
|
|
12199
|
+
<meta name="stx-layout-group" content="${uX(w)}">`)}let O=G.match(/function (__stx_setup_\d+_\d+)\(/);if(O&&G.includes("<body")&&!G.match(/<body[^>]*data-stx=/)){G=G.replace(/<body([^>]*)>/,`<body$1 data-stx="${O[1]}">`);let F=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${O[1]}"`,"i");G=G.replace(F,"$1")}}if(Q)G=OJ(G),G=x_(G);if(Q)try{let{getStoreScript:K}=await Promise.resolve().then(() => (DJ(),IJ)),W=J.storesDir,z=await K(W);if(z){let q=`<script data-stx-stores>${z}</script>`,U=Y7(G,"data-stx-runtime");if(U)G=G.slice(0,U.end)+`
|
|
12197
12200
|
`+q+G.slice(U.end)}}catch{}if(Q)try{let{getComposableScript:K}=await Promise.resolve().then(() => (bJ(),kJ)),W=J.composablesDir,z=await K(W);if(z){let q=`<script data-stx-composables>${z}</script>`,U=Y7(G,"data-stx-stores")||Y7(G,"data-stx-runtime");if(U)G=G.slice(0,U.end)+`
|
|
12198
12201
|
`+q+G.slice(U.end)}}catch{}if(Q&&Z.__stx_inject_css!==!1)G=await Q$(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof E4)throw G;let K=G instanceof Error?G.message:String(G),W=new p1(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(t0.log(W,{filePath:Y,context:Z}),T3.logDetailedError(W,{filePath:Y,template:$.substring(0,500)}),J.debug)throw W;return N3.createFallbackContent("Template Processing",W)}}async function f_($,Z,Y,J,X){let Q=process.cwd(),G={...J,partialsDir:J.partialsDir&&!g0.isAbsolute(J.partialsDir)?g0.resolve(Q,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!g0.isAbsolute(J.componentsDir)?g0.resolve(Q,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!g0.isAbsolute(J.layoutsDir)?g0.resolve(Q,J.layoutsDir):J.layoutsDir},K=G,W=$;await d_(Y,Z),h_(Z,K),W=await _5(()=>ZJ(W,Z,Y,K),W,(O)=>{t0.log(O,{filePath:Y,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Y}: ${O.message}`)}),W=W.replace(/\{\{--[\s\S]*?--\}\}/g,"");let z=Z1(W,d5,(O,F)=>`\x00STX_HTML_COMMENT_${F}\x00`);W=z.output;let q=z.tokens,U=(O)=>q.length===0?O:O.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(F,w)=>q[Number(w)]??""),j="\x00STX_ESCAPED_AT\x00";W=W.replace(/@@/g,j),W=W.replace(/@\{\{([\s\S]*?)\}\}/g,(O,F)=>{return`{{ ${F} }}`}),W=jJ(W),W=await AJ(W,Y,X);let _={};W=P6(W,_);let B={...Z.__sections||{}},H="",L=/@nolayout\b/.test(W);if(L)W=W.replace(/@nolayout\b\s*/g,"");let V=W.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(V)H=V[1],W=W.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!H&&!L&&K.defaultLayout){let O=/<!DOCTYPE\s/i.test(W),F=/@section\s*\(/.test(W);if(!O||F){let w="",A=g0.dirname(Y),R=K.layoutsDir?g0.dirname(K.layoutsDir):process.cwd();for(let N=0;N<20;N++){let M=g0.join(A,"_layout.stx");if(await c(M)){w=M;break}let T=g0.dirname(A);if(T===A||T.length<R.length)break;A=T}if(w)H=w;else if(K.layoutsDir){let N=g0.isAbsolute(K.layoutsDir)?K.layoutsDir:g0.resolve(process.cwd(),K.layoutsDir),M=g0.join(N,`${K.defaultLayout}.stx`);if(await c(M))H=M}if(H&&!F)W=`@section('content')
|
|
12199
12202
|
${W.trim()}
|
|
12200
12203
|
@endsection`}}if(W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,F,w)=>{return B[F]=w,""}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,F,w)=>{if(/^(['"]).*\1$/.test(w.trim()))return O;try{let A=$0(w.trim(),Z);if(A===void 0)return O;return B[F]=String(A??""),""}catch{return O}}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,F,w)=>{if(w.includes("@parent"))B[F]=w.replace("@parent",a1);else B[F]=w.trim();return""}),Z.__sections=B,W=W.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,F,w)=>{return B[F]||w||""}),!("slot"in Z)||Z.slot===void 0)W=W.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(W=C6(W,_),H){let O=[],F=L1(W),w=Z1(F.output,Y5,(A,R)=>`\x00STX_ORPHAN_STYLE_${R}\x00`);if(W=w.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(A,R,N)=>{let M=R==="SCRIPT"?F.scripts[Number(N)]:w.tokens[Number(N)];if(M)O.push(M);return""}),O.length>0){let A=O.join(`
|
|
12201
12204
|
`);B.content=B.content?`${B.content}
|
|
12202
|
-
${A}`:A,Z.__sections=B}}if(H)try{let O;if(g0.isAbsolute(H))O=H,X.add(H);else O=await _5(()=>
|
|
12203
|
-
${W}`,U(W)}catch(O){return t0.log(O instanceof Error?O:Error(String(O)),{layoutPath:H,filePath:Y},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return U(await pX(W,Z,Y,G,X))}function g_($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Y,J,X)=>{let Q=Z[J];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return X||""})}function h_($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let Y=Z.envPrefix||"STX_PUBLIC_",J={};for(let[X,Q]of Object.entries(process.env))if(X.startsWith(Y)&&Q!==void 0)J[X]=Q;$.$env=J}async function d_($,Z){await _5(()=>GJ($,Z),void 0,(Y)=>{t0.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function
|
|
12204
|
-
`;if(Q=T(Q,Z),Q=I(Q,Z),Q=XJ(Q),Q=g3(Q,Z),Q=
|
|
12205
|
+
${A}`:A,Z.__sections=B}}if(H)try{let O;if(g0.isAbsolute(H))O=H,X.add(H);else O=await _5(()=>m7(H,Y,G,X),null,()=>{throw new p1(`Failed to resolve layout path: ${H}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!O){let M=`Layout not found: ${H} (referenced from ${Y})`;if(t0.log(Error(M),{layoutPath:H,filePath:Y},"warning"),G.debug)throw new p1(M,Y);return W}let F=await _5(()=>Bun.file(O).text(),"",()=>{throw new p1(`Failed to read layout file: ${O}`,Y,void 0,void 0,"Layout content could not be loaded")}),w=F.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(w){if(G.debug)console.log(`Found nested layout: ${w[1]} in ${O}`);let M={},T=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(D,y,b)=>{return M[y]=b.trim(),""});for(let[D,y]of Object.entries(M))if(B[D]&&B[D].includes(a1)){let b=B[D].indexOf(a1);B[D]=B[D].slice(0,b)+y+B[D].slice(b+a1.length)}else if(!B[D])B[D]=y;let I={...Z,__sections:B},E=`@layout('${w[1]}')${T}`;return await O0(E,I,O,G,X)}let A=F.replace(/\{\{--[\s\S]*?--\}\}/g,""),R=P6(A,_),N={};return R=R.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(M,T,I)=>{return N[T]=I.trim(),`@slot('${T}')`}),R=R.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(M,T,I)=>{if(B[T]){let E=B[T];if(E.includes(a1)){let D=N[T]||"",y=E.indexOf(a1);E=E.slice(0,y)+D+E.slice(y+a1.length)}return E}return I||""}),R=g_(R,B),R=R.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),R=C6(R,_),Z.__originalFilePath=Y,W=await pX(R,Z,O,G,X),W=`<!-- stx-layout: ${H} -->
|
|
12206
|
+
${W}`,U(W)}catch(O){return t0.log(O instanceof Error?O:Error(String(O)),{layoutPath:H,filePath:Y},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return U(await pX(W,Z,Y,G,X))}function g_($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Y,J,X)=>{let Q=Z[J];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return X||""})}function h_($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let Y=Z.envPrefix||"STX_PUBLIC_",J={};for(let[X,Q]of Object.entries(process.env))if(X.startsWith(Y)&&Q!==void 0)J[X]=Q;$.$env=J}async function d_($,Z){await _5(()=>GJ($,Z),void 0,(Y)=>{t0.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function u_($,Z,Y){let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,X;while((X=J.exec($))!==null){let Q=X[1],G=X[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:W}=await Promise.resolve().then(() => (o5(),y$));await W(G,Z,Y,{preserveExisting:!0})}catch(W){let z=W instanceof Error?W:Error(String(W));t0.log(z,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${z.message}`)}}}async function m_($,Z,Y){try{let{interpolateScriptsInTemplate:J}=await Promise.resolve().then(() => (Y1(),d9));return J($,Z,{skipServer:!0})}catch(J){let X=J instanceof Error?J:Error(String(J));return t0.log(X,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${X.message}`),$}}async function pX($,Z,Y,J,X){let Q=$,G=J;if(await u_(Q,Z,Y),Q=await m_(Q,Z,Y),Q=await sY(Q,Z,Y),Q=await rY(Q,Z,Y),Q=await p2(Q,Z,Y,G),J5(Q))Q=x7(Q,Z),Q=g7(Q,Z);Q=f7(Q);let{processStreamDirectives:K}=await Promise.resolve().then(() => (t3(),a3));Q=K(Q,Z),Q=k6(Q,Z,Y,G),Q=await o4(Q,Z,Y,G,X),Q=await BJ(Q,Z,Y,G,X),Q=G9(Q,Z,Y,G);let{processDeferDirectives:W}=await Promise.resolve().then(() => yJ);Q=W(Q,Z,Y);let{processTeleportDirectives:z}=await Promise.resolve().then(() => CJ);Q=z(Q,Z,Y);let{processTransitionDirectives:q,processTransitionAttributes:U}=await Promise.resolve().then(() => gJ);Q=q(Q,Z,Y),Q=U(Q);let{processErrorBoundaryDirectives:j}=await Promise.resolve().then(() => dJ);Q=j(Q,Z,Y);let{processSuspenseDirectives:_}=await Promise.resolve().then(() => uJ);Q=_(Q,Z,Y);let{processAsyncDirectives:B}=await Promise.resolve().then(() => cJ);Q=B(Q,Z,Y);let{processKeepAliveDirectives:H}=await Promise.resolve().then(() => nJ);Q=H(Q,Z,Y);let{processVirtualListDirectives:L,processVirtualGridDirectives:V,processInfiniteListDirectives:O}=await Promise.resolve().then(() => (eJ(),tJ));Q=L(Q,Z,Y),Q=V(Q,Z,Y),Q=O(Q,Z,Y);let{processPartialHydrationDirectives:F,processStaticDirectives:w}=await Promise.resolve().then(() => (BX(),_X));Q=F(Q,Z,Y),Q=w(Q);let{processComputedDirectives:A,processWatchDirectives:R}=await Promise.resolve().then(() => (IX(),TX));Q=A(Q,Z,Y),Q=R(Q,Z,Y);let{processFormValidationDirectives:N}=await Promise.resolve().then(() => (SX(),bX));Q=N(Q,Z,Y);let{processHeadDirective:M,processTitleDirective:T,processMetaDirective:I,resetHead:E}=await Promise.resolve().then(() => (i5(),A7));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)E();let D=M(Q);if(Q=D.content,D.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${D.headContent}
|
|
12207
|
+
`;if(Q=T(Q,Z),Q=I(Q,Z),Q=XJ(Q),Q=g3(Q,Z),Q=u2(Q),Q=eY(Q),Q=await y6(Q,Z,Y,G,X),Q=await o4(Q,Z,Y,G,X),Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=h6(Q),Q=i1(Q,Z,Y),Q=h3(Q,Z),Q=d3(Q,Z),Q=h4(Q,Z),Q=t2(Q,Z),Q=e2(Q,Z),Q=await k2(Q,Z,Y,G),Q=await g8(Q,Z,Y),Q=await XY(Q,Z,Y,G),Q=e6(Q,Z,Y,G),Q=iZ(Q,Z,Y,G),Q=nZ(Q,Z,Y),Q=oZ(Q,Z,Y,G),Q=g2(Q,Z,Y,G),Q=f6(Q,Z),Q=g6(Q),Q=NJ(Q),!G.skipEventDirectives)Q=R2(Q,Z,Y);if(Q=D2(Q,Z,Y),G.debug){let n=/\bx-data\s*=/.test(Q),J0=o$($);if(n&&J0)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
12205
12208
|
Both work on the same page, but they manage separate scopes.
|
|
12206
12209
|
Prefer signals (state/derived/effect) for new components.`)}Q=zJ(Q,Z),Q=await F1(Q,Z,Y),Q=MJ(Q),Q=TJ(Q),Q=_2(Q);let{processXElementDirectives:y}=await Promise.resolve().then(() => CX);Q=y(Q);let b=Z.__originalFilePath||Y,k=f5(Z);if(Q=await h7(Q,G,b,k),Q=o2(Q,Z),Q=await YJ(Q,Z,Y,G),G.media?.image?.autoSiblings){let n=G.publicDir||"public",{rewriteImagesWithSiblings:J0}=await Promise.resolve().then(() => (xX(),vX));Q=await J0(Q,{publicDir:n})}if(G.seo?.enabled)Q=sZ(Q,Z,G);let v=(n,J0,B0=!0)=>{if(!J0)return n;let R0=J0.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),C=n.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(R0&&C){if(B0)n=n.replace(C[0],R0[0]);if(J0=J0.replace(R0[0],"").trim(),!J0)return n}if(/<\/head>/i.test(n))return n.replace(/<\/head>/i,`${J0}
|
|
12207
12210
|
</head>`);if(/<head\b[^>]*>/i.test(n))return n.replace(/(<head\b[^>]*>)/i,`$1
|
|
@@ -12214,7 +12217,7 @@ ${z2()}
|
|
|
12214
12217
|
`+x}else Q=Q.replace("</head>",`${J0}
|
|
12215
12218
|
</head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
|
|
12216
12219
|
${J0}`);else Q=J0+`
|
|
12217
|
-
`+Q}{let{scanScriptTags:n}=await Promise.resolve().then(() => (t5(),s$)),J0=[];for(let B0 of n(Q)){if(!/\bserver\b/i.test(B0.attrs))continue;let R0=B0.start+B0.fullMatch.indexOf(">")+1,C=v_(Q,R0);if(C===-1)continue;let P=C+9;while(P<Q.length&&/\s/.test(Q[P]))P++;J0.push({start:B0.start,end:P})}for(let B0=J0.length-1;B0>=0;B0--){let{start:R0,end:C}=J0[B0];Q=Q.substring(0,R0)+Q.substring(C)}}let r=E$(Q,Y);if(r.hasScoped)Q=r.html;let Q0=Z.__stx_event_bindings||[],k0=!1,n0=[],j1=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:t1}=await Promise.resolve().then(() => (t5(),s$));for(let n of t1(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))n0.push({match:n.fullMatch,attrs:n.attrs,content:n.body});for(let{match:n,attrs:J0,content:B0}of n0){k0=!0;let R0=B0;
|
|
12220
|
+
`+Q}{let{scanScriptTags:n}=await Promise.resolve().then(() => (t5(),s$)),J0=[];for(let B0 of n(Q)){if(!/\bserver\b/i.test(B0.attrs))continue;let R0=B0.start+B0.fullMatch.indexOf(">")+1,C=v_(Q,R0);if(C===-1)continue;let P=C+9;while(P<Q.length&&/\s/.test(Q[P]))P++;J0.push({start:B0.start,end:P})}for(let B0=J0.length-1;B0>=0;B0--){let{start:R0,end:C}=J0[B0];Q=Q.substring(0,R0)+Q.substring(C)}}let r=E$(Q,Y);if(r.hasScoped)Q=r.html;let Q0=Z.__stx_event_bindings||[],k0=!1,n0=[],j1=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:t1}=await Promise.resolve().then(() => (t5(),s$));for(let n of t1(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))n0.push({match:n.fullMatch,attrs:n.attrs,content:n.body});for(let{match:n,attrs:J0,content:B0}of n0){k0=!0;let R0=B0;u6(B0,Y,J.strict);let C=await g5(B0,{eventBindings:Q0,attrs:J0,hasColonDirectives:j1,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:k});Q=Q.replace(n,()=>C)}if(k0)Z.__stx_event_bindings=[];if(G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=f2(Q,Z.cspNonce);return Q}var a1="<!--PARENT_CONTENT_PLACEHOLDER-->";var e$=S(()=>{P4();C1();Q7();q2();B2();O2();W7();G7();N2();h5();E2();b2();x4();h2();m2();c2();s2();W1();i5();Y1();$Y();QY();oY();tY();b6();p7();JJ();K5();QJ();I3();M0();KJ();qJ();_J();HJ();L7();t5();E6();RJ();d6();m6();w0();$6();d6();m6()});import F0 from"fs";import G0 from"path";import{matchRoute as UB,Router as GQ}from"stx-router";import{findErrorPage as BB,formatRoutes as HB,generateRouteManifest as OB,generateRouteTypes as LB,matchRoute as FB}from"stx-router";function X7($,Z={}){return new GQ($,Z).routes}e$();import{createHash as p_}from"crypto";function l_($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}var c_=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function i_($){return Bun.hash($).toString(16)}function lX($,Z={}){if(!$.includes('type="stx/island"'))return{html:$,chunks:[]};let Y=new Map,J=$.replace(c_,(Q,G,K,W)=>{let z=W.trim();if(!z)return Q;if(/\bdata-stx-src=/.test(K))return Q;if(Z.minify)z=l_(z);let q=i_(z);if(!Y.has(q))Y.set(q,z);let U=Z.integrity?` data-stx-integrity="sha384-${p_("sha384").update(z).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${G}" data-stx-src="/_stx/islands/${q}.js"${U}${K}></script>`}),X=Array.from(Y,([Q,G])=>({hash:Q,code:G}));return{html:J,chunks:X}}var n_=new Set(["visible","idle"]);function cX($){if(!$.includes("data-stx-src="))return $;let Z=new Map,Y=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,J;while((J=Y.exec($))!==null)Z.set(J[1],J[2]);let X=new Set,Q=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,G;while((G=Q.exec($))!==null)if(n_.has(Z.get(G[1])||""))X.add(G[2]);let K=$.lastIndexOf("</head>");if(X.size===0||K===-1)return $;let W=Array.from(X).filter((z)=>!$.includes(`rel="prefetch" href="${z}"`)).map((z)=>`<link rel="prefetch" href="${z}" as="script">`).join("");if(!W)return $;return $.slice(0,K)+W+$.slice(K)}c1();y5();P4();import{abortNavigation as iR,clearMiddleware as iX,createClientCookieManager as nR,createMiddlewareContext as nX,createRouteLocation as oX,createServerCookieManager as oR,createStorageManager as sR,defineMiddleware as rR,getMiddleware as aR,getMiddlewareNames as sX,hasMiddleware as tR,loadMiddlewareFromDirectory as rX,navigateTo as eR,registerMiddleware as $N,runMiddleware as aX}from"stx-router";class tX{cacheDir;cache=new Map;loaded=!1;constructor($){this.cacheDir=$}async load(){if(this.loaded)return;let $=G0.join(this.cacheDir,"build-cache.json");if(await Bun.file($).exists())try{let Z=JSON.parse(await Bun.file($).text());for(let[Y,J]of Object.entries(Z))this.cache.set(Y,J)}catch{}this.loaded=!0}async save(){await F0.promises.mkdir(this.cacheDir,{recursive:!0});let $=G0.join(this.cacheDir,"build-cache.json"),Z={};for(let[Y,J]of this.cache)Z[Y]=J;await Bun.write($,JSON.stringify(Z))}getHash($,Z){let Y=F0.statSync($),J=`${$}:${Y.mtimeMs}`;for(let Q of Z)if(F0.existsSync(Q)){let G=F0.statSync(Q);J+=`:${Q}:${G.mtimeMs}`}let X=0;for(let Q=0;Q<J.length;Q++){let G=J.charCodeAt(Q);X=(X<<5)-X+G,X=X&X}return Math.abs(X).toString(36)}get($,Z){let Y=this.cache.get($);if(!Y)return null;let J=this.getHash(Z,Y.dependencies??[]);if(Y.hash!==J)return this.cache.delete($),null;return Y.html}set($,Z,Y,J){let X=this.getHash(Z,Y);this.cache.set($,{hash:X,html:J,generatedAt:Date.now(),dependencies:Y})}}class eX{cacheDir;constructor($){this.cacheDir=$}getFilePath($){let Z=$.replace(/[^a-zA-Z0-9]/g,"_")+".json";return G0.join(this.cacheDir,"isr",Z)}async get($){let Z=this.getFilePath($);if(!await Bun.file(Z).exists())return null;try{return JSON.parse(await Bun.file(Z).text())}catch{return null}}async set($,Z){let Y=this.getFilePath($);await F0.promises.mkdir(G0.dirname(Y),{recursive:!0}),await Bun.write(Y,JSON.stringify(Z))}async invalidate($){let Z=this.getFilePath($);if(await Bun.file(Z).exists())await F0.promises.unlink(Z)}async invalidatePattern($){let Z=G0.join(this.cacheDir,"isr");if(!F0.existsSync(Z))return;let Y=await F0.promises.readdir(Z);for(let J of Y){let X=J.replace(/_/g,"/").replace(".json","");if($.test(X))await F0.promises.unlink(G0.join(Z,J))}}async needsRevalidation($){let Z=await this.get($);if(!Z)return!0;return Date.now()>Z.revalidateAfter}}async function o_($){try{let Y=(await Bun.file($).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!Y)return null;let J=Y[1];if(!J.includes("getStaticPaths"))return null;let X=J.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!X)return null;return await Function(`
|
|
12218
12221
|
return (async function getStaticPaths() {
|
|
12219
12222
|
${X[1]}
|
|
12220
12223
|
})()
|