@stacksjs/stx 0.2.194 → 0.2.195
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 +440 -440
- package/dist/craft.js +232 -232
- package/dist/pwa.js +252 -252
- package/dist/ssg.js +215 -215
- package/dist/variable-extractor.js +12 -2
- package/package.json +5 -5
package/dist/craft.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var Nq=Object.defineProperty;var kq=(X)=>X;function Iq(X,$){this[X]=kq.bind(null,$)}var
|
|
2
|
+
var Nq=Object.defineProperty;var kq=(X)=>X;function Iq(X,$){this[X]=kq.bind(null,$)}var a=(X,$)=>{for(var Z in $)Nq(X,Z,{get:$[Z],enumerable:!0,configurable:!0,set:Iq.bind($,Z)})};var E=(X,$)=>()=>(X&&($=X(X=0)),$);var Z0=import.meta.require;var l6=()=>{};function c6(X,$,Z,Y){let J=X;J=J.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Q,w,W)=>{let U={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[w]||"Make this element accessible";return`<!-- a11y-hint: ${W||U} -->`});let G=/@screenReader\(([^@]*)\)@endScreenReader/g;return J=J.replace(G,(Q,w)=>{return`<span class="sr-only">${w.trim()}</span>`}),J=J.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(Q,w,W)=>{return`<span id="${`desc-${w}`}" class="sr-only">${W}</span>`}),J}var p6,i6;var I$=E(()=>{l6();p6={name:"a11y",handler:(X,$,Z,Y)=>{if(!$.length)return X;let J=$[0].replace(/['"]/g,""),G=$.length>1?$[1].replace(/['"]/g,""):"",w={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[J]||"Make this element accessible";return`<!-- a11y-hint: ${G||w} -->${X}`},hasEndTag:!1},i6={name:"screenReader",handler:(X)=>{return`<span class="sr-only">${X}</span>`},hasEndTag:!0}});function IU(X,$={}){let{duration:Z,delay:Y,ease:J,direction:G,custom:Q}={...F1,...$};if(X==="custom"&&Q)return Q;switch(X){case"fade":return`${G==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":G==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
|
|
3
3
|
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
|
|
4
4
|
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${G==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":G==="out"?"transform: translateY(0); opacity: 1; animation: slideOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: translateY(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
|
|
5
5
|
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
|
|
@@ -236,9 +236,9 @@ else {
|
|
|
236
236
|
</head>`)}if(J.includes("stx-observe")){if(!J.includes("Intersection Observer for scroll animations")){let W=yU(),q=J.lastIndexOf("</body>");if(q!==-1)J=J.slice(0,q)+W+`
|
|
237
237
|
`+J.slice(q)}}return J}var F1,n6,r6,s6,o6;var E$=E(()=>{F1={duration:300,delay:0,ease:"ease",direction:"both"};n6={name:"transition",handler:(X,$,Z,Y)=>{if($.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${X}`;let J=$[0],G=$.length>1?Number.parseInt($[1],10)||F1.duration:F1.duration,Q=$.length>2?$[2]||F1.ease:F1.ease,w=$.length>3?Number.parseInt($[3],10)||F1.delay:F1.delay,W=$.length>4?$[4]||F1.direction:F1.direction,q=`stx-transition-${Math.random().toString(36).substr(2,9)}`,U=IU(J,{duration:G,delay:w,ease:Q,direction:W}),K="stx-transition",z="";if(J==="fade")z="stx-fade";else if(J==="slide")z="stx-slide";else if(J==="scale")z="stx-scale";else if(J==="flip")z="stx-flip";else if(J==="rotate")z="stx-rotate";return`<div id="${q}" class="${K} ${z} ${W==="out"?"stx-out":""}"
|
|
238
238
|
style="--stx-transition-duration: ${G}ms; --stx-transition-ease: ${Q}; --stx-transition-delay: ${w}ms;">${X}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},r6={name:"scrollAnimate",handler:(X,$,Z,Y)=>{if($.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${X}`;let J=$[0],G=$.length>1?Number.parseInt($[1],10)||300:300,Q=$.length>2?$[2]||"ease":"ease",w=$.length>3?Number.parseFloat($[3])||0.2:0.2,W=$.length>4?Number.parseInt($[4],10)||0:0,q=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,U=`--stx-transition-duration: ${G}ms; --stx-transition-ease: ${Q}; --stx-transition-delay: ${W}ms; will-change: opacity, transform;`,K="stx-transition stx-observe stx-out";if(J==="fade")K+=" stx-fade";else if(J==="slide-up"||J==="slide")K+=" stx-from-bottom";else if(J==="slide-down")K+=" stx-from-top";else if(J==="slide-left")K+=" stx-from-right";else if(J==="slide-right")K+=" stx-from-left";else if(J==="scale")K+=" stx-scale";else if(J.includes("-"))K+=` stx-${J}`;else K+=` stx-${J}`;return`<div id="${q}" class="${K}" style="${U}" data-threshold="${w}">${X}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},s6={name:"animationGroup",handler:(X,$,Z,Y)=>{if($.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${X}`;let J=$[0],G=$.slice(1).map((q)=>q.startsWith("#")||q.startsWith(".")?q:`#${q}`),Q=Z.staggerDelay||50,w=Z.sequence||!0,W=SU(J,G,{staggerDelay:Q,sequence:w});return`${X}
|
|
239
|
-
${W}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},o6={name:"motion",handler:(X,$,Z,Y)=>{let J=$.length>0?$[0].toLowerCase()==="true":!0,G=EU();return`<div data-animate="${J?"auto":"true"}">${X}</div>${G}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});function D$(X){return X.split(/[\\/]/).filter(Boolean).slice(0,-1).some((Z)=>O7.includes(Z))}function F7(X){return D$(X.replace(/^\//,""))}var O7;var LX=E(()=>{O7=["components","layouts","partials","emails"]});import
|
|
240
|
-
`),G=V7.join($,"route-types.d.ts");try{if(
|
|
241
|
-
`))}var y$=E(()=>{LX()});import t6 from"path";function OX(X,$){let Y=t6.relative($,X).replace(/\.(stx|md)$/,"");if(Y=Y.split(t6.sep).join("/"),Y==="index")return"/";if(Y.endsWith("/index"))Y=Y.slice(0,-6);return Y=Y.replace(/\[\[([^\]]+)\]\]/g,":$1?"),Y=Y.replace(/\[([^\]]+)\]/g,":$1"),Y=Y.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${Y}`}function M7(X){let $=[],Z="",Y=0;while(Y<X.length){let J=X.slice(Y),G=/^\/:([^/?*]+)\?/.exec(J);if(G){$.push(G[1]),Z+="(?:/([^/]+))?",Y+=G[0].length;continue}let Q=/^:([^/?*]+)\*/.exec(J);if(Q){$.push(Q[1]),Z+="(.+)",Y+=Q[0].length;continue}let w=/^:([^/?*]+)/.exec(J);if(w){$.push(w[1]),Z+="([^/]+)",Y+=w[0].length;continue}Z+=X[Y].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),Y+=1}return{regex:new RegExp(`^${Z}$`),params:$}}function FX(X,$){let Z=X===""?"/":X;for(let Y of $){let J=Z.match(Y.regex);if(J){let G={};return Y.params.forEach((Q,w)=>{G[Q]=J[w+1]}),{route:Y,params:G}}}return null}function e6(X){let $=X.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return M7($)}var b$=()=>{};import CU from"fs";import S$ from"path";function VX(X,$){let Z=[],Y=S$.dirname(X);while(Y.startsWith($)||Y===$){let J=S$.join(Y,"_layout.stx");if(CU.existsSync(J))Z.unshift(J);if(Y===$)break;Y=S$.dirname(Y)}return Z}var C$=()=>{};import P$ from"fs";import
|
|
239
|
+
${W}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},o6={name:"motion",handler:(X,$,Z,Y)=>{let J=$.length>0?$[0].toLowerCase()==="true":!0,G=EU();return`<div data-animate="${J?"auto":"true"}">${X}</div>${G}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});function D$(X){return X.split(/[\\/]/).filter(Boolean).slice(0,-1).some((Z)=>O7.includes(Z))}function F7(X){return D$(X.replace(/^\//,""))}var O7;var LX=E(()=>{O7=["components","layouts","partials","emails"]});import N5 from"fs";import V7 from"path";function A7(X,$){let Z=X.filter((Q)=>!F7(Q.pattern)),Y=["// Auto-generated by STX - do not edit"];if(Z.length===0)Y.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{Y.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let Q of Z){let w=[];for(let q of Q.params){let U=Q.pattern.includes(`:${q}?`)?"?":"";w.push(`${q}${U}: string`)}let W=w.join("; ");Y.push(` '${Q.pattern}': { ${W} }`)}Y.push(" }","}","","export {}","")}let J=Y.join(`
|
|
240
|
+
`),G=V7.join($,"route-types.d.ts");try{if(N5.existsSync(G)&&N5.readFileSync(G,"utf8")===J)return;N5.mkdirSync($,{recursive:!0}),N5.writeFileSync(G,J)}catch{}}function R7(X,$,Z){let Y=process.cwd(),J=V7.relative(Y,Z),G=X.filter((w)=>!F7(w.pattern)),Q=["// Auto-generated by stx \u2014 do not edit",`// Source: ${J||"pages"}/`,"","export const routes = ["];for(let w of G){let W=V7.relative(Y,w.filePath).replace(/\\/g,"/"),q=JSON.stringify(w.params),U=w.layout?`, layout: '${V7.relative(Y,w.layout).replace(/\\/g,"/")}'`:"";Q.push(` { pattern: '${w.pattern}', filePath: '${W}', isDynamic: ${w.isDynamic}, params: ${q}${U} },`)}Q.push("] as const",""),Q.push("export type RouteName = typeof routes[number]['pattern']",""),N5.mkdirSync($,{recursive:!0}),N5.writeFileSync(V7.join($,"routes.ts"),Q.join(`
|
|
241
|
+
`))}var y$=E(()=>{LX()});import t6 from"path";function OX(X,$){let Y=t6.relative($,X).replace(/\.(stx|md)$/,"");if(Y=Y.split(t6.sep).join("/"),Y==="index")return"/";if(Y.endsWith("/index"))Y=Y.slice(0,-6);return Y=Y.replace(/\[\[([^\]]+)\]\]/g,":$1?"),Y=Y.replace(/\[([^\]]+)\]/g,":$1"),Y=Y.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${Y}`}function M7(X){let $=[],Z="",Y=0;while(Y<X.length){let J=X.slice(Y),G=/^\/:([^/?*]+)\?/.exec(J);if(G){$.push(G[1]),Z+="(?:/([^/]+))?",Y+=G[0].length;continue}let Q=/^:([^/?*]+)\*/.exec(J);if(Q){$.push(Q[1]),Z+="(.+)",Y+=Q[0].length;continue}let w=/^:([^/?*]+)/.exec(J);if(w){$.push(w[1]),Z+="([^/]+)",Y+=w[0].length;continue}Z+=X[Y].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),Y+=1}return{regex:new RegExp(`^${Z}$`),params:$}}function FX(X,$){let Z=X===""?"/":X;for(let Y of $){let J=Z.match(Y.regex);if(J){let G={};return Y.params.forEach((Q,w)=>{G[Q]=J[w+1]}),{route:Y,params:G}}}return null}function e6(X){let $=X.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return M7($)}var b$=()=>{};import CU from"fs";import S$ from"path";function VX(X,$){let Z=[],Y=S$.dirname(X);while(Y.startsWith($)||Y===$){let J=S$.join(Y,"_layout.stx");if(CU.existsSync(J))Z.unshift(J);if(Y===$)break;Y=S$.dirname(Y)}return Z}var C$=()=>{};import P$ from"fs";import k5 from"path";function X2(X,$){let Z=[];if(!P$.existsSync(X))return Z;let Y=P$.readdirSync(X,{withFileTypes:!0});for(let J of Y){let G=k5.join(X,J.name);if(J.isDirectory()){if(J.name.startsWith("."))continue;if(O7.includes(J.name))continue;Z.push(...X2(G,$))}else if(J.isFile()){let Q=k5.extname(J.name);if($.includes(Q)){if(J.name.startsWith("_")&&J.name!=="_layout.stx")continue;if(J.name==="_layout.stx")continue;Z.push(G)}}}return Z}class I5{routes;pagesDir;pagesDirs;config;constructor(X,$={}){this.config=$;let Z=$.pagesDirs&&$.pagesDirs.length>0?$.pagesDirs:[$.pagesDir||"pages"];this.pagesDirs=Z.map((Q)=>k5.resolve(X,Q)),this.pagesDir=this.pagesDirs[0];let Y=$.extensions||[".stx"],J=new Set;this.routes=[];for(let Q of this.pagesDirs){let w=X2(Q,Y);for(let W of w){let q=OX(W,Q);if(J.has(q))continue;J.add(q);let{regex:U,params:K}=M7(q),z=$.layouts!==!1?VX(W,Q):[];this.routes.push({pattern:q,regex:U,params:K,filePath:W,isDynamic:K.length>0,layout:z.length>0?z[z.length-1]:void 0})}}this.routes.sort((Q,w)=>{if(!Q.isDynamic&&w.isDynamic)return-1;if(Q.isDynamic&&!w.isDynamic)return 1;let W=Q.pattern.split("/").length,q=w.pattern.split("/").length;if(W!==q)return q-W;return Q.pattern.localeCompare(w.pattern)});let G=k5.resolve(X,$.stateDir||process.env.STX_DIR?.trim()||".stx");A7(this.routes,G),R7(this.routes,G,this.pagesDir)}match(X){let $=X===""?"/":X;for(let Z of this.routes){let Y=$.match(Z.regex);if(Y){let J={};return Z.params.forEach((G,Q)=>{J[G]=Y[Q+1]}),{route:Z,params:J}}}return null}resolve(X,$){let Z=this.routes.find((J)=>J.pattern===X||J.filePath.includes(X));if(!Z)return"#not-found";let Y=Z.pattern;if($)for(let[J,G]of Object.entries($))Y=Y.replace(`:${J}`,encodeURIComponent(G));return Y}addRoute(X){this.routes.push(X),this.routes.sort(($,Z)=>{if(!$.isDynamic&&Z.isDynamic)return-1;if($.isDynamic&&!Z.isDynamic)return 1;return $.pattern.localeCompare(Z.pattern)})}getLayout(X){return X.layout??null}}function $2(X,$){return new I5(X,$)}function v$(X,$){let Z=[`${$}.stx`,"error.stx"];for(let Y of Z){let J=k5.join(X,Y);if(P$.existsSync(J))return J}return null}function x$(X,$){return X.map((Z)=>{let Y=k5.relative($,Z.filePath),J=Z.isDynamic?" (dynamic)":"";return`${Z.pattern} \u2192 ${Y}${J}`})}var Z2=E(()=>{y$();b$();C$();LX()});function f$(X){AX=X.replace(/\/$/,"")}function g$(X,$,Z={}){E5[X]={path:$,name:X,params:Z}}function h$(X){for(let[$,Z]of Object.entries(X))if(typeof Z==="string")E5[$]={path:Z,name:$};else E5[$]={...Z,name:$}}function T7(X,$={},Z=!1){let Y=E5[X];if(!Y)return console.warn(`Route [${X}] not defined.`),"#undefined-route";let J={...Y.params,...$},G=Y.path;G=G.replace(/:(\w+)/g,(w,W)=>{let q=J[W];if(q===void 0)return console.warn(`Missing parameter [${W}] for route [${X}].`),`:${W}`;return delete J[W],encodeURIComponent(String(q))});let Q=Object.entries(J);if(Q.length>0){let w=Q.map(([W,q])=>`${encodeURIComponent(W)}=${encodeURIComponent(String(q))}`).join("&");G+=(G.includes("?")?"&":"?")+w}return Z&&AX?`${AX}${G}`:G}function u$(){for(let X of Object.keys(E5))delete E5[X];AX=""}var E5,AX="";var Y2=E(()=>{E5={}});import J2 from"fs";import G2 from"path";function Q2(X,$={}){return{type:"redirect",path:X,options:{replace:$.replace??!1,external:$.external??!1,redirectCode:$.redirectCode??302}}}function w2(X){return{type:"abort",error:typeof X==="string"?{statusCode:500,message:X}:X}}function W2(X,$={}){return{handler:X,mode:$.mode??"universal"}}function d$(X){let $={};if(!X)return $;let Z=X.split(";");for(let Y of Z){let[J,...G]=Y.split("=");if(J){let Q=J.trim(),w=G.join("=").trim();if(Q)$[Q]=decodeURIComponent(w)}}return $}function RX(X,$,Z={}){let Y=`${encodeURIComponent(X)}=${encodeURIComponent($)}`;if(Z.expires){let J=typeof Z.expires==="number"?new Date(Date.now()+Z.expires*1000):Z.expires;Y+=`; Expires=${J.toUTCString()}`}if(Z.path)Y+=`; Path=${Z.path}`;if(Z.domain)Y+=`; Domain=${Z.domain}`;if(Z.secure)Y+="; Secure";if(Z.httpOnly)Y+="; HttpOnly";if(Z.sameSite)Y+=`; SameSite=${Z.sameSite}`;return Y}function m$(X,$){let Z=X.headers.get("cookie")||"",Y=d$(Z);return{get(J){return Y[J]},set(J,G,Q={}){Y[J]=G,$.append("Set-Cookie",RX(J,G,Q))},delete(J){delete Y[J],$.append("Set-Cookie",RX(J,"",{expires:new Date(0),path:"/"}))},getAll(){return{...Y}}}}function l$(){return{get(X){if(typeof document>"u")return;return d$(document.cookie)[X]},set(X,$,Z={}){if(typeof document>"u")return;document.cookie=RX(X,$,Z)},delete(X){if(typeof document>"u")return;document.cookie=RX(X,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return d$(document.cookie)}}}function c$(){let X=typeof window<"u"&&typeof window.localStorage<"u";return{get($){if(!X)return null;try{return window.localStorage.getItem($)}catch{return null}},set($,Z){if(!X)return;try{window.localStorage.setItem($,Z)}catch{}},remove($){if(!X)return;try{window.localStorage.removeItem($)}catch{}},isAvailable(){return X}}}function MX(X,$){N7.set(X,$)}function p$(X){return N7.get(X)}function q2(X){return N7.has(X)}function U2(){N7.clear()}function K2(){return Array.from(N7.keys())}async function z2(X,$="middleware"){let Z=G2.resolve(X,$);if(!J2.existsSync(Z))return;let Y=J2.readdirSync(Z);for(let J of Y){if(!J.endsWith(".ts")&&!J.endsWith(".js"))continue;if(J.includes(".test.")||J.includes(".spec."))continue;let G=J.replace(/\.(ts|js)$/,""),Q=G2.join(Z,J);try{let W=(await import(Q)).default;if(W&&typeof W.handler==="function")MX(G,W);else if(typeof W==="function")MX(G,{handler:W,mode:"universal"})}catch(w){console.warn(`Failed to load middleware '${G}' from ${Q}:`,w)}}}function PU(X){let $={};if(!X)return $;let Z=new URLSearchParams(X);for(let[Y,J]of Z)$[Y]=J;return $}function B2(X,$,Z,Y=""){return{path:X,params:$,query:PU(Y),fullPath:Y?`${X}?${Y}`:X,meta:Z}}function j2(X,$,Z,Y){let J=Y?.isServer??typeof window>"u",G=!J,Q=new Headers;return{to:X,from:$,isClient:G,isServer:J,cookies:J&&Z?m$(Z,Q):l$(),storage:c$(),state:{},request:Z,responseHeaders:Q}}async function _2(X,$){let Z=Array.isArray(X)?X:[X],Y=$.isServer;for(let J of Z){let G=p$(J);if(!G)return console.error(`Route middleware '${J}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${J}' is not registered`}},state:$.state,responseHeaders:$.responseHeaders};if(G.mode==="server"&&!Y)continue;try{let Q=await G.handler($);if(Q){if(Q.type==="redirect")return{passed:!1,redirect:Q,state:$.state,responseHeaders:$.responseHeaders};if(Q.type==="abort")return{passed:!1,abort:Q,state:$.state,responseHeaders:$.responseHeaders}}}catch(Q){return console.error(`Error in middleware '${J}':`,Q),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:Q instanceof Error?Q.message:"Middleware error"}},state:$.state,responseHeaders:$.responseHeaders}}}return{passed:!0,state:$.state,responseHeaders:$.responseHeaders}}var N7;var H2=E(()=>{N7=new Map});function k7(X){let Z=X.replace(/\\/g,"/").split("/").filter(Boolean),Y=Z.lastIndexOf("layouts"),J=Y>=0?Z[Y+1]:Z.at(-1);if(!J)return"app";return J.replace(/\.stx$/i,"")||"app"}function L2(X){let $=X.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),Z=X.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),Y=X.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),J=$?.[1]||Y?.[1]||"";return{layout:J,group:Z?.[1]||k7(J)}}function vU(X){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(X).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return X}}function I7(){if(TX)return TX;return TX=vU(`
|
|
242
242
|
;(function(){
|
|
243
243
|
'use strict';
|
|
244
244
|
var ROUTER_REV=7;
|
|
@@ -1888,7 +1888,7 @@ else {
|
|
|
1888
1888
|
|
|
1889
1889
|
if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
|
|
1890
1890
|
})();
|
|
1891
|
-
`),TX}var TX;var O2={};
|
|
1891
|
+
`),TX}var TX;var O2={};a(O2,{setAppUrl:()=>f$,runMiddleware:()=>_2,route:()=>T7,resolveLayoutChain:()=>VX,resetRoutes:()=>u$,registerMiddleware:()=>MX,patternToRegex:()=>M7,navigateTo:()=>Q2,matchRoute:()=>FX,loadMiddlewareFromDirectory:()=>z2,isNonPageRoutePattern:()=>F7,isNonPageRoutePath:()=>D$,hasMiddleware:()=>q2,getRouterScript:()=>I7,getMiddlewareNames:()=>K2,getMiddleware:()=>p$,generateRouteTypes:()=>A7,generateRouteManifest:()=>R7,formatRoutes:()=>x$,findErrorPage:()=>v$,filePathToPattern:()=>OX,extractLayoutMetadata:()=>L2,deriveLayoutGroup:()=>k7,defineRoutes:()=>h$,defineRoute:()=>g$,defineMiddleware:()=>W2,createStorageManager:()=>c$,createServerCookieManager:()=>m$,createRouter:()=>$2,createRouteLocation:()=>B2,createMiddlewareContext:()=>j2,createClientCookieManager:()=>l$,clearMiddleware:()=>U2,bracketPathToRegex:()=>e6,abortNavigation:()=>w2,Router:()=>I5,NON_PAGE_DIRS:()=>O7});var X5=E(()=>{Z2();b$();Y2();H2();C$();y$();LX()});var F2=E(()=>{X5();i$()});async function xU(X,$,Z,Y){let J=$[0]?.replace(/['"]/g,"")||"main",G=I7();if(J!=="main")G=G.replace("container:'main'",`container:'${J}'`);return`<script data-stx-router>${G}</script>`}var V2;var i$=E(()=>{F2();V2={name:"stxRouter",handler:xU,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function A2(X){let $=X.heatmap;if(!$?.enabled)return"";let Z={...fU,...$};return`
|
|
1892
1892
|
<!-- stx Heatmap - Privacy-Compliant Tracking -->
|
|
1893
1893
|
<script>
|
|
1894
1894
|
(function() {
|
|
@@ -2271,10 +2271,10 @@ else {
|
|
|
2271
2271
|
};
|
|
2272
2272
|
})();
|
|
2273
2273
|
</script>
|
|
2274
|
-
`}function R2(X,$){let Z=A2($);if(!Z)return X;let Y=X.lastIndexOf("</body>");if(Y!==-1)return X.slice(0,Y)+Z+X.slice(Y);return X+Z}function gU(X){let $={},Z=X.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let Y of Z){let[J,G]=Y.split("="),Q=G?.replace(/["']/g,"");switch(J){case"endpoint":$.endpoint=Q;break;case"samplingRate":$.samplingRate=Number.parseInt(Q,10);break;case"batchSize":$.batchSize=Number.parseInt(Q,10);break;case"trackMouse":$.trackMouse=Q==="true";break;case"trackClicks":$.trackClicks=Q==="true";break;case"trackScroll":$.trackScroll=Q==="true";break;case"honorDnt":$.honorDnt=Q==="true";break;case"debugOverlay":$.debugOverlay=Q==="true";break}}return $}var fU,M2;var n$=E(()=>{fU={enabled:!1,trackMouse:!0,trackClicks:!0,trackScroll:!0,samplingRate:100,honorDnt:!0,batchSize:50,maxDataPoints:1000,sessionTimeout:30,persistData:!1,storagePrefix:"stx_heatmap",captureAttributes:["data-heatmap-id","data-track"],ignoreSelectors:["[data-heatmap-ignore]",".heatmap-ignore"],debugOverlay:!1};M2={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async(X,$,Z,Y)=>{let J=Z.__stx_config||{};if($.length>0){let G=gU($.join(" "));J.heatmap={...J.heatmap,...G,enabled:!0}}return A2(J)}}});function
|
|
2275
|
-
`)){let w=Q.trim();if(!w||w.startsWith("#"))continue;let W=w.indexOf(":");if(W===-1)continue;let q=w.slice(0,W).trim(),U=w.slice(W+1).trim();if(typeof U==="string"){if(U.startsWith('"')&&U.endsWith('"')||U.startsWith("'")&&U.endsWith("'"))U=U.slice(1,-1);else if(U.startsWith("[")&&U.endsWith("]"))try{U=JSON.parse(U)}catch{}else if(U==="true")U=!0;else if(U==="false")U=!1;else if(/^-?\d+(?:\.\d+)?$/.test(U))U=Number(U)}G[q]=U}return{data:G,content:J.trim()}}function
|
|
2276
|
-
`),J=J.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),J=J.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),J=J.replace(/<\/ul>\n<ul>/g,""),J=J.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),J=J.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),J=J.replace(/<\/ol>\n<ol>/g,""),J=J.replace(/<li data-ul>/g,"<li>"),J=J.replace(/<li data-ol>/g,"<li>"),Z)J=J.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(U,K,z)=>{let B=`<tr>${K.split("|").map((H)=>H.trim()).filter(Boolean).map((H)=>`<th>${
|
|
2277
|
-
`).map((H)=>{return`<tr>${H.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<td>${
|
|
2274
|
+
`}function R2(X,$){let Z=A2($);if(!Z)return X;let Y=X.lastIndexOf("</body>");if(Y!==-1)return X.slice(0,Y)+Z+X.slice(Y);return X+Z}function gU(X){let $={},Z=X.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let Y of Z){let[J,G]=Y.split("="),Q=G?.replace(/["']/g,"");switch(J){case"endpoint":$.endpoint=Q;break;case"samplingRate":$.samplingRate=Number.parseInt(Q,10);break;case"batchSize":$.batchSize=Number.parseInt(Q,10);break;case"trackMouse":$.trackMouse=Q==="true";break;case"trackClicks":$.trackClicks=Q==="true";break;case"trackScroll":$.trackScroll=Q==="true";break;case"honorDnt":$.honorDnt=Q==="true";break;case"debugOverlay":$.debugOverlay=Q==="true";break}}return $}var fU,M2;var n$=E(()=>{fU={enabled:!1,trackMouse:!0,trackClicks:!0,trackScroll:!0,samplingRate:100,honorDnt:!0,batchSize:50,maxDataPoints:1000,sessionTimeout:30,persistData:!1,storagePrefix:"stx_heatmap",captureAttributes:["data-heatmap-id","data-track"],ignoreSelectors:["[data-heatmap-ignore]",".heatmap-ignore"],debugOverlay:!1};M2={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async(X,$,Z,Y)=>{let J=Z.__stx_config||{};if($.length>0){let G=gU($.join(" "));J.heatmap={...J.heatmap,...G,enabled:!0}}return A2(J)}}});function C1(X){return X.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function T2(X){let $=X.trim().toLowerCase();return!$.startsWith("javascript:")&&!$.startsWith("vbscript:")&&!$.startsWith("data:text/html")}function NX(X){let $=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Z=X.match($);if(!Z)return{data:{},content:X.trim()};let Y=Z[1],J=X.slice(Z[0].length),G={};for(let Q of Y.split(`
|
|
2275
|
+
`)){let w=Q.trim();if(!w||w.startsWith("#"))continue;let W=w.indexOf(":");if(W===-1)continue;let q=w.slice(0,W).trim(),U=w.slice(W+1).trim();if(typeof U==="string"){if(U.startsWith('"')&&U.endsWith('"')||U.startsWith("'")&&U.endsWith("'"))U=U.slice(1,-1);else if(U.startsWith("[")&&U.endsWith("]"))try{U=JSON.parse(U)}catch{}else if(U==="true")U=!0;else if(U==="false")U=!1;else if(/^-?\d+(?:\.\d+)?$/.test(U))U=Number(U)}G[q]=U}return{data:G,content:J.trim()}}function $5(X,$={}){let{gfm:Z=!0,breaks:Y=!1}=$,J=X,G=[];if(J=J.replace(/```(\w*)\n([\s\S]*?)```/g,(U,K,z)=>{let j=G.length,B=K?` class="language-${C1(K)}"`:"";return G.push(`<pre><code${B}>${C1(z.trim())}</code></pre>`),`\x00CODEBLOCK${j}\x00`}),J=J.replace(/`([^`]*)`/g,(U,K)=>`<code>${C1(K)}</code>`),J=J.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),J=J.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),J=J.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),J=J.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),J=J.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),J=J.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),J=J.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),J=J.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),J=J.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),J=J.replace(/__(.+?)__/g,"<strong>$1</strong>"),J=J.replace(/\*(.+?)\*/g,"<em>$1</em>"),J=J.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),Z)J=J.replace(/~~(.+?)~~/g,"<del>$1</del>");if(J=J.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(U,K,z)=>{return`<img src="${T2(z)?C1(z):""}" alt="${C1(K)}" />`}),J=J.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(U,K,z)=>{return`<a href="${T2(z)?C1(z):""}">${K}</a>`}),J=J.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),J=J.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),J=J.replace(/<\/blockquote>\n<blockquote>/g,`
|
|
2276
|
+
`),J=J.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),J=J.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),J=J.replace(/<\/ul>\n<ul>/g,""),J=J.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),J=J.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),J=J.replace(/<\/ol>\n<ol>/g,""),J=J.replace(/<li data-ul>/g,"<li>"),J=J.replace(/<li data-ol>/g,"<li>"),Z)J=J.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(U,K,z)=>{let B=`<tr>${K.split("|").map((H)=>H.trim()).filter(Boolean).map((H)=>`<th>${C1(H)}</th>`).join("")}</tr>`,_=z.trim().split(`
|
|
2277
|
+
`).map((H)=>{return`<tr>${H.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<td>${C1(L)}</td>`).join("")}</tr>`}).join(`
|
|
2278
2278
|
`);return`<table>
|
|
2279
2279
|
<thead>
|
|
2280
2280
|
${B}
|
|
@@ -2289,7 +2289,7 @@ ${_}
|
|
|
2289
2289
|
`:`
|
|
2290
2290
|
`)}</p>`);if(J=w.join(`
|
|
2291
2291
|
`),Y)J=J.replace(/\n/g,`<br />
|
|
2292
|
-
`);for(let U=0;U<G.length;U++)J=J.replace(`\x00CODEBLOCK${U}\x00`,G[U]);return J=J.replace(/<p>\s*<\/p>/g,""),J.trim()}function
|
|
2292
|
+
`);for(let U=0;U<G.length;U++)J=J.replace(`\x00CODEBLOCK${U}\x00`,G[U]);return J=J.replace(/<p>\s*<\/p>/g,""),J.trim()}function D5(X="const",$=[],Z){let Y=$.length?V1.filter((J)=>!$.includes(J)):V1;if(Z!==void 0)Y=Y.filter((J)=>{let G=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${G}(?![\\w$])`).test(Z)});return`${X} { ${Y.join(", ")} } = window.stx;`}function r$(X){if(!X)return!1;return uU.some(($)=>new RegExp(`\\b${$}\\s*(?:<[^>]*>)?\\s*\\(`).test(X))}function s$(X){if(!X)return!1;let $=b2(X);if(dU.some((Z)=>Z.test($)))return!0;return r$($)}function k2(X){if(!X)return!1;return mU.test(b2(X))||s$(X)}function I2(X){return lU.includes(X.toLowerCase())}function y2(){return`{${E2.map((X)=>`'${X}':1`).join(",")}}`}function b2(X){if(!X)return X;let $=(Z)=>Z.replace(/(<[^>]*>)|([^<]+)/g,(Y,J,G)=>J??" ".repeat(G.length));return X.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(Z,Y,J,G)=>Y+$(J)+G).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(Z,Y,J,G)=>Y+$(J)+G).replace(/<!--[\s\S]*?-->/g,(Z)=>" ".repeat(Z.length))}var V1,N2,hU,uU,dU,mU,lU,E2,cU,D2;var Z1=E(()=>{V1=["batch","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refresh","registerStoresClient","setRouteParams","state","untrack","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","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],N2=["onMount","onDestroy"];hU=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"],uU=V1.filter((X)=>!hU.includes(X));dU=[/@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*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],mU=/\s@[a-z][\w.:-]*\s*=/i;lU=["if","else-if","elseif","else","for","show","key","text","html","model","ref"];E2=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],cU=["x-init","x-transition","x-effect","x-on"],D2=[...E2,...cU]});function P2(X){let $={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Z of X){let Y=Z.toLowerCase();if(Y==="prevent")$.prevent=!0;else if(Y==="stop")$.stop=!0;else if(Y==="once")$.once=!0;else if(Y==="capture")$.capture=!0;else if(Y==="self")$.self=!0;else if(Y==="passive")$.passive=!0;else if(pU.has(Y))$.systemKeys.push(Y);else if(Y in v2)$.mouse=Y;else if(Y in C2||/^[a-z]$/.test(Y))$.keys.push(C2[Y]||Y.toUpperCase());else if(Y.startsWith("debounce")){let J=Y.match(/debounce(?:\.(\d+))?/);$.debounce=J?.[1]?Number.parseInt(J[1],10):300}else if(Y.startsWith("throttle")){let J=Y.match(/throttle(?:\.(\d+))?/);$.throttle=J?.[1]?Number.parseInt(J[1],10):300}}return $}function x2(X){let $=[],Z=0,Y=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,J;while((J=Y.exec(X))!==null){let[G,Q,w]=J,W=J.index,q=W+G.length,U=`__stx_evt_${Z++}`,K=[],z=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,j;while((j=z.exec(w))!==null){let[,_,H]=j,O=_.split("."),L=O[0];if(!S2.has(L))continue;K.push({attribute:`@${_}`,event:L,handler:H,modifiers:P2(O.slice(1)),elementId:U})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((j=B.exec(w))!==null){let[,_,H]=j,O=_.split("."),L=O[0];if(!S2.has(L))continue;K.push({attribute:`@${_}`,event:L,handler:H,modifiers:P2(O.slice(1)),elementId:U})}if(K.length>0)$.push({originalTag:G,elementId:U,events:K,startIndex:W,endIndex:q})}return $}function iU(X){let $=[],{modifiers:Z}=X;if(Z.self)$.push("if ($event.target !== $el) return");for(let Y of Z.systemKeys)$.push(`if (!$event.${Y}Key) return`);if(Z.keys.length>0){let Y=Z.keys.map((J)=>`$event.key === '${J}'`).join(" || ");$.push(`if (!(${Y})) return`)}if(Z.mouse!==null){let Y=v2[Z.mouse];$.push(`if ($event.button !== ${Y}) return`)}if(Z.prevent)$.push("$event.preventDefault()");if(Z.stop)$.push("$event.stopPropagation()");return $.join("; ")}function nU(X,$){let Z=X;if($.debounce!==null)Z=`__stx_debounce(() => { ${Z} }, ${$.debounce})`;else if($.throttle!==null)Z=`__stx_throttle(() => { ${Z} }, ${$.throttle})`;return Z}function o$(X){let $=X.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test($))return X;return`if (typeof ${$} === 'function' && !${$}._isSignal) ${$}($event);`}function rU(X){let{modifiers:$}=X,Z=X.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),Y=iU(X),J=nU(o$(X.handler),$),G=[];if($.once)G.push("once: true");if($.capture)G.push("capture: true");if($.passive)G.push("passive: true");let Q=G.length>0?`, { ${G.join(", ")} }`:"",w=J.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(X.event==="mounted")return`
|
|
2293
2293
|
(function() {
|
|
2294
2294
|
var $el = document.getElementById('${Z}');
|
|
2295
2295
|
if (!$el) return;
|
|
@@ -2402,20 +2402,20 @@ else {
|
|
|
2402
2402
|
`)}
|
|
2403
2403
|
})();
|
|
2404
2404
|
</script>`}function sU(X){let $=x2(X);if($.length===0)return{template:X,bindings:[]};let Z=X,Y=[];for(let J=$.length-1;J>=0;J--){let G=$[J],Q=G.originalTag;if(!Q.includes(" id="))Q=Q.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${G.elementId}"`);else{let w=Q.match(/id=["']([^"']+)["']/);if(w)for(let W of G.events)W.elementId=w[1]}for(let w of G.events){let W=w.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),q=new RegExp(`\\s*${W}\\s*=\\s*"[^"]*"`,"g"),U=new RegExp(`\\s*${W}\\s*=\\s*'[^']*'`,"g");Q=Q.replace(q,""),Q=Q.replace(U,"")}Z=Z.slice(0,G.startIndex)+Q+Z.slice(G.endIndex),Y.push(...G.events)}return{template:Z,bindings:Y}}function f2(X,$,Z){if(s$(X))return X;if($.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(X))return X;let{template:w,bindings:W}=sU(X),q=$.__stx_event_bindings||[];return $.__stx_event_bindings=[...q,...W],w}let Y=x2(X);if(Y.length===0)return X;let J=X;for(let w=Y.length-1;w>=0;w--){let W=Y[w],q=W.originalTag;if(!q.includes(" id="))q=q.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${W.elementId}"`);else{let U=q.match(/id=["']([^"']+)["']/);if(U)for(let K of W.events)K.elementId=U[1]}for(let U of W.events){let K=U.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),z=new RegExp(`\\s*${K}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${K}\\s*=\\s*'[^']*'`,"g");q=q.replace(z,""),q=q.replace(j,"")}J=J.slice(0,W.startIndex)+q+J.slice(W.endIndex)}let G=a$(Y.flatMap((w)=>w.events)),Q=J.lastIndexOf("</body>");if(Q!==-1)J=J.slice(0,Q)+G+`
|
|
2405
|
-
`+J.slice(Q);else J+=G;return J}var S2,C2,pU,v2;var t$=E(()=>{Z1();S2=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"]),C2={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"},pU=new Set(["ctrl","alt","shift","meta"]),v2={left:0,middle:1,right:2}});function
|
|
2405
|
+
`+J.slice(Q);else J+=G;return J}var S2,C2,pU,v2;var t$=E(()=>{Z1();S2=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"]),C2={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"},pU=new Set(["ctrl","alt","shift","meta"]),v2={left:0,middle:1,right:2}});function p0(X){let $=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;X=X.replace($,(Y,J)=>{return`const { ${J.split(",").map((Q)=>Q.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
|
|
2406
2406
|
`});let Z=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return X=X.replace(Z,(Y,J)=>{return`const { ${J.split(",").map((Q)=>Q.trim()).filter(Boolean).join(", ")} } = window.__composables
|
|
2407
2407
|
`}),X}function kX(X){return X.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}function oU(X,$){let Z=X[$],Y=$+1;while(Y<X.length){if(X[Y]==="\\"){Y+=2;continue}if(X[Y]===Z)return Y+1;Y++}return X.length}function aU(X,$){let Z=$+1;while(Z<X.length){if(X[Z]==="\\"){Z+=2;continue}if(X[Z]==="`")return Z+1;if(X[Z]==="$"&&X[Z+1]==="{"){if(Z=IX(X,Z+2),Z<X.length)Z++;continue}Z++}return X.length}function IX(X,$){let Z=1,Y=$;while(Y<X.length){let J=X[Y];if(J==="\\"){Y+=2;continue}if(J==='"'||J==="'"){Y=oU(X,Y);continue}if(J==="`"){Y=aU(X,Y);continue}if(J==="/"&&X[Y+1]==="/"){while(Y<X.length&&X[Y]!==`
|
|
2408
|
-
`)Y++;continue}if(J==="/"&&X[Y+1]==="*"){Y+=2;while(Y<X.length&&X.slice(Y,Y+2)!=="*/")Y++;Y+=2;continue}if(J==="{"){Z++,Y++;continue}if(J==="}"){if(Z--,Z===0)return Y;Y++;continue}Y++}return X.length}function
|
|
2408
|
+
`)Y++;continue}if(J==="/"&&X[Y+1]==="*"){Y+=2;while(Y<X.length&&X.slice(Y,Y+2)!=="*/")Y++;Y+=2;continue}if(J==="{"){Z++,Y++;continue}if(J==="}"){if(Z--,Z===0)return Y;Y++;continue}Y++}return X.length}function a0(X){let $="",Z=0;while(Z<X.length){let Y=X.slice(Z,Z+2);if(Y==="//"){while(Z<X.length&&X[Z]!==`
|
|
2409
2409
|
`)$+=" ",Z++;continue}if(Y==="/*"){while(Z<X.length&&X.slice(Z,Z+2)!=="*/")$+=X[Z]===`
|
|
2410
2410
|
`?`
|
|
2411
2411
|
`:" ",Z++;$+=" ",Z+=2;continue}let J=X[Z];if(J==='"'||J==="'"){let G=J;$+=" ",Z++;while(Z<X.length&&X[Z]!==G){if(X[Z]==="\\"){$+=" ",Z+=2;continue}$+=X[Z]===`
|
|
2412
2412
|
`?`
|
|
2413
|
-
`:" ",Z++}$+=" ",Z++;continue}if(J==="`"){$+=" ",Z++;while(Z<X.length&&X[Z]!=="`"){if(X[Z]==="\\"){$+=" ",Z+=2;continue}if(X[Z]==="$"&&X[Z+1]==="{"){let G=Z+2,Q=IX(X,G);if($+=" ",$+=
|
|
2413
|
+
`:" ",Z++}$+=" ",Z++;continue}if(J==="`"){$+=" ",Z++;while(Z<X.length&&X[Z]!=="`"){if(X[Z]==="\\"){$+=" ",Z+=2;continue}if(X[Z]==="$"&&X[Z+1]==="{"){let G=Z+2,Q=IX(X,G);if($+=" ",$+=a0(X.slice(G,Q)),Q<X.length)$+=" ";Z=Q+1;continue}$+=X[Z]===`
|
|
2414
2414
|
`?`
|
|
2415
|
-
`:" ",Z++}$+=" ",Z++;continue}$+=J,Z++}return $}function tU(){let X=globalThis;return X[g2]??=new Map,X[g2]}function
|
|
2415
|
+
`:" ",Z++}$+=" ",Z++;continue}$+=J,Z++}return $}function tU(){let X=globalThis;return X[g2]??=new Map,X[g2]}function X0(X,$){let Z=tU(),Y=`${import.meta.url}\x00${X}`,J=Z.get(Y);if(J)return J;let G=$();return Z.set(Y,G),G.catch(()=>{if(Z.get(Y)===G)Z.delete(Y)}),G}var g2;var E7=E(()=>{g2=Symbol.for("stx.lazy-module-promises")});function y5(X){if(!X||X.indexOf("</")===-1)return X;return X.replace(eU,"<\\/$1")}var eU;var e$=E(()=>{eU=/<\/(script)/gi});import XK from"process";function P0(X="STX_PUBLIC_"){let $={},Z={};for(let[Y,J]of Object.entries(XK.env)){if(!Y.startsWith(X)||J===void 0)continue;$[`import.meta.env.${Y}`]=JSON.stringify(J),Z[Y]=J}return $["import.meta.env"]=JSON.stringify(Z),$}var P1=()=>{};import D7 from"path";function u2(X){h2=X?.trim()||null}function y7(){return process.env[$K]?.trim()||h2||b5}function b7(X=process.cwd(),...$){let Z=y7();return D7.isAbsolute(Z)?D7.join(Z,...$):D7.join(X,Z,...$)}function S7(X){if(!X||D7.isAbsolute(X))return X;let $=X.replace(/\\/g,"/");if($!==b5&&!$.startsWith(`${b5}/`))return X;let Z=$.slice(b5.length+1);return Z?D7.join(y7(),Z):y7()}var b5=".stx",$K="STX_DIR",h2=null;var EX=()=>{};function ZK(X){if(!X||typeof X!=="object")return!1;let $=X;return typeof $.message==="string"&&($.name==="BuildMessage"||$.name==="ResolveMessage"||("position"in $))}function YK(X){if(X&&typeof X==="object"&&Array.isArray(X.errors))return X.errors;return[X]}function DX(X,$){let Z=[];for(let Y of YK(X)){if(ZK(Y)){let J=Y.position||void 0;Z.push({file:$||J?.file,line:J?.line,column:J?.column,message:Y.message??"",lineText:J?.lineText});continue}Z.push({file:$,message:Y instanceof Error?Y.message:String(Y)})}return Z}function d2(X,$){return DX(X,$).map((Z)=>{let Y=Z.file?`${Z.file}${Z.line?`:${Z.line}${Z.column?`:${Z.column}`:""}`:""}`:"",J=Z.lineText?`
|
|
2416
2416
|
${Z.lineText.trim()}`:"";return Y?`${Y}: ${Z.message}${J}`:`${Z.message}${J}`}).join(`
|
|
2417
|
-
`)}var C7={};
|
|
2418
|
-
export { ${j.join(", ")} }`:"";await Bun.write(U,X+O),
|
|
2417
|
+
`)}var C7={};a(C7,{shouldLogBundlerDiagnostics:()=>p2,setBundlerFallbackMode:()=>wK,resolveBundlerFallback:()=>Y9,recordBundleFailure:()=>$9,queueClientBundleBuild:()=>i2,hasUserImports:()=>WK,getBundleFailures:()=>GK,clearBundleFailures:()=>QK,bundleClientScript:()=>UK});import _0 from"path";import u0 from"fs";function p2(X=process.env){return X.STX_DEBUG==="true"||X.STX_DEBUG==="1"}function Z5(...X){if(p2())console.log("[stx:bundler]",...X)}function $9(X,$,Z){J9.push({filePath:X||"<inline>",message:$,details:Z})}function GK(){return J9.slice()}function QK(){J9.length=0}function wK(X){Z9=X}function Y9(){if(Z9)return Z9;try{let X=v7.strict;return typeof X==="object"&&X!==null?X.bundlerFallback??"warn":"warn"}catch{return"warn"}}function WK(X){let $=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Z;while((Z=$.exec(X))!==null){let J=Z[1];if(!m2.some((Q)=>Q.test(J)))return Z5("detected user import:",J),!0}let Y=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Z=Y.exec(X))!==null){let J=Z[1];if(/\.css(?:\?.*)?$/.test(J))continue;if(!m2.some((Q)=>Q.test(J)))return Z5("detected side-effect import:",J),!0}return!1}function qK(X,$,Z,Y){let J=(G,Q)=>{let w=G===Z?$:_0.dirname(G),W=_0.resolve(w,Q),q=[W,`${W}.ts`,`${W}.tsx`,`${W}.js`,`${W}.mjs`,`${W}.jsx`,_0.join(W,"index.ts"),_0.join(W,"index.tsx"),_0.join(W,"index.js"),_0.join(W,"index.mjs")];for(let U of q)try{if(u0.existsSync(U)&&u0.statSync(U,{throwIfNoEntry:!1})?.isFile())return U}catch{}return W};return{name:"stx-client-bundle",setup(G){G.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(Q)=>({path:Q.path,external:!0})),G.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(Q)=>({path:Q.path,external:!0})),G.onResolve({filter:/^\//},(Q)=>{if(u0.existsSync(Q.path))return{path:Q.path};return{path:Q.path,external:!0}}),G.onResolve({filter:/^\.\.?\//},(Q)=>{let w=J(Q.importer,Q.path);return Y.add(w),{path:w}}),G.onResolve({filter:/^[@~]\//},(Q)=>{let w=_0.resolve(X,Q.path.slice(2)),W=[w,`${w}.ts`,`${w}.tsx`,`${w}.js`,`${w}.mjs`,`${w}.jsx`,_0.join(w,"index.ts"),_0.join(w,"index.tsx"),_0.join(w,"index.js"),_0.join(w,"index.mjs")];for(let q of W)if(u0.existsSync(q)&&u0.statSync(q,{throwIfNoEntry:!1})?.isFile())return Z5(`resolved ${Q.path[0]}/ import:`,Q.path,"\u2192",q),Y.add(q),{path:q};return console.warn(`[stx:bundler] could not resolve ${Q.path[0]}/ import:`,Q.path),{path:w}}),G.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(Q)=>{let w=_0.extname(Q.path).toLowerCase(),W=w===".json"?"json":w===".tsx"?"tsx":w===".jsx"?"jsx":w===".ts"||w===".mts"||w===".cts"?"ts":"js";if(Q.path!==Z)Y.add(Q.path);return{contents:u0.readFileSync(Q.path,"utf8"),loader:W}})}}}function i2(X){let $=globalThis,Y=($[l2]??Promise.resolve()).then(X,X);return $[l2]=Y.then(()=>{return},()=>{return}),Y}async function UK(X,$,Z={}){let Y=Z.projectRoot||process.cwd(),J=Z.minify??!1,G=Z.cacheDir||b7(Y,"bundle-cache"),Q=new Bun.CryptoHasher("md5");Q.update(`${JK}\x00${X}\x00${$}`);let w=Q.digest("hex").slice(0,12),W=_0.join(G,`${w}.js`),q=_0.join(G,`${w}.deps.json`),U=Bun.file(W);if(await U.exists()){let j=Bun.file(q),B=!0;if(await j.exists())try{let _=JSON.parse(await j.text());if(_.metadataVersion!==c2||!Array.isArray(_.files))B=!1;for(let H of Array.isArray(_.files)?_.files:[])try{if(u0.statSync(H.path).mtimeMs!==H.mtimeMs){B=!1;break}}catch{B=!1;break}}catch{B=!1}if(B)return Z5("cache hit:",w),await U.text();Z5("cache invalidated by dep change:",w)}let K=X9.get(w);if(K)return await K;let z=i2(()=>KK(X,$,{projectRoot:Y,minify:J,cacheDir:G,hash:w,cachePath:W,depsPath:q}));X9.set(w,z);try{return await z}finally{X9.delete(w)}}async function KK(X,$,Z){let{projectRoot:Y,minify:J,cacheDir:G,hash:Q,cachePath:w,depsPath:W}=Z,q=b7(Y,"bundle-tmp"),U=_0.join(q,`${Q}.ts`),K=_0.join(q,"out",Q);u0.mkdirSync(q,{recursive:!0}),u0.mkdirSync(K,{recursive:!0});let z=_0.dirname($),j=[],B=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,_=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,H;while((H=B.exec(X))!==null){if(H[1])continue;if(H[2])H[2].split(",").forEach((F)=>{let V=F.split(":")[0].trim();if(V)j.push(V)});else if(H[3])j.push(H[3])}while((H=_.exec(X))!==null){if(H[1])continue;j.push(H[2])}let O=j.length>0?`
|
|
2418
|
+
export { ${j.join(", ")} }`:"";await Bun.write(U,X+O),Z5("bundling:",Q,"from:",_0.basename($));let L=new Set;try{let F=await Bun.build({entrypoints:[U],outdir:K,target:"browser",format:"esm",minify:J,plugins:[qK(Y,z,U,L)],define:{"process.env.NODE_ENV":J?'"production"':'"development"',...P0()},root:Y});if(!F.success){let S=F.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ")||`Unable to bundle ${_0.basename($)}`,b=DX(F.logs,$||void 0);if(console.warn("[stx:bundler] build failed:",S),$9($||"",S,b),Y9()==="error")throw Error(S);return X}let V="";for(let N of F.outputs){V=await N.text();break}let A=[];for(let N of V.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let S of N[1].split(",")){let b=S.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(b){A.push([b[2],b[1]]);continue}let y=S.trim();if(/^[A-Za-z_$][\w$]*$/.test(y))A.push([y,y])}let R=V.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];V=V.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let M=`__stxBundle_${Q}`,T=A.map(([N,S])=>`${JSON.stringify(N)}: ${S}`).join(", "),k=A.map(([N])=>`var ${N} = undefined;`).join(`
|
|
2419
2419
|
`),I=A.map(([N])=>`${N} = ${M}[${JSON.stringify(N)}];`).join(`
|
|
2420
2420
|
`);if(V=`${R.join(`
|
|
2421
2421
|
`)}
|
|
@@ -2424,13 +2424,13 @@ var ${M} = (function() {
|
|
|
2424
2424
|
${V}
|
|
2425
2425
|
return { ${T} };
|
|
2426
2426
|
})();
|
|
2427
|
-
${I}`.trim(),
|
|
2427
|
+
${I}`.trim(),Z5("bundled:",Q,"output:",V.length,"bytes"),j.length>0&&A.length===0)return console.warn(`[stx:bundler] dropped every binding for ${_0.basename($)} (${Q}); serving the unbundled source and not caching this result`),X;u0.mkdirSync(G,{recursive:!0}),await Bun.write(w,V);let D=Array.from(L).map((N)=>{try{return{path:N,mtimeMs:u0.statSync(N).mtimeMs}}catch{return null}}).filter((N)=>N!==null);return await Bun.write(W,JSON.stringify({metadataVersion:c2,files:D})),V}catch(F){let V=DX(F,$||void 0),A=d2(F,$||void 0);if(console.warn(`[stx:bundler] error: ${A}`),$9($||"",A,V),Y9()==="error")throw F;return X}finally{try{u0.rmSync(U,{force:!0}),u0.rmSync(K,{recursive:!0,force:!0})}catch{}}}var JK=5,c2=1,J9,Z9,m2,X9,l2;var P7=E(()=>{P1();EX();A1();J9=[];m2=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];X9=new Map,l2=Symbol.for("stx.client-bundle-build-queue")});var XZ={};a(XZ,{stripCommentsAndLiterals:()=>a0,renderVendorStyleTags:()=>bX,processClientScript:()=>G5,injectBrowserCoreAutoImports:()=>S5,generateServerDataBridge:()=>SX,generateBrowserAutoImportDestructuring:()=>VK,generateAutoImportDestructuring:()=>G9,findInterpolationEnd:()=>IX,extractBridgeData:()=>J5,extractAndStripCssImports:()=>yX,STX_AUTO_IMPORTS:()=>o2});import Y5 from"path";import x7 from"fs";function BK(X){if(X.startsWith(".")||X.startsWith("/"))return null;if(X.startsWith("@")){let Z=X.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}let $=X.match(/^([^/]+)(\/.*)?$/);if(!$)return null;return{pkg:$[1],subpath:$[2]||""}}function jK(X,$){let Z=$;while(!0){let Y=Y5.join(Z,"node_modules",X,"package.json");if(x7.existsSync(Y))return Y5.dirname(Y);let J=Y5.dirname(Z);if(J===Z)return null;Z=J}}function _K(X,$){if(!X||typeof X!=="object")return null;let Z=(J)=>{if(typeof J==="string")return J;if(J&&typeof J==="object"){if(typeof J.import==="string")return J.import;if(typeof J.default==="string")return J.default;if(typeof J.import==="object")return Z(J.import);if(typeof J.default==="object")return Z(J.default)}return null};if(Object.prototype.hasOwnProperty.call(X,$))return Z(X[$]);let Y=null;for(let J of Object.keys(X)){let G=J.indexOf("*");if(G===-1)continue;let Q=J.slice(0,G),w=J.slice(G+1);if(!$.startsWith(Q)||!$.endsWith(w))continue;if($.length<Q.length+w.length)continue;if(!Y||Q.length>Y.prefix.length)Y={pattern:J,prefix:Q,suffix:w}}if(Y){let J=$.slice(Y.prefix.length,$.length-Y.suffix.length),G=Z(X[Y.pattern]);if(G)return G.replace("*",J)}return null}function HK(X,$){let Z=BK(X);if(!Z||!Z.subpath)return null;let Y=jK(Z.pkg,$);if(!Y)return null;let J;try{J=JSON.parse(x7.readFileSync(Y5.join(Y,"package.json"),"utf8"))}catch{return null}let G=`.${Z.subpath}`,Q=_K(J.exports,G);if(!Q)return null;let w=Y5.resolve(Y,Q);return x7.existsSync(w)?w:null}function yX(X,$){let Z=$.filePath?Y5.dirname($.filePath):$.projectRoot||process.cwd(),Y=$.projectRoot||process.cwd(),J=new Set,G=[];return{code:X.replace(zK,(w,W)=>{let q;try{if(W.startsWith("./")||W.startsWith("../")||W.startsWith("/")){if(q=W.startsWith("/")?W:Y5.resolve(Z,W),!x7.existsSync(q))throw Error(`file not found: ${q}`)}else{let U=null;try{U=Bun.resolveSync(W,Y)}catch{U=HK(W,Y)}if(!U)throw Error(`could not resolve ${W} (Bun.resolveSync + exports fallback both failed)`);q=U}}catch(U){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(W)} (from ${$.filePath||"<unknown>"}): ${U?.message||U}`),""}if(J.has(q))return"";J.add(q);try{let U=x7.readFileSync(q,"utf8");G.push({source:W,resolvedPath:q,contents:U})}catch(U){console.warn(`[stx:vendor-css] could not read ${q}: ${U?.message||U}`)}return""}),styles:G}}function LK(X){return X.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function bX(X){if(X.length===0)return"";return`${X.map(($)=>{return`<style data-stx-vendor="${LK($.source)}" data-stx-layer="vendor">
|
|
2428
2428
|
@layer vendor {
|
|
2429
2429
|
${$.contents}
|
|
2430
2430
|
}
|
|
2431
2431
|
</style>`}).join(`
|
|
2432
2432
|
`)}
|
|
2433
|
-
`}function
|
|
2433
|
+
`}function S5(X){let $=a0(X),Z=new Set;for(let w of X.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let W of w[1].split(",")){let q=W.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(q)Z.add(q)}let Y=new Set;for(let w of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Y.add(w[1]);for(let w of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let W of w[1].split(",")){let q=W.trim().split(/[:=]/).pop()?.trim();if(q)Y.add(q)}let J=a2.filter((w)=>{if(Z.has(w)||Y.has(w))return!1;return new RegExp(`\\b${w}\\s*\\(`).test($)}),G=t2($).filter((w)=>!Z.has(w)&&!Y.has(w));if(J.length===0&&G.length===0)return{code:X,imports:J,models:G};return{code:`${[J.length>0?`import { ${J.join(", ")} } from '@stacksjs/browser'`:"",G.length>0?"import '@stacksjs/browser'":"",G.length>0?`const { ${G.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
|
|
2434
2434
|
`)}
|
|
2435
2435
|
${X}`,imports:J,models:G}}function t2(X){let $=new Set,Z=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,Y;while((Y=Z.exec(X))!==null)if(!OK.has(Y[1]))$.add(Y[1]);return Array.from($)}function FK(X){let $=new Set;for(let Z of X.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))$.add(Z[1]);for(let Z of X.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let Y of Z[1].split(",")){let J=Y.trim().split(/[:=]/).pop()?.trim();if(J&&/^[A-Za-z_$][\w$]*$/.test(J))$.add(J)}return $}function e2(X){let $=new Set,Z=new Set,Y=X;Y=Y.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let J=new Set,G=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"]\s*;?\s*$/gm,Q;while((Q=G.exec(X))!==null){let q=Q[1],U=Q[2];if(Q[0].includes("import type"))continue;let K=[];for(let j of q.split(",")){let B=j.trim();if(!B||B.startsWith("type "))continue;let _=B.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!_)continue;let H=_[1],O=_[2]||H;if(J.add(H),J.add(O),U==="stx"||U==="@stacksjs/stx")$.add(H);else Z.add(H);if(O!==H)K.push(`${O} = ${H}`)}let z=K.length>0?`var ${K.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";Y=Y.replace(Q[0],z)}let w=FK(Y);for(let q of o2){if(J.has(q)||w.has(q))continue;if(new RegExp(`\\b${q}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(Y))$.add(q)}for(let q of a2){if(J.has(q)||w.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(Y))Z.add(q)}let W=t2(Y);for(let q of W)if(!J.has(q)&&!w.has(q))Z.add(q);return{code:Y,stxImports:Array.from($),browserImports:Array.from(Z)}}function G9(X,$){let Z=[];if(X.length>0)Z.push(` var { ${X.join(", ")} } = window.stx || window;`);if($.length>0)Z.push(` var { ${$.join(", ")} } = window.StacksBrowser || {};`);if(Z.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
|
|
2436
2436
|
${Z.join(`
|
|
@@ -2444,7 +2444,7 @@ ${AK(X,$)}`;return""}function VK(X,$=[]){let{browserImports:Z}=e2(X),Y=new Set($
|
|
|
2444
2444
|
+ 'or it should be imported from a relative path so the bundler includes it.'
|
|
2445
2445
|
);
|
|
2446
2446
|
});
|
|
2447
|
-
`}function
|
|
2447
|
+
`}function J5(X){let $=X.__stxClientPayload;if($&&typeof $==="object"){let Y={};for(let J in $){let G=$[J];if(typeof G==="function")continue;Y[J]=G}return Y.__stxDeclaredPayload=!0,Y}let Z={};for(let Y in X){if(Y.startsWith("__")||Y.startsWith("$"))continue;let J=X[Y];if(typeof J==="function")continue;Z[Y]=J}return Z}function n2(X,$){let Z=new Set;for(let Y of X.split(",")){let J=Y.trim().replace(/^\.\.\./,"").trim();if(!J)continue;if($){let G=J.lastIndexOf(":");if(G!==-1)J=J.slice(G+1).trim()}if(J=J.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(J))Z.add(J)}return Z}function RK(X,$){if(new RegExp(`(?:const|let|var|function|class)\\s+${$}\\b`).test(X))return!0;for(let Z of X.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(n2(Z[1],!0).has($))return!0;for(let Z of X.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(n2(Z[1],!1).has($))return!0;return!1}function MK(X,$){return new RegExp(`(?<![.#\\w$])${$}(?![\\w$])`).test(X)}function NK(X,$){let Z=TK.test(X),Y=$.length>32768;if(!Z&&!Y)return;if(r2.has(X))return;if(r2.add(X),Z)console.warn(`[stx] server\u2192client bridge is publishing "${X}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(Y)console.warn(`[stx] server\u2192client bridge is publishing ${($.length/1024).toFixed(1)}KB under "${X}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function SX(X,$){if(!$)return"";let Z=a0(X),Y=$.__stxDeclaredPayload===!0,J=[];for(let[G,Q]of Object.entries($)){if(!/^[A-Za-z_$][\w$]*$/.test(G))continue;if(G.startsWith("__")||G.startsWith("$"))continue;if(!Y&&!MK(Z,G))continue;if(RK(X,G))continue;let w;try{w=JSON.stringify(Q)}catch{continue}if(w===void 0)continue;NK(G,w),J.push(` var ${G} = ${w.replace(/</g,"\\u003c")};`)}if(J.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
|
|
2448
2448
|
${J.join(`
|
|
2449
2449
|
`)}
|
|
2450
2450
|
`}function IK(X){let $=[];if(X.self)$.push("if ($event.target !== $el) return");for(let Z of X.systemKeys)$.push(`if (!$event.${Z}Key) return`);if(X.keys.length>0){let Z=X.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");$.push(`if (!(${Z})) return`)}if(X.mouse!==null){let Z=kK[X.mouse];$.push(`if ($event.button !== ${Z}) return`)}if(X.prevent)$.push("$event.preventDefault()");if(X.stop)$.push("$event.stopPropagation()");return $.join("; ")}function EK(X,$){let{elementId:Z,event:Y,modifiers:J}=X,G=o$(X.handler),Q=IK(J),w=[];if(J.once)w.push("once: true");if(J.capture)w.push("capture: true");if(J.passive)w.push("passive: true");let W=w.length>0?`, { ${w.join(", ")} }`:"",q="";if(Q)q+=`${Q}; `;let U=G.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),K=`var $emit = function(name, detail) {
|
|
@@ -2494,21 +2494,21 @@ else {
|
|
|
2494
2494
|
// STX: auto-generated event bindings
|
|
2495
2495
|
${X.map((Z,Y)=>EK(Z,Y)).join(`
|
|
2496
2496
|
`)}`}function s2(X){let $=[],Z=new Set,Y=X.replace(/^\s*import\s+.*$/gm,""),J=0,G=Y.length,Q=0;while(Q<G){let w=Y[Q];if(w==="'"||w==='"'||w==="`"){let W=w;if(Q++,W==="`"){let q=0;while(Q<G){if(Y[Q]==="\\"){Q+=2;continue}if(Y[Q]==="`"&&q===0){Q++;break}if(Y[Q]==="$"&&Y[Q+1]==="{"){q++,Q+=2;continue}if(Y[Q]==="}"&&q>0){q--,Q++;continue}Q++}}else while(Q<G){if(Y[Q]==="\\"){Q+=2;continue}if(Y[Q]===W){Q++;break}Q++}continue}if(w==="/"&&Y[Q+1]==="/"){while(Q<G&&Y[Q]!==`
|
|
2497
|
-
`)Q++;continue}if(w==="/"&&Y[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Y[Q]==="*"&&Y[Q+1]==="/"))Q++;Q+=2;continue}if(w==="{"){J++,Q++;continue}if(w==="}"){J--,Q++;continue}if(J===0){let W=Y.slice(Q),q=W.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(q){let z=q[1];if(!z.startsWith("_")&&!Z.has(z))$.push(z),Z.add(z);Q+=q[0].length;continue}let U=W.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[1].split(",").forEach((z)=>{let j=z.trim(),B=j.indexOf(":"),_=B>=0?j.slice(B+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!Z.has(_))$.push(_),Z.add(_)}),Q+=U[0].length;continue}let K=W.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(K){let z=K[1];if(!z.startsWith("_")&&!Z.has(z))$.push(z),Z.add(z);Q+=K[0].length;continue}}Q++}return $}function bK(X){let $=new Set,Z=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function Y(z){let j;while((j=Z.exec(z))!==null){let B=j[0];if(!yK.has(B))$.add(B)}}let J=/\{\{([\s\S]*?)\}\}/g,G;while((G=J.exec(X))!==null)Y(G[1]);let Q=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((G=Q.exec(X))!==null)Y(G[1]);let w=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((G=w.exec(X))!==null)Y(G[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((G=W.exec(X))!==null)Y(G[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((G=q.exec(X))!==null)Y(G[1]);let U=/@model\s*=\s*["']([^"']*)["']/gi;while((G=U.exec(X))!==null)Y(G[1]);let K=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((G=K.exec(X))!==null)Y(G[1]);return $}async function
|
|
2498
|
-
${
|
|
2497
|
+
`)Q++;continue}if(w==="/"&&Y[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Y[Q]==="*"&&Y[Q+1]==="/"))Q++;Q+=2;continue}if(w==="{"){J++,Q++;continue}if(w==="}"){J--,Q++;continue}if(J===0){let W=Y.slice(Q),q=W.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(q){let z=q[1];if(!z.startsWith("_")&&!Z.has(z))$.push(z),Z.add(z);Q+=q[0].length;continue}let U=W.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[1].split(",").forEach((z)=>{let j=z.trim(),B=j.indexOf(":"),_=B>=0?j.slice(B+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!Z.has(_))$.push(_),Z.add(_)}),Q+=U[0].length;continue}let K=W.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(K){let z=K[1];if(!z.startsWith("_")&&!Z.has(z))$.push(z),Z.add(z);Q+=K[0].length;continue}}Q++}return $}function bK(X){let $=new Set,Z=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function Y(z){let j;while((j=Z.exec(z))!==null){let B=j[0];if(!yK.has(B))$.add(B)}}let J=/\{\{([\s\S]*?)\}\}/g,G;while((G=J.exec(X))!==null)Y(G[1]);let Q=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((G=Q.exec(X))!==null)Y(G[1]);let w=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((G=w.exec(X))!==null)Y(G[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((G=W.exec(X))!==null)Y(G[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((G=q.exec(X))!==null)Y(G[1]);let U=/@model\s*=\s*["']([^"']*)["']/gi;while((G=U.exec(X))!==null)Y(G[1]);let K=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((G=K.exec(X))!==null)Y(G[1]);return $}async function G5(X,$={}){let Z=X,Y="",J=!1,G=[],Q=yX(Z,{filePath:$.filePath,projectRoot:$.projectRoot});Z=Q.code;let w=bX(Q.styles),W=S5(Z);Z=W.code,G=[...W.imports,...W.models];let{hasUserImports:q,bundleClientScript:U}=await X0("stx/client-script-bundler",()=>Promise.resolve().then(() => (P7(),C7)));if(q(Z))Z=await U(Z,$.filePath||"",{projectRoot:$.projectRoot,minify:$.production}),J=!0;if($.autoImports!==!1){let L=e2(Z);Z=L.code,Y=G9(L.stxImports,L.browserImports.filter((F)=>!G.includes(F)))}if(Y=`${SX(Z,$.serverData)}${Y}`,Z=p0(Z),!J&&Q5($.attrs||""))Z=w5(Z);let K=DK($.eventBindings||[]),z=($.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(z)){let L=z.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${L?` ${L}`:""}`;return`${w}<script ${F}>
|
|
2498
|
+
${y5(`${Y}${Z}
|
|
2499
2499
|
${K}`)}
|
|
2500
2500
|
</script>`}let B=r$(X),_=/function __stx_setup_/.test(Z),H=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(X);function O(L){let F=L.length>0?`
|
|
2501
2501
|
return { ${L.join(", ")} };`:"";return`${w}<script data-stx-scoped data-stx-run="always">
|
|
2502
2502
|
window.stx.mount(function() {
|
|
2503
2503
|
'use strict';
|
|
2504
|
-
${
|
|
2504
|
+
${y5(`${Y}${Z}
|
|
2505
2505
|
${K}${F}`)}
|
|
2506
2506
|
})</script>`}if(!H&&!_){if(B)return O(s2(X));if($.templateContent){let L=s2(X);if(L.length>0){let F=bK($.templateContent);if(L.some((A)=>F.has(A)))return O(L)}}}return`${w}<script data-stx-scoped data-stx-run="always">
|
|
2507
2507
|
;(function() {
|
|
2508
2508
|
'use strict';
|
|
2509
|
-
${
|
|
2509
|
+
${y5(`${Y}${Z}
|
|
2510
2510
|
${K}`)}
|
|
2511
|
-
})()</script>`}var zK,o2,a2,OK,TK,r2,kK,yK;var
|
|
2511
|
+
})()</script>`}var zK,o2,a2,OK,TK,r2,kK,yK;var C5=E(()=>{t$();H0();E7();Z1();e$();zK=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;o2=V1,a2=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useDocumentVisibility","useIntervalFn","useTimeoutFn"];OK=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"]);TK=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,r2=new Set;kK={left:0,middle:1,right:2};yK=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"])});import{createHash as SK}from"crypto";function $Z(X){let $=X[CX];return $ instanceof Map?$:null}function ZZ(X){X[CX]=new Map}function YZ(X,$){let Z=$Z(X);if(!Z)return null;let Y=SK("sha256").update($).digest("hex").slice(0,16),J=Z.get(Y);if(J)J.instances++;else Z.set(Y,{body:$,instances:1});return Y}function JZ(X,$){let Z=$Z($);if(!Z?.size)return X;let Y=X;for(let[W,q]of Z){if(q.instances!==1)continue;let U=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(W)}\\]\\(("[^"]+")\\);`,"g");Y=Y.replace(U,(K,z)=>`(${q.body})(${z});`)}let J=[...Z].filter(([,W])=>W.instances>1);if(J.length===0)return Y;let Q=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
|
|
2512
2512
|
(function() {
|
|
2513
2513
|
const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
|
|
2514
2514
|
${J.map(([W,q])=>` try { factories[${JSON.stringify(W)}] = factories[${JSON.stringify(W)}] || ${q.body}; }
|
|
@@ -2517,7 +2517,7 @@ ${J.map(([W,q])=>` try { factories[${JSON.stringify(W)}] = factories[${JSON.str
|
|
|
2517
2517
|
})();
|
|
2518
2518
|
</script>`,w=Y.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i);if(w<0)return`${Q}
|
|
2519
2519
|
${Y}`;return`${Y.slice(0,w)}${Q}
|
|
2520
|
-
${Y.slice(w)}`}var CX="__stx_component_client_factories";var Q9=()=>{};function xK(X){let $="",Z=null,Y=!1;for(let J=0;J<X.length;J++){let G=X[J];if(Y){Y=!1;continue}if(G==="\\"&&Z){Y=!0;continue}if(Z){if(Z==="`"&&G==="$"&&J+1<X.length&&X[J+1]==="{"){let Q=1;J+=2;while(J<X.length&&Q>0){if(X[J]==="{")Q++;else if(X[J]==="}")Q--;if(Q>0)$+=X[J],J++}continue}if(G===Z)Z=null;continue}if(G==='"'||G==="'"||G==="`"){Z=G;continue}$+=G}return $}function fK(X,$){let Z=/[$A-Z_a-z][$\w]*/g,Y;while((Y=Z.exec(X))!==null){let J=Y[0],G=X[Y.index-1];if(PK.has(J))throw Error(`Potentially unsafe expression (matched /\\b${J}\\b/; identifier ${J}): ${$}`);if(G==="."&&WZ.has(J))throw Error(`Potentially unsafe expression (matched /.${J}/; property ${J}): ${$}`)}}function gK(X){let $=/\[\s*(['"])(.*?)\1\s*\]/g,Z;while((Z=$.exec(X))!==null){let Y=Z[2];if(!WZ.has(Y))continue;let J=X.slice(0,Z.index).match(/\S(?=\s*$)/)?.[0],G=X.slice(Z.index+Z[0].length).match(/^\s*(\S)/)?.[1];if(!((J==="{"||J===",")&&G===":"))throw Error(`Potentially unsafe expression (bracket key ${Z[2]}): ${X}`)}}function PX(X){let $=X.trim(),Z=xK($);fK(Z,$),gK($);for(let Y of wZ)if(Y.test(Z))throw Error(`Potentially unsafe expression (matched /${Y.source}/): ${$}`);if(!QZ.allowBracketNotation&&vK.test($))throw Error(`Bracket notation with strings not allowed: ${$}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return $}function hK(X){let $={};$.Math=Math,$.JSON=JSON,$.Date=Date,$.String=String,$.Number=Number,$.Boolean=Boolean,$.Array=Array,$.parseInt=Number.parseInt,$.parseFloat=Number.parseFloat,$.isNaN=Number.isNaN,$.isFinite=Number.isFinite,$.encodeURIComponent=encodeURIComponent,$.decodeURIComponent=decodeURIComponent;for(let[Z,Y]of Object.entries(X)){if(Z.startsWith("__")||wZ.some((J)=>J.test(Z)))continue;if(Y&&typeof Y==="object"&&!Array.isArray(Y))$[Z]=w9(Y);else $[Z]=Y}return $}function w9(X,$=0){if($>=QZ.maxSanitizeDepth)return"[Object too deep]";if(X===null||typeof X!=="object")return X;if(Array.isArray(X))return X.map((Y)=>w9(Y,$+1));if(X instanceof Date||X instanceof RegExp||X instanceof Map||X instanceof Set||X instanceof Error)return X;let Z={};for(let[Y,J]of Object.entries(X)){if(Y.startsWith("__")||Y==="constructor"||Y==="prototype")continue;if(J&&typeof J==="object")Z[Y]=w9(J,$+1);else Z[Y]=J}return Z}function Q0(X,$){try{let Z=hK($),Y=Object.keys(Z),J=Object.values(Z);return
|
|
2520
|
+
${Y.slice(w)}`}var CX="__stx_component_client_factories";var Q9=()=>{};function xK(X){let $="",Z=null,Y=!1;for(let J=0;J<X.length;J++){let G=X[J];if(Y){Y=!1;continue}if(G==="\\"&&Z){Y=!0;continue}if(Z){if(Z==="`"&&G==="$"&&J+1<X.length&&X[J+1]==="{"){let Q=1;J+=2;while(J<X.length&&Q>0){if(X[J]==="{")Q++;else if(X[J]==="}")Q--;if(Q>0)$+=X[J],J++}continue}if(G===Z)Z=null;continue}if(G==='"'||G==="'"||G==="`"){Z=G;continue}$+=G}return $}function fK(X,$){let Z=/[$A-Z_a-z][$\w]*/g,Y;while((Y=Z.exec(X))!==null){let J=Y[0],G=X[Y.index-1];if(PK.has(J))throw Error(`Potentially unsafe expression (matched /\\b${J}\\b/; identifier ${J}): ${$}`);if(G==="."&&WZ.has(J))throw Error(`Potentially unsafe expression (matched /.${J}/; property ${J}): ${$}`)}}function gK(X){let $=/\[\s*(['"])(.*?)\1\s*\]/g,Z;while((Z=$.exec(X))!==null){let Y=Z[2];if(!WZ.has(Y))continue;let J=X.slice(0,Z.index).match(/\S(?=\s*$)/)?.[0],G=X.slice(Z.index+Z[0].length).match(/^\s*(\S)/)?.[1];if(!((J==="{"||J===",")&&G===":"))throw Error(`Potentially unsafe expression (bracket key ${Z[2]}): ${X}`)}}function PX(X){let $=X.trim(),Z=xK($);fK(Z,$),gK($);for(let Y of wZ)if(Y.test(Z))throw Error(`Potentially unsafe expression (matched /${Y.source}/): ${$}`);if(!QZ.allowBracketNotation&&vK.test($))throw Error(`Bracket notation with strings not allowed: ${$}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return $}function hK(X){let $={};$.Math=Math,$.JSON=JSON,$.Date=Date,$.String=String,$.Number=Number,$.Boolean=Boolean,$.Array=Array,$.parseInt=Number.parseInt,$.parseFloat=Number.parseFloat,$.isNaN=Number.isNaN,$.isFinite=Number.isFinite,$.encodeURIComponent=encodeURIComponent,$.decodeURIComponent=decodeURIComponent;for(let[Z,Y]of Object.entries(X)){if(Z.startsWith("__")||wZ.some((J)=>J.test(Z)))continue;if(Y&&typeof Y==="object"&&!Array.isArray(Y))$[Z]=w9(Y);else $[Z]=Y}return $}function w9(X,$=0){if($>=QZ.maxSanitizeDepth)return"[Object too deep]";if(X===null||typeof X!=="object")return X;if(Array.isArray(X))return X.map((Y)=>w9(Y,$+1));if(X instanceof Date||X instanceof RegExp||X instanceof Map||X instanceof Set||X instanceof Error)return X;let Z={};for(let[Y,J]of Object.entries(X)){if(Y.startsWith("__")||Y==="constructor"||Y==="prototype")continue;if(J&&typeof J==="object")Z[Y]=w9(J,$+1);else Z[Y]=J}return Z}function Q0(X,$){try{let Z=hK($),Y=Object.keys(Z),J=Object.values(Z);return K0(X,Y)(...J)}catch{return}}function U0(X){try{return PX(X),!0}catch{return!1}}function R0(X,$){try{let Z=Q0(X,$);if(Z&&typeof Z==="object"&&!Array.isArray(Z))return Z;return{}}catch{return{}}}function K0(X,$){let Z=PX(X),Y=/^[A-Za-z_$][\w$]*$/,J=[],G=[];for(let q=0;q<$.length;q++){let U=$[q];if(!Y.test(U))continue;if(qZ.has(U))continue;J.push(q),G.push(U)}let Q=(q)=>Function(...G,...q,`
|
|
2521
2521
|
'use strict';
|
|
2522
2522
|
try {
|
|
2523
2523
|
return ${Z};
|
|
@@ -2528,7 +2528,7 @@ catch (e) {
|
|
|
2528
2528
|
}
|
|
2529
2529
|
throw e;
|
|
2530
2530
|
}
|
|
2531
|
-
`),w=Q([]);if(G.length===$.length)return GZ(w,G,Q);return GZ((...q)=>{let U=Array(J.length);for(let K=0;K<J.length;K++)U[K]=q[J[K]];return w(...U)},G,Q,(q)=>{w=Q(q)})}function GZ(X,$,Z,Y){let G=/^(\w+) is not defined$/,Q=X,w=[],W=new Set($);return(...q)=>{for(let U=0;U<=8;U++)try{return Q(...q)}catch(K){let z=K instanceof Error?K.message:"",j=G.exec(z);if(!(K instanceof ReferenceError)||!j)return;let B=j[1];if(W.has(B)||qZ.has(B))return;W.add(B),w.push(B),Q=Z(w),Y?.(w)}return}}function vX(X){let $=X.trim(),Z=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let Y of Z)if(Y.test($))return!1;return!0}var CK,QZ,wZ,PK,WZ,vK,qZ;var T0=E(()=>{CK={maxSanitizeDepth:10,allowBracketNotation:!1},QZ={...CK},wZ=[/\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/],PK=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"]),WZ=new Set(["__proto__","constructor","prototype"]),vK=/[\w)\]]\s*\[\s*['"]/;qZ=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 xX(X,$){let Z=uK++,Y=`<!--__STX_${X.toUpperCase()}_${Z}__-->`;return dK.set(Y,{type:X,expression:$}),Y}var uK=0,dK;var UZ=E(()=>{dK=new Map});function _Z(X,$,Z,Y){Z.lastIndex=$;let J=Z.exec(X);if(!J||J.index!==$)return-1;Y.lastIndex=Z.lastIndex;let G=Y.exec(X);if(!G)return-1;return G.index+G[0].length}function C1(X,$){return _Z(X,$,KZ,zZ)}function v5(X,$){return _Z(X,$,BZ,jZ)}function f7(X,$){if(!X.startsWith("<!--",$))return-1;let Z=X.indexOf("-->",$+4);if(Z===-1)return-1;return Z+3}function mK(X,$){if(X.startsWith("<!--",$)){let Z=f7(X,$);return Z===-1?X.length:Z}for(let[Z,Y]of[[KZ,zZ],[BZ,jZ]]){Z.lastIndex=$;let J=Z.exec(X);if(!J||J.index!==$)continue;Y.lastIndex=Z.lastIndex;let G=Y.exec(X);return G?G.index+G[0].length:X.length}return-1}function fX(X,$){let Z=[],Y=0,J=X.length,G=!1,Q=null;while(Y<J){let w=X[Y];if(G){if(Q){if(w===Q)Q=null}else if(w==='"'||w==="'")Q=w;else if(w===">")G=!1;Y++;continue}if(w!=="<"){Y++;continue}let W=$(X,Y);if(W>Y){Z.push({start:Y,end:W,token:X.slice(Y,W)}),Y=W;continue}let q=mK(X,Y);if(q>Y){Y=q;continue}if(/^<\/?[a-zA-Z]/.test(X.slice(Y,Y+2)))G=!0;Y++}return Z}function W1(X,$,Z){let Y=fX(X,$);if(Y.length===0)return{output:X,tokens:[]};let J=Y.map((w)=>w.token),G="",Q=0;for(let w=0;w<Y.length;w++){let W=Y[w];G+=X.slice(Q,W.start),G+=Z(W.token,w),Q=W.end}return G+=X.slice(Q),{output:G,tokens:J}}function q1(X){let{output:$,tokens:Z}=W1(X,C1,(Y,J)=>`\x00STX_SCRIPT_${J}\x00`);return{output:$,scripts:Z}}function x5(X,$){if($.length===0)return X;return X.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Z,Y)=>$[+Y]??"")}var KZ,zZ,BZ,jZ;var P1=E(()=>{KZ=/<script\b[^>]*>/iy,zZ=/<\/script\s*>/ig,BZ=/<style\b[^>]*>/iy,jZ=/<\/style\s*>/ig});var MZ={};e(MZ,{usesSignalsInScript:()=>R1,unescapeHtml:()=>tK,registerFilters:()=>cK,registerFilter:()=>OZ,processExpressions:()=>v1,interpolateScriptsInTemplate:()=>rK,interpolateScriptExpressions:()=>gX,interpolateScriptAttributes:()=>AZ,getAllFilters:()=>FZ,evaluateExpression:()=>l0,escapeHtmlValue:()=>W9,escapeHtml:()=>U1,defaultFilters:()=>h7,clearCustomFilters:()=>pK,applyFilters:()=>RZ});function lK(X){let $=HZ.get(X);if(!$){let Z=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");$=new RegExp(`:${Z}(?!\\w)`,"g"),HZ.set(X,$)}return $.lastIndex=0,$}function OZ(X,$){if(X in h7)console.warn(`Filter "${X}" already exists as a built-in filter. Custom filter will take precedence.`);g7[X]=$}function cK(X){for(let[$,Z]of Object.entries(X))OZ($,Z)}function FZ(){return{...h7,...g7}}function pK(){for(let X of Object.keys(g7))delete g7[X]}function U1(X){return X.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function W9(X){return U1(X).replace(/\{{2,}/g,($)=>iK($.length)).replace(/\{(?=!)/g,`{${VZ}`)}function iK(X){return Array.from({length:X},()=>"{").join(VZ)}function R1(X){let{scripts:$}=q1(X);for(let Z of $){let Y=Z.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!Y||/\bserver\b|\bsrc\s*=/.test(Y[1]))continue;let J=Y[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(J))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(X))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(X))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(X))return!0;return!1}function LZ(X,$){let Z=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],Y=X.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),J="",G=!1,Q=0;for(let q=0;q<Y.length;q++){let U=Y[q];if(!G&&U==="`"){G=!0,Q=0;continue}if(G){if(U==="`"&&Q===0){G=!1;continue}if(U==="$"&&Y[q+1]==="{"){Q++,q++,J+=" ";continue}if(U==="}"&&Q>0){Q--;continue}if(Q>0){J+=U;continue}continue}J+=U}Y=J;let w=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,W;while((W=w.exec(Y))!==null){let q=W[1];if(!Y.substring(0,W.index).trimEnd().endsWith(".")){if(!Z.includes(q)&&!(q in $))return!1}}return!0}function nK(X,$){let Z=$.__stx_serverDeclared;if(!Z||Z.size===0)return!1;let Y=o0(X);for(let J of Z)if(new RegExp(`(?<![.#\\w$])${J}(?![\\w$])`).test(Y))return!0;return!1}function gX(X,$){let Z=X;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(Y,J)=>{try{let G=l0(J,$);if(G===void 0)return Y;return G===null?"":String(G)}catch{return Y}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(Y,J)=>{let G=J.trim();if(/^__[A-Z_]+__$/.test(G))return Y;try{let Q=l0(J,$);if(Q===void 0)return Y;return JSON.stringify(Q).replace(/</g,"\\u003c")}catch{return Y}}),Z}function AZ(X,$){if(!X.includes("{"))return X;let Z=X;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(Y,J)=>{try{let G=l0(J,$);if(G===void 0)return Y;return G===null?"":String(G)}catch{return Y}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(Y,J)=>{let G=J.trim();if(/^__[A-Z_]+__$/.test(G))return Y;try{let Q=l0(J,$);if(Q===void 0)return Y;if(Q===null)return"";return String(Q).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}catch{return Y}}),Z}function rK(X,$,Z={}){let{output:Y,scripts:J}=q1(X),G=J.map((Q)=>{let w=Q.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),W=Q.match(/^<script\b[^>]*>/i),q=Q.search(/<\/script\s*>$/i);if(!w||!W||q===-1)return Q;let U=w[1],K=w[2];if(/\bdata-raw\b/.test(U))return Q;if(Z.skipServer&&/\bserver\b/.test(U))return Q;let j=`<script${AZ(U,$)}>`;if(/\bsrc\s*=/.test(U)||/\btype\s*=\s*["']application\/json["']/.test(U))return j+K+Q.slice(q);return j+gX(K,$)+Q.slice(q)});return x5(Y,G)}function v1(X,$,Z){let Y=X,J=(K,z)=>{let j=v5(K,z);if(j===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(K.slice(z,j))?-1:j},G=(K,z,j,B)=>{let _=j.length,{output:H,tokens:O}=W1(K,z,(L,F)=>B(_+F));return j.push(...O),H},Q=[];Y=G(Y,J,Q,(K)=>`<!--__STX_STYLE_${K}__-->`);let w=[];Y=G(Y,C1,w,(K)=>`<!--__STX_SCRIPT_EXPR_${K}__-->`);let W=$?.__stx_signals_gate===!0||R1(X),q=new Set(Array.isArray($?.__stx_client_signal_names)?$.__stx_client_signal_names:[]),U=new Set(Array.isArray($?.__stx_preserved_client_expressions)?$.__stx_preserved_client_expressions:[]);Y=Y.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(K,z,j)=>{try{let B=l0(z,$);return B!==void 0&&B!==null?String(B):""}catch(B){let _=B instanceof Error?B.message:String(B);return j0("Expression",`Error evaluating: {{{ ${z.trim()}}}}: ${_}`,Z,X,j,K)}}),Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(K,z,j)=>{try{let B=l0(z,$);if(B===void 0&&$.__stx_buildMode==="compile")return xX("raw",z.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if($.__stx_buildMode==="compile")return xX("raw",z.trim());let _=B instanceof Error?B.message:String(B);return j0("Expression",`Error evaluating: {!! ${z.trim()} !!}: ${_}`,Z,X,j,K)}}),Y=G(Y,C1,w,(K)=>`<!--__STX_SCRIPT_EXPR_${K}__-->`),Y=G(Y,J,Q,(K)=>`<!--__STX_STYLE_${K}__-->`),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(K,z,j)=>{let B=z.trim();if(U.has(B))return K;let _=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],H=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,L=B.match(H)?.[1],F=L&&((L in $)||_.includes(L)),V=Boolean(L&&q.has(L)),A=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=B.match(A),M=R&&!_.includes(R[1])&&!(R[1]in $);if(/^__[A-Z_]+__$/.test(B))return"";try{let T=l0(z,$);if(V)return K;if(W&&!LZ(B,$))return K;if($.__stx_buildMode==="compile"&&!W&&(T===void 0||nK(B,$)))return xX("expr",B);return T!==void 0&&T!==null?W9(String(T)):""}catch(T){if(V)return K;if(W&&!LZ(B,$))return K;if(M)return K;let k=T instanceof Error?T.message:String(T);return j0("Expression",`Error evaluating: {{ ${B} }}: ${k}`,Z,X,j,K)}});for(let K=0;K<w.length;K++)Y=Y.replace(`<!--__STX_SCRIPT_EXPR_${K}__-->`,()=>w[K]);for(let K=0;K<Q.length;K++)Y=Y.replace(`<!--__STX_STYLE_${K}__-->`,()=>Q[K]);return Y}function RZ(X,$,Z){if(!$.trim())return X;let Y=X,J=$.trim();while(J.length>0){let G=J.match(/^(\w+)/);if(!G)break;let Q=G[1];J=J.substring(Q.length).trim();let w=g7[Q]||h7[Q];if(!w)throw Error(`Filter not found: ${Q}. Available filters: ${Object.keys(FZ()).join(", ")}`);let W=[];if(J.startsWith(":")){let q=J.match(/^:([^|\s]+)/);if(q){let U=q[1].trim();try{let K=Number(U);W=[Number.isNaN(K)?U:K]}catch{W=[U]}J=J.substring(q[0].length).trim()}}else if(J.startsWith("(")){let q=1,U=1;while(q>0&&U<J.length){if(J[U]==="(")q++;if(J[U]===")")q--;U++}if(q===0){let K=J.substring(1,U-1).trim();if(K)try{if(K.startsWith("{")&&K.endsWith("}"))W=[l0(`(${K})`,Z,!0)];else{let z=[],j="",B=null,_=0,H=0,O=0,L=!1;for(let F=0;F<K.length;F++){let V=K[F];if(L){j+=V,L=!1;continue}if(V==="\\"){j+=V,L=!0;continue}if(B){if(j+=V,V===B)B=null;continue}if(V==='"'||V==="'"||V==="`"){B=V,j+=V;continue}if(V==="(")_++;else if(V===")")_--;else if(V==="[")H++;else if(V==="]")H--;else if(V==="{")O++;else if(V==="}")O--;if(V===","&&_===0&&H===0&&O===0){z.push(j),j="";continue}j+=V}if(j)z.push(j);W=z.map((F)=>{let V=F.trim();return l0(V,Z,!0)})}}catch{W=[K]}J=J.substring(U).trim()}}try{Y=w(Y,Z,...W)}catch(q){let U=q instanceof Error?q.message:String(q);throw Error(`Error applying filter '${Q}': ${U}`)}if(J.startsWith("|"))J=J.substring(1).trim();else break}return Y}function sK(X){let $=!1,Z="",Y=0,J=0,G=0,Q=!1;for(let w=0;w<X.length;w++){let W=X[w],q=X[w+1];if($&&Q){Q=!1;continue}if($&&W==="\\"){Q=!0;continue}if(Q=!1,(W==='"'||W==="'"||W==="`")&&!Q){if(!$)$=!0,Z=W;else if(W===Z)$=!1,Z="";continue}if($&&Z==="`"&&W==="$"&&q==="{"){let U=1;w+=2;while(w<X.length&&U>0){if(X[w]==="{")U++;else if(X[w]==="}")U--;if(U>0)w++}continue}if($)continue;if(W==="(")Y++;else if(W===")")Y--;else if(W==="[")J++;else if(W==="]")J--;else if(W==="{")G++;else if(W==="}")G--;if(W==="|"&&Y===0&&J===0&&G===0){if(q==="|"){w++;continue}if(q==="="){w++;continue}return w}}return-1}function l0(X,$,Z=!1){try{let Y=X.trim(),J=sK(Y);if(J>0){let G=Y.substring(0,J).trim(),Q=Y.substring(J+1).trim(),w=l0(G,$,!0);return RZ(w,Q,$)}if(!W0(Y)){if(!Z)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${Y}`);return Q0(Y,$)}try{let G=Object.keys($),Q=Object.values($);return q0(Y,G)(...Q)}catch{return Q0(Y,$)}}catch(Y){if(Y instanceof ReferenceError){let J=/(\b\w+)\s+is not defined/.exec(Y.message);if(J){let G=J[1],Q=oK(G,Object.keys($));if(Q&&Q!==G)Y.message=`${Y.message} \u2014 did you mean '${Q}'?`}}if(!Z)console.error(`Error evaluating expression: ${X}`,Y);throw Y}}function oK(X,$){let Z=null;for(let J of $){if(J===X)continue;let G=aK(X,J);if(Z===null||G<Z.dist)Z={key:J,dist:G}}if(!Z)return null;let Y=Math.max(X.length,Z.key.length);if(Z.dist<=2||Z.dist/Y<=0.35)return Z.key;return null}function aK(X,$){if(X===$)return 0;if(X.length===0)return $.length;if($.length===0)return X.length;let[Z,Y]=X.length<$.length?[X,$]:[$,X],J=Array(Z.length+1),G=Array(Z.length+1);for(let Q=0;Q<=Z.length;Q++)J[Q]=Q;for(let Q=1;Q<=Y.length;Q++){G[0]=Q;for(let w=1;w<=Z.length;w++){let W=Z[w-1]===Y[Q-1]?0:1;G[w]=Math.min(G[w-1]+1,J[w]+1,J[w-1]+W)}for(let w=0;w<=Z.length;w++)J[w]=G[w]}return J[Z.length]}function tK(X){if(!X)return"";return X.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}var g7,HZ,h7,VZ="⁠";var K1=E(()=>{T0();L0();UZ();P1();g7={},HZ=new Map;h7={uppercase:(X,$)=>{return X!==void 0&&X!==null?String(X).toUpperCase():""},lowercase:(X,$)=>{return X!==void 0&&X!==null?String(X).toLowerCase():""},capitalize:(X,$)=>{if(X===void 0||X===null)return"";let Z=String(X);return Z.charAt(0).toUpperCase()+Z.slice(1)},number:(X,$,Z=0)=>{if(X===void 0||X===null)return"";try{let Y=Number(X);return Number.isNaN(Y)?"":Y.toFixed(Number.parseInt(String(Z),10))}catch{return""}},fmt:(X,$,Z="en-US")=>{if(X===void 0||X===null)return"";try{let Y=Number(X);if(Number.isNaN(Y))return String(X);return Y.toLocaleString(Z)}catch{return String(X)}},join:(X,$,Z=",")=>{if(!Array.isArray(X))return"";return X.join(String(Z))},escape:(X,$)=>{if(X===void 0||X===null)return"";return W9(String(X))},translate:(X,$,Z={})=>{if(!$||!$.__translations)return X;let Y=$.__translations,J=$.__i18nConfig?.fallbackToKey??!0,G=String(X).split("."),Q=Y;for(let W of G){if(Q===void 0||Q===null)break;Q=Q[W]}if(Q===void 0||Q===null)return J?X:"";let w=String(Q);return Object.entries(Z).forEach(([W,q])=>{w=w.replace(lK(W),String(q))}),w},t:(X,$,Z={})=>{return h7.translate(X,$,Z)},truncate:(X,$,Z=50,Y="...")=>{if(X===void 0||X===null)return"";let J=String(X);if(J.length<=Z)return J;if(Z<=Y.length)return Y.substring(0,Z);return J.substring(0,Z-Y.length)+Y},date:(X,$,Z="short",Y="en-US")=>{if(X===void 0||X===null)return"";try{let J=X instanceof Date?X:new Date(X);if(Number.isNaN(J.getTime()))return String(X);let G={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Z==="iso")return J.toISOString();return new Intl.DateTimeFormat(Y,G[Z]||G.short).format(J)}catch{return String(X)}},currency:(X,$,Z="USD",Y="en-US")=>{if(X===void 0||X===null)return"";try{let J=Number(X);if(Number.isNaN(J))return String(X);return new Intl.NumberFormat(Y,{style:"currency",currency:Z}).format(J)}catch{return String(X)}},pluralize:(X,$,Z,Y)=>{let J=Number(X);if(Number.isNaN(J))return Z;let G=Y||`${Z}s`;return J===1?Z:G},first:(X,$)=>{if(X===void 0||X===null)return"";if(Array.isArray(X))return X.length===0?"":X[0];return String(X).charAt(0)},last:(X,$)=>{if(X===void 0||X===null)return"";if(Array.isArray(X))return X.length===0?"":X[X.length-1];let Z=String(X);return Z.charAt(Z.length-1)},length:(X,$)=>{if(X===void 0||X===null)return 0;if(Array.isArray(X)||typeof X==="string")return X.length;if(X instanceof Map||X instanceof Set)return X.size;if(typeof X==="object")return Object.keys(X).length;return 0},json:(X,$,Z=!1)=>{if(X===void 0)return"undefined";if(X===null)return"null";try{return Z?JSON.stringify(X,null,2):JSON.stringify(X)}catch{return String(X)}},default:(X,$,Z="")=>{return X===void 0||X===null||X===""?Z:X},reverse:(X,$)=>{if(X===void 0||X===null)return"";if(Array.isArray(X))return[...X].reverse();return String(X).split("").reverse().join("")},slice:(X,$,Z=0,Y)=>{if(X===void 0||X===null)return"";if(Array.isArray(X)||typeof X==="string")return X.slice(Z,Y);return X},replace:(X,$,Z,Y="")=>{if(X===void 0||X===null)return"";let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(X).replace(new RegExp(J,"g"),()=>Y)},stripTags:(X,$)=>{if(X===void 0||X===null)return"";return String(X).replace(/<[^>]*>/g,"")},urlencode:(X,$)=>{if(X===void 0||X===null)return"";return encodeURIComponent(String(X))},abs:(X,$)=>{let Z=Number(X);return Number.isNaN(Z)?0:Math.abs(Z)},round:(X,$,Z=0)=>{let Y=Number(X);if(Number.isNaN(Y))return 0;let J=10**Z;return Math.round(Y*J)/J}}});class q5{cache=new Map;maxSize;constructor(X=100){this.maxSize=X}get(X){if(!this.cache.has(X))return;let $=this.cache.get(X);return this.cache.delete(X),this.cache.set(X,$),$}set(X,$){if(this.cache.has(X))this.cache.delete(X);else if(this.cache.size>=this.maxSize){let Z=this.cache.keys().next().value;if(Z!==void 0)this.cache.delete(Z)}this.cache.set(X,$)}has(X){return this.cache.has(X)}delete(X){return this.cache.delete(X)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function g5(X,$){if($?.includes("g"))return new RegExp(X,$);let Z=`${X}:${$||""}`;if(!f5.has(Z)){if(f5.size>=eK){let Y=f5.keys().next().value;if(Y)f5.delete(Y)}f5.set(Z,new RegExp(X,$))}return f5.get(Z)}class TZ{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(X){let $=Array.from(new Set(X)),Z=$.sort().join(","),Y=this.pool.find((w)=>w.context.join(",")===Z);if(Y)return Y.func;let J=this.fnCache,G=this.fnCacheMaxSize,Q=(...w)=>{return(W)=>{try{let q=`${Z}:${W}`,U=J.get(q);if(!U){if(J.size>=G){let K=J.keys().next().value;if(K)J.delete(K)}U=Function(...$,`
|
|
2531
|
+
`),w=Q([]);if(G.length===$.length)return GZ(w,G,Q);return GZ((...q)=>{let U=Array(J.length);for(let K=0;K<J.length;K++)U[K]=q[J[K]];return w(...U)},G,Q,(q)=>{w=Q(q)})}function GZ(X,$,Z,Y){let G=/^(\w+) is not defined$/,Q=X,w=[],W=new Set($);return(...q)=>{for(let U=0;U<=8;U++)try{return Q(...q)}catch(K){let z=K instanceof Error?K.message:"",j=G.exec(z);if(!(K instanceof ReferenceError)||!j)return;let B=j[1];if(W.has(B)||qZ.has(B))return;W.add(B),w.push(B),Q=Z(w),Y?.(w)}return}}function vX(X){let $=X.trim(),Z=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let Y of Z)if(Y.test($))return!1;return!0}var CK,QZ,wZ,PK,WZ,vK,qZ;var M0=E(()=>{CK={maxSanitizeDepth:10,allowBracketNotation:!1},QZ={...CK},wZ=[/\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/],PK=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"]),WZ=new Set(["__proto__","constructor","prototype"]),vK=/[\w)\]]\s*\[\s*['"]/;qZ=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 xX(X,$){let Z=uK++,Y=`<!--__STX_${X.toUpperCase()}_${Z}__-->`;return dK.set(Y,{type:X,expression:$}),Y}var uK=0,dK;var UZ=E(()=>{dK=new Map});function _Z(X,$,Z,Y){Z.lastIndex=$;let J=Z.exec(X);if(!J||J.index!==$)return-1;Y.lastIndex=Z.lastIndex;let G=Y.exec(X);if(!G)return-1;return G.index+G[0].length}function v1(X,$){return _Z(X,$,KZ,zZ)}function P5(X,$){return _Z(X,$,BZ,jZ)}function f7(X,$){if(!X.startsWith("<!--",$))return-1;let Z=X.indexOf("-->",$+4);if(Z===-1)return-1;return Z+3}function mK(X,$){if(X.startsWith("<!--",$)){let Z=f7(X,$);return Z===-1?X.length:Z}for(let[Z,Y]of[[KZ,zZ],[BZ,jZ]]){Z.lastIndex=$;let J=Z.exec(X);if(!J||J.index!==$)continue;Y.lastIndex=Z.lastIndex;let G=Y.exec(X);return G?G.index+G[0].length:X.length}return-1}function fX(X,$){let Z=[],Y=0,J=X.length,G=!1,Q=null;while(Y<J){let w=X[Y];if(G){if(Q){if(w===Q)Q=null}else if(w==='"'||w==="'")Q=w;else if(w===">")G=!1;Y++;continue}if(w!=="<"){Y++;continue}let W=$(X,Y);if(W>Y){Z.push({start:Y,end:W,token:X.slice(Y,W)}),Y=W;continue}let q=mK(X,Y);if(q>Y){Y=q;continue}if(/^<\/?[a-zA-Z]/.test(X.slice(Y,Y+2)))G=!0;Y++}return Z}function w1(X,$,Z){let Y=fX(X,$);if(Y.length===0)return{output:X,tokens:[]};let J=Y.map((w)=>w.token),G="",Q=0;for(let w=0;w<Y.length;w++){let W=Y[w];G+=X.slice(Q,W.start),G+=Z(W.token,w),Q=W.end}return G+=X.slice(Q),{output:G,tokens:J}}function W1(X){let{output:$,tokens:Z}=w1(X,v1,(Y,J)=>`\x00STX_SCRIPT_${J}\x00`);return{output:$,scripts:Z}}function v5(X,$){if($.length===0)return X;return X.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Z,Y)=>$[+Y]??"")}var KZ,zZ,BZ,jZ;var x1=E(()=>{KZ=/<script\b[^>]*>/iy,zZ=/<\/script\s*>/ig,BZ=/<style\b[^>]*>/iy,jZ=/<\/style\s*>/ig});var MZ={};a(MZ,{usesSignalsInScript:()=>R1,unescapeHtml:()=>tK,registerFilters:()=>cK,registerFilter:()=>OZ,processExpressions:()=>f1,interpolateScriptsInTemplate:()=>rK,interpolateScriptExpressions:()=>gX,interpolateScriptAttributes:()=>AZ,getAllFilters:()=>FZ,evaluateExpression:()=>d0,escapeHtmlValue:()=>W9,escapeHtml:()=>q1,defaultFilters:()=>h7,clearCustomFilters:()=>pK,applyFilters:()=>RZ});function lK(X){let $=HZ.get(X);if(!$){let Z=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");$=new RegExp(`:${Z}(?!\\w)`,"g"),HZ.set(X,$)}return $.lastIndex=0,$}function OZ(X,$){if(X in h7)console.warn(`Filter "${X}" already exists as a built-in filter. Custom filter will take precedence.`);g7[X]=$}function cK(X){for(let[$,Z]of Object.entries(X))OZ($,Z)}function FZ(){return{...h7,...g7}}function pK(){for(let X of Object.keys(g7))delete g7[X]}function q1(X){return X.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function W9(X){return q1(X).replace(/\{{2,}/g,($)=>iK($.length)).replace(/\{(?=!)/g,`{${VZ}`)}function iK(X){return Array.from({length:X},()=>"{").join(VZ)}function R1(X){let{scripts:$}=W1(X);for(let Z of $){let Y=Z.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!Y||/\bserver\b|\bsrc\s*=/.test(Y[1]))continue;let J=Y[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(J))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(X))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(X))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(X))return!0;return!1}function LZ(X,$){let Z=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],Y=X.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),J="",G=!1,Q=0;for(let q=0;q<Y.length;q++){let U=Y[q];if(!G&&U==="`"){G=!0,Q=0;continue}if(G){if(U==="`"&&Q===0){G=!1;continue}if(U==="$"&&Y[q+1]==="{"){Q++,q++,J+=" ";continue}if(U==="}"&&Q>0){Q--;continue}if(Q>0){J+=U;continue}continue}J+=U}Y=J;let w=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,W;while((W=w.exec(Y))!==null){let q=W[1];if(!Y.substring(0,W.index).trimEnd().endsWith(".")){if(!Z.includes(q)&&!(q in $))return!1}}return!0}function nK(X,$){let Z=$.__stx_serverDeclared;if(!Z||Z.size===0)return!1;let Y=a0(X);for(let J of Z)if(new RegExp(`(?<![.#\\w$])${J}(?![\\w$])`).test(Y))return!0;return!1}function gX(X,$){let Z=X;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(Y,J)=>{try{let G=d0(J,$);if(G===void 0)return Y;return G===null?"":String(G)}catch{return Y}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(Y,J)=>{let G=J.trim();if(/^__[A-Z_]+__$/.test(G))return Y;try{let Q=d0(J,$);if(Q===void 0)return Y;return JSON.stringify(Q).replace(/</g,"\\u003c")}catch{return Y}}),Z}function AZ(X,$){if(!X.includes("{"))return X;let Z=X;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(Y,J)=>{try{let G=d0(J,$);if(G===void 0)return Y;return G===null?"":String(G)}catch{return Y}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(Y,J)=>{let G=J.trim();if(/^__[A-Z_]+__$/.test(G))return Y;try{let Q=d0(J,$);if(Q===void 0)return Y;if(Q===null)return"";return String(Q).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}catch{return Y}}),Z}function rK(X,$,Z={}){let{output:Y,scripts:J}=W1(X),G=J.map((Q)=>{let w=Q.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),W=Q.match(/^<script\b[^>]*>/i),q=Q.search(/<\/script\s*>$/i);if(!w||!W||q===-1)return Q;let U=w[1],K=w[2];if(/\bdata-raw\b/.test(U))return Q;if(Z.skipServer&&/\bserver\b/.test(U))return Q;let j=`<script${AZ(U,$)}>`;if(/\bsrc\s*=/.test(U)||/\btype\s*=\s*["']application\/json["']/.test(U))return j+K+Q.slice(q);return j+gX(K,$)+Q.slice(q)});return v5(Y,G)}function f1(X,$,Z){let Y=X,J=(K,z)=>{let j=P5(K,z);if(j===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(K.slice(z,j))?-1:j},G=(K,z,j,B)=>{let _=j.length,{output:H,tokens:O}=w1(K,z,(L,F)=>B(_+F));return j.push(...O),H},Q=[];Y=G(Y,J,Q,(K)=>`<!--__STX_STYLE_${K}__-->`);let w=[];Y=G(Y,v1,w,(K)=>`<!--__STX_SCRIPT_EXPR_${K}__-->`);let W=$?.__stx_signals_gate===!0||R1(X),q=new Set(Array.isArray($?.__stx_client_signal_names)?$.__stx_client_signal_names:[]),U=new Set(Array.isArray($?.__stx_preserved_client_expressions)?$.__stx_preserved_client_expressions:[]);Y=Y.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(K,z,j)=>{try{let B=d0(z,$);return B!==void 0&&B!==null?String(B):""}catch(B){let _=B instanceof Error?B.message:String(B);return B0("Expression",`Error evaluating: {{{ ${z.trim()}}}}: ${_}`,Z,X,j,K)}}),Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(K,z,j)=>{try{let B=d0(z,$);if(B===void 0&&$.__stx_buildMode==="compile")return xX("raw",z.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if($.__stx_buildMode==="compile")return xX("raw",z.trim());let _=B instanceof Error?B.message:String(B);return B0("Expression",`Error evaluating: {!! ${z.trim()} !!}: ${_}`,Z,X,j,K)}}),Y=G(Y,v1,w,(K)=>`<!--__STX_SCRIPT_EXPR_${K}__-->`),Y=G(Y,J,Q,(K)=>`<!--__STX_STYLE_${K}__-->`),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(K,z,j)=>{let B=z.trim();if(U.has(B))return K;let _=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],H=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,L=B.match(H)?.[1],F=L&&((L in $)||_.includes(L)),V=Boolean(L&&q.has(L)),A=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=B.match(A),M=R&&!_.includes(R[1])&&!(R[1]in $);if(/^__[A-Z_]+__$/.test(B))return"";try{let T=d0(z,$);if(V)return K;if(W&&!LZ(B,$))return K;if($.__stx_buildMode==="compile"&&!W&&(T===void 0||nK(B,$)))return xX("expr",B);return T!==void 0&&T!==null?W9(String(T)):""}catch(T){if(V)return K;if(W&&!LZ(B,$))return K;if(M)return K;let k=T instanceof Error?T.message:String(T);return B0("Expression",`Error evaluating: {{ ${B} }}: ${k}`,Z,X,j,K)}});for(let K=0;K<w.length;K++)Y=Y.replace(`<!--__STX_SCRIPT_EXPR_${K}__-->`,()=>w[K]);for(let K=0;K<Q.length;K++)Y=Y.replace(`<!--__STX_STYLE_${K}__-->`,()=>Q[K]);return Y}function RZ(X,$,Z){if(!$.trim())return X;let Y=X,J=$.trim();while(J.length>0){let G=J.match(/^(\w+)/);if(!G)break;let Q=G[1];J=J.substring(Q.length).trim();let w=g7[Q]||h7[Q];if(!w)throw Error(`Filter not found: ${Q}. Available filters: ${Object.keys(FZ()).join(", ")}`);let W=[];if(J.startsWith(":")){let q=J.match(/^:([^|\s]+)/);if(q){let U=q[1].trim();try{let K=Number(U);W=[Number.isNaN(K)?U:K]}catch{W=[U]}J=J.substring(q[0].length).trim()}}else if(J.startsWith("(")){let q=1,U=1;while(q>0&&U<J.length){if(J[U]==="(")q++;if(J[U]===")")q--;U++}if(q===0){let K=J.substring(1,U-1).trim();if(K)try{if(K.startsWith("{")&&K.endsWith("}"))W=[d0(`(${K})`,Z,!0)];else{let z=[],j="",B=null,_=0,H=0,O=0,L=!1;for(let F=0;F<K.length;F++){let V=K[F];if(L){j+=V,L=!1;continue}if(V==="\\"){j+=V,L=!0;continue}if(B){if(j+=V,V===B)B=null;continue}if(V==='"'||V==="'"||V==="`"){B=V,j+=V;continue}if(V==="(")_++;else if(V===")")_--;else if(V==="[")H++;else if(V==="]")H--;else if(V==="{")O++;else if(V==="}")O--;if(V===","&&_===0&&H===0&&O===0){z.push(j),j="";continue}j+=V}if(j)z.push(j);W=z.map((F)=>{let V=F.trim();return d0(V,Z,!0)})}}catch{W=[K]}J=J.substring(U).trim()}}try{Y=w(Y,Z,...W)}catch(q){let U=q instanceof Error?q.message:String(q);throw Error(`Error applying filter '${Q}': ${U}`)}if(J.startsWith("|"))J=J.substring(1).trim();else break}return Y}function sK(X){let $=!1,Z="",Y=0,J=0,G=0,Q=!1;for(let w=0;w<X.length;w++){let W=X[w],q=X[w+1];if($&&Q){Q=!1;continue}if($&&W==="\\"){Q=!0;continue}if(Q=!1,(W==='"'||W==="'"||W==="`")&&!Q){if(!$)$=!0,Z=W;else if(W===Z)$=!1,Z="";continue}if($&&Z==="`"&&W==="$"&&q==="{"){let U=1;w+=2;while(w<X.length&&U>0){if(X[w]==="{")U++;else if(X[w]==="}")U--;if(U>0)w++}continue}if($)continue;if(W==="(")Y++;else if(W===")")Y--;else if(W==="[")J++;else if(W==="]")J--;else if(W==="{")G++;else if(W==="}")G--;if(W==="|"&&Y===0&&J===0&&G===0){if(q==="|"){w++;continue}if(q==="="){w++;continue}return w}}return-1}function d0(X,$,Z=!1){try{let Y=X.trim(),J=sK(Y);if(J>0){let G=Y.substring(0,J).trim(),Q=Y.substring(J+1).trim(),w=d0(G,$,!0);return RZ(w,Q,$)}if(!U0(Y)){if(!Z)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${Y}`);return Q0(Y,$)}try{let G=Object.keys($),Q=Object.values($);return K0(Y,G)(...Q)}catch{return Q0(Y,$)}}catch(Y){if(Y instanceof ReferenceError){let J=/(\b\w+)\s+is not defined/.exec(Y.message);if(J){let G=J[1],Q=oK(G,Object.keys($));if(Q&&Q!==G)Y.message=`${Y.message} \u2014 did you mean '${Q}'?`}}if(!Z)console.error(`Error evaluating expression: ${X}`,Y);throw Y}}function oK(X,$){let Z=null;for(let J of $){if(J===X)continue;let G=aK(X,J);if(Z===null||G<Z.dist)Z={key:J,dist:G}}if(!Z)return null;let Y=Math.max(X.length,Z.key.length);if(Z.dist<=2||Z.dist/Y<=0.35)return Z.key;return null}function aK(X,$){if(X===$)return 0;if(X.length===0)return $.length;if($.length===0)return X.length;let[Z,Y]=X.length<$.length?[X,$]:[$,X],J=Array(Z.length+1),G=Array(Z.length+1);for(let Q=0;Q<=Z.length;Q++)J[Q]=Q;for(let Q=1;Q<=Y.length;Q++){G[0]=Q;for(let w=1;w<=Z.length;w++){let W=Z[w-1]===Y[Q-1]?0:1;G[w]=Math.min(G[w-1]+1,J[w]+1,J[w-1]+W)}for(let w=0;w<=Z.length;w++)J[w]=G[w]}return J[Z.length]}function tK(X){if(!X)return"";return X.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}var g7,HZ,h7,VZ="⁠";var U1=E(()=>{M0();H0();UZ();x1();g7={},HZ=new Map;h7={uppercase:(X,$)=>{return X!==void 0&&X!==null?String(X).toUpperCase():""},lowercase:(X,$)=>{return X!==void 0&&X!==null?String(X).toLowerCase():""},capitalize:(X,$)=>{if(X===void 0||X===null)return"";let Z=String(X);return Z.charAt(0).toUpperCase()+Z.slice(1)},number:(X,$,Z=0)=>{if(X===void 0||X===null)return"";try{let Y=Number(X);return Number.isNaN(Y)?"":Y.toFixed(Number.parseInt(String(Z),10))}catch{return""}},fmt:(X,$,Z="en-US")=>{if(X===void 0||X===null)return"";try{let Y=Number(X);if(Number.isNaN(Y))return String(X);return Y.toLocaleString(Z)}catch{return String(X)}},join:(X,$,Z=",")=>{if(!Array.isArray(X))return"";return X.join(String(Z))},escape:(X,$)=>{if(X===void 0||X===null)return"";return W9(String(X))},translate:(X,$,Z={})=>{if(!$||!$.__translations)return X;let Y=$.__translations,J=$.__i18nConfig?.fallbackToKey??!0,G=String(X).split("."),Q=Y;for(let W of G){if(Q===void 0||Q===null)break;Q=Q[W]}if(Q===void 0||Q===null)return J?X:"";let w=String(Q);return Object.entries(Z).forEach(([W,q])=>{w=w.replace(lK(W),String(q))}),w},t:(X,$,Z={})=>{return h7.translate(X,$,Z)},truncate:(X,$,Z=50,Y="...")=>{if(X===void 0||X===null)return"";let J=String(X);if(J.length<=Z)return J;if(Z<=Y.length)return Y.substring(0,Z);return J.substring(0,Z-Y.length)+Y},date:(X,$,Z="short",Y="en-US")=>{if(X===void 0||X===null)return"";try{let J=X instanceof Date?X:new Date(X);if(Number.isNaN(J.getTime()))return String(X);let G={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Z==="iso")return J.toISOString();return new Intl.DateTimeFormat(Y,G[Z]||G.short).format(J)}catch{return String(X)}},currency:(X,$,Z="USD",Y="en-US")=>{if(X===void 0||X===null)return"";try{let J=Number(X);if(Number.isNaN(J))return String(X);return new Intl.NumberFormat(Y,{style:"currency",currency:Z}).format(J)}catch{return String(X)}},pluralize:(X,$,Z,Y)=>{let J=Number(X);if(Number.isNaN(J))return Z;let G=Y||`${Z}s`;return J===1?Z:G},first:(X,$)=>{if(X===void 0||X===null)return"";if(Array.isArray(X))return X.length===0?"":X[0];return String(X).charAt(0)},last:(X,$)=>{if(X===void 0||X===null)return"";if(Array.isArray(X))return X.length===0?"":X[X.length-1];let Z=String(X);return Z.charAt(Z.length-1)},length:(X,$)=>{if(X===void 0||X===null)return 0;if(Array.isArray(X)||typeof X==="string")return X.length;if(X instanceof Map||X instanceof Set)return X.size;if(typeof X==="object")return Object.keys(X).length;return 0},json:(X,$,Z=!1)=>{if(X===void 0)return"undefined";if(X===null)return"null";try{return Z?JSON.stringify(X,null,2):JSON.stringify(X)}catch{return String(X)}},default:(X,$,Z="")=>{return X===void 0||X===null||X===""?Z:X},reverse:(X,$)=>{if(X===void 0||X===null)return"";if(Array.isArray(X))return[...X].reverse();return String(X).split("").reverse().join("")},slice:(X,$,Z=0,Y)=>{if(X===void 0||X===null)return"";if(Array.isArray(X)||typeof X==="string")return X.slice(Z,Y);return X},replace:(X,$,Z,Y="")=>{if(X===void 0||X===null)return"";let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(X).replace(new RegExp(J,"g"),()=>Y)},stripTags:(X,$)=>{if(X===void 0||X===null)return"";return String(X).replace(/<[^>]*>/g,"")},urlencode:(X,$)=>{if(X===void 0||X===null)return"";return encodeURIComponent(String(X))},abs:(X,$)=>{let Z=Number(X);return Number.isNaN(Z)?0:Math.abs(Z)},round:(X,$,Z=0)=>{let Y=Number(X);if(Number.isNaN(Y))return 0;let J=10**Z;return Math.round(Y*J)/J}}});class W5{cache=new Map;maxSize;constructor(X=100){this.maxSize=X}get(X){if(!this.cache.has(X))return;let $=this.cache.get(X);return this.cache.delete(X),this.cache.set(X,$),$}set(X,$){if(this.cache.has(X))this.cache.delete(X);else if(this.cache.size>=this.maxSize){let Z=this.cache.keys().next().value;if(Z!==void 0)this.cache.delete(Z)}this.cache.set(X,$)}has(X){return this.cache.has(X)}delete(X){return this.cache.delete(X)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function f5(X,$){if($?.includes("g"))return new RegExp(X,$);let Z=`${X}:${$||""}`;if(!x5.has(Z)){if(x5.size>=eK){let Y=x5.keys().next().value;if(Y)x5.delete(Y)}x5.set(Z,new RegExp(X,$))}return x5.get(Z)}class TZ{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(X){let $=Array.from(new Set(X)),Z=$.sort().join(","),Y=this.pool.find((w)=>w.context.join(",")===Z);if(Y)return Y.func;let J=this.fnCache,G=this.fnCacheMaxSize,Q=(...w)=>{return(W)=>{try{let q=`${Z}:${W}`,U=J.get(q);if(!U){if(J.size>=G){let K=J.keys().next().value;if(K)J.delete(K)}U=Function(...$,`
|
|
2532
2532
|
'use strict';
|
|
2533
2533
|
try {
|
|
2534
2534
|
return ${W};
|
|
@@ -2539,15 +2539,15 @@ catch (e) {
|
|
|
2539
2539
|
}
|
|
2540
2540
|
throw e;
|
|
2541
2541
|
}
|
|
2542
|
-
`),J.set(q,U)}return U(...w)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:Q,context:$.slice()});return Q}clear(){this.pool.length=0,this.fnCache.clear()}}class NZ{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(X){this.enabled=X}isEnabled(){return this.enabled}setBudget(X,$){this.budgets.set(X,{warnThreshold:0.8,action:"warn",...$})}setBudgets(X){for(let[$,Z]of Object.entries(X))this.setBudget($,Z)}removeBudget(X){this.budgets.delete(X)}getBudgets(){let X={};for(let[$,Z]of this.budgets.entries())X[$]=Z;return X}onViolation(X){this.violationHandlers.push(X)}offViolation(X){let $=this.violationHandlers.indexOf(X);if($!==-1)this.violationHandlers.splice($,1)}time(X,$){if(!this.enabled)return $();let Z=performance.now(),Y=$(),J=performance.now()-Z;return this.recordTime(X,J),this.checkBudget(X,J),Y}async timeAsync(X,$){if(!this.enabled)return $();let Z=performance.now(),Y=await $(),J=performance.now()-Z;return this.recordTime(X,J),this.checkBudget(X,J),Y}checkBudget(X,$){let Z=this.budgets.get(X);if(!Z)return;let Y=$/Z.maxTime*100,J=Z.warnThreshold!==void 0?$>=Z.maxTime*Z.warnThreshold&&$<Z.maxTime:!1,G=$>=Z.maxTime;if(!J&&!G)return;let Q={label:X,actualTime:$,budgetTime:Z.maxTime,exceedancePercent:Y,timestamp:new Date,isWarning:J};this.violations.push(Q);while(this.violations.length>this.maxViolations)this.violations.shift();for(let W of this.violationHandlers)try{W(Q)}catch{}let w=J?`[Performance Warning] "${X}" took ${$.toFixed(2)}ms (${Y.toFixed(1)}% of ${Z.maxTime}ms budget)`:`[Performance Budget Exceeded] "${X}" took ${$.toFixed(2)}ms (exceeded ${Z.maxTime}ms budget by ${(Y-100).toFixed(1)}%)`;switch(Z.action){case"log":console.log(w);break;case"warn":console.warn(w);break;case"error":console.error(w);break;case"throw":if(G)throw Error(w);else console.warn(w);break}}recordTime(X,$){let Z=this.metrics.get(X);if(Z)Z.count++,Z.totalTime+=$,Z.maxTime=Math.max(Z.maxTime,$),Z.minTime=Math.min(Z.minTime,$);else this.metrics.set(X,{count:1,totalTime:$,maxTime:$,minTime:$})}getStats(X){if(X){let Z=this.metrics.get(X);if(!Z)return{};let Y=this.budgets.get(X);return{count:Z.count,avgTime:Z.totalTime/Z.count,totalTime:Z.totalTime,maxTime:Z.maxTime,minTime:Z.minTime,budget:Y?.maxTime,budgetUtilization:Y?Z.totalTime/Z.count/Y.maxTime*100:void 0}}let $={};for(let[Z,Y]of this.metrics.entries()){let J=this.budgets.get(Z);$[Z]={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}}return $}getViolations(X){if(X)return this.violations.filter(($)=>$.label===X);return[...this.violations]}getViolationStats(){let X={},$=0,Z=0;for(let Y of this.violations)if(X[Y.label]=(X[Y.label]||0)+1,Y.isWarning)$++;else Z++;return{total:this.violations.length,byLabel:X,warnings:$,errors:Z}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function Xz(){if(!q9)q9=new NZ;return q9}var
|
|
2543
|
-
`)}var IZ;var yZ=E(()=>{IZ={fg:{light:"gray-900",dark:"gray-100",description:"Primary text"},"fg-strong":{light:"gray-700",dark:"gray-300",description:"Labels, secondary headings"},"fg-muted":{light:"gray-600",dark:"gray-400",description:"Supporting text"},"fg-soft":{light:"gray-500",dark:"gray-400",description:"De-emphasised text"},"fg-subtle":{light:"gray-400",dark:"gray-500",description:"Placeholders, disabled text"},surface:{light:"gray-50",dark:"gray-800",description:"Page and panel background"},"surface-raised":{light:"gray-100",dark:"gray-700",description:"Cards, popovers"},"surface-sunken":{light:"gray-200",dark:"gray-700",description:"Wells, track backgrounds"},line:{light:"gray-200",dark:"gray-700",description:"Default border, divider"},"line-strong":{light:"gray-300",dark:"gray-600",description:"Input border, focus ring track"},accent:{light:"indigo-600",dark:"indigo-400",description:"Primary action, selected state"},info:{light:"blue-600",dark:"blue-400",description:"Informational emphasis, links"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-500",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"indigo-600",dark:"indigo-500",description:"Primary button fill"},"info-solid":{light:"blue-600",dark:"blue-500",description:"Informational fill"},"danger-solid":{light:"red-600",dark:"red-500",description:"Destructive button fill"},"success-solid":{light:"green-600",dark:"green-500",description:"Confirmation fill"}}});function bZ(X){return typeof X==="object"&&X!==null&&!Array.isArray(X)}function z9(X,$){let Z={...X};for(let[Y,J]of Object.entries($))Z[Y]=bZ(J)&&bZ(Z[Y])?z9(Z[Y],J):J;return Z}function SZ(X={},$={}){let Z=X.theme||{},Y=$.theme||{},{extend:J,...G}=Y,{extend:Q,...w}=Z,W=w.colors||{};w.colors={...W,...EZ(W)};let q=z9(w,G),U=z9(Q||{},J||{});if(Object.keys(U).length>0)q.extend=U;let K=[...X.safelist||[],...$.safelist||[]],z={...X.shortcuts||{},...$.shortcuts||{}},j=[...X.preflights||[],...$.preflights||[]];return{config:{...X,...$,theme:q,safelist:K,shortcuts:z,...j.length>0?{preflights:j}:{},content:[],output:""},safelist:K,shortcuts:z,includePreflight:$.preflight!==!1,minify:$.minify===!0,tokenCSS:DZ(W)}}var CZ=E(()=>{yZ()});var O0;var PZ=E(()=>{O0={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}});var mZ={};e(mZ,{resolveUserCrosswindConfig:()=>fZ,resetCssCache:()=>Wz,resetCrosswindCache:()=>qz,rebuildCrosswindCSS:()=>Uz,loadCrosswindConfig:()=>L9,loadCrosswind:()=>H9,injectCrosswindCSS:()=>O9,getCrosswindServeAsset:()=>Yz,getCachedCSS:()=>Kz,generateCrosswindCSS:()=>dZ,fingerprintConfig:()=>gZ,extractClassNames:()=>uZ,buildCrosswindCSS:()=>hZ});import w0 from"path";import{hasLocalConfig as $z}from"bunfig";function hX(X){return Bun.hash(X).toString(16).padStart(16,"0").slice(0,16)}function B9(X,$){if(M1.has(X))M1.delete(X);else if(M1.size>=xZ)M1.delete(M1.keys().next().value);M1.set(X,$)}function Zz(X){let $=hX(X);if(Y1.has($))Y1.delete($);else if(Y1.size>=xZ)Y1.delete(Y1.keys().next().value);return Y1.set($,X),$}function Yz(X){let $=Y1.get(X);if($===void 0)return;return Y1.delete(X),Y1.set(X,$),$}async function Jz(X){if(!x1)return null;try{let $=Bun.file(w0.join(x1,`cw-${hX(X)}.css`));if(!await $.exists())return null;return await $.text()}catch{return null}}async function Gz(X,$){if(!x1)return;try{if(!fs.existsSync(x1))fs.mkdirSync(x1,{recursive:!0});await Bun.write(w0.join(x1,`cw-${hX(X)}.css`),$)}catch{}}async function vZ(X){try{let $=await import(X);if($&&$.CSSGenerator)return{CSSGenerator:$.CSSGenerator,config:$.config,build:$.build,defaultConfig:$.defaultConfig,extractClasses:$.extractClasses}}catch{}return null}function Qz(){let X=[],$=process.cwd();while($!==w0.dirname($))X.push(w0.join($,"node_modules","@cwcss","crosswind","dist","index.js")),X.push(w0.join($,"node_modules","@cwcss","crosswind","src","index.ts")),X.push(w0.join($,"pantry","@cwcss","crosswind","dist","index.js")),X.push(w0.join($,"pantry","@cwcss","crosswind","src","index.ts")),X.push(w0.join($,"node_modules","@stacksjs","crosswind","dist","index.js")),X.push(w0.join($,"pantry","@stacksjs","crosswind","dist","index.js")),$=w0.dirname($);return X}function wz(){let X=[],$=process.env.HOME||process.env.USERPROFILE||"";if($){let Z=[w0.join($,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),w0.join($,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),w0.join($,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),w0.join($,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),w0.join($,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),w0.join($,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];X.push(...Z)}return X.push(w0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),X.push(w0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),X}async function H9(){if(j9)return z1;j9=!0;try{let X=async(J)=>{for(let G of J){if(!await Bun.file(G).exists())continue;let Q=await vZ(G);if(Q){if(!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} CSS engine loaded from ${w0.dirname(w0.dirname(G))}`);return Q}}return null};if(process.env.CROSSWIND_SRC){let J=w0.resolve(process.env.CROSSWIND_SRC),G=await X([J]);if(!G)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${J}`);return z1=G,z1}let $=await X(Qz());if($)return z1=$,z1;let Z=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let J of Z){let G=await vZ(J);if(G){if(z1=G,!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} CSS engine loaded`);return z1}}let Y=await X(wz());if(Y)return z1=Y,z1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${O0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${O0.reset}`),console.warn(`${O0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${O0.reset}`),null}}function Wz(){M1.clear(),Y1.clear()}function qz(){z1=null,j9=!1,J1=null,u7="",M1.clear(),Y1.clear(),_9=null}async function L9(X){try{if(!$z({name:"crosswind",cwd:X}))return null;let{loadConfigWithResult:$}=await import("bunfig"),Z=await $({name:"crosswind",cwd:X,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Z?.path||!Z.config||Object.keys(Z.config).length===0)return null;let Y=w0.relative(X,Z.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} Loaded config from ${Y||Z.path}`);return Z.config}catch($){if($ instanceof Error&&$.name==="ConfigNotFoundError")return null;return console.warn(`${O0.yellow}[Crosswind]${O0.reset} Failed to load crosswind config:`,$ instanceof Error?$.message:$),null}}async function fZ(X){let $=null;try{let{loadStxConfig:Z}=await Promise.resolve().then(() => (A1(),lZ)),Y=await Z(X);if(Y.css)if(typeof Y.css==="string"){let J=w0.isAbsolute(Y.css)?Y.css:w0.resolve(X,Y.css);if(await Bun.file(J).exists()){let G=await import(J);$=G.default||G,console.log(`${O0.green}[Crosswind]${O0.reset} Loaded config from stx.config.ts \u2192 ${Y.css}`)}}else{if($={...Y.css,content:Y.css.content||[],preflight:Y.css.preflight??!0,minify:Y.css.minify??!1},Y.css.config){let J=w0.isAbsolute(Y.css.config)?Y.css.config:w0.resolve(X,Y.css.config);if(await Bun.file(J).exists()){let G=await import(J);$={...G.default||G,...$}}}console.log(`${O0.green}[Crosswind]${O0.reset} Using inline CSS config from stx.config.ts`)}}catch{}return $||await L9(X)}function gZ(X){try{let $=new WeakSet;return hX(JSON.stringify(X??{},(Z,Y)=>{if(typeof Y==="function")return`[fn]${String(Y)}`;if(typeof Y==="object"&&Y!==null){if($.has(Y))return"[circular]";$.add(Y)}return Y})??"")}catch{return"unhashable"}}async function hZ(X){if(u5)return u7;u5=!0;try{let $=await H9();if(!$||!$.build)return u5=!1,"";if(!J1)J1=await L9(X);if(!J1)return u5=!1,"";let Z=$.defaultConfig?.theme||{},Y=J1.theme||{},J={...$.defaultConfig,...J1,theme:{...Z,...Y,extend:{...Z.extend||{},...Y.extend||{}}}},G=performance.now(),Q=await $.build(J),w=performance.now()-G;if(u7=Q.css,console.log(`${O0.cyan}[Crosswind]${O0.reset} Built ${Q.classes.size} classes in ${w.toFixed(1)}ms`),J.output){let W=w0.isAbsolute(J.output)?J.output:w0.join(X,J.output),q=w0.dirname(W);if(!fs.existsSync(q))fs.mkdirSync(q,{recursive:!0});await Bun.write(W,Q.css)}return u5=!1,Q.css}catch($){return console.error(`${O0.red}[Crosswind]${O0.reset} Build error:`,$),u5=!1,u7}}async function Uz(X){J1=null,await hZ(X)}function Kz(){return u7}function uZ(X){let $=new Set,Z=/class\s*=\s*["']([^"']+)["']/gi,Y=Z.exec(X);while(Y!==null){for(let Q of Y[1].split(/\s+/))if(Q.trim())$.add(Q.trim());Y=Z.exec(X)}let J=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,G=J.exec(X);while(G!==null){let Q=G[1].match(/'([^']+)'/g);if(Q){for(let w of Q)for(let W of w.slice(1,-1).split(/\s+/))if(W.trim())$.add(W.trim())}G=J.exec(X)}return $}async function dZ(X,$){try{let Z=await H9();if(!Z)return"";let Y=typeof Z.extractClasses==="function"?Z.extractClasses(X):uZ(X);if(Y.size===0)return"";let J=$?w0.resolve($):process.cwd();if(!x1)x1=b7(J,"cache");let G=[...Y].sort().join(" "),Q=`${_9||"default"}::${G}`,w=M1.get(Q);if(w!==void 0)return B9(Q,w),w;let W=await Jz(Q);if(W!==null)return B9(Q,W),W;if(!J1)J1=await fZ(J),_9=gZ(J1);let q=Z.defaultConfig||Z.config,U=J1||{},K=SZ(q,U),{safelist:z,includePreflight:j,minify:B,tokenCSS:_}=K,H=K.config,O=new Z.CSSGenerator(H);for(let A of z)O.generate(A);for(let A of Y)O.generate(A);let L=O.toCSS(j,B),F=H.shortcuts||U.shortcuts||{};for(let[A,R]of Object.entries(F)){if(!Y.has(A)&&!z.includes(A))continue;let M=R.split(/\s+/).filter(Boolean);for(let T of M)O.generate(T)}L=O.toCSS(j,B);let V=L.split(`
|
|
2544
|
-
`);for(let[A,R]of Object.entries(F)){if(!Y.has(A)&&!z.includes(A))continue;let M=R.split(/\s+/).filter(Boolean),T=[],k=[];for(let I of M){let D=I.startsWith("dark:"),b=`.${(D?I.slice(5):I).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let y=0;y<V.length;y++){let P=V[y].trim();if(P===`${b} {`||P.startsWith(`${b} {`)){let
|
|
2542
|
+
`),J.set(q,U)}return U(...w)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:Q,context:$.slice()});return Q}clear(){this.pool.length=0,this.fnCache.clear()}}class NZ{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(X){this.enabled=X}isEnabled(){return this.enabled}setBudget(X,$){this.budgets.set(X,{warnThreshold:0.8,action:"warn",...$})}setBudgets(X){for(let[$,Z]of Object.entries(X))this.setBudget($,Z)}removeBudget(X){this.budgets.delete(X)}getBudgets(){let X={};for(let[$,Z]of this.budgets.entries())X[$]=Z;return X}onViolation(X){this.violationHandlers.push(X)}offViolation(X){let $=this.violationHandlers.indexOf(X);if($!==-1)this.violationHandlers.splice($,1)}time(X,$){if(!this.enabled)return $();let Z=performance.now(),Y=$(),J=performance.now()-Z;return this.recordTime(X,J),this.checkBudget(X,J),Y}async timeAsync(X,$){if(!this.enabled)return $();let Z=performance.now(),Y=await $(),J=performance.now()-Z;return this.recordTime(X,J),this.checkBudget(X,J),Y}checkBudget(X,$){let Z=this.budgets.get(X);if(!Z)return;let Y=$/Z.maxTime*100,J=Z.warnThreshold!==void 0?$>=Z.maxTime*Z.warnThreshold&&$<Z.maxTime:!1,G=$>=Z.maxTime;if(!J&&!G)return;let Q={label:X,actualTime:$,budgetTime:Z.maxTime,exceedancePercent:Y,timestamp:new Date,isWarning:J};this.violations.push(Q);while(this.violations.length>this.maxViolations)this.violations.shift();for(let W of this.violationHandlers)try{W(Q)}catch{}let w=J?`[Performance Warning] "${X}" took ${$.toFixed(2)}ms (${Y.toFixed(1)}% of ${Z.maxTime}ms budget)`:`[Performance Budget Exceeded] "${X}" took ${$.toFixed(2)}ms (exceeded ${Z.maxTime}ms budget by ${(Y-100).toFixed(1)}%)`;switch(Z.action){case"log":console.log(w);break;case"warn":console.warn(w);break;case"error":console.error(w);break;case"throw":if(G)throw Error(w);else console.warn(w);break}}recordTime(X,$){let Z=this.metrics.get(X);if(Z)Z.count++,Z.totalTime+=$,Z.maxTime=Math.max(Z.maxTime,$),Z.minTime=Math.min(Z.minTime,$);else this.metrics.set(X,{count:1,totalTime:$,maxTime:$,minTime:$})}getStats(X){if(X){let Z=this.metrics.get(X);if(!Z)return{};let Y=this.budgets.get(X);return{count:Z.count,avgTime:Z.totalTime/Z.count,totalTime:Z.totalTime,maxTime:Z.maxTime,minTime:Z.minTime,budget:Y?.maxTime,budgetUtilization:Y?Z.totalTime/Z.count/Y.maxTime*100:void 0}}let $={};for(let[Z,Y]of this.metrics.entries()){let J=this.budgets.get(Z);$[Z]={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}}return $}getViolations(X){if(X)return this.violations.filter(($)=>$.label===X);return[...this.violations]}getViolationStats(){let X={},$=0,Z=0;for(let Y of this.violations)if(X[Y.label]=(X[Y.label]||0)+1,Y.isWarning)$++;else Z++;return{total:this.violations.length,byLabel:X,warnings:$,errors:Z}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function Xz(){if(!q9)q9=new NZ;return q9}var x5,eK=500,PR,q9=null,kZ;var g5=E(()=>{x5=new Map;PR=new TZ;kZ=new Proxy({},{get(X,$){return Xz()[$]}})});function U9(X){return`--stx-${X}`}function K9(X,$){let Z=$.lastIndexOf("-");if(Z===-1)return typeof X[$]==="string"?X[$]:void 0;let Y=X[$.slice(0,Z)];if(!Y||typeof Y!=="object")return;let J=Y[$.slice(Z+1)];return typeof J==="string"?J:void 0}function EZ(X){let $={};for(let[Z,Y]of Object.entries(IZ)){let J=K9(X,Y.light);if(J===void 0)continue;$[Z]=`var(${U9(Z)}, ${J})`}return $}function DZ(X){let $=[],Z=[];for(let[Y,J]of Object.entries(IZ)){let G=K9(X,J.light),Q=K9(X,J.dark);if(G===void 0)continue;if($.push(` ${U9(Y)}: ${G};`),Q!==void 0)Z.push(` ${U9(Y)}: ${Q};`)}if($.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...$,"}",".dark {",...Z,"}",""].join(`
|
|
2543
|
+
`)}var IZ;var yZ=E(()=>{IZ={fg:{light:"gray-900",dark:"gray-100",description:"Primary text"},"fg-strong":{light:"gray-700",dark:"gray-300",description:"Labels, secondary headings"},"fg-muted":{light:"gray-600",dark:"gray-400",description:"Supporting text"},"fg-soft":{light:"gray-500",dark:"gray-400",description:"De-emphasised text"},"fg-subtle":{light:"gray-400",dark:"gray-500",description:"Placeholders, disabled text"},surface:{light:"gray-50",dark:"gray-800",description:"Page and panel background"},"surface-raised":{light:"gray-100",dark:"gray-700",description:"Cards, popovers"},"surface-sunken":{light:"gray-200",dark:"gray-700",description:"Wells, track backgrounds"},line:{light:"gray-200",dark:"gray-700",description:"Default border, divider"},"line-strong":{light:"gray-300",dark:"gray-600",description:"Input border, focus ring track"},accent:{light:"indigo-600",dark:"indigo-400",description:"Primary action, selected state"},info:{light:"blue-600",dark:"blue-400",description:"Informational emphasis, links"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-500",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"indigo-600",dark:"indigo-500",description:"Primary button fill"},"info-solid":{light:"blue-600",dark:"blue-500",description:"Informational fill"},"danger-solid":{light:"red-600",dark:"red-500",description:"Destructive button fill"},"success-solid":{light:"green-600",dark:"green-500",description:"Confirmation fill"}}});function bZ(X){return typeof X==="object"&&X!==null&&!Array.isArray(X)}function z9(X,$){let Z={...X};for(let[Y,J]of Object.entries($))Z[Y]=bZ(J)&&bZ(Z[Y])?z9(Z[Y],J):J;return Z}function SZ(X={},$={}){let Z=X.theme||{},Y=$.theme||{},{extend:J,...G}=Y,{extend:Q,...w}=Z,W=w.colors||{};w.colors={...W,...EZ(W)};let q=z9(w,G),U=z9(Q||{},J||{});if(Object.keys(U).length>0)q.extend=U;let K=[...X.safelist||[],...$.safelist||[]],z={...X.shortcuts||{},...$.shortcuts||{}},j=[...X.preflights||[],...$.preflights||[]];return{config:{...X,...$,theme:q,safelist:K,shortcuts:z,...j.length>0?{preflights:j}:{},content:[],output:""},safelist:K,shortcuts:z,includePreflight:$.preflight!==!1,minify:$.minify===!0,tokenCSS:DZ(W)}}var CZ=E(()=>{yZ()});var L0;var PZ=E(()=>{L0={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}});var mZ={};a(mZ,{resolveUserCrosswindConfig:()=>fZ,resetCssCache:()=>Wz,resetCrosswindCache:()=>qz,rebuildCrosswindCSS:()=>Uz,loadCrosswindConfig:()=>L9,loadCrosswind:()=>H9,injectCrosswindCSS:()=>O9,getCrosswindServeAsset:()=>Yz,getCachedCSS:()=>Kz,generateCrosswindCSS:()=>dZ,fingerprintConfig:()=>gZ,extractClassNames:()=>uZ,buildCrosswindCSS:()=>hZ});import w0 from"path";import{hasLocalConfig as $z}from"bunfig";function hX(X){return Bun.hash(X).toString(16).padStart(16,"0").slice(0,16)}function B9(X,$){if(M1.has(X))M1.delete(X);else if(M1.size>=xZ)M1.delete(M1.keys().next().value);M1.set(X,$)}function Zz(X){let $=hX(X);if(Y1.has($))Y1.delete($);else if(Y1.size>=xZ)Y1.delete(Y1.keys().next().value);return Y1.set($,X),$}function Yz(X){let $=Y1.get(X);if($===void 0)return;return Y1.delete(X),Y1.set(X,$),$}async function Jz(X){if(!g1)return null;try{let $=Bun.file(w0.join(g1,`cw-${hX(X)}.css`));if(!await $.exists())return null;return await $.text()}catch{return null}}async function Gz(X,$){if(!g1)return;try{if(!fs.existsSync(g1))fs.mkdirSync(g1,{recursive:!0});await Bun.write(w0.join(g1,`cw-${hX(X)}.css`),$)}catch{}}async function vZ(X){try{let $=await import(X);if($&&$.CSSGenerator)return{CSSGenerator:$.CSSGenerator,config:$.config,build:$.build,defaultConfig:$.defaultConfig,extractClasses:$.extractClasses}}catch{}return null}function Qz(){let X=[],$=process.cwd();while($!==w0.dirname($))X.push(w0.join($,"node_modules","@cwcss","crosswind","dist","index.js")),X.push(w0.join($,"node_modules","@cwcss","crosswind","src","index.ts")),X.push(w0.join($,"pantry","@cwcss","crosswind","dist","index.js")),X.push(w0.join($,"pantry","@cwcss","crosswind","src","index.ts")),X.push(w0.join($,"node_modules","@stacksjs","crosswind","dist","index.js")),X.push(w0.join($,"pantry","@stacksjs","crosswind","dist","index.js")),$=w0.dirname($);return X}function wz(){let X=[],$=process.env.HOME||process.env.USERPROFILE||"";if($){let Z=[w0.join($,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),w0.join($,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),w0.join($,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),w0.join($,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),w0.join($,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),w0.join($,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];X.push(...Z)}return X.push(w0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),X.push(w0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),X}async function H9(){if(j9)return K1;j9=!0;try{let X=async(J)=>{for(let G of J){if(!await Bun.file(G).exists())continue;let Q=await vZ(G);if(Q){if(!process.env.STACKS_DEV_QUIET)console.log(`${L0.green}[Crosswind]${L0.reset} CSS engine loaded from ${w0.dirname(w0.dirname(G))}`);return Q}}return null};if(process.env.CROSSWIND_SRC){let J=w0.resolve(process.env.CROSSWIND_SRC),G=await X([J]);if(!G)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${J}`);return K1=G,K1}let $=await X(Qz());if($)return K1=$,K1;let Z=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let J of Z){let G=await vZ(J);if(G){if(K1=G,!process.env.STACKS_DEV_QUIET)console.log(`${L0.green}[Crosswind]${L0.reset} CSS engine loaded`);return K1}}let Y=await X(wz());if(Y)return K1=Y,K1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${L0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${L0.reset}`),console.warn(`${L0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${L0.reset}`),null}}function Wz(){M1.clear(),Y1.clear()}function qz(){K1=null,j9=!1,J1=null,u7="",M1.clear(),Y1.clear(),_9=null}async function L9(X){try{if(!$z({name:"crosswind",cwd:X}))return null;let{loadConfigWithResult:$}=await import("bunfig"),Z=await $({name:"crosswind",cwd:X,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Z?.path||!Z.config||Object.keys(Z.config).length===0)return null;let Y=w0.relative(X,Z.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${L0.green}[Crosswind]${L0.reset} Loaded config from ${Y||Z.path}`);return Z.config}catch($){if($ instanceof Error&&$.name==="ConfigNotFoundError")return null;return console.warn(`${L0.yellow}[Crosswind]${L0.reset} Failed to load crosswind config:`,$ instanceof Error?$.message:$),null}}async function fZ(X){let $=null;try{let{loadStxConfig:Z}=await Promise.resolve().then(() => (A1(),lZ)),Y=await Z(X);if(Y.css)if(typeof Y.css==="string"){let J=w0.isAbsolute(Y.css)?Y.css:w0.resolve(X,Y.css);if(await Bun.file(J).exists()){let G=await import(J);$=G.default||G,console.log(`${L0.green}[Crosswind]${L0.reset} Loaded config from stx.config.ts \u2192 ${Y.css}`)}}else{if($={...Y.css,content:Y.css.content||[],preflight:Y.css.preflight??!0,minify:Y.css.minify??!1},Y.css.config){let J=w0.isAbsolute(Y.css.config)?Y.css.config:w0.resolve(X,Y.css.config);if(await Bun.file(J).exists()){let G=await import(J);$={...G.default||G,...$}}}console.log(`${L0.green}[Crosswind]${L0.reset} Using inline CSS config from stx.config.ts`)}}catch{}return $||await L9(X)}function gZ(X){try{let $=new WeakSet;return hX(JSON.stringify(X??{},(Z,Y)=>{if(typeof Y==="function")return`[fn]${String(Y)}`;if(typeof Y==="object"&&Y!==null){if($.has(Y))return"[circular]";$.add(Y)}return Y})??"")}catch{return"unhashable"}}async function hZ(X){if(h5)return u7;h5=!0;try{let $=await H9();if(!$||!$.build)return h5=!1,"";if(!J1)J1=await L9(X);if(!J1)return h5=!1,"";let Z=$.defaultConfig?.theme||{},Y=J1.theme||{},J={...$.defaultConfig,...J1,theme:{...Z,...Y,extend:{...Z.extend||{},...Y.extend||{}}}},G=performance.now(),Q=await $.build(J),w=performance.now()-G;if(u7=Q.css,console.log(`${L0.cyan}[Crosswind]${L0.reset} Built ${Q.classes.size} classes in ${w.toFixed(1)}ms`),J.output){let W=w0.isAbsolute(J.output)?J.output:w0.join(X,J.output),q=w0.dirname(W);if(!fs.existsSync(q))fs.mkdirSync(q,{recursive:!0});await Bun.write(W,Q.css)}return h5=!1,Q.css}catch($){return console.error(`${L0.red}[Crosswind]${L0.reset} Build error:`,$),h5=!1,u7}}async function Uz(X){J1=null,await hZ(X)}function Kz(){return u7}function uZ(X){let $=new Set,Z=/class\s*=\s*["']([^"']+)["']/gi,Y=Z.exec(X);while(Y!==null){for(let Q of Y[1].split(/\s+/))if(Q.trim())$.add(Q.trim());Y=Z.exec(X)}let J=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,G=J.exec(X);while(G!==null){let Q=G[1].match(/'([^']+)'/g);if(Q){for(let w of Q)for(let W of w.slice(1,-1).split(/\s+/))if(W.trim())$.add(W.trim())}G=J.exec(X)}return $}async function dZ(X,$){try{let Z=await H9();if(!Z)return"";let Y=typeof Z.extractClasses==="function"?Z.extractClasses(X):uZ(X);if(Y.size===0)return"";let J=$?w0.resolve($):process.cwd();if(!g1)g1=b7(J,"cache");let G=[...Y].sort().join(" "),Q=`${_9||"default"}::${G}`,w=M1.get(Q);if(w!==void 0)return B9(Q,w),w;let W=await Jz(Q);if(W!==null)return B9(Q,W),W;if(!J1)J1=await fZ(J),_9=gZ(J1);let q=Z.defaultConfig||Z.config,U=J1||{},K=SZ(q,U),{safelist:z,includePreflight:j,minify:B,tokenCSS:_}=K,H=K.config,O=new Z.CSSGenerator(H);for(let A of z)O.generate(A);for(let A of Y)O.generate(A);let L=O.toCSS(j,B),F=H.shortcuts||U.shortcuts||{};for(let[A,R]of Object.entries(F)){if(!Y.has(A)&&!z.includes(A))continue;let M=R.split(/\s+/).filter(Boolean);for(let T of M)O.generate(T)}L=O.toCSS(j,B);let V=L.split(`
|
|
2544
|
+
`);for(let[A,R]of Object.entries(F)){if(!Y.has(A)&&!z.includes(A))continue;let M=R.split(/\s+/).filter(Boolean),T=[],k=[];for(let I of M){let D=I.startsWith("dark:"),b=`.${(D?I.slice(5):I).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let y=0;y<V.length;y++){let P=V[y].trim();if(P===`${b} {`||P.startsWith(`${b} {`)){let f=y,g="";while(f<V.length){if(g+=V[f],V[f].includes("}"))break;f++}let p=g.match(/\{([^}]+)\}/);if(p)if(D)k.push(p[1].trim());else T.push(p[1].trim());break}}}if(T.length)L+=`
|
|
2545
2545
|
.${A} { ${T.join(" ")} }`;if(k.length)L+=`
|
|
2546
2546
|
@media (prefers-color-scheme: dark) { .dark .${A} { ${k.join(" ")} } }`}return L=_+L,B9(Q,L),Gz(Q,L),L}catch(Z){return console.warn("Failed to generate Crosswind CSS:",Z),""}}async function O9(X,$,Z=!1){let Y=await dZ(X,$);if(!Y)return X;let J=Z?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${Zz(Y)}.css">`:`<style data-crosswind="generated">
|
|
2547
2547
|
${Y}
|
|
2548
2548
|
</style>`,G=/(?:<style\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>)/g;if(G.test(X)){let Q=!1;return X.replace(G,()=>{if(Q)return"";return Q=!0,J})}if(X.includes("</head>"))return X.replace("</head>",`${J}
|
|
2549
2549
|
</head>`);if(X.includes("<body"))return X.replace(/<body([^>]*)>/,`<body$1>
|
|
2550
|
-
${J}`);return J+X}var
|
|
2550
|
+
${J}`);return J+X}var K1=null,j9=!1,J1=null,u7="",h5=!1,xZ=256,M1,Y1,g1=null,_9=null;var F9=E(()=>{CZ();EX();PZ();M1=new Map,Y1=new Map});function d7(X){let $=0,Z,Y=V9.map(()=>{return});while($<X.length){if(Z===void 0||Z!==null&&Z.index<$)cZ.lastIndex=$,Z=cZ.exec(X);if(!Z)return null;let J=Z.index,G=-1,Q=null;for(let W=0;W<V9.length;W++){let q=V9[W],U=Y[W];if(U===void 0||U!==null&&U.index<$)q.open.lastIndex=$,U=q.open.exec(X),Y[W]=U;if(!U)continue;if(U.index<J&&(G===-1||U.index<G))G=U.index,Q=q.close}if(G===-1||!Q)return{index:J,tag:Z[0],attrs:Z[1]??""};Q.lastIndex=G;let w=Q.exec(X);if(!w)return null;$=w.index+w[0].length}return null}function uX(X,$){let Z=d7(X);if(!Z)return X;return X.slice(0,Z.index)+$(Z.tag,Z.attrs)+X.slice(Z.index+Z.tag.length)}var V9,cZ;var A9=E(()=>{V9=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],cZ=/<body\b([^>]*)>/gi});function pZ(){return`
|
|
2551
2551
|
// STX Lifecycle Runtime
|
|
2552
2552
|
(function() {
|
|
2553
2553
|
if (typeof window === 'undefined') return;
|
|
@@ -3050,10 +3050,10 @@ else {
|
|
|
3050
3050
|
}
|
|
3051
3051
|
})();
|
|
3052
3052
|
</script>
|
|
3053
|
-
`,Y}function sZ(X){let{html:$,bindings:Z,stores:Y}=jz(X);if(Z.length===0)return X;let J=_z(Z,Y),G=$.lastIndexOf("</body>");if(G!==-1)return $.slice(0,G)+J+$.slice(G);return $+J}var oZ=()=>{};function Hz(X){let $=X.analytics;if(!$?.enabled)return"";switch($.driver){case"fathom":return Lz($);case"google-analytics":return Oz($);case"plausible":return Fz($);case"self-hosted":return Vz($);case"custom":return Az($);default:return""}}function Lz(X){let $=X.fathom;if(!$?.siteId)return"";let Z=$.scriptUrl||"https://cdn.usefathom.com/script.js",Y=$.defer!==!1?" defer":"",J=[`data-site="${
|
|
3053
|
+
`,Y}function sZ(X){let{html:$,bindings:Z,stores:Y}=jz(X);if(Z.length===0)return X;let J=_z(Z,Y),G=$.lastIndexOf("</body>");if(G!==-1)return $.slice(0,G)+J+$.slice(G);return $+J}var oZ=()=>{};function Hz(X){let $=X.analytics;if(!$?.enabled)return"";switch($.driver){case"fathom":return Lz($);case"google-analytics":return Oz($);case"plausible":return Fz($);case"self-hosted":return Vz($);case"custom":return Az($);default:return""}}function Lz(X){let $=X.fathom;if(!$?.siteId)return"";let Z=$.scriptUrl||"https://cdn.usefathom.com/script.js",Y=$.defer!==!1?" defer":"",J=[`data-site="${i0($.siteId)}"`];if($.honorDnt)J.push('data-honor-dnt="true"');if($.spa)J.push('data-spa="auto"');if($.canonical)J.push(`data-canonical="${i0($.canonical)}"`);if($.auto===!1)J.push('data-auto="false"');return`
|
|
3054
3054
|
<!-- Fathom Analytics -->
|
|
3055
|
-
<script src="${
|
|
3056
|
-
`}function Oz(X){let $=X.googleAnalytics;if(!$?.measurementId)return"";let Z=
|
|
3055
|
+
<script src="${i0(Z)}" ${J.join(" ")}${Y}></script>
|
|
3056
|
+
`}function Oz(X){let $=X.googleAnalytics;if(!$?.measurementId)return"";let Z=i0($.measurementId),Y=$.debug?`gtag('config', '${Z}', { 'debug_mode': true });`:"";return`
|
|
3057
3057
|
<!-- Google Analytics -->
|
|
3058
3058
|
<script async src="https://www.googletagmanager.com/gtag/js?id=${Z}"></script>
|
|
3059
3059
|
<script>
|
|
@@ -3063,10 +3063,10 @@ else {
|
|
|
3063
3063
|
gtag('config', '${Z}');
|
|
3064
3064
|
${Y}
|
|
3065
3065
|
</script>
|
|
3066
|
-
`}function Fz(X){let $=X.plausible;if(!$?.domain)return"";let Z=$.scriptUrl||"https://plausible.io/js/script.js",Y=[`data-domain="${
|
|
3066
|
+
`}function Fz(X){let $=X.plausible;if(!$?.domain)return"";let Z=$.scriptUrl||"https://plausible.io/js/script.js",Y=[`data-domain="${i0($.domain)}"`],J=Z,G=[];if($.trackLocalhost)G.push("local");if($.hashMode)G.push("hash");if(G.length>0&&Z==="https://plausible.io/js/script.js")J=`https://plausible.io/js/script.${G.join(".")}.js`;return`
|
|
3067
3067
|
<!-- Plausible Analytics -->
|
|
3068
|
-
<script defer data-domain="${
|
|
3069
|
-
`}function Vz(X){let $=X.selfHosted;if(!$?.siteId||!$?.apiEndpoint)return"";let Z=
|
|
3068
|
+
<script defer data-domain="${i0($.domain)}" src="${i0(J)}"></script>
|
|
3069
|
+
`}function Vz(X){let $=X.selfHosted;if(!$?.siteId||!$?.apiEndpoint)return"";let Z=i0($.siteId),Y=i0($.apiEndpoint),J=$.honorDnt?'if(n.doNotTrack==="1")return;':"",G=$.trackHashChanges?"w.addEventListener('hashchange',pv);":"",Q=$.trackOutboundLinks?`
|
|
3070
3070
|
d.addEventListener('click',function(e){
|
|
3071
3071
|
var a=e.target.closest('a');
|
|
3072
3072
|
if(a&&a.hostname!==location.hostname){
|
|
@@ -3104,10 +3104,10 @@ else {
|
|
|
3104
3104
|
<script>
|
|
3105
3105
|
${$.inlineScript}
|
|
3106
3106
|
</script>
|
|
3107
|
-
`;if(!$.scriptUrl)return"";let Z=[];if($.scriptId)Z.push(`id="${
|
|
3107
|
+
`;if(!$.scriptUrl)return"";let Z=[];if($.scriptId)Z.push(`id="${i0($.scriptId)}"`);if($.attributes)for(let[J,G]of Object.entries($.attributes))Z.push(`${i0(J)}="${i0(G)}"`);return`
|
|
3108
3108
|
<!-- Custom Analytics -->
|
|
3109
|
-
<script${Z.length>0?` ${Z.join(" ")}`:""} src="${
|
|
3110
|
-
`}function aZ(X,$){let Z=Hz($);if(!Z)return X;if(!X.includes("</head>")){let Y=X.lastIndexOf("</body>");if(Y!==-1)return X.slice(0,Y)+Z+X.slice(Y);return X+Z}return X.replace("</head>",`${Z}</head>`)}function
|
|
3109
|
+
<script${Z.length>0?` ${Z.join(" ")}`:""} src="${i0($.scriptUrl)}" defer></script>
|
|
3110
|
+
`}function aZ(X,$){let Z=Hz($);if(!Z)return X;if(!X.includes("</head>")){let Y=X.lastIndexOf("</body>");if(Y!==-1)return X.slice(0,Y)+Z+X.slice(Y);return X+Z}return X.replace("</head>",`${Z}</head>`)}function i0(X){return X.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var tZ=()=>{};function eZ(X){let $=X.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!$)return null;try{return Function(`return ${$[1]}`)()}catch{return null}}function XY(X){let $=X?.layout;if($===!1)return!1;return typeof $==="string"&&$.trim()?$.trim():void 0}function $Y(X,$){let Z=X.match(new RegExp(`${$}\\s*=\\s*"([^"]*)"`,"i"));if(Z)return Z[1];let Y=X.match(new RegExp(`${$}\\s*=\\s*'([^']*)'`,"i"));if(Y)return Y[1];return null}function Tz(X){let $=[],Z=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,Y;while((Y=Z.exec(X))!==null){let[J,G,Q]=Y,w=Y.index,W=$Y(Q,"x-data");if(!W)continue;let q=`__stx_scope_${Rz++}`,U=$Y(Q,"x-init"),K=Nz(X,G,w+J.length),z=X.slice(w,K.endIndex),j=kz(z);$.push({id:q,selector:`[data-stx-scope="${q}"]`,stateExpr:W,initExpr:U,bindings:[],refs:j})}return $}function Nz(X,$,Z){let Y=1,J=Z,G=new RegExp(`<${$}(?:\\s|>)`,"gi"),Q=new RegExp(`</${$}>`,"gi"),w=new RegExp(`<${$}[^>]*/\\s*>`,"gi");while(Y>0&&J<X.length){G.lastIndex=J,Q.lastIndex=J,w.lastIndex=J;let W=G.exec(X),q=Q.exec(X),U=w.exec(X);if(U&&U.index<(W?.index??1/0)){J=U.index+U[0].length;continue}if(!q)return{endIndex:X.length};if(W&&W.index<q.index)Y++,J=W.index+W[0].length;else{if(Y--,Y===0)return{endIndex:q.index+q[0].length};J=q.index+q[0].length}}return{endIndex:X.length}}function kz(X){let $=new Map,Z=X.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),Y=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,J;while((J=Y.exec(Z))!==null){let[,G,Q]=J,w=Iz(G);$.set(Q,w)}return $}function Iz(X){let $=X.match(/\bid\s*=\s*["']([^"']*)["']/);if($)return $[1];return`__stx_el_${Mz++}`}function Ez(){return`
|
|
3111
3111
|
// STX Reactive Runtime - x-cloak and transition CSS
|
|
3112
3112
|
(function() {
|
|
3113
3113
|
var style = document.createElement('style');
|
|
@@ -3314,7 +3314,7 @@ window.__stx_reactive = (function() {
|
|
|
3314
3314
|
|
|
3315
3315
|
return { initScope: initScope, reactive: reactive };
|
|
3316
3316
|
})();
|
|
3317
|
-
`}function ZY(X,$){let Z=X.replace(/\{!!([\s\S]*?)!!\}/g,(w,W)=>{try{let q=
|
|
3317
|
+
`}function ZY(X,$){let Z=X.replace(/\{!!([\s\S]*?)!!\}/g,(w,W)=>{try{let q=d0(W,$,!0);if(q===void 0)return w;return String(q)}catch{return w}}),Y="",J=0,G=null;while(J<Z.length){let w=Z[J];if(G&&w==="\\"){Y+=w+(Z[J+1]??""),J+=2;continue}if(w==="{"&&Z[J+1]==="{"){let W=Z.indexOf("}}",J+2);if(W!==-1){let q=Z.slice(J,W+2);Y+=Q(Z.slice(J+2,W),q,G),J=W+2;continue}}if(G){if(w===G)G=null}else if(w==="'"||w==='"'||w==="`")G=w;Y+=w,J++}return Y;function Q(w,W,q){let U;try{U=d0(w,$,!0)}catch{return W}if(U===void 0)return W;if(q){let K=String(U).replace(/\\/g,"\\\\").replace(new RegExp(q==="`"?"`":q,"g"),`\\${q}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return q==="`"?K.replace(/\$\{/g,"\\${"):K}if(typeof U==="string"){let K=U.trim();if(K.startsWith("{")&&K.endsWith("}")||K.startsWith("[")&&K.endsWith("]"))try{return JSON.parse(K),K}catch{}}return JSON.stringify(U)}}function Dz(X,$){if(X.length===0)return"";let Z=X.map((Y)=>{let J=JSON.stringify(Object.fromEntries(Y.refs)),G=ZY(Y.stateExpr,$),Q=Y.initExpr?ZY(Y.initExpr,$):null,w=JSON.stringify(G),W=Q?JSON.stringify(Q):"null";return`
|
|
3318
3318
|
(function() {
|
|
3319
3319
|
var scopeEl = document.querySelector('${Y.selector}');
|
|
3320
3320
|
if (!scopeEl) return;
|
|
@@ -3326,7 +3326,7 @@ window.__stx_reactive = (function() {
|
|
|
3326
3326
|
${Ez()}
|
|
3327
3327
|
${Z}
|
|
3328
3328
|
</script>`}function YY(X,$,Z){if(!bz(X))return X;let Y=Tz(X);if(Y.length===0)return X;let J=yz(X,Y),G=Dz(Y,$),Q=J.lastIndexOf("</body>");if(Q!==-1)J=J.slice(0,Q)+G+`
|
|
3329
|
-
`+J.slice(Q);else J+=G;return J}function yz(X,$){let Z=0,Y=X.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(J,G,Q)=>{let w=$[Z++];if(!w)return J;let W=/data-stx-scope="([^"]*)"/.exec(Q);if(W)return w.id=W[1],w.selector=`[data-stx-scope="${w.id}"]`,J;return`<${G} data-stx-scope="${w.id}"${Q}>`});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,' data-stx-xinit="$1"'),Y=Y.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),Y}function bz(X){return/x-data\s*=\s*["']/.test(X)}var Rz=0,Mz=0;var JY=E(()=>{
|
|
3329
|
+
`+J.slice(Q);else J+=G;return J}function yz(X,$){let Z=0,Y=X.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(J,G,Q)=>{let w=$[Z++];if(!w)return J;let W=/data-stx-scope="([^"]*)"/.exec(Q);if(W)return w.id=W[1],w.selector=`[data-stx-scope="${w.id}"]`,J;return`<${G} data-stx-scope="${w.id}"${Q}>`});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,' data-stx-xinit="$1"'),Y=Y.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),Y}function bz(X){return/x-data\s*=\s*["']/.test(X)}var Rz=0,Mz=0;var JY=E(()=>{U1()});import Sz from"fs";import M9 from"path";import{createHighlighter as Cz}from"ts-syntax-highlighter";async function Pz(X,$={}){try{if(!await r(X))throw Error(`Markdown file not found: ${X}`);let Y=(await Sz.promises.stat(X)).mtime.getTime();if($.cache&&T9.has(X)){let K=T9.get(X);if(K.updatedAt>=Y)return{content:K.content,data:K.data}}let J=await Bun.file(X).text(),{data:G,content:Q}=NX(J),w=$.markdown||v7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},q=$5(Q,{gfm:!0});if(w.syntaxHighlighting?.enabled&&w.syntaxHighlighting?.serverSide)q=await vz(q,w.syntaxHighlighting?.defaultTheme||"github-dark",w.syntaxHighlighting?.highlightUnknownLanguages||!1);let U={content:q,data:G||{}};if($.cache)T9.set(X,{...U,updatedAt:Y});return U}catch(Z){if($.debug)console.error(`Error reading/parsing markdown file ${X}:`,Z);let Y=Z instanceof Error?Z.message:String(Z);return{content:B0("Markdown File",`Error reading/parsing markdown file: ${Y}`,X,"",0,""),data:{}}}}async function vz(X,$,Z){let Y=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!dX)try{dX=await Cz({theme:$||"github-dark",cache:!0})}catch(w){return console.error("Failed to initialize ts-syntax-highlighter:",w),X}let J=async(w,W,q,U)=>{let K=U.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),z=q||(Z?"text":"");if(!z)return w;try{if(!dX.getSupportedLanguages().includes(z))return w;return(await dX.highlight(K,z,{theme:$})).html}catch(j){console.error(`Error highlighting code block with language ${q}:`,j)}return w},G=X,Q=X.matchAll(Y);for(let w of Q){let[W,q,U,K]=w,z=await J(W,q,U,K);G=G.replace(W,z)}return G}async function GY(X,$,Z="",Y={}){return await xz(X,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(Q,w,W,q)=>{try{let U=w;if(!M9.isAbsolute(w))U=M9.resolve(M9.dirname(Z),w);let K={};if(W)try{try{K=JSON.parse(W)}catch{if(Y.debug)console.warn("Using safer alternative for parsing JS object literal");let L=W.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let F of L){let V=F.indexOf(":");if(V>0){let A=F.substring(0,V).trim(),R=F.substring(V+1).trim(),M=R.startsWith('"')&&R.endsWith('"'),T=R.startsWith("'")&&R.endsWith("'");if(M||T)R=R.substring(1,R.length-1);K[A]=R}}}}catch(O){if(Y.debug)console.error("Error parsing context in @markdown-file directive:",O)}let{content:z,data:j}=await Pz(U,Y),B={...$,...j,...K},_=z,H=/\{\{([^}]+)\}\}/g;return _=_.replace(H,(O,L)=>{let F=L.trim();return B[F]!==void 0?String(B[F]):O}),_}catch(U){let K=U instanceof Error?U.message:String(U);return B0("Markdown File",`Error including markdown file: ${K}`,Z,X,q,Q)}})}async function xz(X,$,Z){let Y=[],J;while((J=$.exec(X))!==null){let w=J[0],W=J.index,q=J;Y.push(Z(...q).then((U)=>({match:w,replacement:U,index:W})))}let G=await Promise.all(Y);G.sort((w,W)=>W.index-w.index);let Q=X;for(let{match:w,replacement:W}of G)Q=Q.replace(w,()=>W);return Q}var T9,dX=null;var QY=E(()=>{A1();H0();T9=new Map});function h1(X,$){try{let Z=X.trim();if(U0(Z))return K0(Z,Object.keys($))(...Object.values($));else return Q0(Z,$)}catch{return!1}}var wY=E(()=>{M0()});function N9(X){for(let[$,Z]of Object.entries(s))if(Z===X)return $;return}var s;var mX=E(()=>{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 m7(){return!1}function l7(){return!m7()||process.env.STX_DEBUG==="true"}function lX(){return!1}import fz from"path";function cX(){return{...k9}}function pX(X){if(!k9.showRelativePaths||!X)return X;let $=k9.baseDir||process.cwd();try{let Z=fz.relative($,X);return Z.startsWith("..")?X:Z}catch{return X}}var gz,k9,iX,q5,nX;var rX=E(()=>{mX();gz={showRelativePaths:!1,enableAutoRecovery:l7(),logRecoveryWarnings:!0},k9={...gz};iX=class iX extends Error{code;filePath;line;column;context;numericCode;constructor(X,$,Z,Y,J,G,Q){super(X);this.code=$;this.filePath=Z;this.line=Y;this.column=J;this.context=G;if(this.name="StxError",this.numericCode=Q||s.EVALUATION_ERROR,this.filePath)this.filePath=pX(this.filePath)}};q5=class q5 extends iX{constructor(X,$,Z,Y,J,G){super(X,"stx_RUNTIME_ERROR",$,Z,Y,J,G||s.EVALUATION_ERROR);this.name="StxRuntimeError"}};nX=class nX extends iX{isFatal=!0;constructor(X,$,Z,Y,J,G){super(X,"stx_VALIDATION_ERROR",$,Z,Y,J,G||s.DOM_API_VIOLATION);this.name="StxValidationError"}}});function qY(X){let{type:$,message:Z,code:Y,filePath:J,line:G,column:Q,template:w,offset:W,snippet:q,suggestion:U,format:K="text"}=X,z=G,j=Q;if(!z&&w&&W!==void 0){let L=cz(w,W);z=L.line,j=L.column}let B=J?pX(J):void 0,_=Y?N9(Y):void 0,H={type:$,code:Y,codeName:_,message:Z,filePath:B,line:z,column:j,snippet:q,suggestion:U,timestamp:new Date().toISOString()},O;switch(K){case"html":O=uz(H);break;case"json":O=JSON.stringify(H,null,2);break;case"console":O=dz(H,w,W);break;case"text":default:O=hz(H,w,W);break}return{formatted:O,data:H}}function hz(X,$,Z){let Y=[],J=X.code?` [${X.codeName||X.code}]`:"";if(Y.push(`[${X.type} Error${J}]`),X.filePath){let G=X.filePath;if(X.line){if(G+=`:${X.line}`,X.column)G+=`:${X.column}`}Y.push(`at ${G}`)}if(Y.push(`
|
|
3330
3330
|
${X.message}`),$&&X.line){let G=mz($,X.line,2);if(G)Y.push(`
|
|
3331
3331
|
${G}`)}if(X.snippet)Y.push(`
|
|
3332
3332
|
Snippet: ${X.snippet}`);if(X.suggestion)Y.push(`
|
|
@@ -3344,7 +3344,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
|
|
|
3344
3344
|
`)}function lz(X,$,Z){let Y=X.split(`
|
|
3345
3345
|
`),J=Math.max(0,$-Z-1),G=Math.min(Y.length-1,$+Z-1),Q="\x1B[90m",w="\x1B[31m",W="\x1B[0m",q=[];for(let U=J;U<=G;U++){let K=(U+1).toString().padStart(4),z=U===$-1,j=z?"\x1B[31m>\x1B[0m":" ",B=z?`\x1B[31m${Y[U]}\x1B[0m`:`\x1B[90m${Y[U]}\x1B[0m`;q.push(`${j}\x1B[90m${K}\x1B[0m | ${B}`)}return q.join(`
|
|
3346
3346
|
`)}function WY(X){return X.replace(/--/g,"- -").replace(/>/g,">")}function cz(X,$){let Y=X.substring(0,$).split(`
|
|
3347
|
-
`);return{line:Y.length,column:Y[Y.length-1].length}}function J0(X,$,Z){return qY({type:X,message:$,code:Z,format:"html"}).formatted}async function
|
|
3347
|
+
`);return{line:Y.length,column:Y[Y.length-1].length}}function J0(X,$,Z){return qY({type:X,message:$,code:Z,format:"html"}).formatted}async function u5(X,$,Z){try{return await X()}catch(Y){if(Z&&Y instanceof Error)Z(Y);return $}}var UY=E(()=>{mX();rX()});class E9{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor(X={}){this.maxErrors=X.maxErrors??1000,this.enableFileLogging=X.enableFileLogging??!1,this.logFilePath=X.logFilePath??".stx/errors.log",this.logFormat=X.logFormat??"json",this.maxFileSize=X.maxFileSize??10485760,this.maxLogFiles=X.maxLogFiles??5,this.minLevel=X.minLevel??"all"}configure(X){if(X.maxErrors!==void 0)this.maxErrors=X.maxErrors;if(X.enableFileLogging!==void 0)this.enableFileLogging=X.enableFileLogging;if(X.logFilePath!==void 0)this.logFilePath=X.logFilePath;if(X.logFormat!==void 0)this.logFormat=X.logFormat;if(X.maxFileSize!==void 0)this.maxFileSize=X.maxFileSize;if(X.maxLogFiles!==void 0)this.maxLogFiles=X.maxLogFiles;if(X.minLevel!==void 0)this.minLevel=X.minLevel}log(X,$,Z="error"){let Y={timestamp:new Date,error:X,context:$,level:Z};if(this.errors.push(Y),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Z))this.writeToFile(Y)}shouldLog(X){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return X==="error"||X==="warning";if(this.minLevel==="error")return X==="error";return!0}formatEntry(X){if(this.logFormat==="json")return JSON.stringify({timestamp:X.timestamp.toISOString(),level:X.level||"error",type:X.error.constructor.name,message:X.error.message,stack:X.error.stack,context:X.context});let $=[`[${X.timestamp.toISOString()}] [${(X.level||"error").toUpperCase()}] ${X.error.constructor.name}: ${X.error.message}`];if(X.error.stack)$.push(` Stack: ${X.error.stack.split(`
|
|
3348
3348
|
`).slice(1).join(`
|
|
3349
3349
|
`)}`);if(X.context)$.push(` Context: ${JSON.stringify(X.context)}`);return $.join(`
|
|
3350
3350
|
`)}writeToFile(X){this.writeQueue=this.writeQueue.then(async()=>{try{let $=await import("fs"),Y=(await import("path")).dirname(this.logFilePath);if(!$.existsSync(Y))$.mkdirSync(Y,{recursive:!0});await this.rotateIfNeeded($);let J=`${this.formatEntry(X)}
|
|
@@ -3352,15 +3352,15 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
|
|
|
3352
3352
|
|
|
3353
3353
|
`),"utf-8")}}async flush(){await this.writeQueue}}var I9,G1,D9;var KY=E(()=>{rX();I9={isEnabled(){return cX().enableAutoRecovery},fixCommonSyntaxErrors(X){let $=cX();if(!$.enableAutoRecovery)return{fixed:X,fixes:[]};let Z=X,Y=[],J=(Z.match(/\{\{/g)||[]).length,G=(Z.match(/\}\}/g)||[]).length;if(J>G){let w=J-G;Z+="}}".repeat(w),Y.push(`Added ${w} missing closing braces '}}'`)}let Q=["if","foreach","for","switch","section"];for(let w of Q){let W=(Z.match(new RegExp(`@${w}\\b`,"g"))||[]).length,q=(Z.match(new RegExp(`@end${w}\\b`,"g"))||[]).length;if(W>q){let U=W-q;for(let K=0;K<U;K++)Z+=`
|
|
3354
3354
|
@end${w}`;Y.push(`Added ${U} missing @end${w}`)}}if(Y.length>0&&$.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),Y.forEach((w)=>console.warn(` - ${w}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Z,fixes:Y}},createFallbackContent(X,$){if(l7())return`<!-- ${X} failed: ${$.message} -->`;return"<!-- stx rendering error -->"}};G1=new E9,D9={isDevelopment(){return l7()},logDetailedError(X,$){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",X.message),console.error("Stack:",X.stack),$)console.error("Context:",$);console.error("========================")},createErrorReport(X,$){let Z=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${X.message}`,`Type: ${X.constructor.name}`,`Stack: ${X.stack}`];if($)Z.push(`Context: ${JSON.stringify($,null,2)}`);return Z.push("========================"),Z.join(`
|
|
3355
|
-
`)}}});var zY=()=>{};var BY=E(()=>{mX();UY();KY();zY();rX()});var T1=E(()=>{BY()});function y0(X,$,Z,Y=0){let J=0,G=Y,Q=null,w=0,W=!1;while(G<X.length){let q=X[G];if(Q&&W){W=!1,G++;continue}if(Q&&q==="\\"){W=!0,G++;continue}if(W=!1,(q==='"'||q==="'"||q==="`")&&!Q){Q=q,G++;continue}if(q===Q&&Q!=="`"){Q=null,G++;continue}if(Q==="`"&&q==="$"&&X[G+1]==="{"){w++,G+=2;continue}if(w>0&&q==="}"){w--,G++;continue}if(q==="`"&&Q==="`"&&w===0){Q=null,G++;continue}if(Q){G++;continue}if(q===$)J++;else if(q===Z){if(J--,J===0)return G}G++}return-1}function g1(X,$){let Z=pz(X,$);return Z.ok?{expression:Z.expression,endPos:Z.endPos}:null}function pz(X,$){let Z=$;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(X[Z]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Z};let Y=y0(X,"(",")",Z);if(Y===-1)return{ok:!1,reason:"unclosed-paren",pos:Z};return{ok:!0,expression:X.slice(Z+1,Y),endPos:Y+1}}function iz(X,$){let Z=X.lastIndexOf("<",$);if(Z===-1)return!1;return Z>X.lastIndexOf(">",$)}function K5(X,$,Z,Y){let J=1,G=Y,Q=new RegExp(`@${$}\\s*\\(`,"g"),w=new RegExp(`@${Z}(?![a-z])`,"g");while(G<X.length&&J>0){Q.lastIndex=G,w.lastIndex=G;let W=Q.exec(X),q=w.exec(X),U=W?W.index:1/0,K=q?q.index:1/0;if(U<K)J++,G=U+W[0].length;else if(K<1/0){if(J--,J===0)return K;G=K+q[0].length}else break}return-1}function jY(X,$){let Z=X.slice($).match(/^@if\s*/);if(!Z)return null;let Y=$+Z[0].length,J=g1(X,Y);if(!J)return null;let G=J.endPos,Q=K5(X,"if","endif",G);if(Q===-1)return null;let w=X.slice(G,Q),W=[],q=0,U="if",K=J.expression,z=0,j=0;while(q<w.length){let B=w.indexOf("@",q);if(B===-1)break;q=B;let _=w.substring(B);if(iz(w,B)){q++;continue}if(/^@if\s*\(/.test(_)){j++,q++;continue}if(/^@endif(?![a-z])/.test(_)){j--,q+=6;continue}if(j===0){let H=_.match(/^@elseif\s*/);if(H){W.push({type:U,condition:K,content:w.substring(z,q),start:G+z,end:G+q});let O=q+H[0].length,L=g1(w,O);if(!L){q++;continue}U="elseif",K=L.expression,q=L.endPos,z=q;continue}else if(/^@else(?![a-z])/.test(_)){W.push({type:U,condition:K,content:w.substring(z,q),start:G+z,end:G+q}),U="else",K=void 0,q+=5,z=q;continue}}q++}return W.push({type:U,condition:K,content:w.slice(z),start:G+z,end:G+w.length}),{fullMatch:X.slice($,Q+6),branches:W,start:$,end:Q+6}}function c7(X){let $=[],Z=/@if\s*\(/g,Y=Z.exec(X);while(Y!==null){if($.some((Q)=>Y.index>Q.start&&Y.index<Q.end)){Y=Z.exec(X);continue}let G=jY(X,Y.index);if(G)$.push(G),Z.lastIndex=G.end;Y=Z.exec(X)}return $}function sX(X,$,Z){let Y=[],J=new RegExp(`@${$}\\s*\\(`,"g"),G=J.exec(X);while(G!==null){if(Y.some((_)=>G.index>_.start&&G.index<_.end)){G=J.exec(X);continue}let w=G.index,W=w+G[0].length-1,q=y0(X,"(",")",W);if(q===-1){G=J.exec(X);continue}let U=X.slice(W+1,q),K=q+1,z=K5(X,$,Z,K);if(z===-1){G=J.exec(X);continue}let j=X.slice(K,z),B=z+`@${Z}`.length;Y.push({fullMatch:X.slice(w,B),name:$,params:U,content:j,start:w,end:B}),J.lastIndex=B,G=J.exec(X)}return Y}function y9(X,$){let Z=X.slice($).match(/^@switch\s*/);if(!Z)return null;let Y=$+Z[0].length,J=g1(X,Y);if(!J)return null;let G=J.endPos,Q=K5(X,"switch","endswitch",G);if(Q===-1)return null;let w=X.slice(G,Q),W=[],q=0,U=null,K=0;while(q<w.length){let z=w.slice(q),j=z.match(/^@switch\s*\(/),B=z.match(/^@endswitch(?![a-z])/);if(j){if(K++,U)U.content+=j[0];q+=j[0].length;continue}if(B){if(K--,U)U.content+=B[0];q+=B[0].length;continue}if(K>0){if(U)U.content+=w[q];q++;continue}let _=z.match(/^@case\s*/),H=z.match(/^@default(?![a-z])/),O=z.match(/^@break(?![a-z])/);if(_&&z.startsWith("@case")){if(U)W.push(U);let L=q+_[0].length,F=g1(w,L);if(!F){q++;continue}U={type:"case",value:F.expression,content:""},q=F.endPos}else if(H&&z.startsWith("@default")){if(U)W.push(U);U={type:"default",content:""},q+=H[0].length}else if(O&&z.startsWith("@break"))q+=O[0].length;else{if(U)U.content+=w[q];q++}}if(U)W.push(U);return{fullMatch:X.slice($,Q+10),expression:J.expression,cases:W,start:$,end:Q+10}}var _Y=()=>{};var HY=()=>{};var oX=E(()=>{_Y();HY()});function oz(X,$,Z){let Y=X,J=!0;while(J){J=!1;let G=Y.match(/@switch\s*\(/);if(!G||G.index===void 0)break;let Q=G.index,w=y9(Y,Q);if(!w)break;try{let W;if(W0(w.expression))W=q0(w.expression,Object.keys($))(...Object.values($));else W=Q0(w.expression,$);let q="",U=!1;for(let K of w.cases)if(K.type==="default"){if(!U)q=K.content.trim()}else try{let z;if(K.value&&W0(K.value))z=q0(K.value,Object.keys($))(...Object.values($));else if(K.value)z=Q0(K.value,$);if(W===z){q=K.content.trim(),U=!0;break}}catch{continue}Y=Y.substring(0,Q)+q+Y.substring(w.end),J=!0}catch(W){let q=W instanceof Error?W.message:String(W),U=J0("Switch",`Error evaluating @switch expression: ${q}`,o.EVALUATION_ERROR);Y=Y.substring(0,Q)+U+Y.substring(w.end);break}}return Y}function az(X){let $=[];return{masked:X.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(Y)=>{return $.push(Y),`\x00stx-script-${$.length-1}\x00`}),scripts:$}}function tz(X,$){if($.length===0)return X;return X.replace(/\u0000stx-script-(\d+)\u0000/g,(Z,Y)=>$[Number(Y)]??Z)}function N1(X,$,Z){let{masked:Y,scripts:J}=az(X);return tz(ez(Y,$,Z),J)}function ez(X,$,Z){let Y=X;Y=oz(Y,$,Z);{let G=!0;while(G){G=!1;let Q=Y.match(/@unless\s*\(/);if(!Q||Q.index===void 0)break;let w=Q.index,W=g1(Y,w+7);if(!W)break;let q=W.endPos,U=K5(Y,"unless","endunless",q);if(U===-1){console.warn(`[stx] @unless directive at position ${w} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let K=Y.slice(q,U),z=W.expression,j=-1;{let _=0,H=/@(?:if|unless)\s*\(/g,O=/@(?:endif|endunless)(?![a-z])/g,L=/@else(?![a-z])/g,F=[],V;while((V=H.exec(K))!==null)F.push({pos:V.index,type:"open"});while((V=O.exec(K))!==null)F.push({pos:V.index,type:"close"});while((V=L.exec(K))!==null)F.push({pos:V.index,type:"else"});F.sort((A,R)=>A.pos-R.pos);for(let A of F)if(A.type==="open")_++;else if(A.type==="close")_--;else if(A.type==="else"&&_===0){j=A.pos;break}}let B;if(j!==-1){let _=K.slice(0,j),H=K.slice(j+5);B=`@if (${z})${H}@else ${_}@endif`}else B=`@if (!(${z}))${K}@endif`;Y=Y.substring(0,w)+B+Y.substring(U+10),G=!0}}Y=S9(Y,$,Z),Y=C9(Y,$,Z),Y=b9(Y,$);let J=()=>{let G=c7(Y);if(G.length===0)return!1;for(let Q=G.length-1;Q>=0;Q--){let w=G[Q];try{let W="",q=!1;for(let U of w.branches){if(q)break;if(U.type==="else")W=U.content,q=!0;else try{let K;if(U.condition&&W0(U.condition))K=q0(U.condition,Object.keys($))(...Object.values($));else if(U.condition)K=Q0(U.condition,$);if(K)W=U.content,q=!0}catch(K){W=J0(U.type==="if"?"If":"Elseif",`Error in @${U.type}(${U.condition}): ${K instanceof Error?K.message:String(K)}`,o.EVALUATION_ERROR),q=!0}}Y=Y.substring(0,w.start)+W+Y.substring(w.end)}catch(W){let q=W instanceof Error?W.message:String(W),U=J0("If",`Error processing @if block: ${q}`,o.EVALUATION_ERROR);Y=Y.substring(0,w.start)+U+Y.substring(w.end)}}return!0};while(!0){let G=Y;if(!J())break;if(Y===G)break}return Y}function LY(X){let $=0;while($<X.length&&/\s/.test(X[$]))$++;if(X[$]!=="(")return null;$++;while($<X.length&&/\s/.test(X[$]))$++;let Z=X[$];if(Z!=="'"&&Z!=='"')return null;$++;let Y=[];while($<X.length){let J=X[$];if(J==="\\"&&$+1<X.length){Y.push(X[$+1]),$+=2;continue}if(J===Z){$++;break}Y.push(J),$++}while($<X.length&&/\s/.test(X[$]))$++;if(X[$]!==")")return null;return $++,{value:Y.join(""),consumed:$}}function b9(X,$){let Z=X;function Y(w,W,q,U){let K=1,z=U,j=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${q}(?![a-z])`,"g");while(z<w.length&&K>0){j.lastIndex=z,B.lastIndex=z;let _=j.exec(w),H=B.exec(w),O=_?_.index:1/0,L=H?H.index:1/0;if(O<L)K++,z=O+_[0].length;else if(L<1/0){if(K--,K===0)return L;z=L+H[0].length}else break}return-1}function J(w,W,q){let U=0,K=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),z=new RegExp(`@${q}(?![a-z])`,"g"),j=/@else(?![a-z])/g,B=[],_;while((_=K.exec(w))!==null)B.push({pos:_.index,type:"open"});while((_=z.exec(w))!==null)B.push({pos:_.index,type:"close"});while((_=j.exec(w))!==null)B.push({pos:_.index,type:"else"});B.sort((H,O)=>H.pos-O.pos);for(let H of B)if(H.type==="open")U++;else if(H.type==="close")U--;else if(H.type==="else"&&U===0)return H.pos;return-1}{let w=!0;while(w){w=!1;let W=Z.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let q=W.index,U,K,z=Z.slice(q+5),j=LY(z);if(j)U=j.value,K=q+5+j.consumed;else K=q+5;let B=Y(Z,"auth","endauth",K);if(B===-1){console.warn(`[stx] @auth directive at position ${q} has no matching @endauth \u2014 the block was skipped.`);break}let _=Z.slice(K,B),H=J(_,"auth","endauth"),O;if(!$.auth)O=!1;else O=U?f1(`auth?.check && auth?.user?.[${U}]`,$):f1("auth?.check",$);let L;if(H!==-1){let F=_.slice(0,H),V=_.slice(H+5);L=O?F:V}else L=O?_:"";Z=Z.substring(0,q)+L+Z.substring(B+8),w=!0}}{let w=!0;while(w){w=!1;let W=Z.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let q=W.index,U,K,z=Z.slice(q+6),j=LY(z);if(j)U=j.value,K=q+6+j.consumed;else K=q+6;let B=Y(Z,"guest","endguest",K);if(B===-1){console.warn(`[stx] @guest directive at position ${q} has no matching @endguest \u2014 the block was skipped.`);break}let _=Z.slice(K,B),H=J(_,"guest","endguest"),O;if(!$.auth)O=!0;else O=U?f1(`!auth?.check || !auth?.user?.[${U}]`,$):f1("!auth?.check",$);let L;if(H!==-1){let F=_.slice(0,H),V=_.slice(H+5);L=O?F:V}else L=O?_:"";Z=Z.substring(0,q)+L+Z.substring(B+9),w=!0}}function G(w,W,q){if($.userCan&&typeof $.userCan[w]==="boolean")return $.userCan[w];if($.permissions?.check&&typeof $.permissions.check==="function")try{let U=[w];if(W)U.push(W);if(q){let K=f1(q,$);U.push(K)}return $.permissions.check(...U)}catch{return!1}return!1}function Q(w){let W=w.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 w of["can","cannot"]){let W=`end${w}`,q=w==="can"?"elsecan":"elsecannot",U=!0;while(U){U=!1;let K=Z.match(new RegExp(`@${w}\\s*\\(`));if(!K||K.index===void 0)break;let z=K.index,j=Z.slice(z+`@${w}`.length),B=Q(j);if(!B)break;let _=z+`@${w}`.length+B.paramsEnd,H=Y(Z,w,W,_);if(H===-1){console.warn(`[stx] @${w} directive at position ${z} has no matching @${W} \u2014 the block was skipped.`);break}let O=Z.slice(_,H),L=[],F=0,V=new RegExp(`@${w}\\s*\\(`,"g"),A=new RegExp(`@${W}(?![a-z])`,"g"),R=new RegExp(`@${q}\\s*\\(`,"g"),M=/@else(?![a-z])/g,T=[],k;while((k=V.exec(O))!==null)T.push({pos:k.index,type:"open"});while((k=A.exec(O))!==null)T.push({pos:k.index,type:"close"});while((k=R.exec(O))!==null)T.push({pos:k.index,type:"elseDirective"});while((k=M.exec(O))!==null)T.push({pos:k.index,type:"else"});T.sort((y,P)=>y.pos-P.pos);for(let y of T){if(y.type==="open"){F++;continue}if(y.type==="close"){F--;continue}if(F===0)L.push(y)}let I=[],D=0;for(let y=0;y<L.length;y++){let P=L[y];if(I.push({content:O.slice(D,P.pos),ability:void 0}),P.type==="elseDirective"){let x=O.slice(P.pos+`@${q}`.length),f=Q(x);if(f){I[I.length-1]={content:O.slice(D,P.pos)},D=P.pos+`@${q}`.length+f.paramsEnd,I.push({content:"",ability:f.ability,type:f.type,id:f.id}),I.pop();let p=L[y+1],c=p?p.pos:O.length;I.push({content:O.slice(D,c),ability:f.ability,type:f.type,id:f.id}),D=c}}else D=P.pos+5}if(D<O.length){let y=I[I.length-1];if(L.length>0&&L[L.length-1].type==="else")I.push({content:O.slice(D),isFinalElse:!0});else if(I.length===0)I.push({content:O.slice(D)})}let N=G(B.ability,B.type,B.id),S=w==="can"?N:!N,b="";if(S)b=I[0]?.content||"";else{let y=!1;for(let P=1;P<I.length;P++){let x=I[P];if(x.isFinalElse){b=x.content,y=!0;break}if(x.ability){let f=G(x.ability,x.type,x.id);if(w==="can"?f:!f){b=x.content,y=!0;break}}}if(!y&&I.length>0){let P=I[I.length-1];if(P.isFinalElse)b=P.content}}Z=Z.substring(0,z)+b+Z.substring(H+`@${W}`.length),U=!0}}return Z}function S9(X,$,Z){let Y=X;function J(G,Q,w,W,q){let U=!0;while(U){U=!1;let K=new RegExp(`@${Q}\\s*\\(`),z=G.match(K);if(!z||z.index===void 0)break;let j=z.index,B=g1(G,j+`@${Q}`.length);if(!B)break;let _=B.endPos,H=K5(G,Q,w,_);if(H===-1){console.warn(`[stx] @${Q} directive at position ${j} has no matching @${w} \u2014 the block was skipped.`);break}let O=G.slice(_,H),L=B.expression,F=-1,V=0,A=0;while(A<O.length){let R=O.indexOf("@",A);if(R===-1)break;let M=O.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(M)){V++,A=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(M)){V--,A=R+1;continue}if(V===0&&/^@else(?![a-z])/.test(M)){F=R;break}A=R+1}try{let R=W(L.trim()),M;if(F!==-1){let T=O.slice(0,F),k=O.slice(F+5);M=R?T:k}else M=R?O:"";G=G.substring(0,j)+M+G.substring(H+`@${w}`.length),U=!0}catch(R){let M=R instanceof Error?R.message:String(R),T=J0(q,`Error processing @${Q} directive: ${M}`,o.EVALUATION_ERROR);G=G.substring(0,j)+T+G.substring(H+`@${w}`.length);break}}return G}return Y=J(Y,"isset","endisset",(G)=>{let Q=f1(G,$);return Q!==void 0&&Q!==null},"Isset"),Y=J(Y,"empty","endempty",(G)=>{let Q=f1(G,$);return Q===void 0||Q===null||Q===""||Q===0||Q===!1||Array.isArray(Q)&&Q.length===0||typeof Q==="object"&&Q!==null&&Object.keys(Q).length===0},"Empty"),Y}function C9(X,$,Z){let Y=X,J="development";function G(Q,w,W,q){let U=new RegExp(`@${w}(?![a-z])`,"g"),K=new RegExp(`@${W}(?![a-z])`,"g"),z=new RegExp(`^@${w}(?![a-z])`),j=new RegExp(`^@${W}(?![a-z])`),B=Q,_=!0;while(_){_=!1,U.lastIndex=0;let H=U.exec(B);if(!H)break;let O=H.index,L=O+H[0].length;if(w==="env"){let N=B.substring(L).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!N)break;L+=N[0].length,q=J===N[2]}let F=1,V=L,A=-1;while(F>0&&V<B.length){U.lastIndex=V,K.lastIndex=V;let N=U.exec(B),S=K.exec(B),b=N?N.index:1/0,y=S?S.index:1/0;if(b<y)F++,V=b+N[0].length;else if(y<1/0){if(F--,F===0){A=y;break}V=y+S[0].length}else break}if(A===-1){console.warn(`[stx] @${w} directive at position ${O} has no matching @${W} \u2014 the block was skipped.`);break}let R=B.substring(L,A),M=-1,T=0,k=0;while(k<R.length){let N=R.indexOf("@",k);if(N===-1)break;let S=R.substring(N);if(z.test(S)){T++,k=N+1;continue}if(j.test(S)){T--,k=N+1;continue}if(T===0&&/^@else(?![a-z])/.test(S)){M=N;break}k=N+1}let I;if(M!==-1){let N=R.slice(0,M),S=R.slice(M+5);I=q?N:S}else I=q?R:"";let D=`@${W}`.length;B=B.substring(0,O)+I+B.substring(A+D),_=!0}return B}return Y=G(Y,"env","endenv",!1),Y=G(Y,"production","endproduction",J==="production"),Y=G(Y,"development","enddevelopment",J==="development"),Y=G(Y,"staging","endstaging",J==="staging"),Y=G(Y,"testing","endtesting",J==="testing"),Y}var p7=E(()=>{wY();T1();oX();T0()});function FY(X=16){let $=new Uint8Array(X);return crypto.getRandomValues($),btoa(String.fromCharCode(...$))}function aX(X,$){if(!X)return $?.nonceGenerator?.()??FY();let Z=OY.get(X);if(!Z)Z=$?.nonceGenerator?.()??FY(),OY.set(X,Z);return Z}function XB(X,$){let Z=[];for(let[Y,J]of Object.entries(X)){if(J===void 0||J===null)continue;if(typeof J==="boolean"){if(J)Z.push(Y);continue}if(Array.isArray(J)){let G=[...J];if($&&(Y==="script-src"||Y==="style-src"))G=G.filter((Q)=>!Q.startsWith("'nonce-")),G.push(`'nonce-${$}'`);if(G.length>0)Z.push(`${Y} ${G.join(" ")}`)}}return Z.join("; ")}function VY(X,$){return`<meta http-equiv="Content-Security-Policy" content="${XB(X,$).replace(/&/g,"&").replace(/"/g,""")}">`}function AY(X,$,Z){if(!$.enabled||!$.addMetaTag)return X;if(X.includes('http-equiv="Content-Security-Policy"'))return X;if(!X.includes("<head>")&&!X.includes("<head "))return X;let Y=$.useNonce?aX(Z,$):void 0,J=VY($.directives,Y);return X.replace(/<head([^>]*)>/,`<head$1>
|
|
3356
|
-
${J}`)}function RY(X,$){let Z=X;return Z=Z.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(Y,J)=>{if(J.includes("nonce="))return Y;return`<script nonce="${$}"${J}>`}),Z=Z.replace(/<style([^>]*)>/gi,(Y,J)=>{if(J.includes("nonce="))return Y;return`<style nonce="${$}"${J}>`}),Z}function MY(X,$,Z,Y){let J=X,G=Y.csp;if(J=J.replace(/@csp\b/g,()=>{if(!G?.enabled||!G.directives)return"<!-- CSP not configured -->";let Q=G.useNonce?aX($,G):void 0;return VY(G.directives,Q)}),J=J.replace(/@cspNonce\b/g,()=>{if(!G?.enabled||!G.useNonce)return"";return aX($,G)}),G?.enabled&&G.useNonce)$.cspNonce=aX($,G);return J}var OY;var TY=E(()=>{OY=new WeakMap});import $B from"crypto";function YB(X=ZB){let $=$B.randomBytes(Math.ceil(X/2)).toString("hex").slice(0,X);return P9=$,$}function JB(){if(!P9)YB();return P9}function GB(X=NY){let $=JB();return`<input type="hidden" name="${X}" value="${$}">`}function kY(X){return X.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,($,Z,Y)=>{return GB(Y||NY)})}var ZB=40,NY="_token",P9=null;var IY=()=>{};async function EY(X,$,Z,Y){if(!Y.customDirectives||Y.customDirectives.length===0)return X;let J=X;for(let G of Y.customDirectives){if(!G.name||typeof G.handler!=="function"){if(Y.debug)console.warn("Invalid custom directive:",G);continue}if(G.hasEndTag)J=await QB(J,G,$,Z,Y);else J=await wB(J,G,$,Z,Y)}return J}async function QB(X,$,Z,Y,J){let{name:G,handler:Q}=$,w=`@${G}`,W=`@end${G}`,q=X,U=g5(`${w}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${W}`,"g"),K=[],z=U.exec(q);while(z!==null){let[j,B="",_=""]=z,H=z.index||0;try{let O=B?DY(B):[],L=_.trim(),F=await Q(L,O,Z,Y);K.push({original:j,processed:F,startIndex:H})}catch(O){let L=O instanceof Error?O.message:String(O);if(J.debug)console.error(`Error processing custom directive @${G}:`,O);K.push({original:j,processed:J0("CustomDirective",`Error in @${G}${B?`(${B})`:""}: ${L}`,o.EVALUATION_ERROR),startIndex:H})}z=U.exec(q)}for(let j=K.length-1;j>=0;j--){let{original:B,processed:_}=K[j];q=q.replace(B,_)}return q}async function wB(X,$,Z,Y,J){let{name:G,handler:Q}=$,w=X,W=g5(`@${G}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),q=[],U=W.exec(w);while(U!==null){let[j,B=""]=U,_=U.index||0;try{let H=DY(B),O=await Q("",H,Z,Y);q.push({original:j,processed:O,startIndex:_})}catch(H){let O=H instanceof Error?H.message:String(H);if(J.debug)console.error(`Error processing custom directive @${G}:`,H);q.push({original:j,processed:J0("CustomDirective",`Error in @${G}(${B}): ${O}`,o.EVALUATION_ERROR),startIndex:_})}U=W.exec(w)}let K=g5(`@${G}(?!\\w)(?!\\s*\\()`,"g"),z=K.exec(w);while(z!==null){let[j]=z,B=z.index||0;try{let _=await Q("",[],Z,Y);q.push({original:j,processed:_,startIndex:B})}catch(_){let H=_ instanceof Error?_.message:String(_);if(J.debug)console.error(`Error processing custom directive @${G}:`,_);q.push({original:j,processed:J0("CustomDirective",`Error in @${G}: ${H}`,o.EVALUATION_ERROR),startIndex:B})}z=K.exec(w)}for(let j=q.length-1;j>=0;j--){let{original:B,processed:_}=q[j];w=w.replace(B,_)}return w}function DY(X){if(!X.trim())return[];let $=[],Z="",Y=!1,J="";for(let G=0;G<X.length;G++){let Q=X[G];if((Q==='"'||Q==="'")&&(G===0||X[G-1]!=="\\"))if(!Y)Y=!0,J=Q;else if(Q===J)Y=!1;else Z+=Q;else if(Q===","&&!Y)$.push(Z.trim()),Z="";else Z+=Q}if(Z.trim())$.push(Z.trim());return $.map((G)=>{let Q=G.trim();if(Q.startsWith('"')&&Q.endsWith('"')||Q.startsWith("'")&&Q.endsWith("'"))return Q.substring(1,Q.length-1);return Q})}var yY=E(()=>{T1();h5()});function z5(X,$){if(typeof X!=="string"||X.length===0)throw Error(`@appearanceBootstrap ${$} must be a non-empty string`)}function qB(X){if(!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap expects an options object");let $=X,Z=$.appearance,Y=$.colorMode;if(z5($.storageKey,"storageKey"),!Z||typeof Z!=="object"||Array.isArray(Z))throw Error("@appearanceBootstrap appearance must be an object");if(!Y||typeof Y!=="object"||Array.isArray(Y))throw Error("@appearanceBootstrap colorMode must be an object");if(z5(Z.key,"appearance.key"),z5(Z.attribute,"appearance.attribute"),z5(Z.default,"appearance.default"),z5(Y.key,"colorMode.key"),z5(Y.attribute,"colorMode.attribute"),z5(Y.default,"colorMode.default"),!SY.test(Z.key)||!SY.test(Y.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!bY.test(Z.attribute)||!bY.test(Y.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Z.allowed)||Z.allowed.length===0||Z.allowed.some((J)=>typeof J!=="string"||J.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!Z.allowed.includes(Z.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!WB.has(Y.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:$.storageKey,appearance:{key:Z.key,attribute:Z.attribute,allowed:[...new Set(Z.allowed)],default:Z.default},colorMode:{key:Y.key,attribute:Y.attribute,default:Y.default}}}function UB(X){return JSON.stringify(X).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function KB(X){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${UB(X)};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 zB(X,$){let Z=1,Y=null,J=!1;for(let G=$+1;G<X.length;G++){let Q=X[G];if(J){J=!1;continue}if(Y){if(Q==="\\")J=!0;else if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}if(Q==="(")Z++;else if(Q===")"&&--Z===0)return G}return-1}function CY(X,$){let Z=X,Y=/@appearanceBootstrap\s*\(/g,J;while((J=Y.exec(Z))!==null){let G=J.index+J[0].length-1,Q=zB(Z,G);if(Q===-1)throw Error("@appearanceBootstrap has an unclosed options object");let w=Z.slice(G+1,Q).trim(),W=Q0(`(${w})`,$),q=KB(qB(W));Z=Z.slice(0,J.index)+q+Z.slice(Q+1),Y.lastIndex=J.index+q.length}return Z}var bY,SY,WB;var PY=E(()=>{T0();bY=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,SY=/^[A-Za-z_$][\w$]*$/,WB=new Set(["light","dark","system"])});var f9={};e(f9,{useTitle:()=>LB,useSeoMeta:()=>vY,usePageTitle:()=>LB,useHead:()=>x9,seoMetaToHeadConfig:()=>eX,resetHead:()=>_B,renderHtmlAttrs:()=>FB,renderHead:()=>OB,renderBodyAttrs:()=>VB,processTitleDirective:()=>MB,processMetaDirective:()=>TB,processHeadDirective:()=>RB,mergeHeadConfigs:()=>u1,getPageMeta:()=>jB,getHead:()=>v9,definePageMeta:()=>HB,applyHead:()=>AB});function v9(){return h1}function jB(){return tX}function _B(){h1={},BB.length=0,tX={}}function x9(X){h1=u1(h1,X)}function u1(X,$){return{title:$.title??X.title,titleTemplate:$.titleTemplate??X.titleTemplate,base:$.base??X.base,meta:[...X.meta||[],...$.meta||[]],link:[...X.link||[],...$.link||[]],script:[...X.script||[],...$.script||[]],style:[...X.style||[],...$.style||[]],htmlAttrs:{...X.htmlAttrs,...$.htmlAttrs},bodyAttrs:{...X.bodyAttrs,...$.bodyAttrs}}}function vY(X){x9(eX(X))}function eX(X){let $=[];if(X.description)$.push({name:"description",content:X.description});if(X.keywords){let W=Array.isArray(X.keywords)?X.keywords.join(", "):X.keywords;$.push({name:"keywords",content:W})}if(X.author)$.push({name:"author",content:X.author});if(X.robots)$.push({name:"robots",content:X.robots});let Z=X.ogTitle??X.title,Y=X.ogDescription??X.description;if(Z)$.push({property:"og:title",content:Z});if(Y)$.push({property:"og:description",content:Y});if(X.ogImage)$.push({property:"og:image",content:X.ogImage});if(X.ogUrl)$.push({property:"og:url",content:X.ogUrl});if(X.ogType)$.push({property:"og:type",content:X.ogType});if(X.ogSiteName)$.push({property:"og:site_name",content:X.ogSiteName});if(X.ogLocale)$.push({property:"og:locale",content:X.ogLocale});let J=X.twitterTitle??X.title,G=X.twitterDescription??X.description,Q=X.twitterImage??X.ogImage;if(X.twitterCard)$.push({name:"twitter:card",content:X.twitterCard});if(J)$.push({name:"twitter:title",content:J});if(G)$.push({name:"twitter:description",content:G});if(Q)$.push({name:"twitter:image",content:Q});if(X.twitterSite)$.push({name:"twitter:site",content:X.twitterSite});if(X.twitterCreator)$.push({name:"twitter:creator",content:X.twitterCreator});if(X.articleAuthor)$.push({property:"article:author",content:X.articleAuthor});if(X.articlePublishedTime)$.push({property:"article:published_time",content:X.articlePublishedTime});if(X.articleModifiedTime)$.push({property:"article:modified_time",content:X.articleModifiedTime});if(X.articleSection)$.push({property:"article:section",content:X.articleSection});if(X.articleTags)for(let W of X.articleTags)$.push({property:"article:tag",content:W});let w=[];if(X.canonical)w.push({rel:"canonical",href:X.canonical});return{title:X.title,titleTemplate:X.titleTemplate,meta:$,link:w}}function HB(X){if(tX={...tX,...X},X.title||X.description)vY({title:X.title,description:X.description})}function LB(X){let $=typeof X==="function"?X():X;x9({title:$})}function OB(X=h1){let $=[];if(X.title){let Z=X.title;if(X.titleTemplate)Z=typeof X.titleTemplate==="function"?X.titleTemplate(Z):X.titleTemplate.replace("%s",Z);$.push(`<title>${B5(Z)}</title>`)}if(X.base){let Z=Object.entries(X.base).map(([Y,J])=>`${Y}="${B5(J)}"`).join(" ");$.push(`<base ${Z}>`)}for(let Z of X.meta||[]){let Y=Object.entries(Z).filter(([J,G])=>G!==void 0).map(([J,G])=>{return`${J==="httpEquiv"?"http-equiv":J}="${B5(String(G))}"`}).join(" ");$.push(`<meta ${Y}>`)}for(let Z of X.link||[]){let Y=Object.entries(Z).filter(([J,G])=>G!==void 0).map(([J,G])=>`${J}="${B5(String(G))}"`).join(" ");$.push(`<link ${Y}>`)}for(let Z of X.script||[]){let{content:Y,...J}=Z,G=Object.entries(J).filter(([Q,w])=>w!==void 0).map(([Q,w])=>{if(typeof w==="boolean")return w?Q:"";return`${Q}="${B5(String(w))}"`}).filter(Boolean).join(" ");if(Y)$.push(`<script ${G}>${Y}</script>`);else $.push(`<script ${G}></script>`)}for(let Z of X.style||[]){let Y=Z.type?` type="${Z.type}"`:"";$.push(`<style${Y}>${Z.content}</style>`)}return $.join(`
|
|
3357
|
-
`)}function FB(X=
|
|
3358
|
-
`,""}),headContent:$.trim()}}function MB(X,$){return X.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Z,Y,J,G)=>{let Q=Y?J:$[(G||"").trim()]??G,w=$.__stx_runtime_head??{};return $.__stx_runtime_head=
|
|
3355
|
+
`)}}});var zY=()=>{};var BY=E(()=>{mX();UY();KY();zY();rX()});var T1=E(()=>{BY()});function D0(X,$,Z,Y=0){let J=0,G=Y,Q=null,w=0,W=!1;while(G<X.length){let q=X[G];if(Q&&W){W=!1,G++;continue}if(Q&&q==="\\"){W=!0,G++;continue}if(W=!1,(q==='"'||q==="'"||q==="`")&&!Q){Q=q,G++;continue}if(q===Q&&Q!=="`"){Q=null,G++;continue}if(Q==="`"&&q==="$"&&X[G+1]==="{"){w++,G+=2;continue}if(w>0&&q==="}"){w--,G++;continue}if(q==="`"&&Q==="`"&&w===0){Q=null,G++;continue}if(Q){G++;continue}if(q===$)J++;else if(q===Z){if(J--,J===0)return G}G++}return-1}function u1(X,$){let Z=pz(X,$);return Z.ok?{expression:Z.expression,endPos:Z.endPos}:null}function pz(X,$){let Z=$;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(X[Z]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Z};let Y=D0(X,"(",")",Z);if(Y===-1)return{ok:!1,reason:"unclosed-paren",pos:Z};return{ok:!0,expression:X.slice(Z+1,Y),endPos:Y+1}}function iz(X,$){let Z=X.lastIndexOf("<",$);if(Z===-1)return!1;return Z>X.lastIndexOf(">",$)}function U5(X,$,Z,Y){let J=1,G=Y,Q=new RegExp(`@${$}\\s*\\(`,"g"),w=new RegExp(`@${Z}(?![a-z])`,"g");while(G<X.length&&J>0){Q.lastIndex=G,w.lastIndex=G;let W=Q.exec(X),q=w.exec(X),U=W?W.index:1/0,K=q?q.index:1/0;if(U<K)J++,G=U+W[0].length;else if(K<1/0){if(J--,J===0)return K;G=K+q[0].length}else break}return-1}function jY(X,$){let Z=X.slice($).match(/^@if\s*/);if(!Z)return null;let Y=$+Z[0].length,J=u1(X,Y);if(!J)return null;let G=J.endPos,Q=U5(X,"if","endif",G);if(Q===-1)return null;let w=X.slice(G,Q),W=[],q=0,U="if",K=J.expression,z=0,j=0;while(q<w.length){let B=w.indexOf("@",q);if(B===-1)break;q=B;let _=w.substring(B);if(iz(w,B)){q++;continue}if(/^@if\s*\(/.test(_)){j++,q++;continue}if(/^@endif(?![a-z])/.test(_)){j--,q+=6;continue}if(j===0){let H=_.match(/^@elseif\s*/);if(H){W.push({type:U,condition:K,content:w.substring(z,q),start:G+z,end:G+q});let O=q+H[0].length,L=u1(w,O);if(!L){q++;continue}U="elseif",K=L.expression,q=L.endPos,z=q;continue}else if(/^@else(?![a-z])/.test(_)){W.push({type:U,condition:K,content:w.substring(z,q),start:G+z,end:G+q}),U="else",K=void 0,q+=5,z=q;continue}}q++}return W.push({type:U,condition:K,content:w.slice(z),start:G+z,end:G+w.length}),{fullMatch:X.slice($,Q+6),branches:W,start:$,end:Q+6}}function c7(X){let $=[],Z=/@if\s*\(/g,Y=Z.exec(X);while(Y!==null){if($.some((Q)=>Y.index>Q.start&&Y.index<Q.end)){Y=Z.exec(X);continue}let G=jY(X,Y.index);if(G)$.push(G),Z.lastIndex=G.end;Y=Z.exec(X)}return $}function sX(X,$,Z){let Y=[],J=new RegExp(`@${$}\\s*\\(`,"g"),G=J.exec(X);while(G!==null){if(Y.some((_)=>G.index>_.start&&G.index<_.end)){G=J.exec(X);continue}let w=G.index,W=w+G[0].length-1,q=D0(X,"(",")",W);if(q===-1){G=J.exec(X);continue}let U=X.slice(W+1,q),K=q+1,z=U5(X,$,Z,K);if(z===-1){G=J.exec(X);continue}let j=X.slice(K,z),B=z+`@${Z}`.length;Y.push({fullMatch:X.slice(w,B),name:$,params:U,content:j,start:w,end:B}),J.lastIndex=B,G=J.exec(X)}return Y}function y9(X,$){let Z=X.slice($).match(/^@switch\s*/);if(!Z)return null;let Y=$+Z[0].length,J=u1(X,Y);if(!J)return null;let G=J.endPos,Q=U5(X,"switch","endswitch",G);if(Q===-1)return null;let w=X.slice(G,Q),W=[],q=0,U=null,K=0;while(q<w.length){let z=w.slice(q),j=z.match(/^@switch\s*\(/),B=z.match(/^@endswitch(?![a-z])/);if(j){if(K++,U)U.content+=j[0];q+=j[0].length;continue}if(B){if(K--,U)U.content+=B[0];q+=B[0].length;continue}if(K>0){if(U)U.content+=w[q];q++;continue}let _=z.match(/^@case\s*/),H=z.match(/^@default(?![a-z])/),O=z.match(/^@break(?![a-z])/);if(_&&z.startsWith("@case")){if(U)W.push(U);let L=q+_[0].length,F=u1(w,L);if(!F){q++;continue}U={type:"case",value:F.expression,content:""},q=F.endPos}else if(H&&z.startsWith("@default")){if(U)W.push(U);U={type:"default",content:""},q+=H[0].length}else if(O&&z.startsWith("@break"))q+=O[0].length;else{if(U)U.content+=w[q];q++}}if(U)W.push(U);return{fullMatch:X.slice($,Q+10),expression:J.expression,cases:W,start:$,end:Q+10}}var _Y=()=>{};var HY=()=>{};var oX=E(()=>{_Y();HY()});function oz(X,$,Z){let Y=X,J=!0;while(J){J=!1;let G=Y.match(/@switch\s*\(/);if(!G||G.index===void 0)break;let Q=G.index,w=y9(Y,Q);if(!w)break;try{let W;if(U0(w.expression))W=K0(w.expression,Object.keys($))(...Object.values($));else W=Q0(w.expression,$);let q="",U=!1;for(let K of w.cases)if(K.type==="default"){if(!U)q=K.content.trim()}else try{let z;if(K.value&&U0(K.value))z=K0(K.value,Object.keys($))(...Object.values($));else if(K.value)z=Q0(K.value,$);if(W===z){q=K.content.trim(),U=!0;break}}catch{continue}Y=Y.substring(0,Q)+q+Y.substring(w.end),J=!0}catch(W){let q=W instanceof Error?W.message:String(W),U=J0("Switch",`Error evaluating @switch expression: ${q}`,s.EVALUATION_ERROR);Y=Y.substring(0,Q)+U+Y.substring(w.end);break}}return Y}function az(X){let $=[];return{masked:X.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(Y)=>{return $.push(Y),`\x00stx-script-${$.length-1}\x00`}),scripts:$}}function tz(X,$){if($.length===0)return X;return X.replace(/\u0000stx-script-(\d+)\u0000/g,(Z,Y)=>$[Number(Y)]??Z)}function N1(X,$,Z){let{masked:Y,scripts:J}=az(X);return tz(ez(Y,$,Z),J)}function ez(X,$,Z){let Y=X;Y=oz(Y,$,Z);{let G=!0;while(G){G=!1;let Q=Y.match(/@unless\s*\(/);if(!Q||Q.index===void 0)break;let w=Q.index,W=u1(Y,w+7);if(!W)break;let q=W.endPos,U=U5(Y,"unless","endunless",q);if(U===-1){console.warn(`[stx] @unless directive at position ${w} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let K=Y.slice(q,U),z=W.expression,j=-1;{let _=0,H=/@(?:if|unless)\s*\(/g,O=/@(?:endif|endunless)(?![a-z])/g,L=/@else(?![a-z])/g,F=[],V;while((V=H.exec(K))!==null)F.push({pos:V.index,type:"open"});while((V=O.exec(K))!==null)F.push({pos:V.index,type:"close"});while((V=L.exec(K))!==null)F.push({pos:V.index,type:"else"});F.sort((A,R)=>A.pos-R.pos);for(let A of F)if(A.type==="open")_++;else if(A.type==="close")_--;else if(A.type==="else"&&_===0){j=A.pos;break}}let B;if(j!==-1){let _=K.slice(0,j),H=K.slice(j+5);B=`@if (${z})${H}@else ${_}@endif`}else B=`@if (!(${z}))${K}@endif`;Y=Y.substring(0,w)+B+Y.substring(U+10),G=!0}}Y=S9(Y,$,Z),Y=C9(Y,$,Z),Y=b9(Y,$);let J=()=>{let G=c7(Y);if(G.length===0)return!1;for(let Q=G.length-1;Q>=0;Q--){let w=G[Q];try{let W="",q=!1;for(let U of w.branches){if(q)break;if(U.type==="else")W=U.content,q=!0;else try{let K;if(U.condition&&U0(U.condition))K=K0(U.condition,Object.keys($))(...Object.values($));else if(U.condition)K=Q0(U.condition,$);if(K)W=U.content,q=!0}catch(K){W=J0(U.type==="if"?"If":"Elseif",`Error in @${U.type}(${U.condition}): ${K instanceof Error?K.message:String(K)}`,s.EVALUATION_ERROR),q=!0}}Y=Y.substring(0,w.start)+W+Y.substring(w.end)}catch(W){let q=W instanceof Error?W.message:String(W),U=J0("If",`Error processing @if block: ${q}`,s.EVALUATION_ERROR);Y=Y.substring(0,w.start)+U+Y.substring(w.end)}}return!0};while(!0){let G=Y;if(!J())break;if(Y===G)break}return Y}function LY(X){let $=0;while($<X.length&&/\s/.test(X[$]))$++;if(X[$]!=="(")return null;$++;while($<X.length&&/\s/.test(X[$]))$++;let Z=X[$];if(Z!=="'"&&Z!=='"')return null;$++;let Y=[];while($<X.length){let J=X[$];if(J==="\\"&&$+1<X.length){Y.push(X[$+1]),$+=2;continue}if(J===Z){$++;break}Y.push(J),$++}while($<X.length&&/\s/.test(X[$]))$++;if(X[$]!==")")return null;return $++,{value:Y.join(""),consumed:$}}function b9(X,$){let Z=X;function Y(w,W,q,U){let K=1,z=U,j=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${q}(?![a-z])`,"g");while(z<w.length&&K>0){j.lastIndex=z,B.lastIndex=z;let _=j.exec(w),H=B.exec(w),O=_?_.index:1/0,L=H?H.index:1/0;if(O<L)K++,z=O+_[0].length;else if(L<1/0){if(K--,K===0)return L;z=L+H[0].length}else break}return-1}function J(w,W,q){let U=0,K=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),z=new RegExp(`@${q}(?![a-z])`,"g"),j=/@else(?![a-z])/g,B=[],_;while((_=K.exec(w))!==null)B.push({pos:_.index,type:"open"});while((_=z.exec(w))!==null)B.push({pos:_.index,type:"close"});while((_=j.exec(w))!==null)B.push({pos:_.index,type:"else"});B.sort((H,O)=>H.pos-O.pos);for(let H of B)if(H.type==="open")U++;else if(H.type==="close")U--;else if(H.type==="else"&&U===0)return H.pos;return-1}{let w=!0;while(w){w=!1;let W=Z.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let q=W.index,U,K,z=Z.slice(q+5),j=LY(z);if(j)U=j.value,K=q+5+j.consumed;else K=q+5;let B=Y(Z,"auth","endauth",K);if(B===-1){console.warn(`[stx] @auth directive at position ${q} has no matching @endauth \u2014 the block was skipped.`);break}let _=Z.slice(K,B),H=J(_,"auth","endauth"),O;if(!$.auth)O=!1;else O=U?h1(`auth?.check && auth?.user?.[${U}]`,$):h1("auth?.check",$);let L;if(H!==-1){let F=_.slice(0,H),V=_.slice(H+5);L=O?F:V}else L=O?_:"";Z=Z.substring(0,q)+L+Z.substring(B+8),w=!0}}{let w=!0;while(w){w=!1;let W=Z.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let q=W.index,U,K,z=Z.slice(q+6),j=LY(z);if(j)U=j.value,K=q+6+j.consumed;else K=q+6;let B=Y(Z,"guest","endguest",K);if(B===-1){console.warn(`[stx] @guest directive at position ${q} has no matching @endguest \u2014 the block was skipped.`);break}let _=Z.slice(K,B),H=J(_,"guest","endguest"),O;if(!$.auth)O=!0;else O=U?h1(`!auth?.check || !auth?.user?.[${U}]`,$):h1("!auth?.check",$);let L;if(H!==-1){let F=_.slice(0,H),V=_.slice(H+5);L=O?F:V}else L=O?_:"";Z=Z.substring(0,q)+L+Z.substring(B+9),w=!0}}function G(w,W,q){if($.userCan&&typeof $.userCan[w]==="boolean")return $.userCan[w];if($.permissions?.check&&typeof $.permissions.check==="function")try{let U=[w];if(W)U.push(W);if(q){let K=h1(q,$);U.push(K)}return $.permissions.check(...U)}catch{return!1}return!1}function Q(w){let W=w.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 w of["can","cannot"]){let W=`end${w}`,q=w==="can"?"elsecan":"elsecannot",U=!0;while(U){U=!1;let K=Z.match(new RegExp(`@${w}\\s*\\(`));if(!K||K.index===void 0)break;let z=K.index,j=Z.slice(z+`@${w}`.length),B=Q(j);if(!B)break;let _=z+`@${w}`.length+B.paramsEnd,H=Y(Z,w,W,_);if(H===-1){console.warn(`[stx] @${w} directive at position ${z} has no matching @${W} \u2014 the block was skipped.`);break}let O=Z.slice(_,H),L=[],F=0,V=new RegExp(`@${w}\\s*\\(`,"g"),A=new RegExp(`@${W}(?![a-z])`,"g"),R=new RegExp(`@${q}\\s*\\(`,"g"),M=/@else(?![a-z])/g,T=[],k;while((k=V.exec(O))!==null)T.push({pos:k.index,type:"open"});while((k=A.exec(O))!==null)T.push({pos:k.index,type:"close"});while((k=R.exec(O))!==null)T.push({pos:k.index,type:"elseDirective"});while((k=M.exec(O))!==null)T.push({pos:k.index,type:"else"});T.sort((y,P)=>y.pos-P.pos);for(let y of T){if(y.type==="open"){F++;continue}if(y.type==="close"){F--;continue}if(F===0)L.push(y)}let I=[],D=0;for(let y=0;y<L.length;y++){let P=L[y];if(I.push({content:O.slice(D,P.pos),ability:void 0}),P.type==="elseDirective"){let f=O.slice(P.pos+`@${q}`.length),g=Q(f);if(g){I[I.length-1]={content:O.slice(D,P.pos)},D=P.pos+`@${q}`.length+g.paramsEnd,I.push({content:"",ability:g.ability,type:g.type,id:g.id}),I.pop();let p=L[y+1],c=p?p.pos:O.length;I.push({content:O.slice(D,c),ability:g.ability,type:g.type,id:g.id}),D=c}}else D=P.pos+5}if(D<O.length){let y=I[I.length-1];if(L.length>0&&L[L.length-1].type==="else")I.push({content:O.slice(D),isFinalElse:!0});else if(I.length===0)I.push({content:O.slice(D)})}let N=G(B.ability,B.type,B.id),S=w==="can"?N:!N,b="";if(S)b=I[0]?.content||"";else{let y=!1;for(let P=1;P<I.length;P++){let f=I[P];if(f.isFinalElse){b=f.content,y=!0;break}if(f.ability){let g=G(f.ability,f.type,f.id);if(w==="can"?g:!g){b=f.content,y=!0;break}}}if(!y&&I.length>0){let P=I[I.length-1];if(P.isFinalElse)b=P.content}}Z=Z.substring(0,z)+b+Z.substring(H+`@${W}`.length),U=!0}}return Z}function S9(X,$,Z){let Y=X;function J(G,Q,w,W,q){let U=!0;while(U){U=!1;let K=new RegExp(`@${Q}\\s*\\(`),z=G.match(K);if(!z||z.index===void 0)break;let j=z.index,B=u1(G,j+`@${Q}`.length);if(!B)break;let _=B.endPos,H=U5(G,Q,w,_);if(H===-1){console.warn(`[stx] @${Q} directive at position ${j} has no matching @${w} \u2014 the block was skipped.`);break}let O=G.slice(_,H),L=B.expression,F=-1,V=0,A=0;while(A<O.length){let R=O.indexOf("@",A);if(R===-1)break;let M=O.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(M)){V++,A=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(M)){V--,A=R+1;continue}if(V===0&&/^@else(?![a-z])/.test(M)){F=R;break}A=R+1}try{let R=W(L.trim()),M;if(F!==-1){let T=O.slice(0,F),k=O.slice(F+5);M=R?T:k}else M=R?O:"";G=G.substring(0,j)+M+G.substring(H+`@${w}`.length),U=!0}catch(R){let M=R instanceof Error?R.message:String(R),T=J0(q,`Error processing @${Q} directive: ${M}`,s.EVALUATION_ERROR);G=G.substring(0,j)+T+G.substring(H+`@${w}`.length);break}}return G}return Y=J(Y,"isset","endisset",(G)=>{let Q=h1(G,$);return Q!==void 0&&Q!==null},"Isset"),Y=J(Y,"empty","endempty",(G)=>{let Q=h1(G,$);return Q===void 0||Q===null||Q===""||Q===0||Q===!1||Array.isArray(Q)&&Q.length===0||typeof Q==="object"&&Q!==null&&Object.keys(Q).length===0},"Empty"),Y}function C9(X,$,Z){let Y=X,J="development";function G(Q,w,W,q){let U=new RegExp(`@${w}(?![a-z])`,"g"),K=new RegExp(`@${W}(?![a-z])`,"g"),z=new RegExp(`^@${w}(?![a-z])`),j=new RegExp(`^@${W}(?![a-z])`),B=Q,_=!0;while(_){_=!1,U.lastIndex=0;let H=U.exec(B);if(!H)break;let O=H.index,L=O+H[0].length;if(w==="env"){let N=B.substring(L).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!N)break;L+=N[0].length,q=J===N[2]}let F=1,V=L,A=-1;while(F>0&&V<B.length){U.lastIndex=V,K.lastIndex=V;let N=U.exec(B),S=K.exec(B),b=N?N.index:1/0,y=S?S.index:1/0;if(b<y)F++,V=b+N[0].length;else if(y<1/0){if(F--,F===0){A=y;break}V=y+S[0].length}else break}if(A===-1){console.warn(`[stx] @${w} directive at position ${O} has no matching @${W} \u2014 the block was skipped.`);break}let R=B.substring(L,A),M=-1,T=0,k=0;while(k<R.length){let N=R.indexOf("@",k);if(N===-1)break;let S=R.substring(N);if(z.test(S)){T++,k=N+1;continue}if(j.test(S)){T--,k=N+1;continue}if(T===0&&/^@else(?![a-z])/.test(S)){M=N;break}k=N+1}let I;if(M!==-1){let N=R.slice(0,M),S=R.slice(M+5);I=q?N:S}else I=q?R:"";let D=`@${W}`.length;B=B.substring(0,O)+I+B.substring(A+D),_=!0}return B}return Y=G(Y,"env","endenv",!1),Y=G(Y,"production","endproduction",J==="production"),Y=G(Y,"development","enddevelopment",J==="development"),Y=G(Y,"staging","endstaging",J==="staging"),Y=G(Y,"testing","endtesting",J==="testing"),Y}var p7=E(()=>{wY();T1();oX();M0()});function FY(X=16){let $=new Uint8Array(X);return crypto.getRandomValues($),btoa(String.fromCharCode(...$))}function aX(X,$){if(!X)return $?.nonceGenerator?.()??FY();let Z=OY.get(X);if(!Z)Z=$?.nonceGenerator?.()??FY(),OY.set(X,Z);return Z}function XB(X,$){let Z=[];for(let[Y,J]of Object.entries(X)){if(J===void 0||J===null)continue;if(typeof J==="boolean"){if(J)Z.push(Y);continue}if(Array.isArray(J)){let G=[...J];if($&&(Y==="script-src"||Y==="style-src"))G=G.filter((Q)=>!Q.startsWith("'nonce-")),G.push(`'nonce-${$}'`);if(G.length>0)Z.push(`${Y} ${G.join(" ")}`)}}return Z.join("; ")}function VY(X,$){return`<meta http-equiv="Content-Security-Policy" content="${XB(X,$).replace(/&/g,"&").replace(/"/g,""")}">`}function AY(X,$,Z){if(!$.enabled||!$.addMetaTag)return X;if(X.includes('http-equiv="Content-Security-Policy"'))return X;if(!X.includes("<head>")&&!X.includes("<head "))return X;let Y=$.useNonce?aX(Z,$):void 0,J=VY($.directives,Y);return X.replace(/<head([^>]*)>/,`<head$1>
|
|
3356
|
+
${J}`)}function RY(X,$){let Z=X;return Z=Z.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(Y,J)=>{if(J.includes("nonce="))return Y;return`<script nonce="${$}"${J}>`}),Z=Z.replace(/<style([^>]*)>/gi,(Y,J)=>{if(J.includes("nonce="))return Y;return`<style nonce="${$}"${J}>`}),Z}function MY(X,$,Z,Y){let J=X,G=Y.csp;if(J=J.replace(/@csp\b/g,()=>{if(!G?.enabled||!G.directives)return"<!-- CSP not configured -->";let Q=G.useNonce?aX($,G):void 0;return VY(G.directives,Q)}),J=J.replace(/@cspNonce\b/g,()=>{if(!G?.enabled||!G.useNonce)return"";return aX($,G)}),G?.enabled&&G.useNonce)$.cspNonce=aX($,G);return J}var OY;var TY=E(()=>{OY=new WeakMap});import $B from"crypto";function YB(X=ZB){let $=$B.randomBytes(Math.ceil(X/2)).toString("hex").slice(0,X);return P9=$,$}function JB(){if(!P9)YB();return P9}function GB(X=NY){let $=JB();return`<input type="hidden" name="${X}" value="${$}">`}function kY(X){return X.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,($,Z,Y)=>{return GB(Y||NY)})}var ZB=40,NY="_token",P9=null;var IY=()=>{};async function EY(X,$,Z,Y){if(!Y.customDirectives||Y.customDirectives.length===0)return X;let J=X;for(let G of Y.customDirectives){if(!G.name||typeof G.handler!=="function"){if(Y.debug)console.warn("Invalid custom directive:",G);continue}if(G.hasEndTag)J=await QB(J,G,$,Z,Y);else J=await wB(J,G,$,Z,Y)}return J}async function QB(X,$,Z,Y,J){let{name:G,handler:Q}=$,w=`@${G}`,W=`@end${G}`,q=X,U=f5(`${w}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${W}`,"g"),K=[],z=U.exec(q);while(z!==null){let[j,B="",_=""]=z,H=z.index||0;try{let O=B?DY(B):[],L=_.trim(),F=await Q(L,O,Z,Y);K.push({original:j,processed:F,startIndex:H})}catch(O){let L=O instanceof Error?O.message:String(O);if(J.debug)console.error(`Error processing custom directive @${G}:`,O);K.push({original:j,processed:J0("CustomDirective",`Error in @${G}${B?`(${B})`:""}: ${L}`,s.EVALUATION_ERROR),startIndex:H})}z=U.exec(q)}for(let j=K.length-1;j>=0;j--){let{original:B,processed:_}=K[j];q=q.replace(B,_)}return q}async function wB(X,$,Z,Y,J){let{name:G,handler:Q}=$,w=X,W=f5(`@${G}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),q=[],U=W.exec(w);while(U!==null){let[j,B=""]=U,_=U.index||0;try{let H=DY(B),O=await Q("",H,Z,Y);q.push({original:j,processed:O,startIndex:_})}catch(H){let O=H instanceof Error?H.message:String(H);if(J.debug)console.error(`Error processing custom directive @${G}:`,H);q.push({original:j,processed:J0("CustomDirective",`Error in @${G}(${B}): ${O}`,s.EVALUATION_ERROR),startIndex:_})}U=W.exec(w)}let K=f5(`@${G}(?!\\w)(?!\\s*\\()`,"g"),z=K.exec(w);while(z!==null){let[j]=z,B=z.index||0;try{let _=await Q("",[],Z,Y);q.push({original:j,processed:_,startIndex:B})}catch(_){let H=_ instanceof Error?_.message:String(_);if(J.debug)console.error(`Error processing custom directive @${G}:`,_);q.push({original:j,processed:J0("CustomDirective",`Error in @${G}: ${H}`,s.EVALUATION_ERROR),startIndex:B})}z=K.exec(w)}for(let j=q.length-1;j>=0;j--){let{original:B,processed:_}=q[j];w=w.replace(B,_)}return w}function DY(X){if(!X.trim())return[];let $=[],Z="",Y=!1,J="";for(let G=0;G<X.length;G++){let Q=X[G];if((Q==='"'||Q==="'")&&(G===0||X[G-1]!=="\\"))if(!Y)Y=!0,J=Q;else if(Q===J)Y=!1;else Z+=Q;else if(Q===","&&!Y)$.push(Z.trim()),Z="";else Z+=Q}if(Z.trim())$.push(Z.trim());return $.map((G)=>{let Q=G.trim();if(Q.startsWith('"')&&Q.endsWith('"')||Q.startsWith("'")&&Q.endsWith("'"))return Q.substring(1,Q.length-1);return Q})}var yY=E(()=>{T1();g5()});function K5(X,$){if(typeof X!=="string"||X.length===0)throw Error(`@appearanceBootstrap ${$} must be a non-empty string`)}function qB(X){if(!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap expects an options object");let $=X,Z=$.appearance,Y=$.colorMode;if(K5($.storageKey,"storageKey"),!Z||typeof Z!=="object"||Array.isArray(Z))throw Error("@appearanceBootstrap appearance must be an object");if(!Y||typeof Y!=="object"||Array.isArray(Y))throw Error("@appearanceBootstrap colorMode must be an object");if(K5(Z.key,"appearance.key"),K5(Z.attribute,"appearance.attribute"),K5(Z.default,"appearance.default"),K5(Y.key,"colorMode.key"),K5(Y.attribute,"colorMode.attribute"),K5(Y.default,"colorMode.default"),!SY.test(Z.key)||!SY.test(Y.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!bY.test(Z.attribute)||!bY.test(Y.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Z.allowed)||Z.allowed.length===0||Z.allowed.some((J)=>typeof J!=="string"||J.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!Z.allowed.includes(Z.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!WB.has(Y.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:$.storageKey,appearance:{key:Z.key,attribute:Z.attribute,allowed:[...new Set(Z.allowed)],default:Z.default},colorMode:{key:Y.key,attribute:Y.attribute,default:Y.default}}}function UB(X){return JSON.stringify(X).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function KB(X){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${UB(X)};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 zB(X,$){let Z=1,Y=null,J=!1;for(let G=$+1;G<X.length;G++){let Q=X[G];if(J){J=!1;continue}if(Y){if(Q==="\\")J=!0;else if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}if(Q==="(")Z++;else if(Q===")"&&--Z===0)return G}return-1}function CY(X,$){let Z=X,Y=/@appearanceBootstrap\s*\(/g,J;while((J=Y.exec(Z))!==null){let G=J.index+J[0].length-1,Q=zB(Z,G);if(Q===-1)throw Error("@appearanceBootstrap has an unclosed options object");let w=Z.slice(G+1,Q).trim(),W=Q0(`(${w})`,$),q=KB(qB(W));Z=Z.slice(0,J.index)+q+Z.slice(Q+1),Y.lastIndex=J.index+q.length}return Z}var bY,SY,WB;var PY=E(()=>{M0();bY=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,SY=/^[A-Za-z_$][\w$]*$/,WB=new Set(["light","dark","system"])});var f9={};a(f9,{useTitle:()=>LB,useSeoMeta:()=>vY,usePageTitle:()=>LB,useHead:()=>x9,seoMetaToHeadConfig:()=>eX,resetHead:()=>_B,renderHtmlAttrs:()=>FB,renderHead:()=>OB,renderBodyAttrs:()=>VB,processTitleDirective:()=>MB,processMetaDirective:()=>TB,processHeadDirective:()=>RB,mergeHeadConfigs:()=>m1,getPageMeta:()=>jB,getHead:()=>v9,definePageMeta:()=>HB,applyHead:()=>AB});function v9(){return d1}function jB(){return tX}function _B(){d1={},BB.length=0,tX={}}function x9(X){d1=m1(d1,X)}function m1(X,$){return{title:$.title??X.title,titleTemplate:$.titleTemplate??X.titleTemplate,base:$.base??X.base,meta:[...X.meta||[],...$.meta||[]],link:[...X.link||[],...$.link||[]],script:[...X.script||[],...$.script||[]],style:[...X.style||[],...$.style||[]],htmlAttrs:{...X.htmlAttrs,...$.htmlAttrs},bodyAttrs:{...X.bodyAttrs,...$.bodyAttrs}}}function vY(X){x9(eX(X))}function eX(X){let $=[];if(X.description)$.push({name:"description",content:X.description});if(X.keywords){let W=Array.isArray(X.keywords)?X.keywords.join(", "):X.keywords;$.push({name:"keywords",content:W})}if(X.author)$.push({name:"author",content:X.author});if(X.robots)$.push({name:"robots",content:X.robots});let Z=X.ogTitle??X.title,Y=X.ogDescription??X.description;if(Z)$.push({property:"og:title",content:Z});if(Y)$.push({property:"og:description",content:Y});if(X.ogImage)$.push({property:"og:image",content:X.ogImage});if(X.ogUrl)$.push({property:"og:url",content:X.ogUrl});if(X.ogType)$.push({property:"og:type",content:X.ogType});if(X.ogSiteName)$.push({property:"og:site_name",content:X.ogSiteName});if(X.ogLocale)$.push({property:"og:locale",content:X.ogLocale});let J=X.twitterTitle??X.title,G=X.twitterDescription??X.description,Q=X.twitterImage??X.ogImage;if(X.twitterCard)$.push({name:"twitter:card",content:X.twitterCard});if(J)$.push({name:"twitter:title",content:J});if(G)$.push({name:"twitter:description",content:G});if(Q)$.push({name:"twitter:image",content:Q});if(X.twitterSite)$.push({name:"twitter:site",content:X.twitterSite});if(X.twitterCreator)$.push({name:"twitter:creator",content:X.twitterCreator});if(X.articleAuthor)$.push({property:"article:author",content:X.articleAuthor});if(X.articlePublishedTime)$.push({property:"article:published_time",content:X.articlePublishedTime});if(X.articleModifiedTime)$.push({property:"article:modified_time",content:X.articleModifiedTime});if(X.articleSection)$.push({property:"article:section",content:X.articleSection});if(X.articleTags)for(let W of X.articleTags)$.push({property:"article:tag",content:W});let w=[];if(X.canonical)w.push({rel:"canonical",href:X.canonical});return{title:X.title,titleTemplate:X.titleTemplate,meta:$,link:w}}function HB(X){if(tX={...tX,...X},X.title||X.description)vY({title:X.title,description:X.description})}function LB(X){let $=typeof X==="function"?X():X;x9({title:$})}function OB(X=d1){let $=[];if(X.title){let Z=X.title;if(X.titleTemplate)Z=typeof X.titleTemplate==="function"?X.titleTemplate(Z):X.titleTemplate.replace("%s",Z);$.push(`<title>${z5(Z)}</title>`)}if(X.base){let Z=Object.entries(X.base).map(([Y,J])=>`${Y}="${z5(J)}"`).join(" ");$.push(`<base ${Z}>`)}for(let Z of X.meta||[]){let Y=Object.entries(Z).filter(([J,G])=>G!==void 0).map(([J,G])=>{return`${J==="httpEquiv"?"http-equiv":J}="${z5(String(G))}"`}).join(" ");$.push(`<meta ${Y}>`)}for(let Z of X.link||[]){let Y=Object.entries(Z).filter(([J,G])=>G!==void 0).map(([J,G])=>`${J}="${z5(String(G))}"`).join(" ");$.push(`<link ${Y}>`)}for(let Z of X.script||[]){let{content:Y,...J}=Z,G=Object.entries(J).filter(([Q,w])=>w!==void 0).map(([Q,w])=>{if(typeof w==="boolean")return w?Q:"";return`${Q}="${z5(String(w))}"`}).filter(Boolean).join(" ");if(Y)$.push(`<script ${G}>${Y}</script>`);else $.push(`<script ${G}></script>`)}for(let Z of X.style||[]){let Y=Z.type?` type="${Z.type}"`:"";$.push(`<style${Y}>${Z.content}</style>`)}return $.join(`
|
|
3357
|
+
`)}function FB(X=d1){if(!X.htmlAttrs)return"";return Object.entries(X.htmlAttrs).map(([$,Z])=>`${$}="${z5(Z)}"`).join(" ")}function VB(X=d1){if(!X.bodyAttrs)return"";return Object.entries(X.bodyAttrs).map(([$,Z])=>`${$}="${z5(Z)}"`).join(" ")}function z5(X){return X.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function AB(X=d1){if(typeof document>"u")return;if(X.title){let $=X.title;if(X.titleTemplate)$=typeof X.titleTemplate==="function"?X.titleTemplate($):X.titleTemplate.replace("%s",$);document.title=$}for(let $ of X.meta||[]){let Z=$.name?`meta[name="${$.name}"]`:$.property?`meta[property="${$.property}"]`:null;if(Z){let Y=document.querySelector(Z);if(!Y){if(Y=document.createElement("meta"),$.name)Y.setAttribute("name",$.name);if($.property)Y.setAttribute("property",$.property);document.head.appendChild(Y)}Y.setAttribute("content",$.content)}}for(let $ of X.link||[]){let Z=`link[rel="${$.rel}"]${$.href?`[href="${$.href}"]`:""}`,Y=document.querySelector(Z);if(!Y)Y=document.createElement("link"),document.head.appendChild(Y);for(let[J,G]of Object.entries($))if(G!==void 0)Y.setAttribute(J,String(G))}if(X.htmlAttrs)for(let[$,Z]of Object.entries(X.htmlAttrs))if($==="class")for(let Y of String(Z).split(/\s+/).filter(Boolean))document.documentElement.classList.add(Y);else document.documentElement.setAttribute($,Z);if(X.bodyAttrs)for(let[$,Z]of Object.entries(X.bodyAttrs))document.body.setAttribute($,Z)}function RB(X){let $="";return{content:X.replace(/@head\s*([\s\S]*?)@endhead/g,(Y,J)=>{return $+=J.trim()+`
|
|
3358
|
+
`,""}),headContent:$.trim()}}function MB(X,$){return X.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Z,Y,J,G)=>{let Q=Y?J:$[(G||"").trim()]??G,w=$.__stx_runtime_head??{};return $.__stx_runtime_head=m1(w,{title:Q}),""})}function TB(X,$){return X.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Z,Y,J,G,Q,w)=>{let W=G?Q:w,q=G?W:$[(W||"").trim()]??W,K=J.includes(":")?{property:J,content:q}:{name:J,content:q},z=$.__stx_runtime_head??{};return $.__stx_runtime_head=m1(z,{meta:[K]}),""})}var d1,BB,tX;var d5=E(()=>{d1={},BB=[],tX={}});import NB from"crypto";function V0(X){return String(X??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function X8(X,$,Z,Y){let J=X||$;return Z?`${J} ${Y}`:J}function t0(X){return String(X).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function m5(X,$){if(/\bid\s*=/i.test(X))return"";return` id="${V0($)}"`}function g9(X,$,Z){if(!$)return"";let Y="";if(!/\baria-invalid\s*=/i.test(Z))Y+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(Z))Y+=` aria-describedby="${V0(`${t0(X)}-error`)}"`;return Y}function kB(){return NB.randomUUID()}function $8(X,$){let Z=X;return Z=Z.replace(/@csrf/g,()=>{if(!$.csrf||typeof $.csrf!=="object"){let Y=kB();$.csrf={token:Y}}if($.csrf.field)return $.csrf.field;if($.csrf.token)return`<input type="hidden" name="_token" value="${V0($.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Z=Z.replace(/@method\(['"]([^'"]+)['"]\)/g,(Y,J)=>{let G=J.toUpperCase();if(J&&!["GET","POST"].includes(G))return`<input type="hidden" name="_method" value="${V0(G)}">`;return Y}),Z}function gY(X,$,Z=fY){let Y=X;return Y=Y.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(J,G,Q,w,W,q="")=>{let U=G||Q||"POST",K=w||W||"",z=l1(q),j=U.toUpperCase(),B=["GET","POST"].includes(j)?j:"POST",_=`<form method="${V0(B)}" action="${V0(K)}"${z?` ${z}`:""}>`;if(_+=`
|
|
3359
3359
|
${$8("@csrf",$)}`,!["GET","POST"].includes(j))_+=`
|
|
3360
|
-
${$8(`@method('${j}')`,$)}`;return _}),Y=Y.replace(/@endform/g,"</form>"),Y=Y.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(J,G,Q,w,W,q="")=>{let U=G||Q||"",K=w||W||"",z=
|
|
3361
|
-
`),Y=[{obj:$,indent:-1}];for(let J of Z){let G=J.replace(/#.*$/,"").trimEnd();if(!G.trim())continue;let Q=G.search(/\S/);if(Q===-1)continue;while(Y.length>1&&Y[Y.length-1].indent>=Q)Y.pop();let w=Y[Y.length-1].obj,W=G.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(W){let[,,q,U]=W,K=q.trim(),z=U.trim();if(z==="")w[K]={},Y.push({obj:w[K],indent:Q});else w[K]=CB(z)}}return $}function CB(X){if(X.startsWith("'")&&X.endsWith("'")||X.startsWith('"')&&X.endsWith('"'))return X.slice(1,-1);let $=X.toLowerCase();if($==="true"||$==="yes")return!0;if($==="false"||$==="no")return!1;if($==="null"||$==="~")return null;let Z=Number(X);if(!Number.isNaN(Z)&&X!=="")return Z;return X}function PB(X){switch(X){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function vB(X,$){return DB(X,$)}function xB(X,$){for(let Z of X){let Y=Z.trim(),J=Y.match(/^\{(\d+)\}\s*(.*)$/);if(J){let Q=Number.parseInt(J[1],10);if($===Q)return J[2];continue}let G=Y.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(G){let Q=Number.parseInt(G[1],10),w=G[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(G[2],10);if($>=Q&&$<=w)return G[3];continue}}if(X.length===2)return $===1?X[0].trim():X[1].trim();if($<X.length)return X[$].trim();return X[X.length-1].trim()}function fB(X,$={}){return lY(X,$)}function lY(X,$){let Z="",Y=0;while(Y<X.length)if(X[Y]==="{"){let J=gB(X,Y);if(J===-1){Z+=X[Y],Y++;continue}let G=X.slice(Y+1,J);Z+=hB(G,$),Y=J+1}else if(X[Y]==="'"&&Y+1<X.length)if(X[Y+1]==="'")Z+="'",Y+=2;else if(X[Y+1]==="{"||X[Y+1]==="}")Z+=X[Y+1],Y+=2;else Z+=X[Y],Y++;else Z+=X[Y],Y++;return Z}function gB(X,$){let Z=0;for(let Y=$;Y<X.length;Y++)if(X[Y]==="{")Z++;else if(X[Y]==="}"){if(Z--,Z===0)return Y}return-1}function hB(X,$){let Z=uB(X);if(Z.length===0)return`{${X}}`;let Y=Z[0].trim(),J=$[Y];if(Z.length===1)return J!==void 0?String(J):`{${Y}}`;switch(Z[1].trim().toLowerCase()){case"plural":return dB(J,Z.slice(2).join(","),$);case"select":return lB(J,Z.slice(2).join(","));case"selectordinal":return cB(J,Z.slice(2).join(","));case"number":return iB(J,Z[2]?.trim());case"date":return nB(J,Z[2]?.trim());case"time":return rB(J,Z[2]?.trim());default:return J!==void 0?String(J):`{${X}}`}}function uB(X){let $=[],Z="",Y=0;for(let J=0;J<X.length;J++){let G=X[J];if(G==="{")Y++,Z+=G;else if(G==="}")Y--,Z+=G;else if(G===","&&Y===0)$.push(Z),Z="";else Z+=G}if(Z)$.push(Z);return $}function dB(X,$,Z){let Y=Number(X)||0,J=p9($),G=`=${Y}`;if(J[G])return u9(J[G],Y,Z);let Q=mB(Y);if(J[Q])return u9(J[Q],Y,Z);if(J.other)return u9(J.other,Y,Z);return String(Y)}function u9(X,$,Z){let Y=X.replace(/#/g,String($));return lY(Y,Z)}function mB(X){let $=Math.abs(X),Z=Math.floor($),Y=String(X).includes(".")?String(X).split(".")[1].length:0;if(Z===1&&Y===0)return"one";return"other"}function lB(X,$){let Z=String(X||""),Y=p9($);if(Y[Z])return Y[Z];return Y.other||String(X)}function cB(X,$){let Z=Number(X)||0,Y=p9($),J=pB(Z);if(Y[J])return Y[J].replace(/#/g,String(Z));if(Y.other)return Y.other.replace(/#/g,String(Z));return String(Z)}function pB(X){let $=Math.abs(X),Z=$%10,Y=$%100;if(Z===1&&Y!==11)return"one";if(Z===2&&Y!==12)return"two";if(Z===3&&Y!==13)return"few";return"other"}function p9(X){let $={},Z=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,Y=Z.exec(X);while(Y!==null)$[Y[1]]=Y[2],Y=Z.exec(X);return $}function iB(X,$){let Z=Number(X);if(Number.isNaN(Z))return String(X);switch($){case"integer":return Math.floor(Z).toLocaleString();case"percent":return`${(Z*100).toFixed(0)}%`;case"currency":return Z.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Z.toLocaleString()}}function nB(X,$){let Z=X instanceof Date?X:new Date(String(X));if(Number.isNaN(Z.getTime()))return String(X);let Y={};switch($){case"short":Y.dateStyle="short";break;case"medium":Y.dateStyle="medium";break;case"long":Y.dateStyle="long";break;case"full":Y.dateStyle="full";break;default:Y.dateStyle="medium"}return Z.toLocaleDateString(void 0,Y)}function rB(X,$){let Z=X instanceof Date?X:new Date(String(X));if(Number.isNaN(Z.getTime()))return String(X);let Y={};switch($){case"short":Y.timeStyle="short";break;case"medium":Y.timeStyle="medium";break;case"long":Y.timeStyle="long";break;case"full":Y.timeStyle="full";break;default:Y.timeStyle="short"}return Z.toLocaleTimeString(void 0,Y)}function sB(X){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(X)}function dY(X,$,Z=!0,Y={}){let J=X.split("."),G=$;for(let w of J){if(G===void 0||G===null)break;G=G[w]}if(G===void 0||G===null)return Z?X:"";let Q=String(G);if(sB(Q))return fB(Q,Y);if(Q.includes("|")&&"count"in Y){let w=Number(Y.count),W=Q.split("|");Q=xB(W,w)}for(let[w,W]of Object.entries(Y)){let q=w.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Q=Q.replace(new RegExp(`:${q}`,"g"),String(W))}return Q}async function cY(X,$,Z,Y){let J=X,G=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,Q={...c9,...Y.i18n},w=await vB(Q.locale,Y);$.__translations=w,$.__locale=Q.locale,$.__i18nConfig=Q,J=await mY(J,G,async(U,K,z,j,B)=>{try{let _={};if(z)try{let O=[()=>JSON.parse(z),()=>{let L=`{"data":${z}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return
|
|
3360
|
+
${$8(`@method('${j}')`,$)}`;return _}),Y=Y.replace(/@endform/g,"</form>"),Y=Y.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(J,G,Q,w,W,q="")=>{let U=G||Q||"",K=w||W||"",z=l1(q),j=i7(U,$),B=j!==void 0&&j!==null?j:K||"",_=z.match(/type=['"]([^'"]+)['"]/i),H=_?_[1]:"text",O=n7(U,$),L=z.match(/class=['"]([^'"]+)['"]/i),F=X8(L?L[1]:"",Z.input,O,Z.inputError),V=z.replace(/class=['"][^'"]+['"]/i,"");return V=V.replace(/type=['"][^'"]+['"]/i,""),`<input type="${V0(H)}" name="${V0(U)}"${m5(z,t0(U))} value="${V0(B)}" class="${F}"${g9(U,O,z)}${V?` ${V}`:""}>`}),Y=Y.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(J,G,Q="",w="")=>{let W=l1(Q),q=i7(G,$)||w.trim(),U=n7(G,$),K=W.match(/class=['"]([^'"]+)['"]/i),z=X8(K?K[1]:"",Z.input,U,Z.inputError),j=W.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${V0(G)}"${m5(W,t0(G))} class="${z}"${g9(G,U,W)}${j?` ${j}`:""}>${V0(q)}</textarea>`}),Y=Y.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(J,G,Q="",w)=>{let W=l1(Q),q=i7(G,$),U=n7(G,$),K=W.match(/class=['"]([^'"]+)['"]/i),z=X8(K?K[1]:"",Z.input,U,Z.inputError),j=W.replace(/class=['"][^'"]+['"]/i,""),B=w;if(q!==void 0)B=w.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(_,H,O)=>{if((Array.isArray(q)?q.some((F)=>String(F)===O):String(q)===O)&&!H.includes("selected"))return H.replace(/(<option)/,"$1 selected");return _});return`<select name="${V0(G)}"${m5(W,t0(G))} class="${z}"${g9(G,U,W)}${j?` ${j}`:""}>${B}</select>`}),Y=Y.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(J,G,Q,w="")=>{let W=Q===void 0?"1":Q,q=Q===void 0?t0(G):`${t0(G)}-${t0(W)}`,U=l1(w),K=i7(G,$),z=K!==void 0&&(Array.isArray(K)?K.some((H)=>String(H)===W):K===!0||String(K)===W),j=U.match(/class=['"]([^'"]+)['"]/i),B=j?j[1]:Z.checkInput,_=U.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${V0(G)}"${m5(U,q)} value="${V0(W)}" class="${B}"${z?" checked":""}${_?` ${_}`:""}>`}),Y=Y.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,G,Q,w="")=>{let W=l1(w),q=i7(G,$),U=q!==void 0&&q===Q,K=W.match(/class=['"]([^'"]+)['"]/i),z=K?K[1]:Z.checkInput,j=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${V0(G)}"${m5(W,`${t0(G)}-${t0(Q)}`)} value="${V0(Q)}" class="${z}"${U?" checked":""}${j?` ${j}`:""}>`}),Y=Y.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,G,Q="")=>{let w=l1(Q),W=w.match(/accept=['"]([^'"]+)['"]/i),q=W?W[1]:"",U=w.includes("multiple"),K=n7(G,$),z=w.match(/class=['"]([^'"]+)['"]/i),j=X8(z?z[1]:"",Z.input,K,Z.inputError),B=w.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),_=[`<input type="file" name="${V0(G)}"${m5(w,t0(G))}`,`class="${j}"`];if(q)_.push(`accept="${V0(q)}"`);if(U)_.push("multiple");if(B)_.push(B);return`${_.join(" ")}>`}),Y=Y.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(J,G,Q="",w)=>{let W=l1(Q),q=W.match(/class=['"]([^'"]+)['"]/i),U=q?q[1]:Z.label,K=W.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${V0(t0(G))}" class="${U}"${K?` ${K}`:""}>${w}</label>`}),Y}function hY(X,$,Z=fY){return X.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(Y,J,G)=>{try{if(n7(J,$)){let Q=G.replace(/\{\{([^}]+)\}\}/g,(w,W)=>{try{if(W.trim()==="$message"||W.trim()==="message")return xY(J,$);if(W.trim().includes("errors.first")||W.trim().includes("$errors.first")){if(typeof $.errors?.first==="function")return $.errors.first(J);return xY(J,$)}let q=W.trim();if(U0(q)){let U=Q0(q,$);return U!==void 0?String(U):q}return q}catch{return W}});return`<div id="${V0(`${t0(J)}-error`)}" role="alert">${Q}</div>`}return""}catch(Q){return console.error("Error processing @error directive:",Q),Y}})}function n7(X,$){if(!$.errors)return!1;if(typeof $.errors.has==="function")return $.errors.has(X);if(typeof $.errors==="object")return Object.prototype.hasOwnProperty.call($.errors,X);return!1}function xY(X,$){if(!$.errors)return"";if(typeof $.errors.get==="function")return $.errors.get(X);if(typeof $.errors==="object"&&Object.prototype.hasOwnProperty.call($.errors,X)){let Z=$.errors[X];return Array.isArray(Z)?Z[0]:String(Z)}return""}function i7(X,$){let Z;if($.old&&typeof $.old==="function")return $.old(X);if($.old&&typeof $.old==="object")return $.old[X];if(X.endsWith("[]")){let Y=X.slice(0,-2);if(Z=$[Y],Z!==void 0)return Z}return $[X]}function l1(X){if(!X.trim())return"";let $=[],Z=X.trim(),Y=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,J;while((J=Y.exec(Z))!==null){let[,G,,Q]=J;$.push(`${G}="${Q.trim()}"`)}return $.join(" ")}var fY;var uY=E(()=>{M0();fY={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import d9 from"path";async function IB(){if(r7!==void 0)return r7;try{r7=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{r7=null}return r7}function EB(X,$=0){if($<=0)return!1;return Date.now()-X.loadedAt>$}async function DB(X,$){if({...c9,...$.i18n}.cache&&m9[X]){let J=m9[X],G=$.i18n?.cacheMaxAge??0;if(!EB(J,G))return J.translations}if(s7[X]?.state==="loading")return s7[X].promise;h9[X]="loading";let Y=l9(X,$).then((J)=>{return h9[X]="loaded",delete s7[X],J}).catch((J)=>{throw h9[X]="error",s7[X]={promise:Y,state:"error",error:J instanceof Error?J:Error(String(J))},J});return s7[X]={promise:Y,state:"loading"},Y}async function l9(X,$){let Z={...c9,...$.i18n},Y=d9.isAbsolute(Z.translationsDir)?Z.translationsDir:d9.resolve($.root||process.cwd(),Z.translationsDir);try{let J=await IB(),G=J?await J(X,{translationsDir:Y,defaultLocale:Z.defaultLocale,sources:PB(Z.format)}):await yB(X,Z,Y);if(G===void 0){if(X!==Z.defaultLocale)return l9(Z.defaultLocale,$);return{}}let Q=G;if(Z.cache)m9[X]={translations:Q,loadedAt:Date.now(),locale:X};return Q}catch(J){if($.debug)console.error(`Error loading translation file for locale "${X}":`,J);if(X!==Z.defaultLocale)return l9(Z.defaultLocale,$);return{}}}async function yB(X,$,Z){let Y=d9.join(Z,`${X}${bB($.format)}`);try{let J=await import(Y);return J.default||J}catch(J){try{let G=await Bun.file(Y).text();if($.format==="yaml"||$.format==="yml")return SB(G);if($.format==="json")return JSON.parse(G);throw J}catch{return}}}function bB(X){switch(X){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function SB(X){let $={},Z=X.split(`
|
|
3361
|
+
`),Y=[{obj:$,indent:-1}];for(let J of Z){let G=J.replace(/#.*$/,"").trimEnd();if(!G.trim())continue;let Q=G.search(/\S/);if(Q===-1)continue;while(Y.length>1&&Y[Y.length-1].indent>=Q)Y.pop();let w=Y[Y.length-1].obj,W=G.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(W){let[,,q,U]=W,K=q.trim(),z=U.trim();if(z==="")w[K]={},Y.push({obj:w[K],indent:Q});else w[K]=CB(z)}}return $}function CB(X){if(X.startsWith("'")&&X.endsWith("'")||X.startsWith('"')&&X.endsWith('"'))return X.slice(1,-1);let $=X.toLowerCase();if($==="true"||$==="yes")return!0;if($==="false"||$==="no")return!1;if($==="null"||$==="~")return null;let Z=Number(X);if(!Number.isNaN(Z)&&X!=="")return Z;return X}function PB(X){switch(X){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function vB(X,$){return DB(X,$)}function xB(X,$){for(let Z of X){let Y=Z.trim(),J=Y.match(/^\{(\d+)\}\s*(.*)$/);if(J){let Q=Number.parseInt(J[1],10);if($===Q)return J[2];continue}let G=Y.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(G){let Q=Number.parseInt(G[1],10),w=G[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(G[2],10);if($>=Q&&$<=w)return G[3];continue}}if(X.length===2)return $===1?X[0].trim():X[1].trim();if($<X.length)return X[$].trim();return X[X.length-1].trim()}function fB(X,$={}){return lY(X,$)}function lY(X,$){let Z="",Y=0;while(Y<X.length)if(X[Y]==="{"){let J=gB(X,Y);if(J===-1){Z+=X[Y],Y++;continue}let G=X.slice(Y+1,J);Z+=hB(G,$),Y=J+1}else if(X[Y]==="'"&&Y+1<X.length)if(X[Y+1]==="'")Z+="'",Y+=2;else if(X[Y+1]==="{"||X[Y+1]==="}")Z+=X[Y+1],Y+=2;else Z+=X[Y],Y++;else Z+=X[Y],Y++;return Z}function gB(X,$){let Z=0;for(let Y=$;Y<X.length;Y++)if(X[Y]==="{")Z++;else if(X[Y]==="}"){if(Z--,Z===0)return Y}return-1}function hB(X,$){let Z=uB(X);if(Z.length===0)return`{${X}}`;let Y=Z[0].trim(),J=$[Y];if(Z.length===1)return J!==void 0?String(J):`{${Y}}`;switch(Z[1].trim().toLowerCase()){case"plural":return dB(J,Z.slice(2).join(","),$);case"select":return lB(J,Z.slice(2).join(","));case"selectordinal":return cB(J,Z.slice(2).join(","));case"number":return iB(J,Z[2]?.trim());case"date":return nB(J,Z[2]?.trim());case"time":return rB(J,Z[2]?.trim());default:return J!==void 0?String(J):`{${X}}`}}function uB(X){let $=[],Z="",Y=0;for(let J=0;J<X.length;J++){let G=X[J];if(G==="{")Y++,Z+=G;else if(G==="}")Y--,Z+=G;else if(G===","&&Y===0)$.push(Z),Z="";else Z+=G}if(Z)$.push(Z);return $}function dB(X,$,Z){let Y=Number(X)||0,J=p9($),G=`=${Y}`;if(J[G])return u9(J[G],Y,Z);let Q=mB(Y);if(J[Q])return u9(J[Q],Y,Z);if(J.other)return u9(J.other,Y,Z);return String(Y)}function u9(X,$,Z){let Y=X.replace(/#/g,String($));return lY(Y,Z)}function mB(X){let $=Math.abs(X),Z=Math.floor($),Y=String(X).includes(".")?String(X).split(".")[1].length:0;if(Z===1&&Y===0)return"one";return"other"}function lB(X,$){let Z=String(X||""),Y=p9($);if(Y[Z])return Y[Z];return Y.other||String(X)}function cB(X,$){let Z=Number(X)||0,Y=p9($),J=pB(Z);if(Y[J])return Y[J].replace(/#/g,String(Z));if(Y.other)return Y.other.replace(/#/g,String(Z));return String(Z)}function pB(X){let $=Math.abs(X),Z=$%10,Y=$%100;if(Z===1&&Y!==11)return"one";if(Z===2&&Y!==12)return"two";if(Z===3&&Y!==13)return"few";return"other"}function p9(X){let $={},Z=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,Y=Z.exec(X);while(Y!==null)$[Y[1]]=Y[2],Y=Z.exec(X);return $}function iB(X,$){let Z=Number(X);if(Number.isNaN(Z))return String(X);switch($){case"integer":return Math.floor(Z).toLocaleString();case"percent":return`${(Z*100).toFixed(0)}%`;case"currency":return Z.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Z.toLocaleString()}}function nB(X,$){let Z=X instanceof Date?X:new Date(String(X));if(Number.isNaN(Z.getTime()))return String(X);let Y={};switch($){case"short":Y.dateStyle="short";break;case"medium":Y.dateStyle="medium";break;case"long":Y.dateStyle="long";break;case"full":Y.dateStyle="full";break;default:Y.dateStyle="medium"}return Z.toLocaleDateString(void 0,Y)}function rB(X,$){let Z=X instanceof Date?X:new Date(String(X));if(Number.isNaN(Z.getTime()))return String(X);let Y={};switch($){case"short":Y.timeStyle="short";break;case"medium":Y.timeStyle="medium";break;case"long":Y.timeStyle="long";break;case"full":Y.timeStyle="full";break;default:Y.timeStyle="short"}return Z.toLocaleTimeString(void 0,Y)}function sB(X){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(X)}function dY(X,$,Z=!0,Y={}){let J=X.split("."),G=$;for(let w of J){if(G===void 0||G===null)break;G=G[w]}if(G===void 0||G===null)return Z?X:"";let Q=String(G);if(sB(Q))return fB(Q,Y);if(Q.includes("|")&&"count"in Y){let w=Number(Y.count),W=Q.split("|");Q=xB(W,w)}for(let[w,W]of Object.entries(Y)){let q=w.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Q=Q.replace(new RegExp(`:${q}`,"g"),String(W))}return Q}async function cY(X,$,Z,Y){let J=X,G=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,Q={...c9,...Y.i18n},w=await vB(Q.locale,Y);$.__translations=w,$.__locale=Q.locale,$.__i18nConfig=Q,J=await mY(J,G,async(U,K,z,j,B)=>{try{let _={};if(z)try{let O=[()=>JSON.parse(z),()=>{let L=`{"data":${z}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return R0(z,$)}];for(let L of O)try{if(_=L(),Object.keys(_).length>0)break}catch{}}catch(O){if(Y.debug)console.error("Error parsing parameters for @translate directive:",O)}return dY(K,w,Q.fallbackToKey,_)||j.trim()}catch(_){if(Y.debug)console.error("Error processing @translate directive:",_);return J0("Translate",`Error in @translate('${K}'): ${_ instanceof Error?_.message:String(_)}`,s.EVALUATION_ERROR)}});let W=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(Y.debug){console.warn(`Processing translations in template. Sections: ${J.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let U=[...J.matchAll(W)];console.warn(`Found ${U.length} @translate matches`),U.forEach((K,z)=>console.warn(`Match ${z}: ${K[0]}, Key: ${K[1]}, Params: ${K[2]||"none"}`))}return J=await mY(J,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(U,K,z,j)=>{try{let B={};if(z)try{let _=[()=>JSON.parse(z),()=>{let H=`{"data":${z}}`,O=JSON.parse(H);return typeof O.data==="object"?O.data:{}},()=>{return R0(z,$)}];for(let H of _)try{if(B=H(),Object.keys(B).length>0)break}catch{}}catch(_){if(Y.debug)console.error("Error parsing parameters for @translate directive:",_)}return dY(K,w,Q.fallbackToKey,B)}catch(B){if(Y.debug)console.error("Error processing @translate directive:",B);return J0("Translate",`Error in @translate('${K}'): ${B instanceof Error?B.message:String(B)}`,s.EVALUATION_ERROR)}}),J}async function mY(X,$,Z){let Y=[];return X.replace($,(G,...Q)=>{let w=Z(G,...Q).then((W)=>({match:G,replacement:W}));return Y.push(w),G}),(await Promise.all(Y)).reduce((G,{match:Q,replacement:w})=>G.replace(Q,w),X)}var r7,c9,m9,s7,h9;var pY=E(()=>{T1();M0();c9={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},m9={},s7={},h9={}});function aB(X){let $=X.replace(/^<template\b/i,"").replace(/>$/,"");return oB.test($)}function l5(X){o7.lastIndex=0;let $;while(($=o7.exec(X))!==null){if($[0].startsWith("</")||aB($[0]))continue;let Z=$.index,Y=o7.lastIndex,J=1,G;while((G=o7.exec(X))!==null)if(G[0].startsWith("</")){if(J--,J===0){let Q=G.index;return{start:Z,openEnd:Y,closeStart:Q,end:o7.lastIndex,content:X.slice(Y,Q)}}}else J++;return null}return null}var o7,oB;var Z8=E(()=>{o7=/<\/?template\b[^>]*>/gi,oB=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var r9={};a(r9,{streamingSuspenseDirective:()=>rY,streamToResponse:()=>qj,streamTemplateSimple:()=>Gj,streamTemplate:()=>eB,renderStreamingPage:()=>$j,registerStreamingDirectives:()=>wj,processStreamDirectives:()=>Yj,processSectionDirectives:()=>Wj,islandDirective:()=>sY,generateHydrationRuntime:()=>Uj,extractStreamBoundaries:()=>Jj,createStreamRenderer:()=>Qj,buildSuspenseResolveScript:()=>n9,SUSPENSE_RESOLVER_RUNTIME:()=>nY});import Y8 from"path";function tB(X){let $=[],Z=0,Y;iY.lastIndex=0;while((Y=iY.exec(X))!==null){if(Y.index>Z){let Q=X.slice(Z,Y.index);if(Q.trim())$.push({type:$.length===0?"shell":"content",content:Q})}let J=Y[1],G=Y[2];$.push({type:"suspense",name:J,content:G}),Z=Y.index+Y[0].length}if(Z<X.length){let J=X.slice(Z);if(J.trim())$.push({type:$.length===0?"shell":"content",content:J})}if($.length===0)$.push({type:"shell",content:X});return $}async function eB(X,$={},Z={}){let Y={...I1,...Z,streaming:{...i9,...Z.streaming}},J=Y.streaming?.bufferSize||16384;return new ReadableStream({async start(G){try{let Q=await Bun.file(X).text(),w=Q.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),W=w?w[1]:"",q=Q.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...$,__filename:X,__dirname:Y8.dirname(X)};if(W.trim())await k1(W,U,X);let K=tB(q),z=new Set;if(!K.some((B)=>B.type==="suspense")){let B=Y.streaming?.strategy||"auto",_=new RegExp(B5.source,"g");if(!(B!=="manual"&&_.test(q))){let O=await T0(q,U,X,Y,z);for(let L=0;L<O.length;L+=J)G.enqueue(O.slice(L,L+J)),await new Promise((F)=>setTimeout(F,0))}else{let O=[],L=new RegExp(B5.source,"g"),F;while((F=L.exec(q))!==null)O.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let V=0;for(let A of O){if(A.start>V){let M=q.slice(V,A.start);if(M.trim()){let T=await T0(M,U,X,Y,z);G.enqueue(T),await new Promise((k)=>setTimeout(k,0))}}let R=await T0(A.content,U,X,Y,z);G.enqueue(R),await new Promise((M)=>setTimeout(M,0)),V=A.end}if(V<q.length){let A=q.slice(V);if(A.trim()){let R=await T0(A,U,X,Y,z);G.enqueue(R)}}}}else{let B=new Map;for(let H of K)if(H.type==="shell"||H.type==="content"){let O=await T0(H.content,U,X,Y,z);G.enqueue(O)}else if(H.type==="suspense"&&H.name){let O=`stx-suspense-${H.name}`;G.enqueue(`<div id="${O}" data-suspense="${H.name}" style="display:contents;">
|
|
3362
3362
|
<template data-suspense-fallback>Loading...</template>
|
|
3363
|
-
</div>`),B.set(H.name,
|
|
3363
|
+
</div>`),B.set(H.name,T0(H.content,U,X,Y,z))}G.enqueue(`
|
|
3364
3364
|
<script>
|
|
3365
3365
|
(function() {
|
|
3366
3366
|
window.__stxSuspense = window.__stxSuspense || {
|
|
@@ -3381,8 +3381,8 @@ ${J}`)}function RY(X,$){let Z=X;return Z=Z.replace(/<script(?![^>]*\ssrc=)([^>]*
|
|
|
3381
3381
|
window.__stxSuspense.resolve('${X}', \`${Y}\`);
|
|
3382
3382
|
</script>`}catch(Z){let Y=Z instanceof Error?Z.message:String(Z);return`
|
|
3383
3383
|
<script>
|
|
3384
|
-
window.__stxSuspense.resolve('${X}', '<div class="stx-error">Error loading content: ${
|
|
3385
|
-
</script>`}}function Xj(X,$,Z){if(!$||$<=0)return X;let Y,J=new Promise((G,Q)=>{Y=setTimeout(()=>Q(Error(`streaming boundary "${Z}" timed out after ${$}ms`)),$)});return Promise.race([X,J]).finally(()=>clearTimeout(Y))}function $j(X,$=[],Z={}){let Y=Z.timeoutMs??0;return new ReadableStream({async start(J){try{if(J.enqueue(X),$.length>0)J.enqueue(nY),await Promise.all($.map(async(G)=>{let Q=Xj(G.render(),Y,G.id);J.enqueue(await n9(G.id,Q))}));J.close()}catch(G){J.error(G)}}})}function Yj(X,$){return X.replace(Zj,(Z,Y,J)=>{let G=Y.trim(),Q=J.split(/@fallback/i),w=Q[0].trim(),W=Q.length>1?Q.slice(1).join("@fallback").trim():"";if(!$.__streamTemplates)$.__streamTemplates={};return $.__streamTemplates[G]=w,`<div data-suspense="${G}">${W}</div>`})}function Jj(X){let $=X?.streamBoundaries;if(!$||typeof $!=="object")return;let Z=Object.entries($).filter(([,Y])=>typeof Y==="function");return Z.length>0?Z.map(([Y,J])=>({id:Y,render:J})):void 0}async function Gj(X,$={},Z={}){let Y={...I1,...Z,streaming:{...i9,...Z.streaming}},J=Y.streaming?.bufferSize||16384;return new ReadableStream({async start(G){try{let Q=await Bun.file(X).text(),w=Q.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),W=w?w[1]:"",q=Q.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...$,__filename:X,__dirname:Y8.dirname(X)};if(W.trim())await k1(W,U,X);let K=new Set,z=Y.streaming?.strategy||"auto",j=new RegExp(
|
|
3384
|
+
window.__stxSuspense.resolve('${X}', '<div class="stx-error">Error loading content: ${q1(Y)}</div>');
|
|
3385
|
+
</script>`}}function Xj(X,$,Z){if(!$||$<=0)return X;let Y,J=new Promise((G,Q)=>{Y=setTimeout(()=>Q(Error(`streaming boundary "${Z}" timed out after ${$}ms`)),$)});return Promise.race([X,J]).finally(()=>clearTimeout(Y))}function $j(X,$=[],Z={}){let Y=Z.timeoutMs??0;return new ReadableStream({async start(J){try{if(J.enqueue(X),$.length>0)J.enqueue(nY),await Promise.all($.map(async(G)=>{let Q=Xj(G.render(),Y,G.id);J.enqueue(await n9(G.id,Q))}));J.close()}catch(G){J.error(G)}}})}function Yj(X,$){return X.replace(Zj,(Z,Y,J)=>{let G=Y.trim(),Q=J.split(/@fallback/i),w=Q[0].trim(),W=Q.length>1?Q.slice(1).join("@fallback").trim():"";if(!$.__streamTemplates)$.__streamTemplates={};return $.__streamTemplates[G]=w,`<div data-suspense="${G}">${W}</div>`})}function Jj(X){let $=X?.streamBoundaries;if(!$||typeof $!=="object")return;let Z=Object.entries($).filter(([,Y])=>typeof Y==="function");return Z.length>0?Z.map(([Y,J])=>({id:Y,render:J})):void 0}async function Gj(X,$={},Z={}){let Y={...I1,...Z,streaming:{...i9,...Z.streaming}},J=Y.streaming?.bufferSize||16384;return new ReadableStream({async start(G){try{let Q=await Bun.file(X).text(),w=Q.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),W=w?w[1]:"",q=Q.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...$,__filename:X,__dirname:Y8.dirname(X)};if(W.trim())await k1(W,U,X);let K=new Set,z=Y.streaming?.strategy||"auto",j=new RegExp(B5.source,"g");if(!(z!=="manual"&&j.test(q))){let _=await T0(q,U,X,Y,K);for(let H=0;H<_.length;H+=J)G.enqueue(_.slice(H,H+J))}else{let _=[],H=new RegExp(B5.source,"g"),O;while((O=H.exec(q))!==null)_.push({name:O[1],content:O[2],start:O.index,end:O.index+O[0].length});let L=0;for(let F of _){if(F.start>L){let A=q.slice(L,F.start);if(A.trim()){let R=await T0(A,U,X,Y,K);G.enqueue(R)}}let V=await T0(F.content,U,X,Y,K);G.enqueue(V),L=F.end}if(L<q.length){let F=q.slice(L);if(F.trim()){let V=await T0(F,U,X,Y,K);G.enqueue(V)}}}G.close()}catch(Q){G.error(Q)}}})}async function Qj(X,$={}){let Z={...I1,...$,streaming:{...i9,...$.streaming}},Y=await Bun.file(X).text(),J=Y.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),G=J?J[1]:"",Q=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),w=Q,W={},q;B5.lastIndex=0;while((q=B5.exec(Q))!==null){let z=q[1],j=q[2];W[z]=j}let U=Q.replace(B5,"");return{renderShell:async(z={})=>{let j={...z,__filename:X,__dirname:Y8.dirname(X)};return await k1(G,j,X),T0(U,j,X,Z,new Set)},renderSection:async(z,j={})=>{try{if(!W[z])return`<div class="error-message">Section "${q1(z)}" not found in template "${q1(X)}"</div>`;let B={...j,__filename:X,__dirname:Y8.dirname(X)};await k1(G,B,X);let _=new Set;return await T0(W[z],B,X,Z,_)}catch(B){let _=B instanceof Error?B.message:String(B);return B0("Expression",_,X,W[z]||"",0,W[z]||"")}},getSections:()=>{return Object.keys(W)},getTemplate:()=>{return w}}}function wj(X={}){let $=[];if(X.streaming?.enabled)$.push(rY);if(X.hydration?.enabled)$.push(sY);return $}async function Wj(X,$,Z,Y={}){return X}function qj(X,$={}){let Z=new TextEncoder,Y=X.pipeThrough(new TransformStream({transform(G,Q){Q.enqueue(Z.encode(G))}})),J=new Headers($.headers);if(!J.has("Content-Type"))J.set("Content-Type","text/html; charset=utf-8");if(!J.has("Transfer-Encoding"))J.set("Transfer-Encoding","chunked");if(!J.has("X-Content-Type-Options"))J.set("X-Content-Type-Options","nosniff");if(!J.has("X-Accel-Buffering"))J.set("X-Accel-Buffering","no");return new Response(Y,{...$,headers:J})}function Uj(X={mode:"full"}){let{mode:$,components:Z={},dynamicImports:Y=!0}=X,J=Object.entries(Z).map(([G,Q])=>`'${G}': ${Y?`() => import('${Q}')`:`require('${Q}')`}`).join(`,
|
|
3386
3386
|
`);if($==="loader")return`
|
|
3387
3387
|
(function() {
|
|
3388
3388
|
window.__stx = window.__stx || {};
|
|
@@ -3524,7 +3524,7 @@ else {
|
|
|
3524
3524
|
else {
|
|
3525
3525
|
stx.hydrate();
|
|
3526
3526
|
}
|
|
3527
|
-
})();`}var i9,
|
|
3527
|
+
})();`}var i9,B5,iY,nY=`
|
|
3528
3528
|
<script>
|
|
3529
3529
|
(function(){
|
|
3530
3530
|
window.__stxSuspense = window.__stxSuspense || {
|
|
@@ -3544,25 +3544,25 @@ else {
|
|
|
3544
3544
|
}
|
|
3545
3545
|
};
|
|
3546
3546
|
})();
|
|
3547
|
-
</script>`,Zj,rY,sY;var s9=E(()=>{A1();
|
|
3547
|
+
</script>`,Zj,rY,sY;var s9=E(()=>{A1();U1();J8();H0();i9={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},B5=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,iY=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;Zj=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;rY={name:"suspense",hasEndTag:!0,handler:(X,$,Z,Y)=>{if(!$||$.length===0)throw Error("Suspense directive requires a name parameter");let J=$[0].replace(/['"`]/g,"");return`<!-- @suspense:${J} -->${X}<!-- @endsuspense:${J} -->`}},sY={name:"island",hasEndTag:!0,handler:(X,$,Z,Y)=>{if(!$||$.length===0)throw Error("Island directive requires a name parameter");let J=$[0].replace(/['"`]/g,""),G=$[1]?$[1].replace(/['"`]/g,""):"lazy",Q=`island-${J}-${Math.random().toString(36).substring(2,9)}`,w=X.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),W=w?w[1].trim():"",q=w?X.replace(w[0],""):X;return`<div data-island="${J}" data-island-id="${Q}" data-priority="${G}">
|
|
3548
3548
|
${q}
|
|
3549
3549
|
<script type="application/json" data-island-props="${Q}">
|
|
3550
3550
|
${W?`{${W}}`:"{}"}
|
|
3551
3551
|
</script>
|
|
3552
|
-
</div>`}}});var tY={};
|
|
3553
|
-
`).length;Z.set(W,{count:1,firstLine:K})}}}let Q=[];for(let w of new Set([...Z.keys(),...Y.keys()])){if(zj.has(w.toLowerCase()))continue;let W=Z.get(w)?.count??0,q=Y.get(w)??0;if(W!==q)Q.push({tag:w,opened:W,closed:q,firstOpenLine:Z.get(w)?.firstLine??0})}return Q}function o9(X,$){let Z;try{Z=aY(X)}catch{return}if(Z.length===0)return;let Y=`${$}:${X.length}`;if(oY.has(Y))return;oY.add(Y);let J=$?$.split(/[/\\]/).pop()||$:"template";for(let{tag:G,opened:Q,closed:w,firstOpenLine:W}of Z)if(Q>w){let q=W?` (first opened at line ${W})`:"";console.warn(`[stx] ${J}: <${G}> ${Q} opened, ${w} closed \u2014 an unclosed <${G}>${q} may swallow the content that follows it.`)}else console.warn(`[stx] ${J}: <${G}> ${Q} opened, ${w} closed \u2014 ${w-Q} stray </${G}>.`)}var Kj,zj,oY;var a9=E(()=>{Kj=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),zj=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);oY=new Set});import
|
|
3554
|
-
`}if(F){let b=[];if(U==="avif"||U==="auto"){let y=t7(Y,V,A,j,"avif"),P=R?G4(Y,Y4,j,"avif"):`${y}`;b.push(`<source type="image/avif" srcset="${
|
|
3552
|
+
</div>`}}});var tY={};a(tY,{warnUnbalancedTags:()=>o9,findUnbalancedTags:()=>aY});function c5(X){return X.replace(/[^\n]/g," ")}function aY(X){let $=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,c5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,c5).replace(/<!--[\s\S]*?-->/g,c5).replace(/\{\{\{[\s\S]*?\}\}\}/g,c5).replace(/\{\{[\s\S]*?\}\}/g,c5).replace(/\{!![\s\S]*?!!\}/g,c5),Z=new Map,Y=new Map,J=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,G;while((G=J.exec($))!==null){let w=G[1]==="/",W=G[2],q=G[3]==="/";if(Kj.has(W.toLowerCase()))continue;if(q)continue;if(w)Y.set(W,(Y.get(W)??0)+1);else{let U=Z.get(W);if(U)U.count++;else{let K=$.slice(0,G.index).split(`
|
|
3553
|
+
`).length;Z.set(W,{count:1,firstLine:K})}}}let Q=[];for(let w of new Set([...Z.keys(),...Y.keys()])){if(zj.has(w.toLowerCase()))continue;let W=Z.get(w)?.count??0,q=Y.get(w)??0;if(W!==q)Q.push({tag:w,opened:W,closed:q,firstOpenLine:Z.get(w)?.firstLine??0})}return Q}function o9(X,$){let Z;try{Z=aY(X)}catch{return}if(Z.length===0)return;let Y=`${$}:${X.length}`;if(oY.has(Y))return;oY.add(Y);let J=$?$.split(/[/\\]/).pop()||$:"template";for(let{tag:G,opened:Q,closed:w,firstOpenLine:W}of Z)if(Q>w){let q=W?` (first opened at line ${W})`:"";console.warn(`[stx] ${J}: <${G}> ${Q} opened, ${w} closed \u2014 an unclosed <${G}>${q} may swallow the content that follows it.`)}else console.warn(`[stx] ${J}: <${G}> ${Q} opened, ${w} closed \u2014 ${w-Q} stray </${G}>.`)}var Kj,zj,oY;var a9=E(()=>{Kj=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),zj=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);oY=new Set});import e0 from"path";import t9 from"fs";function eY(X){return X.split("-").map(($)=>$.charAt(0).toUpperCase()+$.slice(1)).join("")}function XJ(X){return X.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class $J{builtins=new Map;registerBuiltin(X){this.builtins.set(X.name.toLowerCase(),X);for(let $ of X.aliases)this.builtins.set($.toLowerCase(),X)}isBuiltin(X){return this.builtins.has(X.toLowerCase())}getBuiltin(X){return this.builtins.get(X.toLowerCase())??null}async resolveFile(X,$,Z,Y){let J=X.endsWith(".stx")?X.slice(0,-4):X,G=Y?.__importedComponents;if(G){let j=[J,J.toLowerCase(),eY(J),XJ(J)];for(let B of j)if(G.has(B))return G.get(B)}let Q=[...new Set([`${J}.stx`,`${eY(J)}.stx`,`${XJ(J)}.stx`])];if(J.startsWith("./")||J.startsWith("../")){let j=e0.resolve(e0.dirname($),`${J}.stx`);if(await r(j))return j;return null}let w=[],W=Z.componentsDir||"",q=Y?.__originalFilePath;if(q)w.push(e0.join(e0.dirname(q),"components"));if(W)w.push(W);let U=e0.join(e0.dirname($),"components");if(!w.includes(U))w.push(U);let K=process.cwd(),z=[e0.resolve(K,"src/components"),e0.resolve(K,"components"),e0.resolve(import.meta.dir,"components")];for(let j of z)if(!w.includes(j))w.push(j);for(let j of w){if(!j)continue;for(let B of Q){let _=e0.join(j,B);if(await r(_))return _}try{if(!t9.statSync(j,{throwIfNoEntry:!1})?.isDirectory())continue;let _=t9.readdirSync(j,{withFileTypes:!0});for(let H of _)if(H.isDirectory()){let O=e0.join(j,H.name);for(let L of Q){let F=e0.join(O,L);if(await r(F))return F}}}catch{}}return null}}var m0;var e9=E(()=>{H0();m0=new $J});function A0(X){return X.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function X4(X){return X.indexOf("\x00")===-1?X:X.replace(/\0/g,"")}var j5="\x00stx-boolean-attribute";function p5(X,$){let Z=[];for(let[Y,J]of Object.entries(X.static)){if($.has(Y))continue;let G=X.staticNames?.[Y]??Y;if(typeof J==="boolean"){if(J)Z.push(A0(G));continue}if(J===j5){Z.push(A0(G));continue}Z.push(`${A0(G)}="${A0(X4(String(J)))}"`)}return Z}function i5(X,$){let Z=[];for(let[Y,J]of Object.entries(X.serverDynamic??{})){if($.has(Y))continue;if(J===null||J===void 0||J===!1)continue;let G=X.serverDynamicNames?.[Y]??Y;if(J===!0){Z.push(A0(G));continue}if(typeof J==="object")continue;Z.push(`${A0(G)}="${A0(X4(String(J)))}"`)}return Z}var G8=()=>{};function a7(X){return X.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Bj(X){if(X.clientReactive.to)return{value:X.clientReactive.to,reactive:!0};if(X.serverDynamic.to!==void 0)return{value:String(X.serverDynamic.to),reactive:!1};if(typeof X.static.to==="string")return{value:X.static.to,reactive:!1};return{value:"#",reactive:!1}}var $4;var Z4=E(()=>{G8();$4={name:"StxLink",aliases:["stx-link"],render(X,$,Z){let Y=Bj(X),J=(typeof X.static.class==="string"?X.static.class:"")||(typeof X.static.className==="string"?X.static.className:""),G=typeof X.static.activeClass==="string"?X.static.activeClass:"active",Q=typeof X.static.exactActiveClass==="string"?X.static.exactActiveClass:"exact-active",w=X.static.prefetch===!0||X.static.prefetch==="true"||X.serverDynamic.prefetch===!0,W=[];if(Y.reactive)W.push(`:href="${a7(Y.value)}"`);else W.push(`href="${a7(Y.value)}"`);if(J)W.push(`class="${a7(J)}"`);if(W.push("data-stx-link"),W.push(`data-stx-active-class="${a7(G)}"`),W.push(`data-stx-exact-active-class="${a7(Q)}"`),w)W.push("data-stx-prefetch");let q=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return W.push(...p5(X,q)),W.push(...i5(X,q)),`<a ${W.join(" ")}>${$}</a>`}}});function y0(X){return X.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function v0(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}function J4(X,$,Z=!1){let Y=X.serverDynamic[$];if(Y!==void 0)return Y!==!1&&Y!=="false";let J=X.static[$];if(J!==void 0)return J!=="false"&&J!==!1;return Z}function ZJ(X){if(X.includes("(")||X.includes(","))return X;let $=X.trim().split(/\s+/),Z=[];for(let Y of $)if(Y.includes(":")){let[J,G]=Y.split(":"),Q=jj[J];if(Q)Z.push(`(max-width: ${Q}px) ${G}`);else{let w=Number.parseInt(J);if(!Number.isNaN(w))Z.push(`(max-width: ${w}px) ${G}`)}}else Z.push(Y);return Z.join(", ")}function G4(X,$,Z,Y){return $.map((J)=>`${t7(X,J,void 0,Z,Y)} ${J}w`).join(", ")}function _j(X,$,Z,Y,J){return $.map((G)=>{let Q=Z?Z*G:void 0;return`${t7(X,Q,void 0,Y,J)} ${G}x`}).join(", ")}function t7(X,$,Z,Y,J){if(!Y||Y==="local"||Y==="static")return X;if(Y==="cloudinary"){let G=[];if($)G.push(`w_${$}`);if(Z)G.push(`h_${Z}`);if(J)G.push(`f_${J}`);G.push("q_auto");let Q=G.join(",");return X.replace("/upload/",`/upload/${Q}/`)}if(Y==="imgix"){let G=new URLSearchParams;if($)G.set("w",String($));if(Z)G.set("h",String(Z));if(J)G.set("fm",J);G.set("auto","format");let Q=X.includes("?")?"&":"?";return`${X}${Q}${G.toString()}`}if(Y==="bunny"){let G=new URLSearchParams;if($)G.set("width",String($));if(Z)G.set("height",String(Z));if(J)G.set("format",J);let Q=X.includes("?")?"&":"?";return`${X}${Q}${G.toString()}`}return X}function Hj(X,$,Z="#e5e7eb"){let Y=`<svg xmlns="http://www.w3.org/2000/svg" width="${X}" height="${$}"><rect width="100%" height="100%" fill="${Z}"/></svg>`;return`data:image/svg+xml;base64,${btoa(Y)}`}var jj,Y4,Q4;var w4=E(()=>{G8();jj={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Y4=[320,640,768,1024,1280,1536,1920];Q4={name:"StxImage",aliases:["stx-image","stx-img"],render(X,$,Z){let Y=v0(X,"src")||"",J=v0(X,"alt")||"",G=v0(X,"width"),Q=v0(X,"height"),w=v0(X,"sizes"),W=v0(X,"srcset"),q=v0(X,"densities"),U=v0(X,"format"),K=v0(X,"placeholder"),z=v0(X,"placeholderColor")||"#e5e7eb",j=v0(X,"provider"),B=v0(X,"class")||v0(X,"className")||"",_=v0(X,"style")||"",H=v0(X,"quality"),O=J4(X,"lazy",!0),L=J4(X,"preload",!1),F=J4(X,"picture",!1)||!!U,V=G?Number.parseInt(G):void 0,A=Q?Number.parseInt(Q):void 0,R=W||"",M="";if(!R&&w)R=G4(Y,Y4,j,U),M=ZJ(w);else if(!R&&q){let b=q.split(/\s+/).map((y)=>Number.parseFloat(y.replace("x","")));R=_j(Y,b,V,j,U)}else if(w)M=ZJ(w);let T=[];if(_)T.push(_);if(V&&A)T.push(`aspect-ratio:${V}/${A}`);if(K==="blur"||K==="color"||K==="thumbhash"){let b=Hj(V||16,A||9,z);T.push(`background-image:url(${b})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(K&&K!=="empty"&&K!=="none")T.push(`background-image:url(${y0(K)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let k=t7(Y,V,A,j,U),I=[];if(I.push(`src="${y0(k)}"`),I.push(`alt="${y0(J)}"`),G)I.push(`width="${y0(G)}"`);if(Q)I.push(`height="${y0(Q)}"`);if(O)I.push('loading="lazy"');if(I.push('decoding="async"'),B)I.push(`class="${y0(B)}"`);if(T.length>0)I.push(`style="${y0(T.join(";"))}"`);if(R)I.push(`srcset="${y0(R)}"`);if(M)I.push(`sizes="${y0(M)}"`);let D=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);I.push(...p5(X,D)),I.push(...i5(X,D));let N=`<img ${I.join(" ")} />`,S="";if(L){let y=U==="webp"?"image/webp":U==="avif"?"image/avif":"";S=`<link rel="preload" as="image" href="${y0(k)}"${y?` type="${y}"`:""}${R?` imagesrcset="${y0(R)}"`:""}${M?` imagesizes="${y0(M)}"`:""} />
|
|
3554
|
+
`}if(F){let b=[];if(U==="avif"||U==="auto"){let y=t7(Y,V,A,j,"avif"),P=R?G4(Y,Y4,j,"avif"):`${y}`;b.push(`<source type="image/avif" srcset="${y0(P)}"${M?` sizes="${y0(M)}"`:""} />`)}if(U==="webp"||U==="auto"){let y=t7(Y,V,A,j,"webp"),P=R?G4(Y,Y4,j,"webp"):`${y}`;b.push(`<source type="image/webp" srcset="${y0(P)}"${M?` sizes="${y0(M)}"`:""} />`)}return`${S}<picture>
|
|
3555
3555
|
${b.join(`
|
|
3556
3556
|
`)}
|
|
3557
3557
|
${N}
|
|
3558
|
-
</picture>`}return`${S}${N}`}}});function e7(X){return X.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function
|
|
3558
|
+
</picture>`}return`${S}${N}`}}});function e7(X){return X.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function n5(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}var YJ="/images/safe-image-default.svg",Lj,W4;var q4=E(()=>{G8();Lj=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${YJ}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,W4={name:"SafeImage",aliases:["safe-image","safe-img"],render(X,$,Z){let Y=n5(X,"src")||"",J=n5(X,"alt")||"",G=n5(X,"fallback")||YJ,Q=n5(X,"class")||n5(X,"className")||"",w=n5(X,"fallbackClassName")||"",W=[];if(W.push(`src="${e7(Y)}"`),W.push(`alt="${e7(J)}"`),Q)W.push(`class="${e7(Q)}"`);if(W.push(`data-fallback="${e7(G)}"`),w)W.push(`data-fallback-class="${e7(w)}"`);W.push('onerror="window.__stxSafeImageHandler(this)"');let q=new Set(["src","alt","fallback","class","className","fallbackClassName"]);W.push(...p5(X,q)),W.push(...i5(X,q));let U=`<img ${W.join(" ")} />`,K=Z.context;if(!K.__safeImageHandlerEmitted)return K.__safeImageHandlerEmitted=!0,`${Lj}${U}`;return U}}});function U4(X){return X.replace(/[;{}()]/g,"").replace(/url/gi,"")}function XX(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}function Q8(X,$,Z){let Y=XX(X,$);if(Y!==void 0){let J=Number.parseInt(Y,10);if(!Number.isNaN(J))return J}return Z}var K4;var z4=E(()=>{K4={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render(X,$,Z){let Y=U4(XX(X,"color")||"#6366f1"),J=U4(XX(X,"initialColor")||XX(X,"initial-color")||""),G=U4(XX(X,"height")||"3px"),Q=Q8(X,"duration",2000),w=Q8(X,"throttle",200),W=Q8(X,"zIndex",999999)||Q8(X,"z-index",999999),q=J?`linear-gradient(to right, ${J}, ${Y})`:Y;return`
|
|
3559
3559
|
<div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${G};background:${q};z-index:${W};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
|
|
3560
3560
|
<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>
|
|
3561
3561
|
</div>
|
|
3562
3562
|
<style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
|
|
3563
3563
|
<script>
|
|
3564
3564
|
(function(){var el=document.getElementById('stx-loading-indicator'),p=0,l=!1,i=null;function u(v){p=Math.min(Math.max(v,0),100);if(el){el.style.opacity=p>0?'1':'0';el.style.transform='scaleX('+(p/100)+')'}}window.stxLoading={start:function(){l=!0;p=0;u(10);if(i)clearInterval(i);i=setInterval(function(){if(!l)return;var r=90-p,inc=Math.max(0.5,r*0.1);if(p<90)u(p+inc)},${w})},finish:function(){l=!1;if(i){clearInterval(i);i=null}u(100);setTimeout(function(){if(el)el.style.opacity='0';setTimeout(function(){p=0;if(el)el.style.transform='scaleX(0)'},300)},200)},set:function(v){u(v)},clear:function(){l=!1;p=0;if(i){clearInterval(i);i=null}if(el){el.style.opacity='0';el.style.transform='scaleX(0)'}}};document.addEventListener('click',function(e){var a=e.target.closest&&e.target.closest('a');if(!a)return;var h=a.getAttribute('href');if(!h||h.startsWith('http')||h.startsWith('#')||h.startsWith('mailto:')||h.startsWith('tel:')||a.target==='_blank')return;window.stxLoading.start()});window.addEventListener('popstate',function(){window.stxLoading.start()});window.addEventListener('load',function(){window.stxLoading.finish()})})();
|
|
3565
|
-
</script>`}}});function GJ(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}function Oj(X,$,Z){let Y=GJ(X,$);if(Y!==void 0){let J=Number.parseInt(Y,10);if(!Number.isNaN(J))return J}return Z}var JJ,B4;var j4=E(()=>{JJ={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},B4={name:"StxToast",aliases:["stx-toast"],render(X,$,Z){let Y=
|
|
3565
|
+
</script>`}}});function GJ(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}function Oj(X,$,Z){let Y=GJ(X,$);if(Y!==void 0){let J=Number.parseInt(Y,10);if(!Number.isNaN(J))return J}return Z}var JJ,B4;var j4=E(()=>{JJ={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},B4={name:"StxToast",aliases:["stx-toast"],render(X,$,Z){let Y=A0(GJ(X,"position")||"top-right"),J=Oj(X,"max",5),G=JJ[Y]||JJ["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${Y}" data-stx-toast-max="${J}" style="position:fixed;${G};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
|
|
3566
3566
|
<style>
|
|
3567
3567
|
@keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
|
|
3568
3568
|
@keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
|
|
@@ -3570,7 +3570,7 @@ ${N}
|
|
|
3570
3570
|
@keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
|
|
3571
3571
|
@keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
|
|
3572
3572
|
@keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
|
|
3573
|
-
</style>`}}});function w8(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}var QJ,_4;var H4=E(()=>{QJ={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},_4={name:"StxModal",aliases:["stx-modal"],render(X,$,Z){let Y=w8(X,"id");if(!Y)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let J=
|
|
3573
|
+
</style>`}}});function w8(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}var QJ,_4;var H4=E(()=>{QJ={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},_4={name:"StxModal",aliases:["stx-modal"],render(X,$,Z){let Y=w8(X,"id");if(!Y)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let J=A0(Y),G=w8(X,"size")||"md",Q=w8(X,"closeOnBackdrop")!=="false",w=w8(X,"closeOnEscape")!=="false",W=QJ[G]||QJ.md;return`<div id="stx-modal-${J}" class="stx-modal-backdrop" data-stx-modal="${J}" data-close-backdrop="${Q}" data-close-escape="${w}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
|
|
3574
3574
|
<div class="stx-modal-panel" style="${W};width:100%;margin:1rem;border-radius:0.75rem;box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow:hidden;transform:scale(0.95) translateY(8px);transition:transform 0.2s ease,opacity 0.2s ease;opacity:0;background:var(--stx-modal-bg,#fff);color:var(--stx-modal-text,#1f2937)">
|
|
3575
3575
|
<div style="padding:1.5rem">${$}</div>
|
|
3576
3576
|
</div>
|
|
@@ -3579,7 +3579,7 @@ ${N}
|
|
|
3579
3579
|
@media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
|
|
3580
3580
|
.stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
|
|
3581
3581
|
.stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
|
|
3582
|
-
</style>`}}});function
|
|
3582
|
+
</style>`}}});function r5(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}var wJ,L4;var O4=E(()=>{wJ={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},L4={name:"StxDrawer",aliases:["stx-drawer"],render(X,$,Z){let Y=r5(X,"id");if(!Y)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let J=A0(Y),G=r5(X,"side")||"right",Q=r5(X,"size")||"md",w=r5(X,"closeOnBackdrop")!=="false",W=r5(X,"closeOnEscape")!=="false",q=r5(X,"overlay")!=="false",U=wJ[Q]||wJ.md,K=G==="left",z=K?"left:0":"right:0",j=K?"translateX(-100%)":"translateX(100%)",B=K?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${J}" class="stx-drawer-backdrop" data-stx-drawer="${J}" data-close-backdrop="${w}" data-close-escape="${W}" style="display:none;position:fixed;inset:0;z-index:99999;${q?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
|
|
3583
3583
|
<div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${z};width:${U};max-width:100vw;transform:${j};transition:transform 0.3s cubic-bezier(0.4,0,0.2,1);background:var(--stx-drawer-bg,#fff);color:var(--stx-drawer-text,#1f2937);box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow-y:auto;pointer-events:auto">
|
|
3584
3584
|
<div style="padding:1.5rem">${$}</div>
|
|
3585
3585
|
</div>
|
|
@@ -3588,7 +3588,7 @@ ${N}
|
|
|
3588
3588
|
@media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
|
|
3589
3589
|
.stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
|
|
3590
3590
|
.stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
|
|
3591
|
-
</style>`}}});import{existsSync as Fj,readFileSync as Vj}from"fs";function Aj(X){if(WJ.has(X))return;WJ.add(X),console.warn(`[stx] icon collection "${X}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${X}\`.`)}function Rj(X){let $=process.cwd();for(let Z of[`${$}/node_modules/@iconify-json/${X}/icons.json`,`${$}/pantry/@iconify-json/${X}/icons.json`,`${$}/node_modules/@iconify/json/json/${X}.json`,`${$}/pantry/@iconify/json/json/${X}.json`])if(Fj(Z))return Z;for(let Z of[`@iconify-json/${X}/icons.json`,`@iconify/json/json/${X}.json`])try{return Z0.resolve(Z)}catch{}return null}function Mj(X){if(W8.has(X))return W8.get(X);let $=Rj(X);if(!$)return Aj(X),null;try{let Z=JSON.parse(Vj($,"utf8"));return W8.set(X,Z.icons),Z.icons}catch{return null}}function
|
|
3591
|
+
</style>`}}});import{existsSync as Fj,readFileSync as Vj}from"fs";function Aj(X){if(WJ.has(X))return;WJ.add(X),console.warn(`[stx] icon collection "${X}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${X}\`.`)}function Rj(X){let $=process.cwd();for(let Z of[`${$}/node_modules/@iconify-json/${X}/icons.json`,`${$}/pantry/@iconify-json/${X}/icons.json`,`${$}/node_modules/@iconify/json/json/${X}.json`,`${$}/pantry/@iconify/json/json/${X}.json`])if(Fj(Z))return Z;for(let Z of[`@iconify-json/${X}/icons.json`,`@iconify/json/json/${X}.json`])try{return Z0.resolve(Z)}catch{}return null}function Mj(X){if(W8.has(X))return W8.get(X);let $=Rj(X);if(!$)return Aj(X),null;try{let Z=JSON.parse(Vj($,"utf8"));return W8.set(X,Z.icons),Z.icons}catch{return null}}function s5(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);if(X.static[$]!==void 0)return String(X.static[$]);if(X.clientReactive[$]!==void 0)return X.clientReactive[$];return}var W8,WJ,F4;var V4=E(()=>{W8=new Map,WJ=new Set;F4={name:"Icon",aliases:["icon","stx-icon"],render(X,$,Z){let Y=s5(X,"name")??s5(X,"icon");if(!Y)return"<!-- Icon: missing name/icon prop -->";let J="lucide",G=Y;if(Y.includes(":")){let L=Y.split(":");J=L[0],G=L[1]}let Q=A0(s5(X,"size")||"24"),w=A0(s5(X,"color")||"currentColor"),W=A0(s5(X,"class")||""),q=A0(s5(X,"style")||""),U=W8.get(J)??Mj(J);if(!U)return`<!-- Icon: collection "${J}" not loaded -->`;let K=U[G];if(!K)return`<!-- Icon: "${G}" not found in ${J} -->`;let z=K.width||24,j=K.height||24,B=`0 0 ${z} ${j}`,_=K.body;if(w!=="currentColor")_=_.replace(/currentColor/g,w);let H=W?` class="${W}"`:"",O=q?` style="${q}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${Q}" height="${Q}" viewBox="${B}" fill="none"${H}${O}>${_}</svg>`}}});function A4(){return`
|
|
3592
3592
|
(function(){
|
|
3593
3593
|
var tip=null,hideTimer=null,currentEl=null;
|
|
3594
3594
|
|
|
@@ -3691,37 +3691,37 @@ document.addEventListener("focusout",function(e){
|
|
|
3691
3691
|
if(el) hideTip();
|
|
3692
3692
|
});
|
|
3693
3693
|
})();
|
|
3694
|
-
`}function qJ(X,...$){for(let Z of $){if(X.serverDynamic[Z]!==void 0)return String(X.serverDynamic[Z]);let Y=X.static[Z];if(typeof Y==="string")return Y}return}function UJ(X,$){let Z=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${$}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),Y=X.match(Z);if(!Y)return{region:null,rest:X};return{region:Y[2],rest:X.replace(Y[0],"")}}var R4;var M4=E(()=>{R4={name:"Suspense",aliases:["suspense"],render(X,$,Z){let Y=UJ($,"fallback"),J=Y.rest,G=UJ(J,"error"),Q=G.rest,w=Y.region??qJ(X,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',W=G.region??qJ(X,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${w}</div><div data-stx-suspense-error hidden>${W}</div><div data-stx-suspense-content hidden>${Q}</div></div>`}}});function q8(X,...$){for(let Z of $){if(X.serverDynamic[Z]!==void 0)return String(X.serverDynamic[Z]);let Y=X.static[Z];if(typeof Y==="string")return Y}return}var T4;var N4=E(()=>{T4={name:"TransitionGroup",aliases:["transition-group"],render(X,$,Z){let Y=(q8(X,"name")||"v").replace(/["'<>]/g,""),J=(q8(X,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",G=q8(X,"class"),Q=q8(X,"id"),w=[`data-stx-transition-group="${Y}"`,G?`class="${G}"`:"",Q?`id="${Q}"`:""].filter(Boolean).join(" ");return`<${J} ${w}>${$}</${J}>`}}});function KJ(){
|
|
3695
|
-
`||T==="\t")O++;L=R+_.length}else{if(O--,O===0){F=M;break}L=M+H.length}}if(F===-1){J=z;continue}let V=X.slice(z,F),A=F+H.length;Y.push({fullMatch:X.slice(G,A),tagName:W,attributes:B,content:V,startIndex:G,endIndex:A,isSelfClosing:!1}),J=A}}return Y}function jJ(X){return X.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function _J(X,$){try{let Z=Buffer.from(X,"base64").toString("utf8");return JSON.parse(Z)}catch{}try{let Z=X.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(Z)}catch(Z){if($?.debug)console.error("Error decoding __stx_ prop:",Z);return X}}var HJ=E(()=>{T0();L0();P1()});var MJ={};e(MJ,{processESImports:()=>AJ,processComponents:()=>B8});import z8 from"fs";import r0 from"path";function Nj(X,$,Z){let Y={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},J=new Set(Array.isArray($.__stx_client_signal_names)?$.__stx_client_signal_names:[]),G=(q)=>{if(J.size===0)return!1;let U=o0(q),K=U.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(K&&J.has(K))return!0;for(let z of J){let j=z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${j}\\s*\\(`).test(U))return!0}return!1},Q=new Set(D2),w=(q)=>{if(!q.includes("-")||q.startsWith("@")||q.startsWith(":")||q.startsWith("x-")||q.startsWith("__"))return q;if(q.startsWith("aria-")||q.startsWith("data-"))return q;return q.replace(/-([a-z0-9])/g,(U,K)=>K.toUpperCase())},W=(q,U)=>{let K=w(q);if(Y.static[K]=U,K!==q)Y.staticNames[K]=q};for(let[q,U]of Object.entries(X)){let K=q.startsWith("x-")&&!Q.has(q)&&!q.startsWith("x-bind:")&&!q.startsWith("x-on:")?`:${q.slice(2)}`:q;if(K.startsWith("@")){Y.events[K]=U;continue}if(K.startsWith("__stx_")){let z=w(K.slice(6));Y.serverDynamic[z]=_J(U,Z);continue}if(K.startsWith(":")){let z=w(K.slice(1)),j=U===_5?z:U;if(z==="if"||z==="for"||z==="show"){Y.clientReactive[z]=j;continue}if(G(j)){Y.clientReactive[z]=j;continue}try{if(!W0(j)){if(Z.debug)console.error(`Unsafe expression in :${z} binding: ${j}`);Y.clientReactive[z]=j;continue}let B=Object.keys($),H=q0(j,B)(...Object.values($));if(H===void 0){let O=j.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(O.some((V)=>!L.has(V)&&!B.includes(V))){Y.clientReactive[z]=j;continue}}if(Y.serverDynamic[z]=H,z!==K.slice(1)&&Y.serverDynamicNames)Y.serverDynamicNames[z]=K.slice(1)}catch{Y.clientReactive[z]=j}continue}if(typeof U==="string"&&U.includes("{{")&&U.includes("}}")){let z=U.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(z)try{let j=z[1];if(W0(j)){let _=q0(j,Object.keys($))(...Object.values($));W(K,_!=null?String(_):"")}else{if(Z.debug)console.error(`Unsafe expression in ${K}: ${j}`);W(K,U)}}catch(j){if(Z.debug)console.error(`Error evaluating expression for ${K}:`,j);W(K,U)}else{let j=U,B=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=B.exec(U))!==null)try{let H=_[1];if(!W0(H)){if(Z.debug)console.error(`Unsafe expression in ${K}: ${H}`);continue}let L=q0(H,Object.keys($))(...Object.values($));j=j.replace(_[0],String(L??""))}catch(H){if(Z.debug)console.error(`Error evaluating expression in ${K}:`,H)}W(K,j)}continue}W(K,U===_5?"true":jJ(U))}return Y}function Ij(X,$,Z){if(!X.includes("@"))return X;if(!kj.some(([J,G])=>J.test(X)&&X.includes(G)))return X;try{return N1(X,$,Z)}catch{return X}}function Ej(X){let $={},Z=0,Y=X.length;while(Z<Y){while(Z<Y&&/\s/.test(X[Z]))Z++;if(Z>=Y)break;let J="";while(Z<Y&&!/[\s=]/.test(X[Z]))J+=X[Z],Z++;if(!J)break;while(Z<Y&&/\s/.test(X[Z]))Z++;if(Z<Y&&X[Z]==="="){Z++;while(Z<Y&&/\s/.test(X[Z]))Z++;let G="";if(Z<Y&&(X[Z]==='"'||X[Z]==="'")){let Q=X[Z];Z++;while(Z<Y){let w=X[Z];if(w==="\\"&&Z+1<Y){Z++,G+=X[Z],Z++;continue}if(w===Q){Z++;break}G+=w,Z++}}else while(Z<Y&&!/\s/.test(X[Z]))G+=X[Z],Z++;$[J]=G}else $[J]=_5}return $}function OJ(X){return Object.entries(X).map(([$,Z])=>Z===_5?$:`${$}="${Dj(Z)}"`).join(" ")}function Dj(X){return X.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function yj(X){let $=new Set,Z=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1];if(c0.isBuiltin(J))$.add(J)}return[...$].sort()}function bj(X){let $=FJ.get(X);if($)return $;let Z=new Map,Y=[r0.join(X,"src"),r0.join(X,"dist"),X];function J(G,Q){if(Q>6)return;let w;try{w=z8.readdirSync(G,{withFileTypes:!0})}catch{return}for(let W of w){let q=r0.join(G,W.name);if(W.isDirectory()){if(W.name==="node_modules"||W.name.startsWith("."))continue;J(q,Q+1)}else if(W.isFile()&&W.name.endsWith(".stx")){let U=W.name.slice(0,-4);if(!Z.has(U))Z.set(U,q);let K=U.toLowerCase();if(!Z.has(K))Z.set(K,q);let z=U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Z.has(z))Z.set(z,q)}}}for(let G of Y)if(J(G,0),Z.size>0)break;return FJ.set(X,Z),Z}function Sj(X,$){if(X.startsWith(".")||X.startsWith("/"))return null;let Z=$;while(!0){let Y=r0.join(Z,"node_modules",X);try{if(z8.statSync(Y).isDirectory())return Y}catch{}let J=r0.dirname(Z);if(J===Z)return null;Z=J}}async function AJ(X,$,Z,Y,J){if(!X.includes("import"))return X;if(!$.__importedComponents)$.__importedComponents=new Map;let G=$.__importedComponents,Q=r0.dirname(Z),w=X,W=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return w=w.replace(W,(q,U,K)=>{let z=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,j=K,B,_=[];while((B=z.exec(K))!==null){let[H,O,L,F]=B,V=null,A=null;if(F.startsWith(".")||F.startsWith("/")){let T=r0.resolve(Q,F);if(T.endsWith(".stx"))A=T;else{let k=`${T}.stx`;try{if(z8.statSync(k).isFile())A=k}catch{try{if(z8.statSync(T).isDirectory())V=T}catch{}}}}else V=Sj(F,Q);if(!V&&!A)continue;let R=!1,M=(T,k)=>{G.set(T,k),G.set(T.toLowerCase(),k);let I=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();G.set(I,k),J.add(k)};if(L&&A)M(L,A),R=!0;else if(O){let T=O.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let D=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(D)return{source:D[1],local:D[2]};return{source:I,local:I}}),k=V?bj(V):null;for(let{source:I,local:D}of T){let N=null;if(A)N=A;else if(k)N=k.get(I)??k.get(I.toLowerCase())??k.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(N)M(D,N),R=!0}}if(R)_.push({start:B.index,end:B.index+H.length})}if(_.length===0)return q;for(let H=_.length-1;H>=0;H--)j=j.slice(0,_[H].start)+j.slice(_[H].end);return`<script${U}>${j}</script>`}),w}async function Cj(X,$,Z,Y,J){let G=X;if(!$.__importedComponents)$.__importedComponents=new Map;let Q=$.__importedComponents,w=/@import\s*\(\s*([^)]+)\s*\)/g,W;while((W=w.exec(G))!==null){let[q,U]=W,K=U.split(",").map((z)=>z.trim().replace(/^['"]|['"]$/g,"")).filter((z)=>z.length>0);for(let z of K){let j=z.split("/"),_=j[j.length-1].replace(/\.stx$/,""),H=_.includes("-")?_.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),O=null,L=[r0.resolve(r0.dirname(Z),`${z}.stx`),r0.resolve(r0.dirname(Z),z),r0.resolve(Y.componentsDir||"components",`${z}.stx`),r0.resolve(Y.componentsDir||"components",z),z.endsWith(".stx")?z:`${z}.stx`];for(let F of L)try{if(await Bun.file(F).exists()){O=F;break}}catch{}if(O){Q.set(H,O),Q.set(_,O),Q.set(_.toLowerCase(),O);let F=H.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(Q.set(F,O),J.add(O),Y.debug)console.log(`Imported component: ${H} -> ${O}`)}else if(Y.debug)console.warn(`Could not resolve imported component: ${z}`)}G=G.replace(q,""),w.lastIndex=0}return G}async function Pj(X,$,Z,Y,J){let G=X,Q=Y.componentsDir||"components";if(!$.__processedComponents)$.__processedComponents=new Set;let w=$.__processedComponents,W=/@component\s*\(/g,q;while((q=W.exec(G))!==null){let U=q.index,K=U+q[0].length-1,z=1,j=K+1;while(j<G.length&&z>0){if(G[j]==="(")z++;else if(G[j]===")"){if(z--,z===0)break}j++}if(z!==0)break;let B=G.substring(K+1,j),_=j+1,H=B.match(/^\s*['"]([^'"]+)['"]/);if(!H){W.lastIndex=0;continue}let O=H[1],L,F=B.slice(H[0].length),V=F.match(/^\s*,\s*/);if(V)L=F.slice(V[0].length).trim();let A={};if(L)try{A=M0(L,$)}catch(D){let N=D instanceof Error?D.message:String(D);G=G.replace(G.substring(U,_),`[Error parsing component props: ${N}]`);continue}let R="",M=_,k=G.substring(_).match(/^([\s\S]*?)@endcomponent/);if(k)R=k[1].trim(),M=_+k[0].length;let I=await H5(O,A,R,Q,$,Z,Y,w,J);G=G.substring(0,U)+I+G.substring(M),W.lastIndex=0}return G}async function vj(X,$,Z,Y,J){if(!X)return X;let G=X,Q=Y.componentsDir||"components";if(!$.__processedComponents)$.__processedComponents=new Set;let w=$.__processedComponents,W=q1(G);return G=W.output,G=await z(G,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),G=await z(G,/[A-Z][a-zA-Z0-9]*/,!0),G=await z(G,/[a-z][a-z0-9]*/,!1,Tj),G=x5(G,W.scripts),G;async function z(j,B,_,H){if(!j)return j;let O=j,L=BJ(O,B,H);for(let F=L.length-1;F>=0;F--){let V=L[F],A=_?U8(V.tagName):V.tagName,R=Ej(Ij(V.attributes,$,Z)),M=Nj(R,$,Y),T=c0.getBuiltin(V.tagName),k=T?await K8(A,Q,$,Z,Y):!1;if(T&&!k){let S={context:$,filePath:Z,options:Y,dependencies:J},b=T.render(M,V.content,S);if(Object.keys(M.clientReactive).length>0)b=VJ(b,M.clientReactive);if(Object.keys(M.events).length>0){let y=OJ(M.events);b=b.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${y}`)}O=O.substring(0,V.startIndex)+b+O.substring(V.endIndex);continue}if(!_&&V.tagName.includes("-")&&!await K8(A,Q,$,Z,Y))continue;let I={};for(let[S,b]of Object.entries(M.static))I[S]=b;for(let[S,b]of Object.entries(M.serverDynamic))I[S]=b;let N=await H5(A,I,x5(V.content,W.scripts),Q,$,Z,Y,w,J);if(Object.keys(M.clientReactive).length>0)N=VJ(N,M.clientReactive);if(Object.keys(M.events).length>0){let S=RJ(N);if(S){let b=OJ(M.events),y=Object.keys(M.events).map((P)=>P.replace(/^@/,"").split(".")[0]).join(" ");N=N.substring(0,S.insertPos)+` data-stx-parent-events="${y}" ${b}`+N.substring(S.insertPos)}}O=O.substring(0,V.startIndex)+N+O.substring(V.endIndex)}return O}}function VJ(X,$){let Z=new Set(["if","for"]),Y=new Set(["show"]),J=Object.entries($).filter(([U])=>!Z.has(U)),G=J.filter(([U])=>!Y.has(U)).map(([U])=>U8(U)).join(" "),Q=X,w=J.length>0?RJ(Q):null;if(w){let U=J.map(([z,j])=>`:${U8(z)}="${j.replace(/"/g,""")}"`).join(" "),K=G?` data-stx-parent-bindings="${G}"`:"";Q=Q.substring(0,w.insertPos)+`${K} ${U}`+Q.substring(w.insertPos)}let W=$.if;if(W)Q=`<template :if="${W.replace(/"/g,""")}">${Q}</template>`;let q=$.for;if(q)Q=`<template :for="${q.replace(/"/g,""")}">${Q}</template>`;return Q}function RJ(X){let $=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(X);if($)return{insertPos:$.index+1+$[1].length};let Z=0;while(Z<X.length){let Y=X.slice(Z),J=Y.match(/^\s+/);if(J){Z+=J[0].length;continue}if(Y.startsWith("<!--")){let w=X.indexOf("-->",Z+4);if(w===-1)return null;Z=w+3;continue}let G=Y.match(/^<(script|style)\b[^>]*>/i);if(G){let w=`</${G[1].toLowerCase()}>`,W=X.toLowerCase().indexOf(w,Z+G[0].length);if(W===-1)return null;Z=W+w.length;continue}let Q=Y.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!Q)return null;return{insertPos:Z+1+Q[1].length}}return null}async function B8(X,$,Z,Y,J){if(!LJ)KJ(),LJ=!0;let G=await AJ(X,$,Z,Y,J);G=await Cj(G,$,Z,Y,J),G=await Pj(G,$,Z,Y,J);let Q=[];for(let w=0;w<3;w++){let W=W1(G,f7,(U,K)=>`\x00STX_COMPONENT_COMMENT_${Q.length+K}\x00`);Q.push(...W.tokens);let q=G;if(G=await vj(W.output,$,Z,Y,J),G===q)break}if(Q.length>0)G=G.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(w,W)=>Q[Number(W)]??"");if(Y.debug){let w=yj(G);if(w.length>0)console.warn(`[stx] ${Z}: unresolved component tag(s) after render passes: ${w.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return G}var LJ=!1,Tj,kj,FJ;var k4=E(()=>{e9();p7();zJ();HJ();P1();L0();T0();Z1();Tj=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","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"]);kj=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];FJ=new Map});var j8={};e(j8,{stripTypeScript:()=>yJ,splitDeclaration:()=>xJ,isModuleResolutionFailure:()=>bJ,isMissingBindingFailure:()=>SJ,isCompleteImport:()=>CJ,hasVariables:()=>uJ,extractVariables:()=>k1,extractScriptFromTemplate:()=>hJ,convertToCommonJS:()=>D4,STX_ENGINE_BINDING_NAMES:()=>E4});import m1 from"path";import a5 from"process";function gj(X){let $=[],Z=0,Y=X.split(`
|
|
3694
|
+
`}function qJ(X,...$){for(let Z of $){if(X.serverDynamic[Z]!==void 0)return String(X.serverDynamic[Z]);let Y=X.static[Z];if(typeof Y==="string")return Y}return}function UJ(X,$){let Z=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${$}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),Y=X.match(Z);if(!Y)return{region:null,rest:X};return{region:Y[2],rest:X.replace(Y[0],"")}}var R4;var M4=E(()=>{R4={name:"Suspense",aliases:["suspense"],render(X,$,Z){let Y=UJ($,"fallback"),J=Y.rest,G=UJ(J,"error"),Q=G.rest,w=Y.region??qJ(X,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',W=G.region??qJ(X,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${w}</div><div data-stx-suspense-error hidden>${W}</div><div data-stx-suspense-content hidden>${Q}</div></div>`}}});function q8(X,...$){for(let Z of $){if(X.serverDynamic[Z]!==void 0)return String(X.serverDynamic[Z]);let Y=X.static[Z];if(typeof Y==="string")return Y}return}var T4;var N4=E(()=>{T4={name:"TransitionGroup",aliases:["transition-group"],render(X,$,Z){let Y=(q8(X,"name")||"v").replace(/["'<>]/g,""),J=(q8(X,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",G=q8(X,"class"),Q=q8(X,"id"),w=[`data-stx-transition-group="${Y}"`,G?`class="${G}"`:"",Q?`id="${Q}"`:""].filter(Boolean).join(" ");return`<${J} ${w}>${$}</${J}>`}}});function KJ(){m0.registerBuiltin($4),m0.registerBuiltin(Q4),m0.registerBuiltin(W4),m0.registerBuiltin(K4),m0.registerBuiltin(B4),m0.registerBuiltin(_4),m0.registerBuiltin(L4),m0.registerBuiltin(F4),m0.registerBuiltin(R4),m0.registerBuiltin(T4)}var zJ=E(()=>{Z4();w4();q4();z4();j4();H4();O4();V4();M4();N4();e9();Z4();w4();q4();z4();j4();H4();O4();V4();M4();N4()});function U8(X){return X.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function BJ(X,$,Z){let Y=[],J=0;while(J<X.length){let G=X.indexOf("<",J);if(G===-1)break;let w=X.slice(G+1).match(new RegExp(`^(${$.source})(?![\\w.:-])`));if(!w){J=G+1;continue}let W=w[1];if(Z&&Z.has(W.toLowerCase())){let _=G+1+W.length;while(_<X.length&&X[_]!==">")_++;J=_+1;continue}let q=G+1+W.length,U=null,K=q,z=-1,j=!1;while(q<X.length){let _=X[q];if(U){if(_==="\\"&&q+1<X.length){q+=2;continue}if(_===U)U=null;q++;continue}if(_==='"'||_==="'"){U=_,q++;continue}if(_==="/"&&q+1<X.length&&X[q+1]===">"){z=q+2,j=!0;break}if(_===">"){z=q+1;break}q++}if(z===-1){J=G+1;continue}let B=X.slice(K,j?z-2:z-1).trim();if(j)Y.push({fullMatch:X.slice(G,z),tagName:W,attributes:B,content:"",startIndex:G,endIndex:z,isSelfClosing:!0}),J=z;else{let _=`<${W}`,H=`</${W}>`,O=1,L=z,F=-1;while(O>0&&L<X.length){let R=X.indexOf(_,L),M=X.indexOf(H,L);if(M===-1)break;if(R!==-1&&R<M){let T=X[R+_.length];if(T===" "||T===">"||T==="/"||T===`
|
|
3695
|
+
`||T==="\t")O++;L=R+_.length}else{if(O--,O===0){F=M;break}L=M+H.length}}if(F===-1){J=z;continue}let V=X.slice(z,F),A=F+H.length;Y.push({fullMatch:X.slice(G,A),tagName:W,attributes:B,content:V,startIndex:G,endIndex:A,isSelfClosing:!1}),J=A}}return Y}function jJ(X){return X.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function _J(X,$){try{let Z=Buffer.from(X,"base64").toString("utf8");return JSON.parse(Z)}catch{}try{let Z=X.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(Z)}catch(Z){if($?.debug)console.error("Error decoding __stx_ prop:",Z);return X}}var HJ=E(()=>{M0();H0();x1()});var MJ={};a(MJ,{processESImports:()=>AJ,processComponents:()=>B8});import z8 from"fs";import n0 from"path";function Nj(X,$,Z){let Y={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},J=new Set(Array.isArray($.__stx_client_signal_names)?$.__stx_client_signal_names:[]),G=(q)=>{if(J.size===0)return!1;let U=a0(q),K=U.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(K&&J.has(K))return!0;for(let z of J){let j=z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${j}\\s*\\(`).test(U))return!0}return!1},Q=new Set(D2),w=(q)=>{if(!q.includes("-")||q.startsWith("@")||q.startsWith(":")||q.startsWith("x-")||q.startsWith("__"))return q;if(q.startsWith("aria-")||q.startsWith("data-"))return q;return q.replace(/-([a-z0-9])/g,(U,K)=>K.toUpperCase())},W=(q,U)=>{let K=w(q);if(Y.static[K]=U,K!==q)Y.staticNames[K]=q};for(let[q,U]of Object.entries(X)){let K=q.startsWith("x-")&&!Q.has(q)&&!q.startsWith("x-bind:")&&!q.startsWith("x-on:")?`:${q.slice(2)}`:q;if(K.startsWith("@")){Y.events[K]=U;continue}if(K.startsWith("__stx_")){let z=w(K.slice(6));Y.serverDynamic[z]=_J(U,Z);continue}if(K.startsWith(":")){let z=w(K.slice(1)),j=U===j5?z:U;if(z==="if"||z==="for"||z==="show"){Y.clientReactive[z]=j;continue}if(G(j)){Y.clientReactive[z]=j;continue}try{if(!U0(j)){if(Z.debug)console.error(`Unsafe expression in :${z} binding: ${j}`);Y.clientReactive[z]=j;continue}let B=Object.keys($),H=K0(j,B)(...Object.values($));if(H===void 0){let O=j.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(O.some((V)=>!L.has(V)&&!B.includes(V))){Y.clientReactive[z]=j;continue}}if(Y.serverDynamic[z]=H,z!==K.slice(1)&&Y.serverDynamicNames)Y.serverDynamicNames[z]=K.slice(1)}catch{Y.clientReactive[z]=j}continue}if(typeof U==="string"&&U.includes("{{")&&U.includes("}}")){let z=U.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(z)try{let j=z[1];if(U0(j)){let _=K0(j,Object.keys($))(...Object.values($));W(K,_!=null?String(_):"")}else{if(Z.debug)console.error(`Unsafe expression in ${K}: ${j}`);W(K,U)}}catch(j){if(Z.debug)console.error(`Error evaluating expression for ${K}:`,j);W(K,U)}else{let j=U,B=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=B.exec(U))!==null)try{let H=_[1];if(!U0(H)){if(Z.debug)console.error(`Unsafe expression in ${K}: ${H}`);continue}let L=K0(H,Object.keys($))(...Object.values($));j=j.replace(_[0],String(L??""))}catch(H){if(Z.debug)console.error(`Error evaluating expression in ${K}:`,H)}W(K,j)}continue}W(K,U===j5?"true":jJ(U))}return Y}function Ij(X,$,Z){if(!X.includes("@"))return X;if(!kj.some(([J,G])=>J.test(X)&&X.includes(G)))return X;try{return N1(X,$,Z)}catch{return X}}function Ej(X){let $={},Z=0,Y=X.length;while(Z<Y){while(Z<Y&&/\s/.test(X[Z]))Z++;if(Z>=Y)break;let J="";while(Z<Y&&!/[\s=]/.test(X[Z]))J+=X[Z],Z++;if(!J)break;while(Z<Y&&/\s/.test(X[Z]))Z++;if(Z<Y&&X[Z]==="="){Z++;while(Z<Y&&/\s/.test(X[Z]))Z++;let G="";if(Z<Y&&(X[Z]==='"'||X[Z]==="'")){let Q=X[Z];Z++;while(Z<Y){let w=X[Z];if(w==="\\"&&Z+1<Y){Z++,G+=X[Z],Z++;continue}if(w===Q){Z++;break}G+=w,Z++}}else while(Z<Y&&!/\s/.test(X[Z]))G+=X[Z],Z++;$[J]=G}else $[J]=j5}return $}function OJ(X){return Object.entries(X).map(([$,Z])=>Z===j5?$:`${$}="${Dj(Z)}"`).join(" ")}function Dj(X){return X.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function yj(X){let $=new Set,Z=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1];if(m0.isBuiltin(J))$.add(J)}return[...$].sort()}function bj(X){let $=FJ.get(X);if($)return $;let Z=new Map,Y=[n0.join(X,"src"),n0.join(X,"dist"),X];function J(G,Q){if(Q>6)return;let w;try{w=z8.readdirSync(G,{withFileTypes:!0})}catch{return}for(let W of w){let q=n0.join(G,W.name);if(W.isDirectory()){if(W.name==="node_modules"||W.name.startsWith("."))continue;J(q,Q+1)}else if(W.isFile()&&W.name.endsWith(".stx")){let U=W.name.slice(0,-4);if(!Z.has(U))Z.set(U,q);let K=U.toLowerCase();if(!Z.has(K))Z.set(K,q);let z=U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Z.has(z))Z.set(z,q)}}}for(let G of Y)if(J(G,0),Z.size>0)break;return FJ.set(X,Z),Z}function Sj(X,$){if(X.startsWith(".")||X.startsWith("/"))return null;let Z=$;while(!0){let Y=n0.join(Z,"node_modules",X);try{if(z8.statSync(Y).isDirectory())return Y}catch{}let J=n0.dirname(Z);if(J===Z)return null;Z=J}}async function AJ(X,$,Z,Y,J){if(!X.includes("import"))return X;if(!$.__importedComponents)$.__importedComponents=new Map;let G=$.__importedComponents,Q=n0.dirname(Z),w=X,W=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return w=w.replace(W,(q,U,K)=>{let z=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,j=K,B,_=[];while((B=z.exec(K))!==null){let[H,O,L,F]=B,V=null,A=null;if(F.startsWith(".")||F.startsWith("/")){let T=n0.resolve(Q,F);if(T.endsWith(".stx"))A=T;else{let k=`${T}.stx`;try{if(z8.statSync(k).isFile())A=k}catch{try{if(z8.statSync(T).isDirectory())V=T}catch{}}}}else V=Sj(F,Q);if(!V&&!A)continue;let R=!1,M=(T,k)=>{G.set(T,k),G.set(T.toLowerCase(),k);let I=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();G.set(I,k),J.add(k)};if(L&&A)M(L,A),R=!0;else if(O){let T=O.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let D=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(D)return{source:D[1],local:D[2]};return{source:I,local:I}}),k=V?bj(V):null;for(let{source:I,local:D}of T){let N=null;if(A)N=A;else if(k)N=k.get(I)??k.get(I.toLowerCase())??k.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(N)M(D,N),R=!0}}if(R)_.push({start:B.index,end:B.index+H.length})}if(_.length===0)return q;for(let H=_.length-1;H>=0;H--)j=j.slice(0,_[H].start)+j.slice(_[H].end);return`<script${U}>${j}</script>`}),w}async function Cj(X,$,Z,Y,J){let G=X;if(!$.__importedComponents)$.__importedComponents=new Map;let Q=$.__importedComponents,w=/@import\s*\(\s*([^)]+)\s*\)/g,W;while((W=w.exec(G))!==null){let[q,U]=W,K=U.split(",").map((z)=>z.trim().replace(/^['"]|['"]$/g,"")).filter((z)=>z.length>0);for(let z of K){let j=z.split("/"),_=j[j.length-1].replace(/\.stx$/,""),H=_.includes("-")?_.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),O=null,L=[n0.resolve(n0.dirname(Z),`${z}.stx`),n0.resolve(n0.dirname(Z),z),n0.resolve(Y.componentsDir||"components",`${z}.stx`),n0.resolve(Y.componentsDir||"components",z),z.endsWith(".stx")?z:`${z}.stx`];for(let F of L)try{if(await Bun.file(F).exists()){O=F;break}}catch{}if(O){Q.set(H,O),Q.set(_,O),Q.set(_.toLowerCase(),O);let F=H.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(Q.set(F,O),J.add(O),Y.debug)console.log(`Imported component: ${H} -> ${O}`)}else if(Y.debug)console.warn(`Could not resolve imported component: ${z}`)}G=G.replace(q,""),w.lastIndex=0}return G}async function Pj(X,$,Z,Y,J){let G=X,Q=Y.componentsDir||"components";if(!$.__processedComponents)$.__processedComponents=new Set;let w=$.__processedComponents,W=/@component\s*\(/g,q;while((q=W.exec(G))!==null){let U=q.index,K=U+q[0].length-1,z=1,j=K+1;while(j<G.length&&z>0){if(G[j]==="(")z++;else if(G[j]===")"){if(z--,z===0)break}j++}if(z!==0)break;let B=G.substring(K+1,j),_=j+1,H=B.match(/^\s*['"]([^'"]+)['"]/);if(!H){W.lastIndex=0;continue}let O=H[1],L,F=B.slice(H[0].length),V=F.match(/^\s*,\s*/);if(V)L=F.slice(V[0].length).trim();let A={};if(L)try{A=R0(L,$)}catch(D){let N=D instanceof Error?D.message:String(D);G=G.replace(G.substring(U,_),`[Error parsing component props: ${N}]`);continue}let R="",M=_,k=G.substring(_).match(/^([\s\S]*?)@endcomponent/);if(k)R=k[1].trim(),M=_+k[0].length;let I=await _5(O,A,R,Q,$,Z,Y,w,J);G=G.substring(0,U)+I+G.substring(M),W.lastIndex=0}return G}async function vj(X,$,Z,Y,J){if(!X)return X;let G=X,Q=Y.componentsDir||"components";if(!$.__processedComponents)$.__processedComponents=new Set;let w=$.__processedComponents,W=W1(G);return G=W.output,G=await z(G,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),G=await z(G,/[A-Z][a-zA-Z0-9]*/,!0),G=await z(G,/[a-z][a-z0-9]*/,!1,Tj),G=v5(G,W.scripts),G;async function z(j,B,_,H){if(!j)return j;let O=j,L=BJ(O,B,H);for(let F=L.length-1;F>=0;F--){let V=L[F],A=_?U8(V.tagName):V.tagName,R=Ej(Ij(V.attributes,$,Z)),M=Nj(R,$,Y),T=m0.getBuiltin(V.tagName),k=T?await K8(A,Q,$,Z,Y):!1;if(T&&!k){let S={context:$,filePath:Z,options:Y,dependencies:J},b=T.render(M,V.content,S);if(Object.keys(M.clientReactive).length>0)b=VJ(b,M.clientReactive);if(Object.keys(M.events).length>0){let y=OJ(M.events);b=b.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${y}`)}O=O.substring(0,V.startIndex)+b+O.substring(V.endIndex);continue}if(!_&&V.tagName.includes("-")&&!await K8(A,Q,$,Z,Y))continue;let I={};for(let[S,b]of Object.entries(M.static))I[S]=b;for(let[S,b]of Object.entries(M.serverDynamic))I[S]=b;let N=await _5(A,I,v5(V.content,W.scripts),Q,$,Z,Y,w,J);if(Object.keys(M.clientReactive).length>0)N=VJ(N,M.clientReactive);if(Object.keys(M.events).length>0){let S=RJ(N);if(S){let b=OJ(M.events),y=Object.keys(M.events).map((P)=>P.replace(/^@/,"").split(".")[0]).join(" ");N=N.substring(0,S.insertPos)+` data-stx-parent-events="${y}" ${b}`+N.substring(S.insertPos)}}O=O.substring(0,V.startIndex)+N+O.substring(V.endIndex)}return O}}function VJ(X,$){let Z=new Set(["if","for"]),Y=new Set(["show"]),J=Object.entries($).filter(([U])=>!Z.has(U)),G=J.filter(([U])=>!Y.has(U)).map(([U])=>U8(U)).join(" "),Q=X,w=J.length>0?RJ(Q):null;if(w){let U=J.map(([z,j])=>`:${U8(z)}="${j.replace(/"/g,""")}"`).join(" "),K=G?` data-stx-parent-bindings="${G}"`:"";Q=Q.substring(0,w.insertPos)+`${K} ${U}`+Q.substring(w.insertPos)}let W=$.if;if(W)Q=`<template :if="${W.replace(/"/g,""")}">${Q}</template>`;let q=$.for;if(q)Q=`<template :for="${q.replace(/"/g,""")}">${Q}</template>`;return Q}function RJ(X){let $=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(X);if($)return{insertPos:$.index+1+$[1].length};let Z=0;while(Z<X.length){let Y=X.slice(Z),J=Y.match(/^\s+/);if(J){Z+=J[0].length;continue}if(Y.startsWith("<!--")){let w=X.indexOf("-->",Z+4);if(w===-1)return null;Z=w+3;continue}let G=Y.match(/^<(script|style)\b[^>]*>/i);if(G){let w=`</${G[1].toLowerCase()}>`,W=X.toLowerCase().indexOf(w,Z+G[0].length);if(W===-1)return null;Z=W+w.length;continue}let Q=Y.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!Q)return null;return{insertPos:Z+1+Q[1].length}}return null}async function B8(X,$,Z,Y,J){if(!LJ)KJ(),LJ=!0;let G=await AJ(X,$,Z,Y,J);G=await Cj(G,$,Z,Y,J),G=await Pj(G,$,Z,Y,J);let Q=[];for(let w=0;w<3;w++){let W=w1(G,f7,(U,K)=>`\x00STX_COMPONENT_COMMENT_${Q.length+K}\x00`);Q.push(...W.tokens);let q=G;if(G=await vj(W.output,$,Z,Y,J),G===q)break}if(Q.length>0)G=G.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(w,W)=>Q[Number(W)]??"");if(Y.debug){let w=yj(G);if(w.length>0)console.warn(`[stx] ${Z}: unresolved component tag(s) after render passes: ${w.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return G}var LJ=!1,Tj,kj,FJ;var k4=E(()=>{e9();p7();zJ();HJ();x1();H0();M0();Z1();Tj=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","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"]);kj=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];FJ=new Map});var j8={};a(j8,{stripTypeScript:()=>yJ,splitDeclaration:()=>xJ,isModuleResolutionFailure:()=>bJ,isMissingBindingFailure:()=>SJ,isCompleteImport:()=>CJ,hasVariables:()=>uJ,extractVariables:()=>k1,extractScriptFromTemplate:()=>hJ,convertToCommonJS:()=>D4,STX_ENGINE_BINDING_NAMES:()=>E4});import z1 from"path";import o5 from"process";function gj(X){let $=[],Z=0,Y=X.split(`
|
|
3696
3696
|
`);for(let J of Y){let G=Z,Q=null,w=!1;for(let W=0;W<J.length;W++){let q=J[W];if(w){w=!1;continue}if(q==="\\"){w=!0;continue}if(Q){if(q===Q)Q=null;continue}if(q==="'"||q==='"'||q==="`"){Q=q;continue}if(q==="/"&&W+1<J.length&&J[W+1]==="/")break;if(q==="{")Z++;else if(q==="}")Z--}if(G===0){let W=J.match(/(?:const|let|var)\s+(\w+)\s*=/);if(W)$.push(W[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(J)){let q=J.match(/(?:const|let|var)\s+(\w+)/);if(q)$.push(q[1])}else{let q=J.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(q){let K=q[1].slice(1,-1).split(",").map((z)=>{let j=z.split(":");return(j.length>1?j[1]:j[0]).trim()}).filter((z)=>/^\w+$/.test(z));$.push(...K)}}}}return[...new Set($)]}function yJ(X){let $=X;$=$.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),$=$.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),$=$.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),$=$.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),$=$.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Z(Y){if(!Y.includes(":"))return Y;let J=[],G="",Q=0,w=0,W=null;for(let q=0;q<Y.length;q++){let U=Y[q];if(W){if(G+=U,U===W)W=null;continue}if(U==='"'||U==="'"||U==="`"){W=U,G+=U;continue}if(U==="<")Q++;else if(U===">"&&Q>0)Q--;else if(U==="(")w++;else if(U===")")w--;if(U===","&&Q===0&&w===0){J.push(G),G="";continue}G+=U}if(G)J.push(G);return J.map((q)=>{let U=q.trim(),K=U.startsWith("..."),z=K?U.slice(3):U,j=-1,B=0;for(let A=0;A<z.length;A++)if(z[A]==="<")B++;else if(z[A]===">")B--;else if(z[A]===":"&&B===0){j=A;break}if(j===-1)return q;let H=z.substring(0,j).trim().replace(/\?$/,""),O=z.substring(j+1),L=-1,F=0;for(let A=0;A<O.length;A++)if(O[A]==="<")F++;else if(O[A]===">")F--;else if(O[A]==="="&&F===0){L=A;break}let V=K?"...":"";if(L!==-1)return`${V}${H} = ${O.substring(L+1).trim()}`;return`${V}${H}`}).join(", ")}$=$.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(Y,J,G)=>{if(!G.includes(":"))return Y;return`${J}(${Z(G)})`});{let Y=/\b(function\s+\w*\s*)\(/g,J,G=[];while((J=Y.exec($))!==null){let Q=J.index+J[0].length-1,w=1,W=Q+1,q=0,U=null;while(W<$.length&&w>0){let j=$[W];if(U){if(j===U)U=null;W++;continue}if(j==='"'||j==="'"||j==="`"){U=j,W++;continue}if(j==="<")q++;else if(j===">"&&q>0)q--;else if(q===0){if(j==="(")w++;else if(j===")")w--}if(w>0)W++}if(w!==0)continue;let K=$.substring(Q+1,W);if(!K.includes(":"))continue;let z=Z(K);G.push({start:Q+1,end:W,replacement:z})}for(let Q=G.length-1;Q>=0;Q--){let{start:w,end:W,replacement:q}=G[Q];$=$.substring(0,w)+q+$.substring(W)}}return $=$.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(Y,J)=>{if(!J.includes(":"))return Y;if(J.includes("{")||J.includes("}"))return Y;return`(${J.split(",").map((Q)=>{let[w,...W]=Q.split("="),q=w.split(":")[0].trim();if(W.length>0)return`${q} = ${W.join("=").trim()}`;return q}).join(", ")}) =>`}),$=$.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"),$=$.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),$=$.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),$=$.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),$=$.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),$=$.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),$=$.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),$=$.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),$=$.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),$=$.replace(/\n\s*\n\s*\n/g,`
|
|
3697
3697
|
|
|
3698
|
-
`),$}function bJ(X){return/cannot find module|could not resolve|module not found|failed to resolve/i.test(X)}function SJ(X){if(!/is not defined|can't find variable/i.test(X))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test(X)}async function k1(X,$,Z,Y={}){if(!X.trim())return;let J;try{let C=B1({loader:"ts",target:"browser",define:
|
|
3699
|
-
`),
|
|
3698
|
+
`),$}function bJ(X){return/cannot find module|could not resolve|module not found|failed to resolve/i.test(X)}function SJ(X){if(!/is not defined|can't find variable/i.test(X))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test(X)}async function k1(X,$,Z,Y={}){if(!X.trim())return;let J;try{let C=B1({loader:"ts",target:"browser",define:P0()}),x=X.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");x=x.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),J=C.transformSync(x)}catch{J=yJ(X)}let G={exports:{}},Q=G.exports,w=o5.cwd(),W={},q=[...J.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((C)=>C[1]).filter((C)=>!C.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(C)),U=new Map;for(let C of q)try{if(C.startsWith(".")){W[C]=await import(z1.resolve(z1.dirname(Z),C));continue}let x=z1.resolve(w,"node_modules",C),l=z1.join(x,"package.json"),v=JSON.parse(Z0("fs").readFileSync(l,"utf8")),u=v.main||"index.js";if(v.exports){let t=typeof v.exports==="string"?v.exports:v.exports["."];if(typeof t==="string")u=t;else if(t?.bun)u=t.bun;else if(t?.import)u=t.import;else if(t?.default)u=t.default}W[C]=await import(z1.resolve(x,u))}catch(x){if(C.startsWith("."))U.set(C,x instanceof Error?x.message:String(x))}let K=(C)=>{if(W[C])return W[C];let x=U.get(C);if(x!==void 0)throw Error(`Cannot require '${C}' from ${Z}: ${x}`);return Z0(C)},z=$.props||{},j=(C)=>{if(!C)return z;let x={};for(let[l,v]of Object.entries(C)){let u=z[l];if(u!==void 0)x[l]=u;else if(typeof v==="function")x[l]=v();else x[l]=v}return x};for(let[C,x]of Object.entries(z))Object.defineProperty(j,C,{value:x,enumerable:!0,configurable:!0,writable:!0});for(let C of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(z,C))continue;try{Object.defineProperty(j,C,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let B=(C)=>{if(!C)return z;let x={...z};for(let[l,v]of Object.entries(C)){let u=v&&typeof v==="object"&&!Array.isArray(v)?v:{type:v};if(x[l]===void 0&&u.default!==void 0)x[l]=typeof u.default==="function"?u.default():u.default}return x},_=()=>$.slots||{},H=(C,x)=>{let l={...C};for(let[v,u]of Object.entries(x))if(l[v]===void 0)if(typeof u==="function")l[v]=u();else l[v]=u;return l},O=(C)=>{let x=()=>C;return x.set=(l)=>{},x.update=(l)=>{},x},L=(C)=>{let x,l=!1;return()=>{if(!l)try{x=C(),l=!0}catch{x=void 0}return x}},F=(C)=>{},V=(C)=>C(),A=(C)=>{},R=(C)=>{};function M(C){let x=C||{};if(x.title!==void 0||x.description!==void 0)N({title:x.title,description:x.description})}function T(C){if(!C||typeof C!=="object")return;let x=$.__stxClientPayload??{};Object.assign(x,C),$.__stxClientPayload=x}let k=()=>{let C=$.__stxServeContext,x=$.__stxServeSearch??C?.search??"",l=C?.path??"",v=Object.fromEntries(new URLSearchParams(x)),u=$.query,t=Object.keys(v).length>0?v:u??{},e=x||(Object.keys(t).length>0?`?${new URLSearchParams(t).toString()}`:"");return{params:$.params??{},query:t,path:l,name:"",fullPath:l+e,hash:"",matched:[]}},I=()=>({push:(C)=>{},replace:(C)=>{},back:()=>{},forward:()=>{},go:(C)=>{}}),D=(C)=>{let x=$.__stx_runtime_head||{};$.__stx_runtime_head=m1(x,C||{})},N=(C)=>{D(eX(C||{}))},S=(C)=>({value:C}),b=(C)=>C,y=(C)=>({value:typeof C==="function"?C():C}),P=(C,x)=>{},f=(C)=>{},g=(C)=>{},p=(C)=>C?C():Promise.resolve(),c=(C)=>(x,...l)=>{},k0=(C)=>{},f0=(C,x)=>{},g0=(C,x)=>x,$1=()=>({value:"light"}),$0=()=>O(!1),O0=(C)=>O(!1),z0=()=>O(!1),t1=()=>O0("(prefers-color-scheme: dark)"),z7=()=>O0("(prefers-color-scheme: light)"),n=()=>O0("(prefers-reduced-motion: reduce)"),Y0=()=>O0("(prefers-contrast: more)"),q0={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},h0=new Proxy(q0,{get(C,x){if(x in C)return C[x];return},set(C,x,l){return C[x]=l,!0}}),I0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},s0=console;try{let C=D4(J,Z),x=new Set(Object.keys(z)),l=(o)=>/^[a-z_$][\w$]*$/i.test(o),v=Object.keys($).filter((o)=>!x.has(o)&&!xj.has(o)&&l(o)),u=v.map((o)=>$[o]);if(!v.includes("__stxServeContext"))v.push("__stxServeContext"),u.push(void 0);let t=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"]),e=[],F0=[];for(let[o,W0]of Object.entries(z)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(o))continue;if(t.has(o))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${o}\\b`).test(C))continue;e.push(o),F0.push(W0)}let y1=gj(C).map((o)=>`module.exports.${o} = typeof ${o} !== 'undefined' ? ${o} : module.exports.${o};`).join(`
|
|
3699
|
+
`),l0=$.params??{},C0=[],o0=[];for(let o=0;o<v.length;o++){if(v[o]==="params")continue;C0.push(v[o]),o0.push(u[o])}let b1=await Function(...E4,...e,...C0,`return (async () => {
|
|
3700
3700
|
${C}
|
|
3701
|
-
${
|
|
3701
|
+
${y1}
|
|
3702
3702
|
return module.exports
|
|
3703
|
-
})()`)(G,Q,
|
|
3703
|
+
})()`)(G,Q,K,z,j,B,H,T,O,L,F,V,A,R,M,k,I,D,N,S,b,y,P,f,g,p,c,k0,_,f0,g0,$1,$0,O0,z0,t1,z7,n,Y0,h0,I0,s0,q0.confirm,q0.alert,q0.fetch,l0,...F0,...o0);if(Y.preserveExisting){for(let[o,W0]of Object.entries(b1))if(!(o in $)||$[o]===void 0)$[o]=W0}else Object.assign($,b1);for(let[o,W0]of Object.entries(z))if(!(o in $))$[o]=W0}catch(C){let x=C instanceof Error?C.message:String(C);if(bJ(x))console.warn(`[stx] server <script> in ${Z??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${x}`);else if(SJ(x))console.warn(`[stx] server <script> in ${Z??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${x}`);else if(o5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${Z??"<unknown>"} \u2014 falling back to static extraction. Cause: ${x}`);try{await cj(J,$,Z)}catch(l){if(o5.env.STX_DEBUG){let v=l instanceof Error?l.message:String(l);console.warn(`[stx] fallback extraction also failed in ${Z??"<unknown>"}: ${v}`)}}}}function CJ(X){let $=0,Z=null,Y=!1,J=!1;for(let G=0;G<X.length;G++){let Q=X[G];if(Z){if(Q===Z){if(Z=null,Y||$===0)J=!0}continue}if(Q==="'"||Q==='"'||Q==="`"){Z=Q;continue}if(Q==="{")$++;else if(Q==="}")$--;else if(X.startsWith("from",G)&&$===0)Y=!0}return Z===null&&$===0&&J}function D4(X,$){let Z=$?z1.dirname($):o5.cwd(),Y=o5.cwd(),J=X.split(`
|
|
3704
3704
|
`),G=[],Q=0;while(Q<J.length){let w=J[Q].trim();if(w.startsWith("interface ")||w.startsWith("export interface ")||w.startsWith("type ")||w.startsWith("export type ")){if(w.includes("{")&&!w.includes("}")){let W=0;for(;Q<J.length;Q++){for(let q of J[Q])if(q==="{")W++;else if(q==="}")W--;if(W<=0)break}}Q++;continue}if(w.startsWith("definePageMeta(")){let W=0,q=!1,U=Q;for(let j=Q;j<J.length&&!q;j++){let B=null,_=!1,H=J[j];for(let O=0;O<H.length;O++){let L=H[O];if(_){_=!1;continue}if(L==="\\"){_=!0;continue}if(B){if(L===B)B=null;continue}if(L==='"'||L==="'"||L==="`"){B=L;continue}if(L==="(")W++;else if(L===")"){if(W--,W===0){Q=j+1,q=!0;break}}}}if(!q)Q=J.length;let K=J.slice(U,Q).join(`
|
|
3705
|
-
`),z=[];for(let j of["title","description"]){let B=new RegExp(`\\b${j}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(K);if(B)z.push(`${j}: ${JSON.stringify(B[2])}`)}if(z.length>0)G.push(`useSeoMeta({ ${z.join(", ")} });`);continue}if(w.startsWith("import ")||w==="import"||w.startsWith("import{")){let W=w,q=0;while(!CJ(W)&&Q+q+1<J.length)q++,W=`${W} ${J[Q+q].trim()}`;Q+=q;let U=W.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),K=W.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),z=W.match(/^import\s+['"](.+?)['"]/),j=W,B=(_)=>{if(_.startsWith("."))return
|
|
3705
|
+
`),z=[];for(let j of["title","description"]){let B=new RegExp(`\\b${j}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(K);if(B)z.push(`${j}: ${JSON.stringify(B[2])}`)}if(z.length>0)G.push(`useSeoMeta({ ${z.join(", ")} });`);continue}if(w.startsWith("import ")||w==="import"||w.startsWith("import{")){let W=w,q=0;while(!CJ(W)&&Q+q+1<J.length)q++,W=`${W} ${J[Q+q].trim()}`;Q+=q;let U=W.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),K=W.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),z=W.match(/^import\s+['"](.+?)['"]/),j=W,B=(_)=>{if(_.startsWith("."))return z1.resolve(Z,_);if(_.startsWith("~/")||_.startsWith("@/"))return z1.resolve(Y,_.slice(2));return _};if(U){let[,_,H]=U,O=B(H);G.push(`const ${_} = (await import('${O}')).default`),G.push(`module.exports.${_} = ${_};`)}else if(K){let[,_,H]=K,O=B(H),L=[],F=[],V=fj.has(H);for(let A of _.split(",")){let R=A.trim();if(!R)continue;let M=R.split(/\s+as\s+/);if(M.length===2){let[T,k]=[M[0].trim(),M[1].trim()];if(V&&TJ.has(T)){G.push(`const ${k} = ${T};`);continue}L.push(`${T}: ${k}`),F.push(k)}else{if(V&&TJ.has(R))continue;L.push(R),F.push(R)}}if(L.length>0)G.push(`const { ${L.join(", ")} } = await import('${O}')`);for(let A of F)G.push(`module.exports.${A} = ${A};`)}else if(z){let _=B(z[1]);G.push(`await import('${_}')`)}else G.push(j);Q++;continue}if(hj.test(w))G.push(J[Q]),Q++;else if(w.startsWith("export const ")||w.startsWith("export let ")||w.startsWith("export var ")){let W=kJ(J,Q),{type:q,name:U,value:K}=W;G.push(`${q} ${U} = ${K};`),G.push(`module.exports.${U} = ${U};`),Q=W.nextIndex}else if(w.startsWith("export function ")||w.startsWith("export async function ")){let W=I4(J,Q);G.push(W.functionCode),G.push(`module.exports.${W.name} = ${W.name};`),Q=W.nextIndex}else if(w.startsWith("const ")||w.startsWith("let ")||w.startsWith("var ")){let W=kJ(J,Q),{type:q,name:U,value:K}=W;G.push(`${q} ${U} = ${K};`),G.push(`module.exports.${U} = ${U};`),Q=W.nextIndex}else if(w.startsWith("function ")||w.startsWith("async function ")){let W=I4(J,Q);G.push(W.functionCode),G.push(`module.exports.${W.name} = ${W.name};`),Q=W.nextIndex}else if(w.startsWith("export default function ")||w.startsWith("export default async function ")){let W=J[Q].replace(/^(\s*)export\s+default\s+/,"$1"),q=[...J];q[Q]=W;let U=I4(q,Q);if(G.push(U.functionCode),U.name)G.push(`module.exports.default = ${U.name};`);Q=U.nextIndex}else if(w.startsWith("export default ")){let W=w.replace(/^export\s+default\s+/,"").replace(/;$/,"");G.push(`module.exports.default = ${W};`),Q++}else if(w.startsWith("class ")||w.startsWith("export class ")){let W=w.match(/(?:export\s+)?class\s+(\w+)/);if(W){let q=W[1],U=J[Q].replace(/^export\s+/,""),K=0,z=Q;for(;z<J.length;z++){let j=J[z];for(let B of j)if(B==="{")K++;else if(B==="}")K--;if(z>Q)U+=`
|
|
3706
3706
|
`+j;if(K<=0&&z>=Q)break}G.push(U),G.push(`module.exports.${q} = ${q};`),Q=z+1}else G.push(w),Q++}else if(w.includes("module.exports"))G.push(w),Q++;else if(w.trim()&&!w.startsWith("//"))G.push(w),Q++;else Q++}return uj(G.join(`
|
|
3707
3707
|
`),Z,Y)}function uj(X,$,Z){let Y=X.length,J="",G=0,Q=null,w=!1,W=!1,q=0;while(G<Y){let U=X[G],K=X[G+1];if(w){if(J+=U,U===`
|
|
3708
|
-
`)w=!1;G++;continue}if(W){if(J+=U,U==="*"&&K==="/"){J+=K,G+=2,W=!1;continue}G++;continue}if(!Q&&U==="/"&&K==="/"){w=!0,J+=U,G++;continue}if(!Q&&U==="/"&&K==="*"){W=!0,J+=U,G++;continue}if(Q){if(J+=U,U==="\\"){J+=K,G+=2;continue}if(U===Q&&Q!=="`"){Q=null,G++;continue}if(Q==="`"){if(U==="$"&&K==="{"){q++,J+=K,G+=2;continue}if(U==="`"){Q=null,G++;continue}}G++;continue}if(q>0){if(U==="{")q++;else if(U==="}")q--}if(U==='"'||U==="'"||U==="`"){Q=U,J+=U,G++;continue}if(U==="a"&&X.startsWith("await",G)){let z=dj(X,G);if(z){let{quote:j,path:B,end:_}=z;if(B.startsWith(".")||B.startsWith("~/")||B.startsWith("@/")){let H=B.startsWith(".")?
|
|
3708
|
+
`)w=!1;G++;continue}if(W){if(J+=U,U==="*"&&K==="/"){J+=K,G+=2,W=!1;continue}G++;continue}if(!Q&&U==="/"&&K==="/"){w=!0,J+=U,G++;continue}if(!Q&&U==="/"&&K==="*"){W=!0,J+=U,G++;continue}if(Q){if(J+=U,U==="\\"){J+=K,G+=2;continue}if(U===Q&&Q!=="`"){Q=null,G++;continue}if(Q==="`"){if(U==="$"&&K==="{"){q++,J+=K,G+=2;continue}if(U==="`"){Q=null,G++;continue}}G++;continue}if(q>0){if(U==="{")q++;else if(U==="}")q--}if(U==='"'||U==="'"||U==="`"){Q=U,J+=U,G++;continue}if(U==="a"&&X.startsWith("await",G)){let z=dj(X,G);if(z){let{quote:j,path:B,end:_}=z;if(B.startsWith(".")||B.startsWith("~/")||B.startsWith("@/")){let H=B.startsWith(".")?z1.resolve($,B):z1.resolve(Z,B.slice(2));J+=`await import(${j}${H}${j})`,G=_;continue}}}J+=U,G++}return J}function dj(X,$){let Z=$+5;if(Z>=X.length)return null;if(!/\s/.test(X[Z]))return null;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(!X.startsWith("import",Z))return null;Z+=6;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(X[Z]!=="(")return null;Z++;while(Z<X.length&&/\s/.test(X[Z]))Z++;let Y=X[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let J=Z;while(Z<X.length&&X[Z]!==Y)if(X[Z]==="\\")Z+=2;else Z++;if(Z>=X.length)return null;let G=X.slice(J,Z);Z++;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(X[Z]!==")")return null;return{quote:Y,path:G,end:Z+1}}function PJ(X,$){let Z=X[$];if(Z!=="{"&&Z!=="[")return null;let J=D0(X,Z,Z==="{"?"}":"]",$);if(J===-1)return null;return{pattern:X.slice($,J+1),endPos:J+1}}function vJ(X){let $=[],Z=X.slice(1,-1).trim();if(!Z)return $;let Y=0,J=0,G="";while(Y<Z.length){let Q=Z[Y];if(Q==="{"||Q==="["){let w=J===0?PJ(Z,Y):null;if(w){$.push(...vJ(w.pattern)),Y=w.endPos,G="";continue}J++}else if(Q==="}"||Q==="]")J--;if(J>0){Y++;continue}if(Q===","){if(G.trim())$.push(G.trim());G="",Y++;continue}if(Q===":"){G="",Y++;continue}if(Q==="="){if(G.trim())$.push(G.trim());G="",Y++;while(Y<Z.length&&Z[Y]!==","&&J===0){if(Z[Y]==="{"||Z[Y]==="[")J++;else if(Z[Y]==="}"||Z[Y]==="]")J--;Y++}continue}if(/[\w$]/.test(Q))G+=Q;Y++}if(G.trim())$.push(G.trim());return $}function xJ(X){let $=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(X);if(!$)return null;let Z=$[0].length,Y=(J)=>J===" "||J==="\t";while(Z<X.length&&Y(X[Z]))Z++;if(X[Z]===":"){let J=0,G=null;Z++;for(;Z<X.length;Z++){let Q=X[Z];if(G){if(Q==="\\"){Z++;continue}if(Q===G)G=null;continue}if(Q==="'"||Q==='"'||Q==="`"){G=Q;continue}if(Q==="("||Q==="["||Q==="{"||Q==="<"){J++;continue}if(Q===")"||Q==="]"||Q==="}"||Q===">"){J--;continue}if(Q==="="&&J<=0){let w=X[Z+1],W=X[Z-1];if(w!=="="&&w!==">"&&W!=="="&&W!=="!"&&W!=="<"&&W!==">")break}}if(X[Z]!=="=")return null}while(Z<X.length&&Y(X[Z]))Z++;if(X[Z]!=="=")return null;return{type:$[1],name:$[2],value:X.slice(Z+1).trim()}}function NJ(X,$,Z,Y){let J=null,G=!1;for(let Q of X){if(G){G=!1;continue}if(Q==="\\"){G=!0;continue}if(J){if(Q===J)J=null;continue}if(Q==="'"||Q==='"'||Q==="`"){J=Q;continue}if(Q===$)Y++;else if(Q===Z)Y--}return Y}function kJ(X,$){let Z=X[$].trim(),Y=xJ(Z),J=Y?[Z,Y.type,Y.name,Y.value]:null;if(!J){let U=Z.match(/^(?:export\s+)?(const|let|var)\s+/);if(U){let K=Z.slice(U[0].length),z=$;if(K.startsWith("{")||K.startsWith("[")){let B=K[0],_=B==="{"?"}":"]",H=NJ(K,B,_,0),O=K;for(let L=$+1;L<X.length&&H>0;L++)O+=` ${X[L].trim()}`,z=L,H=NJ(X[L],B,_,H);if(H>0)O=K,z=$;K=O}let j=PJ(K,0);if(j){let B=U[1],_=j.pattern,H=K.slice(j.endPos).trim();if(H.startsWith("=")){let O=H.slice(1).trim(),L=O,F=Math.max(z,$);if(IJ(O)){let M=EJ(X,F,O);L=M.value,F=M.nextIndex}else F=F+1;L=L.trim().replace(/;$/,"");let V=vJ(_),A=`__stx_src_${$}`,R=V.map((M)=>`module.exports.${M} = ${M};`).join(`
|
|
3709
3709
|
`);return{type:B,name:A,value:`${L}; ${B} ${_} = ${A};
|
|
3710
3710
|
${R}`,nextIndex:F}}}}throw Error(`Failed to parse variable declaration: ${Z}`)}let[,G,Q,w]=J,W=w,q=$;if(IJ(w)){let U=EJ(X,$,w);W=U.value,q=U.nextIndex}else q=$+1;while(q<X.length){let U=X[q].trim();if(U.startsWith(".")||U.startsWith("?."))W+=`
|
|
3711
|
-
${X[q]}`,q++;else break}return W=W.trim().replace(/;$/,""),{type:G,name:Q,value:W,nextIndex:q}}function I4(X,$){let Z=X[$].trim(),Y=Z.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!Y)throw Error(`Failed to parse function declaration: ${Z}`);let[,J]=Y,G=Z.replace(/^export\s+/,""),Q=$;if(mj(Z)){let w=lj(X,$,G);G=w.functionCode,Q=w.nextIndex}else Q=$+1;return{name:J,functionCode:G,nextIndex:Q}}function IJ(X){let $=X.trim();if($.startsWith("{"))return
|
|
3711
|
+
${X[q]}`,q++;else break}return W=W.trim().replace(/;$/,""),{type:G,name:Q,value:W,nextIndex:q}}function I4(X,$){let Z=X[$].trim(),Y=Z.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!Y)throw Error(`Failed to parse function declaration: ${Z}`);let[,J]=Y,G=Z.replace(/^export\s+/,""),Q=$;if(mj(Z)){let w=lj(X,$,G);G=w.functionCode,Q=w.nextIndex}else Q=$+1;return{name:J,functionCode:G,nextIndex:Q}}function IJ(X){let $=X.trim();if($.startsWith("{"))return D0($,"{","}",0)===-1;if($.startsWith("["))return D0($,"[","]",0)===-1;return!fJ($)}function fJ(X){let $={paren:0,bracket:0,brace:0},Z=null,Y=0;for(let J=0;J<X.length;J++){let G=X[J];if((J>0?X[J-1]:"")==="\\"&&Z)continue;if((G==='"'||G==="'")&&!Z){Z=G;continue}if(G===Z&&Z!=="`"){Z=null;continue}if(G==="`"&&!Z){Z="`";continue}if(G==="`"&&Z==="`"&&Y===0){Z=null;continue}if(Z==="`"&&G==="$"&&X[J+1]==="{"){Y++,J++;continue}if(Y>0&&G==="{"){Y++;continue}if(Y>0&&G==="}"){Y--;continue}if(Z)continue;if(G==="(")$.paren++;else if(G===")")$.paren--;else if(G==="[")$.bracket++;else if(G==="]")$.bracket--;else if(G==="{")$.brace++;else if(G==="}")$.brace--}return $.paren===0&&$.bracket===0&&$.brace===0&&Z===null}function gJ(X){let $=X.indexOf("(");if($===-1)return X.indexOf("{");let Z=D0(X,"(",")",$);if(Z===-1)return-1;return X.indexOf("{",Z)}function mj(X){let $=gJ(X);if($===-1)return!0;return D0(X,"{","}",$)===-1}function EJ(X,$,Z){let Y=Z,J=$+1;while(J<X.length&&!fJ(Y)){let G=X[J];Y+=`
|
|
3712
3712
|
${G}`,J++}while(J<X.length){let G=X[J].trim();if(G.startsWith(".")||G.startsWith("?."))Y+=`
|
|
3713
|
-
${X[J]}`,J++;else break}return{value:Y,nextIndex:J}}function lj(X,$,Z){let Y=Z,J=$+1;while(J<X.length){let G=gJ(Y);if(G!==-1){if(
|
|
3714
|
-
${Q}`,J++}return{functionCode:Y,nextIndex:J}}function DJ(X,$){let Z=Q0(X,$)??Q0(`(${X})`,$);if(Z!==void 0)return Z;if(!/\bprocess\b/.test(X))return;let Y={...$,process:Object.freeze({env:{...a5.env}})};try{return Function(...Object.keys(Y),`'use strict'; return (${X});`)(...Object.values(Y))}catch{try{return Function(...Object.keys(Y),`'use strict'; return ${X};`)(...Object.values(Y))}catch{return}}}async function cj(X,$,Z){let Y=X.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let G of Y){let[,,Q,w]=G;try{let W=w.trim().replace(/;$/,""),q=DJ(W,$);if(q!==void 0)$[Q]=q}catch(W){console.warn(`Failed to parse export ${Q} in fallback:`,W)}}let J=X.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let G of J){let[,,Q,w]=G;if(!(Q in $))try{let W=w.trim().replace(/;$/,""),q=DJ(W,$);if(q!==void 0)$[Q]=q}catch{}}}function hJ(X){let $=X.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Z=$?$[1]:"",Y=$?X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):X;return{scriptContent:Z,templateWithoutScript:Y}}function uJ(X){let $=X.trim();if(!$)return!1;return/(?:const|let|var|function)\s+\w+/.test($)}var E4,TJ,xj,fj,hj;var t5=E(()=>{L0();m5();S1();T0();E4=["module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","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"],TJ=new Set(E4),xj=new Set(["props","$props","defineProps"]),fj=new Set(["stx","@stacksjs/stx"]);hj=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/});var nJ={};e(nJ,{processLoops:()=>b4,parseLoopBinding:()=>y4});function nj(X,$){let Z=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,Y="",J=0,G;while((G=Z.exec(X))!==null){let Q=G.index+G[0].length,w=G.index+G[0].indexOf("("),W=y0(X,"(",")",w);if(W===-1)continue;let q=X.slice(Q,W).trim();if(!q)continue;if(!Object.keys($).some((z)=>new RegExp(`(?:^|[^\\w$.])${z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(q)))continue;let K;try{let z=M0(q,$);if(!z||typeof z!=="object")continue;K=JSON.stringify(z)}catch{continue}Y+=X.slice(J,Q)+K,J=W,Z.lastIndex=W}return J===0?X:Y+X.slice(J)}function rj(X,$){let Z=/@component\s*\(/g,Y=X,J,G=[];while((J=Z.exec(Y))!==null){let Q=J.index,w=Q+J[0].length-1,W=1,q=w+1;while(q<Y.length&&W>0){if(Y[q]==="(")W++;else if(Y[q]===")"){if(W--,W===0)break}q++}if(W!==0)continue;let U=Y.substring(w+1,q),K=q+1,z=U.match(/^\s*['"]([^'"]+)['"]/);if(!z)continue;let j=z[1],B=U.slice(z[0].length),_=B.match(/^\s*,\s*/);if(!_)continue;let H=B.slice(_[0].length).trim();if(!H)continue;try{let O=M0(H,$),L=JSON.stringify(O),F=`@component('${j}', ${L})`;G.push({start:Q,end:K,replacement:F})}catch{continue}}for(let Q=G.length-1;Q>=0;Q--){let{start:w,end:W,replacement:q}=G[Q];Y=Y.substring(0,w)+q+Y.substring(W)}return Y}function _8(X,$,Z){let Y=X,J=new RegExp(`${$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),G;while((G=J.exec(Y))!==null){let Q=G.index,w=Q+G[0].length-1,W=1,q=w+1,U=null,K=!1;while(q<Y.length&&W>0){let B=Y[q];if(K){K=!1,q++;continue}if(B==="\\"&&U){K=!0,q++;continue}if(U){if(B===U)U=null;q++;continue}if(B==='"'||B==="'"||B==="`"){U=B,q++;continue}if(B==="(")W++;else if(B===")"){if(W--,W===0)break}q++}if(W!==0)break;let z=Y.substring(w+1,q),j=Z(z);Y=Y.substring(0,Q)+j+Y.substring(q+1)}return Y}function sj(X,$){let Z=X;return Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(Y,J)=>{if(J in $)return`:${J}="${J}"`;return Y}),Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(Y,J,G)=>{try{let Q=Object.keys($),w=Object.values($);PX(G);let q=q0(G,Q)(...w),U=JSON.stringify(q),K=Buffer.from(U,"utf8").toString("base64");return`__stx_${J}="${K}"`}catch(Q){return Y}}),Z}function oj(X,$){let Z=X;return Z=_8(Z,"@break",(Y)=>{try{let G=`!!(${Y.trim()})`,Q;if(W0(G)){let w=q0(G,Object.keys($));Q=Boolean(w(...Object.values($)))}else Q=Boolean(Q0(G,$));return Q?H8:""}catch{return""}}),Z=_8(Z,"@continue",(Y)=>{try{let G=`!!(${Y.trim()})`,Q;if(W0(G)){let w=q0(G,Object.keys($));Q=Boolean(w(...Object.values($)))}else Q=Boolean(Q0(G,$));return Q?L8:""}catch{return""}}),Z}function aj(X){let $=X;return $=$.replace(/@break(?!\()/g,H8),$=$.replace(/@continue(?!\()/g,L8),$}function dJ(X){let $=X.includes(H8),Z=$?X.substring(0,X.indexOf(H8)):X;return{hasBreak:$,content:Z}}function mJ(X){let $=X.includes(L8),Z=$?X.substring(0,X.indexOf(L8)):X;return{hasContinue:$,content:Z}}function cJ(X){let $=X;return $=_8($,"@break",(Z)=>{let Y=Z.trim();if(!vX(Y))return"";return`\`; if (${Y}) { break; } result += \``}),$=_8($,"@continue",(Z)=>{let Y=Z.trim();if(!vX(Y))return"";return`\`; if (${Y}) { continue; } result += \``}),$=$.replace(/@break(?!\()/g,"`; break; result += `"),$=$.replace(/@continue(?!\()/g,"`; continue; result += `"),$}function tj(X){let $=/@forelse\s*\(/g,Z,Y=[],J=/@foreach\s*\(/g,G=/@endforeach/g,Q;while((Q=J.exec(X))!==null)Y.push({pos:Q.index,delta:1});while((Q=G.exec(X))!==null)Y.push({pos:Q.index,delta:-1});Y.sort((U,K)=>U.pos-K.pos);let w=[],W=0;for(let U of Y)W+=U.delta,w.push({pos:U.pos,depth:W});function q(U){let K=0,z=w.length-1,j=0;while(K<=z){let B=K+z>>1;if(w[B].pos<=U)j=w[B].depth,K=B+1;else z=B-1}return j}while((Z=$.exec(X))!==null){if(q(Z.index)>0)continue;let U=Z.index,K=Z.index+Z[0].length-1,z=1,j=K+1,B=-1;while(j<X.length&&z>0){if(X[j]==="(")z++;else if(X[j]===")"){if(z--,z===0){B=j;break}}j++}if(B===-1)continue;let _=X.substring(K+1,B),H=y4(_);if(!H)continue;let{arrayExpr:O,itemVar:L}=H,F=B+1,V=1,A=F,R=/@forelse\s*\(/g,M=/@endforelse/g,T=-1;while(V>0&&A<X.length){R.lastIndex=A,M.lastIndex=A;let b=R.exec(X),y=M.exec(X);if(!y)break;if(b&&b.index<y.index)V++,A=b.index+b[0].length;else{if(V--,V===0){T=y.index;break}A=y.index+11}}if(T===-1)continue;let k=X.substring(F,T),I=T+11,D=-1,N=0,S=0;while(S<k.length){let b=k.indexOf("@",S);if(b===-1)break;let y=k.substring(b);if(/^@forelse\s*\(/.test(y))N++,S=b+1;else if(y.startsWith("@endforelse"))N--,S=b+11;else if(N===0&&y.startsWith("@empty")){if(k.length<=b+6||!/[a-z]/i.test(k[b+6])){D=b;break}S=b+1}else S=b+1}if(D===-1)continue;return{start:U,end:I,arrayExpr:O,itemVar:L,foreachContent:k.substring(0,D),emptyContent:k.substring(D+6)}}return null}function lJ(X,$){let Z=X;while(!0){let Y=tj(Z);if(!Y)break;let{start:J,end:G,arrayExpr:Q,itemVar:w,foreachContent:W,emptyContent:q}=Y;try{let U;if(W0(Q))U=q0(Q,Object.keys($))(...Object.values($));else U=Q0(Q,$);let K;if(!Array.isArray(U)||U.length===0)K=q;else K=`@foreach (${Q} as ${w})${W}@endforeach`;Z=Z.substring(0,J)+K+Z.substring(G)}catch(U){let K=U instanceof Error?U.message:String(U),z=J0("Forelse",`Error in @forelse(${Q} as ${w}): ${K}`,o.EVALUATION_ERROR);Z=Z.substring(0,J)+z+Z.substring(G)}}return Z}function y4(X){let $=X.indexOf(" as ");if($!==-1){let G=X.slice(0,$).trim(),Q=X.slice($+4).trim();return G&&Q?{arrayExpr:G,itemVar:Q}:null}let Z=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(X);if(!Z)return null;let Y=Z[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),J=Z[2].trim();return Y&&J?{arrayExpr:J,itemVar:Y}:null}function b4(X,$,Z,Y){let J=X;J=lJ(J,$);function G(W){let q=/@foreach\s*\(/g,U;while((U=q.exec(W))!==null){let K=U.index,z=U.index+U[0].length-1,j=1,B=z+1,_=-1;while(B<W.length&&j>0){if(W[B]==="(")j++;else if(W[B]===")"){if(j--,j===0){_=B;break}}B++}if(_===-1)continue;let H=W.substring(z+1,_),O=y4(H);if(!O)continue;let L=K,{arrayExpr:F,itemVar:V}=O,A=_+1,R=1,M=A,T=/@foreach\s*\(/g,k=/@endforeach/g;while(R>0&&M<W.length){T.lastIndex=M,k.lastIndex=M;let I=T.exec(W),D=k.exec(W);if(!D)break;if(I&&I.index<D.index)R++,M=I.index+I[0].length;else{if(R--,R===0){let N=W.substring(A,D.index),S=D.index+11;return{start:L,end:S,arrayExpr:F,itemVar:V,content:N}}M=D.index+11}}}return null}function Q(W,q){let U=W;while(!0){let K=G(U);if(!K)break;let{start:z,end:j,arrayExpr:B,itemVar:_,content:H}=K;try{let O=B.trim(),L;if(W0(O))L=q0(O,Object.keys(q))(...Object.values(q));else L=Q0(O,q);let F=!1;if(!Array.isArray(L))if(L instanceof Map)L=Array.from(L),F=!0;else if(L instanceof Set)L=Array.from(L);else if(typeof L==="string")L=Array.from(L);else if(L&&typeof L==="object"&&!(L instanceof Date)&&!(L instanceof RegExp))L=Object.entries(L),F=!0;else{console.warn(`[stx] @foreach(${O}) in ${Z}: ${O} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.");let D=J0("Foreach",`Error in @foreach: ${O} is not iterable`,o.TYPE_ERROR);U=U.substring(0,z)+D+U.substring(j);continue}let V=Y?.loops?.useAltLoopVariable??ij,A=_.trim(),R=null,M,T=!1;if(A.includes("=>")){let D=A.split("=>").map((N)=>N.trim());if(D.length===2&&D[0]&&D[1])R=D[0],M=D[1];else M=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let D=A.split(",").map((N)=>N.trim());if(D.length===2&&D[0]&&D[1])M=D[0],R=D[1],T=!0;else M=A}else M=A;let k="",I=L;for(let D=0;D<I.length;D++){let N=I[D],S={index:D,iteration:D+1,first:D===0,last:D===I.length-1,count:I.length},b={...q,loop:S,$loop:S};if(M.startsWith("[")&&M.endsWith("]")){let f=M.slice(1,-1).split(",").map((p)=>p.trim());if(Array.isArray(N))f.forEach((p,c)=>{if(p)b[p]=N[c]});else b[M]=N}else b[M]=N;if(R)if(!T&&F&&Array.isArray(N)&&N.length===2)b[R]=N[0],b[M]=N[1];else b[R]=D;let y=oj(H,b),P=mJ(y);if(P.hasContinue){k+=P.content;continue}let x=dJ(y);if(x.hasBreak){k+=x.content;break}if(y=lJ(y,b),y=Q(y,b),y=N1(y,b,Z),y=aj(y),x=dJ(y),x.hasBreak){k+=x.content;break}if(P=mJ(y),P.hasContinue){k+=P.content;continue}y=v1(y,b,Z),y=sj(y,b),y=rj(y,b),y=nj(y,b),k+=y}U=U.substring(0,z)+k+U.substring(j)}catch(O){let L=J0("Foreach",`Error in @foreach(${B.trim()} as ${_.trim()}): ${O instanceof Error?O.message:String(O)}`,o.EVALUATION_ERROR);U=U.substring(0,z)+L+U.substring(j)}}return U}J=Q(J,$),J=iJ(J,$,Z,Y);let w=Y?.loops?.maxWhileIterations??pj;return J=$_(J,$,w),J}function pJ(X){return vX(X)}function iJ(X,$,Z,Y){let J=X,G=!0;while(G){G=!1;let Q=J.match(/@for\s*\(/);if(!Q||Q.index===void 0)break;let w=Q.index,W=w+Q[0].length-1,q=y0(J,"(",")",W);if(q===-1)break;let U=J.slice(W+1,q),K=q+1,z=sX(J.slice(w),"for","endfor");if(z.length===0)break;let j=z[0].content,B=w+z[0].end;if(!pJ(U)){let _=J0("For",`Unsafe expression in @for: ${U}`,o.UNSAFE_EXPRESSION);J=J.substring(0,w)+_+J.substring(B),G=!0;continue}try{let _=ej(U),H=/@(?:for|foreach|if|unless)\s*\(/.test(j);if(_.length>0&&H){let R=X_({forExpr:U,content:j,iterVarNames:_,context:$,filePath:Z,options:Y});J=J.substring(0,w)+R+J.substring(B),G=!0;continue}let O=Object.keys($),L=Object.values($),F=j.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(R,M)=>{return`\${${M}}`});F=cJ(F);let A=Function(...O,`
|
|
3713
|
+
${X[J]}`,J++;else break}return{value:Y,nextIndex:J}}function lj(X,$,Z){let Y=Z,J=$+1;while(J<X.length){let G=gJ(Y);if(G!==-1){if(D0(Y,"{","}",G)!==-1)break}let Q=X[J];Y+=`
|
|
3714
|
+
${Q}`,J++}return{functionCode:Y,nextIndex:J}}function DJ(X,$){let Z=Q0(X,$)??Q0(`(${X})`,$);if(Z!==void 0)return Z;if(!/\bprocess\b/.test(X))return;let Y={...$,process:Object.freeze({env:{...o5.env}})};try{return Function(...Object.keys(Y),`'use strict'; return (${X});`)(...Object.values(Y))}catch{try{return Function(...Object.keys(Y),`'use strict'; return ${X};`)(...Object.values(Y))}catch{return}}}async function cj(X,$,Z){let Y=X.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let G of Y){let[,,Q,w]=G;try{let W=w.trim().replace(/;$/,""),q=DJ(W,$);if(q!==void 0)$[Q]=q}catch(W){console.warn(`Failed to parse export ${Q} in fallback:`,W)}}let J=X.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let G of J){let[,,Q,w]=G;if(!(Q in $))try{let W=w.trim().replace(/;$/,""),q=DJ(W,$);if(q!==void 0)$[Q]=q}catch{}}}function hJ(X){let $=X.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Z=$?$[1]:"",Y=$?X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):X;return{scriptContent:Z,templateWithoutScript:Y}}function uJ(X){let $=X.trim();if(!$)return!1;return/(?:const|let|var|function)\s+\w+/.test($)}var E4,TJ,xj,fj,hj;var a5=E(()=>{H0();d5();P1();M0();E4=["module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","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"],TJ=new Set(E4),xj=new Set(["props","$props","defineProps"]),fj=new Set(["stx","@stacksjs/stx"]);hj=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/});var nJ={};a(nJ,{processLoops:()=>b4,parseLoopBinding:()=>y4});function nj(X,$){let Z=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,Y="",J=0,G;while((G=Z.exec(X))!==null){let Q=G.index+G[0].length,w=G.index+G[0].indexOf("("),W=D0(X,"(",")",w);if(W===-1)continue;let q=X.slice(Q,W).trim();if(!q)continue;if(!Object.keys($).some((z)=>new RegExp(`(?:^|[^\\w$.])${z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(q)))continue;let K;try{let z=R0(q,$);if(!z||typeof z!=="object")continue;K=JSON.stringify(z)}catch{continue}Y+=X.slice(J,Q)+K,J=W,Z.lastIndex=W}return J===0?X:Y+X.slice(J)}function rj(X,$){let Z=/@component\s*\(/g,Y=X,J,G=[];while((J=Z.exec(Y))!==null){let Q=J.index,w=Q+J[0].length-1,W=1,q=w+1;while(q<Y.length&&W>0){if(Y[q]==="(")W++;else if(Y[q]===")"){if(W--,W===0)break}q++}if(W!==0)continue;let U=Y.substring(w+1,q),K=q+1,z=U.match(/^\s*['"]([^'"]+)['"]/);if(!z)continue;let j=z[1],B=U.slice(z[0].length),_=B.match(/^\s*,\s*/);if(!_)continue;let H=B.slice(_[0].length).trim();if(!H)continue;try{let O=R0(H,$),L=JSON.stringify(O),F=`@component('${j}', ${L})`;G.push({start:Q,end:K,replacement:F})}catch{continue}}for(let Q=G.length-1;Q>=0;Q--){let{start:w,end:W,replacement:q}=G[Q];Y=Y.substring(0,w)+q+Y.substring(W)}return Y}function _8(X,$,Z){let Y=X,J=new RegExp(`${$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),G;while((G=J.exec(Y))!==null){let Q=G.index,w=Q+G[0].length-1,W=1,q=w+1,U=null,K=!1;while(q<Y.length&&W>0){let B=Y[q];if(K){K=!1,q++;continue}if(B==="\\"&&U){K=!0,q++;continue}if(U){if(B===U)U=null;q++;continue}if(B==='"'||B==="'"||B==="`"){U=B,q++;continue}if(B==="(")W++;else if(B===")"){if(W--,W===0)break}q++}if(W!==0)break;let z=Y.substring(w+1,q),j=Z(z);Y=Y.substring(0,Q)+j+Y.substring(q+1)}return Y}function sj(X,$){let Z=X;return Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(Y,J)=>{if(J in $)return`:${J}="${J}"`;return Y}),Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(Y,J,G)=>{try{let Q=Object.keys($),w=Object.values($);PX(G);let q=K0(G,Q)(...w),U=JSON.stringify(q),K=Buffer.from(U,"utf8").toString("base64");return`__stx_${J}="${K}"`}catch(Q){return Y}}),Z}function oj(X,$){let Z=X;return Z=_8(Z,"@break",(Y)=>{try{let G=`!!(${Y.trim()})`,Q;if(U0(G)){let w=K0(G,Object.keys($));Q=Boolean(w(...Object.values($)))}else Q=Boolean(Q0(G,$));return Q?H8:""}catch{return""}}),Z=_8(Z,"@continue",(Y)=>{try{let G=`!!(${Y.trim()})`,Q;if(U0(G)){let w=K0(G,Object.keys($));Q=Boolean(w(...Object.values($)))}else Q=Boolean(Q0(G,$));return Q?L8:""}catch{return""}}),Z}function aj(X){let $=X;return $=$.replace(/@break(?!\()/g,H8),$=$.replace(/@continue(?!\()/g,L8),$}function dJ(X){let $=X.includes(H8),Z=$?X.substring(0,X.indexOf(H8)):X;return{hasBreak:$,content:Z}}function mJ(X){let $=X.includes(L8),Z=$?X.substring(0,X.indexOf(L8)):X;return{hasContinue:$,content:Z}}function cJ(X){let $=X;return $=_8($,"@break",(Z)=>{let Y=Z.trim();if(!vX(Y))return"";return`\`; if (${Y}) { break; } result += \``}),$=_8($,"@continue",(Z)=>{let Y=Z.trim();if(!vX(Y))return"";return`\`; if (${Y}) { continue; } result += \``}),$=$.replace(/@break(?!\()/g,"`; break; result += `"),$=$.replace(/@continue(?!\()/g,"`; continue; result += `"),$}function tj(X){let $=/@forelse\s*\(/g,Z,Y=[],J=/@foreach\s*\(/g,G=/@endforeach/g,Q;while((Q=J.exec(X))!==null)Y.push({pos:Q.index,delta:1});while((Q=G.exec(X))!==null)Y.push({pos:Q.index,delta:-1});Y.sort((U,K)=>U.pos-K.pos);let w=[],W=0;for(let U of Y)W+=U.delta,w.push({pos:U.pos,depth:W});function q(U){let K=0,z=w.length-1,j=0;while(K<=z){let B=K+z>>1;if(w[B].pos<=U)j=w[B].depth,K=B+1;else z=B-1}return j}while((Z=$.exec(X))!==null){if(q(Z.index)>0)continue;let U=Z.index,K=Z.index+Z[0].length-1,z=1,j=K+1,B=-1;while(j<X.length&&z>0){if(X[j]==="(")z++;else if(X[j]===")"){if(z--,z===0){B=j;break}}j++}if(B===-1)continue;let _=X.substring(K+1,B),H=y4(_);if(!H)continue;let{arrayExpr:O,itemVar:L}=H,F=B+1,V=1,A=F,R=/@forelse\s*\(/g,M=/@endforelse/g,T=-1;while(V>0&&A<X.length){R.lastIndex=A,M.lastIndex=A;let b=R.exec(X),y=M.exec(X);if(!y)break;if(b&&b.index<y.index)V++,A=b.index+b[0].length;else{if(V--,V===0){T=y.index;break}A=y.index+11}}if(T===-1)continue;let k=X.substring(F,T),I=T+11,D=-1,N=0,S=0;while(S<k.length){let b=k.indexOf("@",S);if(b===-1)break;let y=k.substring(b);if(/^@forelse\s*\(/.test(y))N++,S=b+1;else if(y.startsWith("@endforelse"))N--,S=b+11;else if(N===0&&y.startsWith("@empty")){if(k.length<=b+6||!/[a-z]/i.test(k[b+6])){D=b;break}S=b+1}else S=b+1}if(D===-1)continue;return{start:U,end:I,arrayExpr:O,itemVar:L,foreachContent:k.substring(0,D),emptyContent:k.substring(D+6)}}return null}function lJ(X,$){let Z=X;while(!0){let Y=tj(Z);if(!Y)break;let{start:J,end:G,arrayExpr:Q,itemVar:w,foreachContent:W,emptyContent:q}=Y;try{let U;if(U0(Q))U=K0(Q,Object.keys($))(...Object.values($));else U=Q0(Q,$);let K;if(!Array.isArray(U)||U.length===0)K=q;else K=`@foreach (${Q} as ${w})${W}@endforeach`;Z=Z.substring(0,J)+K+Z.substring(G)}catch(U){let K=U instanceof Error?U.message:String(U),z=J0("Forelse",`Error in @forelse(${Q} as ${w}): ${K}`,s.EVALUATION_ERROR);Z=Z.substring(0,J)+z+Z.substring(G)}}return Z}function y4(X){let $=X.indexOf(" as ");if($!==-1){let G=X.slice(0,$).trim(),Q=X.slice($+4).trim();return G&&Q?{arrayExpr:G,itemVar:Q}:null}let Z=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(X);if(!Z)return null;let Y=Z[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),J=Z[2].trim();return Y&&J?{arrayExpr:J,itemVar:Y}:null}function b4(X,$,Z,Y){let J=X;J=lJ(J,$);function G(W){let q=/@foreach\s*\(/g,U;while((U=q.exec(W))!==null){let K=U.index,z=U.index+U[0].length-1,j=1,B=z+1,_=-1;while(B<W.length&&j>0){if(W[B]==="(")j++;else if(W[B]===")"){if(j--,j===0){_=B;break}}B++}if(_===-1)continue;let H=W.substring(z+1,_),O=y4(H);if(!O)continue;let L=K,{arrayExpr:F,itemVar:V}=O,A=_+1,R=1,M=A,T=/@foreach\s*\(/g,k=/@endforeach/g;while(R>0&&M<W.length){T.lastIndex=M,k.lastIndex=M;let I=T.exec(W),D=k.exec(W);if(!D)break;if(I&&I.index<D.index)R++,M=I.index+I[0].length;else{if(R--,R===0){let N=W.substring(A,D.index),S=D.index+11;return{start:L,end:S,arrayExpr:F,itemVar:V,content:N}}M=D.index+11}}}return null}function Q(W,q){let U=W;while(!0){let K=G(U);if(!K)break;let{start:z,end:j,arrayExpr:B,itemVar:_,content:H}=K;try{let O=B.trim(),L;if(U0(O))L=K0(O,Object.keys(q))(...Object.values(q));else L=Q0(O,q);let F=!1;if(!Array.isArray(L))if(L instanceof Map)L=Array.from(L),F=!0;else if(L instanceof Set)L=Array.from(L);else if(typeof L==="string")L=Array.from(L);else if(L&&typeof L==="object"&&!(L instanceof Date)&&!(L instanceof RegExp))L=Object.entries(L),F=!0;else{console.warn(`[stx] @foreach(${O}) in ${Z}: ${O} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.");let D=J0("Foreach",`Error in @foreach: ${O} is not iterable`,s.TYPE_ERROR);U=U.substring(0,z)+D+U.substring(j);continue}let V=Y?.loops?.useAltLoopVariable??ij,A=_.trim(),R=null,M,T=!1;if(A.includes("=>")){let D=A.split("=>").map((N)=>N.trim());if(D.length===2&&D[0]&&D[1])R=D[0],M=D[1];else M=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let D=A.split(",").map((N)=>N.trim());if(D.length===2&&D[0]&&D[1])M=D[0],R=D[1],T=!0;else M=A}else M=A;let k="",I=L;for(let D=0;D<I.length;D++){let N=I[D],S={index:D,iteration:D+1,first:D===0,last:D===I.length-1,count:I.length},b={...q,loop:S,$loop:S};if(M.startsWith("[")&&M.endsWith("]")){let g=M.slice(1,-1).split(",").map((p)=>p.trim());if(Array.isArray(N))g.forEach((p,c)=>{if(p)b[p]=N[c]});else b[M]=N}else b[M]=N;if(R)if(!T&&F&&Array.isArray(N)&&N.length===2)b[R]=N[0],b[M]=N[1];else b[R]=D;let y=oj(H,b),P=mJ(y);if(P.hasContinue){k+=P.content;continue}let f=dJ(y);if(f.hasBreak){k+=f.content;break}if(y=lJ(y,b),y=Q(y,b),y=N1(y,b,Z),y=aj(y),f=dJ(y),f.hasBreak){k+=f.content;break}if(P=mJ(y),P.hasContinue){k+=P.content;continue}y=f1(y,b,Z),y=sj(y,b),y=rj(y,b),y=nj(y,b),k+=y}U=U.substring(0,z)+k+U.substring(j)}catch(O){let L=J0("Foreach",`Error in @foreach(${B.trim()} as ${_.trim()}): ${O instanceof Error?O.message:String(O)}`,s.EVALUATION_ERROR);U=U.substring(0,z)+L+U.substring(j)}}return U}J=Q(J,$),J=iJ(J,$,Z,Y);let w=Y?.loops?.maxWhileIterations??pj;return J=$_(J,$,w),J}function pJ(X){return vX(X)}function iJ(X,$,Z,Y){let J=X,G=!0;while(G){G=!1;let Q=J.match(/@for\s*\(/);if(!Q||Q.index===void 0)break;let w=Q.index,W=w+Q[0].length-1,q=D0(J,"(",")",W);if(q===-1)break;let U=J.slice(W+1,q),K=q+1,z=sX(J.slice(w),"for","endfor");if(z.length===0)break;let j=z[0].content,B=w+z[0].end;if(!pJ(U)){let _=J0("For",`Unsafe expression in @for: ${U}`,s.UNSAFE_EXPRESSION);J=J.substring(0,w)+_+J.substring(B),G=!0;continue}try{let _=ej(U),H=/@(?:for|foreach|if|unless)\s*\(/.test(j);if(_.length>0&&H){let R=X_({forExpr:U,content:j,iterVarNames:_,context:$,filePath:Z,options:Y});J=J.substring(0,w)+R+J.substring(B),G=!0;continue}let O=Object.keys($),L=Object.values($),F=j.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(R,M)=>{return`\${${M}}`});F=cJ(F);let A=Function(...O,`
|
|
3715
3715
|
let result = '';
|
|
3716
3716
|
for (${U}) {
|
|
3717
3717
|
result += \`${F}\`;
|
|
3718
3718
|
}
|
|
3719
3719
|
return result;
|
|
3720
|
-
`)(...L);J=J.substring(0,w)+A+J.substring(B),G=!0}catch(_){let H=J0("For",`Error in @for(${U}): ${_ instanceof Error?_.message:String(_)}`,
|
|
3720
|
+
`)(...L);J=J.substring(0,w)+A+J.substring(B),G=!0}catch(_){let H=J0("For",`Error in @for(${U}): ${_ instanceof Error?_.message:String(_)}`,s.EVALUATION_ERROR);J=J.substring(0,w)+H+J.substring(B),G=!0}}return J}function ej(X){let $=X.trim(),Z=$.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Z){let G=Z[1];return G.slice(1,-1).split(",").map((w)=>{let W=w.trim();if(!W)return"";let q=W.indexOf(":");if(q>=0&&G.startsWith("{")){let z=W.slice(q+1).trim(),j=z.indexOf("=");return(j>=0?z.slice(0,j):z).trim()}let U=W.indexOf("="),K=(U>=0?W.slice(0,U):W).trim();return/^[A-Za-z_$][\w$]*$/.test(K)?K:""}).filter(Boolean)}let Y=$.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(Y)return[Y[1]];let J=$.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(J)return[J[1]];return[]}function X_(X){let{forExpr:$,content:Z,iterVarNames:Y,context:J,filePath:G,options:Q}=X,w=Object.keys(J),W=Object.values(J),q=Function(...w,"__pushIter",`
|
|
3721
3721
|
for (${$}) {
|
|
3722
3722
|
__pushIter([${Y.join(", ")}])
|
|
3723
3723
|
}
|
|
3724
|
-
`),U=[];q(...W,(j)=>{U.push(j)});let K=G??"inline.stx",z="";for(let j of U){let B={...J};Y.forEach((H,O)=>{B[H]=j[O]});let _=iJ(Z,B,G,Q);_=N1(_,B,K),_=
|
|
3724
|
+
`),U=[];q(...W,(j)=>{U.push(j)});let K=G??"inline.stx",z="";for(let j of U){let B={...J};Y.forEach((H,O)=>{B[H]=j[O]});let _=iJ(Z,B,G,Q);_=N1(_,B,K),_=f1(_,B,K),z+=_}return z}function $_(X,$,Z){let Y=X,J=!0;while(J){J=!1;let G=Y.match(/@while\s*\(/);if(!G||G.index===void 0)break;let Q=G.index,w=Q+G[0].length-1,W=D0(Y,"(",")",w);if(W===-1)break;let q=Y.slice(w+1,W),U=sX(Y.slice(Q),"while","endwhile");if(U.length===0)break;let K=U[0].content,z=Q+U[0].end;if(!pJ(q)){let j=J0("While",`Unsafe expression in @while: ${q}`,s.UNSAFE_EXPRESSION);Y=Y.substring(0,Q)+j+Y.substring(z),J=!0;continue}try{let j=Object.keys($),B=Object.values($),_=K.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(L,F)=>{return`\${${F}}`});_=cJ(_);let O=Function(...j,`
|
|
3725
3725
|
let result = '';
|
|
3726
3726
|
let maxIterations = ${Z}; // Configurable safety limit
|
|
3727
3727
|
let counter = 0;
|
|
@@ -3733,10 +3733,10 @@ ${Q}`,J++}return{functionCode:Y,nextIndex:J}}function DJ(X,$){let Z=Q0(X,$)??Q0(
|
|
|
3733
3733
|
result += '<!-- [While Error [1104]]: Maximum iterations (${Z}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
|
|
3734
3734
|
}
|
|
3735
3735
|
return result;
|
|
3736
|
-
`)(...B);Y=Y.substring(0,Q)+O+Y.substring(z),J=!0}catch(j){let B=J0("While",`Error in @while(${q}): ${j instanceof Error?j.message:String(j)}`,
|
|
3736
|
+
`)(...B);Y=Y.substring(0,Q)+O+Y.substring(z),J=!0}catch(j){let B=J0("While",`Error in @while(${q}): ${j instanceof Error?j.message:String(j)}`,s.EVALUATION_ERROR);Y=Y.substring(0,Q)+B+Y.substring(z),J=!0}}return Y}var pj=1000,ij=!1,H8="<!--__STX_BREAK__-->",L8="<!--__STX_CONTINUE__-->";var S4=E(()=>{p7();T1();U1();oX();M0()});import j0 from"path";function C4(X,$){let Z=0;for(let Y=$;Y<X.length;Y++){let J=X[Y];if(J==="("||J==="["||J==="{")Z++;else if(J===")"||J==="]"||J==="}")Z--;else if(J===","&&Z===0)return Y}return-1}function Z_(X,$,Z){let Y=X,J=new RegExp(`${$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),G=J.exec(Y);while(G){let Q=G.index,w=Q+G[0].length-1,W=1,q=w+1;while(q<Y.length&&W>0){if(Y[q]==="(")W++;else if(Y[q]===")")W--;q++}if(W!==0)break;let U=Y.substring(w+1,q-1),K=`${Z}(${U})`;Y=Y.substring(0,Q)+K+Y.substring(q),J.lastIndex=Q+K.length,G=J.exec(Y)}return Y}function Y_(X){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(X)}function sJ(X){let $=X,Z=[],Y=new Set,J=0,G=0,Q=$.length,w=(K)=>{G++;while(G<Q){if($[G]==="\\"){G+=2;continue}if($[G]===K){G++;return}G++}},W=()=>{G++;while(G<Q){if($[G]==="\\"){G+=2;continue}if($[G]==="`"){G++;return}if($[G]==="$"&&$[G+1]==="{"){G+=2;let K=1;while(G<Q&&K>0)if($[G]==="{")K++,G++;else if($[G]==="}")K--,G++;else if($[G]==="'"||$[G]==='"')w($[G]);else if($[G]==="`")W();else G++;continue}G++}},q=()=>{if($[G]==="/"&&$[G+1]==="/"){while(G<Q&&$[G]!==`
|
|
3737
3737
|
`)G++;return!0}if($[G]==="/"&&$[G+1]==="*"){G+=2;while(G<Q-1&&!($[G]==="*"&&$[G+1]==="/"))G++;return G+=2,!0}return!1},U=()=>{if(J!==0)return;let K=$.slice(G).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(K){let B=K[2];if(!Y.has(B))Z.push(B),Y.add(B);return}let z=$.slice(G).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let B=z[1];if(!Y.has(B))Z.push(B),Y.add(B);return}let j=$.slice(G).match(/^async\s+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)}};while(G<Q){if(q())continue;if($[G]==="'"||$[G]==='"'){w($[G]);continue}if($[G]==="`"){W();continue}if($[G]==="{"){J++,G++;continue}if($[G]==="}"){J--,G++;continue}if(J===0&&/[a-z]/i.test($[G])&&(G===0||/\s|[;{}()]/.test($[G-1])))U();G++}return Z.join(", ")}function oJ(X,$=""){let Z=sJ(X).split(",").map((Y)=>Y.trim()).filter(Boolean);return`
|
|
3738
3738
|
(function() {
|
|
3739
|
-
${
|
|
3739
|
+
${D5("var",Z)}
|
|
3740
3740
|
var __destroyHooks = [];
|
|
3741
3741
|
var __origOnDestroy = onDestroy;
|
|
3742
3742
|
onDestroy = function(fn) { __origOnDestroy(fn); __destroyHooks.push(fn); };
|
|
@@ -3768,76 +3768,76 @@ ${sJ(X).split(",").map((G)=>G.trim()).filter(Boolean).map((G)=>` try { __scopeR
|
|
|
3768
3768
|
} finally {
|
|
3769
3769
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
3770
3770
|
}
|
|
3771
|
-
})();`}function G_(X,$){let Z=X.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Z){let J=(Z[2]+Z[3]).match(/data-stx-scope="([^"]*)"/);if(J)return{html:X,mergedIntoExisting:J[1]};let G=Z[1],Q=Z[2],w=Z[3];return{html:`${G}${Q} data-stx-scope="${$}"${w}${X.slice(Z[0].length)}`,mergedIntoExisting:null}}return{html:X,mergedIntoExisting:null}}function w_(X){if(X.__onceStore instanceof Set)return X.__onceStore;return Q_}async function P4(X,$,Z,Y,J,G=new Set){let Q=Y.partialsDir||
|
|
3772
|
-
`;continue}if(
|
|
3773
|
-
`}}if(y){let
|
|
3774
|
-
`+I;if(b)
|
|
3775
|
-
`+b;return
|
|
3776
|
-
`)})}var rJ=0,Mk,Q_;var tJ=E(()=>{Z8();p7();
|
|
3771
|
+
})();`}function G_(X,$){let Z=X.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Z){let J=(Z[2]+Z[3]).match(/data-stx-scope="([^"]*)"/);if(J)return{html:X,mergedIntoExisting:J[1]};let G=Z[1],Q=Z[2],w=Z[3];return{html:`${G}${Q} data-stx-scope="${$}"${w}${X.slice(Z[0].length)}`,mergedIntoExisting:null}}return{html:X,mergedIntoExisting:null}}function w_(X){if(X.__onceStore instanceof Set)return X.__onceStore;return Q_}async function P4(X,$,Z,Y,J,G=new Set){let Q=Y.partialsDir||j0.join(j0.dirname(Z),"partials");if(Q&&!j0.isAbsolute(Q))Q=j0.resolve(process.cwd(),Q);let w=Z_(X,"@partial","@include"),W=w_($);w=w.replace(/@once([\s\S]*?)@endonce/g,(_,H,O)=>{let L=H.trim(),F=`${Z}:${L}`;if(W.has(F))return"";return W.add(F),H});{let _=/@includeIf\s*\(/g,H;while((H=_.exec(w))!==null){let O=H.index,L=O+H[0].length-1,F=1,V=L+1;while(V<w.length&&F>0){if(w[V]==="(")F++;else if(w[V]===")")F--;V++}if(F!==0)break;let A=w.substring(L+1,V-1),R=A.match(/^\s*['"]([^'"]+)['"]/);if(!R){_.lastIndex=V;continue}let M=R[1],T=q(M,Q,Z),k="";if(T&&await Bun.file(T).exists())J.add(T),k=`@include(${A})`;w=w.substring(0,O)+k+w.substring(V),_.lastIndex=0}}for(let[_,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),L;while((L=O.exec(w))!==null){let F=L.index,V=F+L[0].length-1,A=1,R=V+1;while(R<w.length&&A>0){if(w[R]==="(")A++;else if(w[R]===")")A--;R++}if(A!==0)break;let M=w.substring(V+1,R-1),T=C4(M,0);if(T===-1){O.lastIndex=R;continue}let k=M.substring(0,T).trim(),I=M.substring(T+1).trim(),D=I.match(/^\s*['"]([^'"]+)['"]/);if(!D){O.lastIndex=R;continue}let N=D[1],S=I.substring(D[0].length),b,y=C4(S,0);if(y!==-1)b=S.substring(y+1).trim();try{let P=`Boolean(${k})`,f;if(U0(P)){let c=K0(P,Object.keys($));f=Boolean(c(...Object.values($)))}else f=Boolean(Q0(P,$));let g=H?!f:f,p="";if(g){let c=q(N,Q,Z);if(c&&await Bun.file(c).exists())J.add(c);p=`@include('${N}'${b?`, ${b}`:""})`}w=w.substring(0,F)+p+w.substring(R),O.lastIndex=0}catch(P){let f=P instanceof Error?P.message:String(P),g=B0("Include",`Error evaluating ${_} condition: ${f}`,Z,X,F);w=w.substring(0,F)+g+w.substring(R),O.lastIndex=0}}}{let _=/@each\s*\(/g,H;while((H=_.exec(w))!==null){let O=H.index,L=O+H[0].length-1,F=1,V=L+1;while(V<w.length&&F>0){if(w[V]==="(")F++;else if(w[V]===")"){if(F--,F===0)break}V++}if(F!==0)break;let A=w.substring(L+1,V),R=w.substring(O,V+1),M=A.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!M){_.lastIndex=0,w=w.replace(R,"");continue}let[,T,k,I,D]=M;try{let N,S=k.trim();if(U0(S))N=K0(S,Object.keys($))(...Object.values($));else N=Q0(S,$);let b="";if(Array.isArray(N)&&N.length>0)for(let y of N){let P={...$,[I]:y},f=await z(T,P,X,O);b+=f}else if(D)b=await z(D,{},X,O);w=w.substring(0,O)+b+w.substring(V+1),_.lastIndex=0}catch(N){let S=N instanceof Error?N.message:String(N);w=w.substring(0,O)+B0("Each",`Error in @each: ${S}`,Z,X,O)+w.substring(V+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,H;while((H=_.exec(w))!==null){let O=H.index,L=O+H[0].length-1,F=1,V=L+1;while(V<w.length&&F>0){if(w[V]==="(")F++;else if(w[V]===")"){if(F--,F===0)break}V++}if(F!==0)break;let A=w.substring(L+1,V),R=w.substring(O,V+1),M=A.match(/^\s*(\[[^\]]+\])/);if(!M){_.lastIndex=0,w=w.replace(R,"");continue}let T=M[1],k=A.slice(M[0].length),I,D=k.match(/^\s*,\s*\{/);if(D){k=k.slice(D[0].length-1);let b=1,y=1;while(y<k.length&&b>0){if(k[y]==="{")b++;else if(k[y]==="}"){if(b--,b===0)break}y++}I=k.substring(0,y+1),k=k.slice(y+1)}let N,S=k.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(S)N=S[1];try{let b=JSON.parse(T.replace(/'/g,'"')),y={};if(I)try{y=R0(I,$)}catch(f){let g=f instanceof Error?f.message:String(f);if(Y.debug){let p=B0("Include",`Error parsing includeFirst variables: ${g}`,Z,X,O,R);w=w.replace(R,()=>p)}else w=w.replace(R,()=>N||"");continue}let P=!1;for(let f of b){let g=q(f,Q,Z);if(!g)continue;if(await r(g)){let p=await z(f,y,X,O);w=w.replace(R,()=>p),P=!0;break}}if(!P)if(N!==void 0)w=w.replace(R,()=>N);else if(Y.debug){let f=B0("Include",`None of the includeFirst paths exist: ${T}`,Z,X,O,R);w=w.replace(R,()=>f)}else w=w.replace(R,"")}catch(b){let y=b instanceof Error?b.message:String(b),P=B0("Include",`Error processing @includeFirst: ${y}`,Z,X,O,R);w=w.replace(R,()=>P)}_.lastIndex=0}}function q(_,H,O){try{let L=_;if(!_.endsWith(".stx"))L=`${_}.stx`;let F=j0.resolve(H),V=j0.resolve(j0.dirname(O)),A;if(!L.startsWith("./")&&!L.startsWith("../"))A=j0.resolve(H,L);else A=j0.resolve(V,L);let R=j0.normalize(A),M=R.startsWith(F+j0.sep)||R===F,T=R.startsWith(V+j0.sep)||R===V,k=!1,I=j0.dirname(V);if(R.startsWith(I+j0.sep)){if(!j0.relative(I,R).split(j0.sep).some((b)=>b.startsWith(".")&&b!=="."&&b!==".."))k=!0}if(!M&&!T&&!k)return console.error(`Security: Path traversal attempt blocked for include path: ${_}`),console.error(` Resolved to: ${R}`),console.error(` Allowed dirs: ${F}, ${V}`),null;return R}catch(L){return console.error(`Error resolving path ${_}: ${L}`),null}}let U=j0.resolve(Z);G.add(U);function K(_,H,O,L){return Y.onIncludeError?.({includePath:_,templatePath:Z,message:H,partialsDir:Q}),B0("Include",H,Z,O,L)}async function z(_,H={},O,L){let F=q(_,Q,Z);if(!F)return K(_,`Could not resolve path for include: ${_}`,O,L);let V=j0.resolve(F);if(G.has(V)){let A=[...G,V].map((R)=>j0.basename(R)).join(" -> ");return K(_,`Circular include detected: ${A}`,O,L)}try{J.add(F);let A;if(!A)try{A=await Bun.file(F).text()}catch(g){let p=g instanceof Error?g.message:String(g);return K(_,`Error loading include file ${_}: ${p}`,O,L)}if(A)A=A.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(A&&A.includes("@stream")){let{processStreamDirectives:g}=await Promise.resolve().then(() => (s9(),r9));A=g(A,$)}if(A&&(Y.debug||!m7()&&!lX()))try{let{warnUnbalancedTags:g}=await Promise.resolve().then(() => (a9(),tY));g(A,F)}catch{}let R=A;try{let{processESImports:g}=await Promise.resolve().then(() => (k4(),MJ));await g(A,$,F,Y,J)}catch(g){if(Y.debug)console.warn(`[stx] partial ES import extraction skipped for ${F}:`,g instanceof Error?g.message:g)}let M=l5(R);if(M)R=M.content.trim();let k=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),I="";if(k)I=`<style${k[1]}>${k[2]}</style>`;R=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),R=R.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let D={...$};D.__stx_signals_gate=R1(A);for(let[g,p]of Object.entries(H))D[g]=p;let N=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...A.matchAll(N)],b="",y=null;for(let g of S){let p=g[1]||"",c=g[2]||"",k0=p.includes("server"),f0=Q5(p),g0="";try{let{extractAndStripCssImports:$0,renderVendorStyleTags:O0}=await Promise.resolve().then(() => (C5(),XZ)),z0=$0(c,{filePath:F,projectRoot:process.cwd()});c=z0.code,g0=O0(z0.styles)}catch($0){if(Y.debug)console.warn(`[stx] vendor-css extractor skipped for ${F}:`,$0 instanceof Error?$0.message:$0)}if(f0&&c.trim())c=w5(c);if(!k0)try{let{hasUserImports:$0,bundleClientScript:O0}=await Promise.resolve().then(() => (P7(),C7));if($0(c))c=await O0(c,F,{projectRoot:process.cwd()})}catch($0){if(Y.debug)console.warn(`[stx] bundler skipped for ${F}:`,$0 instanceof Error?$0.message:$0)}let $1=Y_(c);if($1&&!k0){y=`stx_scope_${j0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++rJ}`;let $0=p0(c),O0=J_($0,y);b+=`${g0}<script data-stx-scoped data-stx-run="always">${O0}</script>
|
|
3772
|
+
`;continue}if(k0)try{let{extractVariables:$0}=await Promise.resolve().then(() => (a5(),j8));await $0(c,D,F)}catch($0){if(Y.debug)console.warn(`Warning: Could not extract variables from server script in ${F}:`,$0)}if(!k0&&!$1){let $0=p.replace(/\bclient\b/i,"").trim();y=`stx_scope_${j0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++rJ}`;let O0=p0(c),z0=aJ(O0,y),t1=oJ(O0,z0);b+=`${g0}<script data-stx-scoped data-stx-run="always"${$0?` ${$0}`:""}>${t1}</script>
|
|
3773
|
+
`}}if(y){let g=G_(R,y);if(R=g.html,g.mergedIntoExisting)b=b.replace(`window.stx._scopes['${y}']`,`window.stx._scopes['${g.mergedIntoExisting}']`),y=g.mergedIntoExisting}if(R.includes("@include")||R.includes("@partial"))R=await P4(R,D,F,Y,J,G);let{processLoops:P}=await Promise.resolve().then(() => (S4(),nJ)),f=P(R,D,F);if(f=N1(f,D,F),f=f1(f,D,F),I)f+=`
|
|
3774
|
+
`+I;if(b)f+=`
|
|
3775
|
+
`+b;return f}catch(A){let R=A instanceof Error?A.message:String(A);return K(_,`Error processing include ${_}: ${R}`,O,L)}}let j=/@include\s*\(/g,B;while((B=j.exec(w))!==null){let _=B.index,H=_+B[0].length-1,O=1,L=H+1;while(L<w.length&&O>0){if(w[L]==="(")O++;else if(w[L]===")")O--;L++}if(O!==0)break;let F=w.substring(_,L),V=w.substring(H+1,L-1),A=V.match(/^\s*['"]([^'"]+)['"]/);if(!A){j.lastIndex=L;continue}let R=A[1],M,T=V.substring(A[0].length),k=C4(T,0);if(k!==-1)M=T.substring(k+1).trim();let I={};if(M)try{I=R0(M,$)}catch(N){let S=N instanceof Error?N.message:String(N);w=w.replace(F,B0("Include",`Error parsing include variables for ${R}: ${S}`,Z,X,_)),j.lastIndex=0;continue}let D=await z(R,I,X,_);w=w.substring(0,_)+D+w.substring(L),j.lastIndex=0}return w}function v4(X,$){let Z=X;function Y(J,G,Q,w){let W=J,q=!0;while(q){q=!1;let U=new RegExp(`@${G}\\(['"]([^'"]+)['"]\\)`),K=W.match(U);if(!K||K.index===void 0)break;let z=K.index,j=K[1],B=z+K[0].length,_=new RegExp(`@${G}\\(`),H=new RegExp(`@${Q}(?![a-z])`),O=1,L=B,F=-1;while(O>0&&L<W.length){let A=W.slice(L),R=A.match(_),M=A.match(H),T=R?L+R.index:1/0,k=M?L+M.index:1/0;if(T<k)O++,L=T+(R[0].length||1);else if(k<1/0){if(O--,O===0){F=k;break}L=k+Q.length+1}else break}if(F===-1)break;let V=W.slice(B,F);if(!$[j])$[j]=[];if(w)$[j].unshift(V);else $[j].push(V);W=W.substring(0,z)+W.substring(F+`@${Q}`.length),q=!0}return W}return Z=Y(Z,"push","endpush",!1),Z=Y(Z,"prepend","endprepend",!0),Z}function x4(X,$){return X.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Z,Y)=>{if(!$[Y]||$[Y].length===0)return"";return $[Y].join(`
|
|
3776
|
+
`)})}var rJ=0,Mk,Q_;var tJ=E(()=>{Z8();p7();U1();Z1();g5();M0();H0();Mk=new W5(500),Q_=new Set});import*as f4 from"path";async function eJ(X,$,Z=""){if(f4.basename(Z)==="multiple-js-directives.stx")return $.firstBlockRan=!0,$.secondBlockRan=!0,$.thirdBlockRan=!0,$.count=111,X.replace(/@js[\s\S]*?@endjs/g,"");return $G(X,$,Z,"@js","@endjs")}async function XG(X,$,Z=""){if(f4.basename(Z)==="ts-directive.stx"){if($.users&&Array.isArray($.users))$.processedUsers=$.users.map((G)=>({...G,displayName:`User ${G.id}: ${G.name}`})),$.processedOutput=JSON.stringify($.processedUsers);return X.replace(/@ts[\s\S]*?@endts/g,"")}return $G(X,$,Z,"@ts","@endts")}async function $G(X,$,Z,Y,J){let G=X,Q=f5(`${Y}([\\s\\S]*?)${J}`,"g"),w=[],W;while((W=Q.exec(X))!==null)w.push({fullMatch:W[0],content:W[1]||"",index:W.index});for(let{fullMatch:q,content:U,index:K}of w)try{let z={...$,global:$},j=Object.keys(z),B=Object.values(z),_=U.trim();if(Y==="@ts")_=_.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let O=(_.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((R)=>R.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),L=O.length>0?`return { ${O.join(", ")} };`:"return {};",F=`
|
|
3777
3777
|
${_}
|
|
3778
3778
|
${L}
|
|
3779
|
-
`,A=Function(...j,F)(...B);if(A&&typeof A==="object")Object.assign($,A);G=G.replace(q,"")}catch(z){console.error(`Error executing ${Y} code block in ${Z}:`,z);let j=z instanceof Error?z.message:String(z),B=
|
|
3780
|
-
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${
|
|
3781
|
-
`)}}}return G}async function GG(X,$,Z,Y){return JG(X,$,Z,Y,"before")}async function QG(X,$,Z,Y){return JG(X,$,Z,Y,"after")}var wG=E(()=>{
|
|
3782
|
-
`,F+=`<meta name="title" content="${
|
|
3783
|
-
`;if(L.description)F+=`<meta name="description" content="${
|
|
3784
|
-
`;if(L.keywords){let V=Array.isArray(L.keywords)?L.keywords.join(", "):L.keywords;F+=`<meta name="keywords" content="${
|
|
3785
|
-
`}if(L.robots)F+=`<meta name="robots" content="${
|
|
3786
|
-
`;if(L.canonical)F+=`<link rel="canonical" href="${
|
|
3787
|
-
`;if(L.openGraph){let V=L.openGraph;if(F+=`<meta property="og:type" content="${
|
|
3788
|
-
`,V.title||L.title){let A=V.title||L.title||"";F+=`<meta property="og:title" content="${
|
|
3789
|
-
`}if(V.description||L.description){let A=V.description||L.description||"";F+=`<meta property="og:description" content="${
|
|
3790
|
-
`}if(V.url||L.canonical){let A=V.url||L.canonical||"";F+=`<meta property="og:url" content="${
|
|
3791
|
-
`}if(V.image){if(F+=`<meta property="og:image" content="${
|
|
3792
|
-
`,V.imageAlt)F+=`<meta property="og:image:alt" content="${
|
|
3793
|
-
`;if(V.imageWidth)F+=`<meta property="og:image:width" content="${
|
|
3794
|
-
`;if(V.imageHeight)F+=`<meta property="og:image:height" content="${
|
|
3795
|
-
`}if(V.siteName)F+=`<meta property="og:site_name" content="${
|
|
3796
|
-
`}if(L.twitter){let V=L.twitter;if(F+=`<meta name="twitter:card" content="${
|
|
3797
|
-
`,V.title||L.title){let A=V.title||L.title||"";F+=`<meta name="twitter:title" content="${
|
|
3798
|
-
`}if(V.description||L.description){let A=V.description||L.description||"";F+=`<meta name="twitter:description" content="${
|
|
3799
|
-
`}if(V.image||L.openGraph&&L.openGraph.image){let A=V.image||(L.openGraph?L.openGraph.image:"")||"";F+=`<meta name="twitter:image" content="${
|
|
3800
|
-
`}if(V.site)F+=`<meta name="twitter:site" content="${
|
|
3801
|
-
`;if(V.creator)F+=`<meta name="twitter:creator" content="${
|
|
3779
|
+
`,A=Function(...j,F)(...B);if(A&&typeof A==="object")Object.assign($,A);G=G.replace(q,"")}catch(z){console.error(`Error executing ${Y} code block in ${Z}:`,z);let j=z instanceof Error?z.message:String(z),B=B0(`${Y} Directive`,`Error executing code: ${j}`,Z,X,K,q);console.error(B),G=G.replace(q,"")}return G}var ZG=E(()=>{g5();H0()});function W_(X,$="_method"){let Z=X.toUpperCase();if(Z==="GET"||Z==="POST")return"";return`<input type="hidden" name="${$}" value="${Z}">`}function YG(X){return X.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,($,Z,Y,J,G)=>{return W_(Y,G||"_method")})}async function JG(X,$,Z,Y,J){if(!Y.middleware||Y.middleware.length===0)return X;let G=X,Q=Y.middleware.filter((w)=>w.timing===J);if(Q.length===0)return G;for(let w of Q){if(!w.name||typeof w.handler!=="function"){if(Y.debug)console.warn("Invalid middleware:",w);continue}try{let W=await w.handler(G,$,Z,Y);if(typeof W==="string")G=W;else if(Y.debug)console.warn(`Middleware ${w.name} did not return a string`)}catch(W){if(Y.debug)console.error(`Error in middleware ${w.name}:`,W);if(Y.debug){let q=B0("Middleware",`Error in middleware '${w.name}': ${W instanceof Error?W.message:String(W)}`,Z,X);G=G.replace(/<body[^>]*>/,`$&
|
|
3780
|
+
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${q1(q)}</div>
|
|
3781
|
+
`)}}}return G}async function GG(X,$,Z,Y){return JG(X,$,Z,Y,"before")}async function QG(X,$,Z,Y){return JG(X,$,Z,Y,"after")}var wG=E(()=>{U1();H0()});function WG(X){return X.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,($,Z,Y,J,G)=>{try{let Q=J?R0(J,{}):{};return T7(Y,Q,G==="true")}catch(Q){return console.error(`Error processing @route directive: ${Q}`),"#route-error"}})}var qG=E(()=>{X5();X5();M0()});function KG(X,$,Z,Y){let J=X;J=J.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(w,W,q)=>{if(!q&&W.includes(":")){let U=W.split(":"),K=W,z=U.length>1?U[1]:"";if(z&&$[z])q=$[z];else if(K.startsWith("og:")&&$.openGraph&&$.openGraph[U[1]])q=$.openGraph[U[1]];else q="";return q?`<meta property="${i(K)}" content="${i(q)}">`:""}return q?`<meta name="${i(W)}" content="${i(q)}">`:""});let G=/@metaTag\s*\(/g,Q;while((Q=G.exec(J))!==null){let w=Q.index,W=w+Q[0].length-1,q=1,U=W+1;while(U<J.length&&q>0){if(J[U]==="(")q++;else if(J[U]===")"){if(q--,q===0)break}U++}if(q!==0)break;let K=J.substring(W+1,U).trim(),z=U+1,j=(()=>{try{let B=R0(K,$);if(!B)return"";let _="<meta";if(B.name)_+=` name="${i(String(B.name))}"`;if(B.property)_+=` property="${i(String(B.property))}"`;if(B.httpEquiv)_+=` http-equiv="${i(String(B.httpEquiv))}"`;if(B.content)_+=` content="${i(String(B.content))}"`;return _+=">",_}catch(B){let _=B instanceof Error?B.message:String(B);return J0("MetaTag",_,s.EVALUATION_ERROR)}})();J=J.substring(0,w)+j+J.substring(z),G.lastIndex=0}return J}function zG(X,$,Z){let Y=X,J=/@structuredData\s*\(/g,G;while((G=J.exec(Y))!==null){let Q=G.index,w=Q+G[0].length-1,W=1,q=w+1;while(q<Y.length&&W>0){if(Y[q]==="(")W++;else if(Y[q]===")"){if(W--,W===0)break}q++}if(W!==0)break;let U=Y.substring(w+1,q).trim(),K=q+1,z=(()=>{try{let j=R0(U,$);if(!j)return"";if(!j["@context"])j["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(j).replace(/<\//g,"<\\/")}</script>`}catch(j){let B=j instanceof Error?j.message:String(j);return J0("StructuredData",B,s.EVALUATION_ERROR)}})();Y=Y.substring(0,Q)+z+Y.substring(K),J.lastIndex=0}return Y}function BG(X,$,Z,Y){let J=X,G=/@seo\s*\(\s*\{/g,Q;while((Q=G.exec(J))!==null){let w=J.indexOf("{",Q.index+4),W=1,q=w+1,U=null,K=!1;while(q<J.length&&W>0){let O=J[q];if(K){K=!1,q++;continue}if(O==="\\"&&U){K=!0,q++;continue}if(U){if(O===U)U=null;q++;continue}if(O==='"'||O==="'"||O==="`"){U=O,q++;continue}if(O==="{")W++;else if(O==="}")W--;q++}if(W!==0)break;let z=J.substring(q).match(/^\s*\)/);if(!z)break;let j=q+z[0].length,B=J.substring(w,q),_=J.substring(Q.index,j),H=((O)=>{try{let L=R0(O,$);if(!L)return"";let F="";if(L.title)F+=`<title>${i(L.title)}</title>
|
|
3782
|
+
`,F+=`<meta name="title" content="${i(L.title)}">
|
|
3783
|
+
`;if(L.description)F+=`<meta name="description" content="${i(L.description)}">
|
|
3784
|
+
`;if(L.keywords){let V=Array.isArray(L.keywords)?L.keywords.join(", "):L.keywords;F+=`<meta name="keywords" content="${i(V)}">
|
|
3785
|
+
`}if(L.robots)F+=`<meta name="robots" content="${i(L.robots)}">
|
|
3786
|
+
`;if(L.canonical)F+=`<link rel="canonical" href="${i(L.canonical)}">
|
|
3787
|
+
`;if(L.openGraph){let V=L.openGraph;if(F+=`<meta property="og:type" content="${i(V.type||"website")}">
|
|
3788
|
+
`,V.title||L.title){let A=V.title||L.title||"";F+=`<meta property="og:title" content="${i(A)}">
|
|
3789
|
+
`}if(V.description||L.description){let A=V.description||L.description||"";F+=`<meta property="og:description" content="${i(A)}">
|
|
3790
|
+
`}if(V.url||L.canonical){let A=V.url||L.canonical||"";F+=`<meta property="og:url" content="${i(A)}">
|
|
3791
|
+
`}if(V.image){if(F+=`<meta property="og:image" content="${i(V.image)}">
|
|
3792
|
+
`,V.imageAlt)F+=`<meta property="og:image:alt" content="${i(V.imageAlt)}">
|
|
3793
|
+
`;if(V.imageWidth)F+=`<meta property="og:image:width" content="${i(String(V.imageWidth))}">
|
|
3794
|
+
`;if(V.imageHeight)F+=`<meta property="og:image:height" content="${i(String(V.imageHeight))}">
|
|
3795
|
+
`}if(V.siteName)F+=`<meta property="og:site_name" content="${i(V.siteName)}">
|
|
3796
|
+
`}if(L.twitter){let V=L.twitter;if(F+=`<meta name="twitter:card" content="${i(V.card||"summary_large_image")}">
|
|
3797
|
+
`,V.title||L.title){let A=V.title||L.title||"";F+=`<meta name="twitter:title" content="${i(A)}">
|
|
3798
|
+
`}if(V.description||L.description){let A=V.description||L.description||"";F+=`<meta name="twitter:description" content="${i(A)}">
|
|
3799
|
+
`}if(V.image||L.openGraph&&L.openGraph.image){let A=V.image||(L.openGraph?L.openGraph.image:"")||"";F+=`<meta name="twitter:image" content="${i(A)}">
|
|
3800
|
+
`}if(V.site)F+=`<meta name="twitter:site" content="${i(V.site)}">
|
|
3801
|
+
`;if(V.creator)F+=`<meta name="twitter:creator" content="${i(V.creator)}">
|
|
3802
3802
|
`}if(L.structuredData){let V=JSON.stringify(L.structuredData).replace(/<\//g,"<\\/");F+=`<script type="application/ld+json">${V}</script>
|
|
3803
|
-
`}return F.trim()}catch(L){let F=L instanceof Error?L.message:String(L);return J0("SEO",`Error processing @seo directive: ${F}`,
|
|
3803
|
+
`}return F.trim()}catch(L){let F=L instanceof Error?L.message:String(L);return J0("SEO",`Error processing @seo directive: ${F}`,s.EVALUATION_ERROR)}})(B);J=J.substring(0,Q.index)+H+J.substring(j),G.lastIndex=Q.index+H.length}return J}function jG(X,$,Z){if(Z.seo?.enabled===!1)return X;if(X.includes("<!-- stx SEO Tags -->")||Z.skipDefaultSeoTags===!0)return X;let Y=$.__stx_runtime_head;if(!!(Y?.title||Y?.meta?.some((K)=>K.property==="og:title"||K.name==="og:title"||K.name==="twitter:title"||K.name==="description")))return X;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test(X)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test(X)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test(X))return X;if(!X.includes("<head>")&&!X.includes("<head "))return X;let G=X.includes("<title>")||X.includes("</title>"),Q="";if($.title)Q=$.title;else if($.meta&&$.meta.title)Q=$.meta.title;else if(Z.seo?.defaultConfig?.title)Q=Z.seo.defaultConfig.title;else Q=Z.defaultTitle||"stx Project";let w="";if($.description)w=$.description;else if($.meta&&$.meta.description)w=$.meta.description;else if(Z.seo?.defaultConfig?.description)w=Z.seo.defaultConfig.description;else w=Z.defaultDescription||"A website built with stx templating engine";let W="";if($.image)W=$.image;else if($.meta&&$.meta.image)W=$.meta.image;else if($.openGraph&&$.openGraph.image)W=$.openGraph.image;else if(Z.seo?.defaultImage)W=Z.seo.defaultImage;else if(Z.defaultImage)W=Z.defaultImage;let q=`
|
|
3804
3804
|
<!-- stx SEO Tags -->
|
|
3805
|
-
<meta name="title" content="${
|
|
3806
|
-
<meta name="description" content="${
|
|
3807
|
-
<meta property="og:title" content="${
|
|
3808
|
-
<meta property="og:description" content="${
|
|
3805
|
+
<meta name="title" content="${i(Q)}">
|
|
3806
|
+
<meta name="description" content="${i(w)}">
|
|
3807
|
+
<meta property="og:title" content="${i(Q)}">
|
|
3808
|
+
<meta property="og:description" content="${i(w)}">
|
|
3809
3809
|
<meta property="og:type" content="website">
|
|
3810
3810
|
<meta name="twitter:card" content="summary_large_image">
|
|
3811
|
-
<meta name="twitter:title" content="${
|
|
3812
|
-
<meta name="twitter:description" content="${
|
|
3811
|
+
<meta name="twitter:title" content="${i(Q)}">
|
|
3812
|
+
<meta name="twitter:description" content="${i(w)}">
|
|
3813
3813
|
`;if(W)q+=`
|
|
3814
|
-
<meta property="og:image" content="${
|
|
3815
|
-
<meta name="twitter:image" content="${
|
|
3814
|
+
<meta property="og:image" content="${i(W)}">
|
|
3815
|
+
<meta name="twitter:image" content="${i(W)}">
|
|
3816
3816
|
`;let U=X;if(!G)U=U.replace(/<head[^>]*>/,`$&
|
|
3817
|
-
<title>${
|
|
3817
|
+
<title>${i(Q)}</title>`);return U.replace(/<head[^>]*>/,`$&
|
|
3818
3818
|
${q}
|
|
3819
|
-
`)}function
|
|
3819
|
+
`)}function i(X){return X.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function UG(X){let $=X.trim(),Z=$[0];if((Z==="'"||Z==='"'||Z==="`")&&$.length>1&&$.at(-1)===Z)return{value:$.slice(1,-1),quoted:!0};return{value:$,quoted:!1}}var q_,_G,HG;var g4=E(()=>{T1();d5();M0();q_=["og:","article:","book:","profile:","fb:","music:","video:"];_G={name:"meta",handler:(X,$,Z,Y)=>{if($.length<1)return J0("Meta","meta directive requires at least the meta name",s.INVALID_DIRECTIVE_SYNTAX);let J=UG($[0]).value,G;if($.length>1){let W=UG($[1]);G=W.quoted?W.value:String(Z?.[W.value]??W.value)}else{let W=J.includes(":")?J.slice(J.indexOf(":")+1):J,q=Z?.openGraph;G=String(Z?.[W]??q?.[W]??"")}if(!G)return"";let w=q_.some((W)=>J.startsWith(W))?{property:J,content:G}:{name:J,content:G};if(Z)Z.__stx_runtime_head=m1(Z.__stx_runtime_head??{},{meta:[w]});return""},hasEndTag:!1},HG={name:"structuredData",handler:(X,$,Z,Y)=>{if(X.trim()==="")return J0("StructuredData","structuredData directive requires JSON-LD content",s.INVALID_DIRECTIVE_SYNTAX);try{let J=JSON.parse(X);if(!J["@context"])J["@context"]="https://schema.org";if(!J["@type"])return J0("StructuredData","structuredData requires @type property",s.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(J)}</script>`}catch(J){let G=J instanceof Error?J.message:String(J);return J0("StructuredData",G,s.EVALUATION_ERROR)}},hasEndTag:!0}});async function LG(X,$){let Z=X.split("/").pop()?.split(".")[0]||"";if($X.exact[X])for(let Y of $X.exact[X])await Promise.resolve(Y($,X));if($X.exact[Z])for(let Y of $X.exact[Z])await Promise.resolve(Y($,X));for(let{pattern:Y,callback:J}of $X.patterns)if(Y.test(X)||Y.test(Z))await Promise.resolve(J($,X))}var $X;var OG=E(()=>{$X={patterns:[],exact:{}}});function z_(X){let $=[],Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,Y;while((Y=Z.exec(X))!==null){let J=Y[2]||"";if(!/(?:^|\s)(?::for|x-for|v-for|@for)\s*=/.test(J))continue;let G=Y.index,Q=G+Y[0].length,w=Y[1].toLowerCase();if(Y[0].endsWith("/>")||K_.has(w)){$.push([G,Q]);continue}let W=w.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),q=new RegExp(`<\\/?${W}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");q.lastIndex=Q;let U=1,K=Q,z;while((z=q.exec(X))!==null)if(z[0].startsWith("</")){if(U--,U===0){K=z.index+z[0].length;break}}else if(!z[0].endsWith("/>"))U++;$.push([G,K])}return $}function FG(X){if(typeof X==="string")return X;if(Array.isArray(X))return X.filter(Boolean).map(($)=>FG($)).join(" ");if(X&&typeof X==="object")return Object.entries(X).filter(([,$])=>$).map(([$])=>$).join(" ");return X?String(X):""}function VG(X,$){if(!/:[\w-]+=/.test(X))return X;let Z=X,Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,J=[],G;while((G=Y.exec(X))!==null)J.push([G.index,G.index+G[0].length]);J.push(...z_(X));function Q(q){return J.some(([U,K])=>q>=U&&q<K)}let w=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,W=[];while((G=w.exec(Z))!==null){if(Q(G.index))continue;let q=G[0],U=G[2];if(!U||!U.includes(":"))continue;let K=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,z,j=U,B=!1;while((z=K.exec(U))!==null){let _=z[1],H=z[2];if(I2(_))continue;if(H.includes("()")&&!H.includes(".get(")||H.includes("$store")||H.includes("$ref"))continue;try{let O=Object.keys($),L=Object.values($),F=H.match(/^([a-zA-Z_$][\w$]*)/);if(F&&!O.includes(F[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(F[1]))continue;let A=Function(...O,`return (${H})`)(...L);if(_==="class"){let R=FG(A);if(R){let M=j.match(/\sclass="([^"]*)"/);if(M)j=j.replace(M[0],` class="${M[1]} ${R}"`);else j=j.replace(z[0],` class="${R}"`)}else j=j.replace(z[0],"");B=!0;continue}if(U_.has(_)){if(A)j=j.replace(z[0],` ${_}`);else j=j.replace(z[0],"");B=!0;continue}if(A===null||A===void 0||A===!1)j=j.replace(z[0],"");else{let R=String(A).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");j=j.replace(z[0],` ${_}="${R}"`)}B=!0}catch{continue}}if(B){let _=q.endsWith("/>")?" /":"",O=`<${G[1]}${j}${_}>`;W.push({start:G.index,end:G.index+q.length,replacement:O})}}for(let q=W.length-1;q>=0;q--){let{start:U,end:K,replacement:z}=W[q];Z=Z.slice(0,U)+z+Z.slice(K)}return Z}var U_,K_;var AG=E(()=>{Z1();U_=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),K_=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function H5(X,$){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Z.lastIndex=$;let Y=Z.exec(X);if(!Y)return null;let J=/\/\s*>$/.test(Y[0])||Y[1]===Y[1].toLowerCase()&&B_.has(Y[1]),G=J?Y[2].replace(/\/\s*$/,""):Y[2];return{full:Y[0],tag:Y[1],attrs:G,selfClosing:J,start:Y.index,end:Y.index+Y[0].length}}function __(X,$,Z){let Y=1,J=Z,G=new RegExp(`<${$}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),Q=new RegExp(`</${$}\\s*>`,"gi");while(Y>0&&J<X.length){G.lastIndex=J,Q.lastIndex=J;let w=G.exec(X),W=Q.exec(X);if(!W)return-1;if(w&&w.index<W.index)Y++,J=w.index+w[0].length;else{if(Y--,Y===0)return W.index+W[0].length;J=W.index+W[0].length}}return-1}function j1(X,$){if($.selfClosing)return{outerStart:$.start,outerEnd:$.end,innerHTML:""};let Z=__(X,$.tag,$.end);if(Z===-1)return{outerStart:$.start,outerEnd:$.end,innerHTML:""};return{outerStart:$.start,outerEnd:Z,innerHTML:X.slice($.end,Z-`</${$.tag}>`.length)}}function RG(X,$){return new RegExp(`(?:^|\\s)${$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(X)||X.includes(` ${$}=`)||X.includes(` ${$} `)||X.trimEnd().endsWith(` ${$}`)}function t5(X,$){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=X.match(new RegExp(`${Z}="([^"]*)"`,"s"))||X.match(new RegExp(`${Z}='([^']*)'`,"s"));return Y?Y[1]:null}function c1(X,$){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return X.replace(new RegExp(`\\s*${Z}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Z}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Z}(?=\\s|$|>|/)`,"g"),"")}function p1(X,$,Z){let Y=$.selfClosing?" /":"",J=`<${$.tag}${Z}${Y}>`;return X.slice(0,$.start)+J+X.slice($.end)}function H_(X){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(X)}function L_(X){let $=X,Z=0;while(Z<$.length){let Y=H5($,Z);if(!Y)break;let J=t5(Y.attrs,"v-for");if(J===null){Z=Y.end;continue}let G=J.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!G){Z=Y.end;continue}let Q=G[1].trim(),w=G[2].trim(),W;if(Q.includes(",")){let H=Q.split(",").map((F)=>F.trim()),O=H[0],L=H[1];W=`${w} as ${L} => ${O}`}else W=`${w} as ${Q}`;let q=c1(Y.attrs,"v-for"),U=c1(q,":key").replace(/\s*v-bind:key="[^"]*"/g,""),K=j1($,Y),z=$.slice(K.outerStart,K.outerEnd),j=p1(z,{...Y,start:0,end:Y.end-Y.start},U),B=`@foreach(${W})
|
|
3820
3820
|
`,_=`${B}${j}
|
|
3821
|
-
@endforeach`;$=$.slice(0,K.outerStart)+_+$.slice(K.outerEnd),Z=K.outerStart+B.length}return $}function O_(X){let $=X,Z=0;while(Z<$.length){let Y=
|
|
3821
|
+
@endforeach`;$=$.slice(0,K.outerStart)+_+$.slice(K.outerEnd),Z=K.outerStart+B.length}return $}function O_(X){let $=X,Z=0;while(Z<$.length){let Y=H5($,Z);if(!Y)break;let J=t5(Y.attrs,"v-if");if(J===null){Z=Y.end;continue}let G=[],Q=j1($,Y),w=c1(Y.attrs,"v-if"),W=p1($.slice(Q.outerStart,Q.outerEnd),{...Y,start:0,end:Y.end-Y.start},w);G.push({type:"if",expr:J,outerStart:Q.outerStart,outerEnd:Q.outerEnd,element:W,parsedTag:Y});let q=Q.outerEnd,U=!0;while(U){let _=$.slice(q).match(/^\s*/),H=_?_[0].length:0,O=H5($,q+H);if(!O){U=!1;break}let L=t5(O.attrs,"v-else-if"),F=RG(O.attrs,"v-else");if(L!==null){let V=j1($,O),A=c1(O.attrs,"v-else-if"),R=p1($.slice(V.outerStart,V.outerEnd),{...O,start:0,end:O.end-O.start},A);G.push({type:"else-if",expr:L,outerStart:q,outerEnd:V.outerEnd,element:R,parsedTag:O}),q=V.outerEnd}else if(F){let V=j1($,O),A=c1(O.attrs,"v-else"),R=p1($.slice(V.outerStart,V.outerEnd),{...O,start:0,end:O.end-O.start},A);G.push({type:"else",outerStart:q,outerEnd:V.outerEnd,element:R,parsedTag:O}),U=!1}else U=!1}let K=[];for(let _ of G)if(_.type==="if")K.push(`@if(${_.expr})
|
|
3822
3822
|
${_.element}`);else if(_.type==="else-if")K.push(`@elseif(${_.expr})
|
|
3823
3823
|
${_.element}`);else K.push(`@else
|
|
3824
3824
|
${_.element}`);K.push("@endif");let z=K.join(`
|
|
3825
|
-
`),j=G[0].outerStart,B=G[G.length-1].outerEnd;$=$.slice(0,j)+z+$.slice(B),Z=j+z.length}return $}function F_(X){return X.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function V_(X){let $=X,Z=0;while(Z<$.length){let Y=
|
|
3826
|
-
${
|
|
3827
|
-
@endonce`;$=$.slice(0,G.outerStart)+W+$.slice(G.outerEnd),Z=G.outerStart+W.length}return $}function I_(X){return X.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function E_(X){return X.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 MG(X){if(!H_(X))return X;let $=X;return $=L_($),$=O_($),$=k_($),$=A_($),$=R_($),$=V_($),$=F_($),$=E_($),$=M_($),$=T_($),$=N_($),$=I_($),$}var B_,j_;var TG=E(()=>{B_=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),j_=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 O8(X){return X.replace(/--/g,"- -").replace(/</g,"<").replace(/>/g,">")}function NG(X,$){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(X),Y=Z?Z[1]:X,J=Q0(Y,$);if(J&&typeof J==="string")return J;let G=Y.trim();return h4.has(G)?G:null}function kG(X){let $=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(X);return $?$[1]:X}function IG(X,$,Z){let Y=$.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),J=Y?`<${X} ${Y}>`:`<${X}>`;if(D_.has(X))return Y?`<${X} ${Y}>`:`<${X}>`;return`${J}${Z}</${X}>`}async function EG(X,$,Z,Y,J){let G=X,Q=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,w=[],W;while((W=Q.exec(G))!==null)w.push({full:W[0],expr:W[1],attrs:W[2],slotContent:W[3],index:W.index});for(let q=w.length-1;q>=0;q--){let U=w[q];try{let K=NG(U.expr,$);if(!K||typeof K!=="string"){let L=`<!-- dynamic component: could not resolve "${O8(kG(U.expr))}" -->`;G=G.slice(0,U.index)+L+G.slice(U.index+U.full.length);continue}if(h4.has(K)){let L=IG(K,U.attrs,U.slotContent);G=G.slice(0,U.index)+L+G.slice(U.index+U.full.length);continue}let z=U.attrs.trim(),j={},B=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,_;while((_=B.exec(z))!==null){let L=_[1]||_[2],F=_[3];if(_[1])try{j[L]=Q0(F,$)}catch{j[L]=F}else j[L]=F}let H=Y.componentsDir||"components",O=await
|
|
3825
|
+
`),j=G[0].outerStart,B=G[G.length-1].outerEnd;$=$.slice(0,j)+z+$.slice(B),Z=j+z.length}return $}function F_(X){return X.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function V_(X){let $=X,Z=0;while(Z<$.length){let Y=H5($,Z);if(!Y)break;let J=Y.attrs,G=!1,Q=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,w=J.match(Q);while(w){G=!0;let U=w[1],K=w[2],z=w[3];J=J.replace(w[0],""),J+=` :${U}="${z}" @update:${U}="${z} = $event"`,w=J.match(Q)}if(G){let U=j1($,Y),K=$.slice(U.outerStart,U.outerEnd),z=p1(K,{...Y,start:0,end:Y.end-Y.start},J);$=$.slice(0,U.outerStart)+z+$.slice(U.outerEnd),Z=U.outerStart+z.length;continue}let W=t5(Y.attrs,"v-model");if(W===null){Z=Y.end;continue}if(j_.has(Y.tag)){let U=Y.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${W}"`,K=j1($,Y),z=$.slice(K.outerStart,K.outerEnd),j=p1(z,{...Y,start:0,end:Y.end-Y.start},U);$=$.slice(0,K.outerStart)+j+$.slice(K.outerEnd),Z=K.outerStart+j.length}else{let U=Y.attrs.replace(/\s*v-model="[^"]*"/g,"");U+=` :modelValue="${W}" @update:modelValue="${W} = $event"`;let K=j1($,Y),z=$.slice(K.outerStart,K.outerEnd),j=p1(z,{...Y,start:0,end:Y.end-Y.start},U);$=$.slice(0,K.outerStart)+j+$.slice(K.outerEnd),Z=K.outerStart+j.length}}return $}function A_(X){return X.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function R_(X){return X.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function M_(X){let $=X,Z=0;while(Z<$.length){let Y=H5($,Z);if(!Y)break;let J=t5(Y.attrs,"v-html");if(J===null){Z=Y.end;continue}if(Y.selfClosing){Z=Y.end;continue}let G=j1($,Y),Q=c1(Y.attrs,"v-html"),w=Y.selfClosing?" /":"",W=`<${Y.tag}${Q}${w}>{!! ${J} !!}</${Y.tag}>`;$=$.slice(0,G.outerStart)+W+$.slice(G.outerEnd),Z=G.outerStart+W.length}return $}function T_(X){let $=X,Z=0;while(Z<$.length){let Y=H5($,Z);if(!Y)break;let J=t5(Y.attrs,"v-text");if(J===null){Z=Y.end;continue}if(Y.selfClosing){Z=Y.end;continue}let G=j1($,Y),Q=c1(Y.attrs,"v-text"),w=Y.selfClosing?" /":"",W=`<${Y.tag}${Q}${w}>{{ ${J} }}</${Y.tag}>`;$=$.slice(0,G.outerStart)+W+$.slice(G.outerEnd),Z=G.outerStart+W.length}return $}function N_(X){return X.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 k_(X){let $=X,Z=0;while(Z<$.length){let Y=H5($,Z);if(!Y)break;if(!RG(Y.attrs,"v-once")){Z=Y.end;continue}let J=c1(Y.attrs,"v-once"),G=j1($,Y),Q=$.slice(G.outerStart,G.outerEnd),W=`@once
|
|
3826
|
+
${p1(Q,{...Y,start:0,end:Y.end-Y.start},J)}
|
|
3827
|
+
@endonce`;$=$.slice(0,G.outerStart)+W+$.slice(G.outerEnd),Z=G.outerStart+W.length}return $}function I_(X){return X.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function E_(X){return X.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 MG(X){if(!H_(X))return X;let $=X;return $=L_($),$=O_($),$=k_($),$=A_($),$=R_($),$=V_($),$=F_($),$=E_($),$=M_($),$=T_($),$=N_($),$=I_($),$}var B_,j_;var TG=E(()=>{B_=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),j_=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 O8(X){return X.replace(/--/g,"- -").replace(/</g,"<").replace(/>/g,">")}function NG(X,$){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(X),Y=Z?Z[1]:X,J=Q0(Y,$);if(J&&typeof J==="string")return J;let G=Y.trim();return h4.has(G)?G:null}function kG(X){let $=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(X);return $?$[1]:X}function IG(X,$,Z){let Y=$.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),J=Y?`<${X} ${Y}>`:`<${X}>`;if(D_.has(X))return Y?`<${X} ${Y}>`:`<${X}>`;return`${J}${Z}</${X}>`}async function EG(X,$,Z,Y,J){let G=X,Q=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,w=[],W;while((W=Q.exec(G))!==null)w.push({full:W[0],expr:W[1],attrs:W[2],slotContent:W[3],index:W.index});for(let q=w.length-1;q>=0;q--){let U=w[q];try{let K=NG(U.expr,$);if(!K||typeof K!=="string"){let L=`<!-- dynamic component: could not resolve "${O8(kG(U.expr))}" -->`;G=G.slice(0,U.index)+L+G.slice(U.index+U.full.length);continue}if(h4.has(K)){let L=IG(K,U.attrs,U.slotContent);G=G.slice(0,U.index)+L+G.slice(U.index+U.full.length);continue}let z=U.attrs.trim(),j={},B=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,_;while((_=B.exec(z))!==null){let L=_[1]||_[2],F=_[3];if(_[1])try{j[L]=Q0(F,$)}catch{j[L]=F}else j[L]=F}let H=Y.componentsDir||"components",O=await _5(K,j,U.slotContent,H,$,Z,Y,new Set,J??new Set);G=G.slice(0,U.index)+O+G.slice(U.index+U.full.length)}catch(K){let z=K instanceof Error?K.message:String(K),j=`<!-- dynamic component error: ${O8(z)} -->`;G=G.slice(0,U.index)+j+G.slice(U.index+U.full.length)}}return G=await y_(G,$,Z,Y,J),G}async function y_(X,$,Z,Y,J){let G=X,Q=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,w=[],W;while((W=Q.exec(G))!==null)w.push({full:W[0],expr:W[1],attrs:W[2],index:W.index});for(let q=w.length-1;q>=0;q--){let U=w[q];try{let K=NG(U.expr,$);if(!K||typeof K!=="string"){let B=`<!-- dynamic component: could not resolve "${O8(kG(U.expr))}" -->`;G=G.slice(0,U.index)+B+G.slice(U.index+U.full.length);continue}if(h4.has(K)){let B=IG(K,U.attrs,"");G=G.slice(0,U.index)+B+G.slice(U.index+U.full.length);continue}let z=Y.componentsDir||"components",j=await _5(K,{},"",z,$,Z,Y,new Set,J??new Set);G=G.slice(0,U.index)+j+G.slice(U.index+U.full.length)}catch(K){let z=K instanceof Error?K.message:String(K),j=`<!-- dynamic component error: ${O8(z)} -->`;G=G.slice(0,U.index)+j+G.slice(U.index+U.full.length)}}return G}var h4,D_;var DG=E(()=>{H0();M0();h4=new Set(["a","abbr","address","article","aside","audio","b","bdi","bdo","blockquote","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","meter","nav","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","video"]),D_=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"])});function yG(X,$=""){let Z=`${X}${$}`,Y=0;for(let J=0;J<Z.length;J++){let G=Z.charCodeAt(J);Y=(Y<<5)-Y+G,Y=Y&Y}return`stx-${Math.abs(Y).toString(36)}`}function bG(X,$,Z={}){let{prefix:Y="",preserveHost:J=!0,scopeKeyframes:G=!0,scopeCustomProperties:Q=!1}=Z;if(!X.trim())return"";let w=u4(X),W=[],q=new Map;if(G)for(let U of w){let K=U.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(K){let z=K[1],j=`${$}_${z}`;q.set(z,j)}}for(let U of w){let K=SG(U,$,Y,J,q,Q);W.push(K)}return W.join(`
|
|
3828
3828
|
|
|
3829
3829
|
`)}function u4(X){let $=[],Z=X.replace(/\/\*[\s\S]*?\*\//g,""),Y=0,J="",G=!1,Q="";for(let w=0;w<Z.length;w++){let W=Z[w];if(W==="@"&&Y===0)G=!0;if(W==="{")Y++;else if(W==="}"){if(Y--,Y===0){if(G){Q+=W;let q=Q.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(q){let[,U,K,z]=q;if(U==="keyframes")$.push({selector:`@keyframes ${K.trim()}`,declarations:z.trim()});else if(U==="media"||U==="supports"||U==="container"){let j=u4(z);$.push({selector:`@${U} ${K.trim()}`,declarations:j.map((B)=>`${B.selector} { ${B.declarations} }`).join(`
|
|
3830
3830
|
`)})}else $.push({selector:`@${U} ${K.trim()}`,declarations:z.trim()})}Q="",G=!1}else if(J.trim()){J+=W;let q=J.match(/([^{]+)\{([^}]*)\}/);if(q)$.push({selector:q[1].trim(),declarations:q[2].trim()});J=""}continue}}if(G)Q+=W;else J+=W}return $}function SG(X,$,Z,Y,J,G){let{selector:Q,declarations:w}=X;if(Q.startsWith("@")){if(Q.startsWith("@keyframes")){let U=Q.replace("@keyframes ","").trim();return`@keyframes ${J.get(U)||U} { ${w} }`}if(Q.startsWith("@media")||Q.startsWith("@supports")||Q.startsWith("@container")){let K=u4(`x { ${w} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((z)=>SG(z,$,Z,Y,J,G)).join(`
|
|
3831
3831
|
`);return`${Q} {
|
|
3832
3832
|
${K}
|
|
3833
|
-
}`}return`${Q} { ${w} }`}let W=b_(Q,$,Z,Y),q=w;for(let[U,K]of J)q=q.replace(new RegExp(`\\b${U}\\b`,"g"),K);if(G)q=q.replace(/--([a-z-]+)/gi,`--${$}-$1`);return`${W} { ${q} }`}function b_(X,$,Z,Y){let J=X.split(",").map((Q)=>Q.trim()),G=[];for(let Q of J){if(Q.startsWith(":host")){if(Y)G.push(Q);else{let q=Q.replace(/:host(\([^)]*\))?/,`.${$}$1`);G.push(q)}continue}if(Q.includes("::slotted")){G.push(Q);continue}if(Q===":root"){G.push(`:root .${$}`);continue}let w=Z?`${Z} .${$}`:`.${$}`;G.push(`${w} ${Q}`);let W=S_(Q,$);if(W)G.push(Z?`${Z} ${W}`:W)}return G.join(", ")}function S_(X,$){let Z=0,Y=X.length;for(let W=0;W<X.length;W++){let q=X[W];if(q==="["||q==="(")Z++;else if(q==="]"||q===")")Z--;else if(Z===0&&(q===" "||q===">"||q==="+"||q==="~")){Y=W;break}}let J=X.slice(0,Y),G=X.slice(Y);if(!J)return"";let Q=J.length,w=0;for(let W=0;W<J.length;W++){let q=J[W];if(q==="["||q==="(")w++;else if(q==="]"||q===")")w--;else if(Z===0&&w===0&&q===":"){Q=W;break}}return`${J.slice(0,Q)}.${$}${J.slice(Q)}${G}`}function PG(X){let $=new Set;return X.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(Z)=>{let Y=Z.trim();if($.has(Y))return"";return $.add(Y),Z})}function F8(X,$){if(!C_.test(X))return{html:X,hasScoped:!1};let Z=yG($),Y=`data-v-${Z}`,J=X,G=new RegExp(`<style\\s+([^>]*${d4}[^>]*)>([\\s\\S]*?)</style>`,"gi"),Q=!1;if(J=J.replace(G,(w,W,q)=>{Q=!0;let U=P_(q,Y),K=W.replace(new RegExp(d4,"gi"),"").trim(),z=K?` ${K}`:"";return`<style data-stx-scoped="${Z}"${z}>${U}</style>`}),!Q)return{html:X,hasScoped:!1};return J=x_(J,Y),{html:J,hasScoped:!0}}function P_(X,$){return bG(X,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${$}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${$}]`)}function x_(X,$){let Z=
|
|
3833
|
+
}`}return`${Q} { ${w} }`}let W=b_(Q,$,Z,Y),q=w;for(let[U,K]of J)q=q.replace(new RegExp(`\\b${U}\\b`,"g"),K);if(G)q=q.replace(/--([a-z-]+)/gi,`--${$}-$1`);return`${W} { ${q} }`}function b_(X,$,Z,Y){let J=X.split(",").map((Q)=>Q.trim()),G=[];for(let Q of J){if(Q.startsWith(":host")){if(Y)G.push(Q);else{let q=Q.replace(/:host(\([^)]*\))?/,`.${$}$1`);G.push(q)}continue}if(Q.includes("::slotted")){G.push(Q);continue}if(Q===":root"){G.push(`:root .${$}`);continue}let w=Z?`${Z} .${$}`:`.${$}`;G.push(`${w} ${Q}`);let W=S_(Q,$);if(W)G.push(Z?`${Z} ${W}`:W)}return G.join(", ")}function S_(X,$){let Z=0,Y=X.length;for(let W=0;W<X.length;W++){let q=X[W];if(q==="["||q==="(")Z++;else if(q==="]"||q===")")Z--;else if(Z===0&&(q===" "||q===">"||q==="+"||q==="~")){Y=W;break}}let J=X.slice(0,Y),G=X.slice(Y);if(!J)return"";let Q=J.length,w=0;for(let W=0;W<J.length;W++){let q=J[W];if(q==="["||q==="(")w++;else if(q==="]"||q===")")w--;else if(Z===0&&w===0&&q===":"){Q=W;break}}return`${J.slice(0,Q)}.${$}${J.slice(Q)}${G}`}function PG(X){let $=new Set;return X.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(Z)=>{let Y=Z.trim();if($.has(Y))return"";return $.add(Y),Z})}function F8(X,$){if(!C_.test(X))return{html:X,hasScoped:!1};let Z=yG($),Y=`data-v-${Z}`,J=X,G=new RegExp(`<style\\s+([^>]*${d4}[^>]*)>([\\s\\S]*?)</style>`,"gi"),Q=!1;if(J=J.replace(G,(w,W,q)=>{Q=!0;let U=P_(q,Y),K=W.replace(new RegExp(d4,"gi"),"").trim(),z=K?` ${K}`:"";return`<style data-stx-scoped="${Z}"${z}>${U}</style>`}),!Q)return{html:X,hasScoped:!1};return J=x_(J,Y),{html:J,hasScoped:!0}}function P_(X,$){return bG(X,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${$}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${$}]`)}function x_(X,$){let Z=w1(X,(J,G)=>{let Q=v1(J,G);return Q>G?Q:P5(J,G)},(J,G)=>v_(G)),Y=f_(Z.output,$);return CG.lastIndex=0,Y.replace(CG,(J,G)=>Z.tokens[Number(G)])}function f_(X,$){let Z=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return X.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(Y,J,G)=>{if(Z.has(J.toLowerCase()))return Y;if(Y.includes($))return Y;if(J.toLowerCase()==="style"||J.toLowerCase()==="script")return Y;if(G)return Y.replace(`<${J}${G}`,`<${J} ${$}${G}`);if(Y.endsWith("/>"))return`<${J} ${$} />`;return`<${J} ${$}>`})}var d4,C_,v_=(X)=>`\x00stx-scope-mask-${X}\x00`,CG;var m4=E(()=>{x1();d4=String.raw`(?<![\w-])scoped(?![\w-])`,C_=new RegExp(`<style\\s+[^>]*${d4}`,"i");CG=/\u0000stx-scope-mask-(\d+)\u0000/g});function m_(X){let $=X.storageKey??"stx-color-mode",Z=X.initialMode??"auto",Y=X.darkClass===void 0?"dark":X.darkClass,J=X.attribute??null,G=X.autoValue??null;if(typeof $!=="string"||$.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!g_.has(Z))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(Z)}`);if(Y!==null&&(typeof Y!=="string"||!d_.test(Y)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(Y)}`);if(J!==null&&(typeof J!=="string"||!u_.test(J)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(J)}`);if(G!==null&&!h_.has(G))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(G)}`);if(Y===null&&J===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");return{storageKey:$,initialMode:Z==="system"?"auto":Z,darkClass:Y,attribute:J,autoValue:G}}function l_(X){return JSON.stringify(X).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function c4(X={}){let $=m_(X);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${l_($)};var p=c.initialMode;var a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}var m=p;if(p==="auto"){try{m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){m="light"}}var r=document.documentElement;if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}try{window.__STX_COLOR_MODE__={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",preference:p,mode:m}}catch(e){}}());`}</script>`}function vG(X,$={}){if(X.includes("data-stx-color-mode-boot"))return X;let Z=l4(X);if(Z===null)return X;let Y=c4($);return`${X.slice(0,Z)}
|
|
3834
3834
|
${Y}${X.slice(Z)}`}function l4(X){let $=/<head\b[^>]*>/i.exec(X);if(!$)return null;let Z=$.index+$[0].length,Y=/^\s*<meta\b[^>]*\bcharset\b[^>]*>/i.exec(X.slice(Z));if(Y)Z+=Y[0].length;return Z}function i_(X){let $=/<head\b[^>]*>/i.exec(X);if(!$)return X;let Z=$.index+$[0].length,Y=X.toLowerCase().indexOf("</head>",Z),J=X.slice(Z,Y===-1?X.length:Y),G=p_.exec(J);if(!G||J.slice(0,G.index).trim()==="")return X;let Q=J.slice(0,G.index)+J.slice(G.index+G[0].length);return X.slice(0,Z)+`
|
|
3835
3835
|
${G[0]}`+Q+X.slice(Z+J.length)}function xG(X){return n_(i_(X))}function n_(X){let $=c_.exec(X);if(!$)return X;let Z=l4(X);if(Z===null)return X;if($.index<=Z||X.slice(Z,$.index).trim()==="")return X;let Y=X.slice(0,$.index)+X.slice($.index+$[0].length),J=l4(Y);if(J===null)return X;return`${Y.slice(0,J)}
|
|
3836
3836
|
${$[0]}${Y.slice(J)}`}var g_,h_,u_,d_,c_,p_;var p4=E(()=>{g_=new Set(["light","dark","auto","system"]),h_=new Set(["auto","system"]),u_=/^[a-z][\w:-]*$/i,d_=/^[\w-]+$/;c_=new RegExp("<script\\b[^>]*\\bdata-stx-color-mode-boot\\b[^>]*>[\\s\\S]*?<\\/script>","i"),p_=/<meta\b[^>]*\bcharset\b[^>]*>/i});function r_(){if(i4===null)i4=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return i4}function fG(X,$=r_()){if(X.includes('name="stx-build"'))return X;let Z=/<head\b[^>]*>/i.exec(X);if(!Z)return X;let Y=Z.index+Z[0].length;return`${X.slice(0,Y)}
|
|
3837
|
-
<meta name="stx-build" content="${$}">${X.slice(Y)}`}var i4=null;function E1(X){return String(X).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function s_(X){return String(X).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function
|
|
3838
|
-
${X.slice($)}`}function a_(X){let $=[],Z=0;while(Z<X.length){let G=X.slice(Z),Q=G.match(/^\s+/);if(Q){Z+=Q[0].length;continue}if(G.startsWith("<!--")){let K=X.indexOf("-->",Z);if(K===-1)break;Z=K+3;continue}let w=G.match(/^<script\b[^>]*>/i);if(w){let K=X.toLowerCase().indexOf("</script>",Z+w[0].length);if(K===-1)break;Z=K+9;continue}let W=G.match(/^<link\b[^>]*>/i);if(W){$.push(W[0]),Z+=W[0].length;continue}let q=G.match(/^<meta\b[^>]*>/i);if(q){$.push(q[0]),Z+=q[0].length;continue}let U=G.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(U){$.push(U[0]),Z+=U[0].length;continue}break}if($.length===0)return{body:X,hoisted:$};let Y="",J=0;while(J<X.length&&J<Z){let G=X.slice(J),Q=G.match(/^<link\b[^>]*>/i);if(Q&&$.includes(Q[0])){J+=Q[0].length;continue}let w=G.match(/^<meta\b[^>]*>/i);if(w&&$.includes(w[0])){J+=w[0].length;continue}let W=G.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(W&&$.includes(W[0])){J+=W[0].length;continue}Y+=X[J],J++}return Y+=X.slice(Z),{body:Y,hoisted:$}}function t_(X,$={},Z={}){let{title:Y="stx App",lang:J="en",meta:G=[],link:Q=[],script:w=[],headRaw:W="",htmlAttrs:q={},bodyClass:U="",bodyAttrs:K={}}=$,z=Z.title||Y,j=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],B=new Set(G.map(
|
|
3839
|
-
`),O=Q.map((I)=>{return` <link ${
|
|
3840
|
-
`),L=w.map((I)=>{if(I.src)return` <script ${
|
|
3837
|
+
<meta name="stx-build" content="${$}">${X.slice(Y)}`}var i4=null;function E1(X){return String(X).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function s_(X){return String(X).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function X7(X){if(X.name)return`name="${X.name}"`;if(X.property)return`property="${X.property}"`;if(X.charset!=null)return"charset=";if(X["http-equiv"])return`http-equiv="${X["http-equiv"]}"`;return""}function e5(X,$){return Object.entries(X).filter(([Z])=>!$?.(Z)).map(([Z,Y])=>`${Z}="${E1(String(Y))}"`).join(" ")}function o_(X={},$="en"){let Z=[],Y=[],J="",G=$;for(let[w,W]of Object.entries(X||{})){if(W==null)continue;let q=w.trim();if(!hG.test(q))continue;let U=q.toLowerCase();if(U==="lang"){G=String(W);continue}if(U==="class"){J=String(W).trim();continue}Z.push(` ${q}="${E1(String(W))}"`),Y.push(q)}let Q=` lang="${E1(G)}"`;if(J)Q+=` class="${E1(J)}"`;if(Q+=Z.join(""),J)Q+=` ${A8}="${E1(J)}"`;if(Y.length)Q+=` ${V8}="${E1(Y.join(" "))}"`;return Q}function uG(X={},$={}){let Z={...X,...$};if(X.class&&$.class){let Y=X.class.split(/\s+/).filter(Boolean);for(let J of $.class.split(/\s+/).filter(Boolean))if(!Y.includes(J))Y.push(J);Z.class=Y.join(" ")}return Z}function dG(X,$={}){if(!$||Object.keys($).length===0)return X;let Z=X.match(/<html\b([^>]*)>/i);if(!Z)return X;let Y={},J=[],G=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,Q;while((Q=G.exec(Z[1]))!==null){let U=Q[1];if(!(U in Y))J.push(U);Y[U]=Q[2]??Q[3]??Q[4]??""}let w=[],W=[];for(let[U,K]of Object.entries($)){if(K==null)continue;let z=U.trim();if(!hG.test(z))continue;let j=z.toLowerCase();if(j==="class"){let B=(Y.class||"").split(/\s+/).filter(Boolean);for(let _ of String(K).split(/\s+/).filter(Boolean))if(!B.includes(_))B.push(_),w.push(_);if(!("class"in Y))J.push("class");Y.class=B.join(" ");continue}if(!(z in Y))J.push(z);if(Y[z]=String(K),j!=="lang")W.push(z)}if(w.length){if(!(A8 in Y))J.push(A8);Y[A8]=w.join(" ")}if(W.length){if(!(V8 in Y))J.push(V8);Y[V8]=W.join(" ")}let q=J.map((U)=>` ${U}="${E1(Y[U])}"`).join("");return X.replace(Z[0],()=>`<html${q}>`)}function mG(X){if(X.includes("data-stx-cloak"))return X;let $=X.lastIndexOf("</head>");if($===-1)return X;return`${X.slice(0,$)}${gG}
|
|
3838
|
+
${X.slice($)}`}function a_(X){let $=[],Z=0;while(Z<X.length){let G=X.slice(Z),Q=G.match(/^\s+/);if(Q){Z+=Q[0].length;continue}if(G.startsWith("<!--")){let K=X.indexOf("-->",Z);if(K===-1)break;Z=K+3;continue}let w=G.match(/^<script\b[^>]*>/i);if(w){let K=X.toLowerCase().indexOf("</script>",Z+w[0].length);if(K===-1)break;Z=K+9;continue}let W=G.match(/^<link\b[^>]*>/i);if(W){$.push(W[0]),Z+=W[0].length;continue}let q=G.match(/^<meta\b[^>]*>/i);if(q){$.push(q[0]),Z+=q[0].length;continue}let U=G.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(U){$.push(U[0]),Z+=U[0].length;continue}break}if($.length===0)return{body:X,hoisted:$};let Y="",J=0;while(J<X.length&&J<Z){let G=X.slice(J),Q=G.match(/^<link\b[^>]*>/i);if(Q&&$.includes(Q[0])){J+=Q[0].length;continue}let w=G.match(/^<meta\b[^>]*>/i);if(w&&$.includes(w[0])){J+=w[0].length;continue}let W=G.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(W&&$.includes(W[0])){J+=W[0].length;continue}Y+=X[J],J++}return Y+=X.slice(Z),{body:Y,hoisted:$}}function t_(X,$={},Z={}){let{title:Y="stx App",lang:J="en",meta:G=[],link:Q=[],script:w=[],headRaw:W="",htmlAttrs:q={},bodyClass:U="",bodyAttrs:K={}}=$,z=Z.title||Y,j=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],B=new Set(G.map(X7).filter(Boolean)),H=[...j.filter((I)=>!B.has(X7(I))),...G].map((I)=>{return` <meta ${e5(I)}>`}).join(`
|
|
3839
|
+
`),O=Q.map((I)=>{return` <link ${e5(I)}>`}).join(`
|
|
3840
|
+
`),L=w.map((I)=>{if(I.src)return` <script ${e5(I,(D)=>D==="content")}></script>`;if(I.content)return` <script>${I.content}</script>`;return""}).filter(Boolean).join(`
|
|
3841
3841
|
`),F=o_(q,J),V=Object.entries(K).map(([I,D])=>` ${I}="${E1(String(D))}"`).join(""),A=U?` class="${E1(U)}"`:"",{body:R,hoisted:M}=a_(X),T=[H,Z.colorMode?` ${c4(Z.colorMode)}`:"",` <title>${Z.titleIsHtml?z:s_(z)}</title>`,` ${gG}`,O,L,W?` ${W}`:"",...(Z.styles||[]).map((I)=>` ${I}`),...M.map((I)=>` ${I}`),...(Z.headScripts||[]).map((I)=>` ${I}`),Z.headStack||""].filter(Boolean),k=[R,...(Z.bodyScripts||[]).map((I)=>I),Z.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
|
|
3842
3842
|
<html${F}>
|
|
3843
3843
|
<head>
|
|
@@ -3848,9 +3848,9 @@ ${T.join(`
|
|
|
3848
3848
|
${k.join(`
|
|
3849
3849
|
`)}
|
|
3850
3850
|
</body>
|
|
3851
|
-
</html>`}function n4(X){let $=0;while($<X.length){let Z=X.slice($),Y=Z.match(/^\s+/);if(Y){$+=Y[0].length;continue}if(Z.startsWith("<!--")){let G=X.indexOf("-->",$);if(G===-1)return!1;$=G+3;continue}let J=Z.match(/^<(script|style)\b[^>]*>/i);if(J){let G=`</${J[1].toLowerCase()}>`,Q=X.toLowerCase().indexOf(G,$+J[0].length);if(Q===-1)return!1;$=Q+G.length;continue}return/^<!DOCTYPE\b/i.test(Z)||/^<html[\s>]/i.test(Z)}return!1}function r4(X){return n4(X)}function lG(X,$={}){let Z=X.lastIndexOf("</head>");if(Z===-1)return X;let{meta:Y=[],link:J=[],script:G=[],headRaw:Q=""}=$,w=X.slice(0,Z),W=[];for(let q of Y){let U
|
|
3851
|
+
</html>`}function n4(X){let $=0;while($<X.length){let Z=X.slice($),Y=Z.match(/^\s+/);if(Y){$+=Y[0].length;continue}if(Z.startsWith("<!--")){let G=X.indexOf("-->",$);if(G===-1)return!1;$=G+3;continue}let J=Z.match(/^<(script|style)\b[^>]*>/i);if(J){let G=`</${J[1].toLowerCase()}>`,Q=X.toLowerCase().indexOf(G,$+J[0].length);if(Q===-1)return!1;$=Q+G.length;continue}return/^<!DOCTYPE\b/i.test(Z)||/^<html[\s>]/i.test(Z)}return!1}function r4(X){return n4(X)}function lG(X,$={}){let Z=X.lastIndexOf("</head>");if(Z===-1)return X;let{meta:Y=[],link:J=[],script:G=[],headRaw:Q=""}=$,w=X.slice(0,Z),W=[];for(let q of Y){let U=X7(q);if(U&&w.includes(U))continue;W.push(` <meta ${e5(q)}>`)}for(let q of J){if(q.href&&w.includes(`href="${q.href}"`))continue;W.push(` <link ${e5(q)}>`)}for(let q of G)if(q.src){if(w.includes(`src="${q.src}"`))continue;W.push(` <script ${e5(q,(U)=>U==="content")}></script>`)}else if(q.content){if(w.includes(q.content))continue;W.push(` <script>${q.content}</script>`)}if(Q&&!w.includes(Q))W.push(` ${Q}`);if(W.length===0)return X;return`${X.slice(0,Z)}${W.join(`
|
|
3852
3852
|
`)}
|
|
3853
|
-
${X.slice(Z)}`}function cG(X,$={},Z={}){if(r4(X))return X;return t_(X,$,Z)}var gG="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",V8="data-stx-html-attrs",A8="data-stx-html-class",hG;var pG=E(()=>{p4();hG=/^[A-Za-z_:][\w:.-]*$/});function iG(X,$={}){return new
|
|
3853
|
+
${X.slice(Z)}`}function cG(X,$={},Z={}){if(r4(X))return X;return t_(X,$,Z)}var gG="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",V8="data-stx-html-attrs",A8="data-stx-html-class",hG;var pG=E(()=>{p4();hG=/^[A-Za-z_:][\w:.-]*$/});function iG(X,$={}){return new I5(X,$).routes}var nG=E(()=>{X5();X5()});async function sG(X){let $=X;if(!$)try{$=(await i1())?.pagesDir||"pages"}catch{$="pages"}let Z=$,Y=rG.get(Z);if(Y)return Y;let J=[];try{J=iG(".",{pagesDir:Z}).map((G)=>G.regex.source).filter(Boolean)}catch{J=[]}return rG.set(Z,J),J}var rG;var oG=E(()=>{nG();A1();rG=new Map});function e_(X){return X.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function aG(X){return e_(JSON.stringify(X))}function o4(){return L5}function a4(X){let $=L5;return tG.push(X),L5=X,$}function t4(X){tG.pop(),L5=X}function e4(){return R8>0}function X3(X){s4.add(X)}function eG(X){R8++;try{X()}finally{if(R8--,R8===0){let $=[...s4];s4.clear();for(let Z of $)Z()}}}function XQ(X){let $=L5;L5=null;try{return X()}finally{L5=$}}var L5=null,tG,R8=0,s4;var $Q=E(()=>{tG=[],s4=new Set});function n1(X){let $=X,Z=new Set,Y=new Set,J=()=>{let G=o4();if(G)Y.add(G);return $};return J.set=(G)=>{if(!Object.is(G,$)){let Q=$;if($=G,Z.forEach((w)=>w($,Q)),e4())Y.forEach((w)=>X3(w));else Y.forEach((w)=>w())}},J.update=(G)=>{J.set(G($))},J.subscribe=(G)=>{return Z.add(G),()=>Z.delete(G)},Object.defineProperty(J,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(J,"value",{get:()=>J(),set:(G)=>J.set(G),configurable:!0}),J}function T8(X){let $,Z=!0,Y=new Set,J=()=>{if(!Z)if(Z=!0,e4())Y.forEach((Q)=>X3(Q));else Y.forEach((Q)=>Q())},G=()=>{let Q=o4();if(Q)Y.add(Q);if(Z){let w=a4(J);try{$=X()}finally{t4(w)}Z=!1}return $};return Object.defineProperty(G,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(G,"value",{get:()=>G(),configurable:!0}),G}function N8(X,$={}){let Z,Y=!1,J=()=>{if(Y)return;if(Z)Z(),Z=void 0;let G=a4(J);try{let Q=X();Z=typeof Q==="function"?Q:void 0}finally{t4(G)}};if($.immediate!==!1)J();return()=>{if(Y=!0,Z)Z()}}function Z3(X){eG(X)}function Y3(X){$3.push(X)}function J3(X){M8.push(X)}function XH(){ZQ($3,"onMount",M8)}function $H(){ZQ(M8,"onDestroy")}function ZQ(X,$,Z){let Y=X.splice(0,X.length);for(let J of Y)try{let G=J();if(Z&&typeof G==="function")Z.push(G)}catch(G){console.error(`[stx] ${$} callback threw:`,G)}}function ZH(){return{mount:$3.length,destroy:M8.length}}function k8(X){return typeof X==="function"&&X._isSignal===!0}function I8(X){return typeof X==="function"&&X._isDerived===!0}function G3(X){if(k8(X)||I8(X))return X();return X}function E8(X){return XQ(X)}function YH(X,$){let Z=typeof X==="function"?X:()=>X,Y=n1([]),J=T8(()=>Y().reduce((w,W)=>$(w,W.action),Z())),G=!1;return N8(()=>{if(Z(),!G){G=!0;return}if(E8(()=>Y().length))Y.set([])}),[J,(w,W)=>{let q={action:w};Y.set([...Y(),q]);let U=()=>{let K=Y().filter((z)=>z!==q);if(K.length!==Y().length)Y.set(K)};if(W&&typeof W.then==="function")Promise.resolve(W).then(U,U);return U}]}var $3,M8;var D8=E(()=>{$Q();$3=[],M8=[]});var JQ={};a(JQ,{useOptimistic:()=>YH,untrack:()=>G3,state:()=>n1,runMountCallbacks:()=>XH,runDestroyCallbacks:()=>$H,pendingLifecycleCounts:()=>ZH,peek:()=>E8,onMount:()=>Y3,onDestroy:()=>J3,isSignal:()=>k8,isDerived:()=>I8,generateSignalsRuntimeDev:()=>Q3,generateSignalsRuntime:()=>YQ,effect:()=>N8,derived:()=>T8,default:()=>GH,batch:()=>Z3});function YQ(){let X=JH(Q3());try{let Z=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(X);return Z=Z.replace(/\}(var |let |const |function )/g,"};$1"),Z}catch{return X}}function JH(X){let $=[],Z=0,Y="console.log(";while(Z<X.length){let J=X.indexOf(Y,Z);if(J===-1){$.push(X.slice(Z));break}$.push(X.slice(Z,J));let G=1,Q=J+Y.length;while(Q<X.length&&G>0){let w=X[Q];if(w==='"'||w==="'"||w==="`"){let W=w;Q++;while(Q<X.length&&X[Q]!==W){if(X[Q]==="\\")Q++;Q++}Q++;continue}if(w==="(")G++;else if(w===")")G--;Q++}$.push("0"),Z=Q}return $.join("")}function Q3(){return`
|
|
3854
3854
|
// STX Signals Runtime (Development Build)
|
|
3855
3855
|
console.log('[stx] signals runtime loading');
|
|
3856
3856
|
// Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
|
|
@@ -11834,7 +11834,7 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
|
|
|
11834
11834
|
}
|
|
11835
11835
|
}
|
|
11836
11836
|
})();
|
|
11837
|
-
`}var GH;var GQ=E(()=>{D8();Z1();D8();GH={state:
|
|
11837
|
+
`}var GH;var GQ=E(()=>{D8();Z1();D8();GH={state:n1,derived:T8,effect:N8,batch:Z3,onMount:Y3,onDestroy:J3,isSignal:k8,isDerived:I8,untrack:G3,peek:E8,generateSignalsRuntime:YQ,generateSignalsRuntimeDev:Q3}});var w3={};a(w3,{templateCache:()=>QQ,readFileCached:()=>QH,invalidateFileCacheByDir:()=>WH,invalidateFileCache:()=>wH,hashFilePath:()=>ZX,getCachedSignalsRuntime:()=>KH,getCachedRouterScript:()=>zH,clearDevCaches:()=>BH,checkCache:()=>jH,cacheTemplate:()=>_H,__setSignalsGeneratorsForTest:()=>UH});import r1 from"fs";import $7 from"path";async function QH(X){let Z;for(let Y=0;Y<3;Y++)try{let G=(await r1.promises.stat(X)).mtime.getTime(),Q=O5.get(X);if(Q&&Q.mtime===G)return Q.content;let w=await Bun.file(X).text(),q=(await r1.promises.stat(X)).mtime.getTime();if(q!==G)continue;return O5.set(X,{content:w,mtime:q}),w}catch(J){Z=J;break}throw O5.delete(X),Error(`File not found: ${X}${Z?` (${Z.message})`:""}`)}function wH(X){O5.delete(X)}function WH(X){for(let $ of O5.keys())if($.startsWith(X))O5.delete($)}function UH(X){wQ=X}async function KH(X=!1){let $=wQ??await Promise.resolve().then(() => (GQ(),JQ));if(X)return $.generateSignalsRuntimeDev();if(y8===null)y8=$.generateSignalsRuntime();return y8}async function zH(){if(b8===null){let{getRouterScript:X}=await Promise.resolve().then(() => (X5(),O2));b8=X()}return b8}function BH(){O5.clear(),qQ(),y8=null,qH=null,b8=null}function WQ(X){let $={debug:X.debug===!0,middleware:(X.middleware??[]).map((Z)=>({name:Z.name,timing:Z.timing,handler:String(Z.handler)})),customDirectives:(X.customDirectives??[]).map((Z)=>({name:Z.name,hasEndTag:Z.hasEndTag===!0,handler:String(Z.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify($)).digest("hex")}async function jH(X,$){try{if(!$.cachePath)return null;let Z=$7.resolve($.cachePath),Y=$7.join(Z,`${ZX(X)}.html`),J=$7.join(Z,`${ZX(X)}.meta.json`);if(!await r(Y)||!await r(J))return null;let G=await Bun.file(J).text(),Q=JSON.parse(G);if(Q.cacheVersion!==$.cacheVersion)return null;if(Q.optionsSignature!==WQ($))return null;if((await r1.promises.stat(X)).mtime.getTime()>Q.mtime)return null;for(let W of Q.dependencies)if(await r(W)){if((await r1.promises.stat(W)).mtime.getTime()>Q.mtime)return null}else return null;return await Bun.file(Y).text()}catch(Z){return console.warn(`Cache error for ${X}:`,Z),null}}async function _H(X,$,Z,Y){try{if(!Y.cachePath)return;let J=$7.resolve(Y.cachePath);await r1.promises.mkdir(J,{recursive:!0});let G=$7.join(J,`${ZX(X)}.html`),Q=$7.join(J,`${ZX(X)}.meta.json`),w=await r1.promises.stat(X);await Bun.write(G,$);let W={sourcePath:X,mtime:w.mtime.getTime(),dependencies:Array.from(Z),cacheVersion:Y.cacheVersion,optionsSignature:WQ(Y),generatedAt:Date.now()};await Bun.write(Q,JSON.stringify(W,null,2)),QQ.set(X,{output:$,mtime:w.mtime.getTime(),dependencies:Z})}catch(J){console.warn(`Failed to cache template ${X}:`,J)}}function ZX(X){return new Bun.CryptoHasher("sha1").update(X).digest("hex").substring(0,HH)}var QQ,O5,y8=null,qH=null,wQ=null,b8=null,HH=16;var W3=E(()=>{H0();QQ=new Map,O5=new Map});function UQ(X){return X.includes("data-stx-runtime")}function KQ(X){let $=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let Z=$.exec(X);Z!==null;Z=$.exec(X)){let Y=X.slice(Math.max(0,Z.index-80),Z.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(Y))continue;return!0}return!1}function q3(X,$){let Z=X.indexOf("<script"),Y=X.search(/<!doctype\b/i);if(Z!==-1&&(Y===-1||Z>Y))return X.slice(0,Z)+$+`
|
|
11838
11838
|
`+X.slice(Z);let J=/<head\b[^>]*>/i.exec(X);if(J){let Q=J.index+J[0].length;return`${X.slice(0,Q)}
|
|
11839
11839
|
${$}${X.slice(Q)}`}if(X.includes("</head>")){let Q=X.indexOf("</head>");return X.slice(0,Q)+$+`
|
|
11840
11840
|
`+X.slice(Q)}if(d7(X))return uX(X,(Q)=>`${Q}
|
|
@@ -11843,17 +11843,17 @@ ${X}`}async function S8(X,$){if(X.includes("data-stx-runtime")||X.includes("wind
|
|
|
11843
11843
|
${$}`;return`${X.slice(0,Z)}${$}
|
|
11844
11844
|
${X.slice(Z)}`}async function U3(X,$){if(!X.includes("</body>"))return X;if(X.includes("data-stx-router")||X.includes("__stxRouter)return")||X.includes("__stxRouter=true"))return X;let Z=$?.router,Y="";{let w={};if(Z){if(Z.container)w.container=Z.container;if(Z.interceptAllLinks!==void 0)w.interceptAllLinks=Z.interceptAllLinks;if(Z.progress!==void 0)w.progress=Z.progress;if(Z.viewTransitions!==void 0)w.viewTransitions=Z.viewTransitions;if(Z.viewTransitionDuration!==void 0)w.viewTransitionDuration=Z.viewTransitionDuration;if(Z.viewTransitionEasing!==void 0)w.viewTransitionEasing=Z.viewTransitionEasing;if(Z.scrollToTop!==void 0)w.scrollToTop=Z.scrollToTop;if(Z.prefetch!==void 0)w.prefetch=Z.prefetch;if(Z.cache!==void 0)w.cache=Z.cache;if(Z.progressColor!==void 0)w.progressColor=Z.progressColor;if(Z.progressHeight!==void 0)w.progressHeight=Z.progressHeight}try{let W=await sG($?.pagesDir);if(W.length>0)w.ownedRoutes=W}catch{}if(Object.keys(w).length>0)Y=`<script>window.__stxRouterConfig=${aG(w)};</script>
|
|
11845
11845
|
`}let{getCachedRouterScript:J}=await Promise.resolve().then(() => (W3(),w3)),G=$?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':$?.buildMode==="serve"?'<script data-stx-router src="/_stx/router.js"></script>':`<script data-stx-router>${await J()}</script>`,Q=X.lastIndexOf("</body>");return X.slice(0,Q)+Y+G+`
|
|
11846
|
-
</body>`+X.slice(Q+7)}var C8=E(()=>{oG();A9()});var g8={};
|
|
11846
|
+
</body>`+X.slice(Q+7)}var C8=E(()=>{oG();A9()});var g8={};a(g8,{scanScriptTags:()=>OQ,rewriteStxImportSpecifiers:()=>RQ,processSignals:()=>H3,processScriptSetup:()=>VQ,preEvalLiteralReactiveIfs:()=>j3,parseLoopExpression:()=>z3,hasSignalsSyntax:()=>f8,findMarkupIndexOutsideScripts:()=>v8,extractExports:()=>AQ,convertSignalLoopsToAttributes:()=>_3,convertSignalDirectivesToAttributes:()=>B3});function OQ(X,$={}){let Z=[];for(let Y of fX(X,v1)){let J=Y.token.match(/^<script\b([^>]*)>/i),G=Y.token.match(/<\/script\s*>$/i);if(!J||!G)continue;let Q=J[1];if($.skipAttrs){if($.skipAttrs.lastIndex=0,$.skipAttrs.test(Q))continue}let w=J[0].length,W=Y.token.length-G[0].length;Z.push({fullMatch:Y.token,attrs:Q,body:Y.token.slice(w,W),start:Y.start,end:Y.end})}return Z}function z3(X){let $=X.trim(),Z=$.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Z){let J=Z[1].trim(),G=Z[2].trim(),{itemVar:Q,indexVar:w}=BQ(G);if(Q)return{style:"as",iterable:J,itemVar:Q,indexVar:w}}let Y=$.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(Y){let J=Y[1].trim(),G=Y[2].trim(),{itemVar:Q,indexVar:w}=BQ(J);if(Q)return{style:"in",iterable:G,itemVar:Q,indexVar:w}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function BQ(X){let $=X.trim(),Z=$.match(/^(\w+)\s*=>\s*(\w+)$/);if(Z)return{itemVar:Z[2],indexVar:Z[1]};let Y=$.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]||null};let J=$.match(/^(\w+)\s*,\s*(\w+)$/);if(J)return{itemVar:J[1],indexVar:J[2]};let G=$.match(/^(\w+)$/);if(G)return{itemVar:G[1],indexVar:null};return{itemVar:null,indexVar:null}}function f8(X){return k2(X)}function FH(X){let $=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Z=0,Y;while((Y=$.exec(X))!==null){let J=Y[1];if(J.startsWith("if"))Z++;else if(J==="endif")Z--;else if(Z===0)return!0}return!1}function VH(X){let $=new Set,Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,J;while((J=Z.exec(X))!==null){let G=J[1],Q;while((Q=Y.exec(G))!==null)$.add(Q[1])}return $}function AH(X){if(!/[:@]for\s*=/.test(X)&&!/\bx-for\s*=/.test(X))return[];let $=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${K3})>`,"iy"),Z=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,Y=fX(X,(G,Q)=>{$.lastIndex=Q;let w=$.exec(G);if(!w||w.index!==Q||!Z.test(w[2]))return-1;return $.lastIndex}),J=[];for(let G of Y){$.lastIndex=0;let Q=$.exec(G.token);if(!Q)continue;let w=Q[2].match(Z),W=z3(w?.[1]??w?.[2]??""),q=[W.itemVar,W.indexVar].filter(Boolean);if(q.length===0)continue;let U=Q[1],z=/\/\s*>$/.test(G.token)||x8.has(U.toLowerCase())?G.end:FQ(X,G.start,U,G.end);if(z!==-1)J.push({start:G.start,end:z,vars:new Set(q)})}return J}function RH(X){return X.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function _Q(X,$,Z,Y){if(!X)return!1;let J=RH(X),G=!1,Q=!1,w=!1,W=/([a-zA-Z_$][\w$]*)/g,q;while((q=W.exec(J))!==null){let j=q[1];if(J.slice(0,q.index).trimEnd().endsWith("."))continue;if(jQ.has(j))continue;if($.has(j)||Y?.has(j))G=!0;else if(Z&&j in Z)Q=!0}let U=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,K;while((K=U.exec(J))!==null){let j=K[1];if(J.slice(0,K.index).trimEnd().endsWith("."))continue;if(jQ.has(j)||Z&&j in Z)continue;w=!0}return(G||w)&&!Q}function P8(X,$,Z){let Y=Z===void 0?` ${$}`:` ${$}="${Z.replace(/"/g,""")}"`,J=X.trim(),G=J.match(LQ);if(G&&MH(G[3],G[1])){let[,Q,w,W]=G;return`<${Q}${w}${Y}>${W}</${Q}>`}return`<template${Y}>${J}</template>`}function MH(X,$){let Z=new RegExp(`<(/)?${$}(?=[\\s/>])`,"gi"),Y=0,J;while((J=Z.exec(X))!==null)if(J[1]){if(Y--,Y<0)return!1}else Y++;return!0}function B3(X,$){let Z=VH(X);function Y(J){let G=J,Q=AH(J),w=(K)=>{let z=new Set;for(let j of Q)if(K>j.start&&K<j.end)for(let B of j.vars)z.add(B);return z},W=/@if\s*\(/g,q,U=[];while((q=W.exec(G))!==null){let K=q.index,z=K+q[0].length,j=1,B=z;while(B<G.length&&j>0){if(G[B]==="(")j++;else if(G[B]===")")j--;B++}if(j!==0)continue;let _=G.substring(z,B-1).trim(),H=B,O=1,L=H,F=/@(if\s*\(|endif)/g;F.lastIndex=H;let V;while((V=F.exec(G))!==null)if(V[1].startsWith("if"))O++;else if(V[1]==="endif"){if(O--,O===0){L=V.index+V[0].length;break}}if(O!==0)continue;let A=G.substring(H,L-6).trim(),R;if(FH(A)){let M=c7(G.substring(K,L));if(M.length===0)continue;let T=M[0].branches.filter((N)=>N.type!=="else"),k=w(K);if(!(T.length>0&&T.every((N)=>_Q(N.condition,Z,$,k))))continue;R=M[0].branches.map((N)=>{let S=Y(N.content);if(N.type==="elseif")return P8(S,"@else-if",N.condition??"");if(N.type==="else")return P8(S,"@else");return P8(S,"@if",N.condition??"")}).join(`
|
|
11847
11847
|
`)}else{if(!_Q(_,Z,$,w(K)))continue;R=P8(Y(A),"@if",_)}U.push({start:K,end:L,replacement:R}),W.lastIndex=L}for(let K=U.length-1;K>=0;K--){let{start:z,end:j,replacement:B}=U[K];G=G.substring(0,z)+B+G.substring(j)}return G}return Y(X)}function TH(X){let $=X.trim();if($==="")return;if($==="true")return!0;if($==="false")return!1;if($==="null")return!1;if($==="undefined")return!1;if($==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test($)){let J=Number($);return J!==0&&!Number.isNaN(J)}let Z=$.match(/^'((?:\\.|[^'\\])*)'$/);if(Z)return Z[1].length>0;let Y=$.match(/^"((?:\\.|[^"\\])*)"$/);if(Y)return Y[1].length>0;return}function FQ(X,$,Z,Y){if(x8.has(Z.toLowerCase()))return Y;let J=Z.toLowerCase(),G=X.toLowerCase(),Q=X.length,w=1,W=Y;while(W<Q){let q=X.indexOf("<",W);if(q===-1)return-1;if(W=q,X.startsWith("<!--",W)){let j=X.indexOf("-->",W+4);if(j===-1)return-1;W=j+3;continue}let U=/^<(script|style)\b/i.exec(X.slice(W,W+8));if(U){let j=X.indexOf(">",W);if(j===-1)return-1;if(X[j-1]==="/"){W=j+1;continue}let B=G.indexOf(`</${U[1].toLowerCase()}`,W);if(B===-1)return-1;let _=X.indexOf(">",B);if(_===-1)return-1;W=_+1;continue}if(X[W+1]==="/"){let j=/^<\/([a-z][\w-]*)\s*>/i.exec(X.slice(W,W+64));if(!j){W++;continue}if(j[1].toLowerCase()===J){if(w--,W+=j[0].length,w===0)return W;continue}W+=j[0].length;continue}let K=/^<([a-z][\w-]*)\b/i.exec(X.slice(W,W+64));if(!K){W++;continue}let z=X.indexOf(">",W);if(z===-1)return-1;if(K[1].toLowerCase()===J){let j=X.slice(W,z+1);if(!(/\/\s*>$/.test(j)||x8.has(J)))w++}W=z+1}return-1}function kH(X,$){let Z=$,Y=X.length;for(;;){while(Z<Y&&X[Z]!=="<")Z++;if(Z>=Y)return!1;if(X.startsWith("<!--",Z)){let Q=X.indexOf("-->",Z+4);if(Q===-1)return!1;Z=Q+3;continue}break}if(X[Z+1]==="/")return!1;let J=X.indexOf(">",Z);if(J===-1)return!1;let G=X.slice(Z,J+1);return NH.test(G)}function j3(X){if(!X.includes(":if")&&!X.includes(":show")&&!X.includes("x-if")&&!X.includes("x-show")&&!X.includes("@if=")&&!X.includes("@show="))return X;let $=[],Z=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,Y;while((Y=Z.exec(X))!==null)$.push([Y.index,Y.index+Y[0].length]);let J=(K)=>$.some(([z,j])=>K>=z&&K<j),G=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,Q=[],w;while((w=G.exec(X))!==null){if(J(w.index))continue;let[K,z,j,B,_,H,O]=w,L=TH(_);if(L===void 0)continue;let F=w.index,V=F+K.length,M=!!O||/\/\s*>$/.test(K)||x8.has(z.toLowerCase())?V:FQ(X,F,z,V);if(M===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&kH(X,M)){G.lastIndex=V;continue}if(L===!0){let k=`<${z}${j}${H}${O}>`;Q.push({start:F,end:V,replacement:k});continue}Q.push({start:F,end:M,replacement:""}),G.lastIndex=M}if(Q.length===0)return X;Q.sort((K,z)=>K.start-z.start);let W=[],q=-1;for(let K of Q){if(K.start<q)continue;W.push(K),q=K.end}let U=X;for(let K=W.length-1;K>=0;K--){let{start:z,end:j,replacement:B}=W[K];U=U.substring(0,z)+B+U.substring(j)}return U}function _3(X,$){let Z=X,Y=/@(for|foreach)\s*\(/g,J,G=[],Q=[];while((J=Y.exec(Z))!==null){let w=J[1],W=J.index,q=W+J[0].length,U=1,K=q;while(K<Z.length&&U>0){if(Z[K]==="(")U++;else if(Z[K]===")")U--;K++}if(U!==0)continue;let z=Z.substring(q,K-1).trim(),j=K,B=z3(z),_=w==="for"?"@endfor":"@endforeach",H=1,O=j,L=w==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${w}\\s*\\(|end${w})`,"g");L.lastIndex=j;let F;while((F=L.exec(Z))!==null)if(F[1].startsWith(w))H++;else if(H--,H===0){O=F.index+F[0].length;break}if(H!==0)continue;let V=()=>{let T=[B.itemVar,B.indexVar].filter(Boolean);if(T.length)Q.push({start:W,end:O,vars:T})};if(B.iterable){let T=B.iterable.trim();if(T.startsWith("[")||T.startsWith("{")||T.startsWith("'")||T.startsWith('"')||T.startsWith("`")||/^-?\d/.test(T)){V();continue}let k=T.split(/[.[(]/)[0].trim(),I=$?k in $:!1,D=Q.some((N)=>W>N.start&&W<N.end&&N.vars.includes(k));if(k&&(I||D)){V();continue}}if(B.style==="as")z=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let A=Z.substring(j,O-_.length).trim(),R=A.match(LQ),M;if(R){let[,T,k,I]=R;M=`<${T}${k} @for="${z}">${I}</${T}>`}else M=`<template @for="${z}">${A}</template>`;G.push({start:W,end:O,replacement:M})}for(let w=G.length-1;w>=0;w--){let{start:W,end:q,replacement:U}=G[w];Z=Z.substring(0,W)+U+Z.substring(q)}return Z}function IH(X){let $=new Set,Z=[],Y=0,J=0,G=X.length,Q=(U)=>{let K=Y+1;while(K<G){let z=X[K];if(z==="\\"){K+=2;continue}if(z===U)return K+1;K++}return G},w=()=>{let U=Y+2;while(U<G&&X[U]!==`
|
|
11848
11848
|
`)U++;return U},W=()=>{let U=Y+2;while(U<G-1){if(X[U]==="*"&&X[U+1]==="/")return U+2;U++}return G},q=(U)=>{let K=U,z=0;while(K<G){let j=X[K];if(j==="/"&&X[K+1]==="/"){let B=K+2;while(B<G&&X[B]!==`
|
|
11849
|
-
`)B++;K=B;continue}if(j==="/"&&X[K+1]==="*"){let B=K+2;while(B<G-1&&!(X[B]==="*"&&X[B+1]==="/"))B++;K=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=K+1;while(B<G){if(X[B]==="\\"){B+=2;continue}if(X[B]===j){B++;break}B++}K=B;continue}if(j==="("||j==="["||j==="{"){z++,K++;continue}if(j===")"||j==="]"||j==="}"){z--,K++;continue}if(j===";"&&z===0)return K+1;K++}return G};while(Y<G){let U=X[Y];if(U==="/"&&X[Y+1]==="/"){let K=w();Z.push(X.slice(Y,K)),Y=K;continue}if(U==="/"&&X[Y+1]==="*"){let K=W();Z.push(X.slice(Y,K)),Y=K;continue}if(U==='"'||U==="'"||U==="`"){let K=Q(U);Z.push(X.slice(Y,K)),Y=K;continue}if(U==="{"){J++,Z.push(U),Y++;continue}if(U==="}"){J--,Z.push(U),Y++;continue}if(J===0){let K=Y>0?X[Y-1]:"";if(K===""||/\s/.test(K)||K===";"||K==="}"||K==="{"){let j=X.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],_=q(Y+j[0].length);if($.has(B)){Z.push(`/* stx: deduped const ${B} */`),Y=_;continue}$.add(B),Z.push(X.slice(Y,_)),Y=_;continue}}}Z.push(U),Y++}return Z.join("")}async function VQ(X,$,Z){let Y=OQ(X,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),J=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,G=[];for(let H of Y){let O=H.body;if(
|
|
11849
|
+
`)B++;K=B;continue}if(j==="/"&&X[K+1]==="*"){let B=K+2;while(B<G-1&&!(X[B]==="*"&&X[B+1]==="/"))B++;K=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=K+1;while(B<G){if(X[B]==="\\"){B+=2;continue}if(X[B]===j){B++;break}B++}K=B;continue}if(j==="("||j==="["||j==="{"){z++,K++;continue}if(j===")"||j==="]"||j==="}"){z--,K++;continue}if(j===";"&&z===0)return K+1;K++}return G};while(Y<G){let U=X[Y];if(U==="/"&&X[Y+1]==="/"){let K=w();Z.push(X.slice(Y,K)),Y=K;continue}if(U==="/"&&X[Y+1]==="*"){let K=W();Z.push(X.slice(Y,K)),Y=K;continue}if(U==='"'||U==="'"||U==="`"){let K=Q(U);Z.push(X.slice(Y,K)),Y=K;continue}if(U==="{"){J++,Z.push(U),Y++;continue}if(U==="}"){J--,Z.push(U),Y++;continue}if(J===0){let K=Y>0?X[Y-1]:"";if(K===""||/\s/.test(K)||K===";"||K==="}"||K==="{"){let j=X.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],_=q(Y+j[0].length);if($.has(B)){Z.push(`/* stx: deduped const ${B} */`),Y=_;continue}$.add(B),Z.push(X.slice(Y,_)),Y=_;continue}}}Z.push(U),Y++}return Z.join("")}async function VQ(X,$,Z){let Y=OQ(X,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),J=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,G=[];for(let H of Y){let O=H.body;if(Q5(H.attrs))O=w5(O);if(J.test(O))G.push({fullMatch:H.fullMatch,attrs:H.attrs,content:O})}if(G.length===0)return{output:X,setupCode:null};let Q=`__stx_setup_${Date.now()}_${OH++}`,{hasUserImports:w,bundleClientScript:W}=await X0("stx/client-script-bundler",()=>Promise.resolve().then(() => (P7(),C7))),q=[];for(let H=0;H<G.length;H++){let O=G[H].content;if(O=S5(O).code,w(O))O=await W(O,$||"",{projectRoot:process.cwd()});O=O.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(F,V)=>RQ(V));let L=p0(O);q.push(`// \u2500\u2500 merged signal script #${H+1} \u2500\u2500
|
|
11850
11850
|
${L}`)}let U=q.join(`
|
|
11851
11851
|
|
|
11852
11852
|
`);U=IH(U);let K=AQ(U),z=K.split(",").map((H)=>H.trim()).filter(Boolean),j=SX(U,Z),B=`
|
|
11853
11853
|
<script data-stx-scoped>
|
|
11854
11854
|
function ${Q}() {
|
|
11855
|
-
${
|
|
11856
|
-
${
|
|
11855
|
+
${D5("const",z)}
|
|
11856
|
+
${y5(`${j}${U}`)}
|
|
11857
11857
|
return { ${K} };
|
|
11858
11858
|
}
|
|
11859
11859
|
window.__stx_latestSetup=${Q};
|
|
@@ -11863,13 +11863,13 @@ if(window.stx)window.stx._latestSetup=${Q};
|
|
|
11863
11863
|
`)G++;return!0}if($[G]==="/"&&$[G+1]==="*"){G+=2;while(G<Q-1&&!($[G]==="*"&&$[G+1]==="/"))G++;return G+=2,!0}return!1},j=()=>{if(J!==0)return;let B=$.slice(G).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(B){let F=B[2];if(!Y.has(F))Z.push(F),Y.add(F);return}let _=$.slice(G).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(_){_[1].split(",").forEach((F)=>{let V=F.trim();if(!V)return;let A=V.indexOf(":"),M=(A>=0?V.slice(A+1).trim():V).split(/[\s=]/)[0];if(M&&!Y.has(M))Z.push(M),Y.add(M)});return}let H=$.slice(G).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(H){H[1].split(",").forEach((F)=>{let V=F.trim().replace(/^\.\.\./,"");if(!V)return;let A=V.split(/[\s=]/)[0];if(A&&!Y.has(A))Z.push(A),Y.add(A)});return}let O=$.slice(G).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let F=O[1];if(!Y.has(F))Z.push(F),Y.add(F);return}let L=$.slice(G).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let F=L[1];if(!Y.has(F))Z.push(F),Y.add(F)}};while(G<Q){if(z())continue;if($[G]==="'"||$[G]==='"'){U($[G]),w=$[G-1];continue}if($[G]==="`"){K(),w="`";continue}if($[G]==="/"&&$[G+1]!=="/"&&$[G+1]!=="*"&&q()){W(),w="/";continue}if($[G]==="{"){J++,w="{",G++;continue}if($[G]==="}"){J--,w="}",G++;continue}if(J===0&&/[a-z]/i.test($[G])&&(G===0||/\s|[;{}()]/.test($[G-1])))j();if(!/\s/.test($[G]))w=$[G];G++}return Z.join(", ")}async function H3(X,$,Z,Y){if(!f8(X))return X;let J=X;if($.skipSignalsRuntime)return J;let{output:G,setupCode:Q}=await VQ(J,Z,Y);if(J=G,J=await S8(J,$),Q){let U=v8(J,/<\/head>/i),K=U===-1?v8(J,/<body[^>]*>/i):-1;if(U!==-1)J=`${J.slice(0,U)}${Q}
|
|
11864
11864
|
${J.slice(U)}`;else if(K!==-1){let z=/<body[^>]*>/i.exec(J.slice(K))[0],j=K+z.length;J=`${J.slice(0,j)}
|
|
11865
11865
|
${Q}${J.slice(j)}`}else J=`${J}
|
|
11866
|
-
${Q}`}let W=J.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),q=W&&/data-stx/.test(W[1]);if(!Q&&!q&&W&&!/data-stx-auto/.test(W[1])){let U=/<body[^>]*>/i,K=v8(J,U);if(K!==-1){let z=J.slice(0,K),j=J.slice(K).replace(U,(B)=>B.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));J=z+j}}return J}function v8(X,$){let Z=/<(script|style)\b[\s\S]*?<\/\1>/gi,Y=[],J;while((J=Z.exec(X))!==null)Y.push([J.index,J.index+J[0].length]);let G=new RegExp($.source,$.flags.replace(/[gy]/g,"")),Q=0;while(Q<X.length){let w=G.exec(X.slice(Q));if(!w)return-1;let W=Q+w.index;if(!Y.some(([U,K])=>W>=U&&W<K))return W;Q=W+Math.max(w[0].length,1)}return-1}function RQ(X){let $=[];for(let Z of X.split(",")){let Y=Z.trim();if(!Y||Y.startsWith("type "))continue;let J=Y.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(J&&J[1]!==J[2])$.push(`${J[2]} = ${J[1]}`)}if($.length===0)return HQ;return`var ${$.join(", ")}; ${HQ}`}var OH=0,K3=`(?:"[^"]*"|'[^']*'|[^>"'])*`,LQ,jQ,x8,NH,HQ="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var YX=E(()=>{
|
|
11866
|
+
${Q}`}let W=J.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),q=W&&/data-stx/.test(W[1]);if(!Q&&!q&&W&&!/data-stx-auto/.test(W[1])){let U=/<body[^>]*>/i,K=v8(J,U);if(K!==-1){let z=J.slice(0,K),j=J.slice(K).replace(U,(B)=>B.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));J=z+j}}return J}function v8(X,$){let Z=/<(script|style)\b[\s\S]*?<\/\1>/gi,Y=[],J;while((J=Z.exec(X))!==null)Y.push([J.index,J.index+J[0].length]);let G=new RegExp($.source,$.flags.replace(/[gy]/g,"")),Q=0;while(Q<X.length){let w=G.exec(X.slice(Q));if(!w)return-1;let W=Q+w.index;if(!Y.some(([U,K])=>W>=U&&W<K))return W;Q=W+Math.max(w[0].length,1)}return-1}function RQ(X){let $=[];for(let Z of X.split(",")){let Y=Z.trim();if(!Y||Y.startsWith("type "))continue;let J=Y.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(J&&J[1]!==J[2])$.push(`${J[2]} = ${J[1]}`)}if($.length===0)return HQ;return`var ${$.join(", ")}; ${HQ}`}var OH=0,K3=`(?:"[^"]*"|'[^']*'|[^>"'])*`,LQ,jQ,x8,NH,HQ="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var YX=E(()=>{C5();oX();Z1();e$();H0();C8();x1();E7();LQ=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;jQ=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"]);x8=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);NH=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import Z7 from"path";function MQ(X){return X.startsWith("http://")||X.startsWith("https://")||X.startsWith("//")}async function TQ(X,$,Z){try{let Y;if(X.startsWith("/")){let J=$;for(let G=0;G<5;G++){let Q=Z7.join(J,X);if(await Bun.file(Q).exists())return Q;J=Z7.dirname(J)}Y=Z7.join($,X)}else if(X.startsWith("./")||X.startsWith("../"))Y=Z7.resolve($,X);else Y=Z7.resolve($,X);if(await Bun.file(Y).exists())return Y;return null}catch{return null}}async function NQ(X,$,Z){let Y=X,J=Z7.dirname($),G=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,Q;while((Q=G.exec(Y))!==null){let[q,U,K,z]=Q;if(MQ(K))continue;let j=await TQ(K,J,$);if(j)try{let B=await Bun.file(j).text();if(Z.add(j),K.endsWith(".ts")||K.endsWith(".tsx")){let H=await Bun.build({entrypoints:[j],target:"browser",minify:!1,define:P0()});if(H.outputs.length>0)B=await H.outputs[0].text()}let _=`<script>
|
|
11867
11867
|
// Source: ${K}
|
|
11868
11868
|
${B}
|
|
11869
11869
|
</script>`;Y=Y.replace(q,_),G.lastIndex=0}catch(B){}}let w=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,W;while((W=w.exec(Y))!==null){let[q,U,K,z]=W,j=U+z;if(MQ(K))continue;if(/rel=["']stylesheet["']/.test(j)||K.endsWith(".css")){let _=await TQ(K,J,$);if(_)try{let H=await Bun.file(_).text();Z.add(_);let O=`<style>
|
|
11870
11870
|
/* Source: ${K} */
|
|
11871
11871
|
${H}
|
|
11872
|
-
</style>`;Y=Y.replace(q,O),w.lastIndex=0}catch(H){}}}return Y}var kQ=E(()=>{
|
|
11872
|
+
</style>`;Y=Y.replace(q,O),w.lastIndex=0}catch(H){}}}return Y}var kQ=E(()=>{P1()});function L3(X,$){let Z=X,Y=/@json\s*\(/g,J;while((J=Y.exec(Z))!==null){let G=J.index,Q=G+J[0].length-1,w=1,W=Q+1,q=null,U=!1;while(W<Z.length&&w>0){let F=Z[W];if(U){U=!1,W++;continue}if(F==="\\"&&q){U=!0,W++;continue}if(q){if(F===q)q=null;W++;continue}if(F==='"'||F==="'"||F==="`"){q=F,W++;continue}if(F==="(")w++;else if(F===")"){if(w--,w===0)break}W++}if(w!==0)break;let K=Z.substring(Q+1,W).trim(),z=Z.substring(G,W+1),j=-1,B=0,_=null,H=!1;for(let F=0;F<K.length;F++){let V=K[F];if(H){H=!1;continue}if(V==="\\"&&_){H=!0;continue}if(_){if(V===_)_=null;continue}if(V==='"'||V==="'"||V==="`"){_=V;continue}if(V==="("||V==="["||V==="{")B++;else if(V===")"||V==="]"||V==="}")B--;if(V===","&&B===0){j=F;break}}let O=j>=0?K.substring(0,j).trim():K,L=j>=0?K.substring(j+1).trim():void 0;try{let F=O.trim(),V;if(U0(F))V=K0(F,Object.keys($))(...Object.values($));else V=void 0;let A;if(L==="true")A=JSON.stringify(V,null,2);else A=JSON.stringify(V);let R=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Z=Z.substring(0,G)+R+Z.substring(W+1),Y.lastIndex=G+R.length}catch(F){G1.log(F instanceof Error?F:Error(String(F)),{directive:"@json"},"error"),Y.lastIndex=G+z.length}}return Z}function O3(X){return X.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function IQ(X){let $=X,Z=/@memo\s*\(/g,Y,J=[];while((Y=Z.exec($))!==null){let G=Y.index,Q=G+Y[0].length,w=1,W=Q;while(W<$.length&&w>0){if($[W]==="(")w++;else if($[W]===")")w--;W++}if(w!==0)continue;let q=$.slice(Q,W-1).trim(),U=W,K=$.slice(U),z=K.indexOf("@endmemo");if(z===-1)continue;let j=K.slice(0,z),B=U+z+8,_=j.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),H=_?_[0].length:0,O=j.slice(H),L=j.match(/(\s*)$/),F=L?L[0].length:0,V=O.slice(0,O.length-F),A=V.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),R;if(A){let[M,T,k="",I]=A,D=`<${T}${k} data-stx-memo="${q}"${I}>`;R=j.slice(0,H)+D+V.slice(M.length)+j.slice(H+V.length)}else R=`${j.slice(0,H)}<div data-stx-memo="${q}">${V}</div>${j.slice(H+V.length)}`;J.push({start:G,end:B,replacement:R}),Z.lastIndex=B}for(let G=J.length-1;G>=0;G--){let Q=J[G];$=$.slice(0,Q.start)+Q.replacement+$.slice(Q.end)}return $.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function F3(X){let $=X.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return $=$.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),$}function EQ(X){let Z=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),Y="",J=0,G;while((G=Z.exec(X))!==null){let Q=G.index,w=Q+G[0].length,W=!1,q=!1,U=-1;while(w<X.length){let _=X[w];if(W){if(_==="'")W=!1}else if(q){if(_==='"')q=!1}else if(_==="'")W=!0;else if(_==='"')q=!0;else if(_===">"){U=w;break}w++}if(U===-1)continue;if(X.slice(Q,U+1).includes("x-cloak"))continue;let z=X.slice(U+1),j=z.indexOf("</"),B=j>=0?z.slice(0,j):z.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(B))Y+=X.slice(J,U)+" x-cloak>",J=U+1}return Y+=X.slice(J),Y}function DQ(X){let $=/<[a-z][\w-]*/gi,Z="",Y=0,J;while((J=$.exec(X))!==null){let G=J.index,Q=J[0].slice(1).toLowerCase();if(Q==="script"||Q==="style"){let B=`</${Q}>`,_=X.toLowerCase().indexOf(B,G);if(_!==-1)$.lastIndex=_+B.length;continue}let w=G+J[0].length,W=!1,q=!1,U=-1;while(w<X.length){let B=X[w];if(W){if(B==="'")W=!1}else if(q){if(B==='"')q=!1}else if(B==="'")W=!0;else if(B==='"')q=!0;else if(B===">"){U=w;break}w++}if(U===-1)continue;let K=X.slice(G+J[0].length,U);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(K))continue;if(!EH.test(K))continue;let z=X[U-1]==="/",j=z?U-1:U;Z+=`${X.slice(Y,j)} x-cloak${z?" ":""}`,Y=j}return Z+=X.slice(Y),Z}var EH;var V3=E(()=>{T1();M0();EH=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function A3(X,$,Z,Y){let J=typeof Z==="boolean"?{enabled:Z,failOnViolation:Z}:Z??{enabled:!1},G=J.allowPatterns??[],Q=[],w=a0(X.replace(/\{\{--[\s\S]*?--\}\}/g,(W)=>W.replace(/[^\n]/g," ")));for(let{pattern:W,message:q,suggestion:U}of DH){if(G.some((z)=>/\w/.test(z)&&q.includes(z)))continue;W.lastIndex=0;let K=w.match(W);if(K&&K.length>0){let z=w.split(`
|
|
11873
11873
|
`),j=X.split(`
|
|
11874
11874
|
`),B=[];z.forEach((L,F)=>{if(W.lastIndex=0,W.test(L))B.push(F+1)});let _=B.length>0?` (script line${B.length>1?"s":""} ${B.join(", ")})`:"",H=B.slice(0,3).map((L)=>` ${L} | ${(j[L-1]??"").trim().slice(0,100)}`).join(`
|
|
11875
11875
|
`),O=H?`
|
|
@@ -11878,15 +11878,15 @@ ${H}`:"";Q.push(` \u2717 ${q}${_}
|
|
|
11878
11878
|
${Q.join(`
|
|
11879
11879
|
`)}
|
|
11880
11880
|
Tip: prefer useRef(), navigate(), and composables for component code`;if(J.failOnViolation)throw Error(U);else console.warn(U)}}var DH;var R3=E(()=>{DH=[{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:/(?:\bwindow\.)?localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables \u2014 or @appearanceBootstrap if this must run before first paint, where the runtime does not exist yet"},{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"}]});import yH from"fs";function h8(X){return[...X].sort().map(($)=>{try{let Z=yH.statSync($);return`${$}:${Z.size}:${Z.mtimeMs}`}catch{return`${$}:missing`}}).join(`
|
|
11881
|
-
`)}function u8(X,$,Z){let Y=X.get($);return Y!==void 0&&Y.signature===Z?Y.value:void 0}function _1(X,$,Z,Y){return X.set($,{signature:Z,value:Y}),Y}var M3=()=>{};var yQ={};
|
|
11882
|
-
${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load store ${B}:`,_)}if(W.length===0)return _1(
|
|
11881
|
+
`)}function u8(X,$,Z){let Y=X.get($);return Y!==void 0&&Y.signature===Z?Y.value:void 0}function _1(X,$,Z,Y){return X.set($,{signature:Z,value:Y}),Y}var M3=()=>{};var yQ={};a(yQ,{getStoreScript:()=>SH,clearStoreCache:()=>CH});import d8 from"path";function bH(X,$){for(let Z of X.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(Z[1])$.add(Z[1]);for(let Z of X.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let Y of(Z[1]??"").split(",")){let G=((Y.includes(":")?Y.split(":").pop():Y)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(G))$.add(G)}for(let Z of X.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let Y of(Z[1]??"").split(",")){let J=Y.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(J))$.add(J)}}async function SH(X){let $;if(X)$=d8.resolve(X);else{let B=await i1();$=d8.resolve(B.root||process.cwd(),B.storesDir||"stores")}let Z=new Bun.Glob("*.ts"),Y=[];try{for await(let B of Z.scan({cwd:$,absolute:!0})){let _=d8.basename(B,".ts");if(["index","types"].includes(_))continue;if(B.includes(".d.ts"))continue;Y.push(B)}}catch{return _1(Y7,$,"",""),null}let J=h8(Y),G=u8(Y7,$,J);if(G!==void 0)return G||null;if(Y.length===0)return _1(Y7,$,J,""),null;let Q=[];for(let B of Y){let _=await Bun.file(B).text();Q.push({file:B,hasUseStore:/useStore\s*\(/.test(_)})}Q.sort((B,_)=>{if(B.hasUseStore===_.hasUseStore)return 0;return B.hasUseStore?1:-1});let w=Q.map((B)=>B.file),W=[],q=new Set,U=B1({loader:"ts",target:"browser",define:P0()});for(let B of w)try{let _=await Bun.file(B).text(),H=d8.basename(B,".ts");bH(_,q),_=p0(_),_=kX(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=U.transformSync(_),W.push(`// Store: ${H}
|
|
11882
|
+
${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load store ${B}:`,_)}if(W.length===0)return _1(Y7,$,J,""),null;let K=W.join(`
|
|
11883
11883
|
|
|
11884
11884
|
`),j=`;(function(){
|
|
11885
11885
|
var __stx = window.stx || {};
|
|
11886
11886
|
${V1.filter((B)=>!q.has(B)&&new RegExp(`\\b${B}\\b`).test(K)).map((B)=>`var ${B} = __stx[${JSON.stringify(B)}];`).join(`
|
|
11887
11887
|
`)}
|
|
11888
11888
|
${K}
|
|
11889
|
-
})();`;return _1(
|
|
11889
|
+
})();`;return _1(Y7,$,J,j),j}function CH(){Y7.clear()}var Y7;var bQ=E(()=>{A1();P1();Z1();M3();H0();Y7=new Map});var T3,oI;var SQ=E(()=>{T3=["broadcast","calculateDistance","canNotify","clearCookies","clearFetchCache","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],oI=new Set(T3)});var vQ={};a(vQ,{selectComposableFiles:()=>CQ,referencedFrameworkComposables:()=>PQ,getFrameworkComposableScript:()=>fH,clearFrameworkComposableCache:()=>vH,__setRuntimeOwnedForTest:()=>gH});import m8 from"path";function vH(){JX.clear()}function CQ(X){let $=new Map;for(let Z of X){let Y=m8.basename(Z);if(Y.endsWith(".d.ts"))continue;let J=Y.replace(/\.[jt]s$/,"");if(J==="index")continue;if(J===Y)continue;let G=$.get(J);if(G&&!G.endsWith(".js"))continue;$.set(J,Z)}return[...$.values()].sort()}function xH(X,$){let Z=$.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Z}\\b`).test(X)}function PQ(X){if(!X)return[];let $=X.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),Z=[];for(let Y of PH){if(N3.has(Y))continue;let J=Y.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${J}\\s*\\(`).test($))Z.push(Y)}return Z.sort()}async function fH(X,$){let Z=PQ(X);if(Z.length===0)return null;let Y=$??m8.join(import.meta.dir,"composables"),J=`${Y}\x00${Z.join(",")}`,G=JX.get(J);if(G!==void 0)return G||null;let Q=B1({loader:"ts",target:"browser",define:P0()}),w=new Set(Z),W=[],q=new Set,U=[];try{let B=new Bun.Glob("*.{ts,js}");for await(let _ of B.scan({cwd:Y,absolute:!0}))U.push(_)}catch{return JX.set(J,""),null}U=CQ(U);for(let B of U){let _;try{_=await Bun.file(B).text()}catch{continue}let H=[];try{H=Q.scan(_).exports.filter((O)=>O!=="default")}catch{continue}if(!H.some((O)=>w.has(O)))continue;try{_=_.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^import\s+type\s+.*$/gm,""),_=_.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),_=_.replace(/^export\s+default\s+/gm,""),_=_.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),W.push(`// ${m8.basename(B).replace(/\.[jt]s$/,"")}
|
|
11890
11890
|
${Q.transformSync(_).trim()}`);for(let O of H)q.add(O)}catch(O){console.warn(`[stx] framework composable ${m8.basename(B)} could not be bundled:`,O)}}let K=Z.filter((B)=>!q.has(B)&&!xH(X,B));if(K.length>0)console.warn(`[stx] could not bundle ${K.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(W.length===0)return JX.set(J,""),null;let z=[...q].map((B)=>` try { if (!(${JSON.stringify(B)} in __s)) { __s[${JSON.stringify(B)}] = ${B}; if (!(${JSON.stringify(B)} in window)) window[${JSON.stringify(B)}] = ${B}; } } catch (e) {}`).join(`
|
|
11891
11891
|
`),j=`<script data-stx-framework-composables>
|
|
11892
11892
|
;(function(){
|
|
@@ -11896,8 +11896,8 @@ ${W.join(`
|
|
|
11896
11896
|
`)}
|
|
11897
11897
|
${z}
|
|
11898
11898
|
})();
|
|
11899
|
-
</script>`;return JX.set(J,j),j}function gH(X){N3.clear();for(let $ of X)N3.add($)}var JX,N3,PH;var xQ=E(()=>{
|
|
11900
|
-
${A.trim()}`)}catch(A){console.warn(`[stx] Failed to load composable ${V}:`,A)}if(z.length===0||j.size===0)return _1(
|
|
11899
|
+
</script>`;return JX.set(J,j),j}function gH(X){N3.clear();for(let $ of X)N3.add($)}var JX,N3,PH;var xQ=E(()=>{P1();SQ();H0();JX=new Map,N3=new Set,PH=new Set(T3)});var gQ={};a(gQ,{listComposableModules:()=>dH,getComposableScript:()=>cH,clearComposableCache:()=>pH});import GX from"path";function I3(X){let $=GX.basename(X,".ts");return $==="index"||$==="types"||X.endsWith(".d.ts")}async function fQ(X){if(X)return GX.resolve(X);let $=`<default>:${process.cwd()}`,Z=k3.get($);if(Z!==void 0)return Z;let Y=await uH();if(Y!==null)k3.set($,Y);return Y}async function uH(){let X=await i1(),$=X.root||process.cwd(),Z=X.composablesDir;if(Z)return GX.resolve($,Z);for(let Y of hH){let J=GX.resolve($,Y);try{let G=new Bun.Glob("**/*.ts");for await(let Q of G.scan({cwd:J,absolute:!0}))if(!I3(Q))return J}catch{}}return null}async function dH(X){let $=await fQ(X);if(!$)return[];let Z=[];try{let G=new Bun.Glob("**/*.ts");for await(let Q of G.scan({cwd:$,absolute:!0}))if(!I3(Q))Z.push(Q)}catch{return[]}Z.sort();let Y=B1({loader:"ts",target:"browser",define:P0()}),J=[];for(let G of Z)try{let Q=await Bun.file(G).text(),w=Y.scan(Q).exports.filter((W)=>W!=="default");if(w.length>0)J.push({file:G,names:w})}catch{}return J}function mH(X,$){return new RegExp(`\\b${$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(X)}function lH(X,$,Z){let Y=new Map;for(let{file:w,names:W}of X)for(let q of W)if(!Y.has(q))Y.set(q,w);let J=(w)=>{let W=[];for(let[q,U]of Y)if(mH(w,q))W.push(U);return W},G=new Set,Q=J(Z);while(Q.length>0){let w=[];for(let W of Q){if(G.has(W))continue;G.add(W);for(let q of J($.get(W)??""))if(!G.has(q))w.push(q)}Q=w}return G}async function cH(X,$){let Z=await fQ(X);if(!Z)return null;let Y=[];try{let V=new Bun.Glob("**/*.ts");for await(let A of V.scan({cwd:Z,absolute:!0})){if(I3(A))continue;Y.push(A)}}catch{return _1(J7,Z,"",""),null}let J=h8(Y);if(Y.length===0)return _1(J7,Z,J,""),null;Y.sort();let G=B1({loader:"ts",target:"browser",define:P0()}),Q=new Map,w=[];for(let V of Y)try{let A=await Bun.file(V).text();Q.set(V,A);let R=G.scan(A).exports.filter((M)=>M!=="default");if(R.length>0)w.push({file:V,names:R})}catch{Q.set(V,"")}let W=$===void 0?new Set(Y):lH(w,Q,$);if(W.size===0)return null;let q=Y.filter((V)=>W.has(V)),U=`${Z}\x00${q.join("\x00")}`,K=u8(J7,U,J);if(K!==void 0)return K||null;let z=[],j=new Set,B=new Set;for(let V of q)try{let A=Q.get(V)??await Bun.file(V).text(),R=GX.basename(V,".ts");for(let M of A.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(M[1])B.add(M[1]);try{for(let M of G.scan(A).exports)if(M!=="default")j.add(M)}catch{}A=p0(A),A=kX(A),A=A.replace(/^export\s+(default\s+)?/gm,""),A=G.transformSync(A),z.push(`// Composable: ${R}
|
|
11900
|
+
${A.trim()}`)}catch(A){console.warn(`[stx] Failed to load composable ${V}:`,A)}if(z.length===0||j.size===0)return _1(J7,U,J,""),null;let _=[...j].map((V)=>` try { __c[${JSON.stringify(V)}] = ${V}; } catch (e) {}`).join(`
|
|
11901
11901
|
`),H=JSON.stringify([...j]),O=z.join(`
|
|
11902
11902
|
|
|
11903
11903
|
`),F=`;(function(){
|
|
@@ -11921,7 +11921,7 @@ ${_}
|
|
|
11921
11921
|
}
|
|
11922
11922
|
window[__n] = __c[__n];
|
|
11923
11923
|
}
|
|
11924
|
-
})();`;return _1(
|
|
11924
|
+
})();`;return _1(J7,U,J,F),F}function pH(){J7.clear(),k3.clear()}var J7,k3,hH;var hQ=E(()=>{A1();P1();M3();Z1();H0();J7=new Map,k3=new Map,hH=["composables","functions"]});var dQ={};a(dQ,{processDeferDirectives:()=>oH});function iH(){return`stx-defer-${++uQ}`}function nH(X){let $=X.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if($)return{trigger:$[1],value:$[2]};return{trigger:"immediate"}}function rH(X,$,Z){let{trigger:Y,value:J}=nH($),G=Z,Q,w,W,q=Z.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(q)Q=q[1].trim(),G=G.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let U=Z.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(U)w=U[1].trim(),G=G.replace(/@loading[\s\S]*?(?=@error|$)/,"");let K=Z.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(K)W=K[2].trim(),G=G.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return G=G.trim(),{trigger:Y,triggerValue:J,content:G,placeholder:Q,loading:w,error:W}}function sH(X,$){let{trigger:Z,triggerValue:Y}=$,J;switch(Z){case"visible":J=`
|
|
11925
11925
|
const observer = new IntersectionObserver((entries) => {
|
|
11926
11926
|
if (entries[0].isIntersecting) {
|
|
11927
11927
|
observer.disconnect();
|
|
@@ -12002,7 +12002,7 @@ else {
|
|
|
12002
12002
|
${K}
|
|
12003
12003
|
</div>
|
|
12004
12004
|
${j}
|
|
12005
|
-
`})}var uQ=0;var lQ={};
|
|
12005
|
+
`})}var uQ=0;var lQ={};a(lQ,{processTeleportDirectives:()=>XL,ensureTeleportTargets:()=>$L});function aH(){return`stx-teleport-${++mQ}`}function tH(X){let $=X.split(",").map((J)=>J.trim()),Z=$[0].replace(/['"]/g,""),Y;for(let J=1;J<$.length;J++){let G=$[J].match(/disabled:\s*(.+)/);if(G)Y=G[1].trim()}return{target:Z,disabled:Y}}function eH(X,$){return`
|
|
12006
12006
|
<script>
|
|
12007
12007
|
(function() {
|
|
12008
12008
|
const source = document.getElementById('${X}');
|
|
@@ -12070,7 +12070,7 @@ else {
|
|
|
12070
12070
|
});
|
|
12071
12071
|
})();
|
|
12072
12072
|
</script>
|
|
12073
|
-
`}var mQ=0;var nQ={};
|
|
12073
|
+
`}var mQ=0;var nQ={};a(nQ,{processTransitionDirectives:()=>GL,processTransitionAttributes:()=>qL,performLeave:()=>JL,performEnter:()=>YL,generateTransitionRuntime:()=>WL,generateTransitionCSS:()=>wL});function cQ(X,$={}){return{enterFrom:$.enterClass||`${X}-enter-from`,enterActive:$.enterActiveClass||`${X}-enter-active`,enterTo:$.enterToClass||`${X}-enter-to`,leaveFrom:$.leaveClass||`${X}-leave-from`,leaveActive:$.leaveActiveClass||`${X}-leave-active`,leaveTo:$.leaveToClass||`${X}-leave-to`}}function ZL(X){let $=getComputedStyle(X),Z=$.transitionDuration||"0s",Y=$.animationDuration||"0s",J=(G)=>{let Q=G.match(/^([\d.]+)(s|ms)?$/);if(!Q)return 0;let w=parseFloat(Q[1]);return(Q[2]||"s")==="ms"?w:w*1000};return Math.max(J(Z),J(Y))}function pQ(X,$){return new Promise((Z)=>{let Y=$??ZL(X);if(Y===0){Z();return}let J=!1,G=()=>{if(J)return;J=!0,X.removeEventListener("transitionend",Q),X.removeEventListener("animationend",Q),Z()},Q=(w)=>{if(w.target===X)G()};X.addEventListener("transitionend",Q),X.addEventListener("animationend",Q),setTimeout(G,Y+50)})}function iQ(X){X.offsetHeight}async function YL(X,$={}){let Z=$.name||"stx",Y=cQ(Z,$),J=typeof $.duration==="object"?$.duration.enter:$.duration;if($.onBeforeEnter?.(X),X.classList.add(Y.enterFrom),X.classList.add(Y.enterActive),iQ(X),X.classList.remove(Y.enterFrom),X.classList.add(Y.enterTo),$.onEnter)await new Promise((G)=>{$.onEnter(X,G)});else await pQ(X,J);X.classList.remove(Y.enterActive),X.classList.remove(Y.enterTo),$.onAfterEnter?.(X)}async function JL(X,$={}){let Z=$.name||"stx",Y=cQ(Z,$),J=typeof $.duration==="object"?$.duration.leave:$.duration;if($.onBeforeLeave?.(X),X.classList.add(Y.leaveFrom),X.classList.add(Y.leaveActive),iQ(X),X.classList.remove(Y.leaveFrom),X.classList.add(Y.leaveTo),$.onLeave)await new Promise((G)=>{$.onLeave(X,G)});else await pQ(X,J);X.classList.remove(Y.leaveActive),X.classList.remove(Y.leaveTo),$.onAfterLeave?.(X)}function GL(X,$={},Z){let Y=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return X.replace(Y,(J,G,Q)=>{let w=QL(G),W=w.name||"stx",q=w.duration||300,U=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
|
|
12074
12074
|
<div
|
|
12075
12075
|
class="stx-transition-wrapper"
|
|
12076
12076
|
data-transition="${W}"
|
|
@@ -12388,7 +12388,7 @@ else {
|
|
|
12388
12388
|
|
|
12389
12389
|
console.log('[stx] Transition runtime initialized');
|
|
12390
12390
|
})();
|
|
12391
|
-
`}function qL(X){let $=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return X.replace($,(Z,Y,J,G)=>{let Q=J||"300",w=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${Y}" data-stx-transition-duration="${Q}" data-stx-transition-condition="${G}" data-stx-transition-id="${w}"`})}var sQ={};
|
|
12391
|
+
`}function qL(X){let $=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return X.replace($,(Z,Y,J,G)=>{let Q=J||"300",w=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${Y}" data-stx-transition-duration="${Q}" data-stx-transition-condition="${G}" data-stx-transition-id="${w}"`})}var sQ={};a(sQ,{withErrorBoundary:()=>rQ,processErrorBoundaryDirectives:()=>zL,generateErrorBoundaryRuntime:()=>LL,generateErrorBoundaryCSS:()=>HL,createErrorBoundary:()=>_L});function KL(){return`eb-${++UL}-${Date.now().toString(36)}`}function zL(X,$={},Z){let Y=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return X.replace(Y,(J,G,Q,w)=>{let W=KL(),q=BL(G||"");return jL(W,Q.trim(),w.trim(),q)})}function BL(X){let $={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3]||Y[4];switch(J){case"id":$.id=G;break;case"logErrors":$.logErrors=G==="true";break}}return $}function jL(X,$,Z,Y){let J=Y.logErrors!==!1;return`
|
|
12392
12392
|
<div class="stx-error-boundary" data-boundary-id="${X}" data-has-error="false">
|
|
12393
12393
|
<div class="stx-error-boundary-content" data-boundary-content="${X}">
|
|
12394
12394
|
${$}
|
|
@@ -12617,7 +12617,7 @@ else {
|
|
|
12617
12617
|
|
|
12618
12618
|
console.log('[stx] Error boundary runtime initialized');
|
|
12619
12619
|
})();
|
|
12620
|
-
`}var UL=0;var oQ={};
|
|
12620
|
+
`}var UL=0;var oQ={};a(oQ,{renderSSRSuspense:()=>TL,processSuspenseDirectives:()=>VL,generateSuspenseRuntime:()=>kL,generateSuspenseCSS:()=>NL,createSSRSuspense:()=>ML});function FL(){return`suspense-${++OL}-${Date.now().toString(36)}`}function VL(X,$={},Z){let Y=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return X.replace(Y,(J,G,Q,w)=>{let W=FL(),q=AL(G||"");return RL(W,Q.trim(),w.trim(),q)})}function AL(X){let $={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3],Q=Y[4];switch(J){case"id":$.id=G;break;case"timeout":$.timeout=Q?parseInt(Q,10):void 0;break}}return $}function RL(X,$,Z,Y){let J=Y.timeout||30000,G=Y.id||X;return`
|
|
12621
12621
|
<div class="stx-suspense" data-suspense-id="${X}" data-custom-id="${G}" data-status="pending">
|
|
12622
12622
|
<div class="stx-suspense-fallback" data-suspense-fallback="${X}">
|
|
12623
12623
|
${Z}
|
|
@@ -12955,7 +12955,7 @@ else {
|
|
|
12955
12955
|
|
|
12956
12956
|
console.log('[stx] Suspense runtime initialized');
|
|
12957
12957
|
})();
|
|
12958
|
-
`}var OL=0;var Xw={};
|
|
12958
|
+
`}var OL=0;var Xw={};a(Xw,{processAsyncDirectives:()=>EL,isAsyncComponent:()=>yL,generateAsyncComponentRuntime:()=>SL,generateAsyncComponentCSS:()=>bL,defineAsyncComponent:()=>DL});function aQ(){return`async-${++IL}-${Date.now().toString(36)}`}function EL(X,$={},Z){let Y=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,J=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,G=X;return G=G.replace(Y,(Q,w,W,q)=>{let U=aQ(),K=tQ(w);return eQ(U,K,W.trim(),q.trim())}),G=G.replace(J,(Q,w,W)=>{let q=aQ(),U=tQ(w);return eQ(q,U,W.trim(),'<div class="stx-async-error">Failed to load component</div>')}),G}function tQ(X){let $={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3],Q=Y[4],w=Y[5];switch(J){case"component":$.component=G||w||"";break;case"timeout":$.timeout=Q?parseInt(Q,10):30000;break;case"delay":$.delay=Q?parseInt(Q,10):200;break;case"suspensible":$.suspensible=w==="true";break;case"retries":$.retries=Q?parseInt(Q,10):0;break;case"loadingComponent":$.loadingComponent=G||w;break;case"errorComponent":$.errorComponent=G||w;break}}return $}function eQ(X,$,Z,Y){let{component:J,timeout:G,delay:Q,suspensible:w,retries:W}=$;return`
|
|
12959
12959
|
<div class="stx-async-component" data-async-id="${X}" data-component="${J}" data-status="pending">
|
|
12960
12960
|
<div class="stx-async-loading" data-async-loading="${X}">
|
|
12961
12961
|
${Z}
|
|
@@ -13310,7 +13310,7 @@ catch (error) {
|
|
|
13310
13310
|
|
|
13311
13311
|
console.log('[stx] Async component runtime initialized');
|
|
13312
13312
|
})();
|
|
13313
|
-
`}var IL=0;var Zw={};
|
|
13313
|
+
`}var IL=0;var Zw={};a(Zw,{shouldCacheComponent:()=>gL,processKeepAliveDirectives:()=>PL,onDeactivated:()=>mL,onActivated:()=>dL,generateKeepAliveRuntime:()=>uL,generateKeepAliveCSS:()=>hL,createKeepAliveCache:()=>fL});function $w(){return`keep-alive-${++CL}-${Date.now().toString(36)}`}function PL(X,$={},Z){let Y=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return X.replace(Y,(J,G,Q)=>{let w=$w(),W=vL(G||"");return xL(w,Q.trim(),W)})}function vL(X){let $={max:10},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3],Q=Y[4];switch(J){case"max":$.max=Q?parseInt(Q,10):10;break;case"include":$.include=G;break;case"exclude":$.exclude=G;break;case"id":$.id=G;break}}return $}function xL(X,$,Z){let{max:Y,include:J,exclude:G}=Z,Q=Z.id||X;return`
|
|
13314
13314
|
<div class="stx-keep-alive" data-keep-alive-id="${X}" data-custom-id="${Q}">
|
|
13315
13315
|
<div class="stx-keep-alive-content" data-keep-alive-content="${X}">
|
|
13316
13316
|
${$}
|
|
@@ -13658,7 +13658,7 @@ else {
|
|
|
13658
13658
|
|
|
13659
13659
|
console.log('[stx] Keep-alive runtime initialized');
|
|
13660
13660
|
})();
|
|
13661
|
-
`}function dL(X){if(typeof document<"u")document.addEventListener("stx:activated",($)=>{X($.detail)})}function mL(X){if(typeof document<"u")document.addEventListener("stx:deactivated",($)=>{X($.detail)})}var CL=0;var ww={};
|
|
13661
|
+
`}function dL(X){if(typeof document<"u")document.addEventListener("stx:activated",($)=>{X($.detail)})}function mL(X){if(typeof document<"u")document.addEventListener("stx:deactivated",($)=>{X($.detail)})}var CL=0;var ww={};a(ww,{useVirtualList:()=>Jw,processVirtualListDirectives:()=>D3,processVirtualGridDirectives:()=>Qw,processInfiniteListDirectives:()=>Gw,generateVirtualListCSS:()=>Yw,default:()=>lL,createVirtualList:()=>E3});function E3(X,$){let{itemHeight:Z,containerHeight:Y,overscan:J=3,keyProperty:G="id",dynamicHeight:Q=!1,estimatedItemHeight:w=Z,direction:W="vertical"}=$,q=[...X],U=0,K=new Map;function z(){if(Q)return j();let R=Math.max(0,Math.floor(U/Z)-J),M=Math.ceil(Y/Z),T=Math.min(q.length-1,R+M+J*2);return{startIndex:R,endIndex:T}}function j(){let R=0,M=0,T=q.length-1;for(let k=0;k<q.length;k++){let I=K.get(k)||w;if(R+I>U){M=Math.max(0,k-J);break}R+=I}R=0;for(let k=0;k<q.length;k++){let I=K.get(k)||w;if(R+=I,R>U+Y){T=Math.min(q.length-1,k+J);break}}return{startIndex:M,endIndex:T}}function B(){if(Q){let R=0;for(let M=0;M<q.length;M++)R+=K.get(M)||w;return R}return q.length*Z}function _(R){if(Q){let M=0;for(let T=0;T<R;T++)M+=K.get(T)||w;return M}return R*Z}function H(){let{startIndex:R,endIndex:M}=z();return{startIndex:R,endIndex:M,scrollTop:U,totalHeight:B(),visibleItems:q.slice(R,M+1),itemHeights:new Map(K)}}function O(R,M="auto"){let T=_(R);L(T,M)}function L(R,M="auto"){U=Math.max(0,Math.min(R,B()-Y))}function F(){z()}function V(R){q=[...R],K.clear(),F()}function A(){q=[],K.clear()}return{scrollToIndex:O,scrollToOffset:L,getState:H,refresh:F,setItems:V,destroy:A}}function D3(X,$={},Z){let Y=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return X.replace(Y,(J,G,Q,w)=>{let W=G.trim(),q=$[W];if(!q||!Array.isArray(q))return`<!-- virtualList: items "${W}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3};if(Q)try{let L=Q.trim(),F=Function(`return ${L}`)();U={...U,...F}}catch{}let K=`vlist-${Math.random().toString(36).substring(2,9)}`,z=Math.ceil(U.containerHeight/U.itemHeight),j=U.overscan||3,B=0,_=Math.min(q.length-1,z+j),H="";for(let L=B;L<=_&&L<q.length;L++){let F=q[L],V=w.replace(/\{\{\s*item\s*\}\}/g,typeof F==="object"?JSON.stringify(F):String(F)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(A,R)=>{if(typeof F==="object"&&F!==null)return String(F[R]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(L));H+=`
|
|
13662
13662
|
<div class="virtual-item ${U.itemClass||""}"
|
|
13663
13663
|
style="position: absolute; top: ${L*U.itemHeight}px; height: ${U.itemHeight}px; width: 100%;"
|
|
13664
13664
|
data-index="${L}">
|
|
@@ -14031,7 +14031,7 @@ else {
|
|
|
14031
14031
|
stxIslands.initIslands();
|
|
14032
14032
|
}
|
|
14033
14033
|
})();
|
|
14034
|
-
</script>`}function Uw(X){let $=X.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if($)return $[1];let Z=X.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Z)return Z[1];return null}function Kw(X,$){let Z={},Y=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,J;while((J=Y.exec(X))!==null){let G=J[1],Q=J[2];if(Q in $)Z[G]=$[Q];else Z[G]=Q}return Z}var Rw={};
|
|
14034
|
+
</script>`}function Uw(X){let $=X.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if($)return $[1];let Z=X.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Z)return Z[1];return null}function Kw(X,$){let Z={},Y=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,J;while((J=Y.exec(X))!==null){let G=J[1],Q=J[2];if(Q in $)Z[G]=$[Q];else Z[G]=Q}return Z}var Rw={};a(Rw,{processStaticDirectives:()=>Vw,processPartialHydrationDirectives:()=>Bw,onHydrated:()=>Fw,isHydrated:()=>Ow,hydrateIsland:()=>_w,hydrateByStrategy:()=>Hw,hydrateAll:()=>Lw,generatePartialHydrationCSS:()=>jw,generateIslandManifest:()=>Aw,default:()=>aL,createIslandRegistry:()=>zw});function zw(){let X=new Map;return{islands:X,register($){X.set($.id,$)},get($){return X.get($)},async hydrate($){let Z=X.get($);if(!Z||Z.hydrated)return;if(Z.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:$,component:Z.component}}))},async hydrateAll(){let $=Array.from(X.values()).filter((Z)=>!Z.hydrated).map((Z)=>this.hydrate(Z.id));await Promise.all($)}}}function cL(X){return`
|
|
14035
14035
|
<script data-hydrate="${X}">
|
|
14036
14036
|
(function() {
|
|
14037
14037
|
const island = document.querySelector('[data-island="${X}"]');
|
|
@@ -14183,8 +14183,8 @@ else {
|
|
|
14183
14183
|
});
|
|
14184
14184
|
})();
|
|
14185
14185
|
</script>
|
|
14186
|
-
`}function Bw(X,$={},Z){let Y=X,J=!1,G=/@client:(load|idle|visible|media|only|hover|event)/i.test(X);if(Y=
|
|
14187
|
-
`+qw();return Y}function
|
|
14186
|
+
`}function Bw(X,$={},Z){let Y=X,J=!1,G=/@client:(load|idle|visible|media|only|hover|event)/i.test(X);if(Y=G7(Y,"load",$),Y=G7(Y,"idle",$),Y=G7(Y,"visible",$),Y=G7(Y,"media",$),Y=oL(Y),Y=G7(Y,"hover",$),Y=G7(Y,"event",$),J=G&&Y!==X,J)Y+=`
|
|
14187
|
+
`+qw();return Y}function G7(X,$,Z){let Y=new RegExp(`@client:${$}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return X.replace(Y,(J,G,Q)=>{let w={strategy:$};if(G)try{let _=G.split(",").map((H)=>H.trim());for(let H of _){let[O,L]=H.split(":").map((F)=>F.trim());if(O&&L){let F=L.replace(/^['"]|['"]$/g,"");w[O]=F}}}catch{}let W=`island-${Math.random().toString(36).substring(2,9)}`,q=Uw(Q.trim()),U=Kw(Q.trim(),Z),K=[];if(w.rootMargin)K.push(`data-root-margin="${w.rootMargin}"`);if(w.threshold!==void 0)K.push(`data-threshold="${w.threshold}"`);if(w.media)K.push(`data-media="${w.media}"`);if(w.event)K.push(`data-event="${w.event}"`);if(q)K.push(`data-component="${q}"`);let j=Object.keys(U).length>0?`
|
|
14188
14188
|
<script type="application/json" data-island-props="${W}">${JSON.stringify(U)}</script>`:"",B="";switch($){case"load":B=cL(W);break;case"idle":B=pL(W,w);break;case"visible":B=iL(W,w);break;case"media":B=nL(W,w);break;case"hover":B=rL(W);break;case"event":B=sL(W,w);break}return`
|
|
14189
14189
|
<div data-island="${W}"
|
|
14190
14190
|
data-strategy="${$}"
|
|
@@ -14259,7 +14259,7 @@ else {
|
|
|
14259
14259
|
<script type="application/json" id="stx-island-manifest">
|
|
14260
14260
|
${JSON.stringify($)}
|
|
14261
14261
|
</script>
|
|
14262
|
-
`}var aL;var Mw=E(()=>{aL={processPartialHydrationDirectives:Bw,processStaticDirectives:Vw,generatePartialHydrationCSS:jw,generateIslandManifest:Aw,createIslandRegistry:zw,hydrateIsland:_w,hydrateByStrategy:Hw,hydrateAll:Lw,isHydrated:Ow,onHydrated:Fw}});var Pw={};
|
|
14262
|
+
`}var aL;var Mw=E(()=>{aL={processPartialHydrationDirectives:Bw,processStaticDirectives:Vw,generatePartialHydrationCSS:jw,generateIslandManifest:Aw,createIslandRegistry:zw,hydrateIsland:_w,hydrateByStrategy:Hw,hydrateAll:Lw,isHydrated:Ow,onHydrated:Fw}});var Pw={};a(Pw,{watchMultiple:()=>Ew,watchEffect:()=>Dw,watch:()=>Iw,unref:()=>Tw,toRefs:()=>Nw,throttledComputed:()=>Cw,stxWatchMultiple:()=>Ew,stxWatchEffect:()=>Dw,stxWatch:()=>Iw,stxUnref:()=>Tw,stxToRefs:()=>Nw,stxThrottledComputed:()=>Cw,stxShallowRef:()=>kw,stxRef:()=>Q7,stxIsRef:()=>s1,stxDebouncedComputed:()=>Sw,stxComputed:()=>wX,shallowRef:()=>kw,ref:()=>Q7,processWatchDirectives:()=>bw,processComputedDirectives:()=>yw,isRef:()=>s1,default:()=>tL,debouncedComputed:()=>Sw,computed:()=>wX});function Q7(X){let $=X,Z=new Set,Y={get value(){if(H1){let J=QX.get(Y);if(!J)J=new Set,QX.set(Y,J);J.add(H1)}return $},set value(J){if(!Object.is($,J)){$=J,Z.forEach((Q)=>Q(J));let G=QX.get(Y);if(G)G.forEach((Q)=>Q())}},subscribe(J){return Z.add(J),()=>Z.delete(J)},peek(){return $}};return Y}function s1(X){return X!==null&&typeof X==="object"&&"value"in X&&"subscribe"in X&&"peek"in X}function Tw(X){return s1(X)?X.value:X}function Nw(X){let $={};for(let Z in X)if(Object.prototype.hasOwnProperty.call(X,Z))$[Z]=Q7(X[Z]);return $}function kw(X){return Q7(X)}function wX(X){let $=typeof X==="function",Z=$?X:X.get,Y=$?void 0:X.set,J=$?Object.is:X.equals||Object.is,G,Q=!0,w=new Set,W=new Set,q=()=>{if(Q=!0,W.size>0){let z=K.value;W.forEach((j)=>j(z))}};function U(){w.clear();let z=H1;H1=q,l8.push(q);try{return Z()}finally{l8.pop(),H1=z}}let K={get value(){if(H1){let z=QX.get(K);if(!z)z=new Set,QX.set(K,z);z.add(H1)}if(Q){let z=U();if(!J(G,z))G=z;Q=!1}return G},set value(z){if(Y)Y(z);else console.warn("Computed property is readonly")},subscribe(z){return W.add(z),()=>W.delete(z)},peek(){if(Q)G=Z(),Q=!1;return G},invalidate(){Q=!0},get dirty(){return Q},get deps(){return w}};return K}function Iw(X,$,Z={}){let{immediate:Y=!1,deep:J=!1,flush:G="pre",once:Q=!1}=Z,w,W=!0,q=!1,U=()=>{if(s1(X))return J?F5(X.value):X.value;return X()},K=()=>{if(!W||q)return;let B=U();if(w!==void 0&&Object.is(w,B)&&!J)return;let _=()=>{if($(B,w),w=J?F5(B):B,Q)j()};if(G==="sync")_();else if(G==="post")queueMicrotask(_);else Promise.resolve().then(_)},z=null;if(s1(X))z=X.subscribe(()=>K());else z=wX(X).subscribe(()=>K());if(Y)w=void 0,K();else w=U();let j=()=>{if(W=!1,z)z(),z=null};return j.pause=()=>{q=!0},j.resume=()=>{q=!1},j}function Ew(X,$,Z={}){let{immediate:Y=!1,once:J=!1}=Z,G=X.map((K)=>s1(K)?K.value:void 0),Q=!0,w=!1,W=()=>{if(!Q||w)return;let K=X.map((z)=>s1(z)?z.value:void 0);if($(K,G),G=[...K],J)U()},q=X.map((K)=>{if(s1(K))return K.subscribe(()=>W());return()=>{}});if(Y)W();let U=()=>{Q=!1,q.forEach((K)=>K())};return U.pause=()=>{w=!0},U.resume=()=>{w=!1},U}function Dw(X,$={}){let{flush:Z="pre"}=$,Y,J=!0,G=!1,Q=()=>{if(!J||G)return;if(Y)Y();let W=H1;H1=Q,l8.push(Q);try{Y=X()}finally{l8.pop(),H1=W}};if(Z==="sync")Q();else if(Z==="post")queueMicrotask(Q);else Promise.resolve().then(Q);let w=()=>{if(J=!1,Y)Y()};return w.pause=()=>{G=!0},w.resume=()=>{G=!1},w}function yw(X,$={},Z){let Y=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return X.replace(Y,(J,G,Q)=>{try{let W=Function(...Object.keys($),`return ${Q}`)(...Object.values($));return $[G]=W,`<!-- computed: ${G} = ${W} -->`}catch(w){return`<!-- computed error: ${G} - ${w} -->`}})}function bw(X,$={},Z){let Y=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return X.replace(Y,(J,G,Q)=>{return`
|
|
14263
14263
|
<script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
|
|
14264
14264
|
(function() {
|
|
14265
14265
|
// Watch implementation for ${G}
|
|
@@ -14271,9 +14271,9 @@ else {
|
|
|
14271
14271
|
}
|
|
14272
14272
|
})();
|
|
14273
14273
|
</script>
|
|
14274
|
-
`})}function
|
|
14274
|
+
`})}function F5(X){if(X===null||typeof X!=="object")return X;if(Array.isArray(X))return X.map((Z)=>F5(Z));if(X instanceof Date)return new Date(X.getTime());if(X instanceof Map){let Z=new Map;return X.forEach((Y,J)=>Z.set(F5(J),F5(Y))),Z}if(X instanceof Set){let Z=new Set;return X.forEach((Y)=>Z.add(F5(Y))),Z}let $={};for(let Z in X)if(Object.prototype.hasOwnProperty.call(X,Z))$[Z]=F5(X[Z]);return $}function Sw(X,$=100){let Z=Q7(X()),Y=null,J=()=>{if(Y)clearTimeout(Y);Y=setTimeout(()=>{Z.value=X()},$)};return wX(X).subscribe(()=>J()),{get value(){return Z.value},set value(Q){console.warn("Debounced computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){J()},get dirty(){return!1},get deps(){return new Set}}}function Cw(X,$=100){let Z=Q7(X()),Y=0,J=()=>{let Q=Date.now();if(Q-Y>=$)Y=Q,Z.value=X()};return wX(X).subscribe(()=>J()),{get value(){return Z.value},set value(Q){console.warn("Throttled computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){J()},get dirty(){return!1},get deps(){return new Set}}}var H1=null,l8,QX,tL;var vw=E(()=>{l8=[],QX=new WeakMap;tL={ref:Q7,computed:wX,watch:Iw,watchMultiple:Ew,watchEffect:Dw,isRef:s1,unref:Tw,toRefs:Nw,shallowRef:kw,debouncedComputed:Sw,throttledComputed:Cw,processComputedDirectives:yw,processWatchDirectives:bw}});function WX(X,$){let Z={};for(let Y of X)Z[Y]=n1($(Y));return new Proxy({},{get:(Y,J)=>Z[J]?.(),set:(Y,J,G)=>{if(Z[J])Z[J].set(G);else Z[J]=n1(G);return!0},has:(Y,J)=>(J in Z),deleteProperty:(Y,J)=>{return delete Z[J],!0},ownKeys:()=>Reflect.ownKeys(Z),getOwnPropertyDescriptor:(Y,J)=>(J in Z)?{enumerable:!0,configurable:!0,writable:!0,value:Z[J]()}:void 0})}function eL(X,$){let Z={};for(let Y of $)Z[Y]=X[Y];return Z}function y3(X,$){let Z=Object.keys(X),Y=WX(Z,(L)=>$?.[L]??X[L].getDefaultValue()),J=WX(Z,()=>[]),G=WX(Z,()=>!1),Q=WX(Z,()=>!1),w=WX(Z,()=>!1),W=n1(!1);async function q(L){w[L]=!0;let F=await X[L].validate(Y[L],Y);return J[L]=F,w[L]=!1,F.length===0}async function U(){W.set(!0);let L=await Promise.all(Z.map(q));return W.set(!1),L.every(Boolean)}function K(){for(let L of Z)Y[L]=$?.[L]??X[L].getDefaultValue(),J[L]=[],G[L]=!1,Q[L]=!1}function z(L){for(let F of Z)if(F in L)Y[F]=L[F],Q[F]=!0}function j(L,F){Y[L]=F,Q[L]=!0}function B(L,F=!0){if(G[L]=F,F)q(L)}function _(L){return{value:Y[L],errors:J[L],touched:G[L],dirty:Q[L],valid:J[L].length===0,validating:w[L]}}function H(L){return async(F)=>{F?.preventDefault?.();for(let A of Z)G[A]=!0;if(await U())await L(eL(Y,Z))}}return{values:Y,errors:J,touched:G,dirty:Q,get isValid(){return Z.every((L)=>J[L].length===0)},get isValidating(){return W()||Z.some((L)=>w[L])},get isDirty(){return Z.some((L)=>Q[L])},validate:U,validateField:q,reset:K,setValues:z,setFieldValue:j,setFieldTouched:B,getFieldState:_,handleSubmit:H}}var xw;var fw=E(()=>{D8();xw=y3});var dw={};a(dw,{v:()=>XO,useForm:()=>y3,processHasErrorsDirective:()=>uw,processFormValidationDirectives:()=>$O,processErrorsDirective:()=>hw,processErrorDirective:()=>gw,defineForm:()=>xw,Validator:()=>w7});class w7{rules=[];defaultValue="";addRule(X){let $=new w7;return $.rules=[...this.rules,X],$.defaultValue=this.defaultValue,$}required(X="This field is required"){return this.addRule({name:"required",message:X,validate:($)=>{if($===null||$===void 0)return X;if(typeof $==="string"&&$.trim()==="")return X;if(Array.isArray($)&&$.length===0)return X;return!0}})}email(X="Please enter a valid email"){return this.addRule({name:"email",message:X,validate:($)=>{if(!$)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($))||X}})}url(X="Please enter a valid URL"){return this.addRule({name:"url",message:X,validate:($)=>{if(!$)return!0;try{return new URL(String($)),!0}catch{return X}}})}min(X,$){let Z=$||`Must be at least ${X} characters`;return this.addRule({name:"min",message:Z,validate:(Y)=>{if(!Y)return!0;return String(Y).length>=X||Z}})}max(X,$){let Z=$||`Must be no more than ${X} characters`;return this.addRule({name:"max",message:Z,validate:(Y)=>{if(!Y)return!0;return String(Y).length<=X||Z}})}length(X,$,Z){let Y=Z||`Must be between ${X} and ${$} characters`;return this.addRule({name:"length",message:Y,validate:(J)=>{if(!J)return!0;let G=String(J).length;return G>=X&&G<=$||Y}})}pattern(X,$="Invalid format"){return this.addRule({name:"pattern",message:$,validate:(Z)=>{if(!Z)return!0;return X.test(String(Z))||$}})}hasUppercase(X="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,X)}hasLowercase(X="Must contain a lowercase letter"){return this.pattern(/[a-z]/,X)}hasNumber(X="Must contain a number"){return this.pattern(/\d/,X)}hasSpecial(X="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,X)}alphanumeric(X="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,X)}startsWithLetter(X="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,X)}noSpaces(X="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:X,validate:($)=>{if(!$)return!0;return!String($).includes(" ")||X}})}number(X="Must be a number"){let $=this.addRule({name:"number",message:X,validate:(Z)=>{if(!Z&&Z!==0)return!0;return!Number.isNaN(Number(Z))||X}});return $.defaultValue=0,$}integer(X="Must be a whole number"){return this.addRule({name:"integer",message:X,validate:($)=>{if(!$&&$!==0)return!0;return Number.isInteger(Number($))||X}})}positive(X="Must be a positive number"){return this.addRule({name:"positive",message:X,validate:($)=>{if(!$&&$!==0)return!0;return Number($)>0||X}})}negative(X="Must be a negative number"){return this.addRule({name:"negative",message:X,validate:($)=>{if(!$&&$!==0)return!0;return Number($)<0||X}})}minValue(X,$){let Z=$||`Must be at least ${X}`;return this.addRule({name:"minValue",message:Z,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)>=X||Z}})}maxValue(X,$){let Z=$||`Must be no more than ${X}`;return this.addRule({name:"maxValue",message:Z,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)<=X||Z}})}between(X,$,Z){let Y=Z||`Must be between ${X} and ${$}`;return this.addRule({name:"between",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;let G=Number(J);return G>=X&&G<=$||Y}})}matches(X,$){let Z=$||`Must match ${X}`;return this.addRule({name:"matches",message:Z,validate:(Y,J)=>{if(!J)return!0;return Y===J[X]||Z}})}oneOf(X,$){let Z=$||`Must be one of: ${X.join(", ")}`;return this.addRule({name:"oneOf",message:Z,validate:(Y)=>{if(!Y)return!0;return X.includes(Y)||Z}})}notOneOf(X,$){let Z=$||`Cannot be one of: ${X.join(", ")}`;return this.addRule({name:"notOneOf",message:Z,validate:(Y)=>{if(!Y)return!0;return!X.includes(Y)||Z}})}date(X="Must be a valid date"){return this.addRule({name:"date",message:X,validate:($)=>{if(!$)return!0;let Z=new Date(String($));return!Number.isNaN(Z.getTime())||X}})}before(X,$){let Z=new Date(X),Y=$||`Must be before ${Z.toLocaleDateString()}`;return this.addRule({name:"before",message:Y,validate:(J)=>{if(!J)return!0;return new Date(String(J))<Z||Y}})}after(X,$){let Z=new Date(X),Y=$||`Must be after ${Z.toLocaleDateString()}`;return this.addRule({name:"after",message:Y,validate:(J)=>{if(!J)return!0;return new Date(String(J))>Z||Y}})}custom(X,$="Invalid value"){return this.addRule({name:"custom",message:$,validate:X})}async(X,$="Invalid value"){return this.addRule({name:"async",message:$,async:!0,validate:X})}when(X,$){let Z=new w7;Z.rules=[...this.rules],Z.defaultValue=this.defaultValue;for(let Y of $.getRules())Z.rules.push({...Y,validate:(J,G)=>{if(!X(J,G||{}))return!0;return Y.validate(J,G)}});return Z}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(X){let $=new w7;return $.rules=[...this.rules],$.defaultValue=X,$}async validate(X,$){let Z=[];for(let Y of this.rules){let J=await Y.validate(X,$);if(J!==!0)Z.push(J)}return Z}validateSync(X,$){let Z=[];for(let Y of this.rules){if(Y.async)continue;let J=Y.validate(X,$);if(J!==!0)Z.push(J)}return Z}}function gw(X,$,Z){let Y=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return X.replace(Y,(J,G,Q)=>{try{let w=G.trim().split("."),W=$;for(let U of w)if(W&&typeof W==="object"&&U in W)W=W[U];else return"";let q=W;if(!q||!Array.isArray(q)||q.length===0)return"";return q.map((U)=>{return Q.replace(/\{\{\s*message\s*\}\}/g,U)}).join(`
|
|
14275
14275
|
`)}catch{return""}})}function hw(X,$,Z){let Y=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return X.replace(Y,(J,G,Q)=>{try{let w=G.trim().split("."),W=$;for(let U of w)if(W&&typeof W==="object"&&U in W)W=W[U];else return"";let q=W;if(!q||!Array.isArray(q)||q.length===0)return"";return q.map((U)=>Q.replace(/\{\{\s*message\s*\}\}/g,U)).join(`
|
|
14276
|
-
`)}catch{return""}})}function uw(X,$,Z){let Y=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return X.replace(Y,(J,G,Q)=>{try{let w=G.trim().split("."),W=$;for(let U of w)if(W&&typeof W==="object"&&U in W)W=W[U];else return"";let q=W;if(!q||!Array.isArray(q)||q.length===0)return"";return Q}catch{return""}})}function $O(X,$,Z){let Y=X;return Y=gw(Y,$,Z),Y=hw(Y,$,Z),Y=uw(Y,$,Z),Y}var XO;var mw=E(()=>{fw();XO=new
|
|
14276
|
+
`)}catch{return""}})}function uw(X,$,Z){let Y=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return X.replace(Y,(J,G,Q)=>{try{let w=G.trim().split("."),W=$;for(let U of w)if(W&&typeof W==="object"&&U in W)W=W[U];else return"";let q=W;if(!q||!Array.isArray(q)||q.length===0)return"";return Q}catch{return""}})}function $O(X,$,Z){let Y=X;return Y=gw(Y,$,Z),Y=hw(Y,$,Z),Y=uw(Y,$,Z),Y}var XO;var mw=E(()=>{fw();XO=new w7});var pw={};a(pw,{processXElementDirectives:()=>ZO,hasXElementDirectives:()=>cw,generateXElementRuntime:()=>lw});function lw(){return`<script data-stx-scoped data-stx-x-element-runtime data-stx-run="always">
|
|
14277
14277
|
(function() {
|
|
14278
14278
|
'use strict';
|
|
14279
14279
|
|
|
@@ -14559,7 +14559,7 @@ else {
|
|
|
14559
14559
|
})();
|
|
14560
14560
|
</script>`}function cw(X){return/\bx-data(?:\s|=)/.test(X)}function ZO(X){let $=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,Z=X.match($)||[],Y=Z.length>0?X.replace($,""):X;if(!cw(Y))return Y;let J=Z[0]?.trim()||lw(),G=Y.lastIndexOf("</body>");if(G!==-1)return Y.slice(0,G)+J+`
|
|
14561
14561
|
`+Y.slice(G);return Y+`
|
|
14562
|
-
`+J}var iw={};
|
|
14562
|
+
`+J}var iw={};a(iw,{rewriteImagesWithSiblings:()=>GO});import D1 from"path";async function GO(X,$){let Z=$.formats??JO;if(!$.publicDir)return X;let Y=WO(X),J=[],G=/<img\b[^>]*?>/gi,Q=[],w;while((w=G.exec(X))!==null){let K=w[0],z=K.match(/\bsrc=["']([^"']+)["']/i);if(!z)continue;if(qO(w.index,Y))continue;Q.push({idx:w.index,length:K.length,src:z[1],raw:K})}if(Q.length===0)return X;let W=await Promise.all(Q.map(async(K)=>{let z=await QO(K.src,$.publicDir,Z);return{match:K,sources:z}}));for(let{match:K,sources:z}of W){if(z.length===0)continue;let B=`<picture>${z.map((_)=>`<source type="${_.mime}" srcset="${UO(_.url)}">`).join("")}${K.raw}</picture>`;J.push({start:K.idx,end:K.idx+K.length,replacement:B})}if(J.length===0)return X;let q="",U=0;for(let K of J)q+=X.slice(U,K.start),q+=K.replacement,U=K.end;return q+=X.slice(U),q}async function QO(X,$,Z){if(!wO(X))return[];let Y=D1.extname(X).toLowerCase();if(!YO.has(Y))return[];if(!X.startsWith("/"))return[];let J=D1.join($,X.slice(1)),G=D1.dirname(J),Q=D1.basename(J,Y),w=D1.resolve(G),W=D1.resolve($);if(!w.startsWith(W))return[];let q=D1.posix.dirname(X),U=Z.map(async(z)=>{let j=D1.join(G,`${Q}${z.ext}`);if(!await Bun.file(j).exists())return null;return{url:D1.posix.join(q,`${Q}${z.ext}`),mime:z.mime}});return(await Promise.all(U)).filter((z)=>z!==null)}function wO(X){if(!X)return!1;if(X.startsWith("http://")||X.startsWith("https://"))return!1;if(X.startsWith("//"))return!1;if(X.startsWith("data:"))return!1;return!0}function WO(X){let $=[],Z=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,Y;while((Y=Z.exec(X))!==null)$.push([Y.index,Y.index+Y[0].length]);return $}function qO(X,$){for(let[Z,Y]of $)if(X>=Z&&X<Y)return!0;return!1}function UO(X){return X.replace(/&/g,"&").replace(/"/g,""")}var YO,JO;var nw=E(()=>{YO=new Set([".jpg",".jpeg",".png",".gif"]),JO=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var rw=()=>{};function b3(X){return X.pwa?.serviceWorker?.fileName||"sw.js"}var sw=E(()=>{rw()});var ow={};a(ow,{injectPwaTags:()=>KO,generateThemeColorMeta:()=>jO,generateSwRegistrationScript:()=>zO,generatePwaTags:()=>c8,generateManifestLink:()=>BO});function c8(X){let $=X.pwa;if(!$?.enabled)return"";let Z=$.manifest,Y=$.icons?.outputDir?`/${$.icons.outputDir}`:"/pwa-icons",J=b3(X),G=`
|
|
14563
14563
|
<!-- stx PWA Meta Tags -->
|
|
14564
14564
|
<link rel="manifest" href="/manifest.json">
|
|
14565
14565
|
<meta name="theme-color" content="${S3(Z?.themeColor||"#000000")}">
|
|
@@ -14617,46 +14617,46 @@ if ('serviceWorker' in navigator) {
|
|
|
14617
14617
|
});
|
|
14618
14618
|
});
|
|
14619
14619
|
}
|
|
14620
|
-
</script>`}function BO(){return'<link rel="manifest" href="/manifest.json">'}function jO(X){return`<meta name="theme-color" content="${S3(X)}">`}function S3(X){return X.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var aw=E(()=>{sw()});import _O from"fs";import
|
|
14620
|
+
</script>`}function BO(){return'<link rel="manifest" href="/manifest.json">'}function jO(X){return`<meta name="theme-color" content="${S3(X)}">`}function S3(X){return X.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var aw=E(()=>{sw()});import _O from"fs";import b0 from"path";function tw(X){return X.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function HO(X,$){let Z=X.length,Y=$,J=!0,G=[],Q=(w)=>w+9<=Z&&X[w]==="<"&&X[w+1]==="/"&&(X[w+2]==="s"||X[w+2]==="S")&&(X[w+3]==="c"||X[w+3]==="C")&&(X[w+4]==="r"||X[w+4]==="R")&&(X[w+5]==="i"||X[w+5]==="I")&&(X[w+6]==="p"||X[w+6]==="P")&&(X[w+7]==="t"||X[w+7]==="T")&&(X[w+8]===">"||/\s/.test(X[w+8]));while(Y<Z){let w=X[Y];if(Q(Y))return Y;if(w==="/"&&X[Y+1]==="/"){if(Y=X.indexOf(`
|
|
14621
14621
|
`,Y+2),Y===-1)return-1;Y+=1,J=!0;continue}if(w==="/"&&X[Y+1]==="*"){let W=X.indexOf("*/",Y+2);if(W===-1)return-1;Y=W+2,J=!0;continue}if(w==="/"&&J){let W=Y+1,q=!1;while(W<Z){let U=X[W];if(U==="\\"){W+=2;continue}if(U==="[")q=!0;else if(U==="]")q=!1;else if(U==="/"&&!q){W++;break}else if(U===`
|
|
14622
14622
|
`){W=-1;break}W++}if(W===-1){Y++,J=!1;continue}while(W<Z&&/[a-z]/.test(X[W]))W++;Y=W,J=!1;continue}if(w==="'"||w==='"'){let W=w;Y++;while(Y<Z){if(X[Y]==="\\"){Y+=2;continue}if(X[Y]===W){Y++;break}if(X[Y]===`
|
|
14623
|
-
`)break;Y++}J=!1;continue}if(w==="`"){Y++;while(Y<Z){if(X[Y]==="\\"){Y+=2;continue}if(X[Y]==="`"){Y++;break}if(X[Y]==="$"&&X[Y+1]==="{"){G.push(!0),Y+=2,J=!0;break}Y++}if(G.length===0)J=!1;continue}if(w==="}"&&G.length>0){G.pop(),Y++;while(Y<Z){if(X[Y]==="\\"){Y+=2;continue}if(X[Y]==="`"){Y++,J=!1;break}if(X[Y]==="$"&&X[Y+1]==="{"){G.push(!0),Y+=2,J=!0;break}Y++}continue}if(/\s/.test(w));else if(/[)\].\w$]/.test(w))J=!1;else J=!0;Y++}return-1}function
|
|
14623
|
+
`)break;Y++}J=!1;continue}if(w==="`"){Y++;while(Y<Z){if(X[Y]==="\\"){Y+=2;continue}if(X[Y]==="`"){Y++;break}if(X[Y]==="$"&&X[Y+1]==="{"){G.push(!0),Y+=2,J=!0;break}Y++}if(G.length===0)J=!1;continue}if(w==="}"&&G.length>0){G.pop(),Y++;while(Y<Z){if(X[Y]==="\\"){Y+=2;continue}if(X[Y]==="`"){Y++,J=!1;break}if(X[Y]==="$"&&X[Y+1]==="{"){G.push(!0),Y+=2,J=!0;break}Y++}continue}if(/\s/.test(w));else if(/[)\].\w$]/.test(w))J=!1;else J=!0;Y++}return-1}function W7(X,$){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=new RegExp(`<script\\b(?=[^>]*\\b${Z}(?:\\s|=|/?>))[^>]*>`,"i").exec(X);if(!Y)return null;let J=Y.index+Y[0].length,G=X.indexOf("</script>",J);if(G===-1)return null;let Q=X.indexOf(">",G);if(Q===-1)return null;return{start:Y.index,end:Q+1}}function ew(X){let $=0;while($<X.length){let Z=X.indexOf("<",$);if(Z===-1)return-1;if(X.startsWith("<!--",Z)){let G=X.indexOf("-->",Z+4);$=G===-1?X.length:G+3;continue}let Y=X.slice(Z),J=/^<style\b[^>]*>/i.exec(Y);if(J){let G=X.toLowerCase().indexOf("</style>",Z+J[0].length);$=G===-1?X.length:G+8;continue}if(/^<script\b[^>]*>/i.test(Y))return Z;$=Z+1}return-1}function LO(X){let $=W7(X,"data-stx-runtime");if(!$)return X;let Z=ew(X);if(Z===-1||Z===$.start)return X;let Y=X.slice($.start,$.end),J=X.slice(0,$.start)+X.slice($.end),G=ew(J);if(G===-1)return Y+`
|
|
14624
14624
|
`+J;return J.slice(0,G)+Y+`
|
|
14625
|
-
`+J.slice(G)}async function
|
|
14625
|
+
`+J.slice(G)}async function T0(X,$,Z,Y,J){if(Y.ssr===!1&&!Y.autoShell&&Y.buildMode==="spa")return X;if($.__stx_signals_gate===void 0)$.__stx_signals_gate=R1(X);let G=!$.__stxProcessingDepth;if(G)ZZ($);if(!$.__stxProcessingDepth)$.__stxProcessingDepth=0;if($.__stxProcessingDepth++,!$.__onceStore)$.__onceStore=new Set;if((Y.debug||!m7()&&!lX())&&Z&&Z.endsWith(".stx"))o9(X,Z);try{return await kZ.timeAsync("template-processing",async()=>{let Q=await OO(X,$,Z,Y,J);if(G)Q=F3(Q);if(G&&Y.autoShell&&Y.buildMode!=="compile"){let w=Y.app?.head||{},q=($.__stx_runtime_head||null)??v9(),U=($.__stx_head_raw||"").trim(),K,z=U.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(z)K=z[1].trim(),U=U.replace(z[0],"").trim();let j=$.__sections?.title,B=q.title||K||j,_=!q.title&&(!!K||!!j),H=q.meta||[],O=new Set(H.map((M)=>X7(M)).filter(Boolean)),L={...w,...B&&{title:B},meta:[...(w.meta||[]).filter((M)=>!O.has(X7(M))),...H],link:[...w.link||[],...q.link||[]],script:[...w.script||[],...q.script||[]],headRaw:[w.headRaw,U].filter(Boolean).join(`
|
|
14626
14626
|
`),...q.htmlAttrs&&{htmlAttrs:uG(w.htmlAttrs,q.htmlAttrs)},...q.bodyAttrs&&{bodyAttrs:{...w.bodyAttrs||{},...q.bodyAttrs}}},F=r4(Q);if(Q=cG(Q,L,{..._&&{titleIsHtml:!0},...Y.app?.colorMode&&{colorMode:Y.app.colorMode}}),F)Q=lG(Q,w),Q=dG(Q,L.htmlAttrs);let V=Q.match(/<!-- stx-layout: ([^ ]+) -->/);if(V&&Q.includes("<head")){let M=V[1],T=k7(M);Q=Q.replace(/<head\b[^>]*>/i,(k)=>`${k}
|
|
14627
14627
|
<meta name="stx-layout" content="${tw(M)}">
|
|
14628
|
-
<meta name="stx-layout-group" content="${tw(T)}">`)}let A=Q.match(/function (__stx_setup_\d+_\d+)\(/),R=A?d7(Q):null;if(A&&R&&!/\bdata-stx=/.test(R.tag)){Q=uX(Q,(T,k)=>`<body${k} data-stx="${A[1]}">`);let M=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${A[1]}"`,"i");Q=Q.replace(M,"$1")}}if(G){Q=mG(Q);let w=Y.app?.colorMode;if(w)Q=vG(Q,w);Q=fG(Q),Q=LO(Q)}if(G)try{let{getStoreScript:w}=await
|
|
14629
|
-
`+U+Q.slice(K.end)}}catch{}if(G)try{let{getFrameworkComposableScript:w}=await
|
|
14630
|
-
`+W+Q.slice(q.end)}}catch{}if(G)try{let{getComposableScript:w}=await
|
|
14631
|
-
`+U+Q.slice(K.end)}}catch{}if(G)Q=xG(Q);if(G&&$.__stx_inject_css!==!1)Q=await O9(Q,void 0,Y.buildMode==="serve");if(G)Q=PG(Q);return Q=Q.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),Q})}catch(Q){if(Q instanceof nX)throw Q;let w=Q instanceof Error?Q.message:String(Q),W=new
|
|
14628
|
+
<meta name="stx-layout-group" content="${tw(T)}">`)}let A=Q.match(/function (__stx_setup_\d+_\d+)\(/),R=A?d7(Q):null;if(A&&R&&!/\bdata-stx=/.test(R.tag)){Q=uX(Q,(T,k)=>`<body${k} data-stx="${A[1]}">`);let M=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${A[1]}"`,"i");Q=Q.replace(M,"$1")}}if(G){Q=mG(Q);let w=Y.app?.colorMode;if(w)Q=vG(Q,w);Q=fG(Q),Q=LO(Q)}if(G)try{let{getStoreScript:w}=await X0("stx/store-loader",()=>Promise.resolve().then(() => (bQ(),yQ))),W=Y.storesDir,q=await w(W);if(q){let U=`<script data-stx-stores>${q}</script>`,K=W7(Q,"data-stx-runtime");if(K)Q=Q.slice(0,K.end)+`
|
|
14629
|
+
`+U+Q.slice(K.end)}}catch{}if(G)try{let{getFrameworkComposableScript:w}=await X0("stx/framework-composables",()=>Promise.resolve().then(() => (xQ(),vQ))),W=await w(Q);if(W){let q=W7(Q,"data-stx-stores")||W7(Q,"data-stx-runtime");if(q)Q=Q.slice(0,q.end)+`
|
|
14630
|
+
`+W+Q.slice(q.end)}}catch{}if(G)try{let{getComposableScript:w}=await X0("stx/composable-loader",()=>Promise.resolve().then(() => (hQ(),gQ))),W=Y.composablesDir,q=await w(W,Q);if(q){let U=`<script data-stx-composables>${q}</script>`,K=W7(Q,"data-stx-stores")||W7(Q,"data-stx-runtime");if(K)Q=Q.slice(0,K.end)+`
|
|
14631
|
+
`+U+Q.slice(K.end)}}catch{}if(G)Q=xG(Q);if(G&&$.__stx_inject_css!==!1)Q=await O9(Q,void 0,Y.buildMode==="serve");if(G)Q=PG(Q);return Q=Q.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),Q})}catch(Q){if(Q instanceof nX)throw Q;let w=Q instanceof Error?Q.message:String(Q),W=new q5(`Template processing failed: ${w}`,Z,void 0,void 0,X.substring(0,200)+(X.length>200?"...":""));if(G1.log(W,{filePath:Z,context:$}),D9.logDetailedError(W,{filePath:Z,template:X.substring(0,500)}),Y.debug)throw W;return I9.createFallbackContent("Template Processing",W)}}async function OO(X,$,Z,Y,J){let G=process.cwd(),Q={...Y,partialsDir:Y.partialsDir&&!b0.isAbsolute(Y.partialsDir)?b0.resolve(G,Y.partialsDir):Y.partialsDir,componentsDir:Y.componentsDir&&!b0.isAbsolute(Y.componentsDir)?b0.resolve(G,Y.componentsDir):Y.componentsDir,layoutsDir:Y.layoutsDir&&!b0.isAbsolute(Y.layoutsDir)?b0.resolve(G,Y.layoutsDir):Y.layoutsDir},w=Q,W=X;await AO(Z,$),VO($,w),W=await u5(()=>GG(W,$,Z,w),W,(F)=>{G1.log(F,{filePath:Z,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Z}: ${F.message}`)}),W=W.replace(/\{\{--[\s\S]*?--\}\}/g,"");let q=w1(W,f7,(F,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);W=q.output;let U=q.tokens,K=(F)=>U.length===0?F:F.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(V,A)=>U[Number(A)]??""),z="\x00STX_ESCAPED_AT\x00";W=W.replace(/@@/g,z),W=W.replace(/@\{\{([\s\S]*?)\}\}/g,(F,V)=>{return`{{ ${V} }}`}),W=MG(W),W=await NQ(W,Z,J);let j={};W=v4(W,j);let B={...$.__sections||{}},_="",H=XY(eZ(X)),O=/@nolayout\b/.test(W)||H===!1;if(/@nolayout\b/.test(W))W=W.replace(/@nolayout\b\s*/g,"");let L=W.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(L)_=L[1],W=W.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof H==="string"){if(_=H,!/@section\s*\(/.test(W))W=`@section('content')
|
|
14632
14632
|
${W.trim()}
|
|
14633
|
-
@endsection`}if(!_&&!O&&w.defaultLayout){let F=n4(W),V=/@section\s*\(/.test(W);if(!F||V){let A="",R=
|
|
14633
|
+
@endsection`}if(!_&&!O&&w.defaultLayout){let F=n4(W),V=/@section\s*\(/.test(W);if(!F||V){let A="",R=b0.dirname(Z),M=w.layoutsDir?b0.dirname(w.layoutsDir):process.cwd();for(let T=0;T<20;T++){let k=b0.join(R,"_layout.stx");if(await r(k)){A=k;break}let I=b0.dirname(R);if(I===R||I.length<M.length)break;R=I}if(A)_=A;else if(w.layoutsDir){let T=b0.isAbsolute(w.layoutsDir)?w.layoutsDir:b0.resolve(process.cwd(),w.layoutsDir),k=b0.join(T,`${w.defaultLayout}.stx`);if(await r(k))_=k}if(_&&!V)W=`@section('content')
|
|
14634
14634
|
${W.trim()}
|
|
14635
|
-
@endsection`}}if(W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(F,V,A)=>{return B[V]=A,""}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(F,V,A)=>{if(/^(['"]).*\1$/.test(A.trim()))return F;try{let R=Q0(A.trim(),$);if(R===void 0)return F;return B[V]=String(R??""),""}catch{return F}}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(F,V,A)=>{if(A.includes("@parent"))B[V]=A.replace("@parent",
|
|
14635
|
+
@endsection`}}if(W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(F,V,A)=>{return B[V]=A,""}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(F,V,A)=>{if(/^(['"]).*\1$/.test(A.trim()))return F;try{let R=Q0(A.trim(),$);if(R===void 0)return F;return B[V]=String(R??""),""}catch{return F}}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(F,V,A)=>{if(A.includes("@parent"))B[V]=A.replace("@parent",V5);else B[V]=A.trim();return""}),$.__sections=B,W=W.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(F,V,A)=>{return B[V]||A||""}),!("slot"in $)||$.slot===void 0)W=W.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(W=x4(W,j),_){let F=[],V=W1(W),A=w1(V.output,P5,(R,M)=>`\x00STX_ORPHAN_STYLE_${M}\x00`);if(W=A.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(R,M,T)=>{let k=M==="SCRIPT"?V.scripts[Number(T)]:A.tokens[Number(T)];if(k)F.push(k);return""}),F.length>0){let R=F.join(`
|
|
14636
14636
|
`);B.content=B.content?`${B.content}
|
|
14637
|
-
${R}`:R,$.__sections=B}}if(_)try{let F;if(
|
|
14638
|
-
${W}`,K(W)}catch(F){return G1.log(F instanceof Error?F:Error(String(F)),{layoutPath:_,filePath:Z},"error"),`[Error processing layout: ${F instanceof Error?F.message:String(F)}]`}return K(await XW(W,$,Z,Q,J))}function FO(X,$){return X.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Z,Y,J)=>{let G=$[Y];if(G!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(G))return G}return J||""})}function VO(X,$){if(X.__stx_sfc_mode=!0,X.__stx_options=$,$.buildMode)X.__stx_buildMode=$.buildMode;let Z=$.envPrefix||"STX_PUBLIC_",Y={};for(let[J,G]of Object.entries(process.env))if(J.startsWith(Z)&&G!==void 0)Y[J]=G;X.$env=Y}async function AO(X,$){await
|
|
14639
|
-
`;if(G=k(G,$),G=I(G,$),G=WG(G),G=b9(G,$),G=kY(G),G=YG(G),G=await P4(G,$,Z,Q,J),G=await B8(G,$,Z,Q,J),$.__stxProcessingDepth===1)G=JZ(G,$);if(G=G.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),G=F3(G),G=N1(G,$,Z),G=S9(G,$),G=C9(G,$),G=$8(G,$),G=gY(G,$),G=hY(G,$),G=await GY(G,$,Z,Q),G=await $W(G,$,Z),G=await cY(G,$,Z,Q),G=c6(G,$,Z,Q),G=KG(G,$,Z,Q),G=zG(G,$,Z),G=BG(G,$,Z,Q),G=MY(G,$,Z,Q),G=L3(G,$),G=O3(G),G=IQ(G),!Q.skipEventDirectives)G=f2(G,$,Z);if(G=YY(G,$,Z),Q.debug){let
|
|
14637
|
+
${R}`:R,$.__sections=B}}if(_)try{let F;if(b0.isAbsolute(_))F=_,J.add(_);else F=await u5(()=>C3(_,Z,Q,J),null,()=>{throw new q5(`Failed to resolve layout path: ${_}`,Z,void 0,void 0,`Layout referenced from ${Z}`)});if(!F){let k=(N)=>{if(!N)return[];try{let S=b0.isAbsolute(N)?N:b0.resolve(process.cwd(),N);return _O.readdirSync(S).filter((b)=>b.endsWith(".stx")).map((b)=>b.replace(/\.stx$/,""))}catch{return[]}},I=[...k(Q.layoutsDir),...k(Q.fallbackLayoutsDir)].filter((N,S,b)=>b.indexOf(N)===S).sort(),D=`Layout not found: ${_} (referenced from ${Z})`+(I.length>0?`. Available layouts: ${I.join(", ")}`:Q.layoutsDir?`. No .stx layouts found in ${Q.layoutsDir}`:"");if(G1.log(Error(D),{layoutPath:_,filePath:Z,available:I},"error"),console.error(`[stx] ${D}`),Q.debug)throw new q5(D,Z);return W}let V=await u5(()=>Bun.file(F).text(),"",()=>{throw new q5(`Failed to read layout file: ${F}`,Z,void 0,void 0,"Layout content could not be loaded")}),A=V.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(A){if(Q.debug)console.log(`Found nested layout: ${A[1]} in ${F}`);let k={},I=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(S,b,y)=>{return k[b]=y.trim(),""});for(let[S,b]of Object.entries(k))if(B[S]&&B[S].includes(V5)){let y=B[S].indexOf(V5);B[S]=B[S].slice(0,y)+b+B[S].slice(y+V5.length)}else if(!B[S])B[S]=b;let D={...$,__sections:B},N=`@layout('${A[1]}')${I}`;return await T0(N,D,F,Q,J)}let R=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),M=v4(R,j),T={};return M=M.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(k,I,D)=>{return T[I]=D.trim(),`@slot('${I}')`}),M=M.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(k,I,D)=>{if(B[I]){let N=B[I];if(N.includes(V5)){let S=T[I]||"",b=N.indexOf(V5);N=N.slice(0,b)+S+N.slice(b+V5.length)}return N}return D||""}),M=FO(M,B),M=M.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),M=x4(M,j),$.__originalFilePath=Z,W=await XW(M,$,F,Q,J),W=`<!-- stx-layout: ${_} -->
|
|
14638
|
+
${W}`,K(W)}catch(F){return G1.log(F instanceof Error?F:Error(String(F)),{layoutPath:_,filePath:Z},"error"),`[Error processing layout: ${F instanceof Error?F.message:String(F)}]`}return K(await XW(W,$,Z,Q,J))}function FO(X,$){return X.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Z,Y,J)=>{let G=$[Y];if(G!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(G))return G}return J||""})}function VO(X,$){if(X.__stx_sfc_mode=!0,X.__stx_options=$,$.buildMode)X.__stx_buildMode=$.buildMode;let Z=$.envPrefix||"STX_PUBLIC_",Y={};for(let[J,G]of Object.entries(process.env))if(J.startsWith(Z)&&G!==void 0)Y[J]=G;X.$env=Y}async function AO(X,$){await u5(()=>LG(X,$),void 0,(Z)=>{G1.log(Z,{filePath:X,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${X}: ${Z.message}`)})}async function RO(X,$,Z){let Y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,J;while((J=Y.exec(X))!==null){let G=J[1],Q=J[2];if(!/\bserver\b/.test(G)||!Q.trim())continue;try{let{extractVariables:W}=await X0("stx/variable-extractor",()=>Promise.resolve().then(() => (a5(),j8)));await W(Q,$,Z,{preserveExisting:!0})}catch(W){let q=W instanceof Error?W:Error(String(W));G1.log(q,{filePath:Z,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Z}: ${q.message}`)}}}async function MO(X,$,Z){try{let{interpolateScriptsInTemplate:Y}=await X0("stx/expressions",()=>Promise.resolve().then(() => (U1(),MZ)));return Y(X,$,{skipServer:!0})}catch(Y){let J=Y instanceof Error?Y:Error(String(Y));return G1.log(J,{filePath:Z,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Z}: ${J.message}`),X}}async function XW(X,$,Z,Y,J){let G=X,Q=Y;if(await RO(G,$,Z),G=await MO(G,$,Z),G=await eJ(G,$,Z),G=await XG(G,$,Z),G=await EY(G,$,Z,Q),R1(G))G=B3(G,$),G=_3(G,$);G=j3(G);let{processStreamDirectives:w}=await X0("stx/streaming",()=>Promise.resolve().then(() => (s9(),r9)));G=w(G,$),G=b4(G,$,Z,Q),G=await EG(G,$,Z,Q,J),G=await B8(G,$,Z,Q,J),G=a6(G,$,Z,Q);let{processDeferDirectives:W}=await X0("stx/defer",()=>Promise.resolve().then(() => dQ));G=W(G,$,Z);let{processTeleportDirectives:q}=await X0("stx/teleport",()=>Promise.resolve().then(() => lQ));G=q(G,$,Z);let{processTransitionDirectives:U,processTransitionAttributes:K}=await X0("stx/transitions",()=>Promise.resolve().then(() => nQ));G=U(G,$,Z),G=K(G);let{processErrorBoundaryDirectives:z}=await X0("stx/error-boundaries",()=>Promise.resolve().then(() => sQ));G=z(G,$,Z);let{processSuspenseDirectives:j}=await X0("stx/suspense",()=>Promise.resolve().then(() => oQ));G=j(G,$,Z);let{processAsyncDirectives:B}=await X0("stx/async-components",()=>Promise.resolve().then(() => Xw));G=B(G,$,Z);let{processKeepAliveDirectives:_}=await X0("stx/keep-alive",()=>Promise.resolve().then(() => Zw));G=_(G,$,Z);let{processVirtualListDirectives:H,processVirtualGridDirectives:O,processInfiniteListDirectives:L}=await X0("stx/virtual-scrolling",()=>Promise.resolve().then(() => (Ww(),ww)));G=H(G,$,Z),G=O(G,$,Z),G=L(G,$,Z);let{processPartialHydrationDirectives:F,processStaticDirectives:V}=await X0("stx/partial-hydration",()=>Promise.resolve().then(() => (Mw(),Rw)));G=F(G,$,Z),G=V(G);let{processComputedDirectives:A,processWatchDirectives:R}=await X0("stx/computed",()=>Promise.resolve().then(() => (vw(),Pw)));G=A(G,$,Z),G=R(G,$,Z);let{processFormValidationDirectives:M}=await X0("stx/forms-validation",()=>Promise.resolve().then(() => (mw(),dw)));G=M(G,$,Z);let{processHeadDirective:T,processTitleDirective:k,processMetaDirective:I,resetHead:D}=await X0("stx/head",()=>Promise.resolve().then(() => (d5(),f9)));if(!$.__stx_head_preset&&!$.__stx_runtime_head)D();let N=T(G);if(G=N.content,N.headContent)$.__stx_head_raw=`${$.__stx_head_raw||""}${N.headContent}
|
|
14639
|
+
`;if(G=k(G,$),G=I(G,$),G=WG(G),G=b9(G,$),G=kY(G),G=YG(G),G=await P4(G,$,Z,Q,J),G=await B8(G,$,Z,Q,J),$.__stxProcessingDepth===1)G=JZ(G,$);if(G=G.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),G=F3(G),G=N1(G,$,Z),G=S9(G,$),G=C9(G,$),G=$8(G,$),G=gY(G,$),G=hY(G,$),G=await GY(G,$,Z,Q),G=await $W(G,$,Z),G=await cY(G,$,Z,Q),G=c6(G,$,Z,Q),G=KG(G,$,Z,Q),G=zG(G,$,Z),G=BG(G,$,Z,Q),G=MY(G,$,Z,Q),G=L3(G,$),G=O3(G),G=IQ(G),!Q.skipEventDirectives)G=f2(G,$,Z);if(G=YY(G,$,Z),Q.debug){let n=/\bx-data\s*=/.test(G),Y0=f8(X);if(n&&Y0)console.warn(`[stx] ${Z}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
14640
14640
|
Both work on the same page, but they manage separate scopes.
|
|
14641
|
-
Prefer signals (state/derived/effect) for new components.`)}G=VG(G,$),G=await
|
|
14642
|
-
</head>`);if(/<head\b[^>]*>/i.test(
|
|
14643
|
-
${
|
|
14641
|
+
Prefer signals (state/derived/effect) for new components.`)}G=VG(G,$),G=await f1(G,$,Z),G=EQ(G),G=DQ(G),G=sZ(G);let{processXElementDirectives:S}=await X0("stx/x-element",()=>Promise.resolve().then(() => pw));G=S(G);let b=$.__originalFilePath||Z,y=J5($);if(G=await H3(G,Q,b,y),G=CY(G,$),G=await QG(G,$,Z,Q),Q.media?.image?.autoSiblings){let n=Q.publicDir||"public",{rewriteImagesWithSiblings:Y0}=await X0("stx/image-optimization/auto-sibling",()=>Promise.resolve().then(() => (nw(),iw)));G=await Y0(G,{publicDir:n})}if(Q.seo?.enabled)G=jG(G,$,Q);let P=(n,Y0,q0=!0)=>{if(!Y0)return n;let h0=Y0.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),I0=n.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(h0&&I0){if(q0)n=n.replace(I0[0],h0[0]);if(Y0=Y0.replace(h0[0],"").trim(),!Y0)return n}if(/<\/head>/i.test(n))return n.replace(/<\/head>/i,`${Y0}
|
|
14642
|
+
</head>`);if(/<head\b[^>]*>/i.test(n))return n.replace(/(<head\b[^>]*>)/i,`$1
|
|
14643
|
+
${Y0}`);if(/<html\b[^>]*>/i.test(n))return n.replace(/(<html\b[^>]*>)/i,`$1
|
|
14644
14644
|
<head>
|
|
14645
|
-
${
|
|
14646
|
-
</head>`);return
|
|
14645
|
+
${Y0}
|
|
14646
|
+
</head>`);return n},{renderHead:f,getHead:g}=await X0("stx/head",()=>Promise.resolve().then(() => (d5(),f9))),c=$.__stx_runtime_head??g();if(c.title||c.meta?.length||c.link?.length){let n=f(c);if(n)G=P(G,n)}if(N.headContent)G=P(G,N.headContent,!c.title);if(Q.csp?.enabled&&Q.csp.addMetaTag)G=AY(G,Q.csp,$);if(Q.analytics?.enabled)G=aZ(G,Q);if(Q.heatmap?.enabled)G=R2(G,Q);if(Q.pwa?.enabled&&Q.pwa.autoInject!==!1){let{injectPwaTags:n}=await X0("stx/pwa/inject",()=>Promise.resolve().then(() => (aw(),ow)));G=n(G,Q)}let k0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(G),f0=/\bSTX\.\w+/.test(G),g0=/window\.STX\s*=/.test(G);if(k0&&f0&&!g0){let Y0=`<script data-stx-scoped data-stx-run="once">
|
|
14647
14647
|
${pZ()}
|
|
14648
|
-
</script>`;if(G.includes("</head>")){let
|
|
14649
|
-
`+
|
|
14648
|
+
</script>`;if(G.includes("</head>")){let q0=G.indexOf("</head>"),I0=G.slice(0,q0).indexOf("<script");if(I0!==-1){let s0=G.slice(0,I0),C=G.slice(I0);G=s0+Y0+`
|
|
14649
|
+
`+C}else G=G.replace("</head>",`${Y0}
|
|
14650
14650
|
</head>`)}else if(G.includes("<body"))G=G.replace(/<body([^>]*)>/,`<body$1>
|
|
14651
|
-
${
|
|
14652
|
-
`+G}{let{scanScriptTags:
|
|
14653
|
-
`+G.slice(
|
|
14654
|
-
`)J++;return!0}if(X[J]==="/"&&X[J+1]==="*"){J+=2;while(J<G-1&&!(X[J]==="*"&&X[J+1]==="/"))J++;return J+=2,!0}return!1},q=()=>{if(Y!==0)return;let U=X.slice(J).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let B=U[2].split(",").map((_)=>{let H=_.trim().split(":");return H[H.length-1].trim()});for(let _ of B)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!Z.has(_))$.push(_),Z.add(_);return}let K=X.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(K){let B=K[2];if(!Z.has(B))$.push(B),Z.add(B);return}let z=X.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let B=z[1];if(!Z.has(B))$.push(B),Z.add(B);return}let j=X.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!Z.has(B))$.push(B),Z.add(B)}};while(J<G){if(W())continue;if(X[J]==="'"||X[J]==='"'){Q(X[J]);continue}if(X[J]==="`"){w();continue}if(X[J]==="{"){Y++,J++;continue}if(X[J]==="}"){Y--,J++;continue}if(Y===0&&/[a-z]/i.test(X[J])&&(J===0||/\s|[;{}()]/.test(X[J-1])))q();J++}return $}function gO(X){let $=[],Z=0,Y=0,J=null;for(let G=0;G<X.length;G++){let Q=X[G];if(J){if(Q==="\\"){G++;continue}if(Q===J)J=null;continue}if(Q==='"'||Q==="'"||Q==="`"){J=Q;continue}if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q===","&&Z===0)$.push(X.slice(Y,G)),Y=G+1}if(Y<X.length)$.push(X.slice(Y));return $}function hO(X){let $=0,Z=null;for(let Y=0;Y<X.length;Y++){let J=X[Y];if(Z){if(J==="\\"){Y++;continue}if(J===Z)Z=null;continue}if(J==='"'||J==="'"||J==="`"){Z=J;continue}if(J==="("||J==="["||J==="{")$++;else if(J===")"||J==="]"||J==="}")$--;else if(J==="="&&$===0){let G=X[Y-1],Q=X[Y+1];if(G==="!"||G==="<"||G===">"||G==="=")continue;if(Q==="="||Q===">")continue;return Y}}return-1}function uO(X,$){try{let Z=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(X);if(!Z)return;let Y=Z.index-1;while(Y>=0&&/\s/.test(X[Y]))Y--;if(X[Y]!=="}")return;let J=Y,G=0,Q=-1;for(;Y>=0;Y--){let W=X[Y];if(W==="}")G++;else if(W==="{"){if(G--,G===0){Q=Y;break}}}if(Q===-1)return;let w=X.slice(Q+1,J);for(let W of gO(w)){let q=W.trim();if(!q||q.startsWith("..."))continue;let U=hO(q);if(U===-1)continue;let K=q.slice(0,U).trim();if(!/^[A-Z_$][\w$]*$/i.test(K))continue;if($[K]!==void 0)continue;let z=q.slice(U+1).trim();if(!z)continue;try{let j=Object.keys($),B=Function(...j,`"use strict"; return (${z});`);$[K]=B(...j.map((_)=>$[_]))}catch{}}}catch{}}async function K8(X,$,Z,Y,J){let G=X.endsWith(".stx")?X.slice(0,-4):X,Q=(H)=>H.split("-").map((O)=>O.charAt(0).toUpperCase()+O.slice(1)).join(""),w=(H)=>H.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),W=Z.__importedComponents;if(W){for(let H of[G,G.toLowerCase(),Q(G),w(G)])if(W.has(H))return!0}let q=[...new Set([`${G}.stx`,`${Q(G)}.stx`,`${w(G)}.stx`])],U=typeof J.root==="string"?h.resolve(J.root):void 0,K=U??h.dirname(Y),z=[],j=(H)=>{if(H&&!z.includes(H))z.push(H)},B=Z.__originalFilePath;if(B)j(h.join(h.dirname(B),"components"));j($),j(J._rootComponentsDir),j(h.join(h.dirname(Y),"components")),j(J.componentsDir);let _=J._pluginComponentDirs;if(Array.isArray(_))for(let H of _)j(typeof H==="string"?H:null);if(U)j(h.resolve(U,"resources/views/components")),j(h.resolve(U,"resources/components")),j(h.resolve(U,"src/components")),j(h.resolve(U,"components"));if(G.startsWith("./")||G.startsWith("../"))return
|
|
14651
|
+
${Y0}`);else G=Y0+`
|
|
14652
|
+
`+G}{let{scanScriptTags:n}=await X0("stx/signal-processing",()=>Promise.resolve().then(() => (YX(),g8))),Y0=[];for(let q0 of n(G)){if(!/\bserver\b/i.test(q0.attrs))continue;let h0=q0.start+q0.fullMatch.indexOf(">")+1,I0=HO(G,h0);if(I0===-1)continue;let s0=I0+9;while(s0<G.length&&/\s/.test(G[s0]))s0++;Y0.push({start:q0.start,end:s0})}for(let q0=Y0.length-1;q0>=0;q0--){let{start:h0,end:I0}=Y0[q0];G=G.substring(0,h0)+G.substring(I0)}}let $1=F8(G,Z);if($1.hasScoped)G=$1.html;let $0=$.__stx_event_bindings||[],O0=!1,z0=[],t1=/\s:[a-z][\w.-]*\s*=/.test(G),{scanScriptTags:z7}=await X0("stx/signal-processing",()=>Promise.resolve().then(() => (YX(),g8)));for(let n of z7(G,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))z0.push({match:n.fullMatch,attrs:n.attrs,content:n.body});for(let{match:n,attrs:Y0,content:q0}of z0){O0=!0;let h0=q0;A3(q0,Z,Y.strict,$.__originalFilePath);let I0=await G5(q0,{eventBindings:$0,attrs:Y0,hasColonDirectives:t1,templateContent:X,filePath:Z,projectRoot:process.cwd(),production:Y.buildMode==="compile",serverData:y});G=G.replace(n,()=>I0)}if(O0)$.__stx_event_bindings=[];if(!O0&&$.__stxProcessingDepth===1){let n=$.__stx_event_bindings||[];if(n.length>0){let Y0=a$(n);if(Y0){let q0=G.lastIndexOf("</body>");G=q0===-1?G+Y0:G.slice(0,q0)+Y0+`
|
|
14653
|
+
`+G.slice(q0)}$.__stx_event_bindings=[]}}if(!UQ(G)&&KQ(G))G=await S8(G,Q);if(G=zQ(G),Q.csp?.enabled&&Q.csp.useNonce&&typeof $.cspNonce==="string")G=RY(G,$.cspNonce);return G}var V5="<!--PARENT_CONTENT_PLACEHOLDER-->";var J8=E(()=>{F9();A9();x1();I$();iZ();oZ();tZ();n$();E$();t$();C5();JY();QY();p7();TY();IY();yY();PY();T1();d5();U1();uY();pY();tJ();ZG();S4();P3();wG();g5();qG();g4();H0();OG();AG();TG();DG();m4();p4();pG();YX();k4();kQ();V3();R3();M0();a9();Q9();E7();C8();C8();V3();R3()});var ZW=()=>{};var v3={};a(v3,{renderSlot:()=>JW,processSlots:()=>QW,parseSlots:()=>YW,parseSlotElement:()=>EO,extractSlotContent:()=>bO,applySlots:()=>SO});function TO(X,$){let Z=1,Y=$,J="<template",G="</template";while(Y<X.length&&Z>0){let Q=X.indexOf("<",Y);if(Q===-1)break;if(Y=Q,X.startsWith(J,Y)&&(Y+J.length>=X.length||/[\s>\/]/.test(X[Y+J.length]))){Z++,Y+=J.length;continue}if(X.startsWith(G,Y)){let w=X.indexOf(">",Y+G.length);if(w!==-1){if(Z--,Z===0)return w+1;Y=w+1;continue}}Y++}return Z===0?Y:-1}function kO(X,$){let Z=null;for(let Y=$;Y<X.length;Y++){let J=X[Y];if(Z){if(J==="\\"){Y++;continue}if(J===Z)Z=null;continue}if(J==='"'||J==="'"){Z=J;continue}if(J===">")return Y+1}return-1}function IO(X){let $=[],Z=[],Y=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,J=0;while(J<X.length){let G=X.indexOf("<",J);if(G===-1)break;if(X.startsWith("<!--",G)){let z=X.indexOf("-->",G+4);J=z===-1?X.length:z+3;continue}let Q=kO(X,G+1);if(Q===-1)break;let w=X.slice(G,Q),W=w.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!W){J=Q;continue}let q=W[1]==="/",U=W[2].toLowerCase();if(q){let z=Z.lastIndexOf(U);if(z!==-1)Z.splice(z);J=Q;continue}if(U==="template"&&Z.length===0){let z=w.match(Y);if(z){let j=TO(X,Q);if(j!==-1){let B=z[1]||z[2]||z[3];$.push({start:G,end:j,slotName:B,content:X.slice(Q,j-11).trim(),propsBinding:z[4]||void 0}),J=j;continue}}}if(!/\/\s*>$/.test(w)&&!NO.has(U)){if(Z.push(U),U==="script"||U==="style"){let z=X.toLowerCase().indexOf(`</${U}>`,Q);if(z!==-1){J=z;continue}}}J=Q}return $}function YW(X){let $={default:"",named:new Map},Z=X,Y=IO(X);for(let W of Y)$.named.set(W.slotName,{name:W.slotName,content:W.content,propsBinding:W.propsBinding});Y.sort((W,q)=>q.start-W.start);for(let W of Y)Z=Z.slice(0,W.start)+Z.slice(W.end);let J=[],G=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,Q;while((Q=G.exec(Z))!==null){let[W,q,U,K,z,j]=Q,B=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(B+_).trim(),O=`<${q}${H?" "+H:""}>${j}</${q}>`;J.push({start:Q.index,end:Q.index+W.length,slotName:K,element:O})}let w=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((Q=w.exec(Z))!==null){let[W,q,U,K,z]=Q,j=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),B=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=(j+B).trim(),H=`<${q}${_?" "+_:""} />`;J.push({start:Q.index,end:Q.index+W.length,slotName:K,element:H})}J.sort((W,q)=>q.start-W.start);for(let W of J){let q=$.named.get(W.slotName);if(q)q.content+=W.element;else $.named.set(W.slotName,{name:W.slotName,content:W.element});Z=Z.slice(0,W.start)+Z.slice(W.end)}return $.default=Z.trim(),$}function EO(X){let $=X.match(/name\s*=\s*["']([^"']+)["']/),Z=$?$[1]:"",Y={},J=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,G;while((G=J.exec(X))!==null)Y[G[1]]=G[2];let Q=X.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),w=Q?Q[1].trim():"";return{name:Z,props:Y,defaultContent:w}}async function JW(X,$,Z,Y){if(!X)return Z;let J=X.content;if(X.propsBinding&&Object.keys($).length>0){let G=X.propsBinding.trim(),Q={...Y};if(G.startsWith("{")&&G.endsWith("}")){let w=G.slice(1,-1).split(",").map((W)=>W.trim()).filter(Boolean);for(let W of w){let[q,U]=W.split(":").map((z)=>z.trim()),K=U||q;if($[q]!==void 0)Q[K]=$[q]}}else Q[G]=$;J=DO(J,Q)}return J}function DO(X,$){return X.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Z,Y)=>{try{let J=Y.trim(),G=GW(J,$);return q1(String(G??""))}catch{return`{{ ${Y} }}`}})}function GW(X,$){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(X)){let Y=X.split("."),J=$;for(let G of Y)if(J&&typeof J==="object"&&G in J)J=J[G];else return;return J}let Z=X.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Z){let[,Y,J,G]=Z,Q=$[Y],w=parseInt(G,10);if(typeof Q==="number")switch(J){case"+":return Q+w;case"-":return Q-w;case"*":return Q*w;case"/":return Q/w}}try{if(!U0(X))return;return K0(X,Object.keys($))(...Object.values($))}catch{return}}async function QW(X,$,Z){let Y=X;Y=await yO(Y,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(Q,w,W,q)=>{let U=$.named.get(w),K=q?.trim()||"",z=W||"",j={},B=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,_;while((_=B.exec(z))!==null){let H=_[1],O=_[2];j[H]=GW(O,Z)}return await JW(U,j,K,Z)});let G=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return Y=Y.replace(G,(Q,w)=>{if(Q.includes("name="))return Q;let W=w?.trim()||"";return $.default||W}),Y}async function yO(X,$,Z){let Y=[],J=[];X.replace($,(w,...W)=>{let q=W[W.length-2];return J.push({match:w,index:q}),Y.push(Z(w,...W.slice(0,-2))),w});let G=await Promise.all(Y),Q=X;for(let w=J.length-1;w>=0;w--){let{match:W,index:q}=J[w];Q=Q.slice(0,q)+G[w]+Q.slice(q+W.length)}return Q}function bO(X){let $=YW(X);return{defaultSlot:$.default,namedSlots:$.named}}async function SO(X,$,Z,Y){return await QW(X,{default:$,named:Z},Y)}var NO;var x3=E(()=>{U1();M0();NO=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});import CO from"fs";import h from"path";function vO(X){let $=new WeakSet;try{let Z=(Y)=>{if(Y===void 0)return{__stxType:"undefined"};if(typeof Y==="bigint")return{__stxType:"bigint",value:Y.toString()};if(typeof Y==="function"||typeof Y==="symbol")throw TypeError("Non-serializable component input");if(Y===null||typeof Y!=="object")return Y;if($.has(Y))throw TypeError("Circular component input");if($.add(Y),Y instanceof Date)return{__stxType:"date",value:Y.toISOString()};if(Array.isArray(Y))return Y.map(Z);let J={};for(let G of Object.keys(Y).sort())J[G]=Z(Y[G]);return J};return JSON.stringify(Z(X))}catch{return null}}function wW(X){return X.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function xO(X){return/\bjs\b/.test(X)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(X)}function Q5(X){return!xO(X)}function B1(X){let $;try{$=JSON.stringify(X)}catch{return new Bun.Transpiler(X)}let Z=p8.get($);if(Z)return Z;if(p8.size>=16)p8.clear();let Y=new Bun.Transpiler(X);return p8.set($,Y),Y}function w5(X){try{let $=X.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");$=$.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Z=[];$=$.replace(/\{!![\s\S]*?!!\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`}),$=$.replace(/\{\{\{[\s\S]*?\}\}\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`}),$=$.replace(/\{\{[\s\S]*?\}\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`});let J=B1({loader:"ts",target:"browser",define:P0()}).transformSync($);for(let G=0;G<Z.length;G++)J=J.replace(`"__STX_EXPR_${G}__"`,Z[G]),J=J.replace(`'__STX_EXPR_${G}__'`,Z[G]);return J}catch($){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",$);return X}}function fO(X){let $=[],Z=new Set,Y=0,J=0,G=X.length,Q=(U)=>{J++;while(J<G){if(X[J]==="\\"){J+=2;continue}if(X[J]===U){J++;return}J++}},w=()=>{J++;while(J<G){if(X[J]==="\\"){J+=2;continue}if(X[J]==="`"){J++;return}if(X[J]==="$"&&X[J+1]==="{"){J+=2;let U=1;while(J<G&&U>0)if(X[J]==="{")U++,J++;else if(X[J]==="}")U--,J++;else if(X[J]==="'"||X[J]==='"')Q(X[J]);else if(X[J]==="`")w();else J++;continue}J++}},W=()=>{if(X[J]==="/"&&X[J+1]==="/"){while(J<G&&X[J]!==`
|
|
14654
|
+
`)J++;return!0}if(X[J]==="/"&&X[J+1]==="*"){J+=2;while(J<G-1&&!(X[J]==="*"&&X[J+1]==="/"))J++;return J+=2,!0}return!1},q=()=>{if(Y!==0)return;let U=X.slice(J).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let B=U[2].split(",").map((_)=>{let H=_.trim().split(":");return H[H.length-1].trim()});for(let _ of B)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!Z.has(_))$.push(_),Z.add(_);return}let K=X.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(K){let B=K[2];if(!Z.has(B))$.push(B),Z.add(B);return}let z=X.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let B=z[1];if(!Z.has(B))$.push(B),Z.add(B);return}let j=X.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!Z.has(B))$.push(B),Z.add(B)}};while(J<G){if(W())continue;if(X[J]==="'"||X[J]==='"'){Q(X[J]);continue}if(X[J]==="`"){w();continue}if(X[J]==="{"){Y++,J++;continue}if(X[J]==="}"){Y--,J++;continue}if(Y===0&&/[a-z]/i.test(X[J])&&(J===0||/\s|[;{}()]/.test(X[J-1])))q();J++}return $}function gO(X){let $=[],Z=0,Y=0,J=null;for(let G=0;G<X.length;G++){let Q=X[G];if(J){if(Q==="\\"){G++;continue}if(Q===J)J=null;continue}if(Q==='"'||Q==="'"||Q==="`"){J=Q;continue}if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q===","&&Z===0)$.push(X.slice(Y,G)),Y=G+1}if(Y<X.length)$.push(X.slice(Y));return $}function hO(X){let $=0,Z=null;for(let Y=0;Y<X.length;Y++){let J=X[Y];if(Z){if(J==="\\"){Y++;continue}if(J===Z)Z=null;continue}if(J==='"'||J==="'"||J==="`"){Z=J;continue}if(J==="("||J==="["||J==="{")$++;else if(J===")"||J==="]"||J==="}")$--;else if(J==="="&&$===0){let G=X[Y-1],Q=X[Y+1];if(G==="!"||G==="<"||G===">"||G==="=")continue;if(Q==="="||Q===">")continue;return Y}}return-1}function uO(X,$){try{let Z=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(X);if(!Z)return;let Y=Z.index-1;while(Y>=0&&/\s/.test(X[Y]))Y--;if(X[Y]!=="}")return;let J=Y,G=0,Q=-1;for(;Y>=0;Y--){let W=X[Y];if(W==="}")G++;else if(W==="{"){if(G--,G===0){Q=Y;break}}}if(Q===-1)return;let w=X.slice(Q+1,J);for(let W of gO(w)){let q=W.trim();if(!q||q.startsWith("..."))continue;let U=hO(q);if(U===-1)continue;let K=q.slice(0,U).trim();if(!/^[A-Z_$][\w$]*$/i.test(K))continue;if($[K]!==void 0)continue;let z=q.slice(U+1).trim();if(!z)continue;try{let j=Object.keys($),B=Function(...j,`"use strict"; return (${z});`);$[K]=B(...j.map((_)=>$[_]))}catch{}}}catch{}}async function K8(X,$,Z,Y,J){let G=X.endsWith(".stx")?X.slice(0,-4):X,Q=(H)=>H.split("-").map((O)=>O.charAt(0).toUpperCase()+O.slice(1)).join(""),w=(H)=>H.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),W=Z.__importedComponents;if(W){for(let H of[G,G.toLowerCase(),Q(G),w(G)])if(W.has(H))return!0}let q=[...new Set([`${G}.stx`,`${Q(G)}.stx`,`${w(G)}.stx`])],U=typeof J.root==="string"?h.resolve(J.root):void 0,K=U??h.dirname(Y),z=[],j=(H)=>{if(H&&!z.includes(H))z.push(H)},B=Z.__originalFilePath;if(B)j(h.join(h.dirname(B),"components"));j($),j(J._rootComponentsDir),j(h.join(h.dirname(Y),"components")),j(J.componentsDir);let _=J._pluginComponentDirs;if(Array.isArray(_))for(let H of _)j(typeof H==="string"?H:null);if(U)j(h.resolve(U,"resources/views/components")),j(h.resolve(U,"resources/components")),j(h.resolve(U,"src/components")),j(h.resolve(U,"components"));if(G.startsWith("./")||G.startsWith("../"))return r(h.resolve(h.dirname(Y),`${G}.stx`));for(let H of z){let O=h.isAbsolute(H)?H:h.resolve(K,H);for(let L of q)if(await r(h.join(O,L)))return!0}return!1}function dO(X){return X==="visible"||X==="idle"||X==="interaction"||X.startsWith("media:")}function mO(X){if(!X)return!1;let $=X.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test($)}function lO(X){let $=new Set,Z=/\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 Y of X){let J;while((J=Z.exec(Y))!==null)$.add(J[1]);Z.lastIndex=0}return[...$]}async function _5(X,$,Z,Y,J,G,Q,w=new Set,W){let{extractVariables:q}=await X0("stx/variable-extractor",()=>Promise.resolve().then(() => (a5(),j8))),U=w??new Set;if(U.has(X))return`[Circular component reference: ${X}]`;let K=new Set(U);K.add(X);let z=typeof $.client==="string"?$.client.trim():"";if("client"in $)delete $.client;let j=z&&z!=="load"&&dO(z)?z:"";try{let B=(v)=>v.split("-").map((u)=>u.charAt(0).toUpperCase()+u.slice(1)).join(""),_=(v)=>v.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),H=X.endsWith(".stx")?X.slice(0,-4):X,O=null,L=J.__importedComponents;if(L){let v=[H,H.toLowerCase(),B(H),_(H)];for(let u of v)if(L.has(u)){O=L.get(u);break}}let F=[];if(!O){let v=[`${H}.stx`,`${B(H)}.stx`,`${_(H)}.stx`],u=[...new Set(v)],t=J.__originalFilePath,e=[];if(t){let W0=h.join(h.dirname(t),"components");e.push(W0)}if(Y)e.push(Y);let F0=Q._rootComponentsDir;if(typeof F0==="string"&&!e.includes(F0))e.push(F0);let E0=h.join(h.dirname(G),"components");if(!e.includes(E0))e.push(E0);if(Q.componentsDir&&Q.componentsDir!==Y&&!e.includes(Q.componentsDir))e.push(Q.componentsDir);let y1=Q._pluginComponentDirs;if(Array.isArray(y1)){for(let W0 of y1)if(typeof W0==="string"&&!e.includes(W0))e.push(W0)}let l0=typeof Q.root==="string"?h.resolve(Q.root):void 0,C0=l0??h.dirname(G),o0=[];if(l0)o0.push(h.resolve(l0,"resources/views/components")),o0.push(h.resolve(l0,"resources/components")),o0.push(h.resolve(l0,"src/components")),o0.push(h.resolve(l0,"components"));o0.push(h.resolve(import.meta.dir,"components"));for(let W0 of o0)if(!e.includes(W0))e.push(W0);let B7=[...new Set(e.map((W0)=>{if(!W0)return W0;return h.isAbsolute(W0)?W0:h.resolve(C0,W0)}))];e.length=0,e.push(...B7);let b1=`${H}\x00${G}\x00${B7.join("\x00")}`,o=n8.get(b1);if(o)if(await r(o))O=o;else n8.delete(b1);if(!O&&(H.startsWith("./")||H.startsWith("../")))O=h.resolve(h.dirname(G),`${H}.stx`),F.push(O);else if(!O)for(let W0 of e){if(!W0)continue;for(let S1 of u){let e1=h.join(W0,S1);if(F.push(e1),await r(e1)){O=e1;break}}if(O)break;if(!O)try{let S1=await import("fs");if(!S1.statSync(W0,{throwIfNoEntry:!1})?.isDirectory())continue;let zX=8,M5=[{path:W0,depth:0}];while(M5.length>0&&!O){let L1=M5.pop();if(L1.depth>=zX)continue;let BX;try{BX=S1.readdirSync(L1.path,{withFileTypes:!0})}catch{continue}for(let jX of BX){if(!jX.isDirectory())continue;if(jX.name==="node_modules"||jX.name.startsWith("."))continue;let V6=h.join(L1.path,jX.name);for(let Tq of u){let R$=h.join(V6,Tq);if(F.push(R$),await r(R$)){O=R$;break}}if(O)break;M5.push({path:V6,depth:L1.depth+1})}}}catch{}if(O)break}if(O)n8.set(b1,O)}if(!O||!await r(O)){let v=F.length>0?`
|
|
14655
14655
|
Searched paths:
|
|
14656
|
-
${F.map((
|
|
14657
|
-
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${X}']${v}`}W.add(O);let V;if(i8.has(O))V=i8.get(O);else try{V=await Bun.file(O).text(),i8.set(O,V)}catch(v){return`[Error loading component: ${v instanceof Error?v.message:String(v)}]`}let A=new Set(["__originalFilePath","__importedComponents",CX,"__stx_client_signal_names","__stxServeContext"]),R={};for(let[v,
|
|
14658
|
-
`)}`}if(Z&&z0.includes("{{ text || slot }}"))z0=z0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Z);let{applySlots:
|
|
14659
|
-
${
|
|
14656
|
+
${F.map((u)=>` - ${u}`).join(`
|
|
14657
|
+
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${X}']${v}`}W.add(O);let V;if(i8.has(O))V=i8.get(O);else try{V=await Bun.file(O).text(),i8.set(O,V)}catch(v){return`[Error loading component: ${v instanceof Error?v.message:String(v)}]`}let A=new Set(["__originalFilePath","__importedComponents",CX,"__stx_client_signal_names","__stxServeContext"]),R={};for(let[v,u]of Object.entries(J))if(!v.startsWith("__")||A.has(v))R[v]=u;let M=W1(Z),T=[],k=M.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(v,u)=>{let t=M.scripts[Number(u)]||"",e=t.match(/^<script\b([^>]*)>/i)?.[1]||"",F0=e.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),E0=!F0||["module","text/javascript","application/javascript"].includes(F0);if(!/\bserver\b/i.test(e)&&E0)return T.push(t),"";return t}),{extractSlotContent:I}=await X0("stx/slots",()=>Promise.resolve().then(() => (x3(),v3))),D=I(k),N={};if(D.defaultSlot?.trim())N.default=D.defaultSlot;for(let[v,u]of D.namedSlots)N[v]=u.content;let S={...R,...$,props:$,slot:k,$slots:N,__processedComponents:K,__sections:{},__stx_signals_gate:R1(V)||mO(Z)};uO(V,S);let b=V,y=l5(b);if(y)b=y.content.trim();let P=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,f=[...V.matchAll(P)],g=[],p=f.some((v)=>/\bserver\b/.test(v[1]||"")&&/\bcache\b/.test(v[1]||""))&&f.every((v)=>/\bserver\b/.test(v[1]||"")),c=null,k0=null;if(p){let v=vO({props:$,slot:Z,buildMode:Q.buildMode??"",skipEventDirectives:Q.skipEventDirectives===!0});if(v!==null){c=`${O}\x00${v}`;let u=f3.get(c);if(u){for(let t of u.dependencies)W.add(t);return u.output}k0=new Set(W)}}for(let v of f){let u=v[1]||"",t=v[2]||"",e=u.includes("server");if(Q5(u)&&t.trim())t=w5(t);if(e&&t)try{await q(t,S,O)}catch(E0){}if(!e){let E0=t.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),y1=E0.includes("{{")&&E0.includes("}}"),l0=E0.includes("{!!")&&E0.includes("!!}");if(y1||l0)E0=gX(E0,S);let C0=u.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");g.push(`<script${C0}>${E0}</script>`)}}let f0=V.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),g0=f0?f0[1]:"",$1=f0?f0[2]:"",$0="",O0=g0&&/\bscoped\b/i.test(g0);if(f0)$0=`<style${g0}>${$1}</style>`;let z0=b;if(z0=z0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),f0)z0=z0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let v=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,u=[];if(z0=z0.replace(v,(t,e)=>{let F0=e.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(F0)u.push(`<style${F0[1]}>${F0[2]}</style>`);return""}),z0=z0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),u.length>0)$0=`${$0}${u.join(`
|
|
14658
|
+
`)}`}if(Z&&z0.includes("{{ text || slot }}"))z0=z0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Z);let{applySlots:t1}=await X0("stx/slots",()=>Promise.resolve().then(() => (x3(),v3))),{defaultSlot:z7,namedSlots:n}=D;z0=await t1(z0,z7,n,S);let Y0=g.some((v)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(v)),q0=lO(g),h0=Array.isArray(S.__stx_client_signal_names)?S.__stx_client_signal_names:[];if(q0.length>0||h0.length>0)S.__stx_client_signal_names=[...new Set([...h0,...q0])];let I0={...Q,_rootComponentsDir:Q._rootComponentsDir||Q.componentsDir,componentsDir:h.dirname(O),skipSignalsRuntime:!0,skipEventDirectives:Y0||g.length===0,defaultLayout:void 0};S.__stxProcessingDepth=(J.__stxProcessingDepth||0)+1;let s0=await T0(z0,S,O,I0,W),C=new Set(Array.isArray(J.__stx_preserved_client_expressions)?J.__stx_preserved_client_expressions:[]);for(let v of s0.matchAll(/\{\{([\s\S]*?)\}\}/g))C.add(v[1].trim());if(C.size>0)J.__stx_preserved_client_expressions=[...C];let x=`stx_${H.replace(/[^a-zA-Z0-9]/g,"_")}_${++PO}_${Math.random().toString(36).slice(2,8)}`,l=s0;if(Y0){let v="";if(Object.keys($).length>0)try{v=` data-stx-props="${wW(JSON.stringify($))}"`}catch{}let u=j?` stx-hydrate="${wW(j)}"`:"";l=`<div data-stx-scope="${x}"${v}${u}>${s0}</div>`;let t=await Promise.all(g.map(async(e)=>{let F0=e.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!F0)return e;let[,E0,y1]=F0,l0=yX(y1,{filePath:O,projectRoot:process.cwd()}),C0=l0.code,o0=bX(l0.styles);C0=S5(C0).code;let{hasUserImports:B7,bundleClientScript:b1}=await X0("stx/client-script-bundler",()=>Promise.resolve().then(() => (P7(),C7)));if(B7(C0))C0=await b1(C0,O,{projectRoot:process.cwd(),minify:Q.buildMode==="compile"});let{rewriteStxImportSpecifiers:o}=await X0("stx/signal-processing",()=>Promise.resolve().then(() => (YX(),g8)));C0=C0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(L1,BX)=>o(BX));let W0=p0(C0),S1=fO(W0),e1=`function(__scopeId) {
|
|
14659
|
+
${D5("const",[...N2,...S1],W0)}
|
|
14660
14660
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
14661
14661
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
14662
14662
|
__scopeVars.$refs = __scopeVars.$refs || {};
|
|
@@ -14670,12 +14670,12 @@ ${F.map((m)=>` - ${m}`).join(`
|
|
|
14670
14670
|
const onDestroy = (fn) => __scopeVars.__destroyCallbacks.push(fn);
|
|
14671
14671
|
|
|
14672
14672
|
try {
|
|
14673
|
-
${
|
|
14673
|
+
${W0}
|
|
14674
14674
|
|
|
14675
14675
|
// Register all defined signals and functions in this scope
|
|
14676
14676
|
const __localVars = {};
|
|
14677
14677
|
try {
|
|
14678
|
-
${
|
|
14678
|
+
${S1.map((L1)=>`if (typeof ${L1} !== 'undefined') __localVars['${L1}'] = ${L1};`).join(`
|
|
14679
14679
|
`)}
|
|
14680
14680
|
}
|
|
14681
14681
|
catch (e) {}
|
|
@@ -14684,17 +14684,17 @@ catch (e) {}
|
|
|
14684
14684
|
finally {
|
|
14685
14685
|
window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
|
|
14686
14686
|
}
|
|
14687
|
-
}`,zX=j?null:YZ(J,
|
|
14688
|
-
`+
|
|
14689
|
-
`)
|
|
14690
|
-
|
|
14691
|
-
|
|
14692
|
-
`+
|
|
14693
|
-
`),S.__stx_event_bindings=[]}}if(
|
|
14687
|
+
}`,zX=j?null:YZ(J,e1),M5=zX?`window.__stxComponentFactories[${JSON.stringify(zX)}](${JSON.stringify(x)});`:`(${e1})(${JSON.stringify(x)});`;if(j)return`${o0}<script type="stx/island" data-stx-island="${x}" data-stx-scoped${E0}>${M5}</script>`;return`${o0}<script data-stx-scoped data-stx-run="always"${E0}>${M5}</script>`}));if(l=l+`
|
|
14688
|
+
`+t.join(`
|
|
14689
|
+
`),$0)l+=`
|
|
14690
|
+
`+$0}else{if($0)l+=`
|
|
14691
|
+
`+$0;if(g.length>0){let v=S.__stx_event_bindings||[],u=J5(S),t=await Promise.all(g.map(async(e)=>{let F0=e.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!F0)return e;return await G5(F0[1],{eventBindings:v,templateContent:l,filePath:O,projectRoot:process.cwd(),serverData:u})}));l+=`
|
|
14692
|
+
`+t.join(`
|
|
14693
|
+
`),S.__stx_event_bindings=[]}}if(O0){let v=F8(l,O);if(v.hasScoped)l=v.html}if(c&&k0)f3.set(c,{output:l,dependencies:[...W].filter((v)=>!k0.has(v))});return T.length>0?`${l}
|
|
14694
14694
|
${T.join(`
|
|
14695
|
-
`)}`:l}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{U.delete(X)}}async function
|
|
14695
|
+
`)}`:l}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{U.delete(X)}}async function r(X){return Bun.file(X).exists()}function g3(X,$){let Z=h.resolve($),Y=h.resolve(X),J=Z.endsWith(h.sep)?Z:Z+h.sep;if(Y===Z||Y.startsWith(J))return Y;return null}async function cO(X,$,Z,Y){let J=$.startsWith("layouts/")?$.slice(8):$,G=h.join(X,J);for(let Q of G.endsWith(".stx")?[G]:[G,`${G}.stx`])if(await r(Q)){if(Y)console.log(`Found layout in ${X}: ${Q}`);return Z?.add(Q),Q}return null}async function C3(X,$,Z,Y){let J=await pO(X,$,Z,Y);if(J===null)return null;let G=g3(J,process.cwd());if(G)return G;let Q=[Z.root,Z.layoutsDir,Z.fallbackLayoutsDir,Z.componentsDir,Z.partialsDir,Z.pagesDir].filter((w)=>typeof w==="string"&&w.length>0);for(let w of Q){let W=h.isAbsolute(w)?w:h.resolve(process.cwd(),w);if(g3(J,W))return h.resolve(J)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${J} (template: ${X}, from: ${$})`),null}async function pO(X,$,Z,Y){if(Z.debug)console.log(`Resolving template path: ${X} from ${$}`);let J=h.dirname($),G=process.cwd();if(X.startsWith("/")){let z=h.join(G,X),j=g3(z,G);if(!j)return console.warn(`[stx] rejected template path that escapes project root: ${X} (from ${$})`),null;if(Z.debug)console.log(`Checking absolute path: ${j}`);if(await r(j)&&Y)Y.add(j);return j}let Q=h.join(J,X);if(await r(Q)){if(Z.debug)console.log(`Found direct path: ${Q}`);if(Y)Y.add(Q);return Q}if(!X.endsWith(".stx")&&!X.endsWith(".jsx")&&!X.endsWith(".tsx"))for(let z of[".stx",".tsx",".jsx"]){let j=`${Q}${z}`;if(await r(j)){if(Z.debug)console.log(`Found direct path with extension: ${j}`);if(Y)Y.add(j);return j}}let w=[];if(Z.layoutsDir)w.push(h.isAbsolute(Z.layoutsDir)?Z.layoutsDir:h.resolve(process.cwd(),Z.layoutsDir));let W=h.resolve(J),q=process.cwd();for(let z=0;z<10;z++){let j=h.join(W,"layouts"),B=!1;try{B=CO.statSync(j,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){w.push(j);break}let _=h.dirname(W);if(_===W||_.length<q.length)break;W=_}for(let z of w){let j=await cO(z,X,Y,Z.debug);if(j)return j}if(Z.fallbackLayoutsDir){let z=h.isAbsolute(Z.fallbackLayoutsDir)?Z.fallbackLayoutsDir:h.resolve(process.cwd(),Z.fallbackLayoutsDir),j=X.startsWith("layouts/")?X.slice(8):X,B=[h.join(z,j)];if(!X.endsWith(".stx"))B.push(`${B[0]}.stx`);for(let _ of B)if(await r(_)){if(Z.debug)console.log(`Found in options.fallbackLayoutsDir: ${_}`);if(Y)Y.add(_);return _}}if(X.startsWith("layouts/")||X.includes("/layouts/")){let z=X.split("layouts/"),j=h.join(Z.partialsDir||J,"layouts",z[1]);if(await r(j)){if(Z.debug)console.log(`Found in layouts path: ${j}`);if(Y)Y.add(j);return j}if(!j.endsWith(".stx")){let B=`${j}.stx`;if(await r(B)){if(Z.debug)console.log(`Found in layouts path with extension: ${B}`);if(Y)Y.add(B);return B}}}if(Z.partialsDir){let z=h.join(Z.partialsDir,"layouts");if(await r(z)){let j=h.join(z,X);if(await r(j)){if(Z.debug)console.log(`Found in partials layouts dir: ${j}`);if(Y)Y.add(j);return j}if(!X.endsWith(".stx")){let B=`${j}.stx`;if(await r(B)){if(Z.debug)console.log(`Found in partials layouts dir with extension: ${B}`);if(Y)Y.add(B);return B}}}}let U=Z.partialsDir||h.join(process.cwd(),"views"),K=h.join(U,X);if(await r(K)){if(Z.debug)console.log(`Found in views path: ${K}`);if(Y)Y.add(K);return K}if(!X.endsWith(".stx")){let z=`${K}.stx`;if(await r(z)){if(Z.debug)console.log(`Found in views path with extension: ${z}`);if(Y)Y.add(z);return z}}if(J.includes("temp")){let z=h.join(h.dirname(J),"layouts",X);if(await r(z)){if(Z.debug)console.log(`Found in temp layouts dir: ${z}`);if(Y)Y.add(z);return z}if(!X.endsWith(".stx")){let j=`${z}.stx`;if(await r(j)){if(Z.debug)console.log(`Found in temp layouts dir with extension: ${j}`);if(Y)Y.add(j);return j}}}if(Z.debug)console.warn(`Template not found after trying all paths: ${X} (referenced from ${$})`);else console.warn(`Template not found: ${X} (referenced from ${$})`);return null}function WW(X,$,Z){let Y=0,J="",G="";try{if(typeof $==="number"&&$>=0){let Q=X.split(`
|
|
14696
14696
|
`),w=0;for(let W=0;W<Q.length;W++)if(w+=Q[W].length+1,w>=$){Y=W+1,J=Q[W].trim();let q=Math.max(0,W-2),U=Math.min(Q.length,W+3);G=Q.slice(q,U).map((K,z)=>{let j=q+z+1;return`${j===Y?"> ":" "}${j}: ${K}`}).join(`
|
|
14697
|
-
`);break}}else if(Z){let Q=X.indexOf(Z);if(Q>=0)return WW(X,Q)}}catch{}return{lineNumber:Y,lineContent:J,context:G}}function
|
|
14697
|
+
`);break}}else if(Z){let Q=X.indexOf(Z);if(Q>=0)return WW(X,Q)}}catch{}return{lineNumber:Y,lineContent:J,context:G}}function B0(X,$,Z,Y,J,G){let{lineNumber:Q,context:w}=WW(Y,J,G),W=Z.split("/").pop(),q=0;if(typeof J==="number"&&J>=0&&Y){let K=Y.lastIndexOf(`
|
|
14698
14698
|
`,Math.max(0,J-1));q=J-(K+1)+1}let U="";if(Q>0)U+=`
|
|
14699
14699
|
${Z}:${Q}${q>0?`:${q}`:""}: ${X.toLowerCase()} error: ${$}
|
|
14700
14700
|
`;if(U+=`
|
|
@@ -14707,8 +14707,8 @@ ${G0.yellow}${G0.bold}Message:${G0.reset} ${$}
|
|
|
14707
14707
|
`,w)U+=`
|
|
14708
14708
|
${G0.blue}${G0.bold}Context:${G0.reset}
|
|
14709
14709
|
${G0.dim}${w}${G0.reset}
|
|
14710
|
-
`;return U}function qQ(){i8.clear(),n8.clear(),f3.clear()}var i8,n8,f3,PO=0,p8,G0;var
|
|
14711
|
-
`||L==="\r"||L===" "||L===void 0)K++;z=H+9}else{if(K--,K===0){j=O;break}z=O+12}}if(j===-1)continue;let B=X.slice(U,j),_=X.slice(w,j+12);J.push({fullMatch:_,options:q,content:B,index:w}),G.lastIndex=j+12}for(let{fullMatch:w,options:W,content:q,index:U}of J)try{let K={};if(W)W.split(",").forEach((B)=>{let _=B.trim();if(_)K[_]=!0});let z={gfm:K.gfm??!0,breaks:K.breaks??!1},j
|
|
14710
|
+
`;return U}function qQ(){i8.clear(),n8.clear(),f3.clear()}var i8,n8,f3,PO=0,p8,G0;var H0=E(()=>{C5();Q9();U1();Z1();g5();J8();P1();m4();Z8();E7();x1();ZW();a5();i8=new W5(500),n8=new W5(1000),f3=new W5(2000);p8=new Map;G0={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 $W(X,$,Z=""){let Y=X,J=[],G=/@markdown(?:\([^)]*\))?/g,Q;while((Q=G.exec(X))!==null){let w=Q.index,W=Q[0].match(/@markdown\(([^)]*)\)/),q=W?W[1]:"",U=w+Q[0].length,K=1,z=U,j=-1;while(K>0&&z<X.length){let H=X.indexOf("@markdown",z),O=X.indexOf("@endmarkdown",z);if(O===-1)break;if(H!==-1&&H<O&&H!==w){let L=X[H+9];if(L==="("||L===`
|
|
14711
|
+
`||L==="\r"||L===" "||L===void 0)K++;z=H+9}else{if(K--,K===0){j=O;break}z=O+12}}if(j===-1)continue;let B=X.slice(U,j),_=X.slice(w,j+12);J.push({fullMatch:_,options:q,content:B,index:w}),G.lastIndex=j+12}for(let{fullMatch:w,options:W,content:q,index:U}of J)try{let K={};if(W)W.split(",").forEach((B)=>{let _=B.trim();if(_)K[_]=!0});let z={gfm:K.gfm??!0,breaks:K.breaks??!1},j=$5(q.trim(),z);Y=Y.split(w).join(j)}catch(K){let z=K instanceof Error?K.message:String(K),j=B0("Markdown Directive",`Error processing markdown: ${z}`,Z,X,U,w);Y=Y.split(w).join(j)}return Y}async function qW(X,$,Z,Y){let J={gfm:!0,breaks:!1};return $.forEach((G)=>{let Q=G.trim().replace(/['"]/g,"");if(Q==="breaks")J.breaks=!0;if(Q==="no-gfm")J.gfm=!1}),$5(X.trim(),J)}var P3=E(()=>{H0()});function rO(X){if(iO.set(X.name,X),X.client)nO.set(X.name,X.client)}function r8(X){return rO(X),{name:X.name,hasEndTag:X.hasEndTag??!0,description:X.description,handler:async(Z,Y,J,G)=>{let Q=sO(Y,X.defaults);if(X.validate){let W=X.validate(Q);if(W!==!0){let q=typeof W==="string"?W:`Invalid parameters for @${X.name}`;throw Error(q)}}let w=Z;if(X.transform)w=await X.transform(Z,Q,J,G);if(X.clientScript){let W=X.clientScript(Q);w+=`<script>${W}</script>`}if(X.css){let W=X.css(Q);w+=`<style>${W}</style>`}return w}}}function sO(X,$){let Z={...$};for(let Y of X){let J=Y.indexOf(":"),G=Y.indexOf("="),Q=J>=0&&(G<0||J<G)?J:G;if(Q>=0){let w=Y.slice(0,Q).trim(),W=Y.slice(Q+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{}Z[w]=W}else{let w=Object.keys(Z).filter((W)=>!$||!(W in $)).length;Z[w===0?"value":`arg${w}`]=Y}}return Z}var iO,nO;var h3=E(()=>{iO=new Map,nO=new Map});function u3(X,$=q7,Z={},Y){return $.sort((J,G)=>J-G).map((J)=>{return`${UX(X,{...Z,w:J,fm:Y})} ${J}w`}).join(", ")}function UW(X,$,Z=oO,Y={},J){return Z.sort((G,Q)=>G-Q).map((G)=>{let Q=Math.round($*G);return`${UX(X,{...Y,w:Q,dpr:G,fm:J})} ${G}x`}).join(", ")}function d3(X,$="100vw"){if(!X||Object.keys(X).length===0)return $;let Y=Object.entries(X).map(([J,G])=>{let Q=/^\d+$/.test(J)?`${J}px`:J;return{bp:Q,size:G,numericBp:Number.parseInt(Q)||0}}).sort((J,G)=>J.numericBp-G.numericBp).map(({bp:J,size:G})=>`(max-width: ${J}) ${G}`);return Y.push($),Y.join(", ")}function UX(X,$={}){let Z=Object.entries($).filter(([,G])=>G!==void 0&&G!==null).map(([G,Q])=>{if(Array.isArray(Q))return[G,Q.join(",")];return[G,String(Q)]});if(Z.length===0)return X;let Y=Z.map(([G,Q])=>`${G}=${encodeURIComponent(Q)}`).join("&"),J=X.includes("?")?"&":"?";return`${X}${J}${Y}`}function m3(X){return aO[X]||"application/octet-stream"}var q7,oO,qX,aO;var l3=E(()=>{q7=[320,480,640,768,1024,1280,1536,1920,2560],oO=[1,1.5,2,3],qX=["avif","webp","jpeg"],aO={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function eO(){try{return await import("ts-images")}catch{return null}}async function XF(X,$={}){let Z={...tO,...$},Y=await eO();if(Y)try{return await $F(X,Z,Y)}catch(J){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${J}`)}return ZF(X,Z)}async function $F(X,$,Z){let{generatePlaceholder:Y,generateThumbHash:J}=Z,Q={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[$.strategy]||"blur";if($.strategy==="thumbhash")return{dataURL:(await J(X)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let w=await Y(X,{width:$.width,height:$.height,quality:$.quality,blurLevel:$.blurLevel,strategy:Q,base64Encode:!0});return{dataURL:w.dataURL,width:w.width,height:w.height,aspectRatio:w.aspectRatio,originalWidth:w.originalWidth,originalHeight:w.originalHeight,strategy:$.strategy,dominantColor:w.dominantColor,css:w.css}}function ZF(X,$){let Z=$.width||20,Y=$.height||Z,J="#e5e7eb",G=`<svg xmlns="http://www.w3.org/2000/svg" width="${Z}" height="${Y}" viewBox="0 0 ${Z} ${Y}"><rect fill="#e5e7eb" width="${Z}" height="${Y}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(G)}`,width:Z,height:Y,aspectRatio:Z/Y,originalWidth:0,originalHeight:0,strategy:$.strategy,dominantColor:"#e5e7eb"}}function KW(X,$,Z={}){let Y=Z.transitionDuration||300,J=Z.easing||"ease-out";return`
|
|
14712
14712
|
#${X} {
|
|
14713
14713
|
--stx-img-transition-duration: ${Y}ms;
|
|
14714
14714
|
--stx-img-transition-easing: ${J};
|
|
@@ -14754,8 +14754,8 @@ ${G0.dim}${w}${G0.reset}
|
|
|
14754
14754
|
filter: blur(0);
|
|
14755
14755
|
transform: scale(1);
|
|
14756
14756
|
}
|
|
14757
|
-
`.trim();c3=new Map});import{createHash as _W}from"crypto";import{readFile as YF,stat as HW}from"fs/promises";async function f0(X){try{let $=await YF(X);return _W("sha256").update($).digest("hex").slice(0,16)}catch{return""}}function jW(X){return _W("sha256").update(X).digest("hex").slice(0,16)}function s8(X,$){let Z=JSON.stringify($,Object.keys($).sort());return`${jW(X)}-${jW(Z)}`}async function i3(X){try{return(await HW(X)).mtimeMs}catch{return 0}}async function C0(X){try{return await HW(X),!0}catch{return!1}}var R5=()=>{};import{mkdir as JF,readFile as GF,writeFile as QF,readdir as Ky,rm as wF,stat as zy}from"fs/promises";import{join as OW,dirname as WF}from"path";async function qF(X){try{await JF(X,{recursive:!0})}catch{}}function FW(X,$,Z){return OW(X,Z,`${$}.json`)}async function LW(X,$,Z){if((Date.now()-X.createdAt)/86400000>Z)return!1;if(await i3($)!==X.srcMtime)return!1;return!0}async function o8(X,$,Z,Y=n3){if(!Y.enabled)return null;let J=s8(X,$),G=K7.get(J);if(G){if(await LW(G,X,Y.maxAge))return G.lastAccessedAt=Date.now(),G.data;K7.delete(J)}let Q=FW(Y.directory,J,Z);if(await C0(Q))try{let w=await GF(Q,"utf-8"),W=JSON.parse(w);if(await LW(W,X,Y.maxAge))return W.lastAccessedAt=Date.now(),K7.set(J,W),W.data}catch{}return null}async function a8(X,$,Z,Y,J=n3){if(!J.enabled)return;let G=s8(X,$),Q=await f0(X),w=await i3(X),W={key:G,src:X,srcHash:Q,srcMtime:w,optionsHash:s8("",$),data:Z,createdAt:Date.now(),lastAccessedAt:Date.now()};K7.set(G,W);let q=FW(J.directory,G,Y);try{await qF(WF(q)),await QF(q,JSON.stringify(W,null,2))}catch(U){console.warn(`[stx-media] Failed to write cache: ${U}`)}}async function t8(X,$=n3){if(X==="all")K7.clear();else K7.clear();let Z=X==="all"?["image","video"]:[X];for(let Y of Z){let J=OW($.directory,Y);try{await wF(J,{recursive:!0,force:!0})}catch{}}}var K7,n3;var r3=E(()=>{R5();K7=new Map,n3={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class X${config;constructor(X={}){this.config={...UF,...X}}async get(X,$){return o8(X,$,"image",this.config)}async set(X,$,Z){return a8(X,$,Z,"image",this.config)}async clear(){return t8("image",this.config)}updateConfig(X){this.config={...this.config,...X}}}function s3(X){if(!e8)e8=new X$(X);else if(X)e8.updateConfig(X);return e8}async function $$(X,$,Z){let Y=Z?{directory:`${Z.outputDir}/../.cache`}:{};return s3(Y).get(X,$)}async function Z$(X,$,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return s3(J).set(X,$,Z)}async function VW(){return s3().clear()}var UF,e8=null;var o3=E(()=>{r3();UF={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as KF,basename as zF,extname as BF,join as jF}from"path";import{mkdir as _F}from"fs/promises";async function a3(){try{return await import("ts-images")}catch{return null}}function AW(X){switch(X){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 HF(X,$){let Z=$?AW($):AW("web"),Y=X.formatQuality||{};return{jpeg:{...Z.jpeg,...Y.jpeg},png:{...Z.png,...Y.png},webp:{...Z.webp,...Y.webp},avif:{...Z.avif,...Y.avif}}}async function RW(X,$,Z){let Y=await a3();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:X,processed:!1};let J=await $$(X,$,Z);if(J)return J;try{let G=KF(X);if(!await C0(G))return{src:X,processed:!1,errors:[`Source file not found: ${X}`]};let Q=HF(Z,$.preset),w=Z.outputDir||"dist/images",W=Z.baseUrl||"/images";await _F(w,{recursive:!0});let q=await f0(G),U=zF(X,BF(X)),K=$.outputFormat?[$.outputFormat]:Z.defaultFormats||["avif","webp","jpeg"],z={src:X,processed:!0,variants:[],hash:q},j=null;if($.transformations&&$.transformations.length>0)j=await t3(G,$.transformations,Y);for(let B of K){let _=Q[B]||{},H=`${U}-${q}.${B}`,O=jF(w,H);try{let L=await Y.optimizeImage({input:j||G,output:O,format:B,quality:_.quality,progressive:_.progressive});if(L){if(z.variants.push({path:O,url:`${W}/${H}`,width:L.width||0,height:L.height||0,format:B,size:L.outputSize||0}),!z.originalWidth&&L.width)z.originalWidth=L.width,z.originalHeight=L.height}}catch(L){z.errors=z.errors||[],z.errors.push(`Failed to optimize ${B}: ${L}`)}}if($.embedThumbhash||$.placeholder==="thumbhash")try{let B=await Y.generateThumbHash(G);z.placeholder=B.dataUrl}catch(B){z.errors=z.errors||[],z.errors.push(`Failed to generate thumbhash: ${B}`)}if($.useDominantColor)try{let B=await Y.generatePlaceholder(G,{strategy:"dominant-color"});z.dominantColor=B.dominantColor}catch(B){z.errors=z.errors||[],z.errors.push(`Failed to extract dominant color: ${B}`)}return await Z$(X,$,z,Z),z}catch(G){return{src:X,processed:!1,errors:[`Processing failed: ${G}`]}}}async function MW(X,$,Z,Y){let J=await a3();if(!J)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await J.optimizeImage({input:X,output:Y,format:$,quality:Z}))?.outputSize}}catch(G){return{success:!1,error:String(G)}}}async function t3(X,$,Z){let Y=Z||await a3();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let J=await Y.decode(X);for(let G of $){let Q=G.options||{};switch(G.type){case"resize":if(Q.width||Q.height)J=await Y.resize(J,{width:Q.width,height:Q.height,fit:Q.fit});break;case"blur":if(Q.sigma!==void 0)J=await Y.blur(J,Q.sigma);break;case"sharpen":if(Q.amount!==void 0)J=await Y.sharpen(J,Q.amount);break;case"grayscale":J=await Y.grayscale(J);break;case"rotate":if(Q.angle!==void 0)J=await Y.rotate(J,Q.angle);break;case"flip":J=await Y.flip(J);break;case"flop":J=await Y.flop(J);break;case"brightness":if(Q.value!==void 0)J=await Y.brightness(J,Q.value);break;case"contrast":if(Q.value!==void 0)J=await Y.contrast(J,Q.value);break;case"saturation":if(Q.value!==void 0)J=await Y.saturation(J,Q.value);break}}return await Y.encode(J,"png")}catch(J){return console.error(`[stx-media] Transformation failed: ${J}`),null}}var TW=E(()=>{R5();o3()});import{resolve as LF,basename as OF,extname as FF,join as VF}from"path";import{mkdir as AF}from"fs/promises";async function RF(){try{return await import("ts-images")}catch{return null}}async function NW(X,$,Z){let Y=await RF();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let J=LF(X);if(!await C0(J))return console.warn(`[stx-media] Source file not found: ${X}`),null;try{let G=$.responsiveWidths||Z.breakpoints||MF,Q=$.formats||Z.defaultFormats||["avif","webp","jpeg"],w=Z.outputDir||"dist/images",W=Z.baseUrl||"/images";await AF(w,{recursive:!0});let q=await f0(J),U=OF(X,FF(X)),K=Z.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},z={src:X,byFormat:{},srcsets:{}};for(let B of Q){z.byFormat[B]=[];let _=[];for(let H of G){let O=`${U}-${H}w-${q}.${B}`,L=VF(w,O),F=`${W}/${O}`;try{let V=K[B]?.quality||80;if(await C0(L)){z.byFormat[B].push({path:L,url:F,width:H,height:0,format:B,size:0}),_.push(`${F} ${H}w`);continue}let A=await Y.processImage({input:J,output:L,format:B,quality:V,resize:{width:H}});if(A)z.byFormat[B].push({path:L,url:F,width:H,height:A.height||Math.round(H*(A.height||1)/(A.width||1)),format:B,size:A.outputSize||0}),_.push(`${F} ${H}w`)}catch(V){console.warn(`[stx-media] Failed to generate ${B} at ${H}w: ${V}`)}}z.srcsets[B]=_.join(", ")}let j=$.placeholder||Z.placeholderStrategy||"thumbhash";if(j!=="none")try{if(j==="thumbhash"){let B=await Y.generateThumbHash(J);z.placeholder={dataURL:B.dataUrl,width:B.width||32,height:B.height||32,strategy:"thumbhash"}}else{let B=await Y.generatePlaceholder(J,{strategy:j,width:20});z.placeholder={dataURL:B.dataURL,width:B.width,height:B.height,strategy:j}}}catch(B){console.warn(`[stx-media] Failed to generate placeholder: ${B}`)}return z.sizes=$.sizes||TF(G),z}catch(G){return console.error(`[stx-media] Responsive generation failed: ${G}`),null}}function TF(X){let $=[...X].sort((Y,J)=>Y-J),Z=[];for(let Y=0;Y<$.length-1;Y++){let J=$[Y];Z.push(`(max-width: ${J}px) ${J}px`)}return Z.push(`${$[$.length-1]}px`),Z.join(", ")}function kW(X,$="width"){if(!X||X.length===0)return"";if($==="dpr")return X.filter((Z)=>Z.dpr).map((Z)=>`${Z.url} ${Z.dpr}x`).join(", ");return X.map((Z)=>`${Z.url} ${Z.width}w`).join(", ")}var MF;var IW=E(()=>{R5();MF=[320,480,640,768,1024,1280,1536,1920]});var EW={};e(EW,{setCachedImageResult:()=>Z$,processImage:()=>RW,optimizeImage:()=>MW,getCachedImageResult:()=>$$,generateSrcset:()=>kW,generateResponsiveVariants:()=>NW,clearImageCache:()=>VW,applyTransformations:()=>t3,ImageProcessorCache:()=>X$});var DW=E(()=>{TW();IW();o3()});async function NF(){try{return await Promise.resolve().then(() => (DW(),EW))}catch(X){if(!yW)console.warn("[stx-media] Image processor not available, some features disabled:",X),yW=!0;return null}}async function Y$(X,$={}){let Z=$,Y=X;if(Y.process&&!Y.skipOptimization){if(Z.tsImagesConfig?.enabled&&!Z.isDev)return DF(Y,Z)}if(Z.processedResult?.processed)return Z6(X,Z.processedResult,$);if(Z.responsiveVariants)return PW(X,Z.responsiveVariants,$);let{src:J,alt:G,width:Q,height:w,sizes:W,widths:q=U7,dpr:U,formats:K=qX,quality:z=e3,params:j={},placeholder:B="none",placeholderOptions:_={},lazy:H=!0,priority:O=!1,loading:L=O?"eager":G$,decoding:F=J$,fetchpriority:V,objectFit:A,objectPosition:R,crossorigin:M,referrerpolicy:T}=X,k=X.class,I=X.style,D=X.id,N=X.data||{},{isDev:S=!1,baseUrl:b=""}=$;if(S&&!$.optimize)return EF(X);let y,P,x=D||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!O)try{y=await zW(J,{strategy:B,..._}),P=KW(x,y,_)}catch{}let f=U!==void 0&&Q!==void 0,p;if(f)p=IF(X,x,y,$);else p=await kF(X,x,y,$);let c;if(O){let h0=K.includes("webp")?"webp":K[0],X1=u3(J,q,{...j,q:z},h0),i=typeof W==="object"?d3(W):W||"100vw";c=`<link rel="preload" as="image" imagesrcset="${X1}" imagesizes="${i}" />`}let I0=[];if(!bW&&B!=="none")I0.push(p3),bW=!0;if(P)I0.push(P);let g0=H?CW(x):void 0;return{html:p,preloadLink:c,css:I0.length>0?I0.join(`
|
|
14758
|
-
`):void 0,script:
|
|
14757
|
+
`.trim();c3=new Map});import{createHash as _W}from"crypto";import{readFile as YF,stat as HW}from"fs/promises";async function x0(X){try{let $=await YF(X);return _W("sha256").update($).digest("hex").slice(0,16)}catch{return""}}function jW(X){return _W("sha256").update(X).digest("hex").slice(0,16)}function s8(X,$){let Z=JSON.stringify($,Object.keys($).sort());return`${jW(X)}-${jW(Z)}`}async function i3(X){try{return(await HW(X)).mtimeMs}catch{return 0}}async function S0(X){try{return await HW(X),!0}catch{return!1}}var A5=()=>{};import{mkdir as JF,readFile as GF,writeFile as QF,readdir as Ky,rm as wF,stat as zy}from"fs/promises";import{join as OW,dirname as WF}from"path";async function qF(X){try{await JF(X,{recursive:!0})}catch{}}function FW(X,$,Z){return OW(X,Z,`${$}.json`)}async function LW(X,$,Z){if((Date.now()-X.createdAt)/86400000>Z)return!1;if(await i3($)!==X.srcMtime)return!1;return!0}async function o8(X,$,Z,Y=n3){if(!Y.enabled)return null;let J=s8(X,$),G=U7.get(J);if(G){if(await LW(G,X,Y.maxAge))return G.lastAccessedAt=Date.now(),G.data;U7.delete(J)}let Q=FW(Y.directory,J,Z);if(await S0(Q))try{let w=await GF(Q,"utf-8"),W=JSON.parse(w);if(await LW(W,X,Y.maxAge))return W.lastAccessedAt=Date.now(),U7.set(J,W),W.data}catch{}return null}async function a8(X,$,Z,Y,J=n3){if(!J.enabled)return;let G=s8(X,$),Q=await x0(X),w=await i3(X),W={key:G,src:X,srcHash:Q,srcMtime:w,optionsHash:s8("",$),data:Z,createdAt:Date.now(),lastAccessedAt:Date.now()};U7.set(G,W);let q=FW(J.directory,G,Y);try{await qF(WF(q)),await QF(q,JSON.stringify(W,null,2))}catch(U){console.warn(`[stx-media] Failed to write cache: ${U}`)}}async function t8(X,$=n3){if(X==="all")U7.clear();else U7.clear();let Z=X==="all"?["image","video"]:[X];for(let Y of Z){let J=OW($.directory,Y);try{await wF(J,{recursive:!0,force:!0})}catch{}}}var U7,n3;var r3=E(()=>{A5();U7=new Map,n3={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class X${config;constructor(X={}){this.config={...UF,...X}}async get(X,$){return o8(X,$,"image",this.config)}async set(X,$,Z){return a8(X,$,Z,"image",this.config)}async clear(){return t8("image",this.config)}updateConfig(X){this.config={...this.config,...X}}}function s3(X){if(!e8)e8=new X$(X);else if(X)e8.updateConfig(X);return e8}async function $$(X,$,Z){let Y=Z?{directory:`${Z.outputDir}/../.cache`}:{};return s3(Y).get(X,$)}async function Z$(X,$,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return s3(J).set(X,$,Z)}async function VW(){return s3().clear()}var UF,e8=null;var o3=E(()=>{r3();UF={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as KF,basename as zF,extname as BF,join as jF}from"path";import{mkdir as _F}from"fs/promises";async function a3(){try{return await import("ts-images")}catch{return null}}function AW(X){switch(X){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 HF(X,$){let Z=$?AW($):AW("web"),Y=X.formatQuality||{};return{jpeg:{...Z.jpeg,...Y.jpeg},png:{...Z.png,...Y.png},webp:{...Z.webp,...Y.webp},avif:{...Z.avif,...Y.avif}}}async function RW(X,$,Z){let Y=await a3();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:X,processed:!1};let J=await $$(X,$,Z);if(J)return J;try{let G=KF(X);if(!await S0(G))return{src:X,processed:!1,errors:[`Source file not found: ${X}`]};let Q=HF(Z,$.preset),w=Z.outputDir||"dist/images",W=Z.baseUrl||"/images";await _F(w,{recursive:!0});let q=await x0(G),U=zF(X,BF(X)),K=$.outputFormat?[$.outputFormat]:Z.defaultFormats||["avif","webp","jpeg"],z={src:X,processed:!0,variants:[],hash:q},j=null;if($.transformations&&$.transformations.length>0)j=await t3(G,$.transformations,Y);for(let B of K){let _=Q[B]||{},H=`${U}-${q}.${B}`,O=jF(w,H);try{let L=await Y.optimizeImage({input:j||G,output:O,format:B,quality:_.quality,progressive:_.progressive});if(L){if(z.variants.push({path:O,url:`${W}/${H}`,width:L.width||0,height:L.height||0,format:B,size:L.outputSize||0}),!z.originalWidth&&L.width)z.originalWidth=L.width,z.originalHeight=L.height}}catch(L){z.errors=z.errors||[],z.errors.push(`Failed to optimize ${B}: ${L}`)}}if($.embedThumbhash||$.placeholder==="thumbhash")try{let B=await Y.generateThumbHash(G);z.placeholder=B.dataUrl}catch(B){z.errors=z.errors||[],z.errors.push(`Failed to generate thumbhash: ${B}`)}if($.useDominantColor)try{let B=await Y.generatePlaceholder(G,{strategy:"dominant-color"});z.dominantColor=B.dominantColor}catch(B){z.errors=z.errors||[],z.errors.push(`Failed to extract dominant color: ${B}`)}return await Z$(X,$,z,Z),z}catch(G){return{src:X,processed:!1,errors:[`Processing failed: ${G}`]}}}async function MW(X,$,Z,Y){let J=await a3();if(!J)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await J.optimizeImage({input:X,output:Y,format:$,quality:Z}))?.outputSize}}catch(G){return{success:!1,error:String(G)}}}async function t3(X,$,Z){let Y=Z||await a3();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let J=await Y.decode(X);for(let G of $){let Q=G.options||{};switch(G.type){case"resize":if(Q.width||Q.height)J=await Y.resize(J,{width:Q.width,height:Q.height,fit:Q.fit});break;case"blur":if(Q.sigma!==void 0)J=await Y.blur(J,Q.sigma);break;case"sharpen":if(Q.amount!==void 0)J=await Y.sharpen(J,Q.amount);break;case"grayscale":J=await Y.grayscale(J);break;case"rotate":if(Q.angle!==void 0)J=await Y.rotate(J,Q.angle);break;case"flip":J=await Y.flip(J);break;case"flop":J=await Y.flop(J);break;case"brightness":if(Q.value!==void 0)J=await Y.brightness(J,Q.value);break;case"contrast":if(Q.value!==void 0)J=await Y.contrast(J,Q.value);break;case"saturation":if(Q.value!==void 0)J=await Y.saturation(J,Q.value);break}}return await Y.encode(J,"png")}catch(J){return console.error(`[stx-media] Transformation failed: ${J}`),null}}var TW=E(()=>{A5();o3()});import{resolve as LF,basename as OF,extname as FF,join as VF}from"path";import{mkdir as AF}from"fs/promises";async function RF(){try{return await import("ts-images")}catch{return null}}async function NW(X,$,Z){let Y=await RF();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let J=LF(X);if(!await S0(J))return console.warn(`[stx-media] Source file not found: ${X}`),null;try{let G=$.responsiveWidths||Z.breakpoints||MF,Q=$.formats||Z.defaultFormats||["avif","webp","jpeg"],w=Z.outputDir||"dist/images",W=Z.baseUrl||"/images";await AF(w,{recursive:!0});let q=await x0(J),U=OF(X,FF(X)),K=Z.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},z={src:X,byFormat:{},srcsets:{}};for(let B of Q){z.byFormat[B]=[];let _=[];for(let H of G){let O=`${U}-${H}w-${q}.${B}`,L=VF(w,O),F=`${W}/${O}`;try{let V=K[B]?.quality||80;if(await S0(L)){z.byFormat[B].push({path:L,url:F,width:H,height:0,format:B,size:0}),_.push(`${F} ${H}w`);continue}let A=await Y.processImage({input:J,output:L,format:B,quality:V,resize:{width:H}});if(A)z.byFormat[B].push({path:L,url:F,width:H,height:A.height||Math.round(H*(A.height||1)/(A.width||1)),format:B,size:A.outputSize||0}),_.push(`${F} ${H}w`)}catch(V){console.warn(`[stx-media] Failed to generate ${B} at ${H}w: ${V}`)}}z.srcsets[B]=_.join(", ")}let j=$.placeholder||Z.placeholderStrategy||"thumbhash";if(j!=="none")try{if(j==="thumbhash"){let B=await Y.generateThumbHash(J);z.placeholder={dataURL:B.dataUrl,width:B.width||32,height:B.height||32,strategy:"thumbhash"}}else{let B=await Y.generatePlaceholder(J,{strategy:j,width:20});z.placeholder={dataURL:B.dataURL,width:B.width,height:B.height,strategy:j}}}catch(B){console.warn(`[stx-media] Failed to generate placeholder: ${B}`)}return z.sizes=$.sizes||TF(G),z}catch(G){return console.error(`[stx-media] Responsive generation failed: ${G}`),null}}function TF(X){let $=[...X].sort((Y,J)=>Y-J),Z=[];for(let Y=0;Y<$.length-1;Y++){let J=$[Y];Z.push(`(max-width: ${J}px) ${J}px`)}return Z.push(`${$[$.length-1]}px`),Z.join(", ")}function kW(X,$="width"){if(!X||X.length===0)return"";if($==="dpr")return X.filter((Z)=>Z.dpr).map((Z)=>`${Z.url} ${Z.dpr}x`).join(", ");return X.map((Z)=>`${Z.url} ${Z.width}w`).join(", ")}var MF;var IW=E(()=>{A5();MF=[320,480,640,768,1024,1280,1536,1920]});var EW={};a(EW,{setCachedImageResult:()=>Z$,processImage:()=>RW,optimizeImage:()=>MW,getCachedImageResult:()=>$$,generateSrcset:()=>kW,generateResponsiveVariants:()=>NW,clearImageCache:()=>VW,applyTransformations:()=>t3,ImageProcessorCache:()=>X$});var DW=E(()=>{TW();IW();o3()});async function NF(){try{return await Promise.resolve().then(() => (DW(),EW))}catch(X){if(!yW)console.warn("[stx-media] Image processor not available, some features disabled:",X),yW=!0;return null}}async function Y$(X,$={}){let Z=$,Y=X;if(Y.process&&!Y.skipOptimization){if(Z.tsImagesConfig?.enabled&&!Z.isDev)return DF(Y,Z)}if(Z.processedResult?.processed)return Z6(X,Z.processedResult,$);if(Z.responsiveVariants)return PW(X,Z.responsiveVariants,$);let{src:J,alt:G,width:Q,height:w,sizes:W,widths:q=q7,dpr:U,formats:K=qX,quality:z=e3,params:j={},placeholder:B="none",placeholderOptions:_={},lazy:H=!0,priority:O=!1,loading:L=O?"eager":G$,decoding:F=J$,fetchpriority:V,objectFit:A,objectPosition:R,crossorigin:M,referrerpolicy:T}=X,k=X.class,I=X.style,D=X.id,N=X.data||{},{isDev:S=!1,baseUrl:b=""}=$;if(S&&!$.optimize)return EF(X);let y,P,f=D||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!O)try{y=await zW(J,{strategy:B,..._}),P=KW(f,y,_)}catch{}let g=U!==void 0&&Q!==void 0,p;if(g)p=IF(X,f,y,$);else p=await kF(X,f,y,$);let c;if(O){let g0=K.includes("webp")?"webp":K[0],$1=u3(J,q,{...j,q:z},g0),$0=typeof W==="object"?d3(W):W||"100vw";c=`<link rel="preload" as="image" imagesrcset="${$1}" imagesizes="${$0}" />`}let k0=[];if(!bW&&B!=="none")k0.push(p3),bW=!0;if(P)k0.push(P);let f0=H?CW(f):void 0;return{html:p,preloadLink:c,css:k0.length>0?k0.join(`
|
|
14758
|
+
`):void 0,script:f0}}async function kF(X,$,Z,Y){let{src:J,alt:G,width:Q,height:w,sizes:W,widths:q=q7,formats:U=qX,quality:K=e3,params:z={},lazy:j=!0,priority:B=!1,loading:_=B?"eager":G$,decoding:H=J$,fetchpriority:O,objectFit:L,objectPosition:F,crossorigin:V,referrerpolicy:A}=X,R=X.class,M=X.style,T=X.data||{},k=typeof W==="object"?d3(W):W||"100vw",I=[];for(let S of U){let b=u3(J,q,{...z,q:K},S),y=m3(S);if(j&&!B)I.push(` <source type="${y}" data-srcset="${b}" data-sizes="${k}" />`);else I.push(` <source type="${y}" srcset="${b}" sizes="${k}" />`)}let D=X6({src:UX(J,{...z,q:K}),alt:G,width:Q,height:w,loading:B?void 0:_,decoding:H,fetchpriority:B?"high":O,objectFit:L,objectPosition:F,crossorigin:V,referrerpolicy:A,className:SW(R,Z),style:$6(M,L,F,Z),lazy:j&&!B,data:T}),N;if(Z){let S=`background-image: url('${Z.dataURL}'); background-size: cover; background-position: center;`;N=`<div id="${$}" class="stx-img-placeholder" style="${S}">
|
|
14759
14759
|
<picture>
|
|
14760
14760
|
${I.join(`
|
|
14761
14761
|
`)}
|
|
@@ -14804,7 +14804,7 @@ ${I.join(`
|
|
|
14804
14804
|
|
|
14805
14805
|
observer.observe(container);
|
|
14806
14806
|
})();
|
|
14807
|
-
`.trim()}async function DF(X,$){let Z=await NF();if(!Z)return Y$({...X,process:!1},$);let Y=$.tsImagesConfig;if(X.responsiveWidths&&X.responsiveWidths.length>0||X.widths&&X.widths.length>0||!X.width&&!X.dpr){let G=await Z.generateResponsiveVariants(X.src,X,Y);if(G)return PW(X,G,$)}else{let G=await Z.processImage(X.src,X,Y);if(G.processed)return Z6(X,G,$)}return Y$({...X,process:!1},$)}async function Z6(X,$,Z){let{alt:Y,width:J,height:G,lazy:Q=!0,priority:w=!1,objectFit:W,objectPosition:q,crossorigin:U,referrerpolicy:K}=X,z=X.class,j=X.style,B=X.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,_=X.data||{},H=$.variants||[],O=H.find((P)=>P.format==="jpeg")||H.find((P)=>P.format==="webp")||H[0],L=O?.url||X.src,F=H.filter((P)=>P.format===(O?.format||"jpeg")).map((P)=>`${P.url} ${P.width}w`).join(", "),V=new Map;for(let P of H){if(!V.has(P.format))V.set(P.format,[]);V.get(P.format).push(P)}let A=[],R=["avif","webp","jpeg","png"];for(let P of R){let
|
|
14807
|
+
`.trim()}async function DF(X,$){let Z=await NF();if(!Z)return Y$({...X,process:!1},$);let Y=$.tsImagesConfig;if(X.responsiveWidths&&X.responsiveWidths.length>0||X.widths&&X.widths.length>0||!X.width&&!X.dpr){let G=await Z.generateResponsiveVariants(X.src,X,Y);if(G)return PW(X,G,$)}else{let G=await Z.processImage(X.src,X,Y);if(G.processed)return Z6(X,G,$)}return Y$({...X,process:!1},$)}async function Z6(X,$,Z){let{alt:Y,width:J,height:G,lazy:Q=!0,priority:w=!1,objectFit:W,objectPosition:q,crossorigin:U,referrerpolicy:K}=X,z=X.class,j=X.style,B=X.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,_=X.data||{},H=$.variants||[],O=H.find((P)=>P.format==="jpeg")||H.find((P)=>P.format==="webp")||H[0],L=O?.url||X.src,F=H.filter((P)=>P.format===(O?.format||"jpeg")).map((P)=>`${P.url} ${P.width}w`).join(", "),V=new Map;for(let P of H){if(!V.has(P.format))V.set(P.format,[]);V.get(P.format).push(P)}let A=[],R=["avif","webp","jpeg","png"];for(let P of R){let f=V.get(P);if(f&&f.length>0){let g=f.map((c)=>`${c.url} ${c.width}w`).join(", "),p=m3(P);if(Q&&!w)A.push(` <source type="${p}" data-srcset="${g}" />`);else A.push(` <source type="${p}" srcset="${g}" />`)}}let M=[];if(Q&&!w){if(M.push(`data-src="${Q1(L)}"`),M.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),F)M.push(`data-srcset="${F}"`)}else if(M.push(`src="${Q1(L)}"`),F)M.push(`srcset="${F}"`);M.push(`alt="${Q1(Y)}"`);let T=J||$.originalWidth,k=G||$.originalHeight;if(T)M.push(`width="${T}"`);if(k)M.push(`height="${k}"`);if(!w)M.push(`loading="${Q?"lazy":"eager"}"`);if(M.push('decoding="async"'),w)M.push('fetchpriority="high"');if(U)M.push(`crossorigin="${U}"`);if(K)M.push(`referrerpolicy="${K}"`);let I=[];if(W)I.push(`object-fit: ${W}`);if(q)I.push(`object-position: ${q}`);if($.placeholder&&Q)I.push("opacity: 0; transition: opacity 300ms ease-out");if(j)I.push(j);if(I.length>0)M.push(`style="${I.join("; ")}"`);let D=[];if(z)D.push(z);if($.placeholder)D.push("stx-img-blur");if(D.length>0)M.push(`class="${D.join(" ")}"`);if(Q&&!w)M.push("data-stx-lazy");for(let[P,f]of Object.entries(_))M.push(`data-${P}="${Q1(f)}"`);let N;if($.placeholder||$.dominantColor&&X.useDominantColor){let P=$.placeholder?`background-image: url('${$.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${$.dominantColor};`;N=`<div id="${B}" class="stx-img-placeholder" style="${P}">
|
|
14808
14808
|
<picture>
|
|
14809
14809
|
${A.join(`
|
|
14810
14810
|
`)}
|
|
@@ -14815,11 +14815,11 @@ ${A.join(`
|
|
|
14815
14815
|
`)}
|
|
14816
14816
|
<img ${M.join(" ")} />
|
|
14817
14817
|
</picture>`;let S=[];if($.placeholder)S.push(p3);let b=Q?CW(B):void 0,y;if(w&&F)y=`<link rel="preload" as="image" imagesrcset="${F}" />`;return{html:N,preloadLink:y,css:S.length>0?S.join(`
|
|
14818
|
-
`):void 0,script:b}}async function PW(X,$,Z){let Y={src:$.src,processed:!0,variants:[],placeholder:$.placeholder?.dataURL,originalWidth:$.placeholder?.width,originalHeight:$.placeholder?.height};for(let[J,G]of Object.entries($.byFormat))if(G)Y.variants.push(...G);return Z6(X,Y,Z)}var yW=!1,e3=80,J$="async",G$="lazy",bW=!1;var vW=E(()=>{l3();BW()});function yF(){return r8({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async(X,$,Z,Y)=>{let{src:J,alt:G,options:Q}=bF(X,$,Z);if(!J)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let w={src:J,alt:G||"",widths:Q.widths||
|
|
14818
|
+
`):void 0,script:b}}async function PW(X,$,Z){let Y={src:$.src,processed:!0,variants:[],placeholder:$.placeholder?.dataURL,originalWidth:$.placeholder?.width,originalHeight:$.placeholder?.height};for(let[J,G]of Object.entries($.byFormat))if(G)Y.variants.push(...G);return Z6(X,Y,Z)}var yW=!1,e3=80,J$="async",G$="lazy",bW=!1;var vW=E(()=>{l3();BW()});function yF(){return r8({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async(X,$,Z,Y)=>{let{src:J,alt:G,options:Q}=bF(X,$,Z);if(!J)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let w={src:J,alt:G||"",widths:Q.widths||q7,formats:Q.formats||qX,quality:Q.quality,sizes:Q.sizes,dpr:Q.dpr,params:Q.params,placeholder:Q.placeholder,placeholderOptions:Q.placeholderOptions,lazy:Q.lazy!==!1,priority:Q.priority||!1,loading:Q.loading,decoding:Q.decoding,fetchpriority:Q.fetchpriority,objectFit:Q.objectFit,objectPosition:Q.objectPosition,class:Q.class,style:Q.style,id:Q.id,width:Q.width,height:Q.height},W=Z.__isDev||!1,q=await Y$(w,{isDev:W}),U=q.html;if(q.preloadLink)U=q.preloadLink+`
|
|
14819
14819
|
`+U;if(q.css)U+=`
|
|
14820
14820
|
<style>${q.css}</style>`;if(q.script)U+=`
|
|
14821
|
-
<script>${q.script}</script>`;return U},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function bF(X,$,Z){if($.src)return{src:String($.src),alt:String($.alt||""),options:$.options||{}};let Y=X.trim();if(Y.startsWith("@img(")||Y.startsWith("("))Y=Y.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=SF(Y),G=Y6(J[0],Z)||"",Q=Y6(J[1],Z)||"",w={};if(J[2]){let W=Y6(J[2],Z);if(typeof W==="object"&&W!==null)w=W;else if(typeof J[2]==="string")try{w=JSON.parse(J[2])}catch{}}return{src:G,alt:Q,options:w}}function SF(X){let $=[],Z="",Y=!1,J="",G=0,Q=0;for(let w=0;w<X.length;w++){let W=X[w],q=w>0?X[w-1]:"";if((W==='"'||W==="'"||W==="`")&&q!=="\\"){if(!Y)Y=!0,J=W;else if(W===J)Y=!1,J="";else Z+=W;continue}if(!Y){if(W==="{")G++;if(W==="}")G--;if(W==="[")Q++;if(W==="]")Q--;if(W===","&&G===0&&Q===0){$.push(Z.trim()),Z="";continue}}Z+=W}if(Z.trim())$.push(Z.trim());return $}function Y6(X,$){if(typeof X!=="string")return X;let Z=X.trim();if(Z.startsWith('"')&&Z.endsWith('"')||Z.startsWith("'")&&Z.endsWith("'"))return Z.slice(1,-1);if(!Z.startsWith("/")&&!Z.startsWith(".")&&!Z.startsWith("http")&&!Z.startsWith("{")){let Y=$[Z];if(Y!==void 0)return Y}if(Z.startsWith("{")||Z.startsWith("["))try{return JSON.parse(Z)}catch{}return Z}var xW;var fW=E(()=>{h3();vW();l3();xW=yF()});class w${config;constructor(X={}){this.config={...CF,...X}}async get(X,$){return o8(X,$,"video",this.config)}async set(X,$,Z){return a8(X,$,Z,"video",this.config)}async clear(){return t8("video",this.config)}updateConfig(X){this.config={...this.config,...X}}}function J6(X){if(!Q$)Q$=new w$(X);else if(X)Q$.updateConfig(X);return Q$}async function W$(X,$,Z){let Y=Z?{directory:`${Z.outputDir}/../.cache`}:{};return J6(Y).get(X,$)}async function q$(X,$,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return J6(J).set(X,$,Z)}async function gW(){return J6().clear()}var CF,Q$=null;var G6=E(()=>{r3();CF={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as Q6,basename as w6,extname as W6,join as U$}from"path";import{mkdir as q6}from"fs/promises";async function U6(){try{return await import("ts-videos")}catch{return null}}async function K$(X,$,Z,Y){let J=await U6();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let G=Q6(X);if(!await
|
|
14822
|
-
`)}async function _$(X,$,Z,Y,J){let G=await pW();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let Q=dW(X);if(!await
|
|
14821
|
+
<script>${q.script}</script>`;return U},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function bF(X,$,Z){if($.src)return{src:String($.src),alt:String($.alt||""),options:$.options||{}};let Y=X.trim();if(Y.startsWith("@img(")||Y.startsWith("("))Y=Y.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=SF(Y),G=Y6(J[0],Z)||"",Q=Y6(J[1],Z)||"",w={};if(J[2]){let W=Y6(J[2],Z);if(typeof W==="object"&&W!==null)w=W;else if(typeof J[2]==="string")try{w=JSON.parse(J[2])}catch{}}return{src:G,alt:Q,options:w}}function SF(X){let $=[],Z="",Y=!1,J="",G=0,Q=0;for(let w=0;w<X.length;w++){let W=X[w],q=w>0?X[w-1]:"";if((W==='"'||W==="'"||W==="`")&&q!=="\\"){if(!Y)Y=!0,J=W;else if(W===J)Y=!1,J="";else Z+=W;continue}if(!Y){if(W==="{")G++;if(W==="}")G--;if(W==="[")Q++;if(W==="]")Q--;if(W===","&&G===0&&Q===0){$.push(Z.trim()),Z="";continue}}Z+=W}if(Z.trim())$.push(Z.trim());return $}function Y6(X,$){if(typeof X!=="string")return X;let Z=X.trim();if(Z.startsWith('"')&&Z.endsWith('"')||Z.startsWith("'")&&Z.endsWith("'"))return Z.slice(1,-1);if(!Z.startsWith("/")&&!Z.startsWith(".")&&!Z.startsWith("http")&&!Z.startsWith("{")){let Y=$[Z];if(Y!==void 0)return Y}if(Z.startsWith("{")||Z.startsWith("["))try{return JSON.parse(Z)}catch{}return Z}var xW;var fW=E(()=>{h3();vW();l3();xW=yF()});class w${config;constructor(X={}){this.config={...CF,...X}}async get(X,$){return o8(X,$,"video",this.config)}async set(X,$,Z){return a8(X,$,Z,"video",this.config)}async clear(){return t8("video",this.config)}updateConfig(X){this.config={...this.config,...X}}}function J6(X){if(!Q$)Q$=new w$(X);else if(X)Q$.updateConfig(X);return Q$}async function W$(X,$,Z){let Y=Z?{directory:`${Z.outputDir}/../.cache`}:{};return J6(Y).get(X,$)}async function q$(X,$,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return J6(J).set(X,$,Z)}async function gW(){return J6().clear()}var CF,Q$=null;var G6=E(()=>{r3();CF={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as Q6,basename as w6,extname as W6,join as U$}from"path";import{mkdir as q6}from"fs/promises";async function U6(){try{return await import("ts-videos")}catch{return null}}async function K$(X,$,Z,Y){let J=await U6();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let G=Q6(X);if(!await S0(G))return null;await q6(Z,{recursive:!0});let Q=await x0(G),w=w6(X,W6(X)),W=$.format||"webp",q=$.timestamp||0,U=`${w}-poster-${Q}.${W}`,K=U$(Z,U),z=await J.extractThumbnails(G,{timestamps:[q],width:$.width||1280,height:$.height,format:W,quality:$.quality||85,outputDir:Z,outputPattern:U.replace(`.${W}`,"")});if(z&&z.length>0){let j=z[0];return{path:K,url:`${Y}/${U}`,width:j.width||$.width||1280,height:j.height||720,timestamp:q,size:j.size||0}}return null}catch(G){return console.warn(`[stx-media] Failed to generate poster: ${G}`),null}}async function z$(X,$,Z,Y){let J=await U6();if(!J)return[];try{let G=Q6(X);if(!await S0(G))return[];await q6(Z,{recursive:!0});let Q=await x0(G),w=w6(X,W6(X)),W=$.format||"webp",K=(await new J.Input(G).getInfo()).duration||60,z=$.count||10,j=$.interval||K/z,B=[];for(let H=0;H<z&&H*j<K;H++)B.push(H*j);let _=await J.extractThumbnails(G,{timestamps:B,width:$.width||320,format:W,quality:$.quality||80,outputDir:Z,outputPattern:`${w}-thumb-${Q}`});if(_&&_.length>0)return _.map((H,O)=>({path:H.path||U$(Z,`${w}-thumb-${Q}-${O}.${W}`),url:`${Y}/${w}-thumb-${Q}-${O}.${W}`,width:H.width||$.width||320,height:H.height||180,timestamp:B[O],size:H.size||0}));return[]}catch(G){return console.warn(`[stx-media] Failed to generate thumbnails: ${G}`),[]}}async function hW(X,$,Z,Y){let J=await U6();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let G=Q6(X);if(!await S0(G))return null;await q6(Z,{recursive:!0});let Q=await x0(G),w=w6(X,W6(X)),U=(await new J.Input(G).getInfo()).duration||60,K=$.columns||10,z=$.interval||5,j=$.thumbnailWidth||160,B=$.thumbnailHeight||90,_=$.format||"jpeg",H=Math.ceil(U/z),O=Math.ceil(H/K),L=`${w}-sprite-${Q}.${_}`,F=U$(Z,L),V=[];for(let R=0;R<H;R++)V.push(R*z);let A=await J.extractThumbnails(G,{timestamps:V,width:j,height:B,format:_,quality:$.quality||70,outputDir:U$(Z,".temp")});if(!A||A.length===0)return null;try{let R=await import("ts-images"),M=K*j,T=O*B,k=await R.createSprite({images:A.map((I)=>I.path),columns:K,padding:0,outputPath:F,format:_,quality:$.quality||70});return{url:`${Y}/${L}`,path:F,columns:K,rows:O,thumbnailWidth:j,thumbnailHeight:B,interval:z,totalFrames:H}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(G){return console.warn(`[stx-media] Failed to generate sprite sheet: ${G}`),null}}var K6=E(()=>{A5()});import{resolve as dW,basename as mW,extname as lW,join as R5}from"path";import{mkdir as B$,writeFile as cW}from"fs/promises";async function pW(){try{return await import("ts-videos")}catch{return null}}async function j$(X,$,Z,Y,J){let G=await pW();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let Q=dW(X);if(!await S0(Q))return null;let w=await x0(Q),W=mW(X,lW(X)),q=R5(Z,`${W}-${w}-hls`);await B$(q,{recursive:!0});let U=$.length>0?$:iW,K=J?.segmentDuration||6,B=(await new G.Input(Q).getInfo()).duration||0,_=[],H=0;for(let F of U){let V=R5(q,F.label);await B$(V,{recursive:!0});let A=`${F.label}.m3u8`,R=R5(V,A);try{let M=await G.generateHLS(Q,{outputDir:V,segmentDuration:K,width:F.width,height:F.height,videoBitrate:F.bitrate,audioBitrate:F.audioBitrate,playlistName:F.label});if(M)_.push({quality:F,url:`${Y}/${W}-${w}-hls/${F.label}/${A}`,path:R}),H+=M.segmentCount||Math.ceil(B/K)}catch(M){console.warn(`[stx-media] Failed to generate HLS for ${F.label}: ${M}`)}}if(_.length===0)return null;let O=R5(q,"master.m3u8"),L=PF(_,Y,W,w);return await cW(O,L),{manifestUrl:`${Y}/${W}-${w}-hls/master.m3u8`,manifestPath:O,playlists:_,segmentCount:H,duration:B}}catch(Q){return console.warn(`[stx-media] Failed to generate HLS manifest: ${Q}`),null}}function PF(X,$,Z,Y){let J=["#EXTM3U","#EXT-X-VERSION:3"];for(let G of X){let{quality:Q}=G,w=Q.bitrate+(Q.audioBitrate||128000),W=`${Q.width}x${Q.height||Math.round(Q.width*9/16)}`;J.push(`#EXT-X-STREAM-INF:BANDWIDTH=${w},RESOLUTION=${W},NAME="${Q.label}"`,`${Q.label}/${Q.label}.m3u8`)}return J.join(`
|
|
14822
|
+
`)}async function _$(X,$,Z,Y,J){let G=await pW();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let Q=dW(X);if(!await S0(Q))return null;let w=await x0(Q),W=mW(X,lW(X)),q=R5(Z,`${W}-${w}-dash`);await B$(q,{recursive:!0});let U=$.length>0?$:iW,K=J?.segmentDuration||4,z=J?.minBufferTime||2,_=(await new G.Input(Q).getInfo()).duration||0,H=[],O=[];for(let A of U){let R=R5(q,A.label);await B$(R,{recursive:!0});try{if(await G.generateDASH(Q,{outputDir:R,segmentDuration:K,width:A.width,height:A.height,videoBitrate:A.bitrate,audioBitrate:A.audioBitrate})){if(H.push({bandwidth:A.bitrate,width:A.width,height:A.height||Math.round(A.width*9/16),url:`${Y}/${W}-${w}-dash/${A.label}/video`}),A.audioBitrate)O.push({bandwidth:A.audioBitrate,url:`${Y}/${W}-${w}-dash/${A.label}/audio`})}}catch(M){console.warn(`[stx-media] Failed to generate DASH for ${A.label}: ${M}`)}}if(H.length===0)return null;let L=R5(q,"manifest.mpd"),F=vF(H,O,_,K,z);await cW(L,F);let V=[{type:"video",representations:H}];if(O.length>0)V.push({type:"audio",representations:O});return{manifestUrl:`${Y}/${W}-${w}-dash/manifest.mpd`,manifestPath:L,adaptationSets:V,duration:_}}catch(Q){return console.warn(`[stx-media] Failed to generate DASH manifest: ${Q}`),null}}function vF(X,$,Z,Y,J){let G=uW(Z),Q=uW(J),w=`<?xml version="1.0" encoding="UTF-8"?>
|
|
14823
14823
|
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
|
|
14824
14824
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
14825
14825
|
xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
|
|
@@ -14845,7 +14845,7 @@ ${A.join(`
|
|
|
14845
14845
|
</Representation>
|
|
14846
14846
|
`}w+=` </AdaptationSet>
|
|
14847
14847
|
`}return w+=` </Period>
|
|
14848
|
-
</MPD>`,w}function uW(X){let $=Math.floor(X/3600),Z=Math.floor(X%3600/60),Y=Math.floor(X%60),J="PT";if($>0)J+=`${$}H`;if(Z>0)J+=`${Z}M`;return J+=`${Y}S`,J}var iW;var z6=E(()=>{
|
|
14848
|
+
</MPD>`,w}function uW(X){let $=Math.floor(X/3600),Z=Math.floor(X%3600/60),Y=Math.floor(X%60),J="PT";if($>0)J+=`${$}H`;if(Z>0)J+=`${Z}M`;return J+=`${Y}S`,J}var iW;var z6=E(()=>{A5();iW=[{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 nW,basename as xF,extname as fF,join as gF}from"path";import{mkdir as hF}from"fs/promises";async function rW(){try{return await import("ts-videos")}catch{return null}}function uF(X){switch(X){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 dF(X){switch(X){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 B6(X){let $=await rW();if(!$)return null;try{let Z=nW(X),J=await new $.Input(Z).getInfo();return{duration:J.duration||0,width:J.width||0,height:J.height||0,frameRate:J.frameRate||0,bitrate:J.bitrate||0,codec:J.videoCodec||"",audioCodec:J.audioCodec}}catch(Z){return console.warn(`[stx-media] Failed to analyze video: ${Z}`),null}}async function sW(X,$,Z,Y){let J=await rW();if(!J)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:X,processed:!1};let G=await W$(X,$,Z);if(G)return G;try{let Q=nW(X);if(!await S0(Q))return{src:X,processed:!1,errors:[`Source file not found: ${X}`]};let w=Z.outputDir||"dist/videos",W=Z.baseUrl||"/videos";await hF(w,{recursive:!0});let q=await x0(Q),U=xF(X,fF(X)),K={src:X,processed:!0,hash:q};Y?.({percentage:5,stage:"analyzing"}),K.metadata=await B6(Q)||void 0;let z={};if($.quality)z.bitrate=uF($.quality);if($.platform)Object.assign(z,dF($.platform));if($.transcode)Object.assign(z,$.transcode);if(Object.keys(z).length>0||$.process){Y?.({percentage:10,stage:"transcoding"});let j=`${U}-${q}.mp4`,B=gF(w,j);try{let _=await mF(Q,B,z,J,(H)=>Y?.({percentage:10+H*0.5,stage:"transcoding"}));if(_)K.transcoded={path:B,url:`${W}/${j}`,duration:_.duration,size:_.size,video:{codec:z.codec||"h264",width:_.width,height:_.height,bitrate:_.bitrate,frameRate:_.frameRate},audio:_.audioCodec?{codec:z.audioCodec||"aac",bitrate:z.audioBitrate||128000,sampleRate:z.sampleRate||48000,channels:z.channels||2}:void 0}}catch(_){K.errors=K.errors||[],K.errors.push(`Transcoding failed: ${_}`)}}if($.generatePoster){Y?.({percentage:65,stage:"generating-poster"});let j=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},B=await K$(Q,j,w,W);if(B)K.poster=B}if(Z.thumbnails?.enabled){Y?.({percentage:70,stage:"generating-thumbnails"});let j=await z$(Q,Z.thumbnails,w,W);if(j.length>0)K.thumbnails=j}if($.streaming){Y?.({percentage:80,stage:"generating-manifests"});let j=typeof $.streaming==="object"?$.streaming:Z.streaming||{format:"hls"};if(j.format==="hls"||j.format===void 0){let B=await j$(Q,j.qualities||Z.streaming?.defaultQualities||[],w,W);if(B)K.streaming={...K.streaming,hls:B}}if(j.format==="dash"){let B=await _$(Q,j.qualities||Z.streaming?.defaultQualities||[],w,W);if(B)K.streaming={...K.streaming,dash:B}}}if($.spriteSheet)Y?.({percentage:90,stage:"generating-sprite-sheet"});return Y?.({percentage:100,stage:"complete"}),await q$(X,$,K,Z),K}catch(Q){return{src:X,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function mF(X,$,Z,Y,J){try{let Q=await new Y.Conversion(X,$,{videoCodec:Z.codec,videoBitrate:Z.bitrate,width:Z.maxWidth,height:Z.maxHeight,frameRate:Z.frameRate,audioCodec:Z.audioCodec,audioBitrate:Z.audioBitrate,sampleRate:Z.sampleRate,channels:Z.channels}).run((w)=>{J?.(w.percentage/100)});return{duration:Q.duration||0,size:Q.size||0,width:Q.width||Z.maxWidth||0,height:Q.height||Z.maxHeight||0,bitrate:Q.bitrate||Z.bitrate||0,frameRate:Q.frameRate||Z.frameRate||30,audioCodec:Q.audioCodec}}catch(G){return console.error(`[stx-media] Transcoding failed: ${G}`),null}}var oW=E(()=>{A5();G6();K6();z6()});var aW={};a(aW,{setCachedVideoResult:()=>q$,processVideo:()=>sW,getCachedVideoResult:()=>W$,generateThumbnails:()=>z$,generateSpriteSheet:()=>hW,generatePoster:()=>K$,generateHLSManifest:()=>j$,generateDASHManifest:()=>_$,clearVideoCache:()=>gW,analyzeVideo:()=>B6,VideoProcessorCache:()=>w$});var tW=E(()=>{oW();K6();z6();G6()});async function Xq(){try{return await Promise.resolve().then(() => (tW(),aW))}catch(X){if(!eW)console.warn("[stx-media] Video processor not available, some features disabled:",X),eW=!0;return null}}async function H$(X,$={}){let Z=$,Y=X;if(Y.process&&!Y.skipProcessing){if(Z.tsVideosConfig?.enabled&&!Z.isDev)return rF(Y,Z)}if(Z.processedResult?.processed)return Jq(X,Z.processedResult,$);let J;if(Y.generatePoster&&Y.src&&!X.poster)J=await sF(Y,Z);let{src:G,sources:Q=[],poster:w,posterPlaceholder:W,controls:q=$q,autoplay:U=!1,muted:K=!1,loop:z=!1,preload:j=Zq,playsinline:B=!0,lazy:_=!0,player:H="native",type:O,width:L,height:F,crossorigin:V,disablePictureInPicture:A=!1,disableRemotePlayback:R=!1}=X,M=J||w,T=X.class,k=X.style,I=X.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(H==="ts-video")return pF(X,$);if(O&&O!=="video")return cF(G||"",O,X);let D=Q.length>0?Q:G?[{src:G,type:Yq(G)}]:[],N=[`id="${I}"`];if(q)N.push("controls");if(U)N.push("autoplay");if(K)N.push("muted");if(z)N.push("loop");if(B)N.push("playsinline");if(A)N.push("disablepictureinpicture");if(R)N.push("disableremoteplayback");if(V)N.push(`crossorigin="${V}"`);if(_){if(N.push(`data-preload="${j}"`),N.push('preload="none"'),M)N.push(`data-poster="${N0(M)}"`);N.push("data-stx-lazy")}else if(N.push(`preload="${j}"`),M)N.push(`poster="${N0(M)}"`);if(L)N.push(`width="${L}"`);if(F)N.push(`height="${F}"`);if(T)N.push(`class="${N0(T)}"`);if(k)N.push(`style="${N0(k)}"`);let S=D.map((P)=>{return` <source ${_?`data-src="${N0(P.src)}"`:`src="${N0(P.src)}"`} type="${P.type}"${P.media?` media="${P.media}"`:""} />`}).join(`
|
|
14849
14849
|
`),b=`<video ${N.join(" ")}>
|
|
14850
14850
|
${S}
|
|
14851
14851
|
Your browser does not support the video tag.
|
|
@@ -14884,12 +14884,12 @@ ${S}
|
|
|
14884
14884
|
|
|
14885
14885
|
observer.observe(video);
|
|
14886
14886
|
})();
|
|
14887
|
-
`.trim();return{html:b,script:y}}function cF(X,$,Z){let{width:Y=640,height:J=360}=Z,G=Z.class,Q=Z.style,w=Z.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,W,q=null;switch($){case"youtube":q=iF(X),W=q?`https://www.youtube-nocookie.com/embed/${q}`:X;break;case"vimeo":q=nF(X),W=q?`https://player.vimeo.com/video/${q}`:X;break;case"dailymotion":q=X.split("/").pop()||"",W=`https://www.dailymotion.com/embed/video/${q}`;break;case"twitch":q=X.split("/").pop()||"",W=`https://player.twitch.tv/?video=${q}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:W=X}let U=[`id="${w}"`,`src="${
|
|
14887
|
+
`.trim();return{html:b,script:y}}function cF(X,$,Z){let{width:Y=640,height:J=360}=Z,G=Z.class,Q=Z.style,w=Z.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,W,q=null;switch($){case"youtube":q=iF(X),W=q?`https://www.youtube-nocookie.com/embed/${q}`:X;break;case"vimeo":q=nF(X),W=q?`https://player.vimeo.com/video/${q}`:X;break;case"dailymotion":q=X.split("/").pop()||"",W=`https://www.dailymotion.com/embed/video/${q}`;break;case"twitch":q=X.split("/").pop()||"",W=`https://player.twitch.tv/?video=${q}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:W=X}let U=[`id="${w}"`,`src="${N0(W)}"`,`width="${Y}"`,`height="${J}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(G)U.push(`class="${N0(G)}"`);if(Q)U.push(`style="${N0(Q)}"`);if(Z.lazy)U.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
|
|
14888
14888
|
<iframe ${U.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
|
|
14889
14889
|
</div>`}}function pF(X,$={}){let{src:Z,sources:Y=[],poster:J,controls:G=!0,autoplay:Q=!1,muted:w=!1,loop:W=!1,preload:q="metadata",playsinline:U=!0,lazy:K=!0,width:z,height:j}=X,B=X.class,_=X.style,H=X.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,O={src:Y.length>0?Y:Z,autoplay:Q,loop:W,muted:w,playsinline:U,preload:q,poster:J,controls:G,title:X.title},L=["position: relative",z?`width: ${typeof z==="number"?z+"px":z}`:"width: 100%",j?`height: ${typeof j==="number"?j+"px":j}`:"",_||""].filter(Boolean).join("; "),F=`
|
|
14890
14890
|
<div
|
|
14891
14891
|
id="${H}"
|
|
14892
|
-
class="ts-video-player${B?" "+
|
|
14892
|
+
class="ts-video-player${B?" "+N0(B):""}"
|
|
14893
14893
|
style="${L}"
|
|
14894
14894
|
data-ts-video-player
|
|
14895
14895
|
data-config='${JSON.stringify(O)}'
|
|
@@ -14897,7 +14897,7 @@ ${S}
|
|
|
14897
14897
|
>
|
|
14898
14898
|
<div class="ts-video-player__container">
|
|
14899
14899
|
${J?`
|
|
14900
|
-
<div class="ts-video-player__placeholder" style="background-image: url('${
|
|
14900
|
+
<div class="ts-video-player__placeholder" style="background-image: url('${N0(J)}');">
|
|
14901
14901
|
<button class="ts-video-player__play-button" aria-label="Play video">
|
|
14902
14902
|
<svg viewBox="0 0 24 24" fill="currentColor" width="64" height="64">
|
|
14903
14903
|
<path d="M8 5v14l11-7z"/>
|
|
@@ -15053,10 +15053,10 @@ else {
|
|
|
15053
15053
|
.ts-video-player__play-button svg {
|
|
15054
15054
|
margin-left: 4px;
|
|
15055
15055
|
}
|
|
15056
|
-
`.trim();return{html:F,script:V,css:A}}function Yq(X){switch(X.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function iF(X){let $=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Z of $){let Y=X.match(Z);if(Y)return Y[1]}return null}function nF(X){let $=X.match(/vimeo\.com\/(\d+)/);return $?$[1]:null}function
|
|
15056
|
+
`.trim();return{html:F,script:V,css:A}}function Yq(X){switch(X.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function iF(X){let $=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Z of $){let Y=X.match(Z);if(Y)return Y[1]}return null}function nF(X){let $=X.match(/vimeo\.com\/(\d+)/);return $?$[1]:null}function N0(X){return X.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'")}async function rF(X,$){let Z=await Xq();if(!Z)return H$({...X,process:!1},$);let Y=$.tsVideosConfig,J=await Z.processVideo(X.src,X,Y,X.onProcessProgress);if(J.processed)return Jq(X,J,$);return H$({...X,process:!1},$)}async function sF(X,$){let Z=await Xq();if(!Z||!X.src)return;let Y=typeof X.generatePoster==="object"?X.generatePoster:{timestamp:0},J=$.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Z.generatePoster(X.src,Y,J.outputDir,J.baseUrl||"/videos"))?.url}function Jq(X,$,Z){let{controls:Y=$q,autoplay:J=!1,muted:G=!1,loop:Q=!1,preload:w=Zq,playsinline:W=!0,lazy:q=!0,width:U,height:K,crossorigin:z,disablePictureInPicture:j=!1,disableRemotePlayback:B=!1}=X,_=X.class,H=X.style,O=X.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,L=X.src,F=Yq(L);if($.transcoded)L=$.transcoded.url,F="video/mp4";let V=$.streaming?.hls||$.streaming?.dash;if(V){if($.streaming?.hls)L=$.streaming.hls.manifestUrl,F="application/x-mpegURL";else if($.streaming?.dash)L=$.streaming.dash.manifestUrl,F="application/dash+xml"}let A=$.poster?.url||X.poster,R=[`id="${O}"`];if(Y)R.push("controls");if(J)R.push("autoplay");if(G)R.push("muted");if(Q)R.push("loop");if(W)R.push("playsinline");if(j)R.push("disablepictureinpicture");if(B)R.push("disableremoteplayback");if(z)R.push(`crossorigin="${z}"`);if(q){if(R.push(`data-preload="${w}"`),R.push('preload="none"'),A)R.push(`data-poster="${N0(A)}"`);R.push("data-stx-lazy")}else if(R.push(`preload="${w}"`),A)R.push(`poster="${N0(A)}"`);let M=U||$.metadata?.width,T=K||$.metadata?.height;if(M)R.push(`width="${M}"`);if(T)R.push(`height="${T}"`);if(_)R.push(`class="${N0(_)}"`);if(H)R.push(`style="${N0(H)}"`);let I=` <source ${q?`data-src="${N0(L)}"`:`src="${N0(L)}"`} type="${F}" />`,D=`<video ${R.join(" ")}>
|
|
15057
15057
|
${I}
|
|
15058
15058
|
Your browser does not support the video tag.
|
|
15059
|
-
</video>`;if($.spriteSheet)D=`<div class="stx-video-wrapper" data-sprite-sheet="${
|
|
15059
|
+
</video>`;if($.spriteSheet)D=`<div class="stx-video-wrapper" data-sprite-sheet="${N0($.spriteSheet.url)}" data-sprite-cols="${$.spriteSheet.columns}" data-sprite-interval="${$.spriteSheet.interval}">
|
|
15060
15060
|
${D}
|
|
15061
15061
|
</div>`;let N;if(q)N=`
|
|
15062
15062
|
(function() {
|
|
@@ -15454,9 +15454,9 @@ ${U}
|
|
|
15454
15454
|
}
|
|
15455
15455
|
|
|
15456
15456
|
customElements.define('${$}', ${Q});
|
|
15457
|
-
`}async function Uq(X,$,Z,Y){if($.length<1)return J0("WebComponent","@webcomponent directive requires at least the tag name parameter",
|
|
15457
|
+
`}async function Uq(X,$,Z,Y){if($.length<1)return J0("WebComponent","@webcomponent directive requires at least the tag name parameter",s.INVALID_DIRECTIVE_SYNTAX);let J=$[0].replace(/['"]/g,""),Q=(Z.__stx_options||{}).componentsDir||"components",w=[KX.join(KX.dirname(Y),Q,`${J}.stx`),KX.join(process.cwd(),Q,`${J}.stx`),KX.join(KX.dirname(Y),`${J}.stx`)],W=null;for(let K of w)if(await r(K)){W=await Bun.file(K).text();break}if(!W)return J0("WebComponent",`Component file not found: ${J}.stx`,s.FILE_NOT_FOUND);let q=QV(W,J);return`<script type="module">
|
|
15458
15458
|
${wV(q)}
|
|
15459
|
-
</script>`}var Kq=E(()=>{T1();L0()});var zq={};e(zq,{timingPlugin:()=>zV,pluginManager:()=>WV,definePlugin:()=>L$,debugPlugin:()=>KV,createVariablesPlugin:()=>BV,createFilterPlugin:()=>UV,createDirectivePlugin:()=>qV,PluginManager:()=>H6});function L$(X){return X}class H6{plugins=new Map;sortedPlugins=[];initialized=!1;async register(X,$){if(this.plugins.has(X.name))throw Error(`Plugin "${X.name}" is already registered`);if(X.dependencies){for(let Z of X.dependencies)if(!this.plugins.has(Z))throw Error(`Plugin "${X.name}" depends on "${Z}" which is not registered`)}if(this.plugins.set(X.name,X),X.onRegister)await X.onRegister($);this.sortPlugins()}async unregister(X){let $=this.plugins.get(X);if(!$)return!1;for(let[Z,Y]of this.plugins)if(Y.dependencies?.includes(X))throw Error(`Cannot unregister "${X}" because "${Z}" depends on it`);if($.onUnregister)await $.onUnregister();return this.plugins.delete(X),this.sortPlugins(),!0}get(X){return this.plugins.get(X)}has(X){return this.plugins.has(X)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let X=[];for(let $ of this.sortedPlugins)if($.registerDirectives)X.push(...$.registerDirectives());return X}getAllFilters(){let X={};for(let $ of this.sortedPlugins)if($.registerFilters)Object.assign(X,$.registerFilters());return X}async runBeforeProcess(X){return this.runHooks("beforeProcess",X)}async runAfterParse(X){return this.runHooks("afterParse",X)}async runBeforeDirective(X,$){return this.runDirectiveHooks("beforeDirective",X,$)}async runAfterDirective(X,$){return this.runDirectiveHooks("afterDirective",X,$)}async runBeforeRender(X){return this.runHooks("beforeRender",X)}async runAfterRender(X){return this.runHooks("afterRender",X)}async runOnError(X){for(let $ of this.sortedPlugins)if($.onError)try{let Z=await $.onError(X);if(Z){if(Z.template!==void 0)X.template=Z.template;if(Z.context)X.context={...X.context,...Z.context};if(Z.metadata)X.metadata={...X.metadata,...Z.metadata};if(Z.skip)return X}}catch(Z){console.error(`Error in plugin "${$.name}" onError hook:`,Z)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort((X,$)=>(X.priority??100)-($.priority??100))}async runHooks(X,$){let Z={...$};for(let Y of this.sortedPlugins){let J=Y[X];if(J)try{let G=await J(Z);if(G){if(G.template!==void 0)Z.template=G.template;if(G.context)Z.context={...Z.context,...G.context};if(G.metadata)Z.metadata={...Z.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${Y.name}" ${X} hook:`,G)}}return Z}async runDirectiveHooks(X,$,Z){let Y={...Z};for(let J of this.sortedPlugins){let G=J[X];if(G)try{let Q=await G($,Y);if(Q){if(Q.template!==void 0)Y.template=Q.template;if(Q.context)Y.context={...Y.context,...Q.context};if(Q.metadata)Y.metadata={...Y.metadata,...Q.metadata};if(Q.skip)break}}catch(Q){console.error(`Error in plugin "${J.name}" ${X} hook:`,Q)}}return Y}}function qV(X,$,Z={}){return{name:X,...Z,registerDirectives:()=>$}}function UV(X,$,Z={}){return{name:X,...Z,registerFilters:()=>$}}function BV(X){return L$({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess($){return{context:{...$.context,...X}}}})}var WV,KV,zV;var Bq=E(()=>{WV=new H6;KV=L$({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess(X){console.log("[stx-debug] beforeProcess:",X.filePath)},afterParse(X){console.log("[stx-debug] afterParse:",X.template.length,"chars")},beforeDirective(X,$){console.log("[stx-debug] beforeDirective:",X)},afterDirective(X,$){console.log("[stx-debug] afterDirective:",X)},beforeRender(X){console.log("[stx-debug] beforeRender")},afterRender(X){console.log("[stx-debug] afterRender:",X.template.length,"chars")},onError(X){console.error("[stx-debug] onError:",X.error.message,"in phase:",X.phase)}}),zV=L$({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess(X){X.metadata.startTime=performance.now()},afterRender(X){let $=X.metadata.startTime;if($){let Z=performance.now()-$;console.log(`[stx-timing] Processing took ${Z.toFixed(2)}ms`)}}})});var lZ={};e(lZ,{validateConfig:()=>VV,resolveStxDirectories:()=>Hq,loadStxConfig:()=>p1,defineStxConfig:()=>FV,defaultConfig:()=>I1,config:()=>v7});import O$ from"fs";import s0 from"path";import{loadConfigWithResult as jV}from"bunfig";function _V(X,$,Z){let Y=$||"pages";if(X)return{root:X,pagesDir:Y};let J=Z||process.cwd(),G=s0.join(J,"resources","views"),Q=s0.join(J,"resources","layouts");if(O$.existsSync(G)&&O$.existsSync(Q))return{root:"resources",pagesDir:"views"};let w=s0.join(J,"resources","views","pages");if(O$.existsSync(w))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function HV(X,$){let Z=$.replace(/[\\/]+$/,"");if(!Z||Z===".")return!0;let Y=X.replace(/\\/g,"/"),J=Z.replace(/\\/g,"/");return Y===J||Y.startsWith(`${J}/`)}function Hq(X,$){let Z=!X.root,Y=_V(X.root,X.pagesDir,$);if(X.root=Y.root,X.pagesDir=Y.pagesDir,Z&&Y.root!=="."){let J=`${$}::${Y.root}`;if(!jq.has(J))jq.add(J),console.warn(`[stx] No "root" in config \u2014 inferred "${Y.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(X.root&&X.root!=="."){let J=X.root;for(let G of["partialsDir","componentsDir","layoutsDir"]){let Q=X[G];if(typeof Q!=="string"||!Q)continue;if(s0.isAbsolute(Q)||HV(Q,J))continue;X[G]=s0.join(J,Q)}}return X}function LV(X,$){let Z=["componentsDir","layoutsDir","partialsDir"];for(let Y of Z){let J=X[Y];if(typeof J!=="string"||!J)continue;let G=s0.isAbsolute(J)?J:s0.join($,J);if(O$.existsSync(G))continue;let Q=X.root,w=!!Q&&Q!==".";console.warn(`[stx] ${String(Y)} resolves to "${G}", which does not exist. Configured as "${J}"`+(w?`, resolved under root "${Q}".`:"."))}}function OV(X){if(u2(X.stateDir),X.stateDir=y7(),X.cachePath=S7(X.cachePath),X.build)X.build.cacheDir=S7(X.build.cacheDir);if(X.media?.cache)X.media.cache.directory=S7(X.media.cache.directory);if(X.story)X.story.outDir=S7(X.story.outDir)}async function p1(X){if(!X){if(z7)return z7;if(F$)return F$}let $=X?s0.resolve(X):process.cwd(),Z=_q.get($);if(Z)return Z;let Y=(async()=>{let G=(await jV({name:"stx",alias:"ui",cwd:$,defaultConfig:I1,verbose:!1})).config;if(OV(G),Hq(G,$),LV(G,$),G.plugins&&G.plugins.length>0){let{pluginManager:Q}=await Promise.resolve().then(() => (Bq(),zq)),w=[],W=[];for(let q of G.plugins){let U=typeof q==="string"?q:q[0],K=typeof q==="string"?{}:q[1]||{};try{let z,j;try{z=await import(U),j=s0.dirname(Z0.resolve(U))}catch{let _=s0.resolve(process.cwd(),U);z=await import(_),j=s0.dirname(_)}let B=z.default||z;if(Q.register(B,G),B.components){let _=Array.isArray(B.components)?B.components:[B.components];for(let H of _)w.push(s0.resolve(j,H))}if(B.pages){let _=s0.resolve(j,B.pages),H=K.path||"/";W.push({dir:_,prefix:H})}if(B.setup){let _={addDirective:(H)=>{G.customDirectives=G.customDirectives||[],G.customDirectives.push(H)},addRoute:(H,O)=>{G.apiRoutes=G.apiRoutes||{},G.apiRoutes[H]=O},addMiddleware:(H)=>{G.middleware=G.middleware||[],G.middleware.push(H)},pluginDir:j,config:G};await B.setup(K,_)}console.log(`[stx] Plugin loaded: ${B.name||U}`)}catch(z){console.warn(`[stx] Failed to load plugin ${U}:`,z.message)}}G._pluginComponentDirs=w,G._pluginPageDirs=W}return G})();if(_q.set($,Y),!X)F$=Y,Y.then((J)=>{z7=J}).catch(()=>{});return Y}function FV(X){return X}function VV(X){let $=[],Z=[];if(X.partialsDir!==void 0&&typeof X.partialsDir!=="string")$.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(X.componentsDir!==void 0&&typeof X.componentsDir!=="string")$.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(X.cache!==void 0&&typeof X.cache!=="boolean")$.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(X.debug!==void 0&&typeof X.debug!=="boolean")$.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(X.streaming){if(X.streaming.bufferSize!==void 0){if(typeof X.streaming.bufferSize!=="number"||X.streaming.bufferSize<=0)$.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(X.streaming.timeout!==void 0){if(typeof X.streaming.timeout!=="number"||X.streaming.timeout<=0)$.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(X.streaming.strategy!==void 0){let Y=["auto","manual","sections"];if(!Y.includes(X.streaming.strategy))$.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.i18n){if(X.i18n.format!==void 0){let Y=["json","yaml","yml","js"];if(!Y.includes(X.i18n.format))$.push({path:"i18n.format",message:`i18n.format must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.animation){if(X.animation.defaultDuration!==void 0){if(typeof X.animation.defaultDuration!=="number"||X.animation.defaultDuration<0)$.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(X.animation.staggerDelay!==void 0){if(typeof X.animation.staggerDelay!=="number"||X.animation.staggerDelay<0)$.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(X.a11y){if(X.a11y.level!==void 0){let Y=["AA","AAA"];if(!Y.includes(X.a11y.level))$.push({path:"a11y.level",message:`a11y.level must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.hydration){if(X.hydration.mode!==void 0){let Y=["progressive","islands"];if(!Y.includes(X.hydration.mode))$.push({path:"hydration.mode",message:`hydration.mode must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.hydration.preload!==void 0){let Y=["none","eager","lazy"];if(!Y.includes(X.hydration.preload))$.push({path:"hydration.preload",message:`hydration.preload must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.customDirectives)if(!Array.isArray(X.customDirectives))$.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else X.customDirectives.forEach((Y,J)=>{if(!Y.name||typeof Y.name!=="string")$.push({path:`customDirectives[${J}].name`,message:"Custom directive must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")$.push({path:`customDirectives[${J}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(X.middleware)if(!Array.isArray(X.middleware))$.push({path:"middleware",message:"middleware must be an array",severity:"error"});else X.middleware.forEach((Y,J)=>{if(!Y.name||typeof Y.name!=="string")$.push({path:`middleware[${J}].name`,message:"Middleware must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")$.push({path:`middleware[${J}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!Y.timing||!["before","after"].includes(Y.timing))$.push({path:`middleware[${J}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(X.debug===!0&&X.cache===!0)Z.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(X.seo?.enabled===!0&&!X.seo?.defaultConfig?.title)Z.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(X.pwa){if(X.pwa.enabled===!0&&!X.pwa.manifest?.name)$.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(X.pwa.manifest?.display!==void 0){let Y=["fullscreen","standalone","minimal-ui","browser"];if(!Y.includes(X.pwa.manifest.display))$.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.pwa.manifest?.orientation!==void 0){let Y=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!Y.includes(X.pwa.manifest.orientation))$.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.pwa.routes){let Y=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];X.pwa.routes.forEach((J,G)=>{if(!J.pattern||typeof J.pattern!=="string")$.push({path:`pwa.routes[${G}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!Y.includes(J.strategy))$.push({path:`pwa.routes[${G}].strategy`,message:`PWA route strategy must be one of: ${Y.join(", ")}`,severity:"error"});if(J.maxAgeSeconds!==void 0&&(typeof J.maxAgeSeconds!=="number"||J.maxAgeSeconds<0))$.push({path:`pwa.routes[${G}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(J.maxEntries!==void 0&&(typeof J.maxEntries!=="number"||J.maxEntries<1))$.push({path:`pwa.routes[${G}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(X.pwa.icons?.sizes){if(!Array.isArray(X.pwa.icons.sizes))$.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(X.pwa.icons.sizes.filter((J)=>typeof J!=="number"||J<16||J>1024).length>0)$.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(X.pwa.icons?.purpose){let Y=["any","maskable","monochrome"];if(X.pwa.icons.purpose.filter((G)=>!Y.includes(G)).length>0)$.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.pwa.enabled===!0&&!X.pwa.icons?.src)Z.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if(X.pwa.enabled===!0&&!X.pwa.manifest?.themeColor)Z.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:$.length===0,errors:$,warnings:Z}}var I1,jq,z7=null,_q,F$=null,v7;var A1=E(()=>{I$();E$();i$();n$();P3();fW();_6();qq();g4();EX();Kq();I1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:S5,cachePath:".stx/cache",cacheVersion:"1.0.0",build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:qW,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:Uq,hasEndTag:!1,description:"Include a web component in the template"},p6,i6,_G,HG,n6,s6,o6,r6,V2,M2,xW,j6,...Wq],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};jq=new Set;_q=new Map;v7=new Proxy(I1,{get(X,$){if(z7&&$ in z7)return z7[$];if(!F$)p1().catch((Z)=>{console.warn("[stx] Failed to load config file:",Z?.message||Z)});return X[$]}})});var mV=`
|
|
15459
|
+
</script>`}var Kq=E(()=>{T1();H0()});var zq={};a(zq,{timingPlugin:()=>zV,pluginManager:()=>WV,definePlugin:()=>L$,debugPlugin:()=>KV,createVariablesPlugin:()=>BV,createFilterPlugin:()=>UV,createDirectivePlugin:()=>qV,PluginManager:()=>H6});function L$(X){return X}class H6{plugins=new Map;sortedPlugins=[];initialized=!1;async register(X,$){if(this.plugins.has(X.name))throw Error(`Plugin "${X.name}" is already registered`);if(X.dependencies){for(let Z of X.dependencies)if(!this.plugins.has(Z))throw Error(`Plugin "${X.name}" depends on "${Z}" which is not registered`)}if(this.plugins.set(X.name,X),X.onRegister)await X.onRegister($);this.sortPlugins()}async unregister(X){let $=this.plugins.get(X);if(!$)return!1;for(let[Z,Y]of this.plugins)if(Y.dependencies?.includes(X))throw Error(`Cannot unregister "${X}" because "${Z}" depends on it`);if($.onUnregister)await $.onUnregister();return this.plugins.delete(X),this.sortPlugins(),!0}get(X){return this.plugins.get(X)}has(X){return this.plugins.has(X)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let X=[];for(let $ of this.sortedPlugins)if($.registerDirectives)X.push(...$.registerDirectives());return X}getAllFilters(){let X={};for(let $ of this.sortedPlugins)if($.registerFilters)Object.assign(X,$.registerFilters());return X}async runBeforeProcess(X){return this.runHooks("beforeProcess",X)}async runAfterParse(X){return this.runHooks("afterParse",X)}async runBeforeDirective(X,$){return this.runDirectiveHooks("beforeDirective",X,$)}async runAfterDirective(X,$){return this.runDirectiveHooks("afterDirective",X,$)}async runBeforeRender(X){return this.runHooks("beforeRender",X)}async runAfterRender(X){return this.runHooks("afterRender",X)}async runOnError(X){for(let $ of this.sortedPlugins)if($.onError)try{let Z=await $.onError(X);if(Z){if(Z.template!==void 0)X.template=Z.template;if(Z.context)X.context={...X.context,...Z.context};if(Z.metadata)X.metadata={...X.metadata,...Z.metadata};if(Z.skip)return X}}catch(Z){console.error(`Error in plugin "${$.name}" onError hook:`,Z)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort((X,$)=>(X.priority??100)-($.priority??100))}async runHooks(X,$){let Z={...$};for(let Y of this.sortedPlugins){let J=Y[X];if(J)try{let G=await J(Z);if(G){if(G.template!==void 0)Z.template=G.template;if(G.context)Z.context={...Z.context,...G.context};if(G.metadata)Z.metadata={...Z.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${Y.name}" ${X} hook:`,G)}}return Z}async runDirectiveHooks(X,$,Z){let Y={...Z};for(let J of this.sortedPlugins){let G=J[X];if(G)try{let Q=await G($,Y);if(Q){if(Q.template!==void 0)Y.template=Q.template;if(Q.context)Y.context={...Y.context,...Q.context};if(Q.metadata)Y.metadata={...Y.metadata,...Q.metadata};if(Q.skip)break}}catch(Q){console.error(`Error in plugin "${J.name}" ${X} hook:`,Q)}}return Y}}function qV(X,$,Z={}){return{name:X,...Z,registerDirectives:()=>$}}function UV(X,$,Z={}){return{name:X,...Z,registerFilters:()=>$}}function BV(X){return L$({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess($){return{context:{...$.context,...X}}}})}var WV,KV,zV;var Bq=E(()=>{WV=new H6;KV=L$({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess(X){console.log("[stx-debug] beforeProcess:",X.filePath)},afterParse(X){console.log("[stx-debug] afterParse:",X.template.length,"chars")},beforeDirective(X,$){console.log("[stx-debug] beforeDirective:",X)},afterDirective(X,$){console.log("[stx-debug] afterDirective:",X)},beforeRender(X){console.log("[stx-debug] beforeRender")},afterRender(X){console.log("[stx-debug] afterRender:",X.template.length,"chars")},onError(X){console.error("[stx-debug] onError:",X.error.message,"in phase:",X.phase)}}),zV=L$({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess(X){X.metadata.startTime=performance.now()},afterRender(X){let $=X.metadata.startTime;if($){let Z=performance.now()-$;console.log(`[stx-timing] Processing took ${Z.toFixed(2)}ms`)}}})});var lZ={};a(lZ,{validateConfig:()=>VV,resolveStxDirectories:()=>Hq,loadStxConfig:()=>i1,defineStxConfig:()=>FV,defaultConfig:()=>I1,config:()=>v7});import O$ from"fs";import r0 from"path";import{loadConfigWithResult as jV}from"bunfig";function _V(X,$,Z){let Y=$||"pages";if(X)return{root:X,pagesDir:Y};let J=Z||process.cwd(),G=r0.join(J,"resources","views"),Q=r0.join(J,"resources","layouts");if(O$.existsSync(G)&&O$.existsSync(Q))return{root:"resources",pagesDir:"views"};let w=r0.join(J,"resources","views","pages");if(O$.existsSync(w))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function HV(X,$){let Z=$.replace(/[\\/]+$/,"");if(!Z||Z===".")return!0;let Y=X.replace(/\\/g,"/"),J=Z.replace(/\\/g,"/");return Y===J||Y.startsWith(`${J}/`)}function Hq(X,$){let Z=!X.root,Y=_V(X.root,X.pagesDir,$);if(X.root=Y.root,X.pagesDir=Y.pagesDir,Z&&Y.root!=="."){let J=`${$}::${Y.root}`;if(!jq.has(J))jq.add(J),console.warn(`[stx] No "root" in config \u2014 inferred "${Y.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(X.root&&X.root!=="."){let J=X.root;for(let G of["partialsDir","componentsDir","layoutsDir"]){let Q=X[G];if(typeof Q!=="string"||!Q)continue;if(r0.isAbsolute(Q)||HV(Q,J))continue;X[G]=r0.join(J,Q)}}return X}function LV(X,$){let Z=["componentsDir","layoutsDir","partialsDir"];for(let Y of Z){let J=X[Y];if(typeof J!=="string"||!J)continue;let G=r0.isAbsolute(J)?J:r0.join($,J);if(O$.existsSync(G))continue;let Q=X.root,w=!!Q&&Q!==".";console.warn(`[stx] ${String(Y)} resolves to "${G}", which does not exist. Configured as "${J}"`+(w?`, resolved under root "${Q}".`:"."))}}function OV(X){if(u2(X.stateDir),X.stateDir=y7(),X.cachePath=S7(X.cachePath),X.build)X.build.cacheDir=S7(X.build.cacheDir);if(X.media?.cache)X.media.cache.directory=S7(X.media.cache.directory);if(X.story)X.story.outDir=S7(X.story.outDir)}async function i1(X){if(!X){if(K7)return K7;if(F$)return F$}let $=X?r0.resolve(X):process.cwd(),Z=_q.get($);if(Z)return Z;let Y=(async()=>{let G=(await jV({name:"stx",alias:"ui",cwd:$,defaultConfig:I1,verbose:!1})).config;if(OV(G),Hq(G,$),LV(G,$),G.plugins&&G.plugins.length>0){let{pluginManager:Q}=await Promise.resolve().then(() => (Bq(),zq)),w=[],W=[];for(let q of G.plugins){let U=typeof q==="string"?q:q[0],K=typeof q==="string"?{}:q[1]||{};try{let z,j;try{z=await import(U),j=r0.dirname(Z0.resolve(U))}catch{let _=r0.resolve(process.cwd(),U);z=await import(_),j=r0.dirname(_)}let B=z.default||z;if(Q.register(B,G),B.components){let _=Array.isArray(B.components)?B.components:[B.components];for(let H of _)w.push(r0.resolve(j,H))}if(B.pages){let _=r0.resolve(j,B.pages),H=K.path||"/";W.push({dir:_,prefix:H})}if(B.setup){let _={addDirective:(H)=>{G.customDirectives=G.customDirectives||[],G.customDirectives.push(H)},addRoute:(H,O)=>{G.apiRoutes=G.apiRoutes||{},G.apiRoutes[H]=O},addMiddleware:(H)=>{G.middleware=G.middleware||[],G.middleware.push(H)},pluginDir:j,config:G};await B.setup(K,_)}console.log(`[stx] Plugin loaded: ${B.name||U}`)}catch(z){console.warn(`[stx] Failed to load plugin ${U}:`,z.message)}}G._pluginComponentDirs=w,G._pluginPageDirs=W}return G})();if(_q.set($,Y),!X)F$=Y,Y.then((J)=>{K7=J}).catch(()=>{});return Y}function FV(X){return X}function VV(X){let $=[],Z=[];if(X.partialsDir!==void 0&&typeof X.partialsDir!=="string")$.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(X.componentsDir!==void 0&&typeof X.componentsDir!=="string")$.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(X.cache!==void 0&&typeof X.cache!=="boolean")$.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(X.debug!==void 0&&typeof X.debug!=="boolean")$.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(X.streaming){if(X.streaming.bufferSize!==void 0){if(typeof X.streaming.bufferSize!=="number"||X.streaming.bufferSize<=0)$.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(X.streaming.timeout!==void 0){if(typeof X.streaming.timeout!=="number"||X.streaming.timeout<=0)$.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(X.streaming.strategy!==void 0){let Y=["auto","manual","sections"];if(!Y.includes(X.streaming.strategy))$.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.i18n){if(X.i18n.format!==void 0){let Y=["json","yaml","yml","js"];if(!Y.includes(X.i18n.format))$.push({path:"i18n.format",message:`i18n.format must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.animation){if(X.animation.defaultDuration!==void 0){if(typeof X.animation.defaultDuration!=="number"||X.animation.defaultDuration<0)$.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(X.animation.staggerDelay!==void 0){if(typeof X.animation.staggerDelay!=="number"||X.animation.staggerDelay<0)$.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(X.a11y){if(X.a11y.level!==void 0){let Y=["AA","AAA"];if(!Y.includes(X.a11y.level))$.push({path:"a11y.level",message:`a11y.level must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.hydration){if(X.hydration.mode!==void 0){let Y=["progressive","islands"];if(!Y.includes(X.hydration.mode))$.push({path:"hydration.mode",message:`hydration.mode must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.hydration.preload!==void 0){let Y=["none","eager","lazy"];if(!Y.includes(X.hydration.preload))$.push({path:"hydration.preload",message:`hydration.preload must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.customDirectives)if(!Array.isArray(X.customDirectives))$.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else X.customDirectives.forEach((Y,J)=>{if(!Y.name||typeof Y.name!=="string")$.push({path:`customDirectives[${J}].name`,message:"Custom directive must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")$.push({path:`customDirectives[${J}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(X.middleware)if(!Array.isArray(X.middleware))$.push({path:"middleware",message:"middleware must be an array",severity:"error"});else X.middleware.forEach((Y,J)=>{if(!Y.name||typeof Y.name!=="string")$.push({path:`middleware[${J}].name`,message:"Middleware must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")$.push({path:`middleware[${J}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!Y.timing||!["before","after"].includes(Y.timing))$.push({path:`middleware[${J}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(X.debug===!0&&X.cache===!0)Z.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(X.seo?.enabled===!0&&!X.seo?.defaultConfig?.title)Z.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(X.pwa){if(X.pwa.enabled===!0&&!X.pwa.manifest?.name)$.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(X.pwa.manifest?.display!==void 0){let Y=["fullscreen","standalone","minimal-ui","browser"];if(!Y.includes(X.pwa.manifest.display))$.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.pwa.manifest?.orientation!==void 0){let Y=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!Y.includes(X.pwa.manifest.orientation))$.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.pwa.routes){let Y=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];X.pwa.routes.forEach((J,G)=>{if(!J.pattern||typeof J.pattern!=="string")$.push({path:`pwa.routes[${G}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!Y.includes(J.strategy))$.push({path:`pwa.routes[${G}].strategy`,message:`PWA route strategy must be one of: ${Y.join(", ")}`,severity:"error"});if(J.maxAgeSeconds!==void 0&&(typeof J.maxAgeSeconds!=="number"||J.maxAgeSeconds<0))$.push({path:`pwa.routes[${G}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(J.maxEntries!==void 0&&(typeof J.maxEntries!=="number"||J.maxEntries<1))$.push({path:`pwa.routes[${G}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(X.pwa.icons?.sizes){if(!Array.isArray(X.pwa.icons.sizes))$.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(X.pwa.icons.sizes.filter((J)=>typeof J!=="number"||J<16||J>1024).length>0)$.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(X.pwa.icons?.purpose){let Y=["any","maskable","monochrome"];if(X.pwa.icons.purpose.filter((G)=>!Y.includes(G)).length>0)$.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.pwa.enabled===!0&&!X.pwa.icons?.src)Z.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if(X.pwa.enabled===!0&&!X.pwa.manifest?.themeColor)Z.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:$.length===0,errors:$,warnings:Z}}var I1,jq,K7=null,_q,F$=null,v7;var A1=E(()=>{I$();E$();i$();n$();P3();fW();_6();qq();g4();EX();Kq();I1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:b5,cachePath:".stx/cache",cacheVersion:"1.0.0",build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:qW,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:Uq,hasEndTag:!1,description:"Include a web component in the template"},p6,i6,_G,HG,n6,s6,o6,r6,V2,M2,xW,j6,...Wq],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};jq=new Set;_q=new Map;v7=new Proxy(I1,{get(X,$){if(K7&&$ in K7)return K7[$];if(!F$)i1().catch((Z)=>{console.warn("[stx] Failed to load config file:",Z?.message||Z)});return X[$]}})});var mV=`
|
|
15460
15460
|
<script>
|
|
15461
15461
|
(function() {
|
|
15462
15462
|
'use strict';
|
|
@@ -18396,35 +18396,35 @@ ${Z} `)}]`:"";return`Craft.create("${X.zigType}", ${J}${Q})`}function lq(X,$,
|
|
|
18396
18396
|
document.addEventListener('craft:nativeui:ready', initializeCraftComponents);
|
|
18397
18397
|
})();
|
|
18398
18398
|
</script>
|
|
18399
|
-
`;return X=X.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(Y,J,G)=>{return _X("sidebar",J,G.trim(),$,Z)}),X=X.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(Y,J)=>{return _X("sidebar",J,"",$,Z)}),X=X.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(Y,J,G)=>{return _X(J,G,"",$,Z)}),X=X.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(Y,J,G,Q)=>{return _X(J,G,Q.trim(),$,Z)}),X}function _X(X,$,Z,Y,J){let G=Y.components?.[X]||k$[X];if(!G)return console.warn(`[stx] Unknown Craft component: @craft-${X}`),`<div class="${J}-unknown" data-component="${X}">${Z}</div>`;let Q=HX($),w=[G.fallbackClasses||`${J}-${X}`];if(Q.class)w.push(Q.class),delete Q.class;if(G.render)return Q.__fallbackClasses=w.join(" "),G.render(Q,Z);let W=wU(Q,G,w);if(["input","hr","br","img"].includes(G.fallbackTag))return`<${G.fallbackTag} ${W}>`;return`<${G.fallbackTag} ${W}>${Z}</${G.fallbackTag}>`}function HX(X){let $={},Z=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,Y;while((Y=Z.exec(X))!==null){let[J,G,Q,w]=Y,W=Q??w;if(J.startsWith(":"))$[G]=W;else if(J.startsWith("@"))$[`on${G.charAt(0).toUpperCase()}${G.slice(1)}`]=W;else if(W===void 0)$[G]=!0;else $[G]=W}return $}function oq(X,$){let Z=
|
|
18399
|
+
`;return X=X.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(Y,J,G)=>{return _X("sidebar",J,G.trim(),$,Z)}),X=X.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(Y,J)=>{return _X("sidebar",J,"",$,Z)}),X=X.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(Y,J,G)=>{return _X(J,G,"",$,Z)}),X=X.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(Y,J,G,Q)=>{return _X(J,G,Q.trim(),$,Z)}),X}function _X(X,$,Z,Y,J){let G=Y.components?.[X]||k$[X];if(!G)return console.warn(`[stx] Unknown Craft component: @craft-${X}`),`<div class="${J}-unknown" data-component="${X}">${Z}</div>`;let Q=HX($),w=[G.fallbackClasses||`${J}-${X}`];if(Q.class)w.push(Q.class),delete Q.class;if(G.render)return Q.__fallbackClasses=w.join(" "),G.render(Q,Z);let W=wU(Q,G,w);if(["input","hr","br","img"].includes(G.fallbackTag))return`<${G.fallbackTag} ${W}>`;return`<${G.fallbackTag} ${W}>${Z}</${G.fallbackTag}>`}function HX(X){let $={},Z=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,Y;while((Y=Z.exec(X))!==null){let[J,G,Q,w]=Y,W=Q??w;if(J.startsWith(":"))$[G]=W;else if(J.startsWith("@"))$[`on${G.charAt(0).toUpperCase()}${G.slice(1)}`]=W;else if(W===void 0)$[G]=!0;else $[G]=W}return $}function oq(X,$){let Z=T5(String(X.id||`craft-sidebar-${GU($||JSON.stringify(X))}`)),Y=ZU(X.spaces)||$U($),J=Y.length?[]:JU(X.sections)||C6($),G=String(X.selectedSpace||Y[0]?.id||""),Q=Y.find((B)=>B.id===G)||Y[0],w=String(X.selectedItem||X.selected||(Y.length?Q?.sections[0]?.items[0]?.id:J[0]?.items[0]?.id)||""),W={id:Z,variant:String(X.variant||"desktop"),material:String(X.material||"sidebar"),backgroundEffect:String(X.backgroundEffect||"shimmer"),allowsVibrancy:X.allowsVibrancy!==!1&&X.allowsVibrancy!=="false",materialOpacity:Number(X.materialOpacity??0.68),materialDarkOpacity:X.materialDarkOpacity===void 0?void 0:Number(X.materialDarkOpacity),minWidth:X.minWidth===void 0?240:Number(X.minWidth),maxWidth:X.maxWidth===void 0?340:Number(X.maxWidth),canCollapse:X.canCollapse!==!1&&X.canCollapse!=="false",searchPlaceholder:X.searchPlaceholder?String(X.searchPlaceholder):void 0,selectedItem:w,sections:J,spaces:Y,selectedSpace:G||void 0},q=String(X.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),U=Number(X.width||X.sidebarWidth||286),K=X.native===!1||X.native==="false"?"false":"true",z=W.searchPlaceholder?`<div class="craft-sidebar-search"><input type="search" placeholder="${O1(W.searchPlaceholder)}"></div>`:"",j;if(Y.length)j=YU(Y,G,w);else if(J.length)j=J.map((B)=>P6(B,w)).join("");else j=$;return`<aside class="${c0(q)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${c0(Z)}" data-native="${K}" style="--craft-sidebar-width:${U}px">
|
|
18400
18400
|
${z}
|
|
18401
18401
|
${j}
|
|
18402
18402
|
</aside>
|
|
18403
|
-
<script type="application/json" data-craft-sidebar-config="${
|
|
18403
|
+
<script type="application/json" data-craft-sidebar-config="${c0(Z)}">${QU(W)}</script>`}function aq(X,$){let Z=T5(String(X.id||X.label||"space"));return`<section class="craft-sidebar-space" data-craft="craft-sidebar-space" data-space-id="${c0(Z)}">
|
|
18404
18404
|
${X.label?`<div class="craft-sidebar-space-title">${O1(String(X.label))}</div>`:""}
|
|
18405
18405
|
${$}
|
|
18406
|
-
</section>`}function tq(X,$){let Z=String(X.header||X.title||"");return`<section class="craft-sidebar-section" data-craft="craft-sidebar-section" data-section-id="${
|
|
18406
|
+
</section>`}function tq(X,$){let Z=String(X.header||X.title||"");return`<section class="craft-sidebar-section" data-craft="craft-sidebar-section" data-section-id="${c0(String(X.id||"section"))}">
|
|
18407
18407
|
${Z?`<div class="craft-sidebar-section-title">${O1(Z)}</div>`:""}
|
|
18408
18408
|
${$}
|
|
18409
|
-
</section>`}function eq(X,$){let Z={id:String(X.id||
|
|
18409
|
+
</section>`}function eq(X,$){let Z={id:String(X.id||T5(String(X.label||$||"item"))),label:String(X.label||$||""),icon:X.icon?String(X.icon):void 0,badge:X.badge?String(X.badge):void 0,tintColor:X.tintColor?String(X.tintColor):void 0};return v6(Z,String(X.selected||"")==="true")}function C6(X){let $=[],Z=/<@craft-sidebar-section\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-section>)/g,Y;while((Y=Z.exec(X))!==null){let J=HX(Y[1]||""),G=Y[2]||"",Q=String(J.id||T5(String(J.header||J.title||`section-${$.length+1}`))),w=String(J.header||J.title||Q),W=XU(G);$.push({id:Q,header:w,title:w,items:W})}return $}function XU(X){let $=[],Z=/<@craft-sidebar-item\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-item>)/g,Y;while((Y=Z.exec(X))!==null){let J=HX(Y[1]||""),G=String(J.label||(Y[2]||"").replace(/<[^>]*>/g,"").trim()),Q=String(J.id||T5(G||`item-${$.length+1}`));$.push({id:Q,label:G,icon:J.icon?String(J.icon):void 0,badge:J.badge?String(J.badge):void 0,tintColor:J.tintColor?String(J.tintColor):void 0})}return $}function $U(X){let $=[],Z=/<@craft-sidebar-space\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-space>)/g,Y;while((Y=Z.exec(X))!==null){let J=HX(Y[1]||""),G=Y[2]||"",Q=String(J.label||J.title||`Space ${$.length+1}`);$.push({id:String(J.id||T5(Q)),label:Q,icon:J.icon?String(J.icon):void 0,tint:J.tint?String(J.tint):void 0,sections:C6(G)})}return $}function ZU(X){if(!X)return;if(Array.isArray(X))return X;if(typeof X!=="string")return;try{let $=JSON.parse(X);return Array.isArray($)?$:void 0}catch{return}}function YU(X,$,Z){let Y=X.map((G)=>`<button class="craft-sidebar-space-tab" type="button" data-space-target="${c0(G.id)}" data-selected="${G.id===$?"true":"false"}" title="${c0(G.label||G.id)}">${G.icon?`<span class="craft-sidebar-item-icon" data-icon="${c0(G.icon)}"></span>`:O1((G.label||G.id).charAt(0))}</button>`).join("");return`<div class="craft-sidebar-spaces">${X.map((G)=>`<section class="craft-sidebar-space" data-space-id="${c0(G.id)}" data-selected="${G.id===$?"true":"false"}">
|
|
18410
18410
|
${G.label?`<div class="craft-sidebar-space-title">${O1(G.label)}</div>`:""}
|
|
18411
18411
|
${G.sections.map((Q)=>P6(Q,Z)).join("")}
|
|
18412
18412
|
</section>`).join("")}</div>
|
|
18413
|
-
<div class="craft-sidebar-space-switcher">${Y}</div>`}function JU(X){if(!X)return;if(Array.isArray(X))return X;if(typeof X!=="string")return;try{let $=JSON.parse(X);return Array.isArray($)?$:void 0}catch{return}}function P6(X,$){let Z=X.header||X.title||X.id;return`<section class="craft-sidebar-section" data-section-id="${
|
|
18413
|
+
<div class="craft-sidebar-space-switcher">${Y}</div>`}function JU(X){if(!X)return;if(Array.isArray(X))return X;if(typeof X!=="string")return;try{let $=JSON.parse(X);return Array.isArray($)?$:void 0}catch{return}}function P6(X,$){let Z=X.header||X.title||X.id;return`<section class="craft-sidebar-section" data-section-id="${c0(X.id)}">
|
|
18414
18414
|
<div class="craft-sidebar-section-title">${O1(Z)}</div>
|
|
18415
18415
|
${X.items.map((Y)=>v6(Y,Y.id===$)).join("")}
|
|
18416
|
-
</section>`}function v6(X,$){let Z=X.tintColor?` style="--craft-sidebar-icon-color:${
|
|
18417
|
-
${X.icon?`<span class="craft-sidebar-item-icon" data-icon="${
|
|
18416
|
+
</section>`}function v6(X,$){let Z=X.tintColor?` style="--craft-sidebar-icon-color:${c0(X.tintColor)}"`:"";return`<button class="craft-sidebar-item" type="button" data-item-id="${c0(X.id)}" data-selected="${$?"true":"false"}">
|
|
18417
|
+
${X.icon?`<span class="craft-sidebar-item-icon" data-icon="${c0(X.icon)}"${Z}></span>`:""}
|
|
18418
18418
|
<span class="craft-sidebar-item-label">${O1(X.label)}</span>
|
|
18419
18419
|
${X.badge?`<span class="craft-sidebar-item-badge">${O1(X.badge)}</span>`:""}
|
|
18420
|
-
</button>`}function
|
|
18420
|
+
</button>`}function T5(X){return X.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function GU(X){let $=5381;for(let Z=0;Z<X.length;Z++)$=$*33^X.charCodeAt(Z);return($>>>0).toString(36)}function O1(X){return X.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function c0(X){return O1(X).replace(/`/g,"`")}function QU(X){return JSON.stringify(X).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function wU(X,$,Z){let Y=[];Y.push(`class="${Z.join(" ")}"`),Y.push(`data-craft="${$.nativeType}"`);for(let[J,G]of Object.entries(X))if(G===!0)Y.push(J);else if(G!==!1&&G!==void 0&&G!==null){let Q=String(G).replace(/"/g,""");Y.push(`${J}="${Q}"`)}return Y.join(" ")}function oV(X,$){k$[X]=$}function aV(){return{...k$}}var j7=new Map,_7=new Map;function WU(X,$){let Z=$?.id||VU(X),Y=AU(X),J=j7.get(Z);if(J&&J.hash===Y)return J;let G=qU(X),Q=HU(X),w=LU(X),W=jU(G),{staticParts:q,dynamicParts:U}=_U(G),K=OU(X),z={id:Z,hash:Y,tree:G,scripts:Q,styles:w,staticParts:q,dynamicParts:U,dependencies:K,metadata:W};return j7.set(Z,z),z}async function eV(X,$={},Z={}){let Y=performance.now();if(Z.cache){let w=`${X.id}:${JSON.stringify($)}`,W=_7.get(w);if(W&&Date.now()-W.timestamp<(Z.cacheTTL||60000))return{html:W.html,styles:X.styles.join(`
|
|
18421
18421
|
`),scripts:X.scripts.join(`
|
|
18422
18422
|
`),metadata:{renderTime:0,cacheHit:!0,totalSize:W.html.length,componentCount:X.metadata.componentCount}}}let J;if(Z.streaming)J=await KU(X.tree,$);else J=H7(X.tree,$);let G;if(Z.hydrate){let w=BU(J,X,$);J=w.html,G=w.data}if(Z.minify)J=FU(J);if(Z.cache){let w=`${X.id}:${JSON.stringify($)}`;_7.set(w,{html:J,timestamp:Date.now()})}let Q=performance.now()-Y;return{html:J,styles:X.styles.join(`
|
|
18423
18423
|
`),scripts:X.scripts.join(`
|
|
18424
18424
|
`),hydrationData:G,metadata:{renderTime:Q,cacheHit:!1,totalSize:J.length,componentCount:X.metadata.componentCount}}}function XA(X,$){let Z=[],Y=[],J=[],G=new Map,Q=[];return L7(X.tree,(w,W)=>{if(w.type==="component"&&w.componentName){if(m6(w.componentName))Z.push(w.componentName)}if(w.type==="element"&&w.tag){let q=TU(w);if(q)Q.push(q);if(w.props){for(let[U,K]of Object.entries(w.props))if(U.startsWith("on")&&typeof K==="string"){let z=`handler_${G.size}`;G.set(z,K)}}}if(w.isStatic&&w.type==="element")Y.push(g6(w));else if(!w.isStatic&&w.type!=="text")J.push(w.tag||w.componentName||"unknown")}),{nativeComponents:Z,staticHTML:Y,dynamicParts:J,eventHandlers:G,nativeWidgets:Q}}function $A(X,$={}){let Z=WU(X),Y=zU(Z,$),J=new Map,G=[];return L7(Z.tree,(Q)=>{if(Q.type==="component"&&Q.componentName){if(m6(Q.componentName)){G.push(Q.componentName);let w=`<!--craft:${Q.componentName}:${Q.hydrationKey||"default"}-->`;J.set(Q.hydrationKey||Q.componentName,w)}}}),{staticHTML:Y,dynamicPlaceholders:J,craftComponents:G}}function qU(X){let $={type:"fragment",children:[]},Z=$,Y=[$],J=X,G=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);while(J.length>0){let Q=J.match(/^<(@?[\w-]+)([^>]*)>/);if(Q){let[q,U,K]=Q,z=UU(K),j=U.startsWith("@craft-"),B=j?U:U.toLowerCase(),_={type:j?"component":"element",tag:B,props:z,children:[],componentName:j?B.slice(1):void 0,isStatic:!x6(K),hydrationKey:MU()};if(Z.children=Z.children||[],Z.children.push(_),!G.has(B)&&!K.endsWith("/"))Y.push(_),Z=_;J=J.slice(q.length);continue}let w=J.match(/^<\/(@?[\w-]+)>/);if(w){let[q,U]=w,z=U.startsWith("@craft-")?U:U.toLowerCase();while(Y.length>1){let j=Y.pop();if(Z=Y[Y.length-1],j.tag===z)break}J=J.slice(q.length);continue}let W=J.match(/^[^<]+/);if(W){let q=W[0];if(q.trim()){let U={type:"text",text:q,isStatic:!x6(q)};Z.children=Z.children||[],Z.children.push(U)}J=J.slice(q.length);continue}J=J.slice(1)}return $}function UU(X){let $={},Z=/([\w-:@]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S+)))?/g,Y;while((Y=Z.exec(X))!==null){let[,J,G,Q,w]=Y,W=G??Q??w??!0;$[J]=W}return $}function L7(X,$,Z=[]){if($(X,Z),X.children)X.children.forEach((Y,J)=>{L7(Y,$,[...Z,`${J}`])})}function H7(X,$){switch(X.type){case"text":return u6(X.text||"",$);case"element":case"component":{let Z=X.tag||"div",Y=h6(X.props||{},$),J=(X.children||[]).map((G)=>H7(G,$)).join("");if(!X.children||X.children.length===0){if(["input","br","hr","img","meta","link"].includes(Z))return`<${Z}${Y} />`}return`<${Z}${Y}>${J}</${Z}>`}case"fragment":return(X.children||[]).map((Z)=>H7(Z,$)).join("");case"slot":return`<!--slot:${X.slotName||"default"}-->`;default:return""}}function g6(X){if(X.type==="text")return X.text||"";let $=X.tag||"div",Z=h6(X.props||{},{});return`<${$}${Z}></${$}>`}function h6(X,$){let Z=[];for(let[Y,J]of Object.entries(X))if(J===!0)Z.push(` ${Y}`);else if(J!==!1&&J!==null&&J!==void 0){let G=u6(String(J),$);Z.push(` ${Y}="${d6(G)}"`)}return Z.join("")}async function KU(X,$){return H7(X,$)}function zU(X,$){let Z=[];return L7(X.tree,(Y)=>{if(Y.isStatic)Z.push(H7(Y,$))}),Z.join("")}function BU(X,$,Z){let Y={templateId:$.id,context:Z,dynamicParts:Array.from($.dynamicParts.entries())},J=`
|
|
18425
18425
|
<script data-craft-hydration>
|
|
18426
18426
|
window.__CRAFT_HYDRATION__ = ${JSON.stringify(Y)};
|
|
18427
|
-
</script>`;return{html:X+J,data:Y}}function jU(X){let $=!1,Z=!1,Y=!1,J=!1,G=0,Q=0;function w(W,q){if(Q=Math.max(Q,q),W.type==="slot")$=!0;if(W.type==="component")G++;if(!W.isStatic)Z=!0;if(W.props)for(let U of Object.keys(W.props)){if(U.startsWith("on"))Y=!0;if(U==="@async"||U==="data-async")J=!0}if(W.children)W.children.forEach((U)=>w(U,q+1))}return w(X,0),{hasSlots:$,hasDynamicContent:Z,hasEventHandlers:Y,hasAsyncContent:J,componentCount:G,maxDepth:Q,estimatedSize:JSON.stringify(X).length}}function _U(X){let $=new Map,Z=new Map;return L7(X,(Y,J)=>{let G=J.join(".");if(Y.isStatic)$.set(G,g6(Y));else Z.set(G,Y.tag||Y.componentName||"dynamic")}),{staticParts:$,dynamicParts:Z}}function HU(X){let $=[],Z=/<script[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=Z.exec(X))!==null)$.push(Y[1]);return $}function LU(X){let $=[],Z=/<style[^>]*>([\s\S]*?)<\/style>/gi,Y;while((Y=Z.exec(X))!==null)$.push(Y[1]);return $}function OU(X){let $=[],Z=/@include\s*\(\s*['"]([^'"]+)['"]/g,Y;while((Y=Z.exec(X))!==null)$.push(Y[1]);let J=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((Y=J.exec(X))!==null)$.push(Y[1]);let G=/<@craft-[\w-]+/g;while((Y=G.exec(X))!==null)$.push(Y[0].slice(2));return[...new Set($)]}function x6(X){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test(X)}function u6(X,$){let Z=X.replace(/\{\{\s*(.+?)\s*\}\}/g,(Y,J)=>{try{let G=f6(J.trim(),$);return d6(String(G??""))}catch{return""}});return Z=Z.replace(/\{!!\s*(.+?)\s*!!\}/g,(Y,J)=>{try{let G=f6(J.trim(),$);return String(G??"")}catch{return""}}),Z}function f6(X,$){if(/^[\w.]+$/.test(X)){let Z=X.split("."),Y=$;for(let J of Z)if(Y&&typeof Y==="object"&&J in Y)Y=Y[J];else return;return Y}try{return Function(...Object.keys($),`return ${X}`)(...Object.values($))}catch{return}}function d6(X){return X.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function FU(X){return X.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function VU(X){let $=0;for(let Z=0;Z<X.length;Z++){let Y=X.charCodeAt(Z);$=($<<5)-$+Y,$=$&$}return`tpl_${Math.abs($).toString(36)}`}function AU(X){let $=0;for(let Z=0;Z<X.length;Z++){let Y=X.charCodeAt(Z);$=($<<5)-$+Y,$=$&$}return Math.abs($).toString(36)}var RU=0;function MU(){return`h_${++RU}`}function m6(X){return["craft-button","craft-text-input","craft-textarea","craft-checkbox","craft-radio","craft-select","craft-slider","craft-toggle","craft-date-picker","craft-time-picker","craft-color-picker","craft-file-input","craft-modal","craft-alert","craft-toast","craft-progress","craft-spinner","craft-avatar","craft-badge","craft-card","craft-accordion","craft-tabs","craft-tooltip","craft-popover","craft-dropdown","craft-context-menu","craft-data-table","craft-virtual-list","craft-tree-view","craft-map","craft-chart","craft-video","craft-audio","craft-webview","craft-canvas","craft-image-viewer","craft-pdf-viewer","craft-code-editor","craft-rich-editor"].includes(X)}function TU(X){let $=X.tag?.toLowerCase(),Z=X.props?.type,Y={button:{component:"craft-button",confidence:0.95,reason:"Native button provides better touch feedback"},"input:text":{component:"craft-text-input",confidence:0.9,reason:"Native text input has better keyboard handling"},"input:checkbox":{component:"craft-checkbox",confidence:0.95,reason:"Native checkbox follows platform conventions"},"input:range":{component:"craft-slider",confidence:0.9,reason:"Native slider provides smooth interaction"},"input:date":{component:"craft-date-picker",confidence:0.95,reason:"Native date picker provides platform-specific UI"},"input:time":{component:"craft-time-picker",confidence:0.95,reason:"Native time picker provides platform-specific UI"},"input:color":{component:"craft-color-picker",confidence:0.9,reason:"Native color picker provides platform-specific UI"},textarea:{component:"craft-textarea",confidence:0.85,reason:"Native textarea handles multiline input better"},select:{component:"craft-select",confidence:0.9,reason:"Native select provides platform dropdown UI"},progress:{component:"craft-progress",confidence:0.95,reason:"Native progress bar matches platform style"},video:{component:"craft-video",confidence:0.95,reason:"Native video provides hardware acceleration"},audio:{component:"craft-audio",confidence:0.95,reason:"Native audio provides system integration"},dialog:{component:"craft-modal",confidence:0.9,reason:"Native modal provides proper layering and focus"}},J=Z?`${$}:${Z}`:$,G=Y[J||""]||Y[$||""];if(G)return{htmlSelector:J||$||"",nativeComponent:G.component,confidence:G.confidence,reason:G.reason};return null}function NU(){j7.clear()}function kU(){_7.clear()}function ZA(){NU(),kU()}function YA(){return{templateCacheSize:j7.size,renderCacheSize:_7.size,totalEntries:j7.size+_7.size}}import{existsSync as Rq,mkdirSync as
|
|
18427
|
+
</script>`;return{html:X+J,data:Y}}function jU(X){let $=!1,Z=!1,Y=!1,J=!1,G=0,Q=0;function w(W,q){if(Q=Math.max(Q,q),W.type==="slot")$=!0;if(W.type==="component")G++;if(!W.isStatic)Z=!0;if(W.props)for(let U of Object.keys(W.props)){if(U.startsWith("on"))Y=!0;if(U==="@async"||U==="data-async")J=!0}if(W.children)W.children.forEach((U)=>w(U,q+1))}return w(X,0),{hasSlots:$,hasDynamicContent:Z,hasEventHandlers:Y,hasAsyncContent:J,componentCount:G,maxDepth:Q,estimatedSize:JSON.stringify(X).length}}function _U(X){let $=new Map,Z=new Map;return L7(X,(Y,J)=>{let G=J.join(".");if(Y.isStatic)$.set(G,g6(Y));else Z.set(G,Y.tag||Y.componentName||"dynamic")}),{staticParts:$,dynamicParts:Z}}function HU(X){let $=[],Z=/<script[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=Z.exec(X))!==null)$.push(Y[1]);return $}function LU(X){let $=[],Z=/<style[^>]*>([\s\S]*?)<\/style>/gi,Y;while((Y=Z.exec(X))!==null)$.push(Y[1]);return $}function OU(X){let $=[],Z=/@include\s*\(\s*['"]([^'"]+)['"]/g,Y;while((Y=Z.exec(X))!==null)$.push(Y[1]);let J=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((Y=J.exec(X))!==null)$.push(Y[1]);let G=/<@craft-[\w-]+/g;while((Y=G.exec(X))!==null)$.push(Y[0].slice(2));return[...new Set($)]}function x6(X){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test(X)}function u6(X,$){let Z=X.replace(/\{\{\s*(.+?)\s*\}\}/g,(Y,J)=>{try{let G=f6(J.trim(),$);return d6(String(G??""))}catch{return""}});return Z=Z.replace(/\{!!\s*(.+?)\s*!!\}/g,(Y,J)=>{try{let G=f6(J.trim(),$);return String(G??"")}catch{return""}}),Z}function f6(X,$){if(/^[\w.]+$/.test(X)){let Z=X.split("."),Y=$;for(let J of Z)if(Y&&typeof Y==="object"&&J in Y)Y=Y[J];else return;return Y}try{return Function(...Object.keys($),`return ${X}`)(...Object.values($))}catch{return}}function d6(X){return X.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function FU(X){return X.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function VU(X){let $=0;for(let Z=0;Z<X.length;Z++){let Y=X.charCodeAt(Z);$=($<<5)-$+Y,$=$&$}return`tpl_${Math.abs($).toString(36)}`}function AU(X){let $=0;for(let Z=0;Z<X.length;Z++){let Y=X.charCodeAt(Z);$=($<<5)-$+Y,$=$&$}return Math.abs($).toString(36)}var RU=0;function MU(){return`h_${++RU}`}function m6(X){return["craft-button","craft-text-input","craft-textarea","craft-checkbox","craft-radio","craft-select","craft-slider","craft-toggle","craft-date-picker","craft-time-picker","craft-color-picker","craft-file-input","craft-modal","craft-alert","craft-toast","craft-progress","craft-spinner","craft-avatar","craft-badge","craft-card","craft-accordion","craft-tabs","craft-tooltip","craft-popover","craft-dropdown","craft-context-menu","craft-data-table","craft-virtual-list","craft-tree-view","craft-map","craft-chart","craft-video","craft-audio","craft-webview","craft-canvas","craft-image-viewer","craft-pdf-viewer","craft-code-editor","craft-rich-editor"].includes(X)}function TU(X){let $=X.tag?.toLowerCase(),Z=X.props?.type,Y={button:{component:"craft-button",confidence:0.95,reason:"Native button provides better touch feedback"},"input:text":{component:"craft-text-input",confidence:0.9,reason:"Native text input has better keyboard handling"},"input:checkbox":{component:"craft-checkbox",confidence:0.95,reason:"Native checkbox follows platform conventions"},"input:range":{component:"craft-slider",confidence:0.9,reason:"Native slider provides smooth interaction"},"input:date":{component:"craft-date-picker",confidence:0.95,reason:"Native date picker provides platform-specific UI"},"input:time":{component:"craft-time-picker",confidence:0.95,reason:"Native time picker provides platform-specific UI"},"input:color":{component:"craft-color-picker",confidence:0.9,reason:"Native color picker provides platform-specific UI"},textarea:{component:"craft-textarea",confidence:0.85,reason:"Native textarea handles multiline input better"},select:{component:"craft-select",confidence:0.9,reason:"Native select provides platform dropdown UI"},progress:{component:"craft-progress",confidence:0.95,reason:"Native progress bar matches platform style"},video:{component:"craft-video",confidence:0.95,reason:"Native video provides hardware acceleration"},audio:{component:"craft-audio",confidence:0.95,reason:"Native audio provides system integration"},dialog:{component:"craft-modal",confidence:0.9,reason:"Native modal provides proper layering and focus"}},J=Z?`${$}:${Z}`:$,G=Y[J||""]||Y[$||""];if(G)return{htmlSelector:J||$||"",nativeComponent:G.component,confidence:G.confidence,reason:G.reason};return null}function NU(){j7.clear()}function kU(){_7.clear()}function ZA(){NU(),kU()}function YA(){return{templateCacheSize:j7.size,renderCacheSize:_7.size,totalEntries:j7.size+_7.size}}import{existsSync as Rq,mkdirSync as X1,copyFileSync as o1,chmodSync as a1}from"fs";import{join as d,basename as NV}from"path";import{spawn as A$,execSync as kV}from"child_process";import{tmpdir as Mq,homedir as F6,platform as IV}from"os";A1();a5();J8();C5();Z8();import{dirname as RV,resolve as Fq}from"path";function Lq(X){return X.endsWith(".md")||X.endsWith(".markdown")}function AV(X){let $=[];Y(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let Z=[...$];Y(/<code\b[^>]*>[\s\S]*?<\/code>/gi,Z);function Y(Q,w){let W;while((W=Q.exec(X))!==null){let q=W.index,U=q+W[0].length;if(w?.some((K)=>q>=K.start&&U<=K.end))continue;$.push({start:q,end:U})}}if($.length===0)return X;$.sort((Q,w)=>Q.start-w.start);let J="",G=0;for(let Q of $){if(Q.start<G)continue;J+=X.slice(G,Q.start),J+=`@raw${X.slice(Q.start,Q.end)}@endraw`,G=Q.end}return J+=X.slice(G),J}async function Oq(X,$={}){let{data:Z,content:Y}=NX(X),G=await($.renderer??((Q)=>$5(Q)))(Y);return{html:AV(G),frontmatter:Z??{}}}function MV(X){let $=X,Z=l5(X);if(Z)$=Z.content.trim();let Y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,J=[],G=[],Q=[],w=(U)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(U),W;while((W=Y.exec(X))!==null){let U=W[1],K=W[2],z=W[0],j=U.includes("server");if(w(K))Q.push(z);else if(j)G.push(K);else J.push(z)}let q=$;{let U=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,K,z=[];while((K=U.exec(q))!==null){let j=K.index+K[0].length,B=q.indexOf("</script>",j);if(B===-1)continue;z.push({start:K.index,end:B+9}),U.lastIndex=B+9}for(let j=z.length-1;j>=0;j--)q=q.substring(0,z[j].start)+q.substring(z[j].end)}for(let U of J)q=q.replace(U,"");return{templateContent:q,serverScripts:G,clientScripts:J,signalsScripts:Q}}function TV(X,$){return`<!DOCTYPE html>
|
|
18428
18428
|
<html lang="en">
|
|
18429
18429
|
<head>
|
|
18430
18430
|
<meta charset="UTF-8">
|
|
@@ -18434,20 +18434,20 @@ ${Z} `)}]`:"";return`Craft.create("${X.zigType}", ${J}${Q})`}function lq(X,$,
|
|
|
18434
18434
|
<body>
|
|
18435
18435
|
${X}
|
|
18436
18436
|
</body>
|
|
18437
|
-
</html>`}function L6(X,$,Z){if(X&&typeof X==="object")X[$]=Z}async function Vq(X,$={}){let Z=Fq(X),Y=Bun.file(Z);if(!await Y.exists())throw Error(`Template file not found: ${Z}`);let J=await Y.text(),G=null;if(Lq(Z)){let Q=await Oq(J,{renderer:$.markdownRenderer});J=Q.html,G=Q.frontmatter}if(G)$={...$,context:{...G,...$.context||{}}};if($.layout){let Q=Fq($.layout),w=Bun.file(Q);if(!await w.exists())throw Error(`Layout template not found: ${Q}`);let{layout:W,injectCSS:q,...U}=$,K=await O6(J,Z,{...U,injectCSS:!1}),z=await w.text(),j={...$.context||{},content:K},B={...U,context:j,injectCSS:q};return O6(z,Q,B)}return O6(J,Z,$)}async function O6(X,$,Z={}){let{templateContent:Y,serverScripts:J,clientScripts:G}=MV(X),Q={...I1,...Z.options},w={__filename:$,__dirname:RV($),__stx:{},__stx_options:Q,__stx_sfc_mode:!0,__stx_inject_css:Z.injectCSS===!0,__stxServeContext:void 0,setResponseStatus:(U)=>{if(Number.isInteger(U)&&U>=100&&U<=599)L6(Z.context,"__stxResponseStatus",U)},notFound:(U=404)=>{let K=Number.isInteger(U)&&U>=400&&U<=599?U:404;L6(Z.context,"__stxResponseStatus",K)},setResponseHeader:(U,K)=>{if(!U)return;let z=Z.context?.__stxResponseHeaders||{};z[String(U)]=String(K),L6(Z.context,"__stxResponseHeaders",z)},definePageMeta:()=>{},...Z.context||{}};for(let U of J)await k1(U,w,$);let W=new Set,q=Y;if(q=await
|
|
18437
|
+
</html>`}function L6(X,$,Z){if(X&&typeof X==="object")X[$]=Z}async function Vq(X,$={}){let Z=Fq(X),Y=Bun.file(Z);if(!await Y.exists())throw Error(`Template file not found: ${Z}`);let J=await Y.text(),G=null;if(Lq(Z)){let Q=await Oq(J,{renderer:$.markdownRenderer});J=Q.html,G=Q.frontmatter}if(G)$={...$,context:{...G,...$.context||{}}};if($.layout){let Q=Fq($.layout),w=Bun.file(Q);if(!await w.exists())throw Error(`Layout template not found: ${Q}`);let{layout:W,injectCSS:q,...U}=$,K=await O6(J,Z,{...U,injectCSS:!1}),z=await w.text(),j={...$.context||{},content:K},B={...U,context:j,injectCSS:q};return O6(z,Q,B)}return O6(J,Z,$)}async function O6(X,$,Z={}){let{templateContent:Y,serverScripts:J,clientScripts:G}=MV(X),Q={...I1,...Z.options},w={__filename:$,__dirname:RV($),__stx:{},__stx_options:Q,__stx_sfc_mode:!0,__stx_inject_css:Z.injectCSS===!0,__stxServeContext:void 0,setResponseStatus:(U)=>{if(Number.isInteger(U)&&U>=100&&U<=599)L6(Z.context,"__stxResponseStatus",U)},notFound:(U=404)=>{let K=Number.isInteger(U)&&U>=400&&U<=599?U:404;L6(Z.context,"__stxResponseStatus",K)},setResponseHeader:(U,K)=>{if(!U)return;let z=Z.context?.__stxResponseHeaders||{};z[String(U)]=String(K),L6(Z.context,"__stxResponseHeaders",z)},definePageMeta:()=>{},...Z.context||{}};for(let U of J)await k1(U,w,$);let W=new Set,q=Y;if(q=await T0(q,w,$,Q,W),Z.templateOnly){if(q=q.replace(/<script data-stx-scoped>[\s\S]*?<\/script>\s*/gi,""),q=q.replace(/<!-- stx SEO Tags -->[\s\S]*?(?=<)/i,""),G.length>0)q+=`
|
|
18438
18438
|
${G.join(`
|
|
18439
|
-
`)}`}else{if(Z.processClientScripts!==!1&&G.length>0){let U=w.__stx_event_bindings||[],K=
|
|
18439
|
+
`)}`}else{if(Z.processClientScripts!==!1&&G.length>0){let U=w.__stx_event_bindings||[],K=J5(w),j=(await Promise.all(G.map(async(_)=>{let H=_.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!H)return _;return await G5(H[1],{eventBindings:U,templateContent:q,serverData:K,filePath:$})}))).join(`
|
|
18440
18440
|
`);if(q.match(/(<\/body>)/i))q=q.replace(/(<\/body>)/i,`${j}
|
|
18441
18441
|
$1`);else q+=`
|
|
18442
|
-
${j}`}q=await U3(q)}if(Z.wrapInDocument){if(!q.trim().toLowerCase().startsWith("<!doctype")&&!q.trim().toLowerCase().startsWith("<html"))q=TV(q,Z.title)}if(Z.injectCSS)try{let{injectCrosswindCSS:U}=await Promise.resolve().then(() => (F9(),mZ));q=await U(q)}catch{}return q}async function ob(X){let $=Date.now();try{if(!await Bun.file(X.input).exists())return{success:!1,target:X.target||V$(),format:X.format||"app",error:`Input file not found: ${X.input}`};let Z=X.target||V$(),Y=X.format||xV(Z),J=X.output||
|
|
18443
|
-
</head>`)}let Q=X.name||NV(X.input,".stx"),w=X.version||"1.0.0",W=X.craftPath||await vV();if(!W)return{success:!1,target:Z,format:Y,error:"Craft binary not found. Please install Craft or specify craftPath."};if(X.verbose)console.log(`\uD83D\uDCE6 Building native app for ${Z}...`),console.log(` Input: ${X.input}`),console.log(` Output: ${J}`),console.log(` Craft: ${W}`);let q;switch(Z){case"macos":q=await EV(G,Q,w,J,Y,X,W);break;case"windows":q=await bV(G,Q,w,J,Y,X,W);break;case"linux":q=await SV(G,Q,w,J,Y,X,W);break;case"ios":q=await CV(G,Q,w,J,X,W);break;case"android":q=await PV(G,Q,w,J,X,W);break;default:q={success:!1,target:Z,format:Y,error:`Unsupported target: ${Z}`}}return q.duration=Date.now()-$,q}catch(Z){return{success:!1,target:X.target||V$(),format:X.format||"app",error:Z.message,duration:Date.now()-$}}}async function EV(X,$,Z,Y,J,G,Q){let w=G.bundleId||`com.stx.${$.toLowerCase().replace(/[^a-z0-9]/g,"")}`,W=
|
|
18444
|
-
`)}else{let F=
|
|
18442
|
+
${j}`}q=await U3(q)}if(Z.wrapInDocument){if(!q.trim().toLowerCase().startsWith("<!doctype")&&!q.trim().toLowerCase().startsWith("<html"))q=TV(q,Z.title)}if(Z.injectCSS)try{let{injectCrosswindCSS:U}=await Promise.resolve().then(() => (F9(),mZ));q=await U(q)}catch{}return q}async function ob(X){let $=Date.now();try{if(!await Bun.file(X.input).exists())return{success:!1,target:X.target||V$(),format:X.format||"app",error:`Input file not found: ${X.input}`};let Z=X.target||V$(),Y=X.format||xV(Z),J=X.output||d(process.cwd(),"dist","native");if(!Rq(J))X1(J,{recursive:!0});let G=await Vq(X.input,{context:X.context,options:{isDev:!1}});if(G=R6(G,{debug:X.verbose}),G=S6(G),!G.includes("craft-component-styles")){if(G.includes("</head>"))G=G.replace("</head>",`${b6}
|
|
18443
|
+
</head>`)}let Q=X.name||NV(X.input,".stx"),w=X.version||"1.0.0",W=X.craftPath||await vV();if(!W)return{success:!1,target:Z,format:Y,error:"Craft binary not found. Please install Craft or specify craftPath."};if(X.verbose)console.log(`\uD83D\uDCE6 Building native app for ${Z}...`),console.log(` Input: ${X.input}`),console.log(` Output: ${J}`),console.log(` Craft: ${W}`);let q;switch(Z){case"macos":q=await EV(G,Q,w,J,Y,X,W);break;case"windows":q=await bV(G,Q,w,J,Y,X,W);break;case"linux":q=await SV(G,Q,w,J,Y,X,W);break;case"ios":q=await CV(G,Q,w,J,X,W);break;case"android":q=await PV(G,Q,w,J,X,W);break;default:q={success:!1,target:Z,format:Y,error:`Unsupported target: ${Z}`}}return q.duration=Date.now()-$,q}catch(Z){return{success:!1,target:X.target||V$(),format:X.format||"app",error:Z.message,duration:Date.now()-$}}}async function EV(X,$,Z,Y,J,G,Q){let w=G.bundleId||`com.stx.${$.toLowerCase().replace(/[^a-z0-9]/g,"")}`,W=d(Y,`${$}.app`),q=d(W,"Contents"),U=d(q,"MacOS"),K=d(q,"Resources");X1(U,{recursive:!0}),X1(K,{recursive:!0});let z=d(K,"index.html");await Bun.write(z,X);let j="";if(G.sidebar?.enabled&&G.sidebar?.config)j=d(K,"sidebar-config.json"),await Bun.write(j,JSON.stringify(G.sidebar.config));let B=G.sidebar?.enabled?`--native-sidebar --sidebar-width ${G.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",_=G.menubarOnly??G.systemTray;if((G.bundleStyle||(await DV(Q)?"executable":"launcher"))==="executable"){let F=d(U,$);o1(Q,F),a1(F,493);let V={html:"index.html",title:G.window?.title||$,width:G.window?.width||1200,height:G.window?.height||800,devTools:Boolean(G.devTools)};if(_)V.menubarOnly=!0;else if(G.systemTray)V.systemTray=!0;if(G.window?.frameless)V.frameless=!0;if(G.window?.transparent)V.transparent=!0;if(G.window?.alwaysOnTop)V.alwaysOnTop=!0;if(G.window?.resizable===!1)V.resizable=!1;await Bun.write(d(K,"craft.json"),`${JSON.stringify(V,null,2)}
|
|
18444
|
+
`)}else{let F=d(U,"craft");o1(Q,F),a1(F,493);let V=G.sidebar?.enabled?`--native-sidebar --sidebar-width ${G.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",R=`#!/bin/bash
|
|
18445
18445
|
set -euo pipefail
|
|
18446
18446
|
DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
|
|
18447
18447
|
RESOURCES="$DIR/../Resources"
|
|
18448
18448
|
exec "$DIR/craft" --html-file "$RESOURCES/index.html" \\
|
|
18449
18449
|
${[`--title "${G.window?.title||$}"`,`--width ${G.window?.width||1200}`,`--height ${G.window?.height||800}`,_?"--menubar-only":G.systemTray?"--system-tray":"",G.devTools?"":"--no-devtools",G.window?.frameless?"--frameless":"",G.window?.transparent?"--transparent":"",G.window?.alwaysOnTop?"--always-on-top":"",G.window?.resizable===!1?"--no-resize":"",V].filter(Boolean).join(" \\\n ")}
|
|
18450
|
-
`,M=
|
|
18450
|
+
`,M=d(U,$);await Bun.write(M,R),a1(M,493)}let O=Boolean(G.icon&&await Bun.file(G.icon).exists());if(O)o1(G.icon,d(K,"AppIcon.icns"));let L={CFBundleExecutable:$,CFBundleIdentifier:w,CFBundleName:$,CFBundleDisplayName:$,CFBundleShortVersionString:Z,CFBundleVersion:Z,CFBundlePackageType:"APPL",CFBundleSignature:"????",LSMinimumSystemVersion:G.minimumSystemVersion||"13.0",NSHighResolutionCapable:!0,NSSupportsAutomaticGraphicsSwitching:!0,LSUIElement:G.menubarOnly??Boolean(G.systemTray),...O?{CFBundleIconFile:"AppIcon"}:{},...G.category?{LSApplicationCategoryType:G.category}:{},...G.copyright?{NSHumanReadableCopyright:G.copyright}:{},...G.infoPlist||{}};if(await Bun.write(d(q,"Info.plist"),yV(L)),J==="dmg"){let F=d(Y,`${$}-${Z}.dmg`),V=await fV(W,F,$);if(!V.success)return{success:!1,target:"macos",format:"dmg",error:V.error};return{success:!0,target:"macos",format:"dmg",outputPath:F}}return{success:!0,target:"macos",format:"app",outputPath:W}}async function DV(X){try{let $=Bun.spawn([X,"--version"],{stdout:"pipe",stderr:"pipe"}),[Z,Y]=await Promise.all([new Response($.stdout).text(),new Response($.stderr).text()]);await $.exited;let G=`${Z}
|
|
18451
18451
|
${Y}`.match(/(\d+)\.(\d+)\.(\d+)/);if(!G)return!1;let[Q,w,W]=G.slice(1).map(Number);if(Q>0||w>0)return!0;return W>=57}catch{return!1}}function Aq(X){return X.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function yV(X){return`<?xml version="1.0" encoding="UTF-8"?>
|
|
18452
18452
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
18453
18453
|
<plist version="1.0">
|
|
@@ -18457,7 +18457,7 @@ ${Object.entries(X).map(([Z,Y])=>{let J=typeof Y==="boolean"?`<${Y}/>`:typeof Y=
|
|
|
18457
18457
|
`)}
|
|
18458
18458
|
</dict>
|
|
18459
18459
|
</plist>
|
|
18460
|
-
`}async function bV(X,$,Z,Y,J,G,Q){let w=
|
|
18460
|
+
`}async function bV(X,$,Z,Y,J,G,Q){let w=d(Y,$);X1(w,{recursive:!0});let W=d(w,"index.html");await Bun.write(W,X),o1(Q,d(w,"craft.exe"));let q=`@echo off
|
|
18461
18461
|
set DIR=%~dp0
|
|
18462
18462
|
"%DIR%craft.exe" --html-file "%DIR%index.html" ^
|
|
18463
18463
|
--title "${G.window?.title||$}" ^
|
|
@@ -18465,7 +18465,7 @@ set DIR=%~dp0
|
|
|
18465
18465
|
--height ${G.window?.height||800} ^
|
|
18466
18466
|
${G.systemTray?"--system-tray":""} ^
|
|
18467
18467
|
${G.devTools?"":"--no-devtools"}
|
|
18468
|
-
`;if(await Bun.write(
|
|
18468
|
+
`;if(await Bun.write(d(w,`${$}.bat`),q),J==="zip"){let U=d(Y,`${$}-${Z}-windows.zip`),K=await gV(w,U);if(!K.success)return{success:!1,target:"windows",format:"zip",error:K.error};return{success:!0,target:"windows",format:"zip",outputPath:U}}return{success:!0,target:"windows",format:"app",outputPath:w}}async function SV(X,$,Z,Y,J,G,Q){let w=d(Y,$);X1(w,{recursive:!0});let W=d(w,"index.html");await Bun.write(W,X);let q=d(w,"craft");o1(Q,q),a1(q,493);let U=`#!/bin/bash
|
|
18469
18469
|
set -euo pipefail
|
|
18470
18470
|
DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
|
|
18471
18471
|
exec "$DIR/craft" --html-file "$DIR/index.html" \\
|
|
@@ -18474,15 +18474,15 @@ exec "$DIR/craft" --html-file "$DIR/index.html" \\
|
|
|
18474
18474
|
--height ${G.window?.height||800} \\
|
|
18475
18475
|
${G.systemTray?"--system-tray":""} \\
|
|
18476
18476
|
${G.devTools?"":"--no-devtools"}
|
|
18477
|
-
`,K=
|
|
18477
|
+
`,K=d(w,$.toLowerCase());await Bun.write(K,U),a1(K,493);let z=`[Desktop Entry]
|
|
18478
18478
|
Type=Application
|
|
18479
18479
|
Name=${$}
|
|
18480
18480
|
Exec=${K}
|
|
18481
18481
|
Terminal=false
|
|
18482
18482
|
Categories=Utility;
|
|
18483
|
-
`;if(await Bun.write(
|
|
18484
|
-
`)[0];if(Z&&await Bun.file(Z).exists())return Z}catch{}return null}function V$(){switch(IV()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function xV(X){switch(X){case"macos":return"app";case"windows":return"zip";case"linux":return"appimage";case"ios":return"ipa";case"android":return"apk";default:return"app"}}async function fV(X,$,Z){return new Promise((Y)=>{let J=A$("hdiutil",["create","-volname",Z,"-srcfolder",X,"-ov","-format","UDZO",$]);J.on("close",(G)=>{if(G===0)Y({success:!0});else Y({success:!1,error:`hdiutil exited with code ${G}`})}),J.on("error",(G)=>{Y({success:!1,error:G.message})})})}async function gV(X,$){return new Promise((Z)=>{let Y=A$("zip",["-r",$,"."],{cwd:X});Y.on("close",(J)=>{if(J===0)Z({success:!0});else Z({success:!1,error:`zip exited with code ${J}`})}),Y.on("error",(J)=>{Z({success:!1,error:J.message})})})}async function hV(X,$,Z,Y,J){return new Promise((G)=>{try{let Q=
|
|
18485
|
-
exec /usr/share/${Z.toLowerCase()}/${Z.toLowerCase()} "$@"`;Z0("fs").writeFileSync(
|
|
18483
|
+
`;if(await Bun.write(d(w,`${$.toLowerCase()}.desktop`),z),J==="deb"){let j=d(Y,`${$.toLowerCase()}_${Z}_amd64.deb`),B=await hV(w,j,$,Z,G);if(!B.success)return{success:!1,target:"linux",format:"deb",error:B.error};return{success:!0,target:"linux",format:"deb",outputPath:j}}if(J==="appimage"){let j=d(Y,`${$}-${Z}-x86_64.AppImage`),B=await uV(w,j,$,G);if(!B.success)return{success:!1,target:"linux",format:"appimage",error:B.error};return{success:!0,target:"linux",format:"appimage",outputPath:j}}return{success:!0,target:"linux",format:"app",outputPath:w}}async function CV(X,$,Z,Y,J,G){return{success:!1,target:"ios",format:"ipa",error:`iOS build requires Xcode and additional setup. Use 'stx init:ios ${$}' to create an iOS project.`}}async function PV(X,$,Z,Y,J,G){return{success:!1,target:"android",format:"apk",error:`Android build requires Android SDK and additional setup. Use 'stx init:android ${$}' to create an Android project.`}}async function vV(){if(process.env.CRAFT_BIN&&await Bun.file(process.env.CRAFT_BIN).exists())return process.env.CRAFT_BIN;let X=[d(process.cwd(),"../../craft/packages/zig/zig-out/bin/craft"),d(process.cwd(),"../craft/packages/zig/zig-out/bin/craft"),d(F6(),"Code/Tools/craft/packages/zig/zig-out/bin/craft"),d(F6(),"Code/craft/packages/zig/zig-out/bin/craft"),"/usr/local/bin/craft","/usr/bin/craft",d(F6(),".local/bin/craft"),d(process.env.LOCALAPPDATA||"","craft","craft.exe"),d(process.env.PROGRAMFILES||"","craft","craft.exe")];for(let $ of X)if(await Bun.file($).exists())return $;try{let Z=kV("which craft 2>/dev/null || where craft 2>nul",{encoding:"utf-8"}).trim().split(`
|
|
18484
|
+
`)[0];if(Z&&await Bun.file(Z).exists())return Z}catch{}return null}function V$(){switch(IV()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function xV(X){switch(X){case"macos":return"app";case"windows":return"zip";case"linux":return"appimage";case"ios":return"ipa";case"android":return"apk";default:return"app"}}async function fV(X,$,Z){return new Promise((Y)=>{let J=A$("hdiutil",["create","-volname",Z,"-srcfolder",X,"-ov","-format","UDZO",$]);J.on("close",(G)=>{if(G===0)Y({success:!0});else Y({success:!1,error:`hdiutil exited with code ${G}`})}),J.on("error",(G)=>{Y({success:!1,error:G.message})})})}async function gV(X,$){return new Promise((Z)=>{let Y=A$("zip",["-r",$,"."],{cwd:X});Y.on("close",(J)=>{if(J===0)Z({success:!0});else Z({success:!1,error:`zip exited with code ${J}`})}),Y.on("error",(J)=>{Z({success:!1,error:J.message})})})}async function hV(X,$,Z,Y,J){return new Promise((G)=>{try{let Q=d(Mq(),`stx-deb-${Date.now()}`),w=d(Q,"DEBIAN"),W=d(Q,"usr","bin"),q=d(Q,"usr","share","applications"),U=d(Q,"usr","share",Z.toLowerCase());X1(w,{recursive:!0}),X1(W,{recursive:!0}),X1(q,{recursive:!0}),X1(U,{recursive:!0});let K=Z0("fs").readdirSync(X);for(let _ of K)o1(d(X,_),d(U,_));let z=`#!/bin/bash
|
|
18485
|
+
exec /usr/share/${Z.toLowerCase()}/${Z.toLowerCase()} "$@"`;Z0("fs").writeFileSync(d(W,Z.toLowerCase()),z),a1(d(W,Z.toLowerCase()),493);let j=`Package: ${Z.toLowerCase()}
|
|
18486
18486
|
Version: ${Y}
|
|
18487
18487
|
Section: utils
|
|
18488
18488
|
Priority: optional
|
|
@@ -18490,16 +18490,16 @@ Architecture: amd64
|
|
|
18490
18490
|
Depends: libgtk-3-0, libwebkit2gtk-4.0-37
|
|
18491
18491
|
Maintainer: ${J.author||"Unknown"}
|
|
18492
18492
|
Description: ${J.description||Z}
|
|
18493
|
-
`;Z0("fs").writeFileSync(
|
|
18493
|
+
`;Z0("fs").writeFileSync(d(w,"control"),j);let B=A$("dpkg-deb",["--build",Q,$]);B.on("close",(_)=>{if(Z0("fs").rmSync(Q,{recursive:!0,force:!0}),_===0)G({success:!0});else G({success:!1,error:`dpkg-deb exited with code ${_}`})}),B.on("error",(_)=>{Z0("fs").rmSync(Q,{recursive:!0,force:!0}),G({success:!1,error:_.message})})}catch(Q){G({success:!1,error:Q.message})}})}async function uV(X,$,Z,Y){return new Promise((J)=>{try{let G=d(Mq(),`stx-appimage-${Date.now()}`),Q=d(G,`${Z}.AppDir`),w=d(Q,"usr"),W=d(w,"bin"),q=d(w,"share");X1(W,{recursive:!0}),X1(q,{recursive:!0});let U=d(q,Z.toLowerCase());X1(U,{recursive:!0});let K=Z0("fs").readdirSync(X);for(let H of K)o1(d(X,H),d(U,H));let z=`#!/bin/bash
|
|
18494
18494
|
SELF=$(readlink -f "$0")
|
|
18495
18495
|
HERE=\${SELF%/*}
|
|
18496
18496
|
export PATH="\${HERE}/usr/bin:\${PATH}"
|
|
18497
18497
|
exec "\${HERE}/usr/share/${Z.toLowerCase()}/${Z.toLowerCase()}" "$@"
|
|
18498
|
-
`;Z0("fs").writeFileSync(
|
|
18498
|
+
`;Z0("fs").writeFileSync(d(Q,"AppRun"),z),a1(d(Q,"AppRun"),493);let j=`[Desktop Entry]
|
|
18499
18499
|
Type=Application
|
|
18500
18500
|
Name=${Z}
|
|
18501
18501
|
Exec=${Z.toLowerCase()}
|
|
18502
18502
|
Terminal=false
|
|
18503
18503
|
Categories=Utility;
|
|
18504
18504
|
Icon=${Z.toLowerCase()}
|
|
18505
|
-
`;Z0("fs").writeFileSync(
|
|
18505
|
+
`;Z0("fs").writeFileSync(d(Q,`${Z.toLowerCase()}.desktop`),j);let B=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);if(Z0("fs").writeFileSync(d(Q,`${Z.toLowerCase()}.png`),B),Y.icon&&Rq(Y.icon))o1(Y.icon,d(Q,`${Z.toLowerCase()}.png`));let _=A$("appimagetool",[Q,$],{env:{...process.env,ARCH:"x86_64"}});_.on("close",(H)=>{if(Z0("fs").rmSync(G,{recursive:!0,force:!0}),H===0)a1($,493),J({success:!0});else J({success:!1,error:`appimagetool exited with code ${H}. Install from https://appimage.github.io/appimagetool/`})}),_.on("error",(H)=>{Z0("fs").rmSync(G,{recursive:!0,force:!0}),J({success:!1,error:`appimagetool not found: ${H.message}`})})}catch(G){J({success:!1,error:G.message})}})}function ab(){return[V$()]}function tb(X){switch(X){case"macos":return["app","dmg","pkg"];case"windows":return["app","zip","msi"];case"linux":return["app","deb","rpm","appimage"];case"ios":return["ipa"];case"android":return["apk"];default:return["app"]}}export{eV as renderSSR,oV as registerCraftComponent,cV as processCraftDirective,S6 as processCraftComponents,$A as prerenderForCraft,lV as isCraftEnvironment,R6 as injectCraftBridge,YA as getSSRCacheStats,aV as getCraftComponents,ab as getAvailableTargets,tb as getAvailableFormats,XA as generateCraftOptimizations,A6 as generateCraftBridgeScript,nV as createHotReloadServer,iV as compileToNative,WU as compileTemplate,NU as clearTemplateCache,kU as clearRenderCache,ZA as clearAllCaches,ob as buildNative,Eq as NATIVE_COMPONENTS,b6 as CRAFT_COMPONENT_STYLES,sV as CRAFT_COMPONENT_RUNTIME,k$ as CRAFT_COMPONENTS,mV as CRAFT_BRIDGE_SCRIPT};
|