@stacksjs/stx 0.2.38 → 0.2.39

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/index.js CHANGED
@@ -1,32 +1,32 @@
1
1
  // @bun
2
- var _H=Object.defineProperty;var BH=($)=>$;function UH($,Z){this[$]=BH.bind(null,Z)}var Q0=($,Z)=>{for(var Y in Z)_H($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:UH.bind(Z,Y)})};var D=($,Z)=>()=>($&&(Z=$($=0)),Z);var K0=import.meta.require;function O6($){let{token:Z,baseUrl:Y="https://api.netlify.com/api/v1"}=$;async function X(J,Q,G={}){let K=`${Y}${Q}`,W={Authorization:`Bearer ${Z}`,"User-Agent":"stx-deploy/1.0"},_;if(G.rawBody)W["Content-Type"]=G.contentType||"application/octet-stream",_=G.rawBody;else if(G.body)W["Content-Type"]="application/json",_=JSON.stringify(G.body);let B=await fetch(K,{method:J,headers:W,body:_});if(!B.ok){let z=Error(`Netlify API error: ${B.status} ${B.statusText}`);z.status=B.status;try{let q=await B.json();z.message=q.message||z.message,z.code=q.code,z.details=q}catch{}throw z}let U=await B.text();if(!U)return{};return JSON.parse(U)}return{async getSite(J){return X("GET",`/sites/${J}`)},async listSites(){return X("GET","/sites")},async createSite(J){let Q={};if(J)Q.name=J;return X("POST","/sites",{body:Q})},async createDeploy(J,Q){let G={files:Q.files,draft:Q.draft??!0,async:Q.async??!0};if(Q.title)G.title=Q.title;if(Q.branch)G.branch=Q.branch;if(Q.functions)G.functions=Q.functions;return X("POST",`/sites/${J}/deploys`,{body:G})},async uploadFile(J,Q,G){let K=Q.startsWith("/")?Q.slice(1):Q;await X("PUT",`/deploys/${J}/files/${K}`,{rawBody:G,contentType:"application/octet-stream"})},async uploadFiles(J,Q){let K=[...Q],W=async()=>{while(K.length>0){let B=K.shift();if(B)await this.uploadFile(J,B.path,B.content)}},_=Array.from({length:Math.min(5,Q.length)},()=>W());await Promise.all(_)},async getDeploy(J){return X("GET",`/deploys/${J}`)},async waitForDeploy(J,Q={}){let{timeout:G=300000,pollInterval:K=2000,onProgress:W}=Q,_=Date.now();while(!0){let B=await this.getDeploy(J);if(W)W(B);if(B.state==="ready")return B;if(B.state==="error"){let U=Error(`Deploy failed: ${B.error_message||"Unknown error"}`);throw U.status=500,U.details=B,U}if(Date.now()-_>G){let U=Error(`Deploy timed out after ${G}ms`);throw U.status=408,U.details=B,U}await new Promise((U)=>setTimeout(U,K))}},async lockDeploy(J){return X("POST",`/deploys/${J}/lock`)},async unlockDeploy(J){return X("POST",`/deploys/${J}/unlock`)}}}async function OZ($){let Z=await crypto.subtle.digest("SHA-1",$);return Array.from(new Uint8Array(Z)).map((X)=>X.toString(16).padStart(2,"0")).join("")}async function F7($,Z={}){let{ignore:Y=["node_modules",".git",".env*","*.map"]}=Z,X=[],J=new Bun.Glob("**/*");for await(let Q of J.scan({cwd:$,onlyFiles:!0,dot:!1})){if(Y.some((U)=>{if(U.includes("*"))return new RegExp(`^${U.replace(/\*/g,".*")}$`).test(Q);return Q.includes(U)}))continue;let K=`${$}/${Q}`,_=await Bun.file(K).arrayBuffer(),B=await OZ(_);X.push({path:Q,content:new Uint8Array(_),sha1:B})}return X}function L6($){let Z={};for(let Y of $)Z[`/${Y.path}`]=Y.sha1;return Z}function F6($,Z){let Y=new Set(Z.map((X)=>X.startsWith("/")?X.slice(1):X));return $.filter((X)=>Y.has(X.path))}function P$($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;if($<1073741824)return`${($/1048576).toFixed(1)} MB`;return`${($/1073741824).toFixed(1)} GB`}function e1($){return $.reduce((Z,Y)=>Z+Y.content.byteLength,0)}import f1 from"fs";import N1 from"path";function LZ($){let Z=[];if(Z.push("[build]"),Z.push(` command = "${y0($.build.command)}"`),Z.push(` publish = "${y0($.build.publish)}"`),$.build.functions)Z.push(` functions = "${y0($.build.functions)}"`);if($.build.edge_functions)Z.push(` edge_functions = "${y0($.build.edge_functions)}"`);if($.build.environment&&Object.keys($.build.environment).length>0){Z.push(""),Z.push("[build.environment]");for(let[Y,X]of Object.entries($.build.environment))Z.push(` ${Y} = "${y0(X)}"`)}if($.functions){if(Z.push(""),Z.push("[functions]"),$.functions.directory)Z.push(` directory = "${y0($.functions.directory)}"`);if($.functions.node_bundler)Z.push(` node_bundler = "${$.functions.node_bundler}"`);if($.functions.external_node_modules&&$.functions.external_node_modules.length>0)Z.push(` external_node_modules = [${$.functions.external_node_modules.map((Y)=>`"${Y}"`).join(", ")}]`)}if($.edge_functions&&$.edge_functions.length>0){Z.push("");for(let Y of $.edge_functions)Z.push("[[edge_functions]]"),Z.push(` function = "${y0(Y.function)}"`),Z.push(` path = "${y0(Y.path)}"`)}if($.redirects&&$.redirects.length>0){Z.push("");for(let Y of $.redirects){if(Z.push("[[redirects]]"),Z.push(` from = "${y0(Y.from)}"`),Z.push(` to = "${y0(Y.to)}"`),Y.status!==void 0)Z.push(` status = ${Y.status}`);if(Y.force!==void 0)Z.push(` force = ${Y.force}`);if(Y.conditions&&Object.keys(Y.conditions).length>0){Z.push(" [redirects.conditions]");for(let[X,J]of Object.entries(Y.conditions))Z.push(` ${X} = "${y0(J)}"`)}}}if($.headers&&$.headers.length>0){Z.push("");for(let Y of $.headers){Z.push("[[headers]]"),Z.push(` for = "${y0(Y.for)}"`),Z.push(" [headers.values]");for(let[X,J]of Object.entries(Y.values))Z.push(` ${X} = "${y0(J)}"`)}}if($.plugins&&$.plugins.length>0){Z.push("");for(let Y of $.plugins)if(Z.push("[[plugins]]"),Z.push(` package = "${y0(Y.package)}"`),Y.inputs&&Object.keys(Y.inputs).length>0){Z.push(" [plugins.inputs]");for(let[X,J]of Object.entries(Y.inputs))if(typeof J==="string")Z.push(` ${X} = "${y0(J)}"`);else if(typeof J==="boolean"||typeof J==="number")Z.push(` ${X} = ${J}`)}}if($.context&&Object.keys($.context).length>0)for(let[Y,X]of Object.entries($.context)){if(Z.push(""),Z.push(`[context.${Y}]`),X.command)Z.push(` command = "${y0(X.command)}"`);if(X.publish)Z.push(` publish = "${y0(X.publish)}"`);if(X.environment&&Object.keys(X.environment).length>0){Z.push(` [context.${Y}.environment]`);for(let[J,Q]of Object.entries(X.environment))Z.push(` ${J} = "${y0(Q)}"`)}}return Z.join(`
2
+ var _H=Object.defineProperty;var BH=($)=>$;function UH($,Z){this[$]=BH.bind(null,Z)}var Q0=($,Z)=>{for(var Y in Z)_H($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:UH.bind(Z,Y)})};var D=($,Z)=>()=>($&&(Z=$($=0)),Z);var K0=import.meta.require;function O6($){let{token:Z,baseUrl:Y="https://api.netlify.com/api/v1"}=$;async function X(J,Q,G={}){let K=`${Y}${Q}`,W={Authorization:`Bearer ${Z}`,"User-Agent":"stx-deploy/1.0"},_;if(G.rawBody)W["Content-Type"]=G.contentType||"application/octet-stream",_=G.rawBody;else if(G.body)W["Content-Type"]="application/json",_=JSON.stringify(G.body);let B=await fetch(K,{method:J,headers:W,body:_});if(!B.ok){let z=Error(`Netlify API error: ${B.status} ${B.statusText}`);z.status=B.status;try{let q=await B.json();z.message=q.message||z.message,z.code=q.code,z.details=q}catch{}throw z}let U=await B.text();if(!U)return{};return JSON.parse(U)}return{async getSite(J){return X("GET",`/sites/${J}`)},async listSites(){return X("GET","/sites")},async createSite(J){let Q={};if(J)Q.name=J;return X("POST","/sites",{body:Q})},async createDeploy(J,Q){let G={files:Q.files,draft:Q.draft??!0,async:Q.async??!0};if(Q.title)G.title=Q.title;if(Q.branch)G.branch=Q.branch;if(Q.functions)G.functions=Q.functions;return X("POST",`/sites/${J}/deploys`,{body:G})},async uploadFile(J,Q,G){let K=Q.startsWith("/")?Q.slice(1):Q;await X("PUT",`/deploys/${J}/files/${K}`,{rawBody:G,contentType:"application/octet-stream"})},async uploadFiles(J,Q){let K=[...Q],W=async()=>{while(K.length>0){let B=K.shift();if(B)await this.uploadFile(J,B.path,B.content)}},_=Array.from({length:Math.min(5,Q.length)},()=>W());await Promise.all(_)},async getDeploy(J){return X("GET",`/deploys/${J}`)},async waitForDeploy(J,Q={}){let{timeout:G=300000,pollInterval:K=2000,onProgress:W}=Q,_=Date.now();while(!0){let B=await this.getDeploy(J);if(W)W(B);if(B.state==="ready")return B;if(B.state==="error"){let U=Error(`Deploy failed: ${B.error_message||"Unknown error"}`);throw U.status=500,U.details=B,U}if(Date.now()-_>G){let U=Error(`Deploy timed out after ${G}ms`);throw U.status=408,U.details=B,U}await new Promise((U)=>setTimeout(U,K))}},async lockDeploy(J){return X("POST",`/deploys/${J}/lock`)},async unlockDeploy(J){return X("POST",`/deploys/${J}/unlock`)}}}async function HZ($){let Z=await crypto.subtle.digest("SHA-1",$);return Array.from(new Uint8Array(Z)).map((X)=>X.toString(16).padStart(2,"0")).join("")}async function F7($,Z={}){let{ignore:Y=["node_modules",".git",".env*","*.map"]}=Z,X=[],J=new Bun.Glob("**/*");for await(let Q of J.scan({cwd:$,onlyFiles:!0,dot:!1})){if(Y.some((U)=>{if(U.includes("*"))return new RegExp(`^${U.replace(/\*/g,".*")}$`).test(Q);return Q.includes(U)}))continue;let K=`${$}/${Q}`,_=await Bun.file(K).arrayBuffer(),B=await HZ(_);X.push({path:Q,content:new Uint8Array(_),sha1:B})}return X}function L6($){let Z={};for(let Y of $)Z[`/${Y.path}`]=Y.sha1;return Z}function F6($,Z){let Y=new Set(Z.map((X)=>X.startsWith("/")?X.slice(1):X));return $.filter((X)=>Y.has(X.path))}function P$($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;if($<1073741824)return`${($/1048576).toFixed(1)} MB`;return`${($/1073741824).toFixed(1)} GB`}function $$($){return $.reduce((Z,Y)=>Z+Y.content.byteLength,0)}import f1 from"fs";import N1 from"path";function OZ($){let Z=[];if(Z.push("[build]"),Z.push(` command = "${y0($.build.command)}"`),Z.push(` publish = "${y0($.build.publish)}"`),$.build.functions)Z.push(` functions = "${y0($.build.functions)}"`);if($.build.edge_functions)Z.push(` edge_functions = "${y0($.build.edge_functions)}"`);if($.build.environment&&Object.keys($.build.environment).length>0){Z.push(""),Z.push("[build.environment]");for(let[Y,X]of Object.entries($.build.environment))Z.push(` ${Y} = "${y0(X)}"`)}if($.functions){if(Z.push(""),Z.push("[functions]"),$.functions.directory)Z.push(` directory = "${y0($.functions.directory)}"`);if($.functions.node_bundler)Z.push(` node_bundler = "${$.functions.node_bundler}"`);if($.functions.external_node_modules&&$.functions.external_node_modules.length>0)Z.push(` external_node_modules = [${$.functions.external_node_modules.map((Y)=>`"${Y}"`).join(", ")}]`)}if($.edge_functions&&$.edge_functions.length>0){Z.push("");for(let Y of $.edge_functions)Z.push("[[edge_functions]]"),Z.push(` function = "${y0(Y.function)}"`),Z.push(` path = "${y0(Y.path)}"`)}if($.redirects&&$.redirects.length>0){Z.push("");for(let Y of $.redirects){if(Z.push("[[redirects]]"),Z.push(` from = "${y0(Y.from)}"`),Z.push(` to = "${y0(Y.to)}"`),Y.status!==void 0)Z.push(` status = ${Y.status}`);if(Y.force!==void 0)Z.push(` force = ${Y.force}`);if(Y.conditions&&Object.keys(Y.conditions).length>0){Z.push(" [redirects.conditions]");for(let[X,J]of Object.entries(Y.conditions))Z.push(` ${X} = "${y0(J)}"`)}}}if($.headers&&$.headers.length>0){Z.push("");for(let Y of $.headers){Z.push("[[headers]]"),Z.push(` for = "${y0(Y.for)}"`),Z.push(" [headers.values]");for(let[X,J]of Object.entries(Y.values))Z.push(` ${X} = "${y0(J)}"`)}}if($.plugins&&$.plugins.length>0){Z.push("");for(let Y of $.plugins)if(Z.push("[[plugins]]"),Z.push(` package = "${y0(Y.package)}"`),Y.inputs&&Object.keys(Y.inputs).length>0){Z.push(" [plugins.inputs]");for(let[X,J]of Object.entries(Y.inputs))if(typeof J==="string")Z.push(` ${X} = "${y0(J)}"`);else if(typeof J==="boolean"||typeof J==="number")Z.push(` ${X} = ${J}`)}}if($.context&&Object.keys($.context).length>0)for(let[Y,X]of Object.entries($.context)){if(Z.push(""),Z.push(`[context.${Y}]`),X.command)Z.push(` command = "${y0(X.command)}"`);if(X.publish)Z.push(` publish = "${y0(X.publish)}"`);if(X.environment&&Object.keys(X.environment).length>0){Z.push(` [context.${Y}.environment]`);for(let[J,Q]of Object.entries(X.environment))Z.push(` ${J} = "${y0(Q)}"`)}}return Z.join(`
3
3
  `)+`
4
- `}function y0($){return $.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}async function V7($){let Z={framework:"stx",buildCommand:"bun run build",outputDir:"dist"},Y=N1.join($,"package.json");if(await Bun.file(Y).exists())try{let _=JSON.parse(await Bun.file(Y).text());if(_.scripts?.build)Z.buildCommand="bun run build";let B={..._.dependencies,..._.devDependencies};if(B["@stacksjs/stx"]||B.stx)Z.framework="stx"}catch{}let X=N1.join($,"stx.config.ts"),J=N1.join($,".config","stx.config.ts");if(await Bun.file(X).exists()||await Bun.file(J).exists())Z.framework="stx";let Q=["dist","build","out","public",".output"];for(let _ of Q){let B=N1.join($,_);if(f1.existsSync(B)&&f1.statSync(B).isDirectory()){Z.outputDir=_;break}}let G=["functions","netlify/functions","api"];for(let _ of G){let B=N1.join($,_);if(f1.existsSync(B)&&f1.statSync(B).isDirectory()){Z.functionsDir=_;break}}let K=N1.join($,"netlify","edge-functions");if(f1.existsSync(K))Z.edgeFunctionsDir="netlify/edge-functions";let W=N1.join($,Z.outputDir||"dist");if(f1.existsSync(W)){let _=f1.existsSync(N1.join(W,"index.html")),B=f1.readdirSync(W).filter((U)=>U.endsWith(".html"));Z.isSPA=_&&B.length===1}return Z}function N7($={}){let Z={build:{command:$.buildCommand||"bun run build",publish:$.outputDir||"dist"}};if($.functionsDir)Z.build.functions=$.functionsDir,Z.functions={directory:$.functionsDir,node_bundler:"esbuild"};if($.edgeFunctionsDir)Z.build.edge_functions=$.edgeFunctionsDir;if(Z.headers=[{for:"/*",values:{"X-Frame-Options":"DENY","X-Content-Type-Options":"nosniff","X-XSS-Protection":"1; mode=block","Referrer-Policy":"strict-origin-when-cross-origin"}},{for:"/assets/*",values:{"Cache-Control":"public, max-age=31536000, immutable"}}],$.isSPA!==!1)Z.redirects=[{from:"/*",to:"/index.html",status:200}];return Z.context={production:{environment:{NODE_ENV:"production"}},"deploy-preview":{environment:{NODE_ENV:"development"}}},Z}async function V6($,Z){let Y=await V7($),X=Z||N7(Y),J=LZ(X),Q=N1.join($,"netlify.toml");return await Bun.write(Q,J),Q}function N6($){return f1.existsSync(N1.join($,"netlify.toml"))}var FZ=()=>{};import VZ from"fs";import NZ from"path";async function zH($={}){let Z=Date.now(),Y=[],X=$.cwd||process.cwd(),J=(L)=>{Y.push(L)},Q=(L)=>{if($.onProgress)$.onProgress(L)},G=NZ.resolve(X,$.directory||"dist"),K=$.token||process.env.NETLIFY_AUTH_TOKEN,W=$.siteId||process.env.NETLIFY_SITE_ID;if(!K)throw new $$(`No Netlify auth token found.
4
+ `}function y0($){return $.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}async function V7($){let Z={framework:"stx",buildCommand:"bun run build",outputDir:"dist"},Y=N1.join($,"package.json");if(await Bun.file(Y).exists())try{let _=JSON.parse(await Bun.file(Y).text());if(_.scripts?.build)Z.buildCommand="bun run build";let B={..._.dependencies,..._.devDependencies};if(B["@stacksjs/stx"]||B.stx)Z.framework="stx"}catch{}let X=N1.join($,"stx.config.ts"),J=N1.join($,".config","stx.config.ts");if(await Bun.file(X).exists()||await Bun.file(J).exists())Z.framework="stx";let Q=["dist","build","out","public",".output"];for(let _ of Q){let B=N1.join($,_);if(f1.existsSync(B)&&f1.statSync(B).isDirectory()){Z.outputDir=_;break}}let G=["functions","netlify/functions","api"];for(let _ of G){let B=N1.join($,_);if(f1.existsSync(B)&&f1.statSync(B).isDirectory()){Z.functionsDir=_;break}}let K=N1.join($,"netlify","edge-functions");if(f1.existsSync(K))Z.edgeFunctionsDir="netlify/edge-functions";let W=N1.join($,Z.outputDir||"dist");if(f1.existsSync(W)){let _=f1.existsSync(N1.join(W,"index.html")),B=f1.readdirSync(W).filter((U)=>U.endsWith(".html"));Z.isSPA=_&&B.length===1}return Z}function N7($={}){let Z={build:{command:$.buildCommand||"bun run build",publish:$.outputDir||"dist"}};if($.functionsDir)Z.build.functions=$.functionsDir,Z.functions={directory:$.functionsDir,node_bundler:"esbuild"};if($.edgeFunctionsDir)Z.build.edge_functions=$.edgeFunctionsDir;if(Z.headers=[{for:"/*",values:{"X-Frame-Options":"DENY","X-Content-Type-Options":"nosniff","X-XSS-Protection":"1; mode=block","Referrer-Policy":"strict-origin-when-cross-origin"}},{for:"/assets/*",values:{"Cache-Control":"public, max-age=31536000, immutable"}}],$.isSPA!==!1)Z.redirects=[{from:"/*",to:"/index.html",status:200}];return Z.context={production:{environment:{NODE_ENV:"production"}},"deploy-preview":{environment:{NODE_ENV:"development"}}},Z}async function V6($,Z){let Y=await V7($),X=Z||N7(Y),J=OZ(X),Q=N1.join($,"netlify.toml");return await Bun.write(Q,J),Q}function N6($){return f1.existsSync(N1.join($,"netlify.toml"))}var LZ=()=>{};import FZ from"fs";import VZ from"path";async function zH($={}){let Z=Date.now(),Y=[],X=$.cwd||process.cwd(),J=(L)=>{Y.push(L)},Q=(L)=>{if($.onProgress)$.onProgress(L)},G=VZ.resolve(X,$.directory||"dist"),K=$.token||process.env.NETLIFY_AUTH_TOKEN,W=$.siteId||process.env.NETLIFY_SITE_ID;if(!K)throw new Z$(`No Netlify auth token found.
5
5
 
6
6
  To deploy to Netlify:
7
7
  1. Create account at https://app.netlify.com
8
8
  2. Get token at https://app.netlify.com/user/applications#personal-access-tokens
9
9
  3. Set NETLIFY_AUTH_TOKEN environment variable
10
10
 
11
- export NETLIFY_AUTH_TOKEN=your_token_here`,"NO_TOKEN");if(!W)throw new $$(`No Netlify site ID found.
11
+ export NETLIFY_AUTH_TOKEN=your_token_here`,"NO_TOKEN");if(!W)throw new Z$(`No Netlify site ID found.
12
12
 
13
13
  Either:
14
14
  1. Set NETLIFY_SITE_ID environment variable
15
15
  2. Pass --site-id option
16
16
  3. Run \`stx deploy --init\` to set up
17
17
 
18
- Find your site ID at: https://app.netlify.com/sites/YOUR_SITE/settings/general`,"NO_SITE_ID");if(!VZ.existsSync(G))throw new $$(`Build directory not found: ${G}
18
+ Find your site ID at: https://app.netlify.com/sites/YOUR_SITE/settings/general`,"NO_SITE_ID");if(!FZ.existsSync(G))throw new Z$(`Build directory not found: ${G}
19
19
 
20
- Run \`stx build\` first or specify a different directory with --directory`,"NO_BUILD_DIR");if(!(VZ.readdirSync(G).length>0))throw new $$(`Build directory is empty: ${G}
20
+ Run \`stx build\` first or specify a different directory with --directory`,"NO_BUILD_DIR");if(!(FZ.readdirSync(G).length>0))throw new Z$(`Build directory is empty: ${G}
21
21
 
22
- Run \`stx build\` to generate files`,"EMPTY_BUILD_DIR");if($.dryRun){Q({stage:"collect",message:"Collecting files..."});let L=await F7(G),V=e1(L);return J(`Would deploy ${L.length} files (${P$(V)})`),J(`From: ${G}`),J(`To: Site ${W}`),J(`Mode: ${$.production?"production":"draft"}`),{success:!0,url:`https://${W}.netlify.app (dry-run)`,deployId:"dry-run",logs:Y,duration:Date.now()-Z,filesUploaded:L.length,totalSize:V}}let B=O6({token:K});Q({stage:"collect",message:"Verifying site..."});try{let L=await B.getSite(W);J(`Deploying to: ${L.name} (${L.url})`)}catch(L){if(L.status===404)throw new $$(`Site not found: ${W}
22
+ Run \`stx build\` to generate files`,"EMPTY_BUILD_DIR");if($.dryRun){Q({stage:"collect",message:"Collecting files..."});let L=await F7(G),V=$$(L);return J(`Would deploy ${L.length} files (${P$(V)})`),J(`From: ${G}`),J(`To: Site ${W}`),J(`Mode: ${$.production?"production":"draft"}`),{success:!0,url:`https://${W}.netlify.app (dry-run)`,deployId:"dry-run",logs:Y,duration:Date.now()-Z,filesUploaded:L.length,totalSize:V}}let B=O6({token:K});Q({stage:"collect",message:"Verifying site..."});try{let L=await B.getSite(W);J(`Deploying to: ${L.name} (${L.url})`)}catch(L){if(L.status===404)throw new Z$(`Site not found: ${W}
23
23
 
24
- Check your site ID or create a new site at https://app.netlify.com`,"SITE_NOT_FOUND");throw L}Q({stage:"collect",message:"Collecting files..."});let U=await F7(G),z=e1(U);if(J(`Found ${U.length} files (${P$(z)})`),U.length===0)throw new $$(`No files found in ${G}`,"NO_FILES");let q=L6(U);Q({stage:"upload",message:"Creating deploy...",percent:0});let j=await B.createDeploy(W,{title:$.message||"Deploy from stx CLI",draft:!$.production,files:q});J(`Created deploy: ${j.id}`);let H=F6(U,j.required||[]);if(J(`Uploading ${H.length} files...`),H.length>0){let L=0,V=e1(H);for(let A of H){await B.uploadFile(j.id,A.path,A.content),L++;let N=Math.round(L/H.length*100);Q({stage:"upload",message:`Uploading: ${A.path}`,percent:N,details:{uploaded:L,total:H.length}})}J(`Uploaded ${P$(V)}`)}else J("All files already on CDN (no upload needed)");Q({stage:"process",message:"Processing deploy..."});let O=await B.waitForDeploy(j.id,{onProgress:(L)=>{Q({stage:"process",message:`Status: ${L.state}`,details:L})}}),F=Date.now()-Z;if(Q({stage:"done",message:"Deploy complete!"}),J(`Deploy complete in ${(F/1000).toFixed(1)}s`),J(`URL: ${O.deploy_ssl_url}`),$.production)J(`Site: ${O.ssl_url}`);if($.open){let L=$.production?O.ssl_url:O.deploy_ssl_url;jH(L)}return{success:!0,url:O.deploy_ssl_url,siteUrl:$.production?O.ssl_url:void 0,deployId:O.id,logs:Y,duration:F,filesUploaded:H.length,totalSize:e1(H)}}async function qH($={}){let Z=$.directory||process.cwd(),Y;if(N6(Z))Y=NZ.join(Z,"netlify.toml");else{let X=await V7(Z);Y=await V6(Z,N7(X))}if($.siteId){let X=NZ.join(Z,".env.local"),J="";if(await Bun.file(X).exists()){if(J=await Bun.file(X).text(),J=J.split(`
24
+ Check your site ID or create a new site at https://app.netlify.com`,"SITE_NOT_FOUND");throw L}Q({stage:"collect",message:"Collecting files..."});let U=await F7(G),z=$$(U);if(J(`Found ${U.length} files (${P$(z)})`),U.length===0)throw new Z$(`No files found in ${G}`,"NO_FILES");let q=L6(U);Q({stage:"upload",message:"Creating deploy...",percent:0});let j=await B.createDeploy(W,{title:$.message||"Deploy from stx CLI",draft:!$.production,files:q});J(`Created deploy: ${j.id}`);let H=F6(U,j.required||[]);if(J(`Uploading ${H.length} files...`),H.length>0){let L=0,V=$$(H);for(let A of H){await B.uploadFile(j.id,A.path,A.content),L++;let N=Math.round(L/H.length*100);Q({stage:"upload",message:`Uploading: ${A.path}`,percent:N,details:{uploaded:L,total:H.length}})}J(`Uploaded ${P$(V)}`)}else J("All files already on CDN (no upload needed)");Q({stage:"process",message:"Processing deploy..."});let O=await B.waitForDeploy(j.id,{onProgress:(L)=>{Q({stage:"process",message:`Status: ${L.state}`,details:L})}}),F=Date.now()-Z;if(Q({stage:"done",message:"Deploy complete!"}),J(`Deploy complete in ${(F/1000).toFixed(1)}s`),J(`URL: ${O.deploy_ssl_url}`),$.production)J(`Site: ${O.ssl_url}`);if($.open){let L=$.production?O.ssl_url:O.deploy_ssl_url;jH(L)}return{success:!0,url:O.deploy_ssl_url,siteUrl:$.production?O.ssl_url:void 0,deployId:O.id,logs:Y,duration:F,filesUploaded:H.length,totalSize:$$(H)}}async function qH($={}){let Z=$.directory||process.cwd(),Y;if(N6(Z))Y=VZ.join(Z,"netlify.toml");else{let X=await V7(Z);Y=await V6(Z,N7(X))}if($.siteId){let X=VZ.join(Z,".env.local"),J="";if(await Bun.file(X).exists()){if(J=await Bun.file(X).text(),J=J.split(`
25
25
  `).filter((Q)=>!Q.startsWith("NETLIFY_SITE_ID=")).join(`
26
26
  `),J&&!J.endsWith(`
27
27
  `))J+=`
28
28
  `}J+=`NETLIFY_SITE_ID=${$.siteId}
29
- `,await Bun.write(X,J)}return{configPath:Y,siteId:$.siteId}}function jH($){let Z=process.platform,Y=Z==="darwin"?"open":Z==="win32"?"start":"xdg-open";Bun.spawn([Y,$],{stdio:["ignore","ignore","ignore"]})}var $$;var AZ=D(()=>{FZ();FZ();$$=class $$ extends Error{code;constructor($,Z){super($);this.name="DeployError",this.code=Z}}});import HH from"fs";import A6 from"path";import OH from"crypto";async function w6(){if(VQ)return wZ;VQ=!0;try{let $=await import("sharp");return wZ=$.default||$,wZ}catch{return null}}async function g1(){return await w6()!==null}async function h1($,Z={}){let{widths:Y=B1,formats:X=U1,quality:J=z1,fit:Q="cover",placeholder:G="none",outputDir:K=".stx/images",baseUrl:W="/images"}=Z,_,B;if(typeof $==="string"){if(B=$,!await Bun.file($).exists())throw new M7(`Image not found: ${$}`,"NOT_FOUND");_=await Bun.file($).arrayBuffer().then((A)=>Buffer.from(A))}else B="buffer-input",_=$;let U=OH.createHash("sha256").update(_).digest("hex").slice(0,12),z=await R6(_),{width:q,height:j}=z,H=q/j;await HH.promises.mkdir(K,{recursive:!0});let O=[],F=A6.basename(B,A6.extname(B)),L=Y.filter((A)=>A<=q);if(!L.includes(q)&&q<=Math.max(...Y))L.push(q);L.sort((A,N)=>A-N);for(let A of L){let N=Math.round(A/H);for(let w of X){let M=`${F}-${A}w-${U}.${w}`,T=A6.join(K,M),I=`${W}/${M}`,E=await VH(_,{width:A,height:N,format:w,quality:J,fit:Q});await Bun.write(T,E),O.push({path:T,url:I,width:A,height:N,format:w,size:E.length})}}let V;if(G!=="none")V=await NH(_,G);return{src:B,variants:O,placeholder:V,width:q,height:j,aspectRatio:H,hash:U}}async function R6($){let Z=typeof $==="string"?Buffer.from(await Bun.file($).arrayBuffer()):$,Y=await w6();if(Y){let J=await Y(Z).metadata();return{width:J.width||0,height:J.height||0,format:J.format||"unknown",hasAlpha:J.hasAlpha}}return FH(Z)}function FH($){if($[0]===137&&$[1]===80&&$[2]===78&&$[3]===71){let Z=$.readUInt32BE(16),Y=$.readUInt32BE(20);return{width:Z,height:Y,format:"png",hasAlpha:!0}}if($[0]===255&&$[1]===216){let Z=2;while(Z<$.length){if($[Z]!==255)break;let Y=$[Z+1];if(Y>=192&&Y<=207&&Y!==196&&Y!==200&&Y!==204){let J=$.readUInt16BE(Z+5);return{width:$.readUInt16BE(Z+7),height:J,format:"jpeg",hasAlpha:!1}}let X=$.readUInt16BE(Z+2);Z+=2+X}}if($.toString("utf8",0,4)==="RIFF"&&$.toString("utf8",8,12)==="WEBP"){let Z=$.toString("utf8",12,16);if(Z==="VP8 "){let Y=$.readUInt16LE(26)&16383,X=$.readUInt16LE(28)&16383;return{width:Y,height:X,format:"webp",hasAlpha:!1}}if(Z==="VP8L"){let Y=$.readUInt32LE(21),X=(Y&16383)+1,J=(Y>>14&16383)+1;return{width:X,height:J,format:"webp",hasAlpha:!0}}}if($.toString("utf8",0,3)==="GIF"){let Z=$.readUInt16LE(6),Y=$.readUInt16LE(8);return{width:Z,height:Y,format:"gif",hasAlpha:!0}}throw new M7("Unable to parse image dimensions","PARSE_ERROR")}async function VH($,Z){let Y=await w6();if(Y){let X=Y($).resize(Z.width,Z.height,{fit:Z.fit});switch(Z.format){case"webp":X=X.webp({quality:Z.quality});break;case"avif":X=X.avif({quality:Z.quality});break;case"jpeg":X=X.jpeg({quality:Z.quality});break;case"png":X=X.png({quality:Z.quality});break}return X.toBuffer()}return console.warn("sharp not available, returning original image without optimization"),$}async function NH($,Z){let Y=await w6();if(Z==="blur"&&Y){let J=(await Y($).resize(20).blur(10).toBuffer()).toString("base64"),Q=await R6($);return`data:${NQ[Q.format]||"image/jpeg"};base64,${J}`}if(Y){let{dominant:X}=await Y($).resize(1,1).toBuffer().then(async(J)=>{let Q=await Y(J).metadata();return{dominant:{r:128,g:128,b:128}}}).catch(()=>({dominant:{r:128,g:128,b:128}}));return`rgb(${X.r}, ${X.g}, ${X.b})`}return"rgb(128, 128, 128)"}function Q5($,Z){return(Z?$.filter((X)=>X.format===Z):$).sort((X,J)=>X.width-J.width).map((X)=>`${X.url} ${X.width}w`).join(", ")}function A7($){if(!$||Object.keys($).length===0)return"100vw";return Object.entries($).sort((Y,X)=>{let J=Number.parseInt(Y[0].replace(/\D/g,""))||0;return(Number.parseInt(X[0].replace(/\D/g,""))||0)-J}).map(([Y,X])=>`(max-width: ${Y}) ${X}`).join(", ")+", 100vw"}function w7($){let Z=$.filter((X)=>X.format==="jpeg");if(Z.length===0)return $[Math.floor($.length/2)];let Y=Z.sort((X,J)=>X.width-J.width);return Y[Math.floor(Y.length/2)]}function R7($){let Z=new Map;for(let Y of $){let X=Z.get(Y.format)||[];X.push(Y),Z.set(Y.format,X)}return Z}function M6($){let Z=A6.extname($).toLowerCase();return LH.includes(Z)}function d1($){return NQ[$]||"application/octet-stream"}function RZ($){return $.reduce((Z,Y)=>Z+Y.size,0)}function MZ($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1048576).toFixed(2)} MB`}var B1,U1,z1=80,LH,NQ,wZ=null,VQ=!1,M7;var T7=D(()=>{B1=[320,640,768,1024,1280,1536,1920],U1=["webp","jpeg"],LH=[".jpg",".jpeg",".png",".webp",".avif",".gif",".svg"],NQ={webp:"image/webp",avif:"image/avif",jpeg:"image/jpeg",png:"image/png"};M7=class M7 extends Error{code;constructor($,Z){super($);this.name="ImageProcessingError",this.code=Z}}});function AQ($,Z={}){let{src:Y,alt:X,width:J,height:Q,sizes:G="100vw",loading:K="lazy",priority:W=!1,quality:_=z1,placeholder:B="none",formats:U=U1,widths:z=B1,decoding:q="async",fetchpriority:j,objectFit:H,objectPosition:O}=$,F=$.class,L=$.style,{processedImage:V,variants:A,optimize:N=!0,isDev:w=!1}=Z;if(A&&A.length>0)return AH($,A,V);if(w||!N)return wH($);return RH($)}function AH($,Z,Y){let{src:X,alt:J,width:Q,height:G,sizes:K="100vw",loading:W="lazy",priority:_=!1,decoding:B="async",fetchpriority:U,objectFit:z,objectPosition:q,placeholder:j="none"}=$,H=$.class,O=$.style,F=R7(Z),L=w7(Z),V=typeof K==="object"?A7(K):K,A=Y?Y.aspectRatio:Q&&G?Number(Q)/Number(G):void 0,N=[];if(A)N.push(`aspect-ratio: ${A}`);if(z)N.push(`object-fit: ${z}`);if(q)N.push(`object-position: ${q}`);if(O)N.push(O);let w=N.length>0?` style="${N.join("; ")}"`:"",M=H?` class="${H}"`:"",T=_?"":` loading="${W}"`,I=` decoding="${B}"`,E=U?` fetchpriority="${U}"`:_?' fetchpriority="high"':"",S=["avif","webp","jpeg","png"],k=[];for(let l of S){let i=F.get(l);if(i&&i.length>0){let Y0=Q5(i),W0=d1(l);k.push(` <source type="${W0}" srcset="${Y0}" sizes="${V}" />`)}}let b="",P="",x;if(j!=="none"&&Y?.placeholder){let l=`img-${Math.random().toString(36).slice(2,8)}`;if(b=`<div class="stx-image-wrapper" id="${l}">`,P="</div>",j==="blur")x=`
29
+ `,await Bun.write(X,J)}return{configPath:Y,siteId:$.siteId}}function jH($){let Z=process.platform,Y=Z==="darwin"?"open":Z==="win32"?"start":"xdg-open";Bun.spawn([Y,$],{stdio:["ignore","ignore","ignore"]})}var Z$;var NZ=D(()=>{LZ();LZ();Z$=class Z$ extends Error{code;constructor($,Z){super($);this.name="DeployError",this.code=Z}}});import HH from"fs";import A6 from"path";import OH from"crypto";async function w6(){if(VQ)return AZ;VQ=!0;try{let $=await import("sharp");return AZ=$.default||$,AZ}catch{return null}}async function g1(){return await w6()!==null}async function h1($,Z={}){let{widths:Y=B1,formats:X=U1,quality:J=z1,fit:Q="cover",placeholder:G="none",outputDir:K=".stx/images",baseUrl:W="/images"}=Z,_,B;if(typeof $==="string"){if(B=$,!await Bun.file($).exists())throw new M7(`Image not found: ${$}`,"NOT_FOUND");_=await Bun.file($).arrayBuffer().then((A)=>Buffer.from(A))}else B="buffer-input",_=$;let U=OH.createHash("sha256").update(_).digest("hex").slice(0,12),z=await R6(_),{width:q,height:j}=z,H=q/j;await HH.promises.mkdir(K,{recursive:!0});let O=[],F=A6.basename(B,A6.extname(B)),L=Y.filter((A)=>A<=q);if(!L.includes(q)&&q<=Math.max(...Y))L.push(q);L.sort((A,N)=>A-N);for(let A of L){let N=Math.round(A/H);for(let w of X){let M=`${F}-${A}w-${U}.${w}`,T=A6.join(K,M),I=`${W}/${M}`,E=await VH(_,{width:A,height:N,format:w,quality:J,fit:Q});await Bun.write(T,E),O.push({path:T,url:I,width:A,height:N,format:w,size:E.length})}}let V;if(G!=="none")V=await NH(_,G);return{src:B,variants:O,placeholder:V,width:q,height:j,aspectRatio:H,hash:U}}async function R6($){let Z=typeof $==="string"?Buffer.from(await Bun.file($).arrayBuffer()):$,Y=await w6();if(Y){let J=await Y(Z).metadata();return{width:J.width||0,height:J.height||0,format:J.format||"unknown",hasAlpha:J.hasAlpha}}return FH(Z)}function FH($){if($[0]===137&&$[1]===80&&$[2]===78&&$[3]===71){let Z=$.readUInt32BE(16),Y=$.readUInt32BE(20);return{width:Z,height:Y,format:"png",hasAlpha:!0}}if($[0]===255&&$[1]===216){let Z=2;while(Z<$.length){if($[Z]!==255)break;let Y=$[Z+1];if(Y>=192&&Y<=207&&Y!==196&&Y!==200&&Y!==204){let J=$.readUInt16BE(Z+5);return{width:$.readUInt16BE(Z+7),height:J,format:"jpeg",hasAlpha:!1}}let X=$.readUInt16BE(Z+2);Z+=2+X}}if($.toString("utf8",0,4)==="RIFF"&&$.toString("utf8",8,12)==="WEBP"){let Z=$.toString("utf8",12,16);if(Z==="VP8 "){let Y=$.readUInt16LE(26)&16383,X=$.readUInt16LE(28)&16383;return{width:Y,height:X,format:"webp",hasAlpha:!1}}if(Z==="VP8L"){let Y=$.readUInt32LE(21),X=(Y&16383)+1,J=(Y>>14&16383)+1;return{width:X,height:J,format:"webp",hasAlpha:!0}}}if($.toString("utf8",0,3)==="GIF"){let Z=$.readUInt16LE(6),Y=$.readUInt16LE(8);return{width:Z,height:Y,format:"gif",hasAlpha:!0}}throw new M7("Unable to parse image dimensions","PARSE_ERROR")}async function VH($,Z){let Y=await w6();if(Y){let X=Y($).resize(Z.width,Z.height,{fit:Z.fit});switch(Z.format){case"webp":X=X.webp({quality:Z.quality});break;case"avif":X=X.avif({quality:Z.quality});break;case"jpeg":X=X.jpeg({quality:Z.quality});break;case"png":X=X.png({quality:Z.quality});break}return X.toBuffer()}return console.warn("sharp not available, returning original image without optimization"),$}async function NH($,Z){let Y=await w6();if(Z==="blur"&&Y){let J=(await Y($).resize(20).blur(10).toBuffer()).toString("base64"),Q=await R6($);return`data:${NQ[Q.format]||"image/jpeg"};base64,${J}`}if(Y){let{dominant:X}=await Y($).resize(1,1).toBuffer().then(async(J)=>{let Q=await Y(J).metadata();return{dominant:{r:128,g:128,b:128}}}).catch(()=>({dominant:{r:128,g:128,b:128}}));return`rgb(${X.r}, ${X.g}, ${X.b})`}return"rgb(128, 128, 128)"}function Q5($,Z){return(Z?$.filter((X)=>X.format===Z):$).sort((X,J)=>X.width-J.width).map((X)=>`${X.url} ${X.width}w`).join(", ")}function A7($){if(!$||Object.keys($).length===0)return"100vw";return Object.entries($).sort((Y,X)=>{let J=Number.parseInt(Y[0].replace(/\D/g,""))||0;return(Number.parseInt(X[0].replace(/\D/g,""))||0)-J}).map(([Y,X])=>`(max-width: ${Y}) ${X}`).join(", ")+", 100vw"}function w7($){let Z=$.filter((X)=>X.format==="jpeg");if(Z.length===0)return $[Math.floor($.length/2)];let Y=Z.sort((X,J)=>X.width-J.width);return Y[Math.floor(Y.length/2)]}function R7($){let Z=new Map;for(let Y of $){let X=Z.get(Y.format)||[];X.push(Y),Z.set(Y.format,X)}return Z}function M6($){let Z=A6.extname($).toLowerCase();return LH.includes(Z)}function d1($){return NQ[$]||"application/octet-stream"}function wZ($){return $.reduce((Z,Y)=>Z+Y.size,0)}function RZ($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1048576).toFixed(2)} MB`}var B1,U1,z1=80,LH,NQ,AZ=null,VQ=!1,M7;var T7=D(()=>{B1=[320,640,768,1024,1280,1536,1920],U1=["webp","jpeg"],LH=[".jpg",".jpeg",".png",".webp",".avif",".gif",".svg"],NQ={webp:"image/webp",avif:"image/avif",jpeg:"image/jpeg",png:"image/png"};M7=class M7 extends Error{code;constructor($,Z){super($);this.name="ImageProcessingError",this.code=Z}}});function AQ($,Z={}){let{src:Y,alt:X,width:J,height:Q,sizes:G="100vw",loading:K="lazy",priority:W=!1,quality:_=z1,placeholder:B="none",formats:U=U1,widths:z=B1,decoding:q="async",fetchpriority:j,objectFit:H,objectPosition:O}=$,F=$.class,L=$.style,{processedImage:V,variants:A,optimize:N=!0,isDev:w=!1}=Z;if(A&&A.length>0)return AH($,A,V);if(w||!N)return wH($);return RH($)}function AH($,Z,Y){let{src:X,alt:J,width:Q,height:G,sizes:K="100vw",loading:W="lazy",priority:_=!1,decoding:B="async",fetchpriority:U,objectFit:z,objectPosition:q,placeholder:j="none"}=$,H=$.class,O=$.style,F=R7(Z),L=w7(Z),V=typeof K==="object"?A7(K):K,A=Y?Y.aspectRatio:Q&&G?Number(Q)/Number(G):void 0,N=[];if(A)N.push(`aspect-ratio: ${A}`);if(z)N.push(`object-fit: ${z}`);if(q)N.push(`object-position: ${q}`);if(O)N.push(O);let w=N.length>0?` style="${N.join("; ")}"`:"",M=H?` class="${H}"`:"",T=_?"":` loading="${W}"`,I=` decoding="${B}"`,E=U?` fetchpriority="${U}"`:_?' fetchpriority="high"':"",S=["avif","webp","jpeg","png"],k=[];for(let l of S){let i=F.get(l);if(i&&i.length>0){let Y0=Q5(i),W0=d1(l);k.push(` <source type="${W0}" srcset="${Y0}" sizes="${V}" />`)}}let b="",P="",x;if(j!=="none"&&Y?.placeholder){let l=`img-${Math.random().toString(36).slice(2,8)}`;if(b=`<div class="stx-image-wrapper" id="${l}">`,P="</div>",j==="blur")x=`
30
30
  #${l} {
31
31
  position: relative;
32
32
  background-image: url('${Y.placeholder}');
@@ -48,16 +48,16 @@ ${k.join(`
48
48
  `)}
49
49
  <img
50
50
  src="${L?.url||X}"
51
- alt="${EZ(J)}"${C}${f}${M}${w}${T}${I}${E}
51
+ alt="${TZ(J)}"${C}${f}${M}${w}${T}${I}${E}
52
52
  />
53
- </picture>${P}`,h;if(_&&L){let l=F.get("webp"),i=l?.[Math.floor(l.length/2)]||L,Y0=d1(i.format);h=`<link rel="preload" as="image" href="${i.url}" type="${Y0}" />`}return{html:g,preloadLink:h,placeholderCss:x}}function wH($){let{src:Z,alt:Y,width:X,height:J,loading:Q="lazy",decoding:G="async",priority:K=!1,fetchpriority:W,objectFit:_,objectPosition:B}=$,U=$.class,z=$.style,q=[];if(_)q.push(`object-fit: ${_}`);if(B)q.push(`object-position: ${B}`);if(z)q.push(z);let j=q.length>0?` style="${q.join("; ")}"`:"",H=U?` class="${U}"`:"",O=X?` width="${X}"`:"",F=J?` height="${J}"`:"",L=K?"":` loading="${Q}"`,V=` decoding="${G}"`,A=W?` fetchpriority="${W}"`:K?' fetchpriority="high"':"";return{html:`<img src="${Z}" alt="${EZ(Y)}"${O}${F}${H}${j}${L}${V}${A} />`}}function RH($){let{src:Z,alt:Y,width:X,height:J,sizes:Q="100vw",loading:G="lazy",priority:K=!1,quality:W=z1,formats:_=U1,widths:B=B1,decoding:U="async",fetchpriority:z,objectFit:q,objectPosition:j}=$,H=$.class,O=$.style,F=[];if(q)F.push(`object-fit: ${q}`);if(j)F.push(`object-position: ${j}`);if(O)F.push(O);let L=F.length>0?` style="${F.join("; ")}"`:"",V=H?` class="${H}"`:"",A=X?` width="${X}"`:"",N=J?` height="${J}"`:"",w=K?"":` loading="${G}"`,M=` decoding="${U}"`,T=z?` fetchpriority="${z}"`:K?' fetchpriority="high"':"",I=typeof Q==="object"?A7(Q):Q,E=`
53
+ </picture>${P}`,h;if(_&&L){let l=F.get("webp"),i=l?.[Math.floor(l.length/2)]||L,Y0=d1(i.format);h=`<link rel="preload" as="image" href="${i.url}" type="${Y0}" />`}return{html:g,preloadLink:h,placeholderCss:x}}function wH($){let{src:Z,alt:Y,width:X,height:J,loading:Q="lazy",decoding:G="async",priority:K=!1,fetchpriority:W,objectFit:_,objectPosition:B}=$,U=$.class,z=$.style,q=[];if(_)q.push(`object-fit: ${_}`);if(B)q.push(`object-position: ${B}`);if(z)q.push(z);let j=q.length>0?` style="${q.join("; ")}"`:"",H=U?` class="${U}"`:"",O=X?` width="${X}"`:"",F=J?` height="${J}"`:"",L=K?"":` loading="${Q}"`,V=` decoding="${G}"`,A=W?` fetchpriority="${W}"`:K?' fetchpriority="high"':"";return{html:`<img src="${Z}" alt="${TZ(Y)}"${O}${F}${H}${j}${L}${V}${A} />`}}function RH($){let{src:Z,alt:Y,width:X,height:J,sizes:Q="100vw",loading:G="lazy",priority:K=!1,quality:W=z1,formats:_=U1,widths:B=B1,decoding:U="async",fetchpriority:z,objectFit:q,objectPosition:j}=$,H=$.class,O=$.style,F=[];if(q)F.push(`object-fit: ${q}`);if(j)F.push(`object-position: ${j}`);if(O)F.push(O);let L=F.length>0?` style="${F.join("; ")}"`:"",V=H?` class="${H}"`:"",A=X?` width="${X}"`:"",N=J?` height="${J}"`:"",w=K?"":` loading="${G}"`,M=` decoding="${U}"`,T=z?` fetchpriority="${z}"`:K?' fetchpriority="high"':"",I=typeof Q==="object"?A7(Q):Q,E=`
54
54
  data-stx-image
55
55
  data-src="${Z}"
56
56
  data-sizes="${I}"
57
57
  data-quality="${W}"
58
58
  data-formats="${_.join(",")}"
59
59
  data-widths="${B.join(",")}"
60
- `.replace(/\s+/g," ").trim();return{html:`<img src="${Z}" alt="${EZ(Y)}"${A}${N}${V}${L}${w}${M}${T} ${E} />`}}function TZ($){let Z=$.match(/<Image\s+([^>]*?)\/?>/);if(!Z)return null;let Y=Z[1],X={},J=/(\w+)(?:=(?:"([^"]*)"|'([^']*)'|(\{[^}]+\})))?/g,Q;while((Q=J.exec(Y))!==null){let[,G,K,W,_]=Q,B=K??W??_??!0;switch(G){case"src":X.src=String(B);break;case"alt":X.alt=String(B);break;case"width":X.width=Number(B)||B;break;case"height":X.height=Number(B)||B;break;case"sizes":X.sizes=String(B);break;case"loading":X.loading=B;break;case"priority":X.priority=B===!0||B==="true";break;case"quality":X.quality=Number(B);break;case"placeholder":X.placeholder=B;break;case"class":X.class=String(B);break;case"style":X.style=String(B);break;case"decoding":X.decoding=B;break;case"fetchpriority":X.fetchpriority=B;break;case"objectFit":X.objectFit=B;break;case"objectPosition":X.objectPosition=String(B);break}}if(!X.src||!X.alt)return null;return X}async function wQ($,Z){let Y=/<Image\s+[^>]*?\/?>/g,X=[],J=[],Q=$,G,K=[];while((G=Y.exec($))!==null)K.push({match:G[0],index:G.index});for(let W=K.length-1;W>=0;W--){let{match:_}=K[W],B=TZ(_);if(B){let U=await Z(B);if(Q=Q.replace(_,U.html),U.preloadLink)X.push(U.preloadLink);if(U.placeholderCss)J.push(U.placeholderCss)}}return{html:Q,preloadLinks:X,styles:J}}function EZ($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}var RQ=D(()=>{T7()});function MQ($){if(T6.set($.name,$),$.client)IZ.set($.name,$.client)}function MH($){return T6.get($)}function TH(){return Array.from(T6.values())}function EH($){return IZ.delete($),T6.delete($)}function T0($){return MQ($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,X,J,Q)=>{let G=DH(X,$.defaults);if($.validate){let W=$.validate(G);if(W!==!0){let _=typeof W==="string"?W:`Invalid parameters for @${$.name}`;throw Error(_)}}let K=Y;if($.transform)K=await $.transform(Y,G,J,Q);if($.clientScript){let W=$.clientScript(G);K+=`<script>${W}</script>`}if($.css){let W=$.css(G);K+=`<style>${W}</style>`}return K}}}function IH($,Z){let Y=typeof Z==="function"?{mounted:Z}:Z;return IZ.set($,Y),Y}function DH($,Z){let Y={...Z};for(let X of $){let J=X.indexOf(":"),Q=X.indexOf("="),G=J>=0&&(Q<0||J<Q)?J:Q;if(G>=0){let K=X.slice(0,G).trim(),W=X.slice(G+1).trim();if(W==="true")W=!0;else if(W==="false")W=!1;else if(W==="null")W=null;else if(!Number.isNaN(Number(W)))W=Number(W);else if(typeof W==="string"&&W.startsWith("{"))try{W=JSON.parse(W)}catch{}Y[K]=W}else{let K=Object.keys(Y).filter((W)=>!Z||!(W in Z)).length;Y[K===0?"value":`arg${K}`]=X}}return Y}function kH(){return[T0({name:"uppercase",description:"Convert content to uppercase",transform:($)=>$.toUpperCase()}),T0({name:"lowercase",description:"Convert content to lowercase",transform:($)=>$.toLowerCase()}),T0({name:"capitalize",description:"Capitalize first letter of content",transform:($)=>$.charAt(0).toUpperCase()+$.slice(1)}),T0({name:"trim",description:"Remove leading and trailing whitespace",transform:($)=>$.trim()}),T0({name:"truncate",description:"Truncate content to specified length",defaults:{length:100,suffix:"..."},transform:($,{length:Z,suffix:Y})=>$.length>Z?$.slice(0,Z)+Y:$}),T0({name:"highlight",description:"Highlight content with background color",defaults:{color:"yellow"},transform:($,{color:Z})=>`<mark style="background-color: ${Z}; padding: 0.1em 0.2em; border-radius: 0.2em;">${$}</mark>`}),T0({name:"badge",description:"Create a badge/tag",defaults:{variant:"default",color:""},transform:($,{variant:Z,color:Y})=>{let X={default:"background: #e5e7eb; color: #374151;",primary:"background: #3b82f6; color: white;",success:"background: #10b981; color: white;",warning:"background: #f59e0b; color: white;",danger:"background: #ef4444; color: white;",info:"background: #06b6d4; color: white;"};return`<span style="${Y?`background: ${Y}; color: white;`:X[Z]||X.default} padding: 0.25em 0.5em; border-radius: 9999px; font-size: 0.875em; font-weight: 500;">${$}</span>`}}),T0({name:"code",description:"Style content as inline code",transform:($)=>`<code style="background: #f3f4f6; padding: 0.2em 0.4em; border-radius: 0.25em; font-family: ui-monospace, monospace; font-size: 0.875em;">${$}</code>`}),T0({name:"tooltip",description:"Add a tooltip to content",defaults:{text:"",position:"top"},hasEndTag:!0,transform:($,{text:Z,position:Y})=>`<span class="stx-tooltip" data-tooltip="${Z}" data-tooltip-position="${Y}" style="position: relative; cursor: help;">${$}</span>`,css:()=>`
60
+ `.replace(/\s+/g," ").trim();return{html:`<img src="${Z}" alt="${TZ(Y)}"${A}${N}${V}${L}${w}${M}${T} ${E} />`}}function MZ($){let Z=$.match(/<Image\s+([^>]*?)\/?>/);if(!Z)return null;let Y=Z[1],X={},J=/(\w+)(?:=(?:"([^"]*)"|'([^']*)'|(\{[^}]+\})))?/g,Q;while((Q=J.exec(Y))!==null){let[,G,K,W,_]=Q,B=K??W??_??!0;switch(G){case"src":X.src=String(B);break;case"alt":X.alt=String(B);break;case"width":X.width=Number(B)||B;break;case"height":X.height=Number(B)||B;break;case"sizes":X.sizes=String(B);break;case"loading":X.loading=B;break;case"priority":X.priority=B===!0||B==="true";break;case"quality":X.quality=Number(B);break;case"placeholder":X.placeholder=B;break;case"class":X.class=String(B);break;case"style":X.style=String(B);break;case"decoding":X.decoding=B;break;case"fetchpriority":X.fetchpriority=B;break;case"objectFit":X.objectFit=B;break;case"objectPosition":X.objectPosition=String(B);break}}if(!X.src||!X.alt)return null;return X}async function wQ($,Z){let Y=/<Image\s+[^>]*?\/?>/g,X=[],J=[],Q=$,G,K=[];while((G=Y.exec($))!==null)K.push({match:G[0],index:G.index});for(let W=K.length-1;W>=0;W--){let{match:_}=K[W],B=MZ(_);if(B){let U=await Z(B);if(Q=Q.replace(_,U.html),U.preloadLink)X.push(U.preloadLink);if(U.placeholderCss)J.push(U.placeholderCss)}}return{html:Q,preloadLinks:X,styles:J}}function TZ($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}var RQ=D(()=>{T7()});function MQ($){if(T6.set($.name,$),$.client)EZ.set($.name,$.client)}function MH($){return T6.get($)}function TH(){return Array.from(T6.values())}function EH($){return EZ.delete($),T6.delete($)}function T0($){return MQ($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,X,J,Q)=>{let G=DH(X,$.defaults);if($.validate){let W=$.validate(G);if(W!==!0){let _=typeof W==="string"?W:`Invalid parameters for @${$.name}`;throw Error(_)}}let K=Y;if($.transform)K=await $.transform(Y,G,J,Q);if($.clientScript){let W=$.clientScript(G);K+=`<script>${W}</script>`}if($.css){let W=$.css(G);K+=`<style>${W}</style>`}return K}}}function IH($,Z){let Y=typeof Z==="function"?{mounted:Z}:Z;return EZ.set($,Y),Y}function DH($,Z){let Y={...Z};for(let X of $){let J=X.indexOf(":"),Q=X.indexOf("="),G=J>=0&&(Q<0||J<Q)?J:Q;if(G>=0){let K=X.slice(0,G).trim(),W=X.slice(G+1).trim();if(W==="true")W=!0;else if(W==="false")W=!1;else if(W==="null")W=null;else if(!Number.isNaN(Number(W)))W=Number(W);else if(typeof W==="string"&&W.startsWith("{"))try{W=JSON.parse(W)}catch{}Y[K]=W}else{let K=Object.keys(Y).filter((W)=>!Z||!(W in Z)).length;Y[K===0?"value":`arg${K}`]=X}}return Y}function kH(){return[T0({name:"uppercase",description:"Convert content to uppercase",transform:($)=>$.toUpperCase()}),T0({name:"lowercase",description:"Convert content to lowercase",transform:($)=>$.toLowerCase()}),T0({name:"capitalize",description:"Capitalize first letter of content",transform:($)=>$.charAt(0).toUpperCase()+$.slice(1)}),T0({name:"trim",description:"Remove leading and trailing whitespace",transform:($)=>$.trim()}),T0({name:"truncate",description:"Truncate content to specified length",defaults:{length:100,suffix:"..."},transform:($,{length:Z,suffix:Y})=>$.length>Z?$.slice(0,Z)+Y:$}),T0({name:"highlight",description:"Highlight content with background color",defaults:{color:"yellow"},transform:($,{color:Z})=>`<mark style="background-color: ${Z}; padding: 0.1em 0.2em; border-radius: 0.2em;">${$}</mark>`}),T0({name:"badge",description:"Create a badge/tag",defaults:{variant:"default",color:""},transform:($,{variant:Z,color:Y})=>{let X={default:"background: #e5e7eb; color: #374151;",primary:"background: #3b82f6; color: white;",success:"background: #10b981; color: white;",warning:"background: #f59e0b; color: white;",danger:"background: #ef4444; color: white;",info:"background: #06b6d4; color: white;"};return`<span style="${Y?`background: ${Y}; color: white;`:X[Z]||X.default} padding: 0.25em 0.5em; border-radius: 9999px; font-size: 0.875em; font-weight: 500;">${$}</span>`}}),T0({name:"code",description:"Style content as inline code",transform:($)=>`<code style="background: #f3f4f6; padding: 0.2em 0.4em; border-radius: 0.25em; font-family: ui-monospace, monospace; font-size: 0.875em;">${$}</code>`}),T0({name:"tooltip",description:"Add a tooltip to content",defaults:{text:"",position:"top"},hasEndTag:!0,transform:($,{text:Z,position:Y})=>`<span class="stx-tooltip" data-tooltip="${Z}" data-tooltip-position="${Y}" style="position: relative; cursor: help;">${$}</span>`,css:()=>`
61
61
  .stx-tooltip::after {
62
62
  content: attr(data-tooltip);
63
63
  position: absolute;
@@ -201,7 +201,7 @@ ${k.join(`
201
201
 
202
202
  console.log('[stx] Directive runtime initialized');
203
203
  })();
204
- `}function bH($){let Z=/v-(\w+)(?::(\w+))?(?:\.([\w.]+))?="([^"]*)"/g;return $.replace(Z,(Y,X,J,Q,G)=>{let W=(Q?Q.split("."):[]).reduce((_,B)=>{return _[B]=!0,_},{});return`data-stx-directive="${X}:${G}" data-stx-directive-arg="${J||""}" data-stx-directive-modifiers='${JSON.stringify(W)}'`})}var T6,IZ;var E7=D(()=>{T6=new Map,IZ=new Map});function DZ(){E6.clear()}async function CH($,Z){let Y=`${$}:${JSON.stringify(Z)}`;if(E6.has(Y))return E6.get(Y);try{let X=await h1($,Z);return E6.set(Y,X),X}catch{return null}}function kZ(){return T0({name:"image",hasEndTag:!1,description:"Render an optimized image with responsive variants",transform:async($,Z,Y)=>{let{src:X,alt:J,options:Q}=yH($,Z,Y);if(!X)return console.warn("@image directive: missing src argument"),"<!-- @image: missing src -->";let G={widths:Q.widths||(Q.width?[Q.width]:B1),formats:Q.formats||U1,quality:Q.quality||z1,placeholder:(Q.placeholder==="color"?"dominant-color":Q.placeholder)||"none"};if(!await g1())return TQ(X,J||"",Q);let W=await CH(X,G);if(!W)return TQ(X,J||"",Q);return xH(W,J||"",Q)}})}function yH($,Z,Y){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let J=$.trim();if(J.startsWith("@image(")||J.startsWith("("))J=J.replace(/^@image\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=PH(J),G=Q[0]||"",K=Q[1]||"",W={};if(G&&!G.startsWith("/")&&!G.startsWith(".")&&!G.startsWith("http")){let _=Y[G];if(typeof _==="string")G=_}if(Q[2])try{if(typeof Q[2]==="string")W=JSON.parse(Q[2]);else W=Q[2]}catch{}return{src:G,alt:K,options:W}}function PH($){let Z=[],Y="",X=!1,J="",Q=0,G=0;for(let K=0;K<$.length;K++){let W=$[K],_=K>0?$[K-1]:"";if((W==='"'||W==="'")&&_!=="\\"){if(!X)X=!0,J=W;else if(W===J)X=!1,J="";else Y+=W;continue}if(!X){if(W==="{")Q++;if(W==="}")Q--;if(W==="[")G++;if(W==="]")G--;if(W===","&&Q===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=W}if(Y.trim())Z.push(Y.trim());return Z}function TQ($,Z,Y){let X=[`src="${u1($)}"`];if(Z)X.push(`alt="${u1(Z)}"`);if(Y.width)X.push(`width="${Y.width}"`);if(Y.height)X.push(`height="${Y.height}"`);if(Y.class)X.push(`class="${u1(Y.class)}"`);if(Y.style)X.push(`style="${u1(Y.style)}"`);if(Y.lazy!==!1)X.push('loading="lazy"');return X.push('decoding="async"'),`<img ${X.join(" ")} />`}function xH($,Z,Y){let{variants:X,placeholder:J,width:Q,height:G,aspectRatio:K}=$,W=new Map;for(let O of X){let F=W.get(O.format)||[];F.push(O),W.set(O.format,F)}let _=["avif","webp","jpeg","png"],B=[];for(let O of _){let F=W.get(O);if(F&&F.length>0){let L=Q5(F),V=d1(O),A=Y.sizes||"100vw";B.push(` <source type="${V}" srcset="${u1(L)}" sizes="${u1(A)}" />`)}}let U=W.get("jpeg")||[],z=U.length>0?U[Math.floor(U.length/2)]:X[Math.floor(X.length/2)],q=[`src="${z?.url||$.src}"`,`alt="${u1(Z)}"`];if(Y.width||Q)q.push(`width="${Y.width||Q}"`);if(Y.height||G)q.push(`height="${Y.height||G}"`);if(Y.class)q.push(`class="${u1(Y.class)}"`);let j=[];if(K)j.push(`aspect-ratio: ${K.toFixed(4)}`);if(Y.style)j.push(Y.style);if(j.length>0)q.push(`style="${j.join("; ")}"`);if(Y.lazy!==!1&&!Y.priority)q.push('loading="lazy"');if(q.push('decoding="async"'),Y.priority)q.push('fetchpriority="high"');let H=`<picture>
204
+ `}function bH($){let Z=/v-(\w+)(?::(\w+))?(?:\.([\w.]+))?="([^"]*)"/g;return $.replace(Z,(Y,X,J,Q,G)=>{let W=(Q?Q.split("."):[]).reduce((_,B)=>{return _[B]=!0,_},{});return`data-stx-directive="${X}:${G}" data-stx-directive-arg="${J||""}" data-stx-directive-modifiers='${JSON.stringify(W)}'`})}var T6,EZ;var E7=D(()=>{T6=new Map,EZ=new Map});function IZ(){E6.clear()}async function CH($,Z){let Y=`${$}:${JSON.stringify(Z)}`;if(E6.has(Y))return E6.get(Y);try{let X=await h1($,Z);return E6.set(Y,X),X}catch{return null}}function DZ(){return T0({name:"image",hasEndTag:!1,description:"Render an optimized image with responsive variants",transform:async($,Z,Y)=>{let{src:X,alt:J,options:Q}=yH($,Z,Y);if(!X)return console.warn("@image directive: missing src argument"),"<!-- @image: missing src -->";let G={widths:Q.widths||(Q.width?[Q.width]:B1),formats:Q.formats||U1,quality:Q.quality||z1,placeholder:(Q.placeholder==="color"?"dominant-color":Q.placeholder)||"none"};if(!await g1())return TQ(X,J||"",Q);let W=await CH(X,G);if(!W)return TQ(X,J||"",Q);return xH(W,J||"",Q)}})}function yH($,Z,Y){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let J=$.trim();if(J.startsWith("@image(")||J.startsWith("("))J=J.replace(/^@image\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=PH(J),G=Q[0]||"",K=Q[1]||"",W={};if(G&&!G.startsWith("/")&&!G.startsWith(".")&&!G.startsWith("http")){let _=Y[G];if(typeof _==="string")G=_}if(Q[2])try{if(typeof Q[2]==="string")W=JSON.parse(Q[2]);else W=Q[2]}catch{}return{src:G,alt:K,options:W}}function PH($){let Z=[],Y="",X=!1,J="",Q=0,G=0;for(let K=0;K<$.length;K++){let W=$[K],_=K>0?$[K-1]:"";if((W==='"'||W==="'")&&_!=="\\"){if(!X)X=!0,J=W;else if(W===J)X=!1,J="";else Y+=W;continue}if(!X){if(W==="{")Q++;if(W==="}")Q--;if(W==="[")G++;if(W==="]")G--;if(W===","&&Q===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=W}if(Y.trim())Z.push(Y.trim());return Z}function TQ($,Z,Y){let X=[`src="${u1($)}"`];if(Z)X.push(`alt="${u1(Z)}"`);if(Y.width)X.push(`width="${Y.width}"`);if(Y.height)X.push(`height="${Y.height}"`);if(Y.class)X.push(`class="${u1(Y.class)}"`);if(Y.style)X.push(`style="${u1(Y.style)}"`);if(Y.lazy!==!1)X.push('loading="lazy"');return X.push('decoding="async"'),`<img ${X.join(" ")} />`}function xH($,Z,Y){let{variants:X,placeholder:J,width:Q,height:G,aspectRatio:K}=$,W=new Map;for(let O of X){let F=W.get(O.format)||[];F.push(O),W.set(O.format,F)}let _=["avif","webp","jpeg","png"],B=[];for(let O of _){let F=W.get(O);if(F&&F.length>0){let L=Q5(F),V=d1(O),A=Y.sizes||"100vw";B.push(` <source type="${V}" srcset="${u1(L)}" sizes="${u1(A)}" />`)}}let U=W.get("jpeg")||[],z=U.length>0?U[Math.floor(U.length/2)]:X[Math.floor(X.length/2)],q=[`src="${z?.url||$.src}"`,`alt="${u1(Z)}"`];if(Y.width||Q)q.push(`width="${Y.width||Q}"`);if(Y.height||G)q.push(`height="${Y.height||G}"`);if(Y.class)q.push(`class="${u1(Y.class)}"`);let j=[];if(K)j.push(`aspect-ratio: ${K.toFixed(4)}`);if(Y.style)j.push(Y.style);if(j.length>0)q.push(`style="${j.join("; ")}"`);if(Y.lazy!==!1&&!Y.priority)q.push('loading="lazy"');if(q.push('decoding="async"'),Y.priority)q.push('fetchpriority="high"');let H=`<picture>
205
205
  `;if(H+=B.join(`
206
206
  `)+`
207
207
  `,H+=` <img ${q.join(" ")} />
@@ -210,10 +210,10 @@ ${H}
210
210
  </div>`}else if(Y.placeholder==="color"){let F=J.replace(/[^a-zA-Z0-9#(),.\s%-]/g,"");H=`<div id="${O}" class="stx-image-placeholder" style="background-color: ${F};">
211
211
  ${H}
212
212
  </div>`}}if(Y.priority&&z){let O=d1(z.format);H=`<link rel="preload" as="image" href="${u1(z.url)}" type="${O}" />
213
- `+H}return H}function u1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var E6,EQ;var IQ=D(()=>{E7();T7();E6=new Map;EQ=kZ()});import G5 from"fs";import I6 from"path";function DQ($={}){let{inputDirs:Z=["public","src/assets","assets"],outputDir:Y="dist/images",baseUrl:X="/images",formats:J=U1,widths:Q=B1,quality:G=z1,placeholder:K="none",concurrency:W=4,cache:_=!0,cacheDir:B=".stx/image-cache",referencedOnly:U=!1,verbose:z=!1}=$,q={imageReferences:new Set,processedImages:new Map,stats:{totalImages:0,optimizedImages:0,savedBytes:0,variants:0}};return{name:"stx-image-optimization",async setup(j){if(!await g1()){console.warn("[stx-images] sharp not available, image optimization disabled");return}if(_)await G5.promises.mkdir(B,{recursive:!0});if(z)console.log("[stx-images] Plugin initialized"),console.log(` Input dirs: ${Z.join(", ")}`),console.log(` Output dir: ${Y}`),console.log(` Formats: ${J.join(", ")}`),console.log(` Widths: ${Q.join(", ")}`)},async buildStart(){q.imageReferences.clear(),q.processedImages.clear(),q.stats={totalImages:0,optimizedImages:0,savedBytes:0,variants:0}},async transform(j,H){if(H.endsWith(".html")||H.endsWith(".stx")){let O=vH(j);for(let F of O)q.imageReferences.add(F)}if(j.includes("<Image")||j.includes("@image"))return await gH(j,{formats:J,widths:Q,quality:G,placeholder:K,outputDir:Y,baseUrl:X,processedImages:q.processedImages});return j},async buildEnd(j){if(!await g1())return;await G5.promises.mkdir(Y,{recursive:!0});let O=[];for(let V of Z){if(!G5.existsSync(V))continue;let A=await kQ(V);O.push(...A)}let F=U?O.filter((V)=>fH(V,q.imageReferences)):O;if(q.stats.totalImages=F.length,z)console.log(`[stx-images] Processing ${F.length} images...`);let L=SQ(F,W);for(let V of L)await Promise.all(V.map(async(A)=>{try{let N=await h1(A,{formats:J,widths:Q,quality:G,placeholder:K,outputDir:Y,baseUrl:X});q.processedImages.set(A,N),q.stats.optimizedImages++,q.stats.variants+=N.variants.length;let w=G5.statSync(A).size,M=RZ(N.variants);if(q.stats.savedBytes+=Math.max(0,w-M/N.variants.length),z)console.log(` \u2713 ${I6.basename(A)} \u2192 ${N.variants.length} variants`)}catch(N){console.error(`[stx-images] Error processing ${A}:`,N)}}));if(console.log("[stx-images] Optimization complete:"),console.log(` Images: ${q.stats.optimizedImages}/${q.stats.totalImages}`),console.log(` Variants: ${q.stats.variants}`),q.stats.savedBytes>0)console.log(` Saved: ~${MZ(q.stats.savedBytes)}`)}}}function vH($){let Z=[],Y=/src=["']([^"']+\.(jpg|jpeg|png|webp|avif|gif))["']/gi,X;while((X=Y.exec($))!==null)Z.push(X[1]);let J=/<Image[^>]+src=["']([^"']+)["']/gi;while((X=J.exec($))!==null)Z.push(X[1]);let Q=/@image\s*\(\s*['"]([^'"]+)['"]/gi;while((X=Q.exec($))!==null)Z.push(X[1]);let G=/background(?:-image)?:\s*url\(["']?([^"')]+\.(jpg|jpeg|png|webp|avif|gif))["']?\)/gi;while((X=G.exec($))!==null)Z.push(X[1]);return Z}function fH($,Z){let Y=I6.basename($);for(let X of Z)if(X.endsWith(Y)||X.includes(Y))return!0;return!1}async function gH($,Z){return $}async function kQ($){let Z=[];async function Y(X){let J=await G5.promises.readdir(X,{withFileTypes:!0});for(let Q of J){let G=I6.join(X,Q.name);if(Q.isDirectory())await Y(G);else if(Q.isFile()&&M6(G))Z.push(G)}}return await Y($),Z}function SQ($,Z){let Y=[];for(let X=0;X<$.length;X+=Z)Y.push($.slice(X,X+Z));return Y}async function SZ($,Z,Y={}){if(!await g1())throw Error("sharp is required for image optimization");return h1($,{...Y,outputDir:Z})}async function bQ($,Z,Y={}){let{formats:X=U1,widths:J=B1,quality:Q=z1,placeholder:G="none",concurrency:K=4,verbose:W=!1}=Y;if(!await g1())throw Error("sharp is required for image optimization");await G5.promises.mkdir(Z,{recursive:!0});let B=await kQ($),U=[],z={totalImages:B.length,optimizedImages:0,savedBytes:0,variants:0},q=SQ(B,K);for(let j of q){let H=await Promise.all(j.map(async(O)=>{try{let F=await h1(O,{formats:X,widths:J,quality:Q,placeholder:G,outputDir:Z,baseUrl:"/"});if(z.optimizedImages++,z.variants+=F.variants.length,W)console.log(` \u2713 ${I6.basename(O)}`);return F}catch(F){return console.error(`Error processing ${O}:`,F),null}}));U.push(...H.filter((O)=>O!==null))}return{processed:U,stats:z}}function bZ($){let Z={};for(let Y of $)Z[Y.src]={variants:Y.variants,placeholder:Y.placeholder};return Z}async function CQ($,Z){let Y=bZ($);await Bun.write(Z,JSON.stringify(Y,null,2))}var yQ=D(()=>{T7()});var hH;var CZ=D(()=>{T7();RQ();IQ();yQ();hH={enabled:!0,widths:[320,640,768,1024,1280,1536,1920],formats:["webp","jpeg"],quality:80,devOptimize:!1,cacheDir:".stx/image-cache",placeholder:"none",inputDirs:["public","src/assets","assets"],outputDir:"dist/images",baseUrl:"/images"}});function Z$($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(X,J)=>{return`const { ${J.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
213
+ `+H}return H}function u1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var E6,EQ;var IQ=D(()=>{E7();T7();E6=new Map;EQ=DZ()});import G5 from"fs";import I6 from"path";function DQ($={}){let{inputDirs:Z=["public","src/assets","assets"],outputDir:Y="dist/images",baseUrl:X="/images",formats:J=U1,widths:Q=B1,quality:G=z1,placeholder:K="none",concurrency:W=4,cache:_=!0,cacheDir:B=".stx/image-cache",referencedOnly:U=!1,verbose:z=!1}=$,q={imageReferences:new Set,processedImages:new Map,stats:{totalImages:0,optimizedImages:0,savedBytes:0,variants:0}};return{name:"stx-image-optimization",async setup(j){if(!await g1()){console.warn("[stx-images] sharp not available, image optimization disabled");return}if(_)await G5.promises.mkdir(B,{recursive:!0});if(z)console.log("[stx-images] Plugin initialized"),console.log(` Input dirs: ${Z.join(", ")}`),console.log(` Output dir: ${Y}`),console.log(` Formats: ${J.join(", ")}`),console.log(` Widths: ${Q.join(", ")}`)},async buildStart(){q.imageReferences.clear(),q.processedImages.clear(),q.stats={totalImages:0,optimizedImages:0,savedBytes:0,variants:0}},async transform(j,H){if(H.endsWith(".html")||H.endsWith(".stx")){let O=vH(j);for(let F of O)q.imageReferences.add(F)}if(j.includes("<Image")||j.includes("@image"))return await gH(j,{formats:J,widths:Q,quality:G,placeholder:K,outputDir:Y,baseUrl:X,processedImages:q.processedImages});return j},async buildEnd(j){if(!await g1())return;await G5.promises.mkdir(Y,{recursive:!0});let O=[];for(let V of Z){if(!G5.existsSync(V))continue;let A=await kQ(V);O.push(...A)}let F=U?O.filter((V)=>fH(V,q.imageReferences)):O;if(q.stats.totalImages=F.length,z)console.log(`[stx-images] Processing ${F.length} images...`);let L=SQ(F,W);for(let V of L)await Promise.all(V.map(async(A)=>{try{let N=await h1(A,{formats:J,widths:Q,quality:G,placeholder:K,outputDir:Y,baseUrl:X});q.processedImages.set(A,N),q.stats.optimizedImages++,q.stats.variants+=N.variants.length;let w=G5.statSync(A).size,M=wZ(N.variants);if(q.stats.savedBytes+=Math.max(0,w-M/N.variants.length),z)console.log(` \u2713 ${I6.basename(A)} \u2192 ${N.variants.length} variants`)}catch(N){console.error(`[stx-images] Error processing ${A}:`,N)}}));if(console.log("[stx-images] Optimization complete:"),console.log(` Images: ${q.stats.optimizedImages}/${q.stats.totalImages}`),console.log(` Variants: ${q.stats.variants}`),q.stats.savedBytes>0)console.log(` Saved: ~${RZ(q.stats.savedBytes)}`)}}}function vH($){let Z=[],Y=/src=["']([^"']+\.(jpg|jpeg|png|webp|avif|gif))["']/gi,X;while((X=Y.exec($))!==null)Z.push(X[1]);let J=/<Image[^>]+src=["']([^"']+)["']/gi;while((X=J.exec($))!==null)Z.push(X[1]);let Q=/@image\s*\(\s*['"]([^'"]+)['"]/gi;while((X=Q.exec($))!==null)Z.push(X[1]);let G=/background(?:-image)?:\s*url\(["']?([^"')]+\.(jpg|jpeg|png|webp|avif|gif))["']?\)/gi;while((X=G.exec($))!==null)Z.push(X[1]);return Z}function fH($,Z){let Y=I6.basename($);for(let X of Z)if(X.endsWith(Y)||X.includes(Y))return!0;return!1}async function gH($,Z){return $}async function kQ($){let Z=[];async function Y(X){let J=await G5.promises.readdir(X,{withFileTypes:!0});for(let Q of J){let G=I6.join(X,Q.name);if(Q.isDirectory())await Y(G);else if(Q.isFile()&&M6(G))Z.push(G)}}return await Y($),Z}function SQ($,Z){let Y=[];for(let X=0;X<$.length;X+=Z)Y.push($.slice(X,X+Z));return Y}async function kZ($,Z,Y={}){if(!await g1())throw Error("sharp is required for image optimization");return h1($,{...Y,outputDir:Z})}async function bQ($,Z,Y={}){let{formats:X=U1,widths:J=B1,quality:Q=z1,placeholder:G="none",concurrency:K=4,verbose:W=!1}=Y;if(!await g1())throw Error("sharp is required for image optimization");await G5.promises.mkdir(Z,{recursive:!0});let B=await kQ($),U=[],z={totalImages:B.length,optimizedImages:0,savedBytes:0,variants:0},q=SQ(B,K);for(let j of q){let H=await Promise.all(j.map(async(O)=>{try{let F=await h1(O,{formats:X,widths:J,quality:Q,placeholder:G,outputDir:Z,baseUrl:"/"});if(z.optimizedImages++,z.variants+=F.variants.length,W)console.log(` \u2713 ${I6.basename(O)}`);return F}catch(F){return console.error(`Error processing ${O}:`,F),null}}));U.push(...H.filter((O)=>O!==null))}return{processed:U,stats:z}}function SZ($){let Z={};for(let Y of $)Z[Y.src]={variants:Y.variants,placeholder:Y.placeholder};return Z}async function CQ($,Z){let Y=SZ($);await Bun.write(Z,JSON.stringify(Y,null,2))}var yQ=D(()=>{T7()});var hH;var bZ=D(()=>{T7();RQ();IQ();yQ();hH={enabled:!0,widths:[320,640,768,1024,1280,1536,1920],formats:["webp","jpeg"],quality:80,devOptimize:!1,cacheDir:".stx/image-cache",placeholder:"none",inputDirs:["public","src/assets","assets"],outputDir:"dist/images",baseUrl:"/images"}});function Y$($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(X,J)=>{return`const { ${J.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
214
214
  `});let Y=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(Y,(X,J)=>{return`const { ${J.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
215
- `}),$}import PQ from"process";function K1($="STX_PUBLIC_"){let Z={},Y={};for(let[X,J]of Object.entries(PQ.env)){if(!X.startsWith($)||J===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(J),Y[X]=J}return Z["import.meta.env"]=JSON.stringify(Y),Z}function xQ($="STX_PUBLIC_"){let Z={};for(let[Y,X]of Object.entries(PQ.env))if(Y.startsWith($)&&X!==void 0)Z[Y]=X;return Z}var x$=()=>{};var yZ={};Q0(yZ,{hasUserImports:()=>dH,bundleClientScript:()=>mH});import A1 from"path";import v$ from"fs";function dH($){let Z=/^\s*import\s+(?!type\s)/gm;if(!$.match(Z))return!1;let X=/^\s*import\s+(?!type\s).*?\s+from\s+['"]([^'"]+)['"]/gm,J;while((J=X.exec($))!==null){let G=J[1];if(!vQ.some((W)=>W.test(G)))return console.log("[stx:bundler] detected user import:",G),!0}let Q=/^\s*import\s+['"]([^'"]+)['"]/gm;while((J=Q.exec($))!==null){let G=J[1];if(!vQ.some((W)=>W.test(G)))return console.log("[stx:bundler] detected side-effect import:",G),!0}return!1}function uH($){return{name:"stx-client-bundle",setup(Z){Z.onResolve({filter:/^(stx|@stacksjs\/stx|@stacksjs\/browser)$/},(Y)=>({path:Y.path,external:!0})),Z.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(Y)=>({path:Y.path,external:!0})),Z.onResolve({filter:/^@\//},(Y)=>{let X=A1.resolve($,Y.path.slice(2)),J=[X,`${X}.ts`,`${X}.js`,A1.join(X,"index.ts"),A1.join(X,"index.js")];for(let Q of J)if(v$.existsSync(Q)&&v$.statSync(Q,{throwIfNoEntry:!1})?.isFile())return console.log("[stx:bundler] resolved @/ import:",Y.path,"\u2192",Q),{path:Q};return console.warn("[stx:bundler] could not resolve @/ import:",Y.path),{path:X}})}}}async function mH($,Z,Y={}){let X=Y.projectRoot||process.cwd(),J=Y.minify??!1,Q=Y.cacheDir||A1.join(X,".stx","bundle-cache"),G=new Bun.CryptoHasher("md5");G.update($+Z);let K=G.digest("hex").slice(0,12),W=A1.join(Q,`${K}.js`),_=Bun.file(W);if(await _.exists())return console.log("[stx:bundler] cache hit:",K),await _.text();let B=A1.join(X,".stx","bundle-tmp"),U=A1.join(B,`${K}.ts`),z=A1.join(B,"out",K);v$.mkdirSync(B,{recursive:!0}),v$.mkdirSync(z,{recursive:!0});let q=A1.dirname(Z),j=[],H=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,O=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,F;while((F=H.exec($))!==null){if(F[1])continue;if(F[2])F[2].split(",").forEach((V)=>{let A=V.split(":")[0].trim();if(A)j.push(A)});else if(F[3])j.push(F[3])}while((F=O.exec($))!==null){if(F[1])continue;j.push(F[2])}let L=j.length>0?`
216
- export { ${j.join(", ")} }`:"";await Bun.write(U,$+L),console.log("[stx:bundler] bundling:",K,"from:",A1.basename(Z));try{let V=await Bun.build({entrypoints:[U],outdir:z,target:"browser",format:"esm",minify:J,plugins:[uH(X)],define:{"process.env.NODE_ENV":J?'"production"':'"development"',...K1()},root:q});if(!V.success){let N=V.logs.filter((w)=>w.level==="error").map((w)=>w.message).join(", ");return console.warn("[stx:bundler] build failed:",N),$}let A="";for(let N of V.outputs){A=await N.text();break}return A=A.replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),console.log("[stx:bundler] bundled:",K,"output:",A.length,"bytes"),v$.mkdirSync(Q,{recursive:!0}),await Bun.write(W,A),A}catch(V){return console.warn("[stx:bundler] error:",V instanceof Error?V.message:V),$}finally{try{v$.rmSync(U,{force:!0}),v$.rmSync(z,{recursive:!0,force:!0})}catch{}}}var vQ;var PZ=D(()=>{x$();vQ=[/^stx$/,/^@stacksjs\/stx$/,/^@stacksjs\/browser$/,/^@stores$/,/^stx\/stores$/,/^@composables$/]});function iH($){let Z=new Set,Y=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,X;while((X=Y.exec($))!==null)if(!lH.has(X[1]))Z.add(X[1]);return Array.from(Z)}function nH($){let Z=new Set,Y=new Set,X=$;X=X.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let J=new Set,Q=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|stx)['"]\s*;?\s*$/gm,G;while((G=Q.exec($))!==null){let W=G[1],_=G[2];if(G[0].includes("import type"))continue;W.split(",").map((U)=>U.trim().split(/\s+as\s+/)[0]).filter((U)=>U.length>0).forEach((U)=>{if(J.add(U),_==="stx")Z.add(U);else Y.add(U)}),X=X.replace(G[0],"// [auto-import processed]")}for(let W of pH){if(J.has(W))continue;if(new RegExp(`\\b${W}\\s*\\(`,"g").test(X))Z.add(W)}for(let W of cH){if(J.has(W))continue;if(new RegExp(`\\b${W}\\b`,"g").test(X))Y.add(W)}let K=iH(X);for(let W of K)if(!J.has(W))Y.add(W);return{code:X,stxImports:Array.from(Z),browserImports:Array.from(Y)}}function sH($,Z){let Y=[];if($.length>0)Y.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)Y.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(Y.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
215
+ `}),$}import PQ from"process";function K1($="STX_PUBLIC_"){let Z={},Y={};for(let[X,J]of Object.entries(PQ.env)){if(!X.startsWith($)||J===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(J),Y[X]=J}return Z["import.meta.env"]=JSON.stringify(Y),Z}function xQ($="STX_PUBLIC_"){let Z={};for(let[Y,X]of Object.entries(PQ.env))if(Y.startsWith($)&&X!==void 0)Z[Y]=X;return Z}var x$=()=>{};var CZ={};Q0(CZ,{hasUserImports:()=>dH,bundleClientScript:()=>mH});import A1 from"path";import v$ from"fs";function dH($){let Z=/^\s*import\s+(?!type\s)/gm;if(!$.match(Z))return!1;let X=/^\s*import\s+(?!type\s).*?\s+from\s+['"]([^'"]+)['"]/gm,J;while((J=X.exec($))!==null){let G=J[1];if(!vQ.some((W)=>W.test(G)))return console.log("[stx:bundler] detected user import:",G),!0}let Q=/^\s*import\s+['"]([^'"]+)['"]/gm;while((J=Q.exec($))!==null){let G=J[1];if(!vQ.some((W)=>W.test(G)))return console.log("[stx:bundler] detected side-effect import:",G),!0}return!1}function uH($){return{name:"stx-client-bundle",setup(Z){Z.onResolve({filter:/^(stx|@stacksjs\/stx|@stacksjs\/browser)$/},(Y)=>({path:Y.path,external:!0})),Z.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(Y)=>({path:Y.path,external:!0})),Z.onResolve({filter:/^@\//},(Y)=>{let X=A1.resolve($,Y.path.slice(2)),J=[X,`${X}.ts`,`${X}.js`,A1.join(X,"index.ts"),A1.join(X,"index.js")];for(let Q of J)if(v$.existsSync(Q)&&v$.statSync(Q,{throwIfNoEntry:!1})?.isFile())return console.log("[stx:bundler] resolved @/ import:",Y.path,"\u2192",Q),{path:Q};return console.warn("[stx:bundler] could not resolve @/ import:",Y.path),{path:X}})}}}async function mH($,Z,Y={}){let X=Y.projectRoot||process.cwd(),J=Y.minify??!1,Q=Y.cacheDir||A1.join(X,".stx","bundle-cache"),G=new Bun.CryptoHasher("md5");G.update($+Z);let K=G.digest("hex").slice(0,12),W=A1.join(Q,`${K}.js`),_=Bun.file(W);if(await _.exists())return console.log("[stx:bundler] cache hit:",K),await _.text();let B=A1.join(X,".stx","bundle-tmp"),U=A1.join(B,`${K}.ts`),z=A1.join(B,"out",K);v$.mkdirSync(B,{recursive:!0}),v$.mkdirSync(z,{recursive:!0});let q=A1.dirname(Z),j=[],H=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,O=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,F;while((F=H.exec($))!==null){if(F[1])continue;if(F[2])F[2].split(",").forEach((V)=>{let A=V.split(":")[0].trim();if(A)j.push(A)});else if(F[3])j.push(F[3])}while((F=O.exec($))!==null){if(F[1])continue;j.push(F[2])}let L=j.length>0?`
216
+ export { ${j.join(", ")} }`:"";await Bun.write(U,$+L),console.log("[stx:bundler] bundling:",K,"from:",A1.basename(Z));try{let V=await Bun.build({entrypoints:[U],outdir:z,target:"browser",format:"esm",minify:J,plugins:[uH(X)],define:{"process.env.NODE_ENV":J?'"production"':'"development"',...K1()},root:q});if(!V.success){let N=V.logs.filter((w)=>w.level==="error").map((w)=>w.message).join(", ");return console.warn("[stx:bundler] build failed:",N),$}let A="";for(let N of V.outputs){A=await N.text();break}return A=A.replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),console.log("[stx:bundler] bundled:",K,"output:",A.length,"bytes"),v$.mkdirSync(Q,{recursive:!0}),await Bun.write(W,A),A}catch(V){return console.warn("[stx:bundler] error:",V instanceof Error?V.message:V),$}finally{try{v$.rmSync(U,{force:!0}),v$.rmSync(z,{recursive:!0,force:!0})}catch{}}}var vQ;var yZ=D(()=>{x$();vQ=[/^stx$/,/^@stacksjs\/stx$/,/^@stacksjs\/browser$/,/^@stores$/,/^stx\/stores$/,/^@composables$/]});function iH($){let Z=new Set,Y=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,X;while((X=Y.exec($))!==null)if(!lH.has(X[1]))Z.add(X[1]);return Array.from(Z)}function nH($){let Z=new Set,Y=new Set,X=$;X=X.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let J=new Set,Q=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|stx)['"]\s*;?\s*$/gm,G;while((G=Q.exec($))!==null){let W=G[1],_=G[2];if(G[0].includes("import type"))continue;W.split(",").map((U)=>U.trim().split(/\s+as\s+/)[0]).filter((U)=>U.length>0).forEach((U)=>{if(J.add(U),_==="stx")Z.add(U);else Y.add(U)}),X=X.replace(G[0],"// [auto-import processed]")}for(let W of pH){if(J.has(W))continue;if(new RegExp(`\\b${W}\\s*\\(`,"g").test(X))Z.add(W)}for(let W of cH){if(J.has(W))continue;if(new RegExp(`\\b${W}\\b`,"g").test(X))Y.add(W)}let K=iH(X);for(let W of K)if(!J.has(W))Y.add(W);return{code:X,stxImports:Array.from(Z),browserImports:Array.from(Y)}}function sH($,Z){let Y=[];if($.length>0)Y.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)Y.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(Y.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
217
217
  ${Y.join(`
218
218
  `)}
219
219
  `;return""}function oH($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let Y of $.systemKeys)Z.push(`if (!$event.${Y}Key) return`);if($.keys.length>0){let Y=$.keys.map((X)=>`$event.key === '${X}'`).join(" || ");Z.push(`if (!(${Y})) return`)}if($.mouse!==null){let Y=rH[$.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function aH($,Z){let{elementId:Y,event:X,handler:J,modifiers:Q}=$,G=oH(Q),K=[];if(Q.once)K.push("once: true");if(Q.capture)K.push("capture: true");if(Q.passive)K.push("passive: true");let W=K.length>0?`, { ${K.join(", ")} }`:"",_="";if(G)_+=`${G}; `;let B=J.replace(/\\/g,"\\\\").replace(/'/g,"\\'");function U(z){return`var scope = $el.closest('[data-stx-scope]');
@@ -256,7 +256,7 @@ else {
256
256
  // STX: auto-generated event bindings
257
257
  ${$.map((Y,X)=>aH(Y,X)).join(`
258
258
  `)}`}function fQ($){let Z=[],Y=new Set,X=$.replace(/^\s*import\s+.*$/gm,""),J=0,Q=X.length,G=0;while(G<Q){let K=X[G];if(K==="'"||K==='"'||K==="`"){let W=K;if(G++,W==="`"){let _=0;while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]==="`"&&_===0){G++;break}if(X[G]==="$"&&X[G+1]==="{"){_++,G+=2;continue}if(X[G]==="}"&&_>0){_--,G++;continue}G++}}else while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]===W){G++;break}G++}continue}if(K==="/"&&X[G+1]==="/"){while(G<Q&&X[G]!==`
259
- `)G++;continue}if(K==="/"&&X[G+1]==="*"){G+=2;while(G<Q-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(K==="{"){J++,G++;continue}if(K==="}"){J--,G++;continue}if(J===0){let W=X.slice(G),_=W.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(_){let z=_[1];if(!z.startsWith("_")&&!Y.has(z))Z.push(z),Y.add(z);G+=_[0].length;continue}let B=W.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(B){B[1].split(",").forEach((z)=>{let q=z.trim(),j=q.indexOf(":"),H=j>=0?q.slice(j+1).trim().split(/[\s=]/)[0]:q.split(/[\s=]/)[0];if(H&&!H.startsWith("_")&&!Y.has(H))Z.push(H),Y.add(H)}),G+=B[0].length;continue}let U=W.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let z=U[1];if(!z.startsWith("_")&&!Y.has(z))Z.push(z),Y.add(z);G+=U[0].length;continue}}G++}return Z}function $O($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(z){let q;while((q=Y.exec(z))!==null){let j=q[0];if(!eH.has(j))Z.add(j)}}let J=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=J.exec($))!==null)X(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)X(Q[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=K.exec($))!==null)X(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=W.exec($))!==null)X(Q[1]);let _=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=_.exec($))!==null)X(Q[1]);let B=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=B.exec($))!==null)X(Q[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=U.exec($))!==null)X(Q[1]);return Z}async function f$($,Z={}){let Y=$,X="",J=!1,{hasUserImports:Q,bundleClientScript:G}=await Promise.resolve().then(() => (PZ(),yZ));if(Q(Y))console.log("[stx:bundler] user imports detected, bundling..."),Y=await G(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),J=!0;if(Z.autoImports!==!1){let j=nH(Y);Y=j.code,X=sH(j.stxImports,j.browserImports)}if(Y=Z$(Y),!J&&Y$(Z.attrs||""))Y=X$(Y);let K=tH(Z.eventBindings||[]),W=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(W)){let j=W.replace(/\btype\s*=\s*["']module["']/i,"").trim();return`<script ${`type="module" data-stx-scoped${j?` ${j}`:""}`}>
259
+ `)G++;continue}if(K==="/"&&X[G+1]==="*"){G+=2;while(G<Q-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(K==="{"){J++,G++;continue}if(K==="}"){J--,G++;continue}if(J===0){let W=X.slice(G),_=W.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(_){let z=_[1];if(!z.startsWith("_")&&!Y.has(z))Z.push(z),Y.add(z);G+=_[0].length;continue}let B=W.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(B){B[1].split(",").forEach((z)=>{let q=z.trim(),j=q.indexOf(":"),H=j>=0?q.slice(j+1).trim().split(/[\s=]/)[0]:q.split(/[\s=]/)[0];if(H&&!H.startsWith("_")&&!Y.has(H))Z.push(H),Y.add(H)}),G+=B[0].length;continue}let U=W.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let z=U[1];if(!z.startsWith("_")&&!Y.has(z))Z.push(z),Y.add(z);G+=U[0].length;continue}}G++}return Z}function $O($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(z){let q;while((q=Y.exec(z))!==null){let j=q[0];if(!eH.has(j))Z.add(j)}}let J=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=J.exec($))!==null)X(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)X(Q[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=K.exec($))!==null)X(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=W.exec($))!==null)X(Q[1]);let _=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=_.exec($))!==null)X(Q[1]);let B=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=B.exec($))!==null)X(Q[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=U.exec($))!==null)X(Q[1]);return Z}async function f$($,Z={}){let Y=$,X="",J=!1,{hasUserImports:Q,bundleClientScript:G}=await Promise.resolve().then(() => (yZ(),CZ));if(Q(Y))console.log("[stx:bundler] user imports detected, bundling..."),Y=await G(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),J=!0;if(Z.autoImports!==!1){let j=nH(Y);Y=j.code,X=sH(j.stxImports,j.browserImports)}if(Y=Y$(Y),!J&&X$(Z.attrs||""))Y=J$(Y);let K=tH(Z.eventBindings||[]),W=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(W)){let j=W.replace(/\btype\s*=\s*["']module["']/i,"").trim();return`<script ${`type="module" data-stx-scoped${j?` ${j}`:""}`}>
260
260
  ${X}${Y}
261
261
  ${K}
262
262
  </script>`}let B=/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useLocalStorage|useSessionStorage|useRef|useEventListener|useFetch|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|batch|untrack|peek)\s*(?:<[^>]*>)?\s*\(/.test($),U=/function __stx_setup_/.test(Y),z=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function q(j){let H=j.length>0?`
@@ -270,7 +270,7 @@ ${K}${H}
270
270
  'use strict';
271
271
  ${X}${Y}
272
272
  ${K}
273
- })()</script>`}var pH,cH,lH,rH,eH;var I7=D(()=>{q0();pH=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useQuery","useMutation","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","ref","reactive","computed","watch","watchEffect","watchMultiple","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","defineProps","withDefaults","defineEmits","defineExpose","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","useStore","action","createSelector","h","Fragment"],cH=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser"],lH=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"]);rH={left:0,middle:1,right:2};eH=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"])});function XO($){let Z="",Y=null,X=!1;for(let J=0;J<$.length;J++){let Q=$[J];if(X){X=!1;continue}if(Q==="\\"&&Y){X=!0;continue}if(Y){if(Y==="`"&&Q==="$"&&J+1<$.length&&$[J+1]==="{"){let G=1;J+=2;while(J<$.length&&G>0){if($[J]==="{")G++;else if($[J]==="}")G--;if(G>0)Z+=$[J],J++}continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}Z+=Q}return Z}function D7($){let Z=$.trim(),Y=XO(Z);for(let X of hQ)if(X.test(Y))throw Error(`Potentially unsafe expression (matched /${X.source}/): ${Z}`);if(!gQ.allowBracketNotation&&YO.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function JO($){let Z={};Z.Math=Math,Z.JSON=JSON,Z.Date=Date,Z.String=String,Z.Number=Number,Z.Boolean=Boolean,Z.Array=Array,Z.parseInt=Number.parseInt,Z.parseFloat=Number.parseFloat,Z.isNaN=Number.isNaN,Z.isFinite=Number.isFinite,Z.encodeURIComponent=encodeURIComponent,Z.decodeURIComponent=decodeURIComponent;for(let[Y,X]of Object.entries($)){if(Y.startsWith("__")||hQ.some((J)=>J.test(Y)))continue;if(X&&typeof X==="object"&&!Array.isArray(X))Z[Y]=xZ(X);else Z[Y]=X}return Z}function xZ($,Z=0){if(Z>=gQ.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((X)=>xZ(X,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Y={};for(let[X,J]of Object.entries($)){if(X.startsWith("__")||X==="constructor"||X==="prototype")continue;if(J&&typeof J==="object")Y[X]=xZ(J,Z+1);else Y[X]=J}return Y}function L0($,Z){try{let Y=D7($),X=JO(Z);return Function(...Object.keys(X),`
273
+ })()</script>`}var pH,cH,lH,rH,eH;var I7=D(()=>{q0();pH=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useQuery","useMutation","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","ref","reactive","computed","watch","watchEffect","watchMultiple","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","defineProps","withDefaults","defineEmits","defineExpose","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","useStore","action","createSelector","h","Fragment"],cH=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser"],lH=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"]);rH={left:0,middle:1,right:2};eH=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"])});function XO($){let Z="",Y=null,X=!1;for(let J=0;J<$.length;J++){let Q=$[J];if(X){X=!1;continue}if(Q==="\\"&&Y){X=!0;continue}if(Y){if(Y==="`"&&Q==="$"&&J+1<$.length&&$[J+1]==="{"){let G=1;J+=2;while(J<$.length&&G>0){if($[J]==="{")G++;else if($[J]==="}")G--;if(G>0)Z+=$[J],J++}continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}Z+=Q}return Z}function D7($){let Z=$.trim(),Y=XO(Z);for(let X of hQ)if(X.test(Y))throw Error(`Potentially unsafe expression (matched /${X.source}/): ${Z}`);if(!gQ.allowBracketNotation&&YO.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function JO($){let Z={};Z.Math=Math,Z.JSON=JSON,Z.Date=Date,Z.String=String,Z.Number=Number,Z.Boolean=Boolean,Z.Array=Array,Z.parseInt=Number.parseInt,Z.parseFloat=Number.parseFloat,Z.isNaN=Number.isNaN,Z.isFinite=Number.isFinite,Z.encodeURIComponent=encodeURIComponent,Z.decodeURIComponent=decodeURIComponent;for(let[Y,X]of Object.entries($)){if(Y.startsWith("__")||hQ.some((J)=>J.test(Y)))continue;if(X&&typeof X==="object"&&!Array.isArray(X))Z[Y]=PZ(X);else Z[Y]=X}return Z}function PZ($,Z=0){if(Z>=gQ.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((X)=>PZ(X,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Y={};for(let[X,J]of Object.entries($)){if(X.startsWith("__")||X==="constructor"||X==="prototype")continue;if(J&&typeof J==="object")Y[X]=PZ(J,Z+1);else Y[X]=J}return Y}function L0($,Z){try{let Y=D7($),X=JO(Z);return Function(...Object.keys(X),`
274
274
  'use strict';
275
275
  try {
276
276
  return ${Y};
@@ -292,7 +292,7 @@ catch (e) {
292
292
  }
293
293
  throw e;
294
294
  }
295
- `)}function D6($){let Z=$.trim(),Y=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let X of Y)if(X.test(Z))return!1;return!0}var ZO,gQ,hQ,YO;var h0=D(()=>{ZO={maxSanitizeDepth:10,allowBracketNotation:!1},gQ={...ZO},hQ=[/\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/],YO=/[\w)\]]\s*\[\s*['"]/});function vZ(){dQ=0,k6.clear()}function k7($,Z){let Y=dQ++,X=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return k6.set(X,{type:$,expression:Z}),X}function fZ(){let $={};for(let[Z,Y]of k6)$[Z]={type:Y.type,expression:Y.expression};return $}function QO($){let Z={},Y=/<!--__STX_(EXPR|COND|RAW)_(\d+)__-->/g,X;while((X=Y.exec($))!==null){let J=X[0],Q=X[1].toLowerCase(),G=k6.get(J);Z[J]={type:Q,expression:G?.expression||""}}return Z}function S6($,Z){let Y=$;for(let[X,J]of Z)Y=Y.split(X).join(J);return Y}function K5($){return $.includes("<!--__STX_")}var dQ=0,k6;var S7=D(()=>{k6=new Map});var y7={};Q0(y7,{usesSignalsInScript:()=>C7,unescapeHtml:()=>b6,registerFilters:()=>pQ,registerFilter:()=>gZ,processExpressions:()=>q1,interpolateScriptsInTemplate:()=>lQ,interpolateScriptExpressions:()=>dZ,getAllFilters:()=>hZ,evaluateExpression:()=>Y1,escapeHtml:()=>w0,defaultFilters:()=>W5,clearCustomFilters:()=>cQ,applyFilters:()=>uZ});function GO($){let Z=uQ.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),uQ.set($,Z)}return Z.lastIndex=0,Z}function gZ($,Z){if($ in W5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);b7[$]=Z}function pQ($){for(let[Z,Y]of Object.entries($))gZ(Z,Y)}function hZ(){return{...W5,...b7}}function cQ(){for(let $ of Object.keys(b7))delete b7[$]}function w0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function C7($){let Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=Z.exec($))!==null){let X=Y[1];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(X))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;return!1}function mQ($,Z){let Y=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],X=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),J="",Q=!1,G=0;for(let _=0;_<X.length;_++){let B=X[_];if(!Q&&B==="`"){Q=!0,G=0;continue}if(Q){if(B==="`"&&G===0){Q=!1;continue}if(B==="$"&&X[_+1]==="{"){G++,_++;continue}if(B==="}"&&G>0){G--;continue}continue}J+=B}X=J;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,W;while((W=K.exec(X))!==null){let _=W[1];if(!X.substring(0,W.index).trimEnd().endsWith(".")){if(!Y.includes(_)&&!(_ in Z))return!1}}return!0}function dZ($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(X,J)=>{try{let Q=Y1(J,Z);if(Q===void 0)return X;return Q===null?"":String(Q)}catch{return X}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,J)=>{let Q=J.trim();if(/^__[A-Z_]+__$/.test(Q))return X;try{let G=Y1(J,Z);if(G===void 0)return X;return JSON.stringify(G)}catch{return X}}),Y}function lQ($,Z,Y={}){return $.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(X,J,Q)=>{if(/\bsrc\s*=/.test(J))return X;if(/\bdata-raw\b/.test(J))return X;if(/\btype\s*=\s*["']application\/json["']/.test(J))return X;if(Y.skipServer&&/\bserver\b/.test(J))return X;let G=dZ(Q,Z);return`<script${J}>${G}</script>`})}function q1($,Z,Y){let X=$,J=[];X=X.replace(/<style[^>]*>[\s\S]*?<\/style>/gi,(K)=>{if(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(K))return K;let W=J.length;return J.push(K),`<!--__STX_STYLE_${W}__-->`});let Q=[];X=X.replace(/<script[^>]*>[\s\S]*?<\/script>/gi,(K)=>{let W=Q.length;return Q.push(K),`<!--__STX_SCRIPT_EXPR_${W}__-->`});let G=C7($);X=X.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(K,W,_)=>{try{let B=Y1(W,Z);return B!==void 0&&B!==null?String(B):""}catch(B){let U=B instanceof Error?B.message:String(B);return U0("Expression",`Error evaluating: {{{ ${W.trim()}}}}: ${U}`,Y,$,_,K)}}),X=X.replace(/\{!!([\s\S]*?)!!\}/g,(K,W,_)=>{try{let B=Y1(W,Z);if(B===void 0&&Z.__stx_buildMode==="compile")return k7("raw",W.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if(Z.__stx_buildMode==="compile")return k7("raw",W.trim());let U=B instanceof Error?B.message:String(B);return U0("Expression",`Error evaluating: {!! ${W.trim()} !!}: ${U}`,Y,$,_,K)}}),X=X.replace(/<script[^>]*>[\s\S]*?<\/script>/gi,(K)=>{if(K.startsWith("<!--__STX_SCRIPT_EXPR_"))return K;let W=Q.length;return Q.push(K),`<!--__STX_SCRIPT_EXPR_${W}__-->`}),X=X.replace(/<style[^>]*>[\s\S]*?<\/style>/gi,(K)=>{if(K.startsWith("<!--__STX_STYLE_"))return K;if(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(K))return K;let W=J.length;return J.push(K),`<!--__STX_STYLE_${W}__-->`}),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(K,W,_)=>{let B=W.trim(),U=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],z=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,j=B.match(z)?.[1],H=j&&((j in Z)||U.includes(j)),O=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,F=B.match(O),L=F&&!U.includes(F[1])&&!(F[1]in Z);if(/^__[A-Z_]+__$/.test(B))return"";try{let V=Y1(W,Z);if(V===void 0&&G&&!mQ(B,Z))return K;if(V===void 0&&Z.__stx_buildMode==="compile"&&!G)return k7("expr",B);return V!==void 0&&V!==null?w0(String(V)):""}catch(V){if(G&&!mQ(B,Z))return K;if(L)return K;let A=V instanceof Error?V.message:String(V);return U0("Expression",`Error evaluating: {{ ${B} }}: ${A}`,Y,$,_,K)}});for(let K=0;K<Q.length;K++)X=X.replace(`<!--__STX_SCRIPT_EXPR_${K}__-->`,()=>Q[K]);for(let K=0;K<J.length;K++)X=X.replace(`<!--__STX_STYLE_${K}__-->`,()=>J[K]);return X}function uZ($,Z,Y){if(!Z.trim())return $;let X=$,J=Z.trim();while(J.length>0){let Q=J.match(/^(\w+)/);if(!Q)break;let G=Q[1];J=J.substring(G.length).trim();let K=b7[G]||W5[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(hZ()).join(", ")}`);let W=[];if(J.startsWith(":")){let _=J.match(/^:([^|\s]+)/);if(_){let B=_[1].trim();try{let U=Number(B);W=[Number.isNaN(U)?B:U]}catch{W=[B]}J=J.substring(_[0].length).trim()}}else if(J.startsWith("(")){let _=1,B=1;while(_>0&&B<J.length){if(J[B]==="(")_++;if(J[B]===")")_--;B++}if(_===0){let U=J.substring(1,B-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))W=[Y1(`(${U})`,Y,!0)];else{let z=[],q="",j=null,H=0,O=0,F=0,L=!1;for(let V=0;V<U.length;V++){let A=U[V];if(L){q+=A,L=!1;continue}if(A==="\\"){q+=A,L=!0;continue}if(j){if(q+=A,A===j)j=null;continue}if(A==='"'||A==="'"||A==="`"){j=A,q+=A;continue}if(A==="(")H++;else if(A===")")H--;else if(A==="[")O++;else if(A==="]")O--;else if(A==="{")F++;else if(A==="}")F--;if(A===","&&H===0&&O===0&&F===0){z.push(q),q="";continue}q+=A}if(q)z.push(q);W=z.map((V)=>{let A=V.trim();return Y1(A,Y,!0)})}}catch{W=[U]}J=J.substring(B).trim()}}try{X=K(X,Y,...W)}catch(_){let B=_ instanceof Error?_.message:String(_);throw Error(`Error applying filter '${G}': ${B}`)}if(J.startsWith("|"))J=J.substring(1).trim();else break}return X}function KO($){let Z=!1,Y="",X=0,J=0,Q=0,G=!1;for(let K=0;K<$.length;K++){let W=$[K],_=$[K+1];if(Z&&G){G=!1;continue}if(Z&&W==="\\"){G=!0;continue}if(G=!1,(W==='"'||W==="'"||W==="`")&&!G){if(!Z)Z=!0,Y=W;else if(W===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&W==="$"&&_==="{"){let B=1;K+=2;while(K<$.length&&B>0){if($[K]==="{")B++;else if($[K]==="}")B--;if(B>0)K++}continue}if(Z)continue;if(W==="(")X++;else if(W===")")X--;else if(W==="[")J++;else if(W==="]")J--;else if(W==="{")Q++;else if(W==="}")Q--;if(W==="|"&&X===0&&J===0&&Q===0){if(_==="|"){K++;continue}if(_==="="){K++;continue}return K}}return-1}function Y1($,Z,Y=!1){try{let X=$.trim(),J=KO(X);if(J>0){let Q=X.substring(0,J).trim(),G=X.substring(J+1).trim(),K=Y1(Q,Z,!0);return uZ(K,G,Z)}if(!B0(X)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${X}`);return L0(X,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return j0(X,Q)(...G)}catch{return L0(X,Z)}}catch(X){if(X instanceof ReferenceError){let J=/(\b\w+)\s+is not defined/.exec(X.message);if(J){let Q=J[1],G=WO(Q,Object.keys(Z));if(G&&G!==Q)X.message=`${X.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,X);throw X}}function WO($,Z){let Y=null;for(let J of Z){if(J===$)continue;let Q=_O($,J);if(Y===null||Q<Y.dist)Y={key:J,dist:Q}}if(!Y)return null;let X=Math.max($.length,Y.key.length);if(Y.dist<=2||Y.dist/X<=0.35)return Y.key;return null}function _O($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[Y,X]=$.length<Z.length?[$,Z]:[Z,$],J=Array(Y.length+1),Q=Array(Y.length+1);for(let G=0;G<=Y.length;G++)J[G]=G;for(let G=1;G<=X.length;G++){Q[0]=G;for(let K=1;K<=Y.length;K++){let W=Y[K-1]===X[G-1]?0:1;Q[K]=Math.min(Q[K-1]+1,J[K]+1,J[K-1]+W)}for(let K=0;K<=Y.length;K++)J[K]=Q[K]}return J[Y.length]}function b6($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var b7,uQ,W5;var d0=D(()=>{h0();q0();S7();b7={},uQ=new Map;W5={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let Y=String($);return Y.charAt(0).toUpperCase()+Y.slice(1)},number:($,Z,Y=0)=>{if($===void 0||$===null)return"";try{let X=Number($);return Number.isNaN(X)?"":X.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:($,Z,Y="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return X.toLocaleString(Y)}catch{return String($)}},join:($,Z,Y=",")=>{if(!Array.isArray($))return"";return $.join(String(Y))},escape:($,Z)=>{if($===void 0||$===null)return"";return w0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let X=Z.__translations,J=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=X;for(let W of Q){if(G===void 0||G===null)break;G=G[W]}if(G===void 0||G===null)return J?$:"";let K=String(G);return Object.entries(Y).forEach(([W,_])=>{K=K.replace(GO(W),String(_))}),K},t:($,Z,Y={})=>{return W5.translate($,Z,Y)},truncate:($,Z,Y=50,X="...")=>{if($===void 0||$===null)return"";let J=String($);if(J.length<=Y)return J;if(Y<=X.length)return X.substring(0,Y);return J.substring(0,Y-X.length)+X},date:($,Z,Y="short",X="en-US")=>{if($===void 0||$===null)return"";try{let J=$ instanceof Date?$:new Date($);if(Number.isNaN(J.getTime()))return String($);let Q={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Y==="iso")return J.toISOString();return new Intl.DateTimeFormat(X,Q[Y]||Q.short).format(J)}catch{return String($)}},currency:($,Z,Y="USD",X="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return new Intl.NumberFormat(X,{style:"currency",currency:Y}).format(J)}catch{return String($)}},pluralize:($,Z,Y,X)=>{let J=Number($);if(Number.isNaN(J))return Y;let Q=X||`${Y}s`;return J===1?Y:Q},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Y=String($);return Y.charAt(Y.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,Y=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Y?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,Y="")=>{return $===void 0||$===null||$===""?Y:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,Y=0,X)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,X);return $},replace:($,Z,Y,X="")=>{if($===void 0||$===null)return"";let J=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(J,"g"),()=>X)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let Y=Number($);return Number.isNaN(Y)?0:Math.abs(Y)},round:($,Z,Y=0)=>{let X=Number($);if(Number.isNaN(X))return 0;let J=10**Y;return Math.round(X*J)/J}}});class P7{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let Y=this.cache.keys().next().value;if(Y!==void 0)this.cache.delete(Y)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function B5($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!_5.has(Y)){if(_5.size>=BO){let X=_5.keys().next().value;if(X)_5.delete(X)}_5.set(Y,new RegExp($,Z))}return _5.get(Y)}class iQ{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),X=this.pool.find((K)=>K.context.join(",")===Y);if(X)return X.func;let J=this.fnCache,Q=this.fnCacheMaxSize,G=(...K)=>{return(W)=>{try{let _=`${Y}:${W}`,B=J.get(_);if(!B){if(J.size>=Q){let U=J.keys().next().value;if(U)J.delete(U)}B=Function(...Z,`
295
+ `)}function D6($){let Z=$.trim(),Y=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let X of Y)if(X.test(Z))return!1;return!0}var ZO,gQ,hQ,YO;var h0=D(()=>{ZO={maxSanitizeDepth:10,allowBracketNotation:!1},gQ={...ZO},hQ=[/\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/],YO=/[\w)\]]\s*\[\s*['"]/});function xZ(){dQ=0,k6.clear()}function k7($,Z){let Y=dQ++,X=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return k6.set(X,{type:$,expression:Z}),X}function vZ(){let $={};for(let[Z,Y]of k6)$[Z]={type:Y.type,expression:Y.expression};return $}function QO($){let Z={},Y=/<!--__STX_(EXPR|COND|RAW)_(\d+)__-->/g,X;while((X=Y.exec($))!==null){let J=X[0],Q=X[1].toLowerCase(),G=k6.get(J);Z[J]={type:Q,expression:G?.expression||""}}return Z}function S6($,Z){let Y=$;for(let[X,J]of Z)Y=Y.split(X).join(J);return Y}function K5($){return $.includes("<!--__STX_")}var dQ=0,k6;var S7=D(()=>{k6=new Map});var y7={};Q0(y7,{usesSignalsInScript:()=>C7,unescapeHtml:()=>b6,registerFilters:()=>pQ,registerFilter:()=>fZ,processExpressions:()=>q1,interpolateScriptsInTemplate:()=>lQ,interpolateScriptExpressions:()=>hZ,getAllFilters:()=>gZ,evaluateExpression:()=>Y1,escapeHtml:()=>w0,defaultFilters:()=>W5,clearCustomFilters:()=>cQ,applyFilters:()=>dZ});function GO($){let Z=uQ.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),uQ.set($,Z)}return Z.lastIndex=0,Z}function fZ($,Z){if($ in W5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);b7[$]=Z}function pQ($){for(let[Z,Y]of Object.entries($))fZ(Z,Y)}function gZ(){return{...W5,...b7}}function cQ(){for(let $ of Object.keys(b7))delete b7[$]}function w0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function C7($){let Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=Z.exec($))!==null){let X=Y[1];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(X))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;return!1}function mQ($,Z){let Y=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],X=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),J="",Q=!1,G=0;for(let _=0;_<X.length;_++){let B=X[_];if(!Q&&B==="`"){Q=!0,G=0;continue}if(Q){if(B==="`"&&G===0){Q=!1;continue}if(B==="$"&&X[_+1]==="{"){G++,_++;continue}if(B==="}"&&G>0){G--;continue}continue}J+=B}X=J;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,W;while((W=K.exec(X))!==null){let _=W[1];if(!X.substring(0,W.index).trimEnd().endsWith(".")){if(!Y.includes(_)&&!(_ in Z))return!1}}return!0}function hZ($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(X,J)=>{try{let Q=Y1(J,Z);if(Q===void 0)return X;return Q===null?"":String(Q)}catch{return X}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,J)=>{let Q=J.trim();if(/^__[A-Z_]+__$/.test(Q))return X;try{let G=Y1(J,Z);if(G===void 0)return X;return JSON.stringify(G)}catch{return X}}),Y}function lQ($,Z,Y={}){return $.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(X,J,Q)=>{if(/\bsrc\s*=/.test(J))return X;if(/\bdata-raw\b/.test(J))return X;if(/\btype\s*=\s*["']application\/json["']/.test(J))return X;if(Y.skipServer&&/\bserver\b/.test(J))return X;let G=hZ(Q,Z);return`<script${J}>${G}</script>`})}function q1($,Z,Y){let X=$,J=[];X=X.replace(/<style[^>]*>[\s\S]*?<\/style>/gi,(K)=>{if(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(K))return K;let W=J.length;return J.push(K),`<!--__STX_STYLE_${W}__-->`});let Q=[];X=X.replace(/<script[^>]*>[\s\S]*?<\/script>/gi,(K)=>{let W=Q.length;return Q.push(K),`<!--__STX_SCRIPT_EXPR_${W}__-->`});let G=C7($);X=X.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(K,W,_)=>{try{let B=Y1(W,Z);return B!==void 0&&B!==null?String(B):""}catch(B){let U=B instanceof Error?B.message:String(B);return U0("Expression",`Error evaluating: {{{ ${W.trim()}}}}: ${U}`,Y,$,_,K)}}),X=X.replace(/\{!!([\s\S]*?)!!\}/g,(K,W,_)=>{try{let B=Y1(W,Z);if(B===void 0&&Z.__stx_buildMode==="compile")return k7("raw",W.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if(Z.__stx_buildMode==="compile")return k7("raw",W.trim());let U=B instanceof Error?B.message:String(B);return U0("Expression",`Error evaluating: {!! ${W.trim()} !!}: ${U}`,Y,$,_,K)}}),X=X.replace(/<script[^>]*>[\s\S]*?<\/script>/gi,(K)=>{if(K.startsWith("<!--__STX_SCRIPT_EXPR_"))return K;let W=Q.length;return Q.push(K),`<!--__STX_SCRIPT_EXPR_${W}__-->`}),X=X.replace(/<style[^>]*>[\s\S]*?<\/style>/gi,(K)=>{if(K.startsWith("<!--__STX_STYLE_"))return K;if(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(K))return K;let W=J.length;return J.push(K),`<!--__STX_STYLE_${W}__-->`}),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(K,W,_)=>{let B=W.trim(),U=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],z=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,j=B.match(z)?.[1],H=j&&((j in Z)||U.includes(j)),O=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,F=B.match(O),L=F&&!U.includes(F[1])&&!(F[1]in Z);if(/^__[A-Z_]+__$/.test(B))return"";try{let V=Y1(W,Z);if(V===void 0&&G&&!mQ(B,Z))return K;if(V===void 0&&Z.__stx_buildMode==="compile"&&!G)return k7("expr",B);return V!==void 0&&V!==null?w0(String(V)):""}catch(V){if(G&&!mQ(B,Z))return K;if(L)return K;let A=V instanceof Error?V.message:String(V);return U0("Expression",`Error evaluating: {{ ${B} }}: ${A}`,Y,$,_,K)}});for(let K=0;K<Q.length;K++)X=X.replace(`<!--__STX_SCRIPT_EXPR_${K}__-->`,()=>Q[K]);for(let K=0;K<J.length;K++)X=X.replace(`<!--__STX_STYLE_${K}__-->`,()=>J[K]);return X}function dZ($,Z,Y){if(!Z.trim())return $;let X=$,J=Z.trim();while(J.length>0){let Q=J.match(/^(\w+)/);if(!Q)break;let G=Q[1];J=J.substring(G.length).trim();let K=b7[G]||W5[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(gZ()).join(", ")}`);let W=[];if(J.startsWith(":")){let _=J.match(/^:([^|\s]+)/);if(_){let B=_[1].trim();try{let U=Number(B);W=[Number.isNaN(U)?B:U]}catch{W=[B]}J=J.substring(_[0].length).trim()}}else if(J.startsWith("(")){let _=1,B=1;while(_>0&&B<J.length){if(J[B]==="(")_++;if(J[B]===")")_--;B++}if(_===0){let U=J.substring(1,B-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))W=[Y1(`(${U})`,Y,!0)];else{let z=[],q="",j=null,H=0,O=0,F=0,L=!1;for(let V=0;V<U.length;V++){let A=U[V];if(L){q+=A,L=!1;continue}if(A==="\\"){q+=A,L=!0;continue}if(j){if(q+=A,A===j)j=null;continue}if(A==='"'||A==="'"||A==="`"){j=A,q+=A;continue}if(A==="(")H++;else if(A===")")H--;else if(A==="[")O++;else if(A==="]")O--;else if(A==="{")F++;else if(A==="}")F--;if(A===","&&H===0&&O===0&&F===0){z.push(q),q="";continue}q+=A}if(q)z.push(q);W=z.map((V)=>{let A=V.trim();return Y1(A,Y,!0)})}}catch{W=[U]}J=J.substring(B).trim()}}try{X=K(X,Y,...W)}catch(_){let B=_ instanceof Error?_.message:String(_);throw Error(`Error applying filter '${G}': ${B}`)}if(J.startsWith("|"))J=J.substring(1).trim();else break}return X}function KO($){let Z=!1,Y="",X=0,J=0,Q=0,G=!1;for(let K=0;K<$.length;K++){let W=$[K],_=$[K+1];if(Z&&G){G=!1;continue}if(Z&&W==="\\"){G=!0;continue}if(G=!1,(W==='"'||W==="'"||W==="`")&&!G){if(!Z)Z=!0,Y=W;else if(W===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&W==="$"&&_==="{"){let B=1;K+=2;while(K<$.length&&B>0){if($[K]==="{")B++;else if($[K]==="}")B--;if(B>0)K++}continue}if(Z)continue;if(W==="(")X++;else if(W===")")X--;else if(W==="[")J++;else if(W==="]")J--;else if(W==="{")Q++;else if(W==="}")Q--;if(W==="|"&&X===0&&J===0&&Q===0){if(_==="|"){K++;continue}if(_==="="){K++;continue}return K}}return-1}function Y1($,Z,Y=!1){try{let X=$.trim(),J=KO(X);if(J>0){let Q=X.substring(0,J).trim(),G=X.substring(J+1).trim(),K=Y1(Q,Z,!0);return dZ(K,G,Z)}if(!B0(X)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${X}`);return L0(X,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return j0(X,Q)(...G)}catch{return L0(X,Z)}}catch(X){if(X instanceof ReferenceError){let J=/(\b\w+)\s+is not defined/.exec(X.message);if(J){let Q=J[1],G=WO(Q,Object.keys(Z));if(G&&G!==Q)X.message=`${X.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,X);throw X}}function WO($,Z){let Y=null;for(let J of Z){if(J===$)continue;let Q=_O($,J);if(Y===null||Q<Y.dist)Y={key:J,dist:Q}}if(!Y)return null;let X=Math.max($.length,Y.key.length);if(Y.dist<=2||Y.dist/X<=0.35)return Y.key;return null}function _O($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[Y,X]=$.length<Z.length?[$,Z]:[Z,$],J=Array(Y.length+1),Q=Array(Y.length+1);for(let G=0;G<=Y.length;G++)J[G]=G;for(let G=1;G<=X.length;G++){Q[0]=G;for(let K=1;K<=Y.length;K++){let W=Y[K-1]===X[G-1]?0:1;Q[K]=Math.min(Q[K-1]+1,J[K]+1,J[K-1]+W)}for(let K=0;K<=Y.length;K++)J[K]=Q[K]}return J[Y.length]}function b6($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var b7,uQ,W5;var d0=D(()=>{h0();q0();S7();b7={},uQ=new Map;W5={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let Y=String($);return Y.charAt(0).toUpperCase()+Y.slice(1)},number:($,Z,Y=0)=>{if($===void 0||$===null)return"";try{let X=Number($);return Number.isNaN(X)?"":X.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:($,Z,Y="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return X.toLocaleString(Y)}catch{return String($)}},join:($,Z,Y=",")=>{if(!Array.isArray($))return"";return $.join(String(Y))},escape:($,Z)=>{if($===void 0||$===null)return"";return w0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let X=Z.__translations,J=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=X;for(let W of Q){if(G===void 0||G===null)break;G=G[W]}if(G===void 0||G===null)return J?$:"";let K=String(G);return Object.entries(Y).forEach(([W,_])=>{K=K.replace(GO(W),String(_))}),K},t:($,Z,Y={})=>{return W5.translate($,Z,Y)},truncate:($,Z,Y=50,X="...")=>{if($===void 0||$===null)return"";let J=String($);if(J.length<=Y)return J;if(Y<=X.length)return X.substring(0,Y);return J.substring(0,Y-X.length)+X},date:($,Z,Y="short",X="en-US")=>{if($===void 0||$===null)return"";try{let J=$ instanceof Date?$:new Date($);if(Number.isNaN(J.getTime()))return String($);let Q={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Y==="iso")return J.toISOString();return new Intl.DateTimeFormat(X,Q[Y]||Q.short).format(J)}catch{return String($)}},currency:($,Z,Y="USD",X="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return new Intl.NumberFormat(X,{style:"currency",currency:Y}).format(J)}catch{return String($)}},pluralize:($,Z,Y,X)=>{let J=Number($);if(Number.isNaN(J))return Y;let Q=X||`${Y}s`;return J===1?Y:Q},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Y=String($);return Y.charAt(Y.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,Y=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Y?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,Y="")=>{return $===void 0||$===null||$===""?Y:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,Y=0,X)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,X);return $},replace:($,Z,Y,X="")=>{if($===void 0||$===null)return"";let J=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(J,"g"),()=>X)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let Y=Number($);return Number.isNaN(Y)?0:Math.abs(Y)},round:($,Z,Y=0)=>{let X=Number($);if(Number.isNaN(X))return 0;let J=10**Y;return Math.round(X*J)/J}}});class P7{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let Y=this.cache.keys().next().value;if(Y!==void 0)this.cache.delete(Y)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function B5($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!_5.has(Y)){if(_5.size>=BO){let X=_5.keys().next().value;if(X)_5.delete(X)}_5.set(Y,new RegExp($,Z))}return _5.get(Y)}class iQ{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),X=this.pool.find((K)=>K.context.join(",")===Y);if(X)return X.func;let J=this.fnCache,Q=this.fnCacheMaxSize,G=(...K)=>{return(W)=>{try{let _=`${Y}:${W}`,B=J.get(_);if(!B){if(J.size>=Q){let U=J.keys().next().value;if(U)J.delete(U)}B=Function(...Z,`
296
296
  'use strict';
297
297
  try {
298
298
  return ${W};
@@ -303,7 +303,7 @@ catch (e) {
303
303
  }
304
304
  throw e;
305
305
  }
306
- `),J.set(_,B)}return B(...K)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Z.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}class nQ{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,Y]of Object.entries($))this.setBudget(Z,Y)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,Y]of this.budgets.entries())$[Z]=Y;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=Z(),J=performance.now()-Y;return this.recordTime($,J),this.checkBudget($,J),X}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=await Z(),J=performance.now()-Y;return this.recordTime($,J),this.checkBudget($,J),X}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let X=Z/Y.maxTime*100,J=Y.warnThreshold!==void 0?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,Q=Z>=Y.maxTime;if(!J&&!Q)return;let G={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:X,timestamp:new Date,isWarning:J};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let W of this.violationHandlers)try{W(G)}catch{}let K=J?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${X.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(X-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(Q)throw Error(K);else console.warn(K);break}}recordTime($,Z){let Y=this.metrics.get($);if(Y)Y.count++,Y.totalTime+=Z,Y.maxTime=Math.max(Y.maxTime,Z),Y.minTime=Math.min(Y.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let Y=this.metrics.get($);if(!Y)return{};let X=this.budgets.get($);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:X?.maxTime,budgetUtilization:X?Y.totalTime/Y.count/X.maxTime*100:void 0}}let Z={};for(let[Y,X]of this.metrics.entries()){let J=this.budgets.get(Y);Z[Y]={count:X.count,avgTime:X.totalTime/X.count,totalTime:X.totalTime,maxTime:X.maxTime,minTime:X.minTime,budget:J?.maxTime,budgetUtilization:J?X.totalTime/X.count/J.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,Y=0;for(let X of this.violations)if($[X.label]=($[X.label]||0)+1,X.isWarning)Z++;else Y++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:Y}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function UO(){if(!mZ)mZ=new nQ;return mZ}var _5,BO=500,TD,mZ=null,x7;var g$=D(()=>{_5=new Map;TD=new iQ;x7=new Proxy({},{get($,Z){return UO()[Z]}})});var R;var v7=D(()=>{R={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"}});import C6 from"path";function pZ($,Z,Y,X){let J=$;J=J.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,W)=>{let B={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[K]||"Make this element accessible";return`<!-- a11y-hint: ${W||B} -->`});let Q=/@screenReader\(([^@]*)\)@endScreenReader/g;return J=J.replace(Q,(G,K)=>{return`<span class="sr-only">${K.trim()}</span>`}),J=J.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(G,K,W)=>{return`<span id="${`desc-${K}`}" class="sr-only">${W}</span>`}),J}function zO(){return`
306
+ `),J.set(_,B)}return B(...K)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Z.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}class nQ{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,Y]of Object.entries($))this.setBudget(Z,Y)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,Y]of this.budgets.entries())$[Z]=Y;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=Z(),J=performance.now()-Y;return this.recordTime($,J),this.checkBudget($,J),X}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=await Z(),J=performance.now()-Y;return this.recordTime($,J),this.checkBudget($,J),X}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let X=Z/Y.maxTime*100,J=Y.warnThreshold!==void 0?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,Q=Z>=Y.maxTime;if(!J&&!Q)return;let G={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:X,timestamp:new Date,isWarning:J};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let W of this.violationHandlers)try{W(G)}catch{}let K=J?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${X.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(X-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(Q)throw Error(K);else console.warn(K);break}}recordTime($,Z){let Y=this.metrics.get($);if(Y)Y.count++,Y.totalTime+=Z,Y.maxTime=Math.max(Y.maxTime,Z),Y.minTime=Math.min(Y.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let Y=this.metrics.get($);if(!Y)return{};let X=this.budgets.get($);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:X?.maxTime,budgetUtilization:X?Y.totalTime/Y.count/X.maxTime*100:void 0}}let Z={};for(let[Y,X]of this.metrics.entries()){let J=this.budgets.get(Y);Z[Y]={count:X.count,avgTime:X.totalTime/X.count,totalTime:X.totalTime,maxTime:X.maxTime,minTime:X.minTime,budget:J?.maxTime,budgetUtilization:J?X.totalTime/X.count/J.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,Y=0;for(let X of this.violations)if($[X.label]=($[X.label]||0)+1,X.isWarning)Z++;else Y++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:Y}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function UO(){if(!uZ)uZ=new nQ;return uZ}var _5,BO=500,TD,uZ=null,x7;var g$=D(()=>{_5=new Map;TD=new iQ;x7=new Proxy({},{get($,Z){return UO()[Z]}})});var R;var v7=D(()=>{R={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"}});import C6 from"path";function mZ($,Z,Y,X){let J=$;J=J.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,W)=>{let B={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[K]||"Make this element accessible";return`<!-- a11y-hint: ${W||B} -->`});let Q=/@screenReader\(([^@]*)\)@endScreenReader/g;return J=J.replace(Q,(G,K)=>{return`<span class="sr-only">${K.trim()}</span>`}),J=J.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(G,K,W)=>{return`<span id="${`desc-${K}`}" class="sr-only">${W}</span>`}),J}function zO(){return`
307
307
  .sr-only {
308
308
  position: absolute;
309
309
  width: 1px;
@@ -548,7 +548,7 @@ else {
548
548
  }
549
549
  })();
550
550
  </script>
551
- `}function lZ($,Z,Y,X){let J=$;if(X.animation?.enabled===!1)return J;let Q=Y.includes("test")&&Y.includes("animation");if(!NO(J)&&!Q)return J;if(!J.includes('<style id="stx-animation-base">')){let K=wO();J=J.replace("</head>",`${K}
551
+ `}function cZ($,Z,Y,X){let J=$;if(X.animation?.enabled===!1)return J;let Q=Y.includes("test")&&Y.includes("animation");if(!NO(J)&&!Q)return J;if(!J.includes('<style id="stx-animation-base">')){let K=wO();J=J.replace("</head>",`${K}
552
552
  </head>`)}if(J.includes("stx-observe")){if(!J.includes("Intersection Observer for scroll animations")){let W=AO(),_=J.lastIndexOf("</body>");if(_!==-1)J=J.slice(0,_)+W+`
553
553
  `+J.slice(_)}}return J}function MO($,Z){let Y=Z.map((X)=>{let J=X.offset!==void 0?`${X.offset*100}%`:"from",Q=Object.entries(X.properties).map(([G,K])=>`${G}: ${K}`).join("; ");return`${J} { ${Q} }`}).join(`
554
554
  `);return`@keyframes ${$} {
@@ -686,9 +686,9 @@ else {
686
686
  );
687
687
  }
688
688
  };
689
- </script>`}function bO($){let Z=$.customDirectives||[];return Z.push(v6),Z.push(g6),Z.push(h6),Z.push(f6),Z.push(ZG),Z.push(YG),Z.push(XG),{...$,customDirectives:Z}}var tQ,eQ,$G,w1,v6,f6,g6,h6,cZ,ZG,YG,XG;var d6=D(()=>{((G)=>{G.Fade="fade";G.Slide="slide";G.Scale="scale";G.Flip="flip";G.Rotate="rotate";G.Custom="custom"})(tQ||={});((X)=>{X.In="in";X.Out="out";X.Both="both"})(eQ||={});((G)=>{G.Linear="linear";G.Ease="ease";G.EaseIn="ease-in";G.EaseOut="ease-out";G.EaseInOut="ease-in-out";G.Spring="spring"})($G||={});w1={duration:300,delay:0,ease:"ease",direction:"both"};v6={name:"transition",handler:($,Z,Y,X)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let J=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||w1.duration:w1.duration,G=Z.length>2?Z[2]||w1.ease:w1.ease,K=Z.length>3?Number.parseInt(Z[3],10)||w1.delay:w1.delay,W=Z.length>4?Z[4]||w1.direction:w1.direction,_=`stx-transition-${Math.random().toString(36).substr(2,9)}`,B=FO(J,{duration:Q,delay:K,ease:G,direction:W}),U="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="${_}" class="${U} ${z} ${W==="out"?"stx-out":""}"
689
+ </script>`}function bO($){let Z=$.customDirectives||[];return Z.push(v6),Z.push(g6),Z.push(h6),Z.push(f6),Z.push(ZG),Z.push(YG),Z.push(XG),{...$,customDirectives:Z}}var tQ,eQ,$G,w1,v6,f6,g6,h6,pZ,ZG,YG,XG;var d6=D(()=>{((G)=>{G.Fade="fade";G.Slide="slide";G.Scale="scale";G.Flip="flip";G.Rotate="rotate";G.Custom="custom"})(tQ||={});((X)=>{X.In="in";X.Out="out";X.Both="both"})(eQ||={});((G)=>{G.Linear="linear";G.Ease="ease";G.EaseIn="ease-in";G.EaseOut="ease-out";G.EaseInOut="ease-in-out";G.Spring="spring"})($G||={});w1={duration:300,delay:0,ease:"ease",direction:"both"};v6={name:"transition",handler:($,Z,Y,X)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let J=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||w1.duration:w1.duration,G=Z.length>2?Z[2]||w1.ease:w1.ease,K=Z.length>3?Number.parseInt(Z[3],10)||w1.delay:w1.delay,W=Z.length>4?Z[4]||w1.direction:w1.direction,_=`stx-transition-${Math.random().toString(36).substr(2,9)}`,B=FO(J,{duration:Q,delay:K,ease:G,direction:W}),U="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="${_}" class="${U} ${z} ${W==="out"?"stx-out":""}"
690
690
  style="--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},f6={name:"scrollAnimate",handler:($,Z,Y,X)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let J=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",K=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,W=Z.length>4?Number.parseInt(Z[4],10)||0:0,_=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,B=`--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${W}ms; will-change: opacity, transform;`,U="stx-transition stx-observe stx-out";if(J==="fade")U+=" stx-fade";else if(J==="slide-up"||J==="slide")U+=" stx-from-bottom";else if(J==="slide-down")U+=" stx-from-top";else if(J==="slide-left")U+=" stx-from-right";else if(J==="slide-right")U+=" stx-from-left";else if(J==="scale")U+=" stx-scale";else if(J.includes("-"))U+=` stx-${J}`;else U+=` stx-${J}`;return`<div id="${_}" class="${U}" style="${B}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},g6={name:"animationGroup",handler:($,Z,Y,X)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let J=Z[0],Q=Z.slice(1).map((_)=>_.startsWith("#")||_.startsWith(".")?_:`#${_}`),G=Y.staggerDelay||50,K=Y.sequence||!0,W=RO(J,Q,{staggerDelay:G,sequence:K});return`${$}
691
- ${W}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},h6={name:"motion",handler:($,Z,Y,X)=>{let J=Z.length>0?Z[0].toLowerCase()==="true":!0,Q=VO();return`<div data-animate="${J?"auto":"true"}">${$}</div>${Q}`},hasEndTag:!0,description:"Controls motion and animation preferences"};cZ={default:{stiffness:100,damping:10,mass:1},gentle:{stiffness:120,damping:14,mass:1},wobbly:{stiffness:180,damping:12,mass:1},stiff:{stiffness:210,damping:20,mass:1},slow:{stiffness:280,damping:60,mass:1},molasses:{stiffness:280,damping:120,mass:1}};ZG={name:"keyframe",hasEndTag:!0,handler:($,Z,Y,X)=>{if(Z.length<1)return`<div class="stx-error">@keyframe requires an animation name</div>${$}`;let J=Z[0].replace(/['"`]/g,""),Q=Z[1]?Number.parseInt(Z[1],10):1000,G=Z[2]?.replace(/['"`]/g,"")||"ease",K=Z[3]||"1",W=Z[4]?.replace(/['"`]/g,"")||"normal",_=Z[5]?.replace(/['"`]/g,"")||"forwards",B=`stx-keyframe-${Math.random().toString(36).slice(2,9)}`,U=`
691
+ ${W}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},h6={name:"motion",handler:($,Z,Y,X)=>{let J=Z.length>0?Z[0].toLowerCase()==="true":!0,Q=VO();return`<div data-animate="${J?"auto":"true"}">${$}</div>${Q}`},hasEndTag:!0,description:"Controls motion and animation preferences"};pZ={default:{stiffness:100,damping:10,mass:1},gentle:{stiffness:120,damping:14,mass:1},wobbly:{stiffness:180,damping:12,mass:1},stiff:{stiffness:210,damping:20,mass:1},slow:{stiffness:280,damping:60,mass:1},molasses:{stiffness:280,damping:120,mass:1}};ZG={name:"keyframe",hasEndTag:!0,handler:($,Z,Y,X)=>{if(Z.length<1)return`<div class="stx-error">@keyframe requires an animation name</div>${$}`;let J=Z[0].replace(/['"`]/g,""),Q=Z[1]?Number.parseInt(Z[1],10):1000,G=Z[2]?.replace(/['"`]/g,"")||"ease",K=Z[3]||"1",W=Z[4]?.replace(/['"`]/g,"")||"normal",_=Z[5]?.replace(/['"`]/g,"")||"forwards",B=`stx-keyframe-${Math.random().toString(36).slice(2,9)}`,U=`
692
692
  animation-name: ${J};
693
693
  animation-duration: ${Q}ms;
694
694
  animation-timing-function: ${G};
@@ -705,12 +705,12 @@ ${W}`},hasEndTag:!1,description:"Coordinates multiple animations together as a g
705
705
  from { opacity: 0; transform: translateY(10px); }
706
706
  to { opacity: 1; transform: translateY(0); }
707
707
  }
708
- </style>`}<div id="${W}" class="stx-stagger-container">${$}</div>${B}`},description:"Applies staggered animations to child elements"};XG={name:"spring",hasEndTag:!0,handler:($,Z,Y,X)=>{let J=Z[0]?.replace(/['"`]/g,"")||"default",Q;if(cZ[J])Q=cZ[J];else Q={stiffness:Number.parseInt(J,10)||100,damping:Z[1]?Number.parseInt(Z[1],10):10,mass:Z[2]?Number.parseFloat(Z[2]):1};let G=Z[3]?Number.parseInt(Z[3],10):500,K=`stx-spring-${Math.random().toString(36).slice(2,9)}`,W=EO(Q),_=`
708
+ </style>`}<div id="${W}" class="stx-stagger-container">${$}</div>${B}`},description:"Applies staggered animations to child elements"};XG={name:"spring",hasEndTag:!0,handler:($,Z,Y,X)=>{let J=Z[0]?.replace(/['"`]/g,"")||"default",Q;if(pZ[J])Q=pZ[J];else Q={stiffness:Number.parseInt(J,10)||100,damping:Z[1]?Number.parseInt(Z[1],10):10,mass:Z[2]?Number.parseFloat(Z[2]):1};let G=Z[3]?Number.parseInt(Z[3],10):500,K=`stx-spring-${Math.random().toString(36).slice(2,9)}`,W=EO(Q),_=`
709
709
  transition: all ${G}ms ${W};
710
710
  --stx-spring-stiffness: ${Q.stiffness};
711
711
  --stx-spring-damping: ${Q.damping};
712
712
  --stx-spring-mass: ${Q.mass};
713
- `.trim().replace(/\s+/g," ");return`<div id="${K}" class="stx-spring" style="${_}">${$}</div>`},description:"Applies spring physics animations to an element"}});import{getRouterScript as JG}from"stx-router";var QG=D(()=>{iZ()});async function CO($,Z,Y,X){let J=Z[0]?.replace(/['"]/g,"")||"main",Q=JG();if(J!=="main")Q=Q.replace("container:'main'",`container:'${J}'`);return`<script data-stx-router>${Q}</script>`}var GG;var iZ=D(()=>{QG();GG={name:"stxRouter",handler:CO,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function nZ($){let Z=$.heatmap;if(!Z?.enabled)return"";let Y={...KG,...Z};return`
713
+ `.trim().replace(/\s+/g," ");return`<div id="${K}" class="stx-spring" style="${_}">${$}</div>`},description:"Applies spring physics animations to an element"}});import{getRouterScript as JG}from"stx-router";var QG=D(()=>{lZ()});async function CO($,Z,Y,X){let J=Z[0]?.replace(/['"]/g,"")||"main",Q=JG();if(J!=="main")Q=Q.replace("container:'main'",`container:'${J}'`);return`<script data-stx-router>${Q}</script>`}var GG;var lZ=D(()=>{QG();GG={name:"stxRouter",handler:CO,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function iZ($){let Z=$.heatmap;if(!Z?.enabled)return"";let Y={...KG,...Z};return`
714
714
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
715
715
  <script>
716
716
  (function() {
@@ -1093,10 +1093,10 @@ else {
1093
1093
  };
1094
1094
  })();
1095
1095
  </script>
1096
- `}function sZ($,Z){let Y=nZ(Z);if(!Y)return $;let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Y+$.slice(X);return $+Y}function yO($){let Z={},Y=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let X of Y){let[J,Q]=X.split("="),G=Q?.replace(/["']/g,"");switch(J){case"endpoint":Z.endpoint=G;break;case"samplingRate":Z.samplingRate=Number.parseInt(G,10);break;case"batchSize":Z.batchSize=Number.parseInt(G,10);break;case"trackMouse":Z.trackMouse=G==="true";break;case"trackClicks":Z.trackClicks=G==="true";break;case"trackScroll":Z.trackScroll=G==="true";break;case"honorDnt":Z.honorDnt=G==="true";break;case"debugOverlay":Z.debugOverlay=G==="true";break}}return Z}class oZ{sessions=new Map;addSession($){let Z=this.sessions.get($.sid);if(Z)Z.points.push(...$.points),Z.lastActivity=Math.max(Z.lastActivity,$.lastActivity);else this.sessions.set($.sid,$)}getPageData($){let Z=[];for(let Y of this.sessions.values())if(Y.page===$)Z.push(...Y.points);return Z}getClickData($){return this.getPageData($).filter((Z)=>Z.type==="click")}getMovementData($){return this.getPageData($).filter((Z)=>Z.type==="move")}getScrollData($){let Z=this.getPageData($).filter((X)=>X.type==="scroll"),Y=new Map;for(let X of Z)if(X.depth!==void 0)Y.set(X.depth,(Y.get(X.depth)||0)+1);return Array.from(Y.entries()).map(([X,J])=>({depth:X,count:J})).sort((X,J)=>X.depth-J.depth)}getZoneStats($){let Z=new Map,Y=this.getPageData($);for(let X of Y)if(X.zone){let J=Z.get(X.zone)||{clicks:0,hovers:0};if(X.type==="click")J.clicks++;else if(X.type==="move")J.hovers++;Z.set(X.zone,J)}return Z}generateGridData($,Z=20){let Y=this.getPageData($),X=[];for(let Q=0;Q<Z;Q++){X[Q]=[];for(let G=0;G<Z;G++)X[Q][G]=0}for(let Q of Y){let G=Math.min(Math.floor(Q.x/100*Z),Z-1),K=Math.min(Math.floor(Q.y/100*Z),Z-1);X[K][G]+=Q.type==="click"?3:1}let J=0;for(let Q of X)for(let G of Q)J=Math.max(J,G);return X.map((Q,G)=>Q.map((K,W)=>({x:W,y:G,intensity:J>0?K/J:0})))}exportJSON(){return JSON.stringify({sessions:Array.from(this.sessions.values()),exportedAt:new Date().toISOString()},null,2)}clear(){this.sessions.clear()}get sessionCount(){return this.sessions.size}get totalPoints(){let $=0;for(let Z of this.sessions.values())$+=Z.points.length;return $}}function PO(){return new oZ}var KG,rZ;var u6=D(()=>{KG={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};rZ={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,Y,X)=>{let J=Y.__stx_config||{};if(Z.length>0){let Q=yO(Z.join(" "));J.heatmap={...J.heatmap,...Q,enabled:!0}}return nZ(J)}}});function J$($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function WG($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function _G($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Y=$.match(Z);if(!Y)return{data:{},content:$.trim()};let X=Y[1],J=$.slice(Y[0].length),Q={};for(let G of X.split(`
1097
- `)){let K=G.trim();if(!K||K.startsWith("#"))continue;let W=K.indexOf(":");if(W===-1)continue;let _=K.slice(0,W).trim(),B=K.slice(W+1).trim();if(typeof B==="string"){if(B.startsWith('"')&&B.endsWith('"')||B.startsWith("'")&&B.endsWith("'"))B=B.slice(1,-1);else if(B.startsWith("[")&&B.endsWith("]"))try{B=JSON.parse(B)}catch{}else if(B==="true")B=!0;else if(B==="false")B=!1;else if(/^-?\d+(?:\.\d+)?$/.test(B))B=Number(B)}Q[_]=B}return{data:Q,content:J.trim()}}function f7($,Z={}){let{gfm:Y=!0,breaks:X=!1}=Z,J=$,Q=[];if(J=J.replace(/```(\w*)\n([\s\S]*?)```/g,(B,U,z)=>{let q=Q.length,j=U?` class="language-${J$(U)}"`:"";return Q.push(`<pre><code${j}>${J$(z.trim())}</code></pre>`),`\x00CODEBLOCK${q}\x00`}),J=J.replace(/`([^`]*)`/g,(B,U)=>`<code>${J$(U)}</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>"),Y)J=J.replace(/~~(.+?)~~/g,"<del>$1</del>");if(J=J.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(B,U,z)=>{return`<img src="${WG(z)?J$(z):""}" alt="${J$(U)}" />`}),J=J.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(B,U,z)=>{return`<a href="${WG(z)?J$(z):""}">${U}</a>`}),J=J.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),J=J.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),J=J.replace(/<\/blockquote>\n<blockquote>/g,`
1098
- `),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>"),Y)J=J.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(B,U,z)=>{let j=`<tr>${U.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<th>${J$(O)}</th>`).join("")}</tr>`,H=z.trim().split(`
1099
- `).map((O)=>{return`<tr>${O.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<td>${J$(L)}</td>`).join("")}</tr>`}).join(`
1096
+ `}function nZ($,Z){let Y=iZ(Z);if(!Y)return $;let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Y+$.slice(X);return $+Y}function yO($){let Z={},Y=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let X of Y){let[J,Q]=X.split("="),G=Q?.replace(/["']/g,"");switch(J){case"endpoint":Z.endpoint=G;break;case"samplingRate":Z.samplingRate=Number.parseInt(G,10);break;case"batchSize":Z.batchSize=Number.parseInt(G,10);break;case"trackMouse":Z.trackMouse=G==="true";break;case"trackClicks":Z.trackClicks=G==="true";break;case"trackScroll":Z.trackScroll=G==="true";break;case"honorDnt":Z.honorDnt=G==="true";break;case"debugOverlay":Z.debugOverlay=G==="true";break}}return Z}class rZ{sessions=new Map;addSession($){let Z=this.sessions.get($.sid);if(Z)Z.points.push(...$.points),Z.lastActivity=Math.max(Z.lastActivity,$.lastActivity);else this.sessions.set($.sid,$)}getPageData($){let Z=[];for(let Y of this.sessions.values())if(Y.page===$)Z.push(...Y.points);return Z}getClickData($){return this.getPageData($).filter((Z)=>Z.type==="click")}getMovementData($){return this.getPageData($).filter((Z)=>Z.type==="move")}getScrollData($){let Z=this.getPageData($).filter((X)=>X.type==="scroll"),Y=new Map;for(let X of Z)if(X.depth!==void 0)Y.set(X.depth,(Y.get(X.depth)||0)+1);return Array.from(Y.entries()).map(([X,J])=>({depth:X,count:J})).sort((X,J)=>X.depth-J.depth)}getZoneStats($){let Z=new Map,Y=this.getPageData($);for(let X of Y)if(X.zone){let J=Z.get(X.zone)||{clicks:0,hovers:0};if(X.type==="click")J.clicks++;else if(X.type==="move")J.hovers++;Z.set(X.zone,J)}return Z}generateGridData($,Z=20){let Y=this.getPageData($),X=[];for(let Q=0;Q<Z;Q++){X[Q]=[];for(let G=0;G<Z;G++)X[Q][G]=0}for(let Q of Y){let G=Math.min(Math.floor(Q.x/100*Z),Z-1),K=Math.min(Math.floor(Q.y/100*Z),Z-1);X[K][G]+=Q.type==="click"?3:1}let J=0;for(let Q of X)for(let G of Q)J=Math.max(J,G);return X.map((Q,G)=>Q.map((K,W)=>({x:W,y:G,intensity:J>0?K/J:0})))}exportJSON(){return JSON.stringify({sessions:Array.from(this.sessions.values()),exportedAt:new Date().toISOString()},null,2)}clear(){this.sessions.clear()}get sessionCount(){return this.sessions.size}get totalPoints(){let $=0;for(let Z of this.sessions.values())$+=Z.points.length;return $}}function PO(){return new rZ}var KG,sZ;var u6=D(()=>{KG={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};sZ={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,Y,X)=>{let J=Y.__stx_config||{};if(Z.length>0){let Q=yO(Z.join(" "));J.heatmap={...J.heatmap,...Q,enabled:!0}}return iZ(J)}}});function Q$($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function WG($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function _G($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Y=$.match(Z);if(!Y)return{data:{},content:$.trim()};let X=Y[1],J=$.slice(Y[0].length),Q={};for(let G of X.split(`
1097
+ `)){let K=G.trim();if(!K||K.startsWith("#"))continue;let W=K.indexOf(":");if(W===-1)continue;let _=K.slice(0,W).trim(),B=K.slice(W+1).trim();if(typeof B==="string"){if(B.startsWith('"')&&B.endsWith('"')||B.startsWith("'")&&B.endsWith("'"))B=B.slice(1,-1);else if(B.startsWith("[")&&B.endsWith("]"))try{B=JSON.parse(B)}catch{}else if(B==="true")B=!0;else if(B==="false")B=!1;else if(/^-?\d+(?:\.\d+)?$/.test(B))B=Number(B)}Q[_]=B}return{data:Q,content:J.trim()}}function f7($,Z={}){let{gfm:Y=!0,breaks:X=!1}=Z,J=$,Q=[];if(J=J.replace(/```(\w*)\n([\s\S]*?)```/g,(B,U,z)=>{let q=Q.length,j=U?` class="language-${Q$(U)}"`:"";return Q.push(`<pre><code${j}>${Q$(z.trim())}</code></pre>`),`\x00CODEBLOCK${q}\x00`}),J=J.replace(/`([^`]*)`/g,(B,U)=>`<code>${Q$(U)}</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>"),Y)J=J.replace(/~~(.+?)~~/g,"<del>$1</del>");if(J=J.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(B,U,z)=>{return`<img src="${WG(z)?Q$(z):""}" alt="${Q$(U)}" />`}),J=J.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(B,U,z)=>{return`<a href="${WG(z)?Q$(z):""}">${U}</a>`}),J=J.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),J=J.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),J=J.replace(/<\/blockquote>\n<blockquote>/g,`
1098
+ `),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>"),Y)J=J.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(B,U,z)=>{let j=`<tr>${U.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<th>${Q$(O)}</th>`).join("")}</tr>`,H=z.trim().split(`
1099
+ `).map((O)=>{return`<tr>${O.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<td>${Q$(L)}</td>`).join("")}</tr>`}).join(`
1100
1100
  `);return`<table>
1101
1101
  <thead>
1102
1102
  ${j}
@@ -1111,11 +1111,11 @@ ${H}
1111
1111
  `:`
1112
1112
  `)}</p>`);if(J=K.join(`
1113
1113
  `),X)J=J.replace(/\n/g,`<br />
1114
- `);for(let B=0;B<Q.length;B++)J=J.replace(`\x00CODEBLOCK${B}\x00`,Q[B]);return J=J.replace(/<p>\s*<\/p>/g,""),J.trim()}async function aZ($,Z,Y=""){let X=$,J=[],Q=/@markdown(?:\([^)]*\))?/g,G;while((G=Q.exec($))!==null){let K=G.index,W=G[0].match(/@markdown\(([^)]*)\)/),_=W?W[1]:"",B=K+G[0].length,U=1,z=B,q=-1;while(U>0&&z<$.length){let O=$.indexOf("@markdown",z),F=$.indexOf("@endmarkdown",z);if(F===-1)break;if(O!==-1&&O<F&&O!==K){let L=$[O+9];if(L==="("||L===`
1115
- `||L==="\r"||L===" "||L===void 0)U++;z=O+9}else{if(U--,U===0){q=F;break}z=F+12}}if(q===-1)continue;let j=$.slice(B,q),H=$.slice(K,q+12);J.push({fullMatch:H,options:_,content:j,index:K}),Q.lastIndex=q+12}for(let{fullMatch:K,options:W,content:_,index:B}of J)try{let U={};if(W)W.split(",").forEach((j)=>{let H=j.trim();if(H)U[H]=!0});let z={gfm:U.gfm??!0,breaks:U.breaks??!1},q=f7(_.trim(),z);X=X.split(K).join(q)}catch(U){let z=U instanceof Error?U.message:String(U),q=U0("Markdown Directive",`Error processing markdown: ${z}`,Y,$,B,K);X=X.split(K).join(q)}return X}async function tZ($,Z,Y,X){let J={gfm:!0,breaks:!1};return Z.forEach((Q)=>{let G=Q.trim().replace(/['"]/g,"");if(G==="breaks")J.breaks=!0;if(G==="no-gfm")J.gfm=!1}),f7($.trim(),J)}var m6=D(()=>{q0()});function Q$($,Z=R1,Y={},X){return Z.sort((J,Q)=>J-Q).map((J)=>{return`${j1($,{...Y,w:J,fm:X})} ${J}w`}).join(", ")}function eZ($,Z=320,Y=2560,X=0.08,J={},Q){let G=p6(Z,Y,X);return Q$($,G,J,Q)}function p6($,Z,Y=0.08){let X=[],J=$;while(J<Z)X.push(Math.round(J)),J*=1+Y*2;if(X[X.length-1]!==Z)X.push(Z);return X}function U5($,Z,Y=g7,X={},J){return Y.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${j1($,{...X,w:G,dpr:Q,fm:J})} ${Q}x`}).join(", ")}function $Y($,Z,Y=g7,X=80,J={},Q){let G={1:X,1.5:Math.round(X*0.9),2:Math.round(X*0.8),3:Math.round(X*0.7),4:Math.round(X*0.6),5:Math.round(X*0.5)};return Y.sort((K,W)=>K-W).map((K)=>{let W=Math.round(Z*K),_=G[K]||Math.round(X*Math.max(0.5,1-K*0.1));return`${j1($,{...J,w:W,q:_,dpr:K,fm:Q})} ${K}x`}).join(", ")}function z5($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let X=Object.entries($).map(([J,Q])=>{let G=/^\d+$/.test(J)?`${J}px`:J;return{bp:G,size:Q,numericBp:Number.parseInt(G)||0}}).sort((J,Q)=>J.numericBp-Q.numericBp).map(({bp:J,size:Q})=>`(max-width: ${J}) ${Q}`);return X.push(Z),X.join(", ")}function ZY($,Z="100vw"){if(!$||$.length===0)return Z;let X=[...$].sort((J,Q)=>(J.maxWidth||0)-(Q.maxWidth||0)).filter((J)=>J.maxWidth).map((J)=>`(max-width: ${J.maxWidth}px) ${J.imageWidth}`);return X.push(Z),X.join(", ")}function j1($,Z={}){let Y=Object.entries(Z).filter(([,Q])=>Q!==void 0&&Q!==null).map(([Q,G])=>{if(Array.isArray(G))return[Q,G.join(",")];return[Q,String(G)]});if(Y.length===0)return $;let X=Y.map(([Q,G])=>`${Q}=${encodeURIComponent(G)}`).join("&"),J=$.includes("?")?"&":"?";return`${$}${J}${X}`}function XY($){let[Z,Y]=$.split("?"),X={};if(Y)new URLSearchParams(Y).forEach((Q,G)=>{if(/^\d+$/.test(Q))X[G]=Number.parseInt(Q,10);else if(/^\d+\.\d+$/.test(Q))X[G]=Number.parseFloat(Q);else if(Q==="true")X[G]=!0;else if(Q==="false")X[G]=!1;else X[G]=Q});return{src:Z,params:X}}function JY($){let{src:Z,widths:Y,dprValues:X,fixedWidth:J,formats:Q=m1,baseUrl:G="",params:K={}}=$,W=[];for(let _ of Q){let B,U;if(J!==void 0&&X)B=U5(Z,J,X,K,_),U=X.map((z)=>({path:"",url:j1(Z,{...K,w:Math.round(J*z),fm:_}),width:Math.round(J*z),height:0,format:_,size:0,dpr:z}));else{let z=Y||R1;B=Q$(Z,z,K,_),U=z.map((q)=>({path:"",url:j1(Z,{...K,w:q,fm:_}),width:q,height:0,format:_,size:0}))}W.push({srcset:B,format:_,mimeType:h7[_],variants:U})}return W}function QY($,Z="100vw"){return $.map(({srcset:Y,mimeType:X})=>`<source type="${X}" srcset="${Y}" sizes="${Z}" />`).join(`
1116
- `)}function GY($,Z){if($.length===0)return;let Y=[...$].sort((J,Q)=>J.width-Q.width),X=Y.find((J)=>J.width>=Z);if(X)return X;return Y[Y.length-1]}function d7($){return h7[$]||"application/octet-stream"}function KY($){return BG[$]||$}function WY($){switch($.split(".").pop()?.toLowerCase()){case"jpg":case"jpeg":return"jpeg";case"png":return"png";case"webp":return"webp";case"avif":return"avif";case"gif":return"gif";default:return}}var R1,g7,m1,h7,BG,YY;var c6=D(()=>{R1=[320,480,640,768,1024,1280,1536,1920,2560],g7=[1,1.5,2,3],m1=["avif","webp","jpeg"],h7={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"},BG={avif:"avif",webp:"webp",jpeg:"jpg",png:"png",gif:"gif"};YY={fullWidth:"100vw",halfDesktop:"(max-width: 768px) 100vw, 50vw",thirdDesktop:"(max-width: 768px) 100vw, 33.33vw",quarterDesktop:"(max-width: 480px) 100vw, (max-width: 768px) 50vw, 25vw",contentWidth:"(max-width: 768px) 100vw, (max-width: 1200px) 80vw, 960px"}});async function _Y(){try{return await import("ts-images")}catch{return null}}async function u7($,Z={}){let Y={...l6,...Z},X=await _Y();if(X)try{return await xO($,Y,X)}catch(J){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${J}`)}return UG($,Y)}async function xO($,Z,Y){let{generatePlaceholder:X,generateThumbHash:J}=Y,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await J($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await X($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:K.dataURL,width:K.width,height:K.height,aspectRatio:K.aspectRatio,originalWidth:K.originalWidth,originalHeight:K.originalHeight,strategy:Z.strategy,dominantColor:K.dominantColor,css:K.css}}function UG($,Z){let Y=Z.width||20,X=Z.height||Y,J="#e5e7eb",Q=`<svg xmlns="http://www.w3.org/2000/svg" width="${Y}" height="${X}" viewBox="0 0 ${Y} ${X}"><rect fill="#e5e7eb" width="${Y}" height="${X}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Q)}`,width:Y,height:X,aspectRatio:Y/X,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}async function BY($){let Z=await _Y();if(Z)try{return(await Z.generateThumbHash($)).dataUrl}catch{}return(await UG($,{strategy:"thumbhash",width:32,height:32})).dataURL}function UY($){let Z=$[0]|$[1]<<8|$[2]<<16,Y=(Z&63)/63,X=(Z>>6&63)/31.5-1,J=(Z>>12&63)/31.5-1,Q=(Z>>18&31)/31,G=Z>>23!==0,K=$[3]|$[4]<<8,W=(K>>3&63)/63,_=(K>>9&63)/63,B=K>>15!==0,U=Math.max(3,B?G?5:7:G?5:7),z=Math.max(3,B?G?5:7:G?5:7),q=32,j=32,H=Math.max(0,Math.min(255,Math.round((Y+X)*255))),O=Math.max(0,Math.min(255,Math.round(Y*255))),F=Math.max(0,Math.min(255,Math.round((Y-X)*255))),L=`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32">
1114
+ `);for(let B=0;B<Q.length;B++)J=J.replace(`\x00CODEBLOCK${B}\x00`,Q[B]);return J=J.replace(/<p>\s*<\/p>/g,""),J.trim()}async function oZ($,Z,Y=""){let X=$,J=[],Q=/@markdown(?:\([^)]*\))?/g,G;while((G=Q.exec($))!==null){let K=G.index,W=G[0].match(/@markdown\(([^)]*)\)/),_=W?W[1]:"",B=K+G[0].length,U=1,z=B,q=-1;while(U>0&&z<$.length){let O=$.indexOf("@markdown",z),F=$.indexOf("@endmarkdown",z);if(F===-1)break;if(O!==-1&&O<F&&O!==K){let L=$[O+9];if(L==="("||L===`
1115
+ `||L==="\r"||L===" "||L===void 0)U++;z=O+9}else{if(U--,U===0){q=F;break}z=F+12}}if(q===-1)continue;let j=$.slice(B,q),H=$.slice(K,q+12);J.push({fullMatch:H,options:_,content:j,index:K}),Q.lastIndex=q+12}for(let{fullMatch:K,options:W,content:_,index:B}of J)try{let U={};if(W)W.split(",").forEach((j)=>{let H=j.trim();if(H)U[H]=!0});let z={gfm:U.gfm??!0,breaks:U.breaks??!1},q=f7(_.trim(),z);X=X.split(K).join(q)}catch(U){let z=U instanceof Error?U.message:String(U),q=U0("Markdown Directive",`Error processing markdown: ${z}`,Y,$,B,K);X=X.split(K).join(q)}return X}async function aZ($,Z,Y,X){let J={gfm:!0,breaks:!1};return Z.forEach((Q)=>{let G=Q.trim().replace(/['"]/g,"");if(G==="breaks")J.breaks=!0;if(G==="no-gfm")J.gfm=!1}),f7($.trim(),J)}var m6=D(()=>{q0()});function G$($,Z=R1,Y={},X){return Z.sort((J,Q)=>J-Q).map((J)=>{return`${j1($,{...Y,w:J,fm:X})} ${J}w`}).join(", ")}function tZ($,Z=320,Y=2560,X=0.08,J={},Q){let G=p6(Z,Y,X);return G$($,G,J,Q)}function p6($,Z,Y=0.08){let X=[],J=$;while(J<Z)X.push(Math.round(J)),J*=1+Y*2;if(X[X.length-1]!==Z)X.push(Z);return X}function U5($,Z,Y=g7,X={},J){return Y.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${j1($,{...X,w:G,dpr:Q,fm:J})} ${Q}x`}).join(", ")}function eZ($,Z,Y=g7,X=80,J={},Q){let G={1:X,1.5:Math.round(X*0.9),2:Math.round(X*0.8),3:Math.round(X*0.7),4:Math.round(X*0.6),5:Math.round(X*0.5)};return Y.sort((K,W)=>K-W).map((K)=>{let W=Math.round(Z*K),_=G[K]||Math.round(X*Math.max(0.5,1-K*0.1));return`${j1($,{...J,w:W,q:_,dpr:K,fm:Q})} ${K}x`}).join(", ")}function z5($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let X=Object.entries($).map(([J,Q])=>{let G=/^\d+$/.test(J)?`${J}px`:J;return{bp:G,size:Q,numericBp:Number.parseInt(G)||0}}).sort((J,Q)=>J.numericBp-Q.numericBp).map(({bp:J,size:Q})=>`(max-width: ${J}) ${Q}`);return X.push(Z),X.join(", ")}function $Y($,Z="100vw"){if(!$||$.length===0)return Z;let X=[...$].sort((J,Q)=>(J.maxWidth||0)-(Q.maxWidth||0)).filter((J)=>J.maxWidth).map((J)=>`(max-width: ${J.maxWidth}px) ${J.imageWidth}`);return X.push(Z),X.join(", ")}function j1($,Z={}){let Y=Object.entries(Z).filter(([,Q])=>Q!==void 0&&Q!==null).map(([Q,G])=>{if(Array.isArray(G))return[Q,G.join(",")];return[Q,String(G)]});if(Y.length===0)return $;let X=Y.map(([Q,G])=>`${Q}=${encodeURIComponent(G)}`).join("&"),J=$.includes("?")?"&":"?";return`${$}${J}${X}`}function YY($){let[Z,Y]=$.split("?"),X={};if(Y)new URLSearchParams(Y).forEach((Q,G)=>{if(/^\d+$/.test(Q))X[G]=Number.parseInt(Q,10);else if(/^\d+\.\d+$/.test(Q))X[G]=Number.parseFloat(Q);else if(Q==="true")X[G]=!0;else if(Q==="false")X[G]=!1;else X[G]=Q});return{src:Z,params:X}}function XY($){let{src:Z,widths:Y,dprValues:X,fixedWidth:J,formats:Q=m1,baseUrl:G="",params:K={}}=$,W=[];for(let _ of Q){let B,U;if(J!==void 0&&X)B=U5(Z,J,X,K,_),U=X.map((z)=>({path:"",url:j1(Z,{...K,w:Math.round(J*z),fm:_}),width:Math.round(J*z),height:0,format:_,size:0,dpr:z}));else{let z=Y||R1;B=G$(Z,z,K,_),U=z.map((q)=>({path:"",url:j1(Z,{...K,w:q,fm:_}),width:q,height:0,format:_,size:0}))}W.push({srcset:B,format:_,mimeType:h7[_],variants:U})}return W}function JY($,Z="100vw"){return $.map(({srcset:Y,mimeType:X})=>`<source type="${X}" srcset="${Y}" sizes="${Z}" />`).join(`
1116
+ `)}function QY($,Z){if($.length===0)return;let Y=[...$].sort((J,Q)=>J.width-Q.width),X=Y.find((J)=>J.width>=Z);if(X)return X;return Y[Y.length-1]}function d7($){return h7[$]||"application/octet-stream"}function GY($){return BG[$]||$}function KY($){switch($.split(".").pop()?.toLowerCase()){case"jpg":case"jpeg":return"jpeg";case"png":return"png";case"webp":return"webp";case"avif":return"avif";case"gif":return"gif";default:return}}var R1,g7,m1,h7,BG,ZY;var c6=D(()=>{R1=[320,480,640,768,1024,1280,1536,1920,2560],g7=[1,1.5,2,3],m1=["avif","webp","jpeg"],h7={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"},BG={avif:"avif",webp:"webp",jpeg:"jpg",png:"png",gif:"gif"};ZY={fullWidth:"100vw",halfDesktop:"(max-width: 768px) 100vw, 50vw",thirdDesktop:"(max-width: 768px) 100vw, 33.33vw",quarterDesktop:"(max-width: 480px) 100vw, (max-width: 768px) 50vw, 25vw",contentWidth:"(max-width: 768px) 100vw, (max-width: 1200px) 80vw, 960px"}});async function WY(){try{return await import("ts-images")}catch{return null}}async function u7($,Z={}){let Y={...l6,...Z},X=await WY();if(X)try{return await xO($,Y,X)}catch(J){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${J}`)}return UG($,Y)}async function xO($,Z,Y){let{generatePlaceholder:X,generateThumbHash:J}=Y,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await J($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await X($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:K.dataURL,width:K.width,height:K.height,aspectRatio:K.aspectRatio,originalWidth:K.originalWidth,originalHeight:K.originalHeight,strategy:Z.strategy,dominantColor:K.dominantColor,css:K.css}}function UG($,Z){let Y=Z.width||20,X=Z.height||Y,J="#e5e7eb",Q=`<svg xmlns="http://www.w3.org/2000/svg" width="${Y}" height="${X}" viewBox="0 0 ${Y} ${X}"><rect fill="#e5e7eb" width="${Y}" height="${X}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Q)}`,width:Y,height:X,aspectRatio:Y/X,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}async function _Y($){let Z=await WY();if(Z)try{return(await Z.generateThumbHash($)).dataUrl}catch{}return(await UG($,{strategy:"thumbhash",width:32,height:32})).dataURL}function BY($){let Z=$[0]|$[1]<<8|$[2]<<16,Y=(Z&63)/63,X=(Z>>6&63)/31.5-1,J=(Z>>12&63)/31.5-1,Q=(Z>>18&31)/31,G=Z>>23!==0,K=$[3]|$[4]<<8,W=(K>>3&63)/63,_=(K>>9&63)/63,B=K>>15!==0,U=Math.max(3,B?G?5:7:G?5:7),z=Math.max(3,B?G?5:7:G?5:7),q=32,j=32,H=Math.max(0,Math.min(255,Math.round((Y+X)*255))),O=Math.max(0,Math.min(255,Math.round(Y*255))),F=Math.max(0,Math.min(255,Math.round((Y-X)*255))),L=`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32">
1117
1117
  <rect fill="rgb(${H},${O},${F})" width="32" height="32"/>
1118
- </svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(L)}`}async function zY($,Z=20,Y=50){return u7($,{strategy:"blur",width:Z,quality:Y,blurLevel:40})}async function qY($){let Z=await _Y();if(Z)try{return(await Z.generatePlaceholder($,{strategy:"dominant-color"})).dominantColor||"#e5e7eb"}catch{}return"#e5e7eb"}function jY($,Z=1,Y=1){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${Z}" height="${Y}"><rect fill="${$}" width="${Z}" height="${Y}"/></svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(X)}`}function m7($,Z,Y={}){let X=Y.transitionDuration||300,J=Y.easing||"ease-out";return`
1118
+ </svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(L)}`}async function UY($,Z=20,Y=50){return u7($,{strategy:"blur",width:Z,quality:Y,blurLevel:40})}async function zY($){let Z=await WY();if(Z)try{return(await Z.generatePlaceholder($,{strategy:"dominant-color"})).dominantColor||"#e5e7eb"}catch{}return"#e5e7eb"}function qY($,Z=1,Y=1){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${Z}" height="${Y}"><rect fill="${$}" width="${Z}" height="${Y}"/></svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(X)}`}function m7($,Z,Y={}){let X=Y.transitionDuration||300,J=Y.easing||"ease-out";return`
1119
1119
  #${$} {
1120
1120
  --stx-img-transition-duration: ${X}ms;
1121
1121
  --stx-img-transition-easing: ${J};
@@ -1132,7 +1132,7 @@ ${H}
1132
1132
  #${$}.stx-img-loaded img {
1133
1133
  opacity: 1;
1134
1134
  }
1135
- `.trim()}function HY($){return`background-image: url('${$.dataURL}'); background-size: cover; background-position: center;`}async function p7($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if(q5.has(Y))return q5.get(Y);let X=await u7($,Z);return q5.set(Y,X),X}function OY(){q5.clear()}function LY(){return{size:q5.size,keys:Array.from(q5.keys())}}var l6,j5,q5;var FY=D(()=>{l6={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},j5=`
1135
+ `.trim()}function jY($){return`background-image: url('${$.dataURL}'); background-size: cover; background-position: center;`}async function p7($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if(q5.has(Y))return q5.get(Y);let X=await u7($,Z);return q5.set(Y,X),X}function HY(){q5.clear()}function OY(){return{size:q5.size,keys:Array.from(q5.keys())}}var l6,j5,q5;var LY=D(()=>{l6={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},j5=`
1136
1136
  .stx-img-placeholder {
1137
1137
  position: relative;
1138
1138
  overflow: hidden;
@@ -1161,8 +1161,8 @@ ${H}
1161
1161
  filter: blur(0);
1162
1162
  transform: scale(1);
1163
1163
  }
1164
- `.trim();q5=new Map});import{createHash as VY}from"crypto";import{readFile as vO,stat as zG}from"fs/promises";async function v0($){try{let Z=await vO($);return VY("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function qG($){return VY("sha256").update($).digest("hex").slice(0,16)}function i6($){return VY("sha256").update($).digest("hex").slice(0,16)}function H5($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${i6($)}-${i6(Y)}`}async function c7($){try{return(await zG($)).mtimeMs}catch{return 0}}async function f0($){try{return await zG($),!0}catch{return!1}}var G$=()=>{};import{mkdir as fO,readFile as HG,writeFile as gO,readdir as OG,rm as NY,stat as hO}from"fs/promises";import{join as O5,dirname as dO}from"path";async function uO($){try{await fO($,{recursive:!0})}catch{}}function LG($,Z,Y){return O5($,Y,`${Z}.json`)}async function jG($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await c7(Z)!==$.srcMtime)return!1;return!0}async function L5($,Z,Y,X=l7){if(!X.enabled)return null;let J=H5($,Z),Q=K$.get(J);if(Q){if(await jG(Q,$,X.maxAge))return Q.lastAccessedAt=Date.now(),Q.data;K$.delete(J)}let G=LG(X.directory,J,Y);if(await f0(G))try{let K=await HG(G,"utf-8"),W=JSON.parse(K);if(await jG(W,$,X.maxAge))return W.lastAccessedAt=Date.now(),K$.set(J,W),W.data}catch{}return null}async function F5($,Z,Y,X,J=l7){if(!J.enabled)return;let Q=H5($,Z),G=await v0($),K=await c7($),W={key:Q,src:$,srcHash:G,srcMtime:K,optionsHash:H5("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};K$.set(Q,W);let _=LG(J.directory,Q,X);try{await uO(dO(_)),await gO(_,JSON.stringify(W,null,2))}catch(B){console.warn(`[stx-media] Failed to write cache: ${B}`)}}async function V5($,Z=l7){if($==="all")K$.clear();else K$.clear();let Y=$==="all"?["image","video"]:[$];for(let X of Y){let J=O5(Z.directory,X);try{await NY(J,{recursive:!0,force:!0})}catch{}}}async function FG($=l7){let Z={memoryEntries:K$.size,diskEntries:{image:0,video:0},totalSizeMB:0};for(let Y of["image","video"]){let X=O5($.directory,Y);try{let J=await OG(X);Z.diskEntries[Y]=J.length;for(let Q of J){let G=O5(X,Q),K=await hO(G);Z.totalSizeMB+=K.size/1048576}}catch{}}return Z}async function VG($=l7){let Z=0,Y=$.maxAge*24*60*60*1000;for(let X of["image","video"]){let J=O5($.directory,X);try{let Q=await OG(J);for(let G of Q){let K=O5(J,G);try{let W=await HG(K,"utf-8"),_=JSON.parse(W);if(Date.now()-_.createdAt>Y)await NY(K),K$.delete(_.key),Z++}catch{await NY(K).catch(()=>{}),Z++}}}catch{}}return Z}var K$,l7;var n6=D(()=>{G$();K$=new Map,l7={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class N5{config;constructor($={}){this.config={...mO,...$}}async get($,Z){return L5($,Z,"image",this.config)}async set($,Z,Y){return F5($,Z,Y,"image",this.config)}async clear(){return V5("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function AY($){if(!s6)s6=new N5($);else if($)s6.updateConfig($);return s6}async function A5($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return AY(X).get($,Z)}async function w5($,Z,Y,X){let J=X?{directory:`${X.outputDir}/../.cache`}:{};return AY(J).set($,Z,Y)}async function wY(){return AY().clear()}var mO,s6=null;var RY=D(()=>{n6();mO={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as pO,basename as cO,extname as lO,join as iO}from"path";import{mkdir as nO}from"fs/promises";async function MY(){try{return await import("ts-images")}catch{return null}}function NG($){switch($){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function sO($,Z){let Y=Z?NG(Z):NG("web"),X=$.formatQuality||{};return{jpeg:{...Y.jpeg,...X.jpeg},png:{...Y.png,...X.png},webp:{...Y.webp,...X.webp},avif:{...Y.avif,...X.avif}}}async function TY($,Z,Y){let X=await MY();if(!X)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let J=await A5($,Z,Y);if(J)return J;try{let Q=pO($);if(!await f0(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=sO(Y,Z.preset),K=Y.outputDir||"dist/images",W=Y.baseUrl||"/images";await nO(K,{recursive:!0});let _=await v0(Q),B=cO($,lO($)),U=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],z={src:$,processed:!0,variants:[],hash:_},q=null;if(Z.transformations&&Z.transformations.length>0)q=await i7(Q,Z.transformations,X);for(let j of U){let H=G[j]||{},O=`${B}-${_}.${j}`,F=iO(K,O);try{let L=await X.optimizeImage({input:q||Q,output:F,format:j,quality:H.quality,progressive:H.progressive});if(L){if(z.variants.push({path:F,url:`${W}/${O}`,width:L.width||0,height:L.height||0,format:j,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 ${j}: ${L}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let j=await X.generateThumbHash(Q);z.placeholder=j.dataUrl}catch(j){z.errors=z.errors||[],z.errors.push(`Failed to generate thumbhash: ${j}`)}if(Z.useDominantColor)try{let j=await X.generatePlaceholder(Q,{strategy:"dominant-color"});z.dominantColor=j.dominantColor}catch(j){z.errors=z.errors||[],z.errors.push(`Failed to extract dominant color: ${j}`)}return await w5($,Z,z,Y),z}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function EY($,Z,Y,X){let J=await MY();if(!J)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await J.optimizeImage({input:$,output:X,format:Z,quality:Y}))?.outputSize}}catch(Q){return{success:!1,error:String(Q)}}}async function i7($,Z,Y){let X=Y||await MY();if(!X)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let J=await X.decode($);for(let Q of Z){let G=Q.options||{};switch(Q.type){case"resize":if(G.width||G.height)J=await X.resize(J,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)J=await X.blur(J,G.sigma);break;case"sharpen":if(G.amount!==void 0)J=await X.sharpen(J,G.amount);break;case"grayscale":J=await X.grayscale(J);break;case"rotate":if(G.angle!==void 0)J=await X.rotate(J,G.angle);break;case"flip":J=await X.flip(J);break;case"flop":J=await X.flop(J);break;case"brightness":if(G.value!==void 0)J=await X.brightness(J,G.value);break;case"contrast":if(G.value!==void 0)J=await X.contrast(J,G.value);break;case"saturation":if(G.value!==void 0)J=await X.saturation(J,G.value);break}}return await X.encode(J,"png")}catch(J){return console.error(`[stx-media] Transformation failed: ${J}`),null}}var AG=D(()=>{G$();RY()});import{resolve as rO,basename as oO,extname as aO,join as tO}from"path";import{mkdir as eO}from"fs/promises";async function $L(){try{return await import("ts-images")}catch{return null}}async function r6($,Z,Y){let X=await $L();if(!X)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let J=rO($);if(!await f0(J))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let Q=Z.responsiveWidths||Y.breakpoints||ZL,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",W=Y.baseUrl||"/images";await eO(K,{recursive:!0});let _=await v0(J),B=oO($,aO($)),U=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},z={src:$,byFormat:{},srcsets:{}};for(let j of G){z.byFormat[j]=[];let H=[];for(let O of Q){let F=`${B}-${O}w-${_}.${j}`,L=tO(K,F),V=`${W}/${F}`;try{let A=U[j]?.quality||80;if(await f0(L)){z.byFormat[j].push({path:L,url:V,width:O,height:0,format:j,size:0}),H.push(`${V} ${O}w`);continue}let N=await X.processImage({input:J,output:L,format:j,quality:A,resize:{width:O}});if(N)z.byFormat[j].push({path:L,url:V,width:O,height:N.height||Math.round(O*(N.height||1)/(N.width||1)),format:j,size:N.outputSize||0}),H.push(`${V} ${O}w`)}catch(A){console.warn(`[stx-media] Failed to generate ${j} at ${O}w: ${A}`)}}z.srcsets[j]=H.join(", ")}let q=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(q!=="none")try{if(q==="thumbhash"){let j=await X.generateThumbHash(J);z.placeholder={dataURL:j.dataUrl,width:j.width||32,height:j.height||32,strategy:"thumbhash"}}else{let j=await X.generatePlaceholder(J,{strategy:q,width:20});z.placeholder={dataURL:j.dataURL,width:j.width,height:j.height,strategy:q}}}catch(j){console.warn(`[stx-media] Failed to generate placeholder: ${j}`)}return z.sizes=Z.sizes||YL(Q),z}catch(Q){return console.error(`[stx-media] Responsive generation failed: ${Q}`),null}}function YL($){let Z=[...$].sort((X,J)=>X-J),Y=[];for(let X=0;X<Z.length-1;X++){let J=Z[X];Y.push(`(max-width: ${J}px) ${J}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function o6($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return $.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}var ZL;var wG=D(()=>{G$();ZL=[320,480,640,768,1024,1280,1536,1920]});var RG={};Q0(RG,{setCachedImageResult:()=>w5,processImage:()=>TY,optimizeImage:()=>EY,getCachedImageResult:()=>A5,generateSrcset:()=>o6,generateResponsiveVariants:()=>r6,clearImageCache:()=>wY,applyTransformations:()=>i7,ImageProcessorCache:()=>N5});var IY=D(()=>{AG();wG();RY()});async function XL(){try{return await Promise.resolve().then(() => (IY(),RG))}catch($){if(!MG)console.warn("[stx-media] Image processor not available, some features disabled:",$),MG=!0;return null}}async function W$($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return KL(X,Y)}if(Y.processedResult?.processed)return CY($,Y.processedResult,Z);if(Y.responsiveVariants)return DG($,Y.responsiveVariants,Z);let{src:J,alt:Q,width:G,height:K,sizes:W,widths:_=R1,dpr:B,formats:U=m1,quality:z=DY,params:q={},placeholder:j="none",placeholderOptions:H={},lazy:O=!0,priority:F=!1,loading:L=F?"eager":t6,decoding:V=a6,fetchpriority:A,objectFit:N,objectPosition:w,crossorigin:M,referrerpolicy:T}=$,I=$.class,E=$.style,S=$.id,k=$.data||{},{isDev:b=!1,baseUrl:P=""}=Z;if(b&&!Z.optimize)return GL($);let x,C,f=S||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!F)try{x=await p7(J,{strategy:j,...H}),C=m7(f,x,H)}catch{}let g=B!==void 0&&G!==void 0,h;if(g)h=QL($,f,x,Z);else h=await JL($,f,x,Z);let l;if(F){let W0=U.includes("webp")?"webp":U[0],D0=Q$(J,_,{...q,q:z},W0),M0=typeof W==="object"?z5(W):W||"100vw";l=`<link rel="preload" as="image" imagesrcset="${D0}" imagesizes="${M0}" />`}let i=[];if(!TG&&j!=="none")i.push(j5),TG=!0;if(C)i.push(C);let Y0=O?IG(f):void 0;return{html:h,preloadLink:l,css:i.length>0?i.join(`
1165
- `):void 0,script:Y0}}async function JL($,Z,Y,X){let{src:J,alt:Q,width:G,height:K,sizes:W,widths:_=R1,formats:B=m1,quality:U=DY,params:z={},lazy:q=!0,priority:j=!1,loading:H=j?"eager":t6,decoding:O=a6,fetchpriority:F,objectFit:L,objectPosition:V,crossorigin:A,referrerpolicy:N}=$,w=$.class,M=$.style,T=$.data||{},I=typeof W==="object"?z5(W):W||"100vw",E=[];for(let b of B){let P=Q$(J,_,{...z,q:U},b),x=d7(b);if(q&&!j)E.push(` <source type="${x}" data-srcset="${P}" data-sizes="${I}" />`);else E.push(` <source type="${x}" srcset="${P}" sizes="${I}" />`)}let S=kY({src:j1(J,{...z,q:U}),alt:Q,width:G,height:K,loading:j?void 0:H,decoding:O,fetchpriority:j?"high":F,objectFit:L,objectPosition:V,crossorigin:A,referrerpolicy:N,className:EG(w,Y),style:SY(M,L,V,Y),lazy:q&&!j,data:T}),k;if(Y){let b=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;k=`<div id="${Z}" class="stx-img-placeholder" style="${b}">
1164
+ `.trim();q5=new Map});import{createHash as FY}from"crypto";import{readFile as vO,stat as zG}from"fs/promises";async function v0($){try{let Z=await vO($);return FY("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function qG($){return FY("sha256").update($).digest("hex").slice(0,16)}function i6($){return FY("sha256").update($).digest("hex").slice(0,16)}function H5($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${i6($)}-${i6(Y)}`}async function c7($){try{return(await zG($)).mtimeMs}catch{return 0}}async function f0($){try{return await zG($),!0}catch{return!1}}var K$=()=>{};import{mkdir as fO,readFile as HG,writeFile as gO,readdir as OG,rm as VY,stat as hO}from"fs/promises";import{join as O5,dirname as dO}from"path";async function uO($){try{await fO($,{recursive:!0})}catch{}}function LG($,Z,Y){return O5($,Y,`${Z}.json`)}async function jG($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await c7(Z)!==$.srcMtime)return!1;return!0}async function L5($,Z,Y,X=l7){if(!X.enabled)return null;let J=H5($,Z),Q=W$.get(J);if(Q){if(await jG(Q,$,X.maxAge))return Q.lastAccessedAt=Date.now(),Q.data;W$.delete(J)}let G=LG(X.directory,J,Y);if(await f0(G))try{let K=await HG(G,"utf-8"),W=JSON.parse(K);if(await jG(W,$,X.maxAge))return W.lastAccessedAt=Date.now(),W$.set(J,W),W.data}catch{}return null}async function F5($,Z,Y,X,J=l7){if(!J.enabled)return;let Q=H5($,Z),G=await v0($),K=await c7($),W={key:Q,src:$,srcHash:G,srcMtime:K,optionsHash:H5("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};W$.set(Q,W);let _=LG(J.directory,Q,X);try{await uO(dO(_)),await gO(_,JSON.stringify(W,null,2))}catch(B){console.warn(`[stx-media] Failed to write cache: ${B}`)}}async function V5($,Z=l7){if($==="all")W$.clear();else W$.clear();let Y=$==="all"?["image","video"]:[$];for(let X of Y){let J=O5(Z.directory,X);try{await VY(J,{recursive:!0,force:!0})}catch{}}}async function FG($=l7){let Z={memoryEntries:W$.size,diskEntries:{image:0,video:0},totalSizeMB:0};for(let Y of["image","video"]){let X=O5($.directory,Y);try{let J=await OG(X);Z.diskEntries[Y]=J.length;for(let Q of J){let G=O5(X,Q),K=await hO(G);Z.totalSizeMB+=K.size/1048576}}catch{}}return Z}async function VG($=l7){let Z=0,Y=$.maxAge*24*60*60*1000;for(let X of["image","video"]){let J=O5($.directory,X);try{let Q=await OG(J);for(let G of Q){let K=O5(J,G);try{let W=await HG(K,"utf-8"),_=JSON.parse(W);if(Date.now()-_.createdAt>Y)await VY(K),W$.delete(_.key),Z++}catch{await VY(K).catch(()=>{}),Z++}}}catch{}}return Z}var W$,l7;var n6=D(()=>{K$();W$=new Map,l7={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class N5{config;constructor($={}){this.config={...mO,...$}}async get($,Z){return L5($,Z,"image",this.config)}async set($,Z,Y){return F5($,Z,Y,"image",this.config)}async clear(){return V5("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function NY($){if(!s6)s6=new N5($);else if($)s6.updateConfig($);return s6}async function A5($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return NY(X).get($,Z)}async function w5($,Z,Y,X){let J=X?{directory:`${X.outputDir}/../.cache`}:{};return NY(J).set($,Z,Y)}async function AY(){return NY().clear()}var mO,s6=null;var wY=D(()=>{n6();mO={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as pO,basename as cO,extname as lO,join as iO}from"path";import{mkdir as nO}from"fs/promises";async function RY(){try{return await import("ts-images")}catch{return null}}function NG($){switch($){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function sO($,Z){let Y=Z?NG(Z):NG("web"),X=$.formatQuality||{};return{jpeg:{...Y.jpeg,...X.jpeg},png:{...Y.png,...X.png},webp:{...Y.webp,...X.webp},avif:{...Y.avif,...X.avif}}}async function MY($,Z,Y){let X=await RY();if(!X)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let J=await A5($,Z,Y);if(J)return J;try{let Q=pO($);if(!await f0(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=sO(Y,Z.preset),K=Y.outputDir||"dist/images",W=Y.baseUrl||"/images";await nO(K,{recursive:!0});let _=await v0(Q),B=cO($,lO($)),U=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],z={src:$,processed:!0,variants:[],hash:_},q=null;if(Z.transformations&&Z.transformations.length>0)q=await i7(Q,Z.transformations,X);for(let j of U){let H=G[j]||{},O=`${B}-${_}.${j}`,F=iO(K,O);try{let L=await X.optimizeImage({input:q||Q,output:F,format:j,quality:H.quality,progressive:H.progressive});if(L){if(z.variants.push({path:F,url:`${W}/${O}`,width:L.width||0,height:L.height||0,format:j,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 ${j}: ${L}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let j=await X.generateThumbHash(Q);z.placeholder=j.dataUrl}catch(j){z.errors=z.errors||[],z.errors.push(`Failed to generate thumbhash: ${j}`)}if(Z.useDominantColor)try{let j=await X.generatePlaceholder(Q,{strategy:"dominant-color"});z.dominantColor=j.dominantColor}catch(j){z.errors=z.errors||[],z.errors.push(`Failed to extract dominant color: ${j}`)}return await w5($,Z,z,Y),z}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function TY($,Z,Y,X){let J=await RY();if(!J)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await J.optimizeImage({input:$,output:X,format:Z,quality:Y}))?.outputSize}}catch(Q){return{success:!1,error:String(Q)}}}async function i7($,Z,Y){let X=Y||await RY();if(!X)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let J=await X.decode($);for(let Q of Z){let G=Q.options||{};switch(Q.type){case"resize":if(G.width||G.height)J=await X.resize(J,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)J=await X.blur(J,G.sigma);break;case"sharpen":if(G.amount!==void 0)J=await X.sharpen(J,G.amount);break;case"grayscale":J=await X.grayscale(J);break;case"rotate":if(G.angle!==void 0)J=await X.rotate(J,G.angle);break;case"flip":J=await X.flip(J);break;case"flop":J=await X.flop(J);break;case"brightness":if(G.value!==void 0)J=await X.brightness(J,G.value);break;case"contrast":if(G.value!==void 0)J=await X.contrast(J,G.value);break;case"saturation":if(G.value!==void 0)J=await X.saturation(J,G.value);break}}return await X.encode(J,"png")}catch(J){return console.error(`[stx-media] Transformation failed: ${J}`),null}}var AG=D(()=>{K$();wY()});import{resolve as rO,basename as oO,extname as aO,join as tO}from"path";import{mkdir as eO}from"fs/promises";async function $L(){try{return await import("ts-images")}catch{return null}}async function r6($,Z,Y){let X=await $L();if(!X)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let J=rO($);if(!await f0(J))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let Q=Z.responsiveWidths||Y.breakpoints||ZL,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",W=Y.baseUrl||"/images";await eO(K,{recursive:!0});let _=await v0(J),B=oO($,aO($)),U=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},z={src:$,byFormat:{},srcsets:{}};for(let j of G){z.byFormat[j]=[];let H=[];for(let O of Q){let F=`${B}-${O}w-${_}.${j}`,L=tO(K,F),V=`${W}/${F}`;try{let A=U[j]?.quality||80;if(await f0(L)){z.byFormat[j].push({path:L,url:V,width:O,height:0,format:j,size:0}),H.push(`${V} ${O}w`);continue}let N=await X.processImage({input:J,output:L,format:j,quality:A,resize:{width:O}});if(N)z.byFormat[j].push({path:L,url:V,width:O,height:N.height||Math.round(O*(N.height||1)/(N.width||1)),format:j,size:N.outputSize||0}),H.push(`${V} ${O}w`)}catch(A){console.warn(`[stx-media] Failed to generate ${j} at ${O}w: ${A}`)}}z.srcsets[j]=H.join(", ")}let q=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(q!=="none")try{if(q==="thumbhash"){let j=await X.generateThumbHash(J);z.placeholder={dataURL:j.dataUrl,width:j.width||32,height:j.height||32,strategy:"thumbhash"}}else{let j=await X.generatePlaceholder(J,{strategy:q,width:20});z.placeholder={dataURL:j.dataURL,width:j.width,height:j.height,strategy:q}}}catch(j){console.warn(`[stx-media] Failed to generate placeholder: ${j}`)}return z.sizes=Z.sizes||YL(Q),z}catch(Q){return console.error(`[stx-media] Responsive generation failed: ${Q}`),null}}function YL($){let Z=[...$].sort((X,J)=>X-J),Y=[];for(let X=0;X<Z.length-1;X++){let J=Z[X];Y.push(`(max-width: ${J}px) ${J}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function o6($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return $.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}var ZL;var wG=D(()=>{K$();ZL=[320,480,640,768,1024,1280,1536,1920]});var RG={};Q0(RG,{setCachedImageResult:()=>w5,processImage:()=>MY,optimizeImage:()=>TY,getCachedImageResult:()=>A5,generateSrcset:()=>o6,generateResponsiveVariants:()=>r6,clearImageCache:()=>AY,applyTransformations:()=>i7,ImageProcessorCache:()=>N5});var EY=D(()=>{AG();wG();wY()});async function XL(){try{return await Promise.resolve().then(() => (EY(),RG))}catch($){if(!MG)console.warn("[stx-media] Image processor not available, some features disabled:",$),MG=!0;return null}}async function _$($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return KL(X,Y)}if(Y.processedResult?.processed)return bY($,Y.processedResult,Z);if(Y.responsiveVariants)return DG($,Y.responsiveVariants,Z);let{src:J,alt:Q,width:G,height:K,sizes:W,widths:_=R1,dpr:B,formats:U=m1,quality:z=IY,params:q={},placeholder:j="none",placeholderOptions:H={},lazy:O=!0,priority:F=!1,loading:L=F?"eager":t6,decoding:V=a6,fetchpriority:A,objectFit:N,objectPosition:w,crossorigin:M,referrerpolicy:T}=$,I=$.class,E=$.style,S=$.id,k=$.data||{},{isDev:b=!1,baseUrl:P=""}=Z;if(b&&!Z.optimize)return GL($);let x,C,f=S||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!F)try{x=await p7(J,{strategy:j,...H}),C=m7(f,x,H)}catch{}let g=B!==void 0&&G!==void 0,h;if(g)h=QL($,f,x,Z);else h=await JL($,f,x,Z);let l;if(F){let W0=U.includes("webp")?"webp":U[0],D0=G$(J,_,{...q,q:z},W0),M0=typeof W==="object"?z5(W):W||"100vw";l=`<link rel="preload" as="image" imagesrcset="${D0}" imagesizes="${M0}" />`}let i=[];if(!TG&&j!=="none")i.push(j5),TG=!0;if(C)i.push(C);let Y0=O?IG(f):void 0;return{html:h,preloadLink:l,css:i.length>0?i.join(`
1165
+ `):void 0,script:Y0}}async function JL($,Z,Y,X){let{src:J,alt:Q,width:G,height:K,sizes:W,widths:_=R1,formats:B=m1,quality:U=IY,params:z={},lazy:q=!0,priority:j=!1,loading:H=j?"eager":t6,decoding:O=a6,fetchpriority:F,objectFit:L,objectPosition:V,crossorigin:A,referrerpolicy:N}=$,w=$.class,M=$.style,T=$.data||{},I=typeof W==="object"?z5(W):W||"100vw",E=[];for(let b of B){let P=G$(J,_,{...z,q:U},b),x=d7(b);if(q&&!j)E.push(` <source type="${x}" data-srcset="${P}" data-sizes="${I}" />`);else E.push(` <source type="${x}" srcset="${P}" sizes="${I}" />`)}let S=DY({src:j1(J,{...z,q:U}),alt:Q,width:G,height:K,loading:j?void 0:H,decoding:O,fetchpriority:j?"high":F,objectFit:L,objectPosition:V,crossorigin:A,referrerpolicy:N,className:EG(w,Y),style:kY(M,L,V,Y),lazy:q&&!j,data:T}),k;if(Y){let b=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;k=`<div id="${Z}" class="stx-img-placeholder" style="${b}">
1166
1166
  <picture>
1167
1167
  ${E.join(`
1168
1168
  `)}
@@ -1172,9 +1172,9 @@ ${E.join(`
1172
1172
  ${E.join(`
1173
1173
  `)}
1174
1174
  <img ${S} />
1175
- </picture>`;return k}function QL($,Z,Y,X){let{src:J,alt:Q,width:G,height:K,dpr:W=[1,2,3],quality:_=DY,params:B={},lazy:U=!0,priority:z=!1,loading:q=z?"eager":t6,decoding:j=a6,fetchpriority:H,objectFit:O,objectPosition:F,crossorigin:L,referrerpolicy:V}=$,A=$.class,N=$.style,w=$.data||{},M=typeof G==="number"?G:Number.parseInt(String(G),10),T=U5(J,M,W,{...B,q:_}),I=kY({src:j1(J,{...B,w:M,q:_}),alt:Q,width:G,height:K,loading:z?void 0:q,decoding:j,fetchpriority:z?"high":H,objectFit:O,objectPosition:F,crossorigin:L,referrerpolicy:V,className:EG(A,Y),style:SY(N,O,F,Y),lazy:U&&!z,data:w}),E=U&&!z?`data-srcset="${T}"`:`srcset="${T}"`;if(Y){let S=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${S}">
1175
+ </picture>`;return k}function QL($,Z,Y,X){let{src:J,alt:Q,width:G,height:K,dpr:W=[1,2,3],quality:_=IY,params:B={},lazy:U=!0,priority:z=!1,loading:q=z?"eager":t6,decoding:j=a6,fetchpriority:H,objectFit:O,objectPosition:F,crossorigin:L,referrerpolicy:V}=$,A=$.class,N=$.style,w=$.data||{},M=typeof G==="number"?G:Number.parseInt(String(G),10),T=U5(J,M,W,{...B,q:_}),I=DY({src:j1(J,{...B,w:M,q:_}),alt:Q,width:G,height:K,loading:z?void 0:q,decoding:j,fetchpriority:z?"high":H,objectFit:O,objectPosition:F,crossorigin:L,referrerpolicy:V,className:EG(A,Y),style:kY(N,O,F,Y),lazy:U&&!z,data:w}),E=U&&!z?`data-srcset="${T}"`:`srcset="${T}"`;if(Y){let S=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${S}">
1176
1176
  <img ${I} ${E} />
1177
- </div>`}return`<img ${Z?`id="${Z}" `:""}${I} ${E} />`}function GL($){let{src:Z,alt:Y,width:X,height:J,loading:Q=t6,decoding:G=a6,fetchpriority:K,objectFit:W,objectPosition:_,crossorigin:B,referrerpolicy:U,priority:z=!1}=$,q=$.class,j=$.style,H=$.id,O=$.data||{};return{html:`<img ${kY({src:Z,alt:Y,width:X,height:J,loading:z?"eager":Q,decoding:G,fetchpriority:z?"high":K,objectFit:W,objectPosition:_,crossorigin:B,referrerpolicy:U,className:q,style:SY(j,W,_),id:H,data:O})} />`}}function kY($){let Z=[];if($.lazy)Z.push(`data-src="${H1($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${H1($.src)}"`);if(Z.push(`alt="${H1($.alt)}"`),$.width)Z.push(`width="${$.width}"`);if($.height)Z.push(`height="${$.height}"`);if($.loading)Z.push(`loading="${$.loading}"`);if($.decoding)Z.push(`decoding="${$.decoding}"`);if($.fetchpriority)Z.push(`fetchpriority="${$.fetchpriority}"`);if($.crossorigin)Z.push(`crossorigin="${$.crossorigin}"`);if($.referrerpolicy)Z.push(`referrerpolicy="${$.referrerpolicy}"`);if($.className)Z.push(`class="${H1($.className)}"`);if($.style)Z.push(`style="${H1($.style)}"`);if($.id)Z.push(`id="${H1($.id)}"`);if($.data)for(let[Y,X]of Object.entries($.data))Z.push(`data-${Y}="${H1(X)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function EG($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function SY($,Z,Y,X){let J=[];if(Z)J.push(`object-fit: ${Z}`);if(Y)J.push(`object-position: ${Y}`);if(X)J.push("opacity: 0; transition: opacity 300ms ease-out");if($)J.push($);return J.join("; ")}function H1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function IG($){return`
1177
+ </div>`}return`<img ${Z?`id="${Z}" `:""}${I} ${E} />`}function GL($){let{src:Z,alt:Y,width:X,height:J,loading:Q=t6,decoding:G=a6,fetchpriority:K,objectFit:W,objectPosition:_,crossorigin:B,referrerpolicy:U,priority:z=!1}=$,q=$.class,j=$.style,H=$.id,O=$.data||{};return{html:`<img ${DY({src:Z,alt:Y,width:X,height:J,loading:z?"eager":Q,decoding:G,fetchpriority:z?"high":K,objectFit:W,objectPosition:_,crossorigin:B,referrerpolicy:U,className:q,style:kY(j,W,_),id:H,data:O})} />`}}function DY($){let Z=[];if($.lazy)Z.push(`data-src="${H1($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${H1($.src)}"`);if(Z.push(`alt="${H1($.alt)}"`),$.width)Z.push(`width="${$.width}"`);if($.height)Z.push(`height="${$.height}"`);if($.loading)Z.push(`loading="${$.loading}"`);if($.decoding)Z.push(`decoding="${$.decoding}"`);if($.fetchpriority)Z.push(`fetchpriority="${$.fetchpriority}"`);if($.crossorigin)Z.push(`crossorigin="${$.crossorigin}"`);if($.referrerpolicy)Z.push(`referrerpolicy="${$.referrerpolicy}"`);if($.className)Z.push(`class="${H1($.className)}"`);if($.style)Z.push(`style="${H1($.style)}"`);if($.id)Z.push(`id="${H1($.id)}"`);if($.data)for(let[Y,X]of Object.entries($.data))Z.push(`data-${Y}="${H1(X)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function EG($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function kY($,Z,Y,X){let J=[];if(Z)J.push(`object-fit: ${Z}`);if(Y)J.push(`object-position: ${Y}`);if(X)J.push("opacity: 0; transition: opacity 300ms ease-out");if($)J.push($);return J.join("; ")}function H1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function IG($){return`
1178
1178
  (function() {
1179
1179
  const container = document.getElementById('${$}');
1180
1180
  if (!container) return;
@@ -1211,7 +1211,7 @@ ${E.join(`
1211
1211
 
1212
1212
  observer.observe(container);
1213
1213
  })();
1214
- `.trim()}function e6($){let Z=$.match(/<Img\s+([^>]*?)\/?>/);if(!Z)return null;let Y=Z[1],X={},J=/(:?)(\w+)(?:=(?:"([^"]*)"|'([^']*)'|\{([^}]+)\}))?/g,Q;while((Q=J.exec(Y))!==null){let[,G,K,W,_,B]=Q,U=W??_??B??!0;if(G===":"&&typeof U==="string")try{X[K]=JSON.parse(U)}catch{X[K]=U}else switch(K){case"src":X.src=String(U);break;case"alt":X.alt=String(U);break;case"width":X.width=Number(U)||U;break;case"height":X.height=Number(U)||U;break;case"sizes":X.sizes=String(U);break;case"quality":X.quality=Number(U);break;case"placeholder":X.placeholder=U;break;case"lazy":X.lazy=U===!0||U==="true";break;case"priority":X.priority=U===!0||U==="true";break;case"class":X.class=String(U);break;case"style":X.style=String(U);break;case"id":X.id=String(U);break;case"loading":X.loading=U;break;case"decoding":X.decoding=U;break;case"fetchpriority":X.fetchpriority=U;break;case"objectFit":X.objectFit=U;break;case"objectPosition":X.objectPosition=String(U);break;case"crossorigin":X.crossorigin=U;break}}if(!X.src||!X.alt)return null;return X}async function bY($,Z={}){let Y=/<Img\s+[^>]*?\/?>/g,X=[],J=[],Q=[],G=$,K=[],W;while((W=Y.exec($))!==null)K.push({match:W[0],index:W.index});for(let _=K.length-1;_>=0;_--){let{match:B}=K[_],U=e6(B);if(U){let z=await W$(U,Z);if(G=G.replace(B,z.html),z.preloadLink)X.push(z.preloadLink);if(z.css)J.push(z.css);if(z.script)Q.push(z.script)}}return{html:G,preloadLinks:X,styles:J,scripts:Q}}async function KL($,Z){let Y=await XL();if(!Y)return W$({...$,process:!1},Z);let X=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let Q=await Y.generateResponsiveVariants($.src,$,X);if(Q)return DG($,Q,Z)}else{let Q=await Y.processImage($.src,$,X);if(Q.processed)return CY($,Q,Z)}return W$({...$,process:!1},Z)}async function CY($,Z,Y){let{alt:X,width:J,height:Q,lazy:G=!0,priority:K=!1,objectFit:W,objectPosition:_,crossorigin:B,referrerpolicy:U}=$,z=$.class,q=$.style,j=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=$.data||{},O=Z.variants||[],F=O.find((C)=>C.format==="jpeg")||O.find((C)=>C.format==="webp")||O[0],L=F?.url||$.src,V=O.filter((C)=>C.format===(F?.format||"jpeg")).map((C)=>`${C.url} ${C.width}w`).join(", "),A=new Map;for(let C of O){if(!A.has(C.format))A.set(C.format,[]);A.get(C.format).push(C)}let N=[],w=["avif","webp","jpeg","png"];for(let C of w){let f=A.get(C);if(f&&f.length>0){let g=f.map((l)=>`${l.url} ${l.width}w`).join(", "),h=d7(C);if(G&&!K)N.push(` <source type="${h}" data-srcset="${g}" />`);else N.push(` <source type="${h}" srcset="${g}" />`)}}let M=[];if(G&&!K){if(M.push(`data-src="${H1(L)}"`),M.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)M.push(`data-srcset="${V}"`)}else if(M.push(`src="${H1(L)}"`),V)M.push(`srcset="${V}"`);M.push(`alt="${H1(X)}"`);let T=J||Z.originalWidth,I=Q||Z.originalHeight;if(T)M.push(`width="${T}"`);if(I)M.push(`height="${I}"`);if(!K)M.push(`loading="${G?"lazy":"eager"}"`);if(M.push('decoding="async"'),K)M.push('fetchpriority="high"');if(B)M.push(`crossorigin="${B}"`);if(U)M.push(`referrerpolicy="${U}"`);let E=[];if(W)E.push(`object-fit: ${W}`);if(_)E.push(`object-position: ${_}`);if(Z.placeholder&&G)E.push("opacity: 0; transition: opacity 300ms ease-out");if(q)E.push(q);if(E.length>0)M.push(`style="${E.join("; ")}"`);let S=[];if(z)S.push(z);if(Z.placeholder)S.push("stx-img-blur");if(S.length>0)M.push(`class="${S.join(" ")}"`);if(G&&!K)M.push("data-stx-lazy");for(let[C,f]of Object.entries(H))M.push(`data-${C}="${H1(f)}"`);let k;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let C=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;k=`<div id="${j}" class="stx-img-placeholder" style="${C}">
1214
+ `.trim()}function e6($){let Z=$.match(/<Img\s+([^>]*?)\/?>/);if(!Z)return null;let Y=Z[1],X={},J=/(:?)(\w+)(?:=(?:"([^"]*)"|'([^']*)'|\{([^}]+)\}))?/g,Q;while((Q=J.exec(Y))!==null){let[,G,K,W,_,B]=Q,U=W??_??B??!0;if(G===":"&&typeof U==="string")try{X[K]=JSON.parse(U)}catch{X[K]=U}else switch(K){case"src":X.src=String(U);break;case"alt":X.alt=String(U);break;case"width":X.width=Number(U)||U;break;case"height":X.height=Number(U)||U;break;case"sizes":X.sizes=String(U);break;case"quality":X.quality=Number(U);break;case"placeholder":X.placeholder=U;break;case"lazy":X.lazy=U===!0||U==="true";break;case"priority":X.priority=U===!0||U==="true";break;case"class":X.class=String(U);break;case"style":X.style=String(U);break;case"id":X.id=String(U);break;case"loading":X.loading=U;break;case"decoding":X.decoding=U;break;case"fetchpriority":X.fetchpriority=U;break;case"objectFit":X.objectFit=U;break;case"objectPosition":X.objectPosition=String(U);break;case"crossorigin":X.crossorigin=U;break}}if(!X.src||!X.alt)return null;return X}async function SY($,Z={}){let Y=/<Img\s+[^>]*?\/?>/g,X=[],J=[],Q=[],G=$,K=[],W;while((W=Y.exec($))!==null)K.push({match:W[0],index:W.index});for(let _=K.length-1;_>=0;_--){let{match:B}=K[_],U=e6(B);if(U){let z=await _$(U,Z);if(G=G.replace(B,z.html),z.preloadLink)X.push(z.preloadLink);if(z.css)J.push(z.css);if(z.script)Q.push(z.script)}}return{html:G,preloadLinks:X,styles:J,scripts:Q}}async function KL($,Z){let Y=await XL();if(!Y)return _$({...$,process:!1},Z);let X=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let Q=await Y.generateResponsiveVariants($.src,$,X);if(Q)return DG($,Q,Z)}else{let Q=await Y.processImage($.src,$,X);if(Q.processed)return bY($,Q,Z)}return _$({...$,process:!1},Z)}async function bY($,Z,Y){let{alt:X,width:J,height:Q,lazy:G=!0,priority:K=!1,objectFit:W,objectPosition:_,crossorigin:B,referrerpolicy:U}=$,z=$.class,q=$.style,j=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=$.data||{},O=Z.variants||[],F=O.find((C)=>C.format==="jpeg")||O.find((C)=>C.format==="webp")||O[0],L=F?.url||$.src,V=O.filter((C)=>C.format===(F?.format||"jpeg")).map((C)=>`${C.url} ${C.width}w`).join(", "),A=new Map;for(let C of O){if(!A.has(C.format))A.set(C.format,[]);A.get(C.format).push(C)}let N=[],w=["avif","webp","jpeg","png"];for(let C of w){let f=A.get(C);if(f&&f.length>0){let g=f.map((l)=>`${l.url} ${l.width}w`).join(", "),h=d7(C);if(G&&!K)N.push(` <source type="${h}" data-srcset="${g}" />`);else N.push(` <source type="${h}" srcset="${g}" />`)}}let M=[];if(G&&!K){if(M.push(`data-src="${H1(L)}"`),M.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)M.push(`data-srcset="${V}"`)}else if(M.push(`src="${H1(L)}"`),V)M.push(`srcset="${V}"`);M.push(`alt="${H1(X)}"`);let T=J||Z.originalWidth,I=Q||Z.originalHeight;if(T)M.push(`width="${T}"`);if(I)M.push(`height="${I}"`);if(!K)M.push(`loading="${G?"lazy":"eager"}"`);if(M.push('decoding="async"'),K)M.push('fetchpriority="high"');if(B)M.push(`crossorigin="${B}"`);if(U)M.push(`referrerpolicy="${U}"`);let E=[];if(W)E.push(`object-fit: ${W}`);if(_)E.push(`object-position: ${_}`);if(Z.placeholder&&G)E.push("opacity: 0; transition: opacity 300ms ease-out");if(q)E.push(q);if(E.length>0)M.push(`style="${E.join("; ")}"`);let S=[];if(z)S.push(z);if(Z.placeholder)S.push("stx-img-blur");if(S.length>0)M.push(`class="${S.join(" ")}"`);if(G&&!K)M.push("data-stx-lazy");for(let[C,f]of Object.entries(H))M.push(`data-${C}="${H1(f)}"`);let k;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let C=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;k=`<div id="${j}" class="stx-img-placeholder" style="${C}">
1215
1215
  <picture>
1216
1216
  ${N.join(`
1217
1217
  `)}
@@ -1222,10 +1222,10 @@ ${N.join(`
1222
1222
  `)}
1223
1223
  <img ${M.join(" ")} />
1224
1224
  </picture>`;let b=[];if(Z.placeholder)b.push(j5);let P=G?IG(j):void 0,x;if(K&&V)x=`<link rel="preload" as="image" imagesrcset="${V}" />`;return{html:k,preloadLink:x,css:b.length>0?b.join(`
1225
- `):void 0,script:P}}async function DG($,Z,Y){let X={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[J,Q]of Object.entries(Z.byFormat))if(Q)X.variants.push(...Q);return CY($,X,Y)}var MG=!1,DY=80,a6="async",t6="lazy",TG=!1;var yY=D(()=>{c6();FY()});function $3(){return T0({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,Y,X)=>{let{src:J,alt:Q,options:G}=WL($,Z,Y);if(!J)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:J,alt:Q||"",widths:G.widths||R1,formats:G.formats||m1,quality:G.quality,sizes:G.sizes,dpr:G.dpr,params:G.params,placeholder:G.placeholder,placeholderOptions:G.placeholderOptions,lazy:G.lazy!==!1,priority:G.priority||!1,loading:G.loading,decoding:G.decoding,fetchpriority:G.fetchpriority,objectFit:G.objectFit,objectPosition:G.objectPosition,class:G.class,style:G.style,id:G.id,width:G.width,height:G.height},W=Y.__isDev||!1,_=await W$(K,{isDev:W}),B=_.html;if(_.preloadLink)B=_.preloadLink+`
1225
+ `):void 0,script:P}}async function DG($,Z,Y){let X={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[J,Q]of Object.entries(Z.byFormat))if(Q)X.variants.push(...Q);return bY($,X,Y)}var MG=!1,IY=80,a6="async",t6="lazy",TG=!1;var CY=D(()=>{c6();LY()});function $3(){return T0({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,Y,X)=>{let{src:J,alt:Q,options:G}=WL($,Z,Y);if(!J)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:J,alt:Q||"",widths:G.widths||R1,formats:G.formats||m1,quality:G.quality,sizes:G.sizes,dpr:G.dpr,params:G.params,placeholder:G.placeholder,placeholderOptions:G.placeholderOptions,lazy:G.lazy!==!1,priority:G.priority||!1,loading:G.loading,decoding:G.decoding,fetchpriority:G.fetchpriority,objectFit:G.objectFit,objectPosition:G.objectPosition,class:G.class,style:G.style,id:G.id,width:G.width,height:G.height},W=Y.__isDev||!1,_=await _$(K,{isDev:W}),B=_.html;if(_.preloadLink)B=_.preloadLink+`
1226
1226
  `+B;if(_.css)B+=`
1227
1227
  <style>${_.css}</style>`;if(_.script)B+=`
1228
- <script>${_.script}</script>`;return B},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function WL($,Z,Y){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let X=$.trim();if(X.startsWith("@img(")||X.startsWith("("))X=X.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=_L(X),Q=PY(J[0],Y)||"",G=PY(J[1],Y)||"",K={};if(J[2]){let W=PY(J[2],Y);if(typeof W==="object"&&W!==null)K=W;else if(typeof J[2]==="string")try{K=JSON.parse(J[2])}catch{}}return{src:Q,alt:G,options:K}}function _L($){let Z=[],Y="",X=!1,J="",Q=0,G=0;for(let K=0;K<$.length;K++){let W=$[K],_=K>0?$[K-1]:"";if((W==='"'||W==="'"||W==="`")&&_!=="\\"){if(!X)X=!0,J=W;else if(W===J)X=!1,J="";else Y+=W;continue}if(!X){if(W==="{")Q++;if(W==="}")Q--;if(W==="[")G++;if(W==="]")G--;if(W===","&&Q===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=W}if(Y.trim())Z.push(Y.trim());return Z}function PY($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let X=Z[Y];if(X!==void 0)return X}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var n7;var xY=D(()=>{E7();yY();c6();n7=$3()});class R5{config;constructor($={}){this.config={...BL,...$}}async get($,Z){return L5($,Z,"video",this.config)}async set($,Z,Y){return F5($,Z,Y,"video",this.config)}async clear(){return V5("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function vY($){if(!Z3)Z3=new R5($);else if($)Z3.updateConfig($);return Z3}async function M5($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return vY(X).get($,Z)}async function T5($,Z,Y,X){let J=X?{directory:`${X.outputDir}/../.cache`}:{};return vY(J).set($,Z,Y)}async function Y3(){return vY().clear()}var BL,Z3=null;var fY=D(()=>{n6();BL={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as gY,basename as hY,extname as dY,join as X3}from"path";import{mkdir as uY}from"fs/promises";async function mY(){try{return await import("ts-videos")}catch{return null}}async function E5($,Z,Y,X){let J=await mY();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let Q=gY($);if(!await f0(Q))return null;await uY(Y,{recursive:!0});let G=await v0(Q),K=hY($,dY($)),W=Z.format||"webp",_=Z.timestamp||0,B=`${K}-poster-${G}.${W}`,U=X3(Y,B),z=await J.extractThumbnails(Q,{timestamps:[_],width:Z.width||1280,height:Z.height,format:W,quality:Z.quality||85,outputDir:Y,outputPattern:B.replace(`.${W}`,"")});if(z&&z.length>0){let q=z[0];return{path:U,url:`${X}/${B}`,width:q.width||Z.width||1280,height:q.height||720,timestamp:_,size:q.size||0}}return null}catch(Q){return console.warn(`[stx-media] Failed to generate poster: ${Q}`),null}}async function I5($,Z,Y,X){let J=await mY();if(!J)return[];try{let Q=gY($);if(!await f0(Q))return[];await uY(Y,{recursive:!0});let G=await v0(Q),K=hY($,dY($)),W=Z.format||"webp",U=(await new J.Input(Q).getInfo()).duration||60,z=Z.count||10,q=Z.interval||U/z,j=[];for(let O=0;O<z&&O*q<U;O++)j.push(O*q);let H=await J.extractThumbnails(Q,{timestamps:j,width:Z.width||320,format:W,quality:Z.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${G}`});if(H&&H.length>0)return H.map((O,F)=>({path:O.path||X3(Y,`${K}-thumb-${G}-${F}.${W}`),url:`${X}/${K}-thumb-${G}-${F}.${W}`,width:O.width||Z.width||320,height:O.height||180,timestamp:j[F],size:O.size||0}));return[]}catch(Q){return console.warn(`[stx-media] Failed to generate thumbnails: ${Q}`),[]}}async function J3($,Z,Y,X){let J=await mY();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let Q=gY($);if(!await f0(Q))return null;await uY(Y,{recursive:!0});let G=await v0(Q),K=hY($,dY($)),B=(await new J.Input(Q).getInfo()).duration||60,U=Z.columns||10,z=Z.interval||5,q=Z.thumbnailWidth||160,j=Z.thumbnailHeight||90,H=Z.format||"jpeg",O=Math.ceil(B/z),F=Math.ceil(O/U),L=`${K}-sprite-${G}.${H}`,V=X3(Y,L),A=[];for(let w=0;w<O;w++)A.push(w*z);let N=await J.extractThumbnails(Q,{timestamps:A,width:q,height:j,format:H,quality:Z.quality||70,outputDir:X3(Y,".temp")});if(!N||N.length===0)return null;try{let w=await import("ts-images"),M=U*q,T=F*j,I=await w.createSprite({images:N.map((E)=>E.path),columns:U,padding:0,outputPath:V,format:H,quality:Z.quality||70});return{url:`${X}/${L}`,path:V,columns:U,rows:F,thumbnailWidth:q,thumbnailHeight:j,interval:z,totalFrames:O}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(Q){return console.warn(`[stx-media] Failed to generate sprite sheet: ${Q}`),null}}var pY=D(()=>{G$()});import{resolve as SG,basename as bG,extname as CG,join as h$}from"path";import{mkdir as Q3,writeFile as yG}from"fs/promises";async function PG(){try{return await import("ts-videos")}catch{return null}}async function D5($,Z,Y,X,J){let Q=await PG();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=SG($);if(!await f0(G))return null;let K=await v0(G),W=bG($,CG($)),_=h$(Y,`${W}-${K}-hls`);await Q3(_,{recursive:!0});let B=Z.length>0?Z:xG,U=J?.segmentDuration||6,j=(await new Q.Input(G).getInfo()).duration||0,H=[],O=0;for(let V of B){let A=h$(_,V.label);await Q3(A,{recursive:!0});let N=`${V.label}.m3u8`,w=h$(A,N);try{let M=await Q.generateHLS(G,{outputDir:A,segmentDuration:U,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(M)H.push({quality:V,url:`${X}/${W}-${K}-hls/${V.label}/${N}`,path:w}),O+=M.segmentCount||Math.ceil(j/U)}catch(M){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${M}`)}}if(H.length===0)return null;let F=h$(_,"master.m3u8"),L=UL(H,X,W,K);return await yG(F,L),{manifestUrl:`${X}/${W}-${K}-hls/master.m3u8`,manifestPath:F,playlists:H,segmentCount:O,duration:j}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function UL($,Z,Y,X){let J=["#EXTM3U","#EXT-X-VERSION:3"];for(let Q of $){let{quality:G}=Q,K=G.bitrate+(G.audioBitrate||128000),W=`${G.width}x${G.height||Math.round(G.width*9/16)}`;J.push(`#EXT-X-STREAM-INF:BANDWIDTH=${K},RESOLUTION=${W},NAME="${G.label}"`,`${G.label}/${G.label}.m3u8`)}return J.join(`
1228
+ <script>${_.script}</script>`;return B},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function WL($,Z,Y){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let X=$.trim();if(X.startsWith("@img(")||X.startsWith("("))X=X.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=_L(X),Q=yY(J[0],Y)||"",G=yY(J[1],Y)||"",K={};if(J[2]){let W=yY(J[2],Y);if(typeof W==="object"&&W!==null)K=W;else if(typeof J[2]==="string")try{K=JSON.parse(J[2])}catch{}}return{src:Q,alt:G,options:K}}function _L($){let Z=[],Y="",X=!1,J="",Q=0,G=0;for(let K=0;K<$.length;K++){let W=$[K],_=K>0?$[K-1]:"";if((W==='"'||W==="'"||W==="`")&&_!=="\\"){if(!X)X=!0,J=W;else if(W===J)X=!1,J="";else Y+=W;continue}if(!X){if(W==="{")Q++;if(W==="}")Q--;if(W==="[")G++;if(W==="]")G--;if(W===","&&Q===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=W}if(Y.trim())Z.push(Y.trim());return Z}function yY($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let X=Z[Y];if(X!==void 0)return X}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var n7;var PY=D(()=>{E7();CY();c6();n7=$3()});class R5{config;constructor($={}){this.config={...BL,...$}}async get($,Z){return L5($,Z,"video",this.config)}async set($,Z,Y){return F5($,Z,Y,"video",this.config)}async clear(){return V5("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function xY($){if(!Z3)Z3=new R5($);else if($)Z3.updateConfig($);return Z3}async function M5($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return xY(X).get($,Z)}async function T5($,Z,Y,X){let J=X?{directory:`${X.outputDir}/../.cache`}:{};return xY(J).set($,Z,Y)}async function Y3(){return xY().clear()}var BL,Z3=null;var vY=D(()=>{n6();BL={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as fY,basename as gY,extname as hY,join as X3}from"path";import{mkdir as dY}from"fs/promises";async function uY(){try{return await import("ts-videos")}catch{return null}}async function E5($,Z,Y,X){let J=await uY();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let Q=fY($);if(!await f0(Q))return null;await dY(Y,{recursive:!0});let G=await v0(Q),K=gY($,hY($)),W=Z.format||"webp",_=Z.timestamp||0,B=`${K}-poster-${G}.${W}`,U=X3(Y,B),z=await J.extractThumbnails(Q,{timestamps:[_],width:Z.width||1280,height:Z.height,format:W,quality:Z.quality||85,outputDir:Y,outputPattern:B.replace(`.${W}`,"")});if(z&&z.length>0){let q=z[0];return{path:U,url:`${X}/${B}`,width:q.width||Z.width||1280,height:q.height||720,timestamp:_,size:q.size||0}}return null}catch(Q){return console.warn(`[stx-media] Failed to generate poster: ${Q}`),null}}async function I5($,Z,Y,X){let J=await uY();if(!J)return[];try{let Q=fY($);if(!await f0(Q))return[];await dY(Y,{recursive:!0});let G=await v0(Q),K=gY($,hY($)),W=Z.format||"webp",U=(await new J.Input(Q).getInfo()).duration||60,z=Z.count||10,q=Z.interval||U/z,j=[];for(let O=0;O<z&&O*q<U;O++)j.push(O*q);let H=await J.extractThumbnails(Q,{timestamps:j,width:Z.width||320,format:W,quality:Z.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${G}`});if(H&&H.length>0)return H.map((O,F)=>({path:O.path||X3(Y,`${K}-thumb-${G}-${F}.${W}`),url:`${X}/${K}-thumb-${G}-${F}.${W}`,width:O.width||Z.width||320,height:O.height||180,timestamp:j[F],size:O.size||0}));return[]}catch(Q){return console.warn(`[stx-media] Failed to generate thumbnails: ${Q}`),[]}}async function J3($,Z,Y,X){let J=await uY();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let Q=fY($);if(!await f0(Q))return null;await dY(Y,{recursive:!0});let G=await v0(Q),K=gY($,hY($)),B=(await new J.Input(Q).getInfo()).duration||60,U=Z.columns||10,z=Z.interval||5,q=Z.thumbnailWidth||160,j=Z.thumbnailHeight||90,H=Z.format||"jpeg",O=Math.ceil(B/z),F=Math.ceil(O/U),L=`${K}-sprite-${G}.${H}`,V=X3(Y,L),A=[];for(let w=0;w<O;w++)A.push(w*z);let N=await J.extractThumbnails(Q,{timestamps:A,width:q,height:j,format:H,quality:Z.quality||70,outputDir:X3(Y,".temp")});if(!N||N.length===0)return null;try{let w=await import("ts-images"),M=U*q,T=F*j,I=await w.createSprite({images:N.map((E)=>E.path),columns:U,padding:0,outputPath:V,format:H,quality:Z.quality||70});return{url:`${X}/${L}`,path:V,columns:U,rows:F,thumbnailWidth:q,thumbnailHeight:j,interval:z,totalFrames:O}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(Q){return console.warn(`[stx-media] Failed to generate sprite sheet: ${Q}`),null}}var mY=D(()=>{K$()});import{resolve as SG,basename as bG,extname as CG,join as h$}from"path";import{mkdir as Q3,writeFile as yG}from"fs/promises";async function PG(){try{return await import("ts-videos")}catch{return null}}async function D5($,Z,Y,X,J){let Q=await PG();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=SG($);if(!await f0(G))return null;let K=await v0(G),W=bG($,CG($)),_=h$(Y,`${W}-${K}-hls`);await Q3(_,{recursive:!0});let B=Z.length>0?Z:xG,U=J?.segmentDuration||6,j=(await new Q.Input(G).getInfo()).duration||0,H=[],O=0;for(let V of B){let A=h$(_,V.label);await Q3(A,{recursive:!0});let N=`${V.label}.m3u8`,w=h$(A,N);try{let M=await Q.generateHLS(G,{outputDir:A,segmentDuration:U,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(M)H.push({quality:V,url:`${X}/${W}-${K}-hls/${V.label}/${N}`,path:w}),O+=M.segmentCount||Math.ceil(j/U)}catch(M){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${M}`)}}if(H.length===0)return null;let F=h$(_,"master.m3u8"),L=UL(H,X,W,K);return await yG(F,L),{manifestUrl:`${X}/${W}-${K}-hls/master.m3u8`,manifestPath:F,playlists:H,segmentCount:O,duration:j}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function UL($,Z,Y,X){let J=["#EXTM3U","#EXT-X-VERSION:3"];for(let Q of $){let{quality:G}=Q,K=G.bitrate+(G.audioBitrate||128000),W=`${G.width}x${G.height||Math.round(G.width*9/16)}`;J.push(`#EXT-X-STREAM-INF:BANDWIDTH=${K},RESOLUTION=${W},NAME="${G.label}"`,`${G.label}/${G.label}.m3u8`)}return J.join(`
1229
1229
  `)}async function k5($,Z,Y,X,J){let Q=await PG();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=SG($);if(!await f0(G))return null;let K=await v0(G),W=bG($,CG($)),_=h$(Y,`${W}-${K}-dash`);await Q3(_,{recursive:!0});let B=Z.length>0?Z:xG,U=J?.segmentDuration||4,z=J?.minBufferTime||2,H=(await new Q.Input(G).getInfo()).duration||0,O=[],F=[];for(let N of B){let w=h$(_,N.label);await Q3(w,{recursive:!0});try{if(await Q.generateDASH(G,{outputDir:w,segmentDuration:U,width:N.width,height:N.height,videoBitrate:N.bitrate,audioBitrate:N.audioBitrate})){if(O.push({bandwidth:N.bitrate,width:N.width,height:N.height||Math.round(N.width*9/16),url:`${X}/${W}-${K}-dash/${N.label}/video`}),N.audioBitrate)F.push({bandwidth:N.audioBitrate,url:`${X}/${W}-${K}-dash/${N.label}/audio`})}}catch(M){console.warn(`[stx-media] Failed to generate DASH for ${N.label}: ${M}`)}}if(O.length===0)return null;let L=h$(_,"manifest.mpd"),V=zL(O,F,H,U,z);await yG(L,V);let A=[{type:"video",representations:O}];if(F.length>0)A.push({type:"audio",representations:F});return{manifestUrl:`${X}/${W}-${K}-dash/manifest.mpd`,manifestPath:L,adaptationSets:A,duration:H}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function zL($,Z,Y,X,J){let Q=kG(Y),G=kG(J),K=`<?xml version="1.0" encoding="UTF-8"?>
1230
1230
  <MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
1231
1231
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -1252,7 +1252,7 @@ ${N.join(`
1252
1252
  </Representation>
1253
1253
  `}K+=` </AdaptationSet>
1254
1254
  `}return K+=` </Period>
1255
- </MPD>`,K}function kG($){let Z=Math.floor($/3600),Y=Math.floor($%3600/60),X=Math.floor($%60),J="PT";if(Z>0)J+=`${Z}H`;if(Y>0)J+=`${Y}M`;return J+=`${X}S`,J}var xG;var cY=D(()=>{G$();xG=[{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 vG,basename as qL,extname as jL,join as HL}from"path";import{mkdir as OL}from"fs/promises";async function fG(){try{return await import("ts-videos")}catch{return null}}function LL($){switch($){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function FL($){switch($){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function s7($){let Z=await fG();if(!Z)return null;try{let Y=vG($),J=await new Z.Input(Y).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(Y){return console.warn(`[stx-media] Failed to analyze video: ${Y}`),null}}async function G3($,Z,Y,X){let J=await fG();if(!J)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let Q=await M5($,Z,Y);if(Q)return Q;try{let G=vG($);if(!await f0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",W=Y.baseUrl||"/videos";await OL(K,{recursive:!0});let _=await v0(G),B=qL($,jL($)),U={src:$,processed:!0,hash:_};X?.({percentage:5,stage:"analyzing"}),U.metadata=await s7(G)||void 0;let z={};if(Z.quality)z.bitrate=LL(Z.quality);if(Z.platform)Object.assign(z,FL(Z.platform));if(Z.transcode)Object.assign(z,Z.transcode);if(Object.keys(z).length>0||Z.process){X?.({percentage:10,stage:"transcoding"});let q=`${B}-${_}.mp4`,j=HL(K,q);try{let H=await VL(G,j,z,J,(O)=>X?.({percentage:10+O*0.5,stage:"transcoding"}));if(H)U.transcoded={path:j,url:`${W}/${q}`,duration:H.duration,size:H.size,video:{codec:z.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:z.audioCodec||"aac",bitrate:z.audioBitrate||128000,sampleRate:z.sampleRate||48000,channels:z.channels||2}:void 0}}catch(H){U.errors=U.errors||[],U.errors.push(`Transcoding failed: ${H}`)}}if(Z.generatePoster){X?.({percentage:65,stage:"generating-poster"});let q=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},j=await E5(G,q,K,W);if(j)U.poster=j}if(Y.thumbnails?.enabled){X?.({percentage:70,stage:"generating-thumbnails"});let q=await I5(G,Y.thumbnails,K,W);if(q.length>0)U.thumbnails=q}if(Z.streaming){X?.({percentage:80,stage:"generating-manifests"});let q=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(q.format==="hls"||q.format===void 0){let j=await D5(G,q.qualities||Y.streaming?.defaultQualities||[],K,W);if(j)U.streaming={...U.streaming,hls:j}}if(q.format==="dash"){let j=await k5(G,q.qualities||Y.streaming?.defaultQualities||[],K,W);if(j)U.streaming={...U.streaming,dash:j}}}if(Z.spriteSheet)X?.({percentage:90,stage:"generating-sprite-sheet"});return X?.({percentage:100,stage:"complete"}),await T5($,Z,U,Y),U}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function VL($,Z,Y,X,J){try{let G=await new X.Conversion($,Z,{videoCodec:Y.codec,videoBitrate:Y.bitrate,width:Y.maxWidth,height:Y.maxHeight,frameRate:Y.frameRate,audioCodec:Y.audioCodec,audioBitrate:Y.audioBitrate,sampleRate:Y.sampleRate,channels:Y.channels}).run((K)=>{J?.(K.percentage/100)});return{duration:G.duration||0,size:G.size||0,width:G.width||Y.maxWidth||0,height:G.height||Y.maxHeight||0,bitrate:G.bitrate||Y.bitrate||0,frameRate:G.frameRate||Y.frameRate||30,audioCodec:G.audioCodec}}catch(Q){return console.error(`[stx-media] Transcoding failed: ${Q}`),null}}var gG=D(()=>{G$();fY();pY();cY()});var hG={};Q0(hG,{setCachedVideoResult:()=>T5,processVideo:()=>G3,getCachedVideoResult:()=>M5,generateThumbnails:()=>I5,generateSpriteSheet:()=>J3,generatePoster:()=>E5,generateHLSManifest:()=>D5,generateDASHManifest:()=>k5,clearVideoCache:()=>Y3,analyzeVideo:()=>s7,VideoProcessorCache:()=>R5});var lY=D(()=>{gG();pY();cY();fY()});async function uG(){try{return await Promise.resolve().then(() => (lY(),hG))}catch($){if(!dG)console.warn("[stx-media] Video processor not available, some features disabled:",$),dG=!0;return null}}async function S5($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return TL(X,Y)}if(Y.processedResult?.processed)return iG($,Y.processedResult,Z);let J;if(X.generatePoster&&X.src&&!$.poster)J=await EL(X,Y);let{src:Q,sources:G=[],poster:K,posterPlaceholder:W,controls:_=mG,autoplay:B=!1,muted:U=!1,loop:z=!1,preload:q=pG,playsinline:j=!0,lazy:H=!0,player:O="native",type:F,width:L,height:V,crossorigin:A,disablePictureInPicture:N=!1,disableRemotePlayback:w=!1}=$,M=J||K,T=$.class,I=$.style,E=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(O==="ts-video")return wL($,Z);if(F&&F!=="video")return AL(Q||"",F,$);let S=G.length>0?G:Q?[{src:Q,type:cG(Q)}]:[],k=[`id="${E}"`];if(_)k.push("controls");if(B)k.push("autoplay");if(U)k.push("muted");if(z)k.push("loop");if(j)k.push("playsinline");if(N)k.push("disablepictureinpicture");if(w)k.push("disableremoteplayback");if(A)k.push(`crossorigin="${A}"`);if(H){if(k.push(`data-preload="${q}"`),k.push('preload="none"'),M)k.push(`data-poster="${P0(M)}"`);k.push("data-stx-lazy")}else if(k.push(`preload="${q}"`),M)k.push(`poster="${P0(M)}"`);if(L)k.push(`width="${L}"`);if(V)k.push(`height="${V}"`);if(T)k.push(`class="${P0(T)}"`);if(I)k.push(`style="${P0(I)}"`);let b=S.map((C)=>{return` <source ${H?`data-src="${P0(C.src)}"`:`src="${P0(C.src)}"`} type="${C.type}"${C.media?` media="${C.media}"`:""} />`}).join(`
1255
+ </MPD>`,K}function kG($){let Z=Math.floor($/3600),Y=Math.floor($%3600/60),X=Math.floor($%60),J="PT";if(Z>0)J+=`${Z}H`;if(Y>0)J+=`${Y}M`;return J+=`${X}S`,J}var xG;var pY=D(()=>{K$();xG=[{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 vG,basename as qL,extname as jL,join as HL}from"path";import{mkdir as OL}from"fs/promises";async function fG(){try{return await import("ts-videos")}catch{return null}}function LL($){switch($){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function FL($){switch($){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function s7($){let Z=await fG();if(!Z)return null;try{let Y=vG($),J=await new Z.Input(Y).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(Y){return console.warn(`[stx-media] Failed to analyze video: ${Y}`),null}}async function G3($,Z,Y,X){let J=await fG();if(!J)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let Q=await M5($,Z,Y);if(Q)return Q;try{let G=vG($);if(!await f0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",W=Y.baseUrl||"/videos";await OL(K,{recursive:!0});let _=await v0(G),B=qL($,jL($)),U={src:$,processed:!0,hash:_};X?.({percentage:5,stage:"analyzing"}),U.metadata=await s7(G)||void 0;let z={};if(Z.quality)z.bitrate=LL(Z.quality);if(Z.platform)Object.assign(z,FL(Z.platform));if(Z.transcode)Object.assign(z,Z.transcode);if(Object.keys(z).length>0||Z.process){X?.({percentage:10,stage:"transcoding"});let q=`${B}-${_}.mp4`,j=HL(K,q);try{let H=await VL(G,j,z,J,(O)=>X?.({percentage:10+O*0.5,stage:"transcoding"}));if(H)U.transcoded={path:j,url:`${W}/${q}`,duration:H.duration,size:H.size,video:{codec:z.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:z.audioCodec||"aac",bitrate:z.audioBitrate||128000,sampleRate:z.sampleRate||48000,channels:z.channels||2}:void 0}}catch(H){U.errors=U.errors||[],U.errors.push(`Transcoding failed: ${H}`)}}if(Z.generatePoster){X?.({percentage:65,stage:"generating-poster"});let q=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},j=await E5(G,q,K,W);if(j)U.poster=j}if(Y.thumbnails?.enabled){X?.({percentage:70,stage:"generating-thumbnails"});let q=await I5(G,Y.thumbnails,K,W);if(q.length>0)U.thumbnails=q}if(Z.streaming){X?.({percentage:80,stage:"generating-manifests"});let q=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(q.format==="hls"||q.format===void 0){let j=await D5(G,q.qualities||Y.streaming?.defaultQualities||[],K,W);if(j)U.streaming={...U.streaming,hls:j}}if(q.format==="dash"){let j=await k5(G,q.qualities||Y.streaming?.defaultQualities||[],K,W);if(j)U.streaming={...U.streaming,dash:j}}}if(Z.spriteSheet)X?.({percentage:90,stage:"generating-sprite-sheet"});return X?.({percentage:100,stage:"complete"}),await T5($,Z,U,Y),U}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function VL($,Z,Y,X,J){try{let G=await new X.Conversion($,Z,{videoCodec:Y.codec,videoBitrate:Y.bitrate,width:Y.maxWidth,height:Y.maxHeight,frameRate:Y.frameRate,audioCodec:Y.audioCodec,audioBitrate:Y.audioBitrate,sampleRate:Y.sampleRate,channels:Y.channels}).run((K)=>{J?.(K.percentage/100)});return{duration:G.duration||0,size:G.size||0,width:G.width||Y.maxWidth||0,height:G.height||Y.maxHeight||0,bitrate:G.bitrate||Y.bitrate||0,frameRate:G.frameRate||Y.frameRate||30,audioCodec:G.audioCodec}}catch(Q){return console.error(`[stx-media] Transcoding failed: ${Q}`),null}}var gG=D(()=>{K$();vY();mY();pY()});var hG={};Q0(hG,{setCachedVideoResult:()=>T5,processVideo:()=>G3,getCachedVideoResult:()=>M5,generateThumbnails:()=>I5,generateSpriteSheet:()=>J3,generatePoster:()=>E5,generateHLSManifest:()=>D5,generateDASHManifest:()=>k5,clearVideoCache:()=>Y3,analyzeVideo:()=>s7,VideoProcessorCache:()=>R5});var cY=D(()=>{gG();mY();pY();vY()});async function uG(){try{return await Promise.resolve().then(() => (cY(),hG))}catch($){if(!dG)console.warn("[stx-media] Video processor not available, some features disabled:",$),dG=!0;return null}}async function S5($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return TL(X,Y)}if(Y.processedResult?.processed)return iG($,Y.processedResult,Z);let J;if(X.generatePoster&&X.src&&!$.poster)J=await EL(X,Y);let{src:Q,sources:G=[],poster:K,posterPlaceholder:W,controls:_=mG,autoplay:B=!1,muted:U=!1,loop:z=!1,preload:q=pG,playsinline:j=!0,lazy:H=!0,player:O="native",type:F,width:L,height:V,crossorigin:A,disablePictureInPicture:N=!1,disableRemotePlayback:w=!1}=$,M=J||K,T=$.class,I=$.style,E=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(O==="ts-video")return wL($,Z);if(F&&F!=="video")return AL(Q||"",F,$);let S=G.length>0?G:Q?[{src:Q,type:cG(Q)}]:[],k=[`id="${E}"`];if(_)k.push("controls");if(B)k.push("autoplay");if(U)k.push("muted");if(z)k.push("loop");if(j)k.push("playsinline");if(N)k.push("disablepictureinpicture");if(w)k.push("disableremoteplayback");if(A)k.push(`crossorigin="${A}"`);if(H){if(k.push(`data-preload="${q}"`),k.push('preload="none"'),M)k.push(`data-poster="${P0(M)}"`);k.push("data-stx-lazy")}else if(k.push(`preload="${q}"`),M)k.push(`poster="${P0(M)}"`);if(L)k.push(`width="${L}"`);if(V)k.push(`height="${V}"`);if(T)k.push(`class="${P0(T)}"`);if(I)k.push(`style="${P0(I)}"`);let b=S.map((C)=>{return` <source ${H?`data-src="${P0(C.src)}"`:`src="${P0(C.src)}"`} type="${C.type}"${C.media?` media="${C.media}"`:""} />`}).join(`
1256
1256
  `),P=`<video ${k.join(" ")}>
1257
1257
  ${b}
1258
1258
  Your browser does not support the video tag.
@@ -1509,9 +1509,9 @@ ${S}
1509
1509
  width: 100%;
1510
1510
  height: auto;
1511
1511
  }
1512
- `.trim();return{html:S,script:k,css:b}}var dG=!1,mG=!0,pG="metadata",NL="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var iY=D(()=>{nY()});function K3(){return T0({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,Y,X)=>{let{src:J,options:Q}=IL($,Z,Y);if(!J)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:J,poster:Q.poster,controls:Q.controls!==!1,autoplay:Q.autoplay||!1,muted:Q.muted||!1,loop:Q.loop||!1,preload:Q.preload||"metadata",playsinline:Q.playsinline!==!1,lazy:Q.lazy!==!1,player:Q.player||"native",type:Q.type,width:Q.width,height:Q.height,class:Q.class,style:Q.style,id:Q.id,crossorigin:Q.crossorigin,disablePictureInPicture:Q.disablePictureInPicture,disableRemotePlayback:Q.disableRemotePlayback,title:Q.title,quality:Q.quality,platform:Q.platform,process:Q.process,generatePoster:Q.generatePoster,streaming:Q.streaming,transcode:Q.transcode,spriteSheet:Q.spriteSheet,waveform:Q.waveform},W={isDev:Y.__isDev||!1,tsVideosConfig:Y.__tsVideosConfig},_=await S5(G,W),B=_.html;if(_.css)B+=`
1512
+ `.trim();return{html:S,script:k,css:b}}var dG=!1,mG=!0,pG="metadata",NL="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var lY=D(()=>{iY()});function K3(){return T0({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,Y,X)=>{let{src:J,options:Q}=IL($,Z,Y);if(!J)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:J,poster:Q.poster,controls:Q.controls!==!1,autoplay:Q.autoplay||!1,muted:Q.muted||!1,loop:Q.loop||!1,preload:Q.preload||"metadata",playsinline:Q.playsinline!==!1,lazy:Q.lazy!==!1,player:Q.player||"native",type:Q.type,width:Q.width,height:Q.height,class:Q.class,style:Q.style,id:Q.id,crossorigin:Q.crossorigin,disablePictureInPicture:Q.disablePictureInPicture,disableRemotePlayback:Q.disableRemotePlayback,title:Q.title,quality:Q.quality,platform:Q.platform,process:Q.process,generatePoster:Q.generatePoster,streaming:Q.streaming,transcode:Q.transcode,spriteSheet:Q.spriteSheet,waveform:Q.waveform},W={isDev:Y.__isDev||!1,tsVideosConfig:Y.__tsVideosConfig},_=await S5(G,W),B=_.html;if(_.css)B+=`
1513
1513
  <style>${_.css}</style>`;if(_.script)B+=`
1514
- <script>${_.script}</script>`;return B},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function IL($,Z,Y){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let X=$.trim();if(X.startsWith("@video(")||X.startsWith("("))X=X.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=DL(X),Q=nG(J[0],Y)||"",G={};if(J[1]){let K=nG(J[1],Y);if(typeof K==="object"&&K!==null)G=K;else if(typeof J[1]==="string")try{G=JSON.parse(J[1])}catch{}}return{src:Q,options:G}}function DL($){let Z=[],Y="",X=!1,J="",Q=0,G=0;for(let K=0;K<$.length;K++){let W=$[K],_=K>0?$[K-1]:"";if((W==='"'||W==="'"||W==="`")&&_!=="\\"){if(!X)X=!0,J=W;else if(W===J)X=!1,J="";else Y+=W;continue}if(!X){if(W==="{")Q++;if(W==="}")Q--;if(W==="[")G++;if(W==="]")G--;if(W===","&&Q===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=W}if(Y.trim())Z.push(Y.trim());return Z}function nG($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let X=Z[Y];if(X!==void 0)return X}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var r7;var nY=D(()=>{E7();iY();r7=K3()});function kL($,Z){let Y=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
1514
+ <script>${_.script}</script>`;return B},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function IL($,Z,Y){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let X=$.trim();if(X.startsWith("@video(")||X.startsWith("("))X=X.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=DL(X),Q=nG(J[0],Y)||"",G={};if(J[1]){let K=nG(J[1],Y);if(typeof K==="object"&&K!==null)G=K;else if(typeof J[1]==="string")try{G=JSON.parse(J[1])}catch{}}return{src:Q,options:G}}function DL($){let Z=[],Y="",X=!1,J="",Q=0,G=0;for(let K=0;K<$.length;K++){let W=$[K],_=K>0?$[K-1]:"";if((W==='"'||W==="'"||W==="`")&&_!=="\\"){if(!X)X=!0,J=W;else if(W===J)X=!1,J="";else Y+=W;continue}if(!X){if(W==="{")Q++;if(W==="}")Q--;if(W==="[")G++;if(W==="]")G--;if(W===","&&Q===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=W}if(Y.trim())Z.push(Y.trim());return Z}function nG($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let X=Z[Y];if(X!==void 0)return X}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var r7;var iY=D(()=>{E7();lY();r7=K3()});function kL($,Z){let Y=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
1515
1515
  ${$}
1516
1516
  </div>
1517
1517
  <script>
@@ -1810,8 +1810,8 @@ catch (error) {
1810
1810
  init();
1811
1811
  }
1812
1812
  })();
1813
- </script>`}var yL,PL,xL,vL,sG;var rG=D(()=>{yL={name:"pwa.installButton",handler:($,Z,Y,X)=>{let J=Y.__stx_options||{};return kL($,J)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},PL={name:"pwa.updatePrompt",handler:($,Z,Y,X)=>{let J=Y.__stx_options||{};return SL($,J)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},xL={name:"pwa.offlineIndicator",handler:($,Z,Y,X)=>{let J=Y.__stx_options||{};return bL($,J)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},vL={name:"pwa.pushSubscribe",handler:($,Z,Y,X)=>{let J=Y.__stx_options||{};return CL($,J)},hasEndTag:!0,description:"Renders a push notification subscription button"},sG=[yL,PL,xL,vL]});function aG($){oG=$}function tG(){return oG}function eG($){W3={...W3,...$}}function $K(){W3={}}function sY($,Z={}){let Y=W3[$]||fL[$]||{message:`Unknown error (code: ${$})`},X=Y.message,J=Y.help;for(let[Q,G]of Object.entries(Z)){let K=`{{${Q}}}`;if(X=X.replace(new RegExp(K,"g"),G),J)J=J.replace(new RegExp(K,"g"),G)}return{message:X,help:J}}function ZK($,Z={}){let{message:Y,help:X}=sY($,Z);return X?`${Y}
1814
- Help: ${X}`:Y}function _3($){for(let[Z,Y]of Object.entries(o))if(Y===$)return Z;return}var fL,W3,oG="en",o;var B3=D(()=>{fL={1001:{message:"Unclosed directive: {{directive}}",help:"Make sure to close the directive with the appropriate end tag"},1002:{message:"Unclosed expression at position {{position}}",help:"Check for missing closing braces }}"},1003:{message:"Invalid directive syntax: {{directive}}",help:"Review the directive documentation for correct syntax"},1004:{message:"Malformed expression: {{expression}}",help:"Check for syntax errors in your expression"},1005:{message:"Unexpected token: {{token}}",help:"Remove or fix the unexpected token"},1101:{message:"Undefined variable: {{variable}}",help:"Make sure the variable is defined in the template context"},1102:{message:"Type error: {{details}}",help:"Check that you are using the correct types"},1103:{message:"Evaluation error: {{details}}",help:"Review the expression for errors"},1104:{message:"Infinite loop detected in {{location}}",help:"Check your loop conditions"},1105:{message:"Circular reference detected: {{path}}",help:"Remove the circular dependency"},1201:{message:"Unsafe expression blocked: {{expression}}",help:"This expression contains potentially dangerous code"},1202:{message:"Path traversal attempt blocked: {{path}}",help:"Use only relative paths within allowed directories"},1203:{message:"Potential XSS attempt blocked",help:"Sanitize user input before rendering"},1204:{message:"Code injection attempt blocked: {{code}}",help:"Avoid executing dynamic code"},1205:{message:"Prohibited DOM API usage: {{api}}",help:"Use STX.useRefs(), STX.useRef(), STX.el() and other STX helpers instead of direct DOM manipulation"},1301:{message:"File not found: {{path}}",help:"Check that the file exists and the path is correct"},1302:{message:"Error reading file: {{path}}",help:"Check file permissions and encoding"},1303:{message:"Invalid file path: {{path}}",help:"Use a valid file path"},1304:{message:"Permission denied: {{path}}",help:"Check file permissions"},1401:{message:"Invalid configuration: {{details}}",help:"Review your stx.config.ts file"},1402:{message:"Missing required configuration: {{key}}",help:"Add the required configuration option"},1403:{message:"Deprecated configuration: {{key}}",help:"Update to the new configuration format"},1501:{message:"Component not found: {{name}}",help:"Check that the component exists in your components directory"},1502:{message:"Invalid props for component {{name}}: {{details}}",help:"Check the component prop requirements"},1503:{message:"Error rendering component {{name}}: {{details}}",help:"Check the component template for errors"},1601:{message:"Filter not found: {{filter}}",help:"Register the filter or check the filter name"},1602:{message:"Invalid arguments for filter {{filter}}: {{details}}",help:"Check the filter documentation for correct arguments"},1603:{message:"Expression evaluation timed out",help:"Simplify the expression or increase the timeout"}},W3={};o={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 YK(){return!1}function _$(){return!YK()||process.env.STX_DEBUG==="true"}function gL(){return!1}import hL from"path";function JK($){b5={...b5,...$}}function o7(){return{...b5}}function QK(){b5={...XK}}function a7($){if(!b5.showRelativePaths||!$)return $;let Z=b5.baseDir||process.cwd();try{let Y=hL.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var XK,b5,B$,rY,O1,oY,C5,t7;var U3=D(()=>{B3();XK={showRelativePaths:!1,enableAutoRecovery:_$(),logRecoveryWarnings:!0},b5={...XK};B$=class B$ extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,X,J,Q,G){super($);this.code=Z;this.filePath=Y;this.line=X;this.column=J;this.context=Q;if(this.name="StxError",this.numericCode=G||o.EVALUATION_ERROR,this.filePath)this.filePath=a7(this.filePath)}};rY=class rY extends B${constructor($,Z,Y,X,J,Q){super($,"stx_SYNTAX_ERROR",Z,Y,X,J,Q||o.INVALID_DIRECTIVE_SYNTAX);this.name="StxSyntaxError"}};O1=class O1 extends B${constructor($,Z,Y,X,J,Q){super($,"stx_RUNTIME_ERROR",Z,Y,X,J,Q||o.EVALUATION_ERROR);this.name="StxRuntimeError"}};oY=class oY extends B${constructor($,Z,Y,X,J,Q){super($,"stx_SECURITY_ERROR",Z,Y,X,J,Q||o.UNSAFE_EXPRESSION);this.name="StxSecurityError"}};C5=class C5 extends B${constructor($,Z,Y,X,J,Q){super($,"stx_FILE_ERROR",Z,Y,X,J,Q||o.FILE_NOT_FOUND);this.name="StxFileError"}};t7=class t7 extends B${isFatal=!0;constructor($,Z,Y,X,J,Q){super($,"stx_VALIDATION_ERROR",Z,Y,X,J,Q||o.DOM_API_VIOLATION);this.name="StxValidationError"}}});function z3($){let{type:Z,message:Y,code:X,filePath:J,line:Q,column:G,template:K,offset:W,snippet:_,suggestion:B,format:U="text"}=$,z=Q,q=G;if(!z&&K&&W!==void 0){let L=KK(K,W);z=L.line,q=L.column}let j=J?a7(J):void 0,H=X?_3(X):void 0,O={type:Z,code:X,codeName:H,message:Y,filePath:j,line:z,column:q,snippet:_,suggestion:B,timestamp:new Date().toISOString()},F;switch(U){case"html":F=uL(O);break;case"json":F=JSON.stringify(O,null,2);break;case"console":F=mL(O,K,W);break;case"text":default:F=dL(O,K,W);break}return{formatted:F,data:O}}function dL($,Z,Y){let X=[],J=$.code?` [${$.codeName||$.code}]`:"";if(X.push(`[${$.type} Error${J}]`),$.filePath){let Q=$.filePath;if($.line){if(Q+=`:${$.line}`,$.column)Q+=`:${$.column}`}X.push(`at ${Q}`)}if(X.push(`
1813
+ </script>`}var yL,PL,xL,vL,sG;var rG=D(()=>{yL={name:"pwa.installButton",handler:($,Z,Y,X)=>{let J=Y.__stx_options||{};return kL($,J)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},PL={name:"pwa.updatePrompt",handler:($,Z,Y,X)=>{let J=Y.__stx_options||{};return SL($,J)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},xL={name:"pwa.offlineIndicator",handler:($,Z,Y,X)=>{let J=Y.__stx_options||{};return bL($,J)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},vL={name:"pwa.pushSubscribe",handler:($,Z,Y,X)=>{let J=Y.__stx_options||{};return CL($,J)},hasEndTag:!0,description:"Renders a push notification subscription button"},sG=[yL,PL,xL,vL]});function aG($){oG=$}function tG(){return oG}function eG($){W3={...W3,...$}}function $K(){W3={}}function nY($,Z={}){let Y=W3[$]||fL[$]||{message:`Unknown error (code: ${$})`},X=Y.message,J=Y.help;for(let[Q,G]of Object.entries(Z)){let K=`{{${Q}}}`;if(X=X.replace(new RegExp(K,"g"),G),J)J=J.replace(new RegExp(K,"g"),G)}return{message:X,help:J}}function ZK($,Z={}){let{message:Y,help:X}=nY($,Z);return X?`${Y}
1814
+ Help: ${X}`:Y}function _3($){for(let[Z,Y]of Object.entries(o))if(Y===$)return Z;return}var fL,W3,oG="en",o;var B3=D(()=>{fL={1001:{message:"Unclosed directive: {{directive}}",help:"Make sure to close the directive with the appropriate end tag"},1002:{message:"Unclosed expression at position {{position}}",help:"Check for missing closing braces }}"},1003:{message:"Invalid directive syntax: {{directive}}",help:"Review the directive documentation for correct syntax"},1004:{message:"Malformed expression: {{expression}}",help:"Check for syntax errors in your expression"},1005:{message:"Unexpected token: {{token}}",help:"Remove or fix the unexpected token"},1101:{message:"Undefined variable: {{variable}}",help:"Make sure the variable is defined in the template context"},1102:{message:"Type error: {{details}}",help:"Check that you are using the correct types"},1103:{message:"Evaluation error: {{details}}",help:"Review the expression for errors"},1104:{message:"Infinite loop detected in {{location}}",help:"Check your loop conditions"},1105:{message:"Circular reference detected: {{path}}",help:"Remove the circular dependency"},1201:{message:"Unsafe expression blocked: {{expression}}",help:"This expression contains potentially dangerous code"},1202:{message:"Path traversal attempt blocked: {{path}}",help:"Use only relative paths within allowed directories"},1203:{message:"Potential XSS attempt blocked",help:"Sanitize user input before rendering"},1204:{message:"Code injection attempt blocked: {{code}}",help:"Avoid executing dynamic code"},1205:{message:"Prohibited DOM API usage: {{api}}",help:"Use STX.useRefs(), STX.useRef(), STX.el() and other STX helpers instead of direct DOM manipulation"},1301:{message:"File not found: {{path}}",help:"Check that the file exists and the path is correct"},1302:{message:"Error reading file: {{path}}",help:"Check file permissions and encoding"},1303:{message:"Invalid file path: {{path}}",help:"Use a valid file path"},1304:{message:"Permission denied: {{path}}",help:"Check file permissions"},1401:{message:"Invalid configuration: {{details}}",help:"Review your stx.config.ts file"},1402:{message:"Missing required configuration: {{key}}",help:"Add the required configuration option"},1403:{message:"Deprecated configuration: {{key}}",help:"Update to the new configuration format"},1501:{message:"Component not found: {{name}}",help:"Check that the component exists in your components directory"},1502:{message:"Invalid props for component {{name}}: {{details}}",help:"Check the component prop requirements"},1503:{message:"Error rendering component {{name}}: {{details}}",help:"Check the component template for errors"},1601:{message:"Filter not found: {{filter}}",help:"Register the filter or check the filter name"},1602:{message:"Invalid arguments for filter {{filter}}: {{details}}",help:"Check the filter documentation for correct arguments"},1603:{message:"Expression evaluation timed out",help:"Simplify the expression or increase the timeout"}},W3={};o={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 YK(){return!1}function B$(){return!YK()||process.env.STX_DEBUG==="true"}function gL(){return!1}import hL from"path";function JK($){b5={...b5,...$}}function o7(){return{...b5}}function QK(){b5={...XK}}function a7($){if(!b5.showRelativePaths||!$)return $;let Z=b5.baseDir||process.cwd();try{let Y=hL.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var XK,b5,U$,sY,O1,rY,C5,t7;var U3=D(()=>{B3();XK={showRelativePaths:!1,enableAutoRecovery:B$(),logRecoveryWarnings:!0},b5={...XK};U$=class U$ extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,X,J,Q,G){super($);this.code=Z;this.filePath=Y;this.line=X;this.column=J;this.context=Q;if(this.name="StxError",this.numericCode=G||o.EVALUATION_ERROR,this.filePath)this.filePath=a7(this.filePath)}};sY=class sY extends U${constructor($,Z,Y,X,J,Q){super($,"stx_SYNTAX_ERROR",Z,Y,X,J,Q||o.INVALID_DIRECTIVE_SYNTAX);this.name="StxSyntaxError"}};O1=class O1 extends U${constructor($,Z,Y,X,J,Q){super($,"stx_RUNTIME_ERROR",Z,Y,X,J,Q||o.EVALUATION_ERROR);this.name="StxRuntimeError"}};rY=class rY extends U${constructor($,Z,Y,X,J,Q){super($,"stx_SECURITY_ERROR",Z,Y,X,J,Q||o.UNSAFE_EXPRESSION);this.name="StxSecurityError"}};C5=class C5 extends U${constructor($,Z,Y,X,J,Q){super($,"stx_FILE_ERROR",Z,Y,X,J,Q||o.FILE_NOT_FOUND);this.name="StxFileError"}};t7=class t7 extends U${isFatal=!0;constructor($,Z,Y,X,J,Q){super($,"stx_VALIDATION_ERROR",Z,Y,X,J,Q||o.DOM_API_VIOLATION);this.name="StxValidationError"}}});function z3($){let{type:Z,message:Y,code:X,filePath:J,line:Q,column:G,template:K,offset:W,snippet:_,suggestion:B,format:U="text"}=$,z=Q,q=G;if(!z&&K&&W!==void 0){let L=KK(K,W);z=L.line,q=L.column}let j=J?a7(J):void 0,H=X?_3(X):void 0,O={type:Z,code:X,codeName:H,message:Y,filePath:j,line:z,column:q,snippet:_,suggestion:B,timestamp:new Date().toISOString()},F;switch(U){case"html":F=uL(O);break;case"json":F=JSON.stringify(O,null,2);break;case"console":F=mL(O,K,W);break;case"text":default:F=dL(O,K,W);break}return{formatted:F,data:O}}function dL($,Z,Y){let X=[],J=$.code?` [${$.codeName||$.code}]`:"";if(X.push(`[${$.type} Error${J}]`),$.filePath){let Q=$.filePath;if($.line){if(Q+=`:${$.line}`,$.column)Q+=`:${$.column}`}X.push(`at ${Q}`)}if(X.push(`
1815
1815
  ${$.message}`),Z&&$.line){let Q=pL(Z,$.line,2);if(Q)X.push(`
1816
1816
  ${Q}`)}if($.snippet)X.push(`
1817
1817
  Snippet: ${$.snippet}`);if($.suggestion)X.push(`
@@ -1842,8 +1842,8 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
1842
1842
  `;Z.appendFileSync(this.logFilePath,J,"utf-8")}catch(Z){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",Z)}})}async rotateIfNeeded($){try{if(!$.existsSync(this.logFilePath))return;if($.statSync(this.logFilePath).size<this.maxFileSize)return;for(let Y=this.maxLogFiles-1;Y>=1;Y--){let X=`${this.logFilePath}.${Y}`,J=`${this.logFilePath}.${Y+1}`;if($.existsSync(X))if(Y>=this.maxLogFiles-1)$.unlinkSync(X);else $.renameSync(X,J)}if(this.maxLogFiles<=1)$.writeFileSync(this.logFilePath,"");else $.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(Z){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",Z)}}getRecentErrors($=10){return this.errors.slice(-$)}getErrorsByType($){return this.errors.filter((Z)=>Z.error.constructor.name===$)}getErrorsByLevel($){return this.errors.filter((Z)=>Z.level===$)}clear(){this.errors.length=0}async clearLogFile(){try{let $=await import("fs");if($.existsSync(this.logFilePath))$.writeFileSync(this.logFilePath,"","utf-8")}catch($){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",$)}}getStats(){let $={},Z={error:0,warning:0,info:0};for(let Y of this.errors){let X=Y.error.constructor.name;$[X]=($[X]||0)+1;let J=Y.level||"error";Z[J]=(Z[J]||0)+1}return{total:this.errors.length,byType:$,byLevel:Z}}async exportToFile($,Z="json"){let Y=await import("fs"),J=(await import("path")).dirname($);if(!Y.existsSync(J))Y.mkdirSync(J,{recursive:!0});if(Z==="json"){let Q=this.errors.map((G)=>({timestamp:G.timestamp.toISOString(),level:G.level||"error",type:G.error.constructor.name,message:G.error.message,stack:G.error.stack,context:G.context}));Y.writeFileSync($,JSON.stringify(Q,null,2),"utf-8")}else{let Q=this.errors.map((G)=>this.formatEntry(G));Y.writeFileSync($,Q.join(`
1843
1843
 
1844
1844
  `),"utf-8")}}async flush(){await this.writeQueue}}var q3,u0,y5;var zK=D(()=>{U3();q3={isEnabled(){return o7().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=o7();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let Y=$,X=[],J=(Y.match(/\{\{/g)||[]).length,Q=(Y.match(/\}\}/g)||[]).length;if(J>Q){let K=J-Q;Y+="}}".repeat(K),X.push(`Added ${K} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let K of G){let W=(Y.match(new RegExp(`@${K}\\b`,"g"))||[]).length,_=(Y.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(W>_){let B=W-_;for(let U=0;U<B;U++)Y+=`
1845
- @end${K}`;X.push(`Added ${B} missing @end${K}`)}}if(X.length>0&&Z.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),X.forEach((K)=>console.warn(` - ${K}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Y,fixes:X}},createFallbackContent($,Z){if(_$())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};u0=new j3,y5={isDevelopment(){return _$()},logDetailedError($,Z){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",$.message),console.error("Stack:",$.stack),Z)console.error("Context:",Z);console.error("========================")},createErrorReport($,Z){let Y=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${$.message}`,`Type: ${$.constructor.name}`,`Stack: ${$.stack}`];if(Z)Y.push(`Context: ${JSON.stringify(Z,null,2)}`);return Y.push("========================"),Y.join(`
1846
- `)}}});import aY from"path";function lL($){let Z={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};return $.replace(/[&<>"']/g,(Y)=>Z[Y]||Y)}function e7($,Z={}){let{allowHtml:Y=!1,maxLength:X=1e4,allowSpecialChars:J=!0,customSanitizer:Q}=Z,G=[],K=$,W=!1;if(Q){let B=Q(K);if(B!==K)K=B,W=!0}if(K.includes("\x00"))K=K.replace(/\0/g,""),W=!0,G.push("Null bytes removed from parameter");if(K.length>X)K=K.substring(0,X),W=!0,G.push(`Parameter truncated to ${X} characters`);if(!Y&&/<[^>]+>/.test(K))K=lL(K),W=!0,G.push("HTML content was escaped");let _=[{pattern:/javascript:/gi,replacement:"",name:"javascript: URI"},{pattern:/vbscript:/gi,replacement:"",name:"vbscript: URI"},{pattern:/data:text\/html/gi,replacement:"",name:"data:text/html URI"}];for(let{pattern:B,replacement:U,name:z}of _)if(B.test(K))K=K.replace(B,U),W=!0,G.push(`Removed ${z} from parameter`);if(!J){let B=K;if(K=K.split("").filter((U)=>{let z=U.charCodeAt(0);return z>=32&&z!==127}).join(""),K!==B)W=!0,G.push("Control characters removed")}return{value:K,modified:W,warnings:G}}function qK($,Z){let Y=$.replace(/\0/g,"");Y=Y.replace(/\\/g,"/"),Y=Y.replace(/^[a-z][a-z0-9+.-]*:/i,"");while(Y.includes("../")||Y.includes("./"))Y=Y.replace(/\.\.\//g,"").replace(/\.\//g,"");if(!H3.isValidFilePath(Y,Z))return null;return Y}function jK($){let Z=[],Y=$.trim(),X=Y!==$,J=[{pattern:/\beval\s*\(/gi,name:"eval()"},{pattern:/\bFunction\s*\(/gi,name:"Function()"},{pattern:/\bsetTimeout\s*\(/gi,name:"setTimeout()"},{pattern:/\bsetInterval\s*\(/gi,name:"setInterval()"},{pattern:/\bimport\s*\(/gi,name:"dynamic import()"},{pattern:/\brequire\s*\(/gi,name:"require()"},{pattern:/\b__proto__\b/gi,name:"__proto__"},{pattern:/\bconstructor\b/gi,name:"constructor"},{pattern:/\bprototype\b/gi,name:"prototype"}];for(let{pattern:Q,name:G}of J)if(Q.test(Y))Z.push(`Potentially dangerous pattern detected: ${G}`);if(Y.includes("\x00"))Y=Y.replace(/\0/g,""),X=!0,Z.push("Null bytes removed from expression");return{value:Y,modified:X,warnings:Z}}function HK($,Z={}){return $.map((Y)=>e7(Y,Z))}function tY($){let Z={};for(let[Y,X]of Object.entries($)){if(!H3.isValidVariableName(Y))continue;if(typeof X==="string"){let J=e7(X);Z[Y]=J.value}else if(Array.isArray(X))Z[Y]=X.map((J)=>typeof J==="string"?e7(J).value:J);else if(typeof X==="object"&&X!==null)Z[Y]=tY(X);else Z[Y]=X}return Z}var H3;var OK=D(()=>{H3={isValidFilePath($,Z){let Y=$.replace(/\\/g,"/");if(Y.includes("\x00"))return!1;if(Y.includes("../")||Y.includes("..\\")||Y===".."||Y.startsWith("../")||Y.endsWith("/..")||Y.includes("/..\\")||Y.includes("\\../"))return!1;if(/^[a-z][a-z0-9+.-]*:/i.test(Y))return!1;if(Y.startsWith("/")){if(["/etc/","/root/","/var/","/usr/","/bin/","/sbin/","/proc/","/sys/","/dev/","/boot/","/home/","/private/","/Library/","/System/"].some((Q)=>Y===Q.slice(0,-1)||Y.startsWith(Q)))return!1}if(/^[a-z]:/i.test(Y)){if(["Windows/","Windows\\","System32/","System32\\","Program Files/","Program Files\\"].some((Q)=>Y.includes(Q)))return!1}if(Z){let J=aY.resolve(Z,$),Q=aY.resolve(Z);if(!J.startsWith(Q+aY.sep)&&J!==Q)return!1}return!0},isValidVariableName($){return/^[a-z_$]\w*$/i.test($)},isValidDirectiveName($){return/^[a-z][\w-]*$/i.test($)},isSafeContent($){return![/<script[^>]*>[\s\S]*?<\/script>/i,/javascript:/i,/data:text\/html/i,/vbscript:/i,/on\w+\s*=/i].some((Y)=>Y.test($))}}});var LK=D(()=>{B3();UK();zK();OK();U3()});var X1=D(()=>{LK()});function eY($,Z,Y,X){let J=$;J=J.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,W,_)=>{if(!_&&W.includes(":")){let B=W.split(":"),U=W,z=B.length>1?B[1]:"";if(z&&Z[z])_=Z[z];else if(U.startsWith("og:")&&Z.openGraph&&Z.openGraph[B[1]])_=Z.openGraph[B[1]];else _="";return _?`<meta property="${e(U)}" content="${e(_)}">`:""}return _?`<meta name="${e(W)}" content="${e(_)}">`:""});let Q=/@metaTag\s*\(/g,G;while((G=Q.exec(J))!==null){let K=G.index,W=K+G[0].length-1,_=1,B=W+1;while(B<J.length&&_>0){if(J[B]==="(")_++;else if(J[B]===")"){if(_--,_===0)break}B++}if(_!==0)break;let U=J.substring(W+1,B).trim(),z=B+1,q=(()=>{try{let j=k0(U,Z);if(!j)return"";let H="<meta";if(j.name)H+=` name="${e(String(j.name))}"`;if(j.property)H+=` property="${e(String(j.property))}"`;if(j.httpEquiv)H+=` http-equiv="${e(String(j.httpEquiv))}"`;if(j.content)H+=` content="${e(String(j.content))}"`;return H+=">",H}catch(j){let H=j instanceof Error?j.message:String(j);return $0("MetaTag",H,o.EVALUATION_ERROR)}})();J=J.substring(0,K)+q+J.substring(z),Q.lastIndex=0}return J}function $X($,Z,Y){let X=$,J=/@structuredData\s*\(/g,Q;while((Q=J.exec(X))!==null){let G=Q.index,K=G+Q[0].length-1,W=1,_=K+1;while(_<X.length&&W>0){if(X[_]==="(")W++;else if(X[_]===")"){if(W--,W===0)break}_++}if(W!==0)break;let B=X.substring(K+1,_).trim(),U=_+1,z=(()=>{try{let q=k0(B,Z);if(!q)return"";if(!q["@context"])q["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(q).replace(/<\//g,"<\\/")}</script>`}catch(q){let j=q instanceof Error?q.message:String(q);return $0("StructuredData",j,o.EVALUATION_ERROR)}})();X=X.substring(0,G)+z+X.substring(U),J.lastIndex=0}return X}function ZX($,Z,Y,X){let J=$,Q=/@seo\s*\(\s*\{/g,G;while((G=Q.exec(J))!==null){let K=J.indexOf("{",G.index+4),W=1,_=K+1,B=null,U=!1;while(_<J.length&&W>0){let F=J[_];if(U){U=!1,_++;continue}if(F==="\\"&&B){U=!0,_++;continue}if(B){if(F===B)B=null;_++;continue}if(F==='"'||F==="'"||F==="`"){B=F,_++;continue}if(F==="{")W++;else if(F==="}")W--;_++}if(W!==0)break;let z=J.substring(_).match(/^\s*\)/);if(!z)break;let q=_+z[0].length,j=J.substring(K,_),H=J.substring(G.index,q),O=((F)=>{try{let L=k0(F,Z);if(!L)return"";let V="";if(L.title)V+=`<title>${e(L.title)}</title>
1845
+ @end${K}`;X.push(`Added ${B} missing @end${K}`)}}if(X.length>0&&Z.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),X.forEach((K)=>console.warn(` - ${K}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Y,fixes:X}},createFallbackContent($,Z){if(B$())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};u0=new j3,y5={isDevelopment(){return B$()},logDetailedError($,Z){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",$.message),console.error("Stack:",$.stack),Z)console.error("Context:",Z);console.error("========================")},createErrorReport($,Z){let Y=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${$.message}`,`Type: ${$.constructor.name}`,`Stack: ${$.stack}`];if(Z)Y.push(`Context: ${JSON.stringify(Z,null,2)}`);return Y.push("========================"),Y.join(`
1846
+ `)}}});import oY from"path";function lL($){let Z={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};return $.replace(/[&<>"']/g,(Y)=>Z[Y]||Y)}function e7($,Z={}){let{allowHtml:Y=!1,maxLength:X=1e4,allowSpecialChars:J=!0,customSanitizer:Q}=Z,G=[],K=$,W=!1;if(Q){let B=Q(K);if(B!==K)K=B,W=!0}if(K.includes("\x00"))K=K.replace(/\0/g,""),W=!0,G.push("Null bytes removed from parameter");if(K.length>X)K=K.substring(0,X),W=!0,G.push(`Parameter truncated to ${X} characters`);if(!Y&&/<[^>]+>/.test(K))K=lL(K),W=!0,G.push("HTML content was escaped");let _=[{pattern:/javascript:/gi,replacement:"",name:"javascript: URI"},{pattern:/vbscript:/gi,replacement:"",name:"vbscript: URI"},{pattern:/data:text\/html/gi,replacement:"",name:"data:text/html URI"}];for(let{pattern:B,replacement:U,name:z}of _)if(B.test(K))K=K.replace(B,U),W=!0,G.push(`Removed ${z} from parameter`);if(!J){let B=K;if(K=K.split("").filter((U)=>{let z=U.charCodeAt(0);return z>=32&&z!==127}).join(""),K!==B)W=!0,G.push("Control characters removed")}return{value:K,modified:W,warnings:G}}function qK($,Z){let Y=$.replace(/\0/g,"");Y=Y.replace(/\\/g,"/"),Y=Y.replace(/^[a-z][a-z0-9+.-]*:/i,"");while(Y.includes("../")||Y.includes("./"))Y=Y.replace(/\.\.\//g,"").replace(/\.\//g,"");if(!H3.isValidFilePath(Y,Z))return null;return Y}function jK($){let Z=[],Y=$.trim(),X=Y!==$,J=[{pattern:/\beval\s*\(/gi,name:"eval()"},{pattern:/\bFunction\s*\(/gi,name:"Function()"},{pattern:/\bsetTimeout\s*\(/gi,name:"setTimeout()"},{pattern:/\bsetInterval\s*\(/gi,name:"setInterval()"},{pattern:/\bimport\s*\(/gi,name:"dynamic import()"},{pattern:/\brequire\s*\(/gi,name:"require()"},{pattern:/\b__proto__\b/gi,name:"__proto__"},{pattern:/\bconstructor\b/gi,name:"constructor"},{pattern:/\bprototype\b/gi,name:"prototype"}];for(let{pattern:Q,name:G}of J)if(Q.test(Y))Z.push(`Potentially dangerous pattern detected: ${G}`);if(Y.includes("\x00"))Y=Y.replace(/\0/g,""),X=!0,Z.push("Null bytes removed from expression");return{value:Y,modified:X,warnings:Z}}function HK($,Z={}){return $.map((Y)=>e7(Y,Z))}function aY($){let Z={};for(let[Y,X]of Object.entries($)){if(!H3.isValidVariableName(Y))continue;if(typeof X==="string"){let J=e7(X);Z[Y]=J.value}else if(Array.isArray(X))Z[Y]=X.map((J)=>typeof J==="string"?e7(J).value:J);else if(typeof X==="object"&&X!==null)Z[Y]=aY(X);else Z[Y]=X}return Z}var H3;var OK=D(()=>{H3={isValidFilePath($,Z){let Y=$.replace(/\\/g,"/");if(Y.includes("\x00"))return!1;if(Y.includes("../")||Y.includes("..\\")||Y===".."||Y.startsWith("../")||Y.endsWith("/..")||Y.includes("/..\\")||Y.includes("\\../"))return!1;if(/^[a-z][a-z0-9+.-]*:/i.test(Y))return!1;if(Y.startsWith("/")){if(["/etc/","/root/","/var/","/usr/","/bin/","/sbin/","/proc/","/sys/","/dev/","/boot/","/home/","/private/","/Library/","/System/"].some((Q)=>Y===Q.slice(0,-1)||Y.startsWith(Q)))return!1}if(/^[a-z]:/i.test(Y)){if(["Windows/","Windows\\","System32/","System32\\","Program Files/","Program Files\\"].some((Q)=>Y.includes(Q)))return!1}if(Z){let J=oY.resolve(Z,$),Q=oY.resolve(Z);if(!J.startsWith(Q+oY.sep)&&J!==Q)return!1}return!0},isValidVariableName($){return/^[a-z_$]\w*$/i.test($)},isValidDirectiveName($){return/^[a-z][\w-]*$/i.test($)},isSafeContent($){return![/<script[^>]*>[\s\S]*?<\/script>/i,/javascript:/i,/data:text\/html/i,/vbscript:/i,/on\w+\s*=/i].some((Y)=>Y.test($))}}});var LK=D(()=>{B3();UK();zK();OK();U3()});var X1=D(()=>{LK()});function tY($,Z,Y,X){let J=$;J=J.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,W,_)=>{if(!_&&W.includes(":")){let B=W.split(":"),U=W,z=B.length>1?B[1]:"";if(z&&Z[z])_=Z[z];else if(U.startsWith("og:")&&Z.openGraph&&Z.openGraph[B[1]])_=Z.openGraph[B[1]];else _="";return _?`<meta property="${e(U)}" content="${e(_)}">`:""}return _?`<meta name="${e(W)}" content="${e(_)}">`:""});let Q=/@metaTag\s*\(/g,G;while((G=Q.exec(J))!==null){let K=G.index,W=K+G[0].length-1,_=1,B=W+1;while(B<J.length&&_>0){if(J[B]==="(")_++;else if(J[B]===")"){if(_--,_===0)break}B++}if(_!==0)break;let U=J.substring(W+1,B).trim(),z=B+1,q=(()=>{try{let j=k0(U,Z);if(!j)return"";let H="<meta";if(j.name)H+=` name="${e(String(j.name))}"`;if(j.property)H+=` property="${e(String(j.property))}"`;if(j.httpEquiv)H+=` http-equiv="${e(String(j.httpEquiv))}"`;if(j.content)H+=` content="${e(String(j.content))}"`;return H+=">",H}catch(j){let H=j instanceof Error?j.message:String(j);return $0("MetaTag",H,o.EVALUATION_ERROR)}})();J=J.substring(0,K)+q+J.substring(z),Q.lastIndex=0}return J}function eY($,Z,Y){let X=$,J=/@structuredData\s*\(/g,Q;while((Q=J.exec(X))!==null){let G=Q.index,K=G+Q[0].length-1,W=1,_=K+1;while(_<X.length&&W>0){if(X[_]==="(")W++;else if(X[_]===")"){if(W--,W===0)break}_++}if(W!==0)break;let B=X.substring(K+1,_).trim(),U=_+1,z=(()=>{try{let q=k0(B,Z);if(!q)return"";if(!q["@context"])q["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(q).replace(/<\//g,"<\\/")}</script>`}catch(q){let j=q instanceof Error?q.message:String(q);return $0("StructuredData",j,o.EVALUATION_ERROR)}})();X=X.substring(0,G)+z+X.substring(U),J.lastIndex=0}return X}function $X($,Z,Y,X){let J=$,Q=/@seo\s*\(\s*\{/g,G;while((G=Q.exec(J))!==null){let K=J.indexOf("{",G.index+4),W=1,_=K+1,B=null,U=!1;while(_<J.length&&W>0){let F=J[_];if(U){U=!1,_++;continue}if(F==="\\"&&B){U=!0,_++;continue}if(B){if(F===B)B=null;_++;continue}if(F==='"'||F==="'"||F==="`"){B=F,_++;continue}if(F==="{")W++;else if(F==="}")W--;_++}if(W!==0)break;let z=J.substring(_).match(/^\s*\)/);if(!z)break;let q=_+z[0].length,j=J.substring(K,_),H=J.substring(G.index,q),O=((F)=>{try{let L=k0(F,Z);if(!L)return"";let V="";if(L.title)V+=`<title>${e(L.title)}</title>
1847
1847
  `,V+=`<meta name="title" content="${e(L.title)}">
1848
1848
  `;if(L.description)V+=`<meta name="description" content="${e(L.description)}">
1849
1849
  `;if(L.keywords){let A=Array.isArray(L.keywords)?L.keywords.join(", "):L.keywords;V+=`<meta name="keywords" content="${e(A)}">
@@ -1865,7 +1865,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
1865
1865
  `}if(A.site)V+=`<meta name="twitter:site" content="${e(A.site)}">
1866
1866
  `;if(A.creator)V+=`<meta name="twitter:creator" content="${e(A.creator)}">
1867
1867
  `}if(L.structuredData){let A=JSON.stringify(L.structuredData).replace(/<\//g,"<\\/");V+=`<script type="application/ld+json">${A}</script>
1868
- `}return V.trim()}catch(L){let V=L instanceof Error?L.message:String(L);return $0("SEO",`Error processing @seo directive: ${V}`,o.EVALUATION_ERROR)}})(j);J=J.substring(0,G.index)+O+J.substring(q),Q.lastIndex=G.index+O.length}return J}function YX($,Z,Y){if(Y.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||Y.skipDefaultSeoTags===!0)return $;let X=Z.__stx_runtime_head;if(!!(X?.title||X?.meta?.some((U)=>U.property==="og:title"||U.name==="og:title"||U.name==="twitter:title"||U.name==="description")))return $;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test($))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let Q=$.includes("<title>")||$.includes("</title>"),G="";if(Z.title)G=Z.title;else if(Z.meta&&Z.meta.title)G=Z.meta.title;else if(Y.seo?.defaultConfig?.title)G=Y.seo.defaultConfig.title;else G=Y.defaultTitle||"stx Project";let K="";if(Z.description)K=Z.description;else if(Z.meta&&Z.meta.description)K=Z.meta.description;else if(Y.seo?.defaultConfig?.description)K=Y.seo.defaultConfig.description;else K=Y.defaultDescription||"A website built with stx templating engine";let W="";if(Z.image)W=Z.image;else if(Z.meta&&Z.meta.image)W=Z.meta.image;else if(Z.openGraph&&Z.openGraph.image)W=Z.openGraph.image;else if(Y.seo?.defaultImage)W=Y.seo.defaultImage;else if(Y.defaultImage)W=Y.defaultImage;let _=`
1868
+ `}return V.trim()}catch(L){let V=L instanceof Error?L.message:String(L);return $0("SEO",`Error processing @seo directive: ${V}`,o.EVALUATION_ERROR)}})(j);J=J.substring(0,G.index)+O+J.substring(q),Q.lastIndex=G.index+O.length}return J}function ZX($,Z,Y){if(Y.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||Y.skipDefaultSeoTags===!0)return $;let X=Z.__stx_runtime_head;if(!!(X?.title||X?.meta?.some((U)=>U.property==="og:title"||U.name==="og:title"||U.name==="twitter:title"||U.name==="description")))return $;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test($))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let Q=$.includes("<title>")||$.includes("</title>"),G="";if(Z.title)G=Z.title;else if(Z.meta&&Z.meta.title)G=Z.meta.title;else if(Y.seo?.defaultConfig?.title)G=Y.seo.defaultConfig.title;else G=Y.defaultTitle||"stx Project";let K="";if(Z.description)K=Z.description;else if(Z.meta&&Z.meta.description)K=Z.meta.description;else if(Y.seo?.defaultConfig?.description)K=Y.seo.defaultConfig.description;else K=Y.defaultDescription||"A website built with stx templating engine";let W="";if(Z.image)W=Z.image;else if(Z.meta&&Z.meta.image)W=Z.meta.image;else if(Z.openGraph&&Z.openGraph.image)W=Z.openGraph.image;else if(Y.seo?.defaultImage)W=Y.seo.defaultImage;else if(Y.defaultImage)W=Y.defaultImage;let _=`
1869
1869
  <!-- stx SEO Tags -->
1870
1870
  <meta name="title" content="${e(G)}">
1871
1871
  <meta name="description" content="${e(K)}">
@@ -1889,7 +1889,7 @@ ${$.map((Q)=>{let G=Q.startsWith("http")?Q:`${Y}${Q.startsWith("/")?"":"/"}${Q}`
1889
1889
  </sitemap>`}).join(`
1890
1890
  `)}
1891
1891
  </sitemapindex>`}async function sL($,Z){let{extensions:Y=[".stx",".html",".htm"],ignore:X=["_*",".*","node_modules","components","partials","layouts"]}=Z,J=[],Q=Y.length===1?`*${Y[0]}`:`*{${Y.join(",")}}`,G=new Bun.Glob(`**/${Q}`);for await(let K of G.scan($)){if(X.some((z)=>{if(z.startsWith("*"))return K.includes(z.slice(1));return K.startsWith(z)||K.includes(`/${z}`)}))continue;let _=K.replace(/\\/g,"/").replace(/index\.(stx|html|htm)$/,"").replace(/\.(stx|html|htm)$/,"");if(!_.startsWith("/"))_=`/${_}`;if(_!=="/"&&_.endsWith("/"))_=_.slice(0,-1);let B=`${$}/${K}`,U;try{let z=await Bun.file(B).stat();if(z)U=new Date(z.mtime).toISOString().split("T")[0]}catch{}J.push({loc:_||"/",lastmod:U,priority:_==="/"?1:0.5})}return J.sort((K,W)=>K.loc.localeCompare(W.loc)),J}function FK($){let Z=[];for(let Y of $.rules){if(Z.push(`User-agent: ${Y.userAgent}`),Y.allow)for(let X of Y.allow)Z.push(`Allow: ${X}`);if(Y.disallow)for(let X of Y.disallow)Z.push(`Disallow: ${X}`);if(Y.crawlDelay!==void 0)Z.push(`Crawl-delay: ${Y.crawlDelay}`);Z.push("")}if($.sitemap){let Y=Array.isArray($.sitemap)?$.sitemap:[$.sitemap];for(let X of Y)Z.push(`Sitemap: ${X}`)}if($.host)Z.push(`Host: ${$.host}`);return Z.join(`
1892
- `).trim()}function rL($){return FK({rules:[{userAgent:"*",allow:["/"]}],sitemap:$})}function oL($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}var O3,L3;var F3=D(()=>{X1();h0();O3={name:"meta",handler:($,Z,Y,X)=>{if(Z.length<1)return $0("Meta","meta directive requires at least the meta name",o.INVALID_DIRECTIVE_SYNTAX);let J=Z[0].replace(/['"]/g,""),Q=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${e(J)}" content="${e(Q)}">`},hasEndTag:!1},L3={name:"structuredData",handler:($,Z,Y,X)=>{if($.trim()==="")return $0("StructuredData","structuredData directive requires JSON-LD content",o.INVALID_DIRECTIVE_SYNTAX);try{let J=JSON.parse($);if(!J["@context"])J["@context"]="https://schema.org";if(!J["@type"])return $0("StructuredData","structuredData requires @type property",o.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(J)}</script>`}catch(J){let Q=J instanceof Error?J.message:String(J);return $0("StructuredData",Q,o.EVALUATION_ERROR)}},hasEndTag:!0}});import aL from"fs";import U$ from"path";async function XX($,Z){if(!$.webComponents?.enabled)return[];let Y=$.webComponents.components||[],X=[];if(Y.length>0){if($.debug)console.log(`Building ${Y.length} web components...`);for(let J of Y)try{let Q=await tL(J,$,Z);if(Q)X.push(Q)}catch(Q){if(console.error(`Error building web component ${J.name}:`,Q),$.debug)throw Q}}return X}async function tL($,Z,Y){let{name:X,file:J,tag:Q,extends:G}=$;if(!X||!J||!Q)return console.error("Invalid web component configuration, missing required fields:",$),null;let K=null;if(U$.isAbsolute(J)&&await t(J))K=J;else if(Z.componentsDir){let H=U$.join(Z.componentsDir,J);if(await t(H))K=H}if(!K)K=await $4(J,process.cwd(),Z,Y);if(!K)return console.error(`Web component source file not found: ${J}`),null;let W=await Bun.file(K).text();Y.add(K);let B=($.outputFormat||"js")==="ts",U=B?$F({name:X,tag:Q,baseElement:G,source:W,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[],attributeTypes:$.attributeTypes||{}}):eL({name:X,tag:Q,baseElement:G,source:W,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[]}),z=Z.webComponents?.outputDir||"dist/web-components";await aL.promises.mkdir(z,{recursive:!0});let q=B?"ts":"js",j=U$.join(z,`${Q}.${q}`);if(await Bun.write(j,U),Z.debug)console.log(`Built web component ${X} -> ${j}`);return j}function eL($){let{name:Z,tag:Y,baseElement:X="HTMLElement",source:J,shadowDOM:Q,template:G,styleSource:K,attributes:W=[]}=$,_=J.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!Q)_=_.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),_=_.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),_=_.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),_=_.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");let B="";if(K)B=`<link rel="stylesheet" href="${K}">`;return`/**
1892
+ `).trim()}function rL($){return FK({rules:[{userAgent:"*",allow:["/"]}],sitemap:$})}function oL($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}var O3,L3;var F3=D(()=>{X1();h0();O3={name:"meta",handler:($,Z,Y,X)=>{if(Z.length<1)return $0("Meta","meta directive requires at least the meta name",o.INVALID_DIRECTIVE_SYNTAX);let J=Z[0].replace(/['"]/g,""),Q=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${e(J)}" content="${e(Q)}">`},hasEndTag:!1},L3={name:"structuredData",handler:($,Z,Y,X)=>{if($.trim()==="")return $0("StructuredData","structuredData directive requires JSON-LD content",o.INVALID_DIRECTIVE_SYNTAX);try{let J=JSON.parse($);if(!J["@context"])J["@context"]="https://schema.org";if(!J["@type"])return $0("StructuredData","structuredData requires @type property",o.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(J)}</script>`}catch(J){let Q=J instanceof Error?J.message:String(J);return $0("StructuredData",Q,o.EVALUATION_ERROR)}},hasEndTag:!0}});import aL from"fs";import z$ from"path";async function YX($,Z){if(!$.webComponents?.enabled)return[];let Y=$.webComponents.components||[],X=[];if(Y.length>0){if($.debug)console.log(`Building ${Y.length} web components...`);for(let J of Y)try{let Q=await tL(J,$,Z);if(Q)X.push(Q)}catch(Q){if(console.error(`Error building web component ${J.name}:`,Q),$.debug)throw Q}}return X}async function tL($,Z,Y){let{name:X,file:J,tag:Q,extends:G}=$;if(!X||!J||!Q)return console.error("Invalid web component configuration, missing required fields:",$),null;let K=null;if(z$.isAbsolute(J)&&await t(J))K=J;else if(Z.componentsDir){let H=z$.join(Z.componentsDir,J);if(await t(H))K=H}if(!K)K=await $4(J,process.cwd(),Z,Y);if(!K)return console.error(`Web component source file not found: ${J}`),null;let W=await Bun.file(K).text();Y.add(K);let B=($.outputFormat||"js")==="ts",U=B?$F({name:X,tag:Q,baseElement:G,source:W,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[],attributeTypes:$.attributeTypes||{}}):eL({name:X,tag:Q,baseElement:G,source:W,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[]}),z=Z.webComponents?.outputDir||"dist/web-components";await aL.promises.mkdir(z,{recursive:!0});let q=B?"ts":"js",j=z$.join(z,`${Q}.${q}`);if(await Bun.write(j,U),Z.debug)console.log(`Built web component ${X} -> ${j}`);return j}function eL($){let{name:Z,tag:Y,baseElement:X="HTMLElement",source:J,shadowDOM:Q,template:G,styleSource:K,attributes:W=[]}=$,_=J.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!Q)_=_.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),_=_.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),_=_.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),_=_.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");let B="";if(K)B=`<link rel="stylesheet" href="${K}">`;return`/**
1893
1893
  * ${Z} Web Component
1894
1894
  * Auto-generated from stx component
1895
1895
  */
@@ -2120,7 +2120,7 @@ declare global {
2120
2120
 
2121
2121
  // Register the web component
2122
2122
  customElements.define('${Y}', ${B});
2123
- `}function V3($){let Z=$.split("").reduce((Y,X)=>(Y<<5)-Y+X.charCodeAt(0)|0,0);return Math.abs(Z).toString(36).slice(0,8)}function VK($,Z,Y={}){let X={...JX,...Y},J=V3(Z);switch(X.strategy){case"shadow":return $;case"prefix":return YF($,X.prefix||Z,X.preserveOriginal);case"attribute":return ZF($,J,X.attributeName||"data-v",X.preserveOriginal);case"bem":return XF($,Z,X.preserveOriginal);default:return $}}function ZF($,Z,Y,X){let J=`[${Y}-${Z}]`;return $.replace(/([.#]?[\w-]+|\*)\s*(\{|,)/g,(Q,G,K)=>{if(G.startsWith("@"))return Q;if(/^(?::root|:host|html|body)$/i.test(G))return Q;return`${X?`${G}${J}`:`${G}${J}`}${K}`})}function YF($,Z,Y){return $.replace(/\.([a-z_][\w-]*)/gi,(X,J)=>{if(J.startsWith(Z))return X;let Q=`${Z}__${J}`;return Y?`.${Q}`:`.${Q}`})}function XF($,Z,Y){let X=Z.replace(/[^a-z0-9]/gi,"-");return $.replace(/\.([a-z_][\w-]*)/gi,(J,Q)=>{if(Q.includes("__")||Q.includes("--")){if(!Q.startsWith(X))return`.${X}__${Q}`;return J}let G=`${X}__${Q}`;return Y?`.${G}`:`.${G}`})}function NK($,Z,Y={}){let X={...JX,...Y};if(X.strategy==="shadow")return $;if(X.strategy==="attribute"){let J=V3(Z),G=`${X.attributeName||"data-v"}-${J}`;return $.replace(/<([a-z][a-z0-9-]*)([^>]*)>/gi,(K,W,_)=>{if(/^(?:script|style|!--)$/i.test(W))return K;let B=_.trimEnd().endsWith("/"),U=B?_.slice(0,-1):_;return`<${W}${U} ${G}${B?"/":""}>`})}if(X.strategy==="prefix"||X.strategy==="bem"){let J=X.strategy==="bem"?Z.replace(/[^a-z0-9]/gi,"-"):X.prefix||Z;return $.replace(/\bclass\s*=\s*["']([^"']+)["']/gi,(Q,G)=>{return`class="${G.split(/\s+/).map((W)=>{if(!W)return W;if(W.startsWith(J))return W;return`${J}__${W}`}).join(" ")}"`})}return $}function JF($,Z={}){let Y={...JX,...Z},X=V3($);return`${Y.attributeName||"data-v"}-${X}`}function QF($,Z,Y={}){let X="",J=$.replace(/<style([^>]*)>([\s\S]*?)<\/style>/gi,(G,K,W)=>{if(/\bscoped\b/i.test(K)||Y.strategy!=="shadow")X+=`${VK(W,Z,Y)}
2123
+ `}function V3($){let Z=$.split("").reduce((Y,X)=>(Y<<5)-Y+X.charCodeAt(0)|0,0);return Math.abs(Z).toString(36).slice(0,8)}function VK($,Z,Y={}){let X={...XX,...Y},J=V3(Z);switch(X.strategy){case"shadow":return $;case"prefix":return YF($,X.prefix||Z,X.preserveOriginal);case"attribute":return ZF($,J,X.attributeName||"data-v",X.preserveOriginal);case"bem":return XF($,Z,X.preserveOriginal);default:return $}}function ZF($,Z,Y,X){let J=`[${Y}-${Z}]`;return $.replace(/([.#]?[\w-]+|\*)\s*(\{|,)/g,(Q,G,K)=>{if(G.startsWith("@"))return Q;if(/^(?::root|:host|html|body)$/i.test(G))return Q;return`${X?`${G}${J}`:`${G}${J}`}${K}`})}function YF($,Z,Y){return $.replace(/\.([a-z_][\w-]*)/gi,(X,J)=>{if(J.startsWith(Z))return X;let Q=`${Z}__${J}`;return Y?`.${Q}`:`.${Q}`})}function XF($,Z,Y){let X=Z.replace(/[^a-z0-9]/gi,"-");return $.replace(/\.([a-z_][\w-]*)/gi,(J,Q)=>{if(Q.includes("__")||Q.includes("--")){if(!Q.startsWith(X))return`.${X}__${Q}`;return J}let G=`${X}__${Q}`;return Y?`.${G}`:`.${G}`})}function NK($,Z,Y={}){let X={...XX,...Y};if(X.strategy==="shadow")return $;if(X.strategy==="attribute"){let J=V3(Z),G=`${X.attributeName||"data-v"}-${J}`;return $.replace(/<([a-z][a-z0-9-]*)([^>]*)>/gi,(K,W,_)=>{if(/^(?:script|style|!--)$/i.test(W))return K;let B=_.trimEnd().endsWith("/"),U=B?_.slice(0,-1):_;return`<${W}${U} ${G}${B?"/":""}>`})}if(X.strategy==="prefix"||X.strategy==="bem"){let J=X.strategy==="bem"?Z.replace(/[^a-z0-9]/gi,"-"):X.prefix||Z;return $.replace(/\bclass\s*=\s*["']([^"']+)["']/gi,(Q,G)=>{return`class="${G.split(/\s+/).map((W)=>{if(!W)return W;if(W.startsWith(J))return W;return`${J}__${W}`}).join(" ")}"`})}return $}function JF($,Z={}){let Y={...XX,...Z},X=V3($);return`${Y.attributeName||"data-v"}-${X}`}function QF($,Z,Y={}){let X="",J=$.replace(/<style([^>]*)>([\s\S]*?)<\/style>/gi,(G,K,W)=>{if(/\bscoped\b/i.test(K)||Y.strategy!=="shadow")X+=`${VK(W,Z,Y)}
2124
2124
  `;else X+=`${W}
2125
2125
  `;return""});return{html:NK(J,Z,Y),css:X.trim()}}function P5($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function GF($){let{name:Z,tag:Y,baseElement:X="HTMLElement",template:J,styles:Q="",shadowDOM:G=!0,properties:K={},lifecycle:W={},events:_={},methods:B={},state:U={}}=$,z=Z.replace(/\W/g,""),q=Object.keys(K),j=q.filter((T)=>K[T].attribute!==!1).map((T)=>K[T].attribute||P5(T)),H=q.map((T)=>{let I=K[T],E=I.default!==void 0?JSON.stringify(I.default):I.type==="string"?'""':I.type==="number"?"0":I.type==="boolean"?"false":I.type==="array"?"[]":"{}";return` this._${T} = ${E};`}).join(`
2126
2126
  `),O=q.map((T)=>{let I=K[T],E=I.attribute!==!1?I.attribute||P5(T):null,S=I.reflect&&E?`
@@ -2966,16 +2966,16 @@ ${B}
2966
2966
  }
2967
2967
 
2968
2968
  customElements.define('${Z}', ${G});
2969
- `}async function QX($,Z,Y,X){if(Z.length<1)return $0("WebComponent","@webcomponent directive requires at least the tag name parameter",o.INVALID_DIRECTIVE_SYNTAX);let J=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[U$.join(U$.dirname(X),G,`${J}.stx`),U$.join(process.cwd(),G,`${J}.stx`),U$.join(U$.dirname(X),`${J}.stx`)],W=null;for(let U of K)if(await t(U)){W=await Bun.file(U).text();break}if(!W)return $0("WebComponent",`Component file not found: ${J}.stx`,o.FILE_NOT_FOUND);let _=AK(W,J);return`<script type="module">
2969
+ `}async function JX($,Z,Y,X){if(Z.length<1)return $0("WebComponent","@webcomponent directive requires at least the tag name parameter",o.INVALID_DIRECTIVE_SYNTAX);let J=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[z$.join(z$.dirname(X),G,`${J}.stx`),z$.join(process.cwd(),G,`${J}.stx`),z$.join(z$.dirname(X),`${J}.stx`)],W=null;for(let U of K)if(await t(U)){W=await Bun.file(U).text();break}if(!W)return $0("WebComponent",`Component file not found: ${J}.stx`,o.FILE_NOT_FOUND);let _=AK(W,J);return`<script type="module">
2970
2970
  ${wK(_)}
2971
- </script>`}var JX;var GX=D(()=>{X1();q0();JX={strategy:"attribute",attributeName:"data-v",preserveOriginal:!0}});var RK={};Q0(RK,{timingPlugin:()=>qF,pluginManager:()=>WX,definePlugin:()=>x5,debugPlugin:()=>zF,createVariablesPlugin:()=>jF,createFilterPlugin:()=>UF,createDirectivePlugin:()=>BF,PluginManager:()=>KX});function x5($){return $}class KX{plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Z){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Y of $.dependencies)if(!this.plugins.has(Y))throw Error(`Plugin "${$.name}" depends on "${Y}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Z);this.sortPlugins()}async unregister($){let Z=this.plugins.get($);if(!Z)return!1;for(let[Y,X]of this.plugins)if(X.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Y}" depends on it`);if(Z.onUnregister)await Z.onUnregister();return this.plugins.delete($),this.sortPlugins(),!0}get($){return this.plugins.get($)}has($){return this.plugins.has($)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let $=[];for(let Z of this.sortedPlugins)if(Z.registerDirectives)$.push(...Z.registerDirectives());return $}getAllFilters(){let $={};for(let Z of this.sortedPlugins)if(Z.registerFilters)Object.assign($,Z.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Z){return this.runDirectiveHooks("beforeDirective",$,Z)}async runAfterDirective($,Z){return this.runDirectiveHooks("afterDirective",$,Z)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Z of this.sortedPlugins)if(Z.onError)try{let Y=await Z.onError($);if(Y){if(Y.template!==void 0)$.template=Y.template;if(Y.context)$.context={...$.context,...Y.context};if(Y.metadata)$.metadata={...$.metadata,...Y.metadata};if(Y.skip)return $}}catch(Y){console.error(`Error in plugin "${Z.name}" onError hook:`,Y)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let Y={...Z};for(let X of this.sortedPlugins){let J=X[$];if(J)try{let Q=await J(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 "${X.name}" ${$} hook:`,Q)}}return Y}async runDirectiveHooks($,Z,Y){let X={...Y};for(let J of this.sortedPlugins){let Q=J[$];if(Q)try{let G=await Q(Z,X);if(G){if(G.template!==void 0)X.template=G.template;if(G.context)X.context={...X.context,...G.context};if(G.metadata)X.metadata={...X.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${J.name}" ${$} hook:`,G)}}return X}}function BF($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function UF($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function jF($){return x5({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var WX,zF,qF;var _X=D(()=>{WX=new KX;zF=x5({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess($){console.log("[stx-debug] beforeProcess:",$.filePath)},afterParse($){console.log("[stx-debug] afterParse:",$.template.length,"chars")},beforeDirective($,Z){console.log("[stx-debug] beforeDirective:",$)},afterDirective($,Z){console.log("[stx-debug] afterDirective:",$)},beforeRender($){console.log("[stx-debug] beforeRender")},afterRender($){console.log("[stx-debug] afterRender:",$.template.length,"chars")},onError($){console.error("[stx-debug] onError:",$.error.message,"in phase:",$.phase)}}),qF=x5({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Z=$.metadata.startTime;if(Z){let Y=performance.now()-Z;console.log(`[stx-timing] Processing took ${Y.toFixed(2)}ms`)}}})});var IK={};Q0(IK,{validateConfig:()=>EK,loadStxConfig:()=>S0,defineStxConfig:()=>TK,defaultConfig:()=>a0,config:()=>t0});import BX from"fs";import i0 from"path";import{loadConfigWithResult as HF}from"bunfig";function OF($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let X=i0.join(process.cwd(),"resources","views"),J=i0.join(process.cwd(),"resources","layouts");if(BX.existsSync(X)&&BX.existsSync(J))return{root:"resources",pagesDir:"views"};let Q=i0.join(process.cwd(),"resources","views","pages");if(BX.existsSync(Q))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}async function S0($){if(!$){if(v5)return v5;if(N3)return N3}let Z=$?i0.resolve($):process.cwd(),Y=MK.get(Z);if(Y)return Y;let X=(async()=>{let Q=(await HF({name:"stx",alias:"ui",cwd:Z,defaultConfig:a0,verbose:!1})).config,G=OF(Q.root,Q.pagesDir);if(Q.root=G.root,Q.pagesDir=G.pagesDir,Q.root&&Q.root!=="."){let K=Q.root;if(Q.partialsDir&&!i0.isAbsolute(Q.partialsDir))Q.partialsDir=i0.join(K,Q.partialsDir);if(Q.componentsDir&&!i0.isAbsolute(Q.componentsDir))Q.componentsDir=i0.join(K,Q.componentsDir);if(Q.layoutsDir&&!i0.isAbsolute(Q.layoutsDir))Q.layoutsDir=i0.join(K,Q.layoutsDir)}if(Q.plugins&&Q.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (_X(),RK)),W=[],_=[];for(let B of Q.plugins){let U=typeof B==="string"?B:B[0],z=typeof B==="string"?{}:B[1]||{};try{let q,j;try{q=await import(U),j=i0.dirname(K0.resolve(U))}catch{let O=i0.resolve(process.cwd(),U);q=await import(O),j=i0.dirname(O)}let H=q.default||q;if(K.register(H,Q),H.components){let O=i0.resolve(j,H.components);W.push(O)}if(H.pages){let O=i0.resolve(j,H.pages),F=z.path||"/";_.push({dir:O,prefix:F})}if(H.setup){let O={addDirective:(F)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(F)},addRoute:(F,L)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[F]=L},addMiddleware:(F)=>{Q.middleware=Q.middleware||[],Q.middleware.push(F)},pluginDir:j,config:Q};await H.setup(z,O)}console.log(`[stx] Plugin loaded: ${H.name||U}`)}catch(q){console.warn(`[stx] Failed to load plugin ${U}:`,q.message)}}Q._pluginComponentDirs=W,Q._pluginPageDirs=_}return Q})();if(MK.set(Z,X),!$)N3=X,X.then((J)=>{v5=J}).catch(()=>{});return X}function TK($){return $}function EK($){let Z=[],Y=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let X=["auto","manual","sections"];if(!X.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${X.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let X=["json","yaml","yml","js"];if(!X.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${X.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let X=["AA","AAA"];if(!X.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${X.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let X=["progressive","islands"];if(!X.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${X.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let X=["none","eager","lazy"];if(!X.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${X.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((X,J)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${J}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${J}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((X,J)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${J}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${J}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${J}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Y.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)Y.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let X=["fullscreen","standalone","minimal-ui","browser"];if(!X.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let X=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!X.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.routes){let X=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((J,Q)=>{if(!J.pattern||typeof J.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(J.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(J.maxAgeSeconds!==void 0&&(typeof J.maxAgeSeconds!=="number"||J.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].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))Z.push({path:`pwa.routes[${Q}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((J)=>typeof J!=="number"||J<16||J>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let X=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!X.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Y.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Y.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:Y}}var a0,v5=null,MK,N3=null,t0;var m0=D(()=>{x6();d6();iZ();u6();m6();xY();nY();rG();F3();GX();a0={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,cachePath:".stx/cache",cacheVersion:"1.0.0",build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:tZ,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:QX,hasEndTag:!1,description:"Include a web component in the template"},y6,P6,O3,L3,v6,g6,h6,f6,GG,rZ,n7,r7,...sG],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"#app-content",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};MK=new Map;t0=new Proxy(a0,{get($,Z){if(v5&&Z in v5)return v5[Z];if(!N3)S0().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});var M3={};Q0(M3,{resetCssCache:()=>FF,resetCrosswindCache:()=>VF,rebuildCrosswindCSS:()=>Y4,loadCrosswindConfig:()=>qX,loadCrosswind:()=>zX,injectCrosswindCSS:()=>V0,getCachedCSS:()=>NF,generateCrosswindCSS:()=>R3,extractClassNames:()=>w3,buildCrosswindCSS:()=>h5});import DK from"fs";import F0 from"path";async function kK($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig}}catch{}return null}function LF(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"",Y=process.cwd();while(Y!==F0.dirname(Y))$.push(F0.join(Y,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(F0.join(Y,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(F0.join(Y,"node_modules","@stacksjs","crosswind","dist","index.js")),Y=F0.dirname(Y);if(Z){let X=[F0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),F0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),F0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),F0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),F0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),F0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...X)}return $.push(F0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(F0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function zX(){if(UX)return g5;UX=!0;try{let $=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Y of $){let X=await kK(Y);if(X)return g5=X,console.log(`${R.green}[Crosswind]${R.reset} CSS engine loaded`),g5}let Z=LF();for(let Y of Z)if(await Bun.file(Y).exists()){let X=await kK(Y);if(X)return g5=X,console.log(`${R.green}[Crosswind]${R.reset} CSS engine loaded from ${F0.dirname(F0.dirname(Y))}`),g5}throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${R.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${R.reset}`),console.warn(`${R.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${R.reset}`),null}}function FF(){A3.clear()}function VF(){g5=null,UX=!1,T1=null,Z4="",A3.clear()}async function qX($){try{let{loadConfigWithResult:Z}=await import("bunfig"),Y=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Y?.path||!Y.config||Object.keys(Y.config).length===0)return null;let X=F0.relative($,Y.path);return console.log(`${R.green}[Crosswind]${R.reset} Loaded config from ${X||Y.path}`),Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${R.yellow}[Crosswind]${R.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}async function h5($){if(f5)return Z4;f5=!0;try{let Z=await zX();if(!Z||!Z.build)return f5=!1,"";if(!T1)T1=await qX($);if(!T1)return f5=!1,"";let Y=Z.defaultConfig?.theme||{},X=T1.theme||{},J={...Z.defaultConfig,...T1,theme:{...Y,...X,extend:{...Y.extend||{},...X.extend||{}}}},Q=performance.now(),G=await Z.build(J),K=performance.now()-Q;if(Z4=G.css,console.log(`${R.cyan}[Crosswind]${R.reset} Built ${G.classes.size} classes in ${K.toFixed(1)}ms`),J.output){let W=F0.isAbsolute(J.output)?J.output:F0.join($,J.output),_=F0.dirname(W);if(!DK.existsSync(_))DK.mkdirSync(_,{recursive:!0});await Bun.write(W,G.css)}return f5=!1,G.css}catch(Z){return console.error(`${R.red}[Crosswind]${R.reset} Build error:`,Z),f5=!1,Z4}}async function Y4($){T1=null,await h5($)}function NF(){return Z4}function w3($){let Z=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,X=Y.exec($);while(X!==null){for(let G of X[1].split(/\s+/))if(G.trim())Z.add(G.trim());X=Y.exec($)}let J=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,Q=J.exec($);while(Q!==null){let G=Q[1].match(/'([^']+)'/g);if(G){for(let K of G)for(let W of K.slice(1,-1).split(/\s+/))if(W.trim())Z.add(W.trim())}Q=J.exec($)}return Z}async function R3($,Z){try{let Y=await zX();if(!Y)return"";let X=w3($);if(X.size===0)return"";let J=[...X].sort().join(" "),Q=A3.get(J);if(Q!==void 0)return Q;let G=Z?F0.resolve(Z):process.cwd();if(!T1){let V=null;try{let{loadStxConfig:A}=await Promise.resolve().then(() => (m0(),IK)),N=await A(G);if(N.css)if(typeof N.css==="string"){let w=F0.isAbsolute(N.css)?N.css:F0.resolve(G,N.css);if(await Bun.file(w).exists()){let M=await import(w);V=M.default||M,console.log(`${R.green}[Crosswind]${R.reset} Loaded config from stx.config.ts \u2192 ${N.css}`)}}else{if(V={content:N.css.content||[],preflight:N.css.preflight??!0,minify:N.css.minify??!1},N.css.config){let w=F0.isAbsolute(N.css.config)?N.css.config:F0.resolve(G,N.css.config);if(await Bun.file(w).exists()){let M=await import(w);V={...M.default||M,...V}}}console.log(`${R.green}[Crosswind]${R.reset} Using inline CSS config from stx.config.ts`)}}catch{}T1=V||await qX(G)}let K=Y.defaultConfig||Y.config,W=T1||{},_=K.theme||{},U=(W.theme||{}).extend||{},z={..._};if(Object.keys(U).length>0)z.extend=U;let q=[...K.safelist||[],...W.safelist||[]],j={...K,...W,content:[],output:"",preflight:!0,minify:!1,theme:z,safelist:q},H=new Y.CSSGenerator(j);for(let V of q)H.generate(V);for(let V of X)H.generate(V);let O=H.toCSS(!0,!1),F=j.shortcuts||W.shortcuts||{};for(let[V,A]of Object.entries(F)){if(!X.has(V)&&!q.includes(V))continue;let N=A.split(/\s+/).filter(Boolean);for(let w of N)H.generate(w)}O=H.toCSS(!0,!1);let L=O.split(`
2971
+ </script>`}var XX;var QX=D(()=>{X1();q0();XX={strategy:"attribute",attributeName:"data-v",preserveOriginal:!0}});var RK={};Q0(RK,{timingPlugin:()=>qF,pluginManager:()=>KX,definePlugin:()=>x5,debugPlugin:()=>zF,createVariablesPlugin:()=>jF,createFilterPlugin:()=>UF,createDirectivePlugin:()=>BF,PluginManager:()=>GX});function x5($){return $}class GX{plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Z){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Y of $.dependencies)if(!this.plugins.has(Y))throw Error(`Plugin "${$.name}" depends on "${Y}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Z);this.sortPlugins()}async unregister($){let Z=this.plugins.get($);if(!Z)return!1;for(let[Y,X]of this.plugins)if(X.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Y}" depends on it`);if(Z.onUnregister)await Z.onUnregister();return this.plugins.delete($),this.sortPlugins(),!0}get($){return this.plugins.get($)}has($){return this.plugins.has($)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let $=[];for(let Z of this.sortedPlugins)if(Z.registerDirectives)$.push(...Z.registerDirectives());return $}getAllFilters(){let $={};for(let Z of this.sortedPlugins)if(Z.registerFilters)Object.assign($,Z.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Z){return this.runDirectiveHooks("beforeDirective",$,Z)}async runAfterDirective($,Z){return this.runDirectiveHooks("afterDirective",$,Z)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Z of this.sortedPlugins)if(Z.onError)try{let Y=await Z.onError($);if(Y){if(Y.template!==void 0)$.template=Y.template;if(Y.context)$.context={...$.context,...Y.context};if(Y.metadata)$.metadata={...$.metadata,...Y.metadata};if(Y.skip)return $}}catch(Y){console.error(`Error in plugin "${Z.name}" onError hook:`,Y)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let Y={...Z};for(let X of this.sortedPlugins){let J=X[$];if(J)try{let Q=await J(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 "${X.name}" ${$} hook:`,Q)}}return Y}async runDirectiveHooks($,Z,Y){let X={...Y};for(let J of this.sortedPlugins){let Q=J[$];if(Q)try{let G=await Q(Z,X);if(G){if(G.template!==void 0)X.template=G.template;if(G.context)X.context={...X.context,...G.context};if(G.metadata)X.metadata={...X.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${J.name}" ${$} hook:`,G)}}return X}}function BF($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function UF($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function jF($){return x5({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var KX,zF,qF;var WX=D(()=>{KX=new GX;zF=x5({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess($){console.log("[stx-debug] beforeProcess:",$.filePath)},afterParse($){console.log("[stx-debug] afterParse:",$.template.length,"chars")},beforeDirective($,Z){console.log("[stx-debug] beforeDirective:",$)},afterDirective($,Z){console.log("[stx-debug] afterDirective:",$)},beforeRender($){console.log("[stx-debug] beforeRender")},afterRender($){console.log("[stx-debug] afterRender:",$.template.length,"chars")},onError($){console.error("[stx-debug] onError:",$.error.message,"in phase:",$.phase)}}),qF=x5({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Z=$.metadata.startTime;if(Z){let Y=performance.now()-Z;console.log(`[stx-timing] Processing took ${Y.toFixed(2)}ms`)}}})});var IK={};Q0(IK,{validateConfig:()=>EK,loadStxConfig:()=>S0,defineStxConfig:()=>TK,defaultConfig:()=>a0,config:()=>t0});import _X from"fs";import i0 from"path";import{loadConfigWithResult as HF}from"bunfig";function OF($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let X=i0.join(process.cwd(),"resources","views"),J=i0.join(process.cwd(),"resources","layouts");if(_X.existsSync(X)&&_X.existsSync(J))return{root:"resources",pagesDir:"views"};let Q=i0.join(process.cwd(),"resources","views","pages");if(_X.existsSync(Q))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}async function S0($){if(!$){if(v5)return v5;if(N3)return N3}let Z=$?i0.resolve($):process.cwd(),Y=MK.get(Z);if(Y)return Y;let X=(async()=>{let Q=(await HF({name:"stx",alias:"ui",cwd:Z,defaultConfig:a0,verbose:!1})).config,G=OF(Q.root,Q.pagesDir);if(Q.root=G.root,Q.pagesDir=G.pagesDir,Q.root&&Q.root!=="."){let K=Q.root;if(Q.partialsDir&&!i0.isAbsolute(Q.partialsDir))Q.partialsDir=i0.join(K,Q.partialsDir);if(Q.componentsDir&&!i0.isAbsolute(Q.componentsDir))Q.componentsDir=i0.join(K,Q.componentsDir);if(Q.layoutsDir&&!i0.isAbsolute(Q.layoutsDir))Q.layoutsDir=i0.join(K,Q.layoutsDir)}if(Q.plugins&&Q.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (WX(),RK)),W=[],_=[];for(let B of Q.plugins){let U=typeof B==="string"?B:B[0],z=typeof B==="string"?{}:B[1]||{};try{let q,j;try{q=await import(U),j=i0.dirname(K0.resolve(U))}catch{let O=i0.resolve(process.cwd(),U);q=await import(O),j=i0.dirname(O)}let H=q.default||q;if(K.register(H,Q),H.components){let O=i0.resolve(j,H.components);W.push(O)}if(H.pages){let O=i0.resolve(j,H.pages),F=z.path||"/";_.push({dir:O,prefix:F})}if(H.setup){let O={addDirective:(F)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(F)},addRoute:(F,L)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[F]=L},addMiddleware:(F)=>{Q.middleware=Q.middleware||[],Q.middleware.push(F)},pluginDir:j,config:Q};await H.setup(z,O)}console.log(`[stx] Plugin loaded: ${H.name||U}`)}catch(q){console.warn(`[stx] Failed to load plugin ${U}:`,q.message)}}Q._pluginComponentDirs=W,Q._pluginPageDirs=_}return Q})();if(MK.set(Z,X),!$)N3=X,X.then((J)=>{v5=J}).catch(()=>{});return X}function TK($){return $}function EK($){let Z=[],Y=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let X=["auto","manual","sections"];if(!X.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${X.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let X=["json","yaml","yml","js"];if(!X.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${X.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let X=["AA","AAA"];if(!X.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${X.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let X=["progressive","islands"];if(!X.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${X.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let X=["none","eager","lazy"];if(!X.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${X.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((X,J)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${J}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${J}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((X,J)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${J}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${J}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${J}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Y.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)Y.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let X=["fullscreen","standalone","minimal-ui","browser"];if(!X.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let X=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!X.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.routes){let X=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((J,Q)=>{if(!J.pattern||typeof J.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(J.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(J.maxAgeSeconds!==void 0&&(typeof J.maxAgeSeconds!=="number"||J.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].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))Z.push({path:`pwa.routes[${Q}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((J)=>typeof J!=="number"||J<16||J>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let X=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!X.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Y.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Y.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:Y}}var a0,v5=null,MK,N3=null,t0;var m0=D(()=>{x6();d6();lZ();u6();m6();PY();iY();rG();F3();QX();a0={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,cachePath:".stx/cache",cacheVersion:"1.0.0",build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:aZ,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:JX,hasEndTag:!1,description:"Include a web component in the template"},y6,P6,O3,L3,v6,g6,h6,f6,GG,sZ,n7,r7,...sG],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"#app-content",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};MK=new Map;t0=new Proxy(a0,{get($,Z){if(v5&&Z in v5)return v5[Z];if(!N3)S0().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});var M3={};Q0(M3,{resetCssCache:()=>FF,resetCrosswindCache:()=>VF,rebuildCrosswindCSS:()=>Y4,loadCrosswindConfig:()=>zX,loadCrosswind:()=>UX,injectCrosswindCSS:()=>V0,getCachedCSS:()=>NF,generateCrosswindCSS:()=>R3,extractClassNames:()=>w3,buildCrosswindCSS:()=>h5});import DK from"fs";import F0 from"path";async function kK($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig}}catch{}return null}function LF(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"",Y=process.cwd();while(Y!==F0.dirname(Y))$.push(F0.join(Y,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(F0.join(Y,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(F0.join(Y,"node_modules","@stacksjs","crosswind","dist","index.js")),Y=F0.dirname(Y);if(Z){let X=[F0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),F0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),F0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),F0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),F0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),F0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...X)}return $.push(F0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(F0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function UX(){if(BX)return g5;BX=!0;try{let $=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Y of $){let X=await kK(Y);if(X)return g5=X,console.log(`${R.green}[Crosswind]${R.reset} CSS engine loaded`),g5}let Z=LF();for(let Y of Z)if(await Bun.file(Y).exists()){let X=await kK(Y);if(X)return g5=X,console.log(`${R.green}[Crosswind]${R.reset} CSS engine loaded from ${F0.dirname(F0.dirname(Y))}`),g5}throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${R.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${R.reset}`),console.warn(`${R.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${R.reset}`),null}}function FF(){A3.clear()}function VF(){g5=null,BX=!1,T1=null,Z4="",A3.clear()}async function zX($){try{let{loadConfigWithResult:Z}=await import("bunfig"),Y=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Y?.path||!Y.config||Object.keys(Y.config).length===0)return null;let X=F0.relative($,Y.path);return console.log(`${R.green}[Crosswind]${R.reset} Loaded config from ${X||Y.path}`),Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${R.yellow}[Crosswind]${R.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}async function h5($){if(f5)return Z4;f5=!0;try{let Z=await UX();if(!Z||!Z.build)return f5=!1,"";if(!T1)T1=await zX($);if(!T1)return f5=!1,"";let Y=Z.defaultConfig?.theme||{},X=T1.theme||{},J={...Z.defaultConfig,...T1,theme:{...Y,...X,extend:{...Y.extend||{},...X.extend||{}}}},Q=performance.now(),G=await Z.build(J),K=performance.now()-Q;if(Z4=G.css,console.log(`${R.cyan}[Crosswind]${R.reset} Built ${G.classes.size} classes in ${K.toFixed(1)}ms`),J.output){let W=F0.isAbsolute(J.output)?J.output:F0.join($,J.output),_=F0.dirname(W);if(!DK.existsSync(_))DK.mkdirSync(_,{recursive:!0});await Bun.write(W,G.css)}return f5=!1,G.css}catch(Z){return console.error(`${R.red}[Crosswind]${R.reset} Build error:`,Z),f5=!1,Z4}}async function Y4($){T1=null,await h5($)}function NF(){return Z4}function w3($){let Z=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,X=Y.exec($);while(X!==null){for(let G of X[1].split(/\s+/))if(G.trim())Z.add(G.trim());X=Y.exec($)}let J=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,Q=J.exec($);while(Q!==null){let G=Q[1].match(/'([^']+)'/g);if(G){for(let K of G)for(let W of K.slice(1,-1).split(/\s+/))if(W.trim())Z.add(W.trim())}Q=J.exec($)}return Z}async function R3($,Z){try{let Y=await UX();if(!Y)return"";let X=w3($);if(X.size===0)return"";let J=[...X].sort().join(" "),Q=A3.get(J);if(Q!==void 0)return Q;let G=Z?F0.resolve(Z):process.cwd();if(!T1){let V=null;try{let{loadStxConfig:A}=await Promise.resolve().then(() => (m0(),IK)),N=await A(G);if(N.css)if(typeof N.css==="string"){let w=F0.isAbsolute(N.css)?N.css:F0.resolve(G,N.css);if(await Bun.file(w).exists()){let M=await import(w);V=M.default||M,console.log(`${R.green}[Crosswind]${R.reset} Loaded config from stx.config.ts \u2192 ${N.css}`)}}else{if(V={content:N.css.content||[],preflight:N.css.preflight??!0,minify:N.css.minify??!1},N.css.config){let w=F0.isAbsolute(N.css.config)?N.css.config:F0.resolve(G,N.css.config);if(await Bun.file(w).exists()){let M=await import(w);V={...M.default||M,...V}}}console.log(`${R.green}[Crosswind]${R.reset} Using inline CSS config from stx.config.ts`)}}catch{}T1=V||await zX(G)}let K=Y.defaultConfig||Y.config,W=T1||{},_=K.theme||{},U=(W.theme||{}).extend||{},z={..._};if(Object.keys(U).length>0)z.extend=U;let q=[...K.safelist||[],...W.safelist||[]],j={...K,...W,content:[],output:"",preflight:!0,minify:!1,theme:z,safelist:q},H=new Y.CSSGenerator(j);for(let V of q)H.generate(V);for(let V of X)H.generate(V);let O=H.toCSS(!0,!1),F=j.shortcuts||W.shortcuts||{};for(let[V,A]of Object.entries(F)){if(!X.has(V)&&!q.includes(V))continue;let N=A.split(/\s+/).filter(Boolean);for(let w of N)H.generate(w)}O=H.toCSS(!0,!1);let L=O.split(`
2972
2972
  `);for(let[V,A]of Object.entries(F)){if(!X.has(V)&&!q.includes(V))continue;let N=A.split(/\s+/).filter(Boolean),w=[],M=[];for(let T of N){let I=T.startsWith("dark:"),k=`.${(I?T.slice(5):T).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let b=0;b<L.length;b++){let P=L[b].trim();if(P===`${k} {`||P.startsWith(`${k} {`)){let x=b,C="";while(x<L.length){if(C+=L[x],L[x].includes("}"))break;x++}let f=C.match(/\{([^}]+)\}/);if(f)if(I)M.push(f[1].trim());else w.push(f[1].trim());break}}}if(w.length)O+=`
2973
2973
  .${V} { ${w.join(" ")} }`;if(M.length)O+=`
2974
2974
  @media (prefers-color-scheme: dark) { .dark .${V} { ${M.join(" ")} } }`}return A3.set(J,O),O}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function V0($,Z){if($.includes('data-crosswind="generated"'))return $;let Y=await R3($,Z);if(!Y)return $;let X=`<style data-crosswind="generated">
2975
2975
  ${Y}
2976
2976
  </style>`;if($.includes("</head>"))return $.replace("</head>",`${X}
2977
2977
  </head>`);if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
2978
- ${X}`);return X+$}var g5=null,UX=!1,T1=null,Z4="",f5=!1,A3;var E1=D(()=>{v7();A3=new Map});function SK(){return`
2978
+ ${X}`);return X+$}var g5=null,BX=!1,T1=null,Z4="",f5=!1,A3;var E1=D(()=>{v7();A3=new Map});function SK(){return`
2979
2979
  // STX Lifecycle Runtime
2980
2980
  (function() {
2981
2981
  if (typeof window === 'undefined') return;
@@ -3320,7 +3320,7 @@ else {
3320
3320
 
3321
3321
  console.log('[stx] Lifecycle runtime initialized');
3322
3322
  })();
3323
- `}function jX($){return Symbol($)}var hS,dS,uS;var bK=D(()=>{hS=jX("theme"),dS=jX("router"),uS=jX("i18n")});import*as yK from"crypto";function CK($){let Z=/\$(\w+)\./g,Y=[],X;while((X=Z.exec($))!==null)if(!Y.includes(X[1]))Y.push(X[1]);return Y}function AF(){return`stx-${yK.randomBytes(4).toString("hex")}`}function wF($){return/\$\w+\./.test($)}function PK($){let Z=[],Y=new Set,X=/<(\w+)([^>]*?)(\s*\/?>)/g,J=$;return J=J.replace(X,(Q,G,K,W)=>{if(["script","style","template"].includes(G.toLowerCase()))return Q;let _=[],B=!1,U=K,z=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,q=[...K.matchAll(z)];for(let O of q){let F=O[0],L=O[1],V=O[2];if(wF(V)){B=!0;let A=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(A){let N=A[1];if(_.push({attr:L,expr:N,fullMatch:F,originalAttr:L}),CK(N).forEach((M)=>Y.add(M)),L==="text")U=U.replace(F,"");else if(L==="class")U=U.replace(F,'class=""');else if(L==="disabled"||L==="hidden")U=U.replace(F,"");else U=U.replace(F,`${L}=""`)}}}if(!B)return Q;let j=U.match(/\bid\s*=\s*"([^"]+)"/),H;if(j)H=j[1];else H=AF(),U=` id="${H}"${U}`;for(let O of _)Z.push({elementId:H,attribute:O.attr,expression:O.expr,stores:CK(O.expr)});return`<${G}${U}${W}`}),{html:J,bindings:Z,stores:Y}}function xK($,Z){if($.length===0)return"";let Y=Array.from(Z),X=`
3323
+ `}function qX($){return Symbol($)}var hS,dS,uS;var bK=D(()=>{hS=qX("theme"),dS=qX("router"),uS=qX("i18n")});import*as yK from"crypto";function CK($){let Z=/\$(\w+)\./g,Y=[],X;while((X=Z.exec($))!==null)if(!Y.includes(X[1]))Y.push(X[1]);return Y}function AF(){return`stx-${yK.randomBytes(4).toString("hex")}`}function wF($){return/\$\w+\./.test($)}function PK($){let Z=[],Y=new Set,X=/<(\w+)([^>]*?)(\s*\/?>)/g,J=$;return J=J.replace(X,(Q,G,K,W)=>{if(["script","style","template"].includes(G.toLowerCase()))return Q;let _=[],B=!1,U=K,z=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,q=[...K.matchAll(z)];for(let O of q){let F=O[0],L=O[1],V=O[2];if(wF(V)){B=!0;let A=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(A){let N=A[1];if(_.push({attr:L,expr:N,fullMatch:F,originalAttr:L}),CK(N).forEach((M)=>Y.add(M)),L==="text")U=U.replace(F,"");else if(L==="class")U=U.replace(F,'class=""');else if(L==="disabled"||L==="hidden")U=U.replace(F,"");else U=U.replace(F,`${L}=""`)}}}if(!B)return Q;let j=U.match(/\bid\s*=\s*"([^"]+)"/),H;if(j)H=j[1];else H=AF(),U=` id="${H}"${U}`;for(let O of _)Z.push({elementId:H,attribute:O.attr,expression:O.expr,stores:CK(O.expr)});return`<${G}${U}${W}`}),{html:J,bindings:Z,stores:Y}}function xK($,Z){if($.length===0)return"";let Y=Array.from(Z),X=`
3324
3324
  <script>
3325
3325
  (function() {
3326
3326
  'use strict';
@@ -3446,7 +3446,7 @@ else {
3446
3446
  }
3447
3447
  })();
3448
3448
  </script>
3449
- `,X}function HX($){let{html:Z,bindings:Y,stores:X}=PK($);if(Y.length===0)return $;let J=xK(Y,X),Q=Z.lastIndexOf("</body>");if(Q!==-1)return Z.slice(0,Q)+J+Z.slice(Q);return Z+J}var OX=()=>{};function LX($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return RF(Z);case"google-analytics":return MF(Z);case"plausible":return TF(Z);case"self-hosted":return EF(Z);case"custom":return IF(Z);default:return""}}function RF($){let Z=$.fathom;if(!Z?.siteId)return"";let Y=Z.scriptUrl||"https://cdn.usefathom.com/script.js",X=Z.defer!==!1?" defer":"",J=[`data-site="${J1(Z.siteId)}"`];if(Z.honorDnt)J.push('data-honor-dnt="true"');if(Z.spa)J.push('data-spa="auto"');if(Z.canonical)J.push(`data-canonical="${J1(Z.canonical)}"`);if(Z.auto===!1)J.push('data-auto="false"');return`
3449
+ `,X}function jX($){let{html:Z,bindings:Y,stores:X}=PK($);if(Y.length===0)return $;let J=xK(Y,X),Q=Z.lastIndexOf("</body>");if(Q!==-1)return Z.slice(0,Q)+J+Z.slice(Q);return Z+J}var HX=()=>{};function OX($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return RF(Z);case"google-analytics":return MF(Z);case"plausible":return TF(Z);case"self-hosted":return EF(Z);case"custom":return IF(Z);default:return""}}function RF($){let Z=$.fathom;if(!Z?.siteId)return"";let Y=Z.scriptUrl||"https://cdn.usefathom.com/script.js",X=Z.defer!==!1?" defer":"",J=[`data-site="${J1(Z.siteId)}"`];if(Z.honorDnt)J.push('data-honor-dnt="true"');if(Z.spa)J.push('data-spa="auto"');if(Z.canonical)J.push(`data-canonical="${J1(Z.canonical)}"`);if(Z.auto===!1)J.push('data-auto="false"');return`
3450
3450
  <!-- Fathom Analytics -->
3451
3451
  <script src="${J1(Y)}" ${J.join(" ")}${X}></script>
3452
3452
  `}function MF($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let Y=J1(Z.measurementId),X=Z.debug?`gtag('config', '${Y}', { 'debug_mode': true });`:"";return`
@@ -3503,7 +3503,7 @@ ${Z.inlineScript}
3503
3503
  `;if(!Z.scriptUrl)return"";let Y=[];if(Z.scriptId)Y.push(`id="${J1(Z.scriptId)}"`);if(Z.attributes)for(let[J,Q]of Object.entries(Z.attributes))Y.push(`${J1(J)}="${J1(Q)}"`);return`
3504
3504
  <!-- Custom Analytics -->
3505
3505
  <script${Y.length>0?` ${Y.join(" ")}`:""} src="${J1(Z.scriptUrl)}" defer></script>
3506
- `}function FX($,Z){let Y=LX(Z);if(!Y)return $;if(!$.includes("</head>")){let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Y+$.slice(X);return $+Y}return $.replace("</head>",`${Y}</head>`)}function J1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var DF;var VX=D(()=>{DF={name:"analytics",hasEndTag:!1,handler:async($,Z,Y,X)=>{let J=Y.__stx_config||{};return LX(J)}}});function gK($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Y of $){let X=Y.toLowerCase();if(X==="prevent")Z.prevent=!0;else if(X==="stop")Z.stop=!0;else if(X==="once")Z.once=!0;else if(X==="capture")Z.capture=!0;else if(X==="self")Z.self=!0;else if(X==="passive")Z.passive=!0;else if(kF.has(X))Z.systemKeys.push(X);else if(X in hK)Z.mouse=X;else if(X in fK||/^[a-z]$/.test(X))Z.keys.push(fK[X]||X.toUpperCase());else if(X.startsWith("debounce")){let J=X.match(/debounce(?:\.(\d+))?/);Z.debounce=J?.[1]?Number.parseInt(J[1],10):300}else if(X.startsWith("throttle")){let J=X.match(/throttle(?:\.(\d+))?/);Z.throttle=J?.[1]?Number.parseInt(J[1],10):300}}return Z}function dK($){let Z=[],Y=0,X=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,J;while((J=X.exec($))!==null){let[Q,G,K]=J,W=J.index,_=W+Q.length,B=`__stx_evt_${Y++}`,U=[],z=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,q;while((q=z.exec(K))!==null){let[,H,O]=q,F=H.split("."),L=F[0];if(!vK.has(L))continue;U.push({attribute:`@${H}`,event:L,handler:O,modifiers:gK(F.slice(1)),elementId:B})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((q=j.exec(K))!==null){let[,H,O]=q,F=H.split("."),L=F[0];if(!vK.has(L))continue;U.push({attribute:`@${H}`,event:L,handler:O,modifiers:gK(F.slice(1)),elementId:B})}if(U.length>0)Z.push({originalTag:Q,elementId:B,events:U,startIndex:W,endIndex:_})}return Z}function SF($){let Z=[],{modifiers:Y}=$;if(Y.self)Z.push("if ($event.target !== $el) return");for(let X of Y.systemKeys)Z.push(`if (!$event.${X}Key) return`);if(Y.keys.length>0){let X=Y.keys.map((J)=>`$event.key === '${J}'`).join(" || ");Z.push(`if (!(${X})) return`)}if(Y.mouse!==null){let X=hK[Y.mouse];Z.push(`if ($event.button !== ${X}) return`)}if(Y.prevent)Z.push("$event.preventDefault()");if(Y.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function bF($,Z){let Y=$;if(Z.debounce!==null)Y=`__stx_debounce(() => { ${Y} }, ${Z.debounce})`;else if(Z.throttle!==null)Y=`__stx_throttle(() => { ${Y} }, ${Z.throttle})`;return Y}function CF($){let{modifiers:Z}=$,Y=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=SF($),J=bF($.handler,Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(Z.passive)Q.push("passive: true");let G=Q.length>0?`, { ${Q.join(", ")} }`:"",K=J.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
3506
+ `}function LX($,Z){let Y=OX(Z);if(!Y)return $;if(!$.includes("</head>")){let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Y+$.slice(X);return $+Y}return $.replace("</head>",`${Y}</head>`)}function J1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var DF;var FX=D(()=>{DF={name:"analytics",hasEndTag:!1,handler:async($,Z,Y,X)=>{let J=Y.__stx_config||{};return OX(J)}}});function gK($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Y of $){let X=Y.toLowerCase();if(X==="prevent")Z.prevent=!0;else if(X==="stop")Z.stop=!0;else if(X==="once")Z.once=!0;else if(X==="capture")Z.capture=!0;else if(X==="self")Z.self=!0;else if(X==="passive")Z.passive=!0;else if(kF.has(X))Z.systemKeys.push(X);else if(X in hK)Z.mouse=X;else if(X in fK||/^[a-z]$/.test(X))Z.keys.push(fK[X]||X.toUpperCase());else if(X.startsWith("debounce")){let J=X.match(/debounce(?:\.(\d+))?/);Z.debounce=J?.[1]?Number.parseInt(J[1],10):300}else if(X.startsWith("throttle")){let J=X.match(/throttle(?:\.(\d+))?/);Z.throttle=J?.[1]?Number.parseInt(J[1],10):300}}return Z}function dK($){let Z=[],Y=0,X=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,J;while((J=X.exec($))!==null){let[Q,G,K]=J,W=J.index,_=W+Q.length,B=`__stx_evt_${Y++}`,U=[],z=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,q;while((q=z.exec(K))!==null){let[,H,O]=q,F=H.split("."),L=F[0];if(!vK.has(L))continue;U.push({attribute:`@${H}`,event:L,handler:O,modifiers:gK(F.slice(1)),elementId:B})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((q=j.exec(K))!==null){let[,H,O]=q,F=H.split("."),L=F[0];if(!vK.has(L))continue;U.push({attribute:`@${H}`,event:L,handler:O,modifiers:gK(F.slice(1)),elementId:B})}if(U.length>0)Z.push({originalTag:Q,elementId:B,events:U,startIndex:W,endIndex:_})}return Z}function SF($){let Z=[],{modifiers:Y}=$;if(Y.self)Z.push("if ($event.target !== $el) return");for(let X of Y.systemKeys)Z.push(`if (!$event.${X}Key) return`);if(Y.keys.length>0){let X=Y.keys.map((J)=>`$event.key === '${J}'`).join(" || ");Z.push(`if (!(${X})) return`)}if(Y.mouse!==null){let X=hK[Y.mouse];Z.push(`if ($event.button !== ${X}) return`)}if(Y.prevent)Z.push("$event.preventDefault()");if(Y.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function bF($,Z){let Y=$;if(Z.debounce!==null)Y=`__stx_debounce(() => { ${Y} }, ${Z.debounce})`;else if(Z.throttle!==null)Y=`__stx_throttle(() => { ${Y} }, ${Z.throttle})`;return Y}function CF($){let{modifiers:Z}=$,Y=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=SF($),J=bF($.handler,Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(Z.passive)Q.push("passive: true");let G=Q.length>0?`, { ${Q.join(", ")} }`:"",K=J.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
3507
3507
  (function() {
3508
3508
  var $el = document.getElementById('${Y}');
3509
3509
  if (!$el) return;
@@ -3588,8 +3588,8 @@ else {
3588
3588
  ${$.flatMap((Y)=>Y.events).map(CF).join(`
3589
3589
  `)}
3590
3590
  })();
3591
- </script>`}function uK($){let Z=dK($);if(Z.length===0)return{template:$,bindings:[]};let Y=$,X=[];for(let J=Z.length-1;J>=0;J--){let Q=Z[J],G=Q.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${Q.elementId}"`);else{let K=G.match(/id=["']([^"']+)["']/);if(K)for(let W of Q.events)W.elementId=K[1]}for(let K of Q.events){let W=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),_=new RegExp(`\\s*${W}\\s*=\\s*"[^"]*"`,"g"),B=new RegExp(`\\s*${W}\\s*=\\s*'[^']*'`,"g");G=G.replace(_,""),G=G.replace(B,"")}Y=Y.slice(0,Q.startIndex)+G+Y.slice(Q.endIndex),X.push(...Q.events)}return{template:Y,bindings:X}}function NX($,Z,Y){if(/\b(?:state|derived|effect)\s*\(/.test($)||/@(?:model|show|for|if)\s*=/.test($)||/data-stx(?:-auto)?(?![-\w])/.test($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:W,bindings:_}=uK($),B=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...B,..._],W}let J=dK($);if(J.length===0)return $;let Q=$;for(let W=J.length-1;W>=0;W--){let _=J[W],B=_.originalTag;if(!B.includes(" id="))B=B.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${_.elementId}"`);else{let U=B.match(/id=["']([^"']+)["']/);if(U)for(let z of _.events)z.elementId=U[1]}for(let U of _.events){let z=U.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),q=new RegExp(`\\s*${z}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${z}\\s*=\\s*'[^']*'`,"g");B=B.replace(q,""),B=B.replace(j,"")}Q=Q.slice(0,_.startIndex)+B+Q.slice(_.endIndex)}let G=yF(J),K=Q.lastIndexOf("</body>");if(K!==-1)Q=Q.slice(0,K)+G+`
3592
- `+Q.slice(K);else Q+=G;return Q}function PF($){return/@[a-z]+(?:\.[a-z]+)*\s*=\s*["'][^"']*["']/i.test($)}var vK,fK,kF,hK;var AX=D(()=>{vK=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"]),fK={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"},kF=new Set(["ctrl","alt","shift","meta"]),hK={left:0,middle:1,right:2}});function T3($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function mK($,Z){let Y=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(Y)return Y[1];let X=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(X)return X[1];return null}function vF($){let Z=[],Y=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,X;while((X=Y.exec($))!==null){let[J,Q,G]=X,K=X.index,W=mK(G,"x-data");if(!W)continue;let _=`__stx_scope_${pK++}`,B=mK(G,"x-init"),U=fF($,Q,K+J.length),z=$.slice(K,U.endIndex),q=gF(z);Z.push({id:_,selector:`[data-stx-scope="${_}"]`,stateExpr:W,initExpr:B,bindings:[],refs:q})}return Z}function fF($,Z,Y){let X=1,J=Y,Q=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),K=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(X>0&&J<$.length){Q.lastIndex=J,G.lastIndex=J,K.lastIndex=J;let W=Q.exec($),_=G.exec($),B=K.exec($);if(B&&B.index<(W?.index??1/0)){J=B.index+B[0].length;continue}if(!_)return{endIndex:$.length};if(W&&W.index<_.index)X++,J=W.index+W[0].length;else{if(X--,X===0)return{endIndex:_.index+_[0].length};J=_.index+_[0].length}}return{endIndex:$.length}}function gF($){let Z=new Map,Y=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),X=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,J;while((J=X.exec(Y))!==null){let[,Q,G]=J,K=hF(Q);Z.set(G,K)}return Z}function hF($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${xF++}`}function dF(){return`
3591
+ </script>`}function uK($){let Z=dK($);if(Z.length===0)return{template:$,bindings:[]};let Y=$,X=[];for(let J=Z.length-1;J>=0;J--){let Q=Z[J],G=Q.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${Q.elementId}"`);else{let K=G.match(/id=["']([^"']+)["']/);if(K)for(let W of Q.events)W.elementId=K[1]}for(let K of Q.events){let W=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),_=new RegExp(`\\s*${W}\\s*=\\s*"[^"]*"`,"g"),B=new RegExp(`\\s*${W}\\s*=\\s*'[^']*'`,"g");G=G.replace(_,""),G=G.replace(B,"")}Y=Y.slice(0,Q.startIndex)+G+Y.slice(Q.endIndex),X.push(...Q.events)}return{template:Y,bindings:X}}function VX($,Z,Y){if(/\b(?:state|derived|effect)\s*\(/.test($)||/@(?:model|show|for|if)\s*=/.test($)||/data-stx(?:-auto)?(?![-\w])/.test($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:W,bindings:_}=uK($),B=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...B,..._],W}let J=dK($);if(J.length===0)return $;let Q=$;for(let W=J.length-1;W>=0;W--){let _=J[W],B=_.originalTag;if(!B.includes(" id="))B=B.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${_.elementId}"`);else{let U=B.match(/id=["']([^"']+)["']/);if(U)for(let z of _.events)z.elementId=U[1]}for(let U of _.events){let z=U.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),q=new RegExp(`\\s*${z}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${z}\\s*=\\s*'[^']*'`,"g");B=B.replace(q,""),B=B.replace(j,"")}Q=Q.slice(0,_.startIndex)+B+Q.slice(_.endIndex)}let G=yF(J),K=Q.lastIndexOf("</body>");if(K!==-1)Q=Q.slice(0,K)+G+`
3592
+ `+Q.slice(K);else Q+=G;return Q}function PF($){return/@[a-z]+(?:\.[a-z]+)*\s*=\s*["'][^"']*["']/i.test($)}var vK,fK,kF,hK;var NX=D(()=>{vK=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"]),fK={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"},kF=new Set(["ctrl","alt","shift","meta"]),hK={left:0,middle:1,right:2}});function T3($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function mK($,Z){let Y=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(Y)return Y[1];let X=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(X)return X[1];return null}function vF($){let Z=[],Y=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,X;while((X=Y.exec($))!==null){let[J,Q,G]=X,K=X.index,W=mK(G,"x-data");if(!W)continue;let _=`__stx_scope_${pK++}`,B=mK(G,"x-init"),U=fF($,Q,K+J.length),z=$.slice(K,U.endIndex),q=gF(z);Z.push({id:_,selector:`[data-stx-scope="${_}"]`,stateExpr:W,initExpr:B,bindings:[],refs:q})}return Z}function fF($,Z,Y){let X=1,J=Y,Q=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),K=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(X>0&&J<$.length){Q.lastIndex=J,G.lastIndex=J,K.lastIndex=J;let W=Q.exec($),_=G.exec($),B=K.exec($);if(B&&B.index<(W?.index??1/0)){J=B.index+B[0].length;continue}if(!_)return{endIndex:$.length};if(W&&W.index<_.index)X++,J=W.index+W[0].length;else{if(X--,X===0)return{endIndex:_.index+_[0].length};J=_.index+_[0].length}}return{endIndex:$.length}}function gF($){let Z=new Map,Y=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),X=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,J;while((J=X.exec(Y))!==null){let[,Q,G]=J,K=hF(Q);Z.set(G,K)}return Z}function hF($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${xF++}`}function dF(){return`
3593
3593
  // STX Reactive Runtime - x-cloak and transition CSS
3594
3594
  (function() {
3595
3595
  var style = document.createElement('style');
@@ -3805,14 +3805,14 @@ window.__stx_reactive = (function() {
3805
3805
  ${dF()}
3806
3806
  ${Z}
3807
3807
  </script>`}function cK($,Z,Y){if(pK=0,!pF($))return $;let X=vF($);if(X.length===0)return $;let J=mF($,X),Q=uF(X),G=J.lastIndexOf("</body>");if(G!==-1)J=J.slice(0,G)+Q+`
3808
- `+J.slice(G);else J+=Q;return J}function mF($,Z){let Y=$;for(let X of Z){let Q=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${T3(X.stateExpr)}["']`,"gi").exec(Y);if(Q)X.id=Q[1],X.selector=`[data-stx-scope="${X.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${T3(X.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(Y);if(K)X.id=K[1],X.selector=`[data-stx-scope="${X.id}"]`;else Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${T3(X.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`),Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${T3(X.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`)}}return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Y=Y.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Y}function pF($){return/x-data\s*=\s*["']/.test($)}var pK=0,xF=0;import cF from"fs";import wX from"path";import{createHighlighter as lF}from"ts-syntax-highlighter";async function p1($,Z={}){try{if(!await t($))throw Error(`Markdown file not found: ${$}`);let X=(await cF.promises.stat($)).mtime.getTime();if(Z.cache&&I3.has($)){let U=I3.get($);if(U.updatedAt>=X)return{content:U.content,data:U.data}}let J=await Bun.file($).text(),{data:Q,content:G}=_G(J),K=Z.markdown||t0.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},_=f7(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)_=await iF(_,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let B={content:_,data:Q||{}};if(Z.cache)I3.set($,{...B,updatedAt:X});return B}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let X=Y instanceof Error?Y.message:String(Y);return{content:U0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}async function iF($,Z,Y){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!E3)try{E3=await lF({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let J=async(K,W,_,B)=>{let U=B.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),z=_||(Y?"text":"");if(!z)return K;try{if(!E3.getSupportedLanguages().includes(z))return K;return(await E3.highlight(U,z,{theme:Z})).html}catch(q){console.error(`Error highlighting code block with language ${_}:`,q)}return K},Q=$,G=$.matchAll(X);for(let K of G){let[W,_,B,U]=K,z=await J(W,_,B,U);Q=Q.replace(W,z)}return Q}async function RX($,Z,Y="",X={}){return await nF($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,W,_)=>{try{let B=K;if(!wX.isAbsolute(K))B=wX.resolve(wX.dirname(Y),K);let U={};if(W)try{try{U=JSON.parse(W)}catch{if(X.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 V of L){let A=V.indexOf(":");if(A>0){let N=V.substring(0,A).trim(),w=V.substring(A+1).trim(),M=w.startsWith('"')&&w.endsWith('"'),T=w.startsWith("'")&&w.endsWith("'");if(M||T)w=w.substring(1,w.length-1);U[N]=w}}}}catch(F){if(X.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:z,data:q}=await p1(B,X),j={...Z,...q,...U},H=z,O=/\{\{([^}]+)\}\}/g;return H=H.replace(O,(F,L)=>{let V=L.trim();return j[V]!==void 0?String(j[V]):F}),H}catch(B){let U=B instanceof Error?B.message:String(B);return U0("Markdown File",`Error including markdown file: ${U}`,Y,$,_,G)}})}async function nF($,Z,Y){let X=[],J;while((J=Z.exec($))!==null){let K=J[0],W=J.index,_=J;X.push(Y(..._).then((B)=>({match:K,replacement:B,index:W})))}let Q=await Promise.all(X);Q.sort((K,W)=>W.index-K.index);let G=$;for(let{match:K,replacement:W}of Q)G=G.replace(K,()=>W);return G}var I3,E3=null;var d5=D(()=>{m0();q0();I3=new Map});function c1($,Z){try{let Y=$.trim();if(B0(Y))return j0(Y,Object.keys(Z))(...Object.values(Z));else return L0(Y,Z)}catch{return!1}}var MX=D(()=>{h0()});class X4{source;pos=0;line=1;column=0;tokens=[];constructor($){this.source=$}tokenize(){this.tokens=[],this.pos=0,this.line=1,this.column=0;while(this.pos<this.source.length){let $=this.nextToken();if($)this.tokens.push($)}return this.tokens.push({type:"EOF",value:"",start:this.pos,end:this.pos,line:this.line,column:this.column}),this.tokens}nextToken(){if(this.pos>=this.source.length)return null;let $=this.pos,Z=this.line,Y=this.column,X=this.source[this.pos];if(/\s/.test(X))return this.readWhitespace($,Z,Y);if(X==="/"&&this.peek(1)==="/")return this.readLineComment($,Z,Y);if(X==="/"&&this.peek(1)==="*")return this.readBlockComment($,Z,Y);if(X==='"'||X==="'")return this.readString(X,$,Z,Y);if(X==="`")return this.readTemplateString($,Z,Y);if(/\d/.test(X)||X==="."&&/\d/.test(this.peek(1)||""))return this.readNumber($,Z,Y);if(/[a-z_$]/i.test(X))return this.readIdentifier($,Z,Y);if(X==="{"){if(this.peek(1)==="{"&&this.peek(2)==="{")return this.advance(3),{type:"RAW_START",value:"{{{",start:$,end:this.pos,line:Z,column:Y};if(this.peek(1)==="{")return this.advance(2),{type:"EXPRESSION_START",value:"{{",start:$,end:this.pos,line:Z,column:Y};if(this.peek(1)==="!"&&this.peek(2)==="!")return this.advance(3),{type:"RAW_START",value:"{!!",start:$,end:this.pos,line:Z,column:Y}}if(X==="}"){if(this.peek(1)==="}"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"}}}",start:$,end:this.pos,line:Z,column:Y};if(this.peek(1)==="}")return this.advance(2),{type:"EXPRESSION_END",value:"}}",start:$,end:this.pos,line:Z,column:Y}}if(X==="!"&&this.peek(1)==="!"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"!!}",start:$,end:this.pos,line:Z,column:Y};if(X==="@"&&/[a-z]/i.test(this.peek(1)||""))return this.readDirective($,Z,Y);let J=["===","!==","==","!=","<=",">=","&&","||","??","++","--","+=","-=","*=","/=","%=","**","=>","?.","...","<<",">>",">>>","&=","|=","^="];for(let Q of J)if(this.source.slice(this.pos,this.pos+Q.length)===Q)return this.advance(Q.length),{type:"OPERATOR",value:Q,start:$,end:this.pos,line:Z,column:Y};if(/[+\-*/%<>=!&|^~?:]/.test(X))return this.advance(),{type:"OPERATOR",value:X,start:$,end:this.pos,line:Z,column:Y};if(/[()[\]{},;.]/.test(X))return this.advance(),{type:"PUNCTUATION",value:X,start:$,end:this.pos,line:Z,column:Y};return this.advance(),{type:"PUNCTUATION",value:X,start:$,end:this.pos,line:Z,column:Y}}readWhitespace($,Z,Y){while(this.pos<this.source.length&&/\s/.test(this.source[this.pos]))this.advance();return{type:"WHITESPACE",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:Y}}readLineComment($,Z,Y){this.advance(2);while(this.pos<this.source.length&&this.source[this.pos]!==`
3808
+ `+J.slice(G);else J+=Q;return J}function mF($,Z){let Y=$;for(let X of Z){let Q=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${T3(X.stateExpr)}["']`,"gi").exec(Y);if(Q)X.id=Q[1],X.selector=`[data-stx-scope="${X.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${T3(X.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(Y);if(K)X.id=K[1],X.selector=`[data-stx-scope="${X.id}"]`;else Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${T3(X.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`),Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${T3(X.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`)}}return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Y=Y.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Y}function pF($){return/x-data\s*=\s*["']/.test($)}var pK=0,xF=0;import cF from"fs";import AX from"path";import{createHighlighter as lF}from"ts-syntax-highlighter";async function p1($,Z={}){try{if(!await t($))throw Error(`Markdown file not found: ${$}`);let X=(await cF.promises.stat($)).mtime.getTime();if(Z.cache&&I3.has($)){let U=I3.get($);if(U.updatedAt>=X)return{content:U.content,data:U.data}}let J=await Bun.file($).text(),{data:Q,content:G}=_G(J),K=Z.markdown||t0.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},_=f7(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)_=await iF(_,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let B={content:_,data:Q||{}};if(Z.cache)I3.set($,{...B,updatedAt:X});return B}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let X=Y instanceof Error?Y.message:String(Y);return{content:U0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}async function iF($,Z,Y){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!E3)try{E3=await lF({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let J=async(K,W,_,B)=>{let U=B.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),z=_||(Y?"text":"");if(!z)return K;try{if(!E3.getSupportedLanguages().includes(z))return K;return(await E3.highlight(U,z,{theme:Z})).html}catch(q){console.error(`Error highlighting code block with language ${_}:`,q)}return K},Q=$,G=$.matchAll(X);for(let K of G){let[W,_,B,U]=K,z=await J(W,_,B,U);Q=Q.replace(W,z)}return Q}async function wX($,Z,Y="",X={}){return await nF($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,W,_)=>{try{let B=K;if(!AX.isAbsolute(K))B=AX.resolve(AX.dirname(Y),K);let U={};if(W)try{try{U=JSON.parse(W)}catch{if(X.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 V of L){let A=V.indexOf(":");if(A>0){let N=V.substring(0,A).trim(),w=V.substring(A+1).trim(),M=w.startsWith('"')&&w.endsWith('"'),T=w.startsWith("'")&&w.endsWith("'");if(M||T)w=w.substring(1,w.length-1);U[N]=w}}}}catch(F){if(X.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:z,data:q}=await p1(B,X),j={...Z,...q,...U},H=z,O=/\{\{([^}]+)\}\}/g;return H=H.replace(O,(F,L)=>{let V=L.trim();return j[V]!==void 0?String(j[V]):F}),H}catch(B){let U=B instanceof Error?B.message:String(B);return U0("Markdown File",`Error including markdown file: ${U}`,Y,$,_,G)}})}async function nF($,Z,Y){let X=[],J;while((J=Z.exec($))!==null){let K=J[0],W=J.index,_=J;X.push(Y(..._).then((B)=>({match:K,replacement:B,index:W})))}let Q=await Promise.all(X);Q.sort((K,W)=>W.index-K.index);let G=$;for(let{match:K,replacement:W}of Q)G=G.replace(K,()=>W);return G}var I3,E3=null;var d5=D(()=>{m0();q0();I3=new Map});function c1($,Z){try{let Y=$.trim();if(B0(Y))return j0(Y,Object.keys(Z))(...Object.values(Z));else return L0(Y,Z)}catch{return!1}}var RX=D(()=>{h0()});class X4{source;pos=0;line=1;column=0;tokens=[];constructor($){this.source=$}tokenize(){this.tokens=[],this.pos=0,this.line=1,this.column=0;while(this.pos<this.source.length){let $=this.nextToken();if($)this.tokens.push($)}return this.tokens.push({type:"EOF",value:"",start:this.pos,end:this.pos,line:this.line,column:this.column}),this.tokens}nextToken(){if(this.pos>=this.source.length)return null;let $=this.pos,Z=this.line,Y=this.column,X=this.source[this.pos];if(/\s/.test(X))return this.readWhitespace($,Z,Y);if(X==="/"&&this.peek(1)==="/")return this.readLineComment($,Z,Y);if(X==="/"&&this.peek(1)==="*")return this.readBlockComment($,Z,Y);if(X==='"'||X==="'")return this.readString(X,$,Z,Y);if(X==="`")return this.readTemplateString($,Z,Y);if(/\d/.test(X)||X==="."&&/\d/.test(this.peek(1)||""))return this.readNumber($,Z,Y);if(/[a-z_$]/i.test(X))return this.readIdentifier($,Z,Y);if(X==="{"){if(this.peek(1)==="{"&&this.peek(2)==="{")return this.advance(3),{type:"RAW_START",value:"{{{",start:$,end:this.pos,line:Z,column:Y};if(this.peek(1)==="{")return this.advance(2),{type:"EXPRESSION_START",value:"{{",start:$,end:this.pos,line:Z,column:Y};if(this.peek(1)==="!"&&this.peek(2)==="!")return this.advance(3),{type:"RAW_START",value:"{!!",start:$,end:this.pos,line:Z,column:Y}}if(X==="}"){if(this.peek(1)==="}"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"}}}",start:$,end:this.pos,line:Z,column:Y};if(this.peek(1)==="}")return this.advance(2),{type:"EXPRESSION_END",value:"}}",start:$,end:this.pos,line:Z,column:Y}}if(X==="!"&&this.peek(1)==="!"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"!!}",start:$,end:this.pos,line:Z,column:Y};if(X==="@"&&/[a-z]/i.test(this.peek(1)||""))return this.readDirective($,Z,Y);let J=["===","!==","==","!=","<=",">=","&&","||","??","++","--","+=","-=","*=","/=","%=","**","=>","?.","...","<<",">>",">>>","&=","|=","^="];for(let Q of J)if(this.source.slice(this.pos,this.pos+Q.length)===Q)return this.advance(Q.length),{type:"OPERATOR",value:Q,start:$,end:this.pos,line:Z,column:Y};if(/[+\-*/%<>=!&|^~?:]/.test(X))return this.advance(),{type:"OPERATOR",value:X,start:$,end:this.pos,line:Z,column:Y};if(/[()[\]{},;.]/.test(X))return this.advance(),{type:"PUNCTUATION",value:X,start:$,end:this.pos,line:Z,column:Y};return this.advance(),{type:"PUNCTUATION",value:X,start:$,end:this.pos,line:Z,column:Y}}readWhitespace($,Z,Y){while(this.pos<this.source.length&&/\s/.test(this.source[this.pos]))this.advance();return{type:"WHITESPACE",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:Y}}readLineComment($,Z,Y){this.advance(2);while(this.pos<this.source.length&&this.source[this.pos]!==`
3809
3809
  `)this.advance();return{type:"COMMENT",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:Y}}readBlockComment($,Z,Y){this.advance(2);while(this.pos<this.source.length-1){if(this.source[this.pos]==="*"&&this.source[this.pos+1]==="/"){this.advance(2);break}this.advance()}return{type:"COMMENT",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:Y}}readString($,Z,Y,X){this.advance();while(this.pos<this.source.length){let J=this.source[this.pos];if(J==="\\"){this.advance(2);continue}if(J===$){this.advance();break}this.advance()}return{type:"STRING",value:this.source.slice(Z,this.pos),start:Z,end:this.pos,line:Y,column:X}}readTemplateString($,Z,Y){this.advance();let X=0,J=256;while(this.pos<this.source.length){let Q=this.source[this.pos];if(Q==="\\"){this.advance(2);continue}if(Q==="$"&&this.peek(1)==="{"){if(X>=J){this.pos=this.source.length;break}this.advance(2),X++;continue}if(Q==="{"&&X>0){X++,this.advance();continue}if(Q==="}"&&X>0){X--,this.advance();continue}if(Q==="`"&&X===0){this.advance();break}this.advance()}return{type:"TEMPLATE_STRING",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:Y}}readNumber($,Z,Y){if(this.source[this.pos]==="0"){let X=this.peek(1)?.toLowerCase();if(X==="x"||X==="o"||X==="b"){this.advance(2);while(this.pos<this.source.length&&/[\da-f_]/i.test(this.source[this.pos]))this.advance();return{type:"NUMBER",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:Y}}}while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance();if(this.source[this.pos]==="."&&/\d/.test(this.peek(1)||"")){this.advance();while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance()}if(/e/i.test(this.source[this.pos]||"")){if(this.advance(),/[+-]/.test(this.source[this.pos]||""))this.advance();while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance()}if(this.source[this.pos]==="n")this.advance();return{type:"NUMBER",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:Y}}readIdentifier($,Z,Y){while(this.pos<this.source.length&&/[\w$]/.test(this.source[this.pos]))this.advance();return{type:"IDENTIFIER",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:Y}}readDirective($,Z,Y){this.advance();while(this.pos<this.source.length&&/[a-z]/i.test(this.source[this.pos]))this.advance();return{type:"DIRECTIVE",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:Y}}advance($=1){for(let Z=0;Z<$&&this.pos<this.source.length;Z++){if(this.source[this.pos]===`
3810
- `)this.line++,this.column=0;else this.column++;this.pos++}}peek($){return this.source[this.pos+$]}saveState(){return{pos:this.pos,line:this.line,column:this.column}}restoreState($){this.pos=$.pos,this.line=$.line,this.column=$.column}}function b0($,Z,Y,X=0){let J=0,Q=X,G=null,K=0,W=!1;while(Q<$.length){let _=$[Q];if(G&&W){W=!1,Q++;continue}if(G&&_==="\\"){W=!0,Q++;continue}if(W=!1,(_==='"'||_==="'"||_==="`")&&!G){G=_,Q++;continue}if(_===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&_==="$"&&$[Q+1]==="{"){K++,Q+=2;continue}if(K>0&&_==="}"){K--,Q++;continue}if(_==="`"&&G==="`"&&K===0){G=null,Q++;continue}if(G){Q++;continue}if(_===Z)J++;else if(_===Y){if(J--,J===0)return Q}Q++}return-1}function TX($,Z){let Y=Z,X={paren:0,bracket:0,brace:0},J=null,Q=0;while(Y<$.length){let G=$[Y];if((Y>0?$[Y-1]:"")==="\\"&&J){Y++;continue}if((G==='"'||G==="'")&&!J){J=G,Y++;continue}if(G===J&&J!=="`"){J=null,Y++;continue}if(G==="`"&&!J){J="`",Y++;continue}if(G==="`"&&J==="`"&&Q===0){J=null,Y++;continue}if(J==="`"&&G==="$"&&$[Y+1]==="{"){Q++,Y+=2;continue}if(Q>0){if(G==="{")Q++;else if(G==="}")Q--;Y++;continue}if(J){Y++;continue}if(X.paren===0&&X.bracket===0&&X.brace===0){if($.slice(Y,Y+2)==="}}"||$.slice(Y,Y+3)==="!!}")break;if(G===","||G===";")break}if(G==="(")X.paren++;else if(G===")"){if(X.paren--,X.paren<0)break}else if(G==="[")X.bracket++;else if(G==="]"){if(X.bracket--,X.bracket<0)break}else if(G==="{")X.brace++;else if(G==="}"){if(X.brace--,X.brace<0)break}Y++}return{expression:$.slice(Z,Y),endPos:Y}}function D3($){let Z=[],Y="",X={paren:0,bracket:0,brace:0},J=null,Q=0;for(let G=0;G<$.length;G++){let K=$[G];if((G>0?$[G-1]:"")==="\\"&&J){Y+=K;continue}if((K==='"'||K==="'")&&!J){J=K,Y+=K;continue}if(K===J&&J!=="`"){J=null,Y+=K;continue}if(K==="`"&&!J){J="`",Y+=K;continue}if(K==="`"&&J==="`"&&Q===0){J=null,Y+=K;continue}if(J==="`"&&K==="$"&&$[G+1]==="{"){Q++,Y+=K+$[G+1],G++;continue}if(Q>0&&K==="{"){Q++,Y+=K;continue}if(Q>0&&K==="}"){Q--,Y+=K;continue}if(J){Y+=K;continue}if(K==="(")X.paren++;else if(K===")")X.paren--;else if(K==="[")X.bracket++;else if(K==="]")X.bracket--;else if(K==="{")X.brace++;else if(K==="}")X.brace--;if(K==="|"&&$[G+1]!=="|"&&(G===0||$[G-1]!=="|")&&$[G-1]!=="\\"&&X.paren===0&&X.bracket===0&&X.brace===0){Z.push(Y.trim()),Y="";continue}if(K==="|"&&$[G-1]==="\\"&&!J){Y=Y.slice(0,-1)+K;continue}Y+=K}if(Y.trim())Z.push(Y.trim());return Z}function l1($,Z){let Y=sF($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function sF($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let X=b0($,"(",")",Y);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,X),endPos:X+1}}function z$($,Z,Y,X){let J=1,Q=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(Q<$.length&&J>0){G.lastIndex=Q,K.lastIndex=Q;let W=G.exec($),_=K.exec($),B=W?W.index:1/0,U=_?_.index:1/0;if(B<U)J++,Q=B+W[0].length;else if(U<1/0){if(J--,J===0)return U;Q=U+_[0].length}else break}return-1}function EX($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let X=Z+Y[0].length,J=l1($,X);if(!J)return null;let Q=J.endPos,G=z$($,"if","endif",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],_=0,B="if",U=J.expression,z=0,q=0;while(_<K.length){let j=K.indexOf("@",_);if(j===-1)break;_=j;let H=K.substring(j);if(/^@if\s*\(/.test(H)){q++,_++;continue}if(/^@endif(?![a-z])/.test(H)){q--,_+=6;continue}if(q===0){let O=H.match(/^@elseif\s*/);if(O){W.push({type:B,condition:U,content:K.substring(z,_),start:Q+z,end:Q+_});let F=_+O[0].length,L=l1(K,F);if(!L){_++;continue}B="elseif",U=L.expression,_=L.endPos,z=_;continue}else if(/^@else(?![a-z])/.test(H)){W.push({type:B,condition:U,content:K.substring(z,_),start:Q+z,end:Q+_}),B="else",U=void 0,_+=5,z=_;continue}}_++}return W.push({type:B,condition:U,content:K.slice(z),start:Q+z,end:Q+K.length}),{fullMatch:$.slice(Z,G+6),branches:W,start:Z,end:G+6}}function k3($){let Z=[],Y=/@if\s*\(/g,X=Y.exec($);while(X!==null){if(Z.some((G)=>X.index>G.start&&X.index<G.end)){X=Y.exec($);continue}let Q=EX($,X.index);if(Q)Z.push(Q),Y.lastIndex=Q.end;X=Y.exec($)}return Z}function J4($,Z,Y){let X=[],J=new RegExp(`@${Z}\\s*\\(`,"g"),Q=J.exec($);while(Q!==null){if(X.some((H)=>Q.index>H.start&&Q.index<H.end)){Q=J.exec($);continue}let K=Q.index,W=K+Q[0].length-1,_=b0($,"(",")",W);if(_===-1){Q=J.exec($);continue}let B=$.slice(W+1,_),U=_+1,z=z$($,Z,Y,U);if(z===-1){Q=J.exec($);continue}let q=$.slice(U,z),j=z+`@${Y}`.length;X.push({fullMatch:$.slice(K,j),name:Z,params:B,content:q,start:K,end:j}),J.lastIndex=j,Q=J.exec($)}return X}function S3($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let X=Z+Y[0].length,J=l1($,X);if(!J)return null;let Q=J.endPos,G=z$($,"switch","endswitch",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],_=0,B=null,U=0;while(_<K.length){let z=K.slice(_),q=z.match(/^@switch\s*\(/),j=z.match(/^@endswitch(?![a-z])/);if(q){if(U++,B)B.content+=q[0];_+=q[0].length;continue}if(j){if(U--,B)B.content+=j[0];_+=j[0].length;continue}if(U>0){if(B)B.content+=K[_];_++;continue}let H=z.match(/^@case\s*/),O=z.match(/^@default(?![a-z])/),F=z.match(/^@break(?![a-z])/);if(H&&z.startsWith("@case")){if(B)W.push(B);let L=_+H[0].length,V=l1(K,L);if(!V){_++;continue}B={type:"case",value:V.expression,content:""},_=V.endPos}else if(O&&z.startsWith("@default")){if(B)W.push(B);B={type:"default",content:""},_+=O[0].length}else if(F&&z.startsWith("@break"))_+=F[0].length;else{if(B)B.content+=K[_];_++}}if(B)W.push(B);return{fullMatch:$.slice(Z,G+10),expression:J.expression,cases:W,start:Z,end:G+10}}var lK=()=>{};function sK($){let Z=[],Y=0;while(Y<$.length){let X=$.indexOf("{{",Y),J=$.indexOf("{!!",Y),Q=!1,G;if(X===-1&&J===-1)break;else if(X===-1)G=J,Q=!0;else if(J===-1)G=X,Q=!1;else if(J<X)G=J,Q=!0;else G=X,Q=!1;if(!Q&&$.slice(G,G+3)==="{{{")Q=!0;let K=Q?$.slice(G,G+3)==="{{{"?"{{{":"{!!":"{{",W=Q?K==="{{{"?"}}}":"!!}":"}}",_=G+K.length,B=rF($,_,W);if(B===-1){Y=G+1;continue}let U=$.slice(_,B).trim(),z=B+W.length;Z.push({fullMatch:$.slice(G,z),expression:U,start:G,end:z,isRaw:Q}),Y=z}return Z}function rF($,Z,Y){let X=Z,J=null,Q={paren:0,bracket:0,brace:0},G=0;while(X<$.length){let K=$[X];if((X>0?$[X-1]:"")==="\\"&&J){X++;continue}if((K==='"'||K==="'")&&!J){J=K,X++;continue}if(K===J&&J!=="`"){J=null,X++;continue}if(K==="`"&&!J){J="`",X++;continue}if(K==="`"&&J==="`"&&G===0){J=null,X++;continue}if(J==="`"&&K==="$"&&$[X+1]==="{"){G++,X+=2;continue}if(G>0){if(K==="{")G++;else if(K==="}")G--;X++;continue}if(J){X++;continue}if(K==="(")Q.paren++;else if(K===")")Q.paren--;else if(K==="[")Q.bracket++;else if(K==="]")Q.bracket--;else if(K==="{")Q.brace++;else if(K==="}")Q.brace--;if(Q.paren===0&&Q.bracket===0&&Q.brace<=0){if($.slice(X,X+Y.length)===Y)return X}X++}return-1}function rK($){let Z=D3($);if(Z.length===0)return{baseExpression:"",filters:[]};let Y=Z[0],X=[];for(let J=1;J<Z.length;J++){let Q=oF(Z[J]);if(Q)X.push(Q)}return{baseExpression:Y,filters:X}}function oF($){let Z=$.trim();if(!Z)return null;let Y=Z.indexOf("(");if(Y===-1)return{name:Z,args:[]};let X=Z.slice(0,Y).trim(),J=Y+1,Q=b0(Z,"(",")",Y);if(Q===-1)return{name:X,args:[]};let G=Z.slice(J,Q),K=IX(G);return{name:X,args:K}}function IX($){let Z=[],Y="",X={paren:0,bracket:0,brace:0},J=null,Q=0;for(let G=0;G<$.length;G++){let K=$[G];if((G>0?$[G-1]:"")==="\\"&&J){Y+=K;continue}if((K==='"'||K==="'")&&!J){J=K,Y+=K;continue}if(K===J&&J!=="`"){J=null,Y+=K;continue}if(K==="`"&&!J){J="`",Y+=K;continue}if(K==="`"&&J==="`"&&Q===0){J=null,Y+=K;continue}if(J==="`"&&K==="$"&&$[G+1]==="{"){Q++,Y+="${",G++;continue}if(Q>0&&K==="{"){Q++,Y+=K;continue}if(Q>0&&K==="}"){Q--,Y+=K;continue}if(J){Y+=K;continue}if(K==="(")X.paren++;else if(K===")")X.paren--;else if(K==="[")X.bracket++;else if(K==="]")X.bracket--;else if(K==="{")X.brace++;else if(K==="}")X.brace--;if(K===","&&X.paren===0&&X.bracket===0&&X.brace===0){Z.push(Y.trim()),Y="";continue}Y+=K}if(Y.trim())Z.push(Y.trim());return Z}function oK($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return null;let X=b0($,"(",")",Y);if(X===-1)return null;return{params:$.slice(Y+1,X),endPos:X+1}}function aK($){let Z=[],X=new X4($).tokenize().filter((Q)=>Q.type!=="WHITESPACE"&&Q.type!=="COMMENT"),J=0;while(J<X.length){let Q=X[J],G=!1;if(Q.type==="IDENTIFIER"&&Q.value==="export"){if(G=!0,J++,J>=X.length)break}let K=X[J];if(K.type==="IDENTIFIER"&&(K.value==="const"||K.value==="let"||K.value==="var")){let W=K.value;if(J++,J>=X.length)break;let _=X[J];if(_.type==="IDENTIFIER"){let B=_.value;if(J++,J<X.length&&X[J].type==="OPERATOR"&&X[J].value==="="){J++;let U=J<X.length?X[J].start:$.length,z=iK(X,J,$);J=z.nextIndex,Z.push({type:"variable",name:B,value:$.slice(U,z.endPos),exported:G,start:K.start,end:z.endPos})}}else if(_.type==="PUNCTUATION"&&(_.value==="{"||_.value==="[")){let B=_.start,U=_.value==="{"?"}":"]",z=b0($,_.value,U,B);if(z!==-1){let q=$.slice(B,z+1);if(J=nK(X,z+1),J<X.length&&X[J].type==="OPERATOR"&&X[J].value==="="){J++;let j=J<X.length?X[J].start:$.length,H=iK(X,J,$);J=H.nextIndex;let O=`__stx_destructured_${Z.length}`;Z.push({type:"variable",name:O,value:`${$.slice(j,H.endPos)}; ${W} ${q} = ${O}`,exported:G,start:K.start,end:H.endPos})}}}}else if(K.type==="IDENTIFIER"&&K.value==="function"){let W=G?X[J-1].start:K.start;if(J++,J>=X.length)break;let _=X[J];if(_.type==="IDENTIFIER"){let B=_.value;J++;let U=-1;while(J<X.length){if(X[J].type==="PUNCTUATION"&&X[J].value==="{"){U=X[J].start;break}J++}if(U!==-1){let z=b0($,"{","}",U);if(z!==-1)Z.push({type:"function",name:B,value:$.slice(W,z+1).replace(/^export\s+/,""),exported:G,start:W,end:z+1}),J=nK(X,z+1)}}}else J++}return Z}function iK($,Z,Y){let X=Z,J={paren:0,bracket:0,brace:0},Q=Z<$.length?$[Z].start:Y.length;while(X<$.length){let G=$[X];if(G.type==="PUNCTUATION"){if(G.value==="(")J.paren++;else if(G.value===")")J.paren--;else if(G.value==="[")J.bracket++;else if(G.value==="]")J.bracket--;else if(G.value==="{")J.brace++;else if(G.value==="}")J.brace--;if(G.value===";"&&J.paren===0&&J.bracket===0&&J.brace===0){Q=G.start,X++;break}}if(G.type==="IDENTIFIER"&&(G.value==="const"||G.value==="let"||G.value==="var"||G.value==="function"||G.value==="export")){if(J.paren===0&&J.bracket===0&&J.brace===0){Q=$[X-1]?.end??G.start;break}}Q=G.end,X++}return{nextIndex:X,endPos:Q}}function nK($,Z){for(let Y=0;Y<$.length;Y++)if($[Y].start>=Z)return Y;return $.length}var tK=()=>{};var b3=D(()=>{lK();tK()});function aF($,Z,Y){let X=$,J=!0;while(J){J=!1;let Q=X.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=S3(X,G);if(!K)break;try{let W;if(B0(K.expression))W=j0(K.expression,Object.keys(Z))(...Object.values(Z));else W=L0(K.expression,Z);let _="",B=!1;for(let U of K.cases)if(U.type==="default"){if(!B)_=U.content.trim()}else try{let z;if(U.value&&B0(U.value))z=j0(U.value,Object.keys(Z))(...Object.values(Z));else if(U.value)z=L0(U.value,Z);if(W===z){_=U.content.trim(),B=!0;break}}catch{continue}X=X.substring(0,G)+_+X.substring(K.end),J=!0}catch(W){let _=W instanceof Error?W.message:String(W),B=$0("Switch",`Error evaluating @switch expression: ${_}`,o.EVALUATION_ERROR);X=X.substring(0,G)+B+X.substring(K.end);break}}return X}function u5($,Z,Y){let X=$;X=aF(X,Z,Y);{let Q=!0;while(Q){Q=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,W=l1(X,K+7);if(!W)break;let _=W.endPos,B=z$(X,"unless","endunless",_);if(B===-1){console.warn(`[stx] @unless directive at position ${K} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let U=X.slice(_,B),z=W.expression,q=-1;{let H=0,O=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,L=/@else(?![a-z])/g,V=[],A;while((A=O.exec(U))!==null)V.push({pos:A.index,type:"open"});while((A=F.exec(U))!==null)V.push({pos:A.index,type:"close"});while((A=L.exec(U))!==null)V.push({pos:A.index,type:"else"});V.sort((N,w)=>N.pos-w.pos);for(let N of V)if(N.type==="open")H++;else if(N.type==="close")H--;else if(N.type==="else"&&H===0){q=N.pos;break}}let j;if(q!==-1){let H=U.slice(0,q),O=U.slice(q+5);j=`@if (${z})${O}@else ${H}@endif`}else j=`@if (!(${z}))${U}@endif`;X=X.substring(0,K)+j+X.substring(B+10),Q=!0}}X=kX(X,Z,Y),X=SX(X,Z,Y),X=DX(X,Z);let J=()=>{let Q=k3(X);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let K=Q[G];try{let W="",_=!1;for(let B of K.branches){if(_)break;if(B.type==="else")W=B.content,_=!0;else try{let U;if(B.condition&&B0(B.condition))U=j0(B.condition,Object.keys(Z))(...Object.values(Z));else if(B.condition)U=L0(B.condition,Z);if(U)W=B.content,_=!0}catch(U){W=$0(B.type==="if"?"If":"Elseif",`Error in @${B.type}(${B.condition}): ${U instanceof Error?U.message:String(U)}`,o.EVALUATION_ERROR),_=!0}}X=X.substring(0,K.start)+W+X.substring(K.end)}catch(W){let _=W instanceof Error?W.message:String(W),B=$0("If",`Error processing @if block: ${_}`,o.EVALUATION_ERROR);X=X.substring(0,K.start)+B+X.substring(K.end)}}return!0};while(J());return X}function eK($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let Y=$[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let X=[];while(Z<$.length){let J=$[Z];if(J==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(J===Y){Z++;break}X.push(J),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function DX($,Z){let Y=$;function X(K,W,_,B){let U=1,z=B,q=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${_}(?![a-z])`,"g");while(z<K.length&&U>0){q.lastIndex=z,j.lastIndex=z;let H=q.exec(K),O=j.exec(K),F=H?H.index:1/0,L=O?O.index:1/0;if(F<L)U++,z=F+H[0].length;else if(L<1/0){if(U--,U===0)return L;z=L+O[0].length}else break}return-1}function J(K,W,_){let B=0,U=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),z=new RegExp(`@${_}(?![a-z])`,"g"),q=/@else(?![a-z])/g,j=[],H;while((H=U.exec(K))!==null)j.push({pos:H.index,type:"open"});while((H=z.exec(K))!==null)j.push({pos:H.index,type:"close"});while((H=q.exec(K))!==null)j.push({pos:H.index,type:"else"});j.sort((O,F)=>O.pos-F.pos);for(let O of j)if(O.type==="open")B++;else if(O.type==="close")B--;else if(O.type==="else"&&B===0)return O.pos;return-1}{let K=!0;while(K){K=!1;let W=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let _=W.index,B,U,z=Y.slice(_+5),q=eK(z);if(q)B=q.value,U=_+5+q.consumed;else U=_+5;let j=X(Y,"auth","endauth",U);if(j===-1){console.warn(`[stx] @auth directive at position ${_} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(U,j),O=J(H,"auth","endauth"),F;if(!Z.auth)F=!1;else F=B?c1(`auth?.check && auth?.user?.[${B}]`,Z):c1("auth?.check",Z);let L;if(O!==-1){let V=H.slice(0,O),A=H.slice(O+5);L=F?V:A}else L=F?H:"";Y=Y.substring(0,_)+L+Y.substring(j+8),K=!0}}{let K=!0;while(K){K=!1;let W=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let _=W.index,B,U,z=Y.slice(_+6),q=eK(z);if(q)B=q.value,U=_+6+q.consumed;else U=_+6;let j=X(Y,"guest","endguest",U);if(j===-1){console.warn(`[stx] @guest directive at position ${_} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(U,j),O=J(H,"guest","endguest"),F;if(!Z.auth)F=!0;else F=B?c1(`!auth?.check || !auth?.user?.[${B}]`,Z):c1("!auth?.check",Z);let L;if(O!==-1){let V=H.slice(0,O),A=H.slice(O+5);L=F?V:A}else L=F?H:"";Y=Y.substring(0,_)+L+Y.substring(j+9),K=!0}}function Q(K,W,_){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let B=[K];if(W)B.push(W);if(_){let U=c1(_,Z);B.push(U)}return Z.permissions.check(...B)}catch{return!1}return!1}function G(K){let W=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!W)return null;return{ability:W[1],type:W[2],id:W[3]?.trim(),paramsEnd:W[0].length}}for(let K of["can","cannot"]){let W=`end${K}`,_=K==="can"?"elsecan":"elsecannot",B=!0;while(B){B=!1;let U=Y.match(new RegExp(`@${K}\\s*\\(`));if(!U||U.index===void 0)break;let z=U.index,q=Y.slice(z+`@${K}`.length),j=G(q);if(!j)break;let H=z+`@${K}`.length+j.paramsEnd,O=X(Y,K,W,H);if(O===-1){console.warn(`[stx] @${K} directive at position ${z} has no matching @${W} \u2014 the block was skipped.`);break}let F=Y.slice(H,O),L=[],V=0,A=new RegExp(`@${K}\\s*\\(`,"g"),N=new RegExp(`@${W}(?![a-z])`,"g"),w=new RegExp(`@${_}\\s*\\(`,"g"),M=/@else(?![a-z])/g,T=[],I;while((I=A.exec(F))!==null)T.push({pos:I.index,type:"open"});while((I=N.exec(F))!==null)T.push({pos:I.index,type:"close"});while((I=w.exec(F))!==null)T.push({pos:I.index,type:"elseDirective"});while((I=M.exec(F))!==null)T.push({pos:I.index,type:"else"});T.sort((x,C)=>x.pos-C.pos);for(let x of T){if(x.type==="open"){V++;continue}if(x.type==="close"){V--;continue}if(V===0)L.push(x)}let E=[],S=0;for(let x=0;x<L.length;x++){let C=L[x];if(E.push({content:F.slice(S,C.pos),ability:void 0}),C.type==="elseDirective"){let f=F.slice(C.pos+`@${_}`.length),g=G(f);if(g){E[E.length-1]={content:F.slice(S,C.pos)},S=C.pos+`@${_}`.length+g.paramsEnd,E.push({content:"",ability:g.ability,type:g.type,id:g.id}),E.pop();let h=L[x+1],l=h?h.pos:F.length;E.push({content:F.slice(S,l),ability:g.ability,type:g.type,id:g.id}),S=l}}else S=C.pos+5}if(S<F.length){let x=E[E.length-1];if(L.length>0&&L[L.length-1].type==="else")E.push({content:F.slice(S),isFinalElse:!0});else if(E.length===0)E.push({content:F.slice(S)})}let k=Q(j.ability,j.type,j.id),b=K==="can"?k:!k,P="";if(b)P=E[0]?.content||"";else{let x=!1;for(let C=1;C<E.length;C++){let f=E[C];if(f.isFinalElse){P=f.content,x=!0;break}if(f.ability){let g=Q(f.ability,f.type,f.id);if(K==="can"?g:!g){P=f.content,x=!0;break}}}if(!x&&E.length>0){let C=E[E.length-1];if(C.isFinalElse)P=C.content}}Y=Y.substring(0,z)+P+Y.substring(O+`@${W}`.length),B=!0}}return Y}function kX($,Z,Y){let X=$;function J(Q,G,K,W,_){let B=!0;while(B){B=!1;let U=new RegExp(`@${G}\\s*\\(`),z=Q.match(U);if(!z||z.index===void 0)break;let q=z.index,j=l1(Q,q+`@${G}`.length);if(!j)break;let H=j.endPos,O=z$(Q,G,K,H);if(O===-1){console.warn(`[stx] @${G} directive at position ${q} has no matching @${K} \u2014 the block was skipped.`);break}let F=Q.slice(H,O),L=j.expression,V=-1,A=0,N=0;while(N<F.length){let w=F.indexOf("@",N);if(w===-1)break;let M=F.substring(w);if(/^@(?:if|unless|isset|empty)\s*\(/.test(M)){A++,N=w+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(M)){A--,N=w+1;continue}if(A===0&&/^@else(?![a-z])/.test(M)){V=w;break}N=w+1}try{let w=W(L.trim()),M;if(V!==-1){let T=F.slice(0,V),I=F.slice(V+5);M=w?T:I}else M=w?F:"";Q=Q.substring(0,q)+M+Q.substring(O+`@${K}`.length),B=!0}catch(w){let M=w instanceof Error?w.message:String(w),T=$0(_,`Error processing @${G} directive: ${M}`,o.EVALUATION_ERROR);Q=Q.substring(0,q)+T+Q.substring(O+`@${K}`.length);break}}return Q}return X=J(X,"isset","endisset",(Q)=>{let G=c1(Q,Z);return G!==void 0&&G!==null},"Isset"),X=J(X,"empty","endempty",(Q)=>{let G=c1(Q,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),X}function SX($,Z,Y){let X=$,J="development";function Q(G,K,W,_){let B=new RegExp(`@${K}(?![a-z])`,"g"),U=new RegExp(`@${W}(?![a-z])`,"g"),z=new RegExp(`^@${K}(?![a-z])`),q=new RegExp(`^@${W}(?![a-z])`),j=G,H=!0;while(H){H=!1,B.lastIndex=0;let O=B.exec(j);if(!O)break;let F=O.index,L=F+O[0].length;if(K==="env"){let k=j.substring(L).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!k)break;L+=k[0].length,_=J===k[2]}let V=1,A=L,N=-1;while(V>0&&A<j.length){B.lastIndex=A,U.lastIndex=A;let k=B.exec(j),b=U.exec(j),P=k?k.index:1/0,x=b?b.index:1/0;if(P<x)V++,A=P+k[0].length;else if(x<1/0){if(V--,V===0){N=x;break}A=x+b[0].length}else break}if(N===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${W} \u2014 the block was skipped.`);break}let w=j.substring(L,N),M=-1,T=0,I=0;while(I<w.length){let k=w.indexOf("@",I);if(k===-1)break;let b=w.substring(k);if(z.test(b)){T++,I=k+1;continue}if(q.test(b)){T--,I=k+1;continue}if(T===0&&/^@else(?![a-z])/.test(b)){M=k;break}I=k+1}let E;if(M!==-1){let k=w.slice(0,M),b=w.slice(M+5);E=_?k:b}else E=_?w:"";let S=`@${W}`.length;j=j.substring(0,F)+E+j.substring(N+S),H=!0}return j}return X=Q(X,"env","endenv",!1),X=Q(X,"production","endproduction",J==="production"),X=Q(X,"development","enddevelopment",J==="development"),X=Q(X,"staging","endstaging",J==="staging"),X=Q(X,"testing","endtesting",J==="testing"),X}var C3=D(()=>{MX();X1();b3();h0()});function CX($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function q$($,Z){if(!$)return Z?.nonceGenerator?.()??CX();let Y=bX.get($);if(!Y)Y=Z?.nonceGenerator?.()??CX(),bX.set($,Y);return Y}function tF($){bX.delete($)}function yX($,Z){let Y=[];for(let[X,J]of Object.entries($)){if(J===void 0||J===null)continue;if(typeof J==="boolean"){if(J)Y.push(X);continue}if(Array.isArray(J)){let Q=[...J];if(Z&&(X==="script-src"||X==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)Y.push(`${X} ${Q.join(" ")}`)}}return Y.join("; ")}function P3($,Z){return`<meta http-equiv="Content-Security-Policy" content="${yX($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function eF($){return{enabled:!0,directives:{strict:$W,moderate:y3,relaxed:ZW,api:YW}[$]||y3,useNonce:$==="strict",addMetaTag:!0}}function $V($,Z){let Y={...$};for(let[X,J]of Object.entries(Z)){let Q=X,G=Y[Q];if(J===void 0||J===null)continue;if(typeof J==="boolean")Y[Q]=G||J;else if(Array.isArray(J)){let K=Array.isArray(G)?G:[],W=[...new Set([...K,...J])];Y[Q]=W}}return Y}function PX($,Z,Y){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=Z.useNonce?q$(Y,Z):void 0,J=P3(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
3811
- ${J}`)}function ZV($,Z){let Y=$;return Y=Y.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(X,J)=>{if(J.includes("nonce="))return X;return`<script nonce="${Z}"${J}>`}),Y=Y.replace(/<style([^>]*)>/gi,(X,J)=>{if(J.includes("nonce="))return X;return`<style nonce="${Z}"${J}>`}),Y}function xX($,Z,Y,X){let J=$,Q=X.csp;if(J=J.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?q$(Z,Q):void 0;return P3(Q.directives,G)}),J=J.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return q$(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=q$(Z,Q);return J}function YV(){return[XW,JW]}function XV($){let Z=[];if($["script-src"]?.includes("'unsafe-inline'"))Z.push("CSP: Using unsafe-inline in script-src significantly reduces XSS protection");if($["script-src"]?.includes("'unsafe-eval'"))Z.push("CSP: Using unsafe-eval in script-src allows eval() and related functions");if(!$["default-src"])Z.push("CSP: No default-src specified. Recommend adding default-src as a fallback");if($["default-src"]?.includes("*"))Z.push("CSP: Using * in default-src provides minimal protection");if(!$["object-src"]&&!$["default-src"]?.includes("'none'"))Z.push("CSP: Consider adding object-src: none to block plugins");if(!$["base-uri"])Z.push("CSP: Consider adding base-uri to prevent base tag injection attacks");for(let[Y,X]of Object.entries($))if(Array.isArray(X)&&X.includes("http:"))Z.push(`CSP: Using http: in ${Y} allows insecure resources`);return Z}function QW($=!1){return $?"Content-Security-Policy-Report-Only":"Content-Security-Policy"}function JV($,Z){if(!$.enabled)return{};let Y=$.useNonce?q$(Z,$):void 0,X=yX($.directives,Y);return{[QW($.reportOnly)]:X}}var bX,$W,y3,ZW,YW,XW,JW,QV;var vX=D(()=>{bX=new WeakMap;$W={"default-src":["'self'"],"script-src":["'self'","'strict-dynamic'"],"style-src":["'self'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'none'"],"base-uri":["'self'"],"form-action":["'self'"],"frame-ancestors":["'self'"],"upgrade-insecure-requests":!0},y3={"default-src":["'self'"],"script-src":["'self'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'","https:"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'self'"],"base-uri":["'self'"],"form-action":["'self'"],"upgrade-insecure-requests":!0},ZW={"default-src":["'self'"],"script-src":["'self'","'unsafe-inline'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:","http:"],"font-src":["'self'","https:","http:","data:"],"connect-src":["'self'","https:","http:","ws:","wss:"],"media-src":["'self'","https:","http:"],"object-src":["'none'"],"frame-src":["'self'","https:"],"base-uri":["'self'"]},YW={"default-src":["'none'"],"frame-ancestors":["'none'"]};XW={name:"csp",handler:($,Z,Y,X)=>{let Q=Y.__stx_options?.csp;if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?q$(Y,Q):void 0;return P3(Q.directives,G)},hasEndTag:!1,description:"Insert Content-Security-Policy meta tag"},JW={name:"cspNonce",handler:($,Z,Y,X)=>{let Q=Y.__stx_options?.csp;if(!Q?.enabled||!Q.useNonce)return"";return q$(Y,Q)},hasEndTag:!1,description:"Output the current CSP nonce value"};QV={enabled:!1,reportOnly:!1,directives:y3,useNonce:!1,addMetaTag:!0}});import GV from"crypto";function WV($=KV){let Z=GV.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return fX=Z,Z}function _V(){if(!fX)WV();return fX}function BV($=GW){let Z=_V();return`<input type="hidden" name="${$}" value="${Z}">`}function KW($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,X)=>{return BV(X||GW)})}var KV=40,GW="_token",fX=null;var WW=()=>{};async function gX($,Z,Y,X){if(!X.customDirectives||X.customDirectives.length===0)return $;let J=$;for(let Q of X.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(X.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)J=await UV(J,Q,Z,Y,X);else J=await zV(J,Q,Z,Y,X)}return J}async function UV($,Z,Y,X,J){let{name:Q,handler:G}=Z,K=`@${Q}`,W=`@end${Q}`,_=$,B=B5(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${W}`,"g"),U=[],z=B.exec(_);while(z!==null){let[q,j="",H=""]=z,O=z.index||0;try{let F=j?_W(j):[],L=H.trim(),V=await G(L,F,Y,X);U.push({original:q,processed:V,startIndex:O})}catch(F){let L=F instanceof Error?F.message:String(F);if(J.debug)console.error(`Error processing custom directive @${Q}:`,F);U.push({original:q,processed:$0("CustomDirective",`Error in @${Q}${j?`(${j})`:""}: ${L}`,o.EVALUATION_ERROR),startIndex:O})}z=B.exec(_)}for(let q=U.length-1;q>=0;q--){let{original:j,processed:H}=U[q];_=_.replace(j,H)}return _}async function zV($,Z,Y,X,J){let{name:Q,handler:G}=Z,K=$,W=B5(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),_=[],B=W.exec(K);while(B!==null){let[q,j=""]=B,H=B.index||0;try{let O=_W(j),F=await G("",O,Y,X);_.push({original:q,processed:F,startIndex:H})}catch(O){let F=O instanceof Error?O.message:String(O);if(J.debug)console.error(`Error processing custom directive @${Q}:`,O);_.push({original:q,processed:$0("CustomDirective",`Error in @${Q}(${j}): ${F}`,o.EVALUATION_ERROR),startIndex:H})}B=W.exec(K)}let U=B5(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),z=U.exec(K);while(z!==null){let[q]=z,j=z.index||0;try{let H=await G("",[],Y,X);_.push({original:q,processed:H,startIndex:j})}catch(H){let O=H instanceof Error?H.message:String(H);if(J.debug)console.error(`Error processing custom directive @${Q}:`,H);_.push({original:q,processed:$0("CustomDirective",`Error in @${Q}: ${O}`,o.EVALUATION_ERROR),startIndex:j})}z=U.exec(K)}for(let q=_.length-1;q>=0;q--){let{original:j,processed:H}=_[q];K=K.replace(j,H)}return K}function _W($){if(!$.trim())return[];let Z=[],Y="",X=!1,J="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!X)X=!0,J=G;else if(G===J)X=!1;else Y+=G;else if(G===","&&!X)Z.push(Y.trim()),Y="";else Y+=G}if(Y.trim())Z.push(Y.trim());return Z.map((Q)=>{let G=Q.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var hX=D(()=>{X1();g$()});var f3={};Q0(f3,{useTitle:()=>zW,useSeoMeta:()=>Q4,usePageTitle:()=>zW,useHead:()=>H$,resetHead:()=>BW,renderHtmlAttrs:()=>jW,renderHead:()=>qW,renderBodyAttrs:()=>HW,processTitleDirective:()=>FW,processMetaDirective:()=>VW,processHeadDirective:()=>LW,getPageMeta:()=>v3,getHead:()=>m5,definePageMeta:()=>UW,applyHead:()=>OW});function m5(){return j$}function v3(){return x3}function BW(){j$={},qV.length=0,x3={}}function H$($){j$=jV(j$,$)}function jV($,Z){return{title:Z.title??$.title,titleTemplate:Z.titleTemplate??$.titleTemplate,base:Z.base??$.base,meta:[...$.meta||[],...Z.meta||[]],link:[...$.link||[],...Z.link||[]],script:[...$.script||[],...Z.script||[]],style:[...$.style||[],...Z.style||[]],htmlAttrs:{...$.htmlAttrs,...Z.htmlAttrs},bodyAttrs:{...$.bodyAttrs,...Z.bodyAttrs}}}function Q4($){let Z=[];if($.description)Z.push({name:"description",content:$.description});if($.keywords){let W=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Z.push({name:"keywords",content:W})}if($.author)Z.push({name:"author",content:$.author});if($.robots)Z.push({name:"robots",content:$.robots});let Y=$.ogTitle??$.title,X=$.ogDescription??$.description;if(Y)Z.push({property:"og:title",content:Y});if(X)Z.push({property:"og:description",content:X});if($.ogImage)Z.push({property:"og:image",content:$.ogImage});if($.ogUrl)Z.push({property:"og:url",content:$.ogUrl});if($.ogType)Z.push({property:"og:type",content:$.ogType});if($.ogSiteName)Z.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)Z.push({property:"og:locale",content:$.ogLocale});let J=$.twitterTitle??$.title,Q=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(J)Z.push({name:"twitter:title",content:J});if(Q)Z.push({name:"twitter:description",content:Q});if(G)Z.push({name:"twitter:image",content:G});if($.twitterSite)Z.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)Z.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)Z.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)Z.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)Z.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)Z.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let W of $.articleTags)Z.push({property:"article:tag",content:W});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});H$({title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K})}function UW($){if(x3={...x3,...$},$.title||$.description)Q4({title:$.title,description:$.description})}function zW($){let Z=typeof $==="function"?$():$;H$({title:Z})}function qW($=j$){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${d$(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([X,J])=>`${X}="${d$(J)}"`).join(" ");Z.push(`<base ${Y}>`)}for(let Y of $.meta||[]){let X=Object.entries(Y).filter(([J,Q])=>Q!==void 0).map(([J,Q])=>{return`${J==="httpEquiv"?"http-equiv":J}="${d$(String(Q))}"`}).join(" ");Z.push(`<meta ${X}>`)}for(let Y of $.link||[]){let X=Object.entries(Y).filter(([J,Q])=>Q!==void 0).map(([J,Q])=>`${J}="${d$(String(Q))}"`).join(" ");Z.push(`<link ${X}>`)}for(let Y of $.script||[]){let{content:X,...J}=Y,Q=Object.entries(J).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${d$(String(K))}"`}).filter(Boolean).join(" ");if(X)Z.push(`<script ${Q}>${X}</script>`);else Z.push(`<script ${Q}></script>`)}for(let Y of $.style||[]){let X=Y.type?` type="${Y.type}"`:"";Z.push(`<style${X}>${Y.content}</style>`)}return Z.join(`
3812
- `)}function jW($=j$){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${d$(Y)}"`).join(" ")}function HW($=j$){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${d$(Y)}"`).join(" ")}function d$($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function OW($=j$){if(typeof document>"u")return;if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);document.title=Z}for(let Z of $.meta||[]){let Y=Z.name?`meta[name="${Z.name}"]`:Z.property?`meta[property="${Z.property}"]`:null;if(Y){let X=document.querySelector(Y);if(!X){if(X=document.createElement("meta"),Z.name)X.setAttribute("name",Z.name);if(Z.property)X.setAttribute("property",Z.property);document.head.appendChild(X)}X.setAttribute("content",Z.content)}}for(let Z of $.link||[]){let Y=`link[rel="${Z.rel}"]${Z.href?`[href="${Z.href}"]`:""}`,X=document.querySelector(Y);if(!X)X=document.createElement("link"),document.head.appendChild(X);for(let[J,Q]of Object.entries(Z))if(Q!==void 0)X.setAttribute(J,String(Q))}if($.htmlAttrs)for(let[Z,Y]of Object.entries($.htmlAttrs))document.documentElement.setAttribute(Z,Y);if($.bodyAttrs)for(let[Z,Y]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,Y)}function LW($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(X,J)=>{return Z+=J.trim()+`
3813
- `,""}),headContent:Z.trim()}}function FW($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,X,J,Q)=>{let G=X?J:Z[(Q||"").trim()]??Q;return H$({title:G}),""})}function VW($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Y,X,J,Q,G,K)=>{let W=Q?G:K,_=Q?W:Z[(W||"").trim()]??W,U=J.includes(":")?{property:J,content:_}:{name:J,content:_};return H$({meta:[U]}),""})}var j$,qV,x3;var O$=D(()=>{j$={},qV=[],x3={}});import HV from"crypto";function g0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function OV($){return{...h3,...$.forms?.classes}}function g3($,Z,Y,X){let J=$||Z;return Y?`${J} ${X}`:J}function LV(){return HV.randomUUID()}function FV($,Z,Y,X){let J=OV(X),Q=$;return Q=RW(Q,Z),Q=p5(Q,Z),Q=d3(Q,Z,J),Q=u3(Q,Z,J),Q}function p5($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=LV();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${g0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,J)=>{let Q=J.toUpperCase();if(J&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${g0(Q)}">`;return X}),Y}function d3($,Z,Y=h3){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(J,Q,G,K,W,_="")=>{let B=Q||G||"POST",U=K||W||"",z=L$(_),q=B.toUpperCase(),j=["GET","POST"].includes(q)?q:"POST",H=`<form method="${g0(j)}" action="${g0(U)}"${z?` ${z}`:""}>`;if(H+=`
3810
+ `)this.line++,this.column=0;else this.column++;this.pos++}}peek($){return this.source[this.pos+$]}saveState(){return{pos:this.pos,line:this.line,column:this.column}}restoreState($){this.pos=$.pos,this.line=$.line,this.column=$.column}}function b0($,Z,Y,X=0){let J=0,Q=X,G=null,K=0,W=!1;while(Q<$.length){let _=$[Q];if(G&&W){W=!1,Q++;continue}if(G&&_==="\\"){W=!0,Q++;continue}if(W=!1,(_==='"'||_==="'"||_==="`")&&!G){G=_,Q++;continue}if(_===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&_==="$"&&$[Q+1]==="{"){K++,Q+=2;continue}if(K>0&&_==="}"){K--,Q++;continue}if(_==="`"&&G==="`"&&K===0){G=null,Q++;continue}if(G){Q++;continue}if(_===Z)J++;else if(_===Y){if(J--,J===0)return Q}Q++}return-1}function MX($,Z){let Y=Z,X={paren:0,bracket:0,brace:0},J=null,Q=0;while(Y<$.length){let G=$[Y];if((Y>0?$[Y-1]:"")==="\\"&&J){Y++;continue}if((G==='"'||G==="'")&&!J){J=G,Y++;continue}if(G===J&&J!=="`"){J=null,Y++;continue}if(G==="`"&&!J){J="`",Y++;continue}if(G==="`"&&J==="`"&&Q===0){J=null,Y++;continue}if(J==="`"&&G==="$"&&$[Y+1]==="{"){Q++,Y+=2;continue}if(Q>0){if(G==="{")Q++;else if(G==="}")Q--;Y++;continue}if(J){Y++;continue}if(X.paren===0&&X.bracket===0&&X.brace===0){if($.slice(Y,Y+2)==="}}"||$.slice(Y,Y+3)==="!!}")break;if(G===","||G===";")break}if(G==="(")X.paren++;else if(G===")"){if(X.paren--,X.paren<0)break}else if(G==="[")X.bracket++;else if(G==="]"){if(X.bracket--,X.bracket<0)break}else if(G==="{")X.brace++;else if(G==="}"){if(X.brace--,X.brace<0)break}Y++}return{expression:$.slice(Z,Y),endPos:Y}}function D3($){let Z=[],Y="",X={paren:0,bracket:0,brace:0},J=null,Q=0;for(let G=0;G<$.length;G++){let K=$[G];if((G>0?$[G-1]:"")==="\\"&&J){Y+=K;continue}if((K==='"'||K==="'")&&!J){J=K,Y+=K;continue}if(K===J&&J!=="`"){J=null,Y+=K;continue}if(K==="`"&&!J){J="`",Y+=K;continue}if(K==="`"&&J==="`"&&Q===0){J=null,Y+=K;continue}if(J==="`"&&K==="$"&&$[G+1]==="{"){Q++,Y+=K+$[G+1],G++;continue}if(Q>0&&K==="{"){Q++,Y+=K;continue}if(Q>0&&K==="}"){Q--,Y+=K;continue}if(J){Y+=K;continue}if(K==="(")X.paren++;else if(K===")")X.paren--;else if(K==="[")X.bracket++;else if(K==="]")X.bracket--;else if(K==="{")X.brace++;else if(K==="}")X.brace--;if(K==="|"&&$[G+1]!=="|"&&(G===0||$[G-1]!=="|")&&$[G-1]!=="\\"&&X.paren===0&&X.bracket===0&&X.brace===0){Z.push(Y.trim()),Y="";continue}if(K==="|"&&$[G-1]==="\\"&&!J){Y=Y.slice(0,-1)+K;continue}Y+=K}if(Y.trim())Z.push(Y.trim());return Z}function l1($,Z){let Y=sF($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function sF($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let X=b0($,"(",")",Y);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,X),endPos:X+1}}function q$($,Z,Y,X){let J=1,Q=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(Q<$.length&&J>0){G.lastIndex=Q,K.lastIndex=Q;let W=G.exec($),_=K.exec($),B=W?W.index:1/0,U=_?_.index:1/0;if(B<U)J++,Q=B+W[0].length;else if(U<1/0){if(J--,J===0)return U;Q=U+_[0].length}else break}return-1}function TX($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let X=Z+Y[0].length,J=l1($,X);if(!J)return null;let Q=J.endPos,G=q$($,"if","endif",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],_=0,B="if",U=J.expression,z=0,q=0;while(_<K.length){let j=K.indexOf("@",_);if(j===-1)break;_=j;let H=K.substring(j);if(/^@if\s*\(/.test(H)){q++,_++;continue}if(/^@endif(?![a-z])/.test(H)){q--,_+=6;continue}if(q===0){let O=H.match(/^@elseif\s*/);if(O){W.push({type:B,condition:U,content:K.substring(z,_),start:Q+z,end:Q+_});let F=_+O[0].length,L=l1(K,F);if(!L){_++;continue}B="elseif",U=L.expression,_=L.endPos,z=_;continue}else if(/^@else(?![a-z])/.test(H)){W.push({type:B,condition:U,content:K.substring(z,_),start:Q+z,end:Q+_}),B="else",U=void 0,_+=5,z=_;continue}}_++}return W.push({type:B,condition:U,content:K.slice(z),start:Q+z,end:Q+K.length}),{fullMatch:$.slice(Z,G+6),branches:W,start:Z,end:G+6}}function k3($){let Z=[],Y=/@if\s*\(/g,X=Y.exec($);while(X!==null){if(Z.some((G)=>X.index>G.start&&X.index<G.end)){X=Y.exec($);continue}let Q=TX($,X.index);if(Q)Z.push(Q),Y.lastIndex=Q.end;X=Y.exec($)}return Z}function J4($,Z,Y){let X=[],J=new RegExp(`@${Z}\\s*\\(`,"g"),Q=J.exec($);while(Q!==null){if(X.some((H)=>Q.index>H.start&&Q.index<H.end)){Q=J.exec($);continue}let K=Q.index,W=K+Q[0].length-1,_=b0($,"(",")",W);if(_===-1){Q=J.exec($);continue}let B=$.slice(W+1,_),U=_+1,z=q$($,Z,Y,U);if(z===-1){Q=J.exec($);continue}let q=$.slice(U,z),j=z+`@${Y}`.length;X.push({fullMatch:$.slice(K,j),name:Z,params:B,content:q,start:K,end:j}),J.lastIndex=j,Q=J.exec($)}return X}function S3($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let X=Z+Y[0].length,J=l1($,X);if(!J)return null;let Q=J.endPos,G=q$($,"switch","endswitch",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],_=0,B=null,U=0;while(_<K.length){let z=K.slice(_),q=z.match(/^@switch\s*\(/),j=z.match(/^@endswitch(?![a-z])/);if(q){if(U++,B)B.content+=q[0];_+=q[0].length;continue}if(j){if(U--,B)B.content+=j[0];_+=j[0].length;continue}if(U>0){if(B)B.content+=K[_];_++;continue}let H=z.match(/^@case\s*/),O=z.match(/^@default(?![a-z])/),F=z.match(/^@break(?![a-z])/);if(H&&z.startsWith("@case")){if(B)W.push(B);let L=_+H[0].length,V=l1(K,L);if(!V){_++;continue}B={type:"case",value:V.expression,content:""},_=V.endPos}else if(O&&z.startsWith("@default")){if(B)W.push(B);B={type:"default",content:""},_+=O[0].length}else if(F&&z.startsWith("@break"))_+=F[0].length;else{if(B)B.content+=K[_];_++}}if(B)W.push(B);return{fullMatch:$.slice(Z,G+10),expression:J.expression,cases:W,start:Z,end:G+10}}var lK=()=>{};function sK($){let Z=[],Y=0;while(Y<$.length){let X=$.indexOf("{{",Y),J=$.indexOf("{!!",Y),Q=!1,G;if(X===-1&&J===-1)break;else if(X===-1)G=J,Q=!0;else if(J===-1)G=X,Q=!1;else if(J<X)G=J,Q=!0;else G=X,Q=!1;if(!Q&&$.slice(G,G+3)==="{{{")Q=!0;let K=Q?$.slice(G,G+3)==="{{{"?"{{{":"{!!":"{{",W=Q?K==="{{{"?"}}}":"!!}":"}}",_=G+K.length,B=rF($,_,W);if(B===-1){Y=G+1;continue}let U=$.slice(_,B).trim(),z=B+W.length;Z.push({fullMatch:$.slice(G,z),expression:U,start:G,end:z,isRaw:Q}),Y=z}return Z}function rF($,Z,Y){let X=Z,J=null,Q={paren:0,bracket:0,brace:0},G=0;while(X<$.length){let K=$[X];if((X>0?$[X-1]:"")==="\\"&&J){X++;continue}if((K==='"'||K==="'")&&!J){J=K,X++;continue}if(K===J&&J!=="`"){J=null,X++;continue}if(K==="`"&&!J){J="`",X++;continue}if(K==="`"&&J==="`"&&G===0){J=null,X++;continue}if(J==="`"&&K==="$"&&$[X+1]==="{"){G++,X+=2;continue}if(G>0){if(K==="{")G++;else if(K==="}")G--;X++;continue}if(J){X++;continue}if(K==="(")Q.paren++;else if(K===")")Q.paren--;else if(K==="[")Q.bracket++;else if(K==="]")Q.bracket--;else if(K==="{")Q.brace++;else if(K==="}")Q.brace--;if(Q.paren===0&&Q.bracket===0&&Q.brace<=0){if($.slice(X,X+Y.length)===Y)return X}X++}return-1}function rK($){let Z=D3($);if(Z.length===0)return{baseExpression:"",filters:[]};let Y=Z[0],X=[];for(let J=1;J<Z.length;J++){let Q=oF(Z[J]);if(Q)X.push(Q)}return{baseExpression:Y,filters:X}}function oF($){let Z=$.trim();if(!Z)return null;let Y=Z.indexOf("(");if(Y===-1)return{name:Z,args:[]};let X=Z.slice(0,Y).trim(),J=Y+1,Q=b0(Z,"(",")",Y);if(Q===-1)return{name:X,args:[]};let G=Z.slice(J,Q),K=EX(G);return{name:X,args:K}}function EX($){let Z=[],Y="",X={paren:0,bracket:0,brace:0},J=null,Q=0;for(let G=0;G<$.length;G++){let K=$[G];if((G>0?$[G-1]:"")==="\\"&&J){Y+=K;continue}if((K==='"'||K==="'")&&!J){J=K,Y+=K;continue}if(K===J&&J!=="`"){J=null,Y+=K;continue}if(K==="`"&&!J){J="`",Y+=K;continue}if(K==="`"&&J==="`"&&Q===0){J=null,Y+=K;continue}if(J==="`"&&K==="$"&&$[G+1]==="{"){Q++,Y+="${",G++;continue}if(Q>0&&K==="{"){Q++,Y+=K;continue}if(Q>0&&K==="}"){Q--,Y+=K;continue}if(J){Y+=K;continue}if(K==="(")X.paren++;else if(K===")")X.paren--;else if(K==="[")X.bracket++;else if(K==="]")X.bracket--;else if(K==="{")X.brace++;else if(K==="}")X.brace--;if(K===","&&X.paren===0&&X.bracket===0&&X.brace===0){Z.push(Y.trim()),Y="";continue}Y+=K}if(Y.trim())Z.push(Y.trim());return Z}function oK($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return null;let X=b0($,"(",")",Y);if(X===-1)return null;return{params:$.slice(Y+1,X),endPos:X+1}}function aK($){let Z=[],X=new X4($).tokenize().filter((Q)=>Q.type!=="WHITESPACE"&&Q.type!=="COMMENT"),J=0;while(J<X.length){let Q=X[J],G=!1;if(Q.type==="IDENTIFIER"&&Q.value==="export"){if(G=!0,J++,J>=X.length)break}let K=X[J];if(K.type==="IDENTIFIER"&&(K.value==="const"||K.value==="let"||K.value==="var")){let W=K.value;if(J++,J>=X.length)break;let _=X[J];if(_.type==="IDENTIFIER"){let B=_.value;if(J++,J<X.length&&X[J].type==="OPERATOR"&&X[J].value==="="){J++;let U=J<X.length?X[J].start:$.length,z=iK(X,J,$);J=z.nextIndex,Z.push({type:"variable",name:B,value:$.slice(U,z.endPos),exported:G,start:K.start,end:z.endPos})}}else if(_.type==="PUNCTUATION"&&(_.value==="{"||_.value==="[")){let B=_.start,U=_.value==="{"?"}":"]",z=b0($,_.value,U,B);if(z!==-1){let q=$.slice(B,z+1);if(J=nK(X,z+1),J<X.length&&X[J].type==="OPERATOR"&&X[J].value==="="){J++;let j=J<X.length?X[J].start:$.length,H=iK(X,J,$);J=H.nextIndex;let O=`__stx_destructured_${Z.length}`;Z.push({type:"variable",name:O,value:`${$.slice(j,H.endPos)}; ${W} ${q} = ${O}`,exported:G,start:K.start,end:H.endPos})}}}}else if(K.type==="IDENTIFIER"&&K.value==="function"){let W=G?X[J-1].start:K.start;if(J++,J>=X.length)break;let _=X[J];if(_.type==="IDENTIFIER"){let B=_.value;J++;let U=-1;while(J<X.length){if(X[J].type==="PUNCTUATION"&&X[J].value==="{"){U=X[J].start;break}J++}if(U!==-1){let z=b0($,"{","}",U);if(z!==-1)Z.push({type:"function",name:B,value:$.slice(W,z+1).replace(/^export\s+/,""),exported:G,start:W,end:z+1}),J=nK(X,z+1)}}}else J++}return Z}function iK($,Z,Y){let X=Z,J={paren:0,bracket:0,brace:0},Q=Z<$.length?$[Z].start:Y.length;while(X<$.length){let G=$[X];if(G.type==="PUNCTUATION"){if(G.value==="(")J.paren++;else if(G.value===")")J.paren--;else if(G.value==="[")J.bracket++;else if(G.value==="]")J.bracket--;else if(G.value==="{")J.brace++;else if(G.value==="}")J.brace--;if(G.value===";"&&J.paren===0&&J.bracket===0&&J.brace===0){Q=G.start,X++;break}}if(G.type==="IDENTIFIER"&&(G.value==="const"||G.value==="let"||G.value==="var"||G.value==="function"||G.value==="export")){if(J.paren===0&&J.bracket===0&&J.brace===0){Q=$[X-1]?.end??G.start;break}}Q=G.end,X++}return{nextIndex:X,endPos:Q}}function nK($,Z){for(let Y=0;Y<$.length;Y++)if($[Y].start>=Z)return Y;return $.length}var tK=()=>{};var b3=D(()=>{lK();tK()});function aF($,Z,Y){let X=$,J=!0;while(J){J=!1;let Q=X.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=S3(X,G);if(!K)break;try{let W;if(B0(K.expression))W=j0(K.expression,Object.keys(Z))(...Object.values(Z));else W=L0(K.expression,Z);let _="",B=!1;for(let U of K.cases)if(U.type==="default"){if(!B)_=U.content.trim()}else try{let z;if(U.value&&B0(U.value))z=j0(U.value,Object.keys(Z))(...Object.values(Z));else if(U.value)z=L0(U.value,Z);if(W===z){_=U.content.trim(),B=!0;break}}catch{continue}X=X.substring(0,G)+_+X.substring(K.end),J=!0}catch(W){let _=W instanceof Error?W.message:String(W),B=$0("Switch",`Error evaluating @switch expression: ${_}`,o.EVALUATION_ERROR);X=X.substring(0,G)+B+X.substring(K.end);break}}return X}function u5($,Z,Y){let X=$;X=aF(X,Z,Y);{let Q=!0;while(Q){Q=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,W=l1(X,K+7);if(!W)break;let _=W.endPos,B=q$(X,"unless","endunless",_);if(B===-1){console.warn(`[stx] @unless directive at position ${K} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let U=X.slice(_,B),z=W.expression,q=-1;{let H=0,O=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,L=/@else(?![a-z])/g,V=[],A;while((A=O.exec(U))!==null)V.push({pos:A.index,type:"open"});while((A=F.exec(U))!==null)V.push({pos:A.index,type:"close"});while((A=L.exec(U))!==null)V.push({pos:A.index,type:"else"});V.sort((N,w)=>N.pos-w.pos);for(let N of V)if(N.type==="open")H++;else if(N.type==="close")H--;else if(N.type==="else"&&H===0){q=N.pos;break}}let j;if(q!==-1){let H=U.slice(0,q),O=U.slice(q+5);j=`@if (${z})${O}@else ${H}@endif`}else j=`@if (!(${z}))${U}@endif`;X=X.substring(0,K)+j+X.substring(B+10),Q=!0}}X=DX(X,Z,Y),X=kX(X,Z,Y),X=IX(X,Z);let J=()=>{let Q=k3(X);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let K=Q[G];try{let W="",_=!1;for(let B of K.branches){if(_)break;if(B.type==="else")W=B.content,_=!0;else try{let U;if(B.condition&&B0(B.condition))U=j0(B.condition,Object.keys(Z))(...Object.values(Z));else if(B.condition)U=L0(B.condition,Z);if(U)W=B.content,_=!0}catch(U){W=$0(B.type==="if"?"If":"Elseif",`Error in @${B.type}(${B.condition}): ${U instanceof Error?U.message:String(U)}`,o.EVALUATION_ERROR),_=!0}}X=X.substring(0,K.start)+W+X.substring(K.end)}catch(W){let _=W instanceof Error?W.message:String(W),B=$0("If",`Error processing @if block: ${_}`,o.EVALUATION_ERROR);X=X.substring(0,K.start)+B+X.substring(K.end)}}return!0};while(J());return X}function eK($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let Y=$[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let X=[];while(Z<$.length){let J=$[Z];if(J==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(J===Y){Z++;break}X.push(J),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function IX($,Z){let Y=$;function X(K,W,_,B){let U=1,z=B,q=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${_}(?![a-z])`,"g");while(z<K.length&&U>0){q.lastIndex=z,j.lastIndex=z;let H=q.exec(K),O=j.exec(K),F=H?H.index:1/0,L=O?O.index:1/0;if(F<L)U++,z=F+H[0].length;else if(L<1/0){if(U--,U===0)return L;z=L+O[0].length}else break}return-1}function J(K,W,_){let B=0,U=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),z=new RegExp(`@${_}(?![a-z])`,"g"),q=/@else(?![a-z])/g,j=[],H;while((H=U.exec(K))!==null)j.push({pos:H.index,type:"open"});while((H=z.exec(K))!==null)j.push({pos:H.index,type:"close"});while((H=q.exec(K))!==null)j.push({pos:H.index,type:"else"});j.sort((O,F)=>O.pos-F.pos);for(let O of j)if(O.type==="open")B++;else if(O.type==="close")B--;else if(O.type==="else"&&B===0)return O.pos;return-1}{let K=!0;while(K){K=!1;let W=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let _=W.index,B,U,z=Y.slice(_+5),q=eK(z);if(q)B=q.value,U=_+5+q.consumed;else U=_+5;let j=X(Y,"auth","endauth",U);if(j===-1){console.warn(`[stx] @auth directive at position ${_} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(U,j),O=J(H,"auth","endauth"),F;if(!Z.auth)F=!1;else F=B?c1(`auth?.check && auth?.user?.[${B}]`,Z):c1("auth?.check",Z);let L;if(O!==-1){let V=H.slice(0,O),A=H.slice(O+5);L=F?V:A}else L=F?H:"";Y=Y.substring(0,_)+L+Y.substring(j+8),K=!0}}{let K=!0;while(K){K=!1;let W=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let _=W.index,B,U,z=Y.slice(_+6),q=eK(z);if(q)B=q.value,U=_+6+q.consumed;else U=_+6;let j=X(Y,"guest","endguest",U);if(j===-1){console.warn(`[stx] @guest directive at position ${_} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(U,j),O=J(H,"guest","endguest"),F;if(!Z.auth)F=!0;else F=B?c1(`!auth?.check || !auth?.user?.[${B}]`,Z):c1("!auth?.check",Z);let L;if(O!==-1){let V=H.slice(0,O),A=H.slice(O+5);L=F?V:A}else L=F?H:"";Y=Y.substring(0,_)+L+Y.substring(j+9),K=!0}}function Q(K,W,_){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let B=[K];if(W)B.push(W);if(_){let U=c1(_,Z);B.push(U)}return Z.permissions.check(...B)}catch{return!1}return!1}function G(K){let W=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!W)return null;return{ability:W[1],type:W[2],id:W[3]?.trim(),paramsEnd:W[0].length}}for(let K of["can","cannot"]){let W=`end${K}`,_=K==="can"?"elsecan":"elsecannot",B=!0;while(B){B=!1;let U=Y.match(new RegExp(`@${K}\\s*\\(`));if(!U||U.index===void 0)break;let z=U.index,q=Y.slice(z+`@${K}`.length),j=G(q);if(!j)break;let H=z+`@${K}`.length+j.paramsEnd,O=X(Y,K,W,H);if(O===-1){console.warn(`[stx] @${K} directive at position ${z} has no matching @${W} \u2014 the block was skipped.`);break}let F=Y.slice(H,O),L=[],V=0,A=new RegExp(`@${K}\\s*\\(`,"g"),N=new RegExp(`@${W}(?![a-z])`,"g"),w=new RegExp(`@${_}\\s*\\(`,"g"),M=/@else(?![a-z])/g,T=[],I;while((I=A.exec(F))!==null)T.push({pos:I.index,type:"open"});while((I=N.exec(F))!==null)T.push({pos:I.index,type:"close"});while((I=w.exec(F))!==null)T.push({pos:I.index,type:"elseDirective"});while((I=M.exec(F))!==null)T.push({pos:I.index,type:"else"});T.sort((x,C)=>x.pos-C.pos);for(let x of T){if(x.type==="open"){V++;continue}if(x.type==="close"){V--;continue}if(V===0)L.push(x)}let E=[],S=0;for(let x=0;x<L.length;x++){let C=L[x];if(E.push({content:F.slice(S,C.pos),ability:void 0}),C.type==="elseDirective"){let f=F.slice(C.pos+`@${_}`.length),g=G(f);if(g){E[E.length-1]={content:F.slice(S,C.pos)},S=C.pos+`@${_}`.length+g.paramsEnd,E.push({content:"",ability:g.ability,type:g.type,id:g.id}),E.pop();let h=L[x+1],l=h?h.pos:F.length;E.push({content:F.slice(S,l),ability:g.ability,type:g.type,id:g.id}),S=l}}else S=C.pos+5}if(S<F.length){let x=E[E.length-1];if(L.length>0&&L[L.length-1].type==="else")E.push({content:F.slice(S),isFinalElse:!0});else if(E.length===0)E.push({content:F.slice(S)})}let k=Q(j.ability,j.type,j.id),b=K==="can"?k:!k,P="";if(b)P=E[0]?.content||"";else{let x=!1;for(let C=1;C<E.length;C++){let f=E[C];if(f.isFinalElse){P=f.content,x=!0;break}if(f.ability){let g=Q(f.ability,f.type,f.id);if(K==="can"?g:!g){P=f.content,x=!0;break}}}if(!x&&E.length>0){let C=E[E.length-1];if(C.isFinalElse)P=C.content}}Y=Y.substring(0,z)+P+Y.substring(O+`@${W}`.length),B=!0}}return Y}function DX($,Z,Y){let X=$;function J(Q,G,K,W,_){let B=!0;while(B){B=!1;let U=new RegExp(`@${G}\\s*\\(`),z=Q.match(U);if(!z||z.index===void 0)break;let q=z.index,j=l1(Q,q+`@${G}`.length);if(!j)break;let H=j.endPos,O=q$(Q,G,K,H);if(O===-1){console.warn(`[stx] @${G} directive at position ${q} has no matching @${K} \u2014 the block was skipped.`);break}let F=Q.slice(H,O),L=j.expression,V=-1,A=0,N=0;while(N<F.length){let w=F.indexOf("@",N);if(w===-1)break;let M=F.substring(w);if(/^@(?:if|unless|isset|empty)\s*\(/.test(M)){A++,N=w+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(M)){A--,N=w+1;continue}if(A===0&&/^@else(?![a-z])/.test(M)){V=w;break}N=w+1}try{let w=W(L.trim()),M;if(V!==-1){let T=F.slice(0,V),I=F.slice(V+5);M=w?T:I}else M=w?F:"";Q=Q.substring(0,q)+M+Q.substring(O+`@${K}`.length),B=!0}catch(w){let M=w instanceof Error?w.message:String(w),T=$0(_,`Error processing @${G} directive: ${M}`,o.EVALUATION_ERROR);Q=Q.substring(0,q)+T+Q.substring(O+`@${K}`.length);break}}return Q}return X=J(X,"isset","endisset",(Q)=>{let G=c1(Q,Z);return G!==void 0&&G!==null},"Isset"),X=J(X,"empty","endempty",(Q)=>{let G=c1(Q,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),X}function kX($,Z,Y){let X=$,J="development";function Q(G,K,W,_){let B=new RegExp(`@${K}(?![a-z])`,"g"),U=new RegExp(`@${W}(?![a-z])`,"g"),z=new RegExp(`^@${K}(?![a-z])`),q=new RegExp(`^@${W}(?![a-z])`),j=G,H=!0;while(H){H=!1,B.lastIndex=0;let O=B.exec(j);if(!O)break;let F=O.index,L=F+O[0].length;if(K==="env"){let k=j.substring(L).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!k)break;L+=k[0].length,_=J===k[2]}let V=1,A=L,N=-1;while(V>0&&A<j.length){B.lastIndex=A,U.lastIndex=A;let k=B.exec(j),b=U.exec(j),P=k?k.index:1/0,x=b?b.index:1/0;if(P<x)V++,A=P+k[0].length;else if(x<1/0){if(V--,V===0){N=x;break}A=x+b[0].length}else break}if(N===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${W} \u2014 the block was skipped.`);break}let w=j.substring(L,N),M=-1,T=0,I=0;while(I<w.length){let k=w.indexOf("@",I);if(k===-1)break;let b=w.substring(k);if(z.test(b)){T++,I=k+1;continue}if(q.test(b)){T--,I=k+1;continue}if(T===0&&/^@else(?![a-z])/.test(b)){M=k;break}I=k+1}let E;if(M!==-1){let k=w.slice(0,M),b=w.slice(M+5);E=_?k:b}else E=_?w:"";let S=`@${W}`.length;j=j.substring(0,F)+E+j.substring(N+S),H=!0}return j}return X=Q(X,"env","endenv",!1),X=Q(X,"production","endproduction",J==="production"),X=Q(X,"development","enddevelopment",J==="development"),X=Q(X,"staging","endstaging",J==="staging"),X=Q(X,"testing","endtesting",J==="testing"),X}var C3=D(()=>{RX();X1();b3();h0()});function bX($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function j$($,Z){if(!$)return Z?.nonceGenerator?.()??bX();let Y=SX.get($);if(!Y)Y=Z?.nonceGenerator?.()??bX(),SX.set($,Y);return Y}function tF($){SX.delete($)}function CX($,Z){let Y=[];for(let[X,J]of Object.entries($)){if(J===void 0||J===null)continue;if(typeof J==="boolean"){if(J)Y.push(X);continue}if(Array.isArray(J)){let Q=[...J];if(Z&&(X==="script-src"||X==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)Y.push(`${X} ${Q.join(" ")}`)}}return Y.join("; ")}function P3($,Z){return`<meta http-equiv="Content-Security-Policy" content="${CX($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function eF($){return{enabled:!0,directives:{strict:$W,moderate:y3,relaxed:ZW,api:YW}[$]||y3,useNonce:$==="strict",addMetaTag:!0}}function $V($,Z){let Y={...$};for(let[X,J]of Object.entries(Z)){let Q=X,G=Y[Q];if(J===void 0||J===null)continue;if(typeof J==="boolean")Y[Q]=G||J;else if(Array.isArray(J)){let K=Array.isArray(G)?G:[],W=[...new Set([...K,...J])];Y[Q]=W}}return Y}function yX($,Z,Y){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=Z.useNonce?j$(Y,Z):void 0,J=P3(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
3811
+ ${J}`)}function ZV($,Z){let Y=$;return Y=Y.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(X,J)=>{if(J.includes("nonce="))return X;return`<script nonce="${Z}"${J}>`}),Y=Y.replace(/<style([^>]*)>/gi,(X,J)=>{if(J.includes("nonce="))return X;return`<style nonce="${Z}"${J}>`}),Y}function PX($,Z,Y,X){let J=$,Q=X.csp;if(J=J.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?j$(Z,Q):void 0;return P3(Q.directives,G)}),J=J.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return j$(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=j$(Z,Q);return J}function YV(){return[XW,JW]}function XV($){let Z=[];if($["script-src"]?.includes("'unsafe-inline'"))Z.push("CSP: Using unsafe-inline in script-src significantly reduces XSS protection");if($["script-src"]?.includes("'unsafe-eval'"))Z.push("CSP: Using unsafe-eval in script-src allows eval() and related functions");if(!$["default-src"])Z.push("CSP: No default-src specified. Recommend adding default-src as a fallback");if($["default-src"]?.includes("*"))Z.push("CSP: Using * in default-src provides minimal protection");if(!$["object-src"]&&!$["default-src"]?.includes("'none'"))Z.push("CSP: Consider adding object-src: none to block plugins");if(!$["base-uri"])Z.push("CSP: Consider adding base-uri to prevent base tag injection attacks");for(let[Y,X]of Object.entries($))if(Array.isArray(X)&&X.includes("http:"))Z.push(`CSP: Using http: in ${Y} allows insecure resources`);return Z}function QW($=!1){return $?"Content-Security-Policy-Report-Only":"Content-Security-Policy"}function JV($,Z){if(!$.enabled)return{};let Y=$.useNonce?j$(Z,$):void 0,X=CX($.directives,Y);return{[QW($.reportOnly)]:X}}var SX,$W,y3,ZW,YW,XW,JW,QV;var xX=D(()=>{SX=new WeakMap;$W={"default-src":["'self'"],"script-src":["'self'","'strict-dynamic'"],"style-src":["'self'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'none'"],"base-uri":["'self'"],"form-action":["'self'"],"frame-ancestors":["'self'"],"upgrade-insecure-requests":!0},y3={"default-src":["'self'"],"script-src":["'self'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'","https:"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'self'"],"base-uri":["'self'"],"form-action":["'self'"],"upgrade-insecure-requests":!0},ZW={"default-src":["'self'"],"script-src":["'self'","'unsafe-inline'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:","http:"],"font-src":["'self'","https:","http:","data:"],"connect-src":["'self'","https:","http:","ws:","wss:"],"media-src":["'self'","https:","http:"],"object-src":["'none'"],"frame-src":["'self'","https:"],"base-uri":["'self'"]},YW={"default-src":["'none'"],"frame-ancestors":["'none'"]};XW={name:"csp",handler:($,Z,Y,X)=>{let Q=Y.__stx_options?.csp;if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?j$(Y,Q):void 0;return P3(Q.directives,G)},hasEndTag:!1,description:"Insert Content-Security-Policy meta tag"},JW={name:"cspNonce",handler:($,Z,Y,X)=>{let Q=Y.__stx_options?.csp;if(!Q?.enabled||!Q.useNonce)return"";return j$(Y,Q)},hasEndTag:!1,description:"Output the current CSP nonce value"};QV={enabled:!1,reportOnly:!1,directives:y3,useNonce:!1,addMetaTag:!0}});import GV from"crypto";function WV($=KV){let Z=GV.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return vX=Z,Z}function _V(){if(!vX)WV();return vX}function BV($=GW){let Z=_V();return`<input type="hidden" name="${$}" value="${Z}">`}function KW($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,X)=>{return BV(X||GW)})}var KV=40,GW="_token",vX=null;var WW=()=>{};async function fX($,Z,Y,X){if(!X.customDirectives||X.customDirectives.length===0)return $;let J=$;for(let Q of X.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(X.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)J=await UV(J,Q,Z,Y,X);else J=await zV(J,Q,Z,Y,X)}return J}async function UV($,Z,Y,X,J){let{name:Q,handler:G}=Z,K=`@${Q}`,W=`@end${Q}`,_=$,B=B5(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${W}`,"g"),U=[],z=B.exec(_);while(z!==null){let[q,j="",H=""]=z,O=z.index||0;try{let F=j?_W(j):[],L=H.trim(),V=await G(L,F,Y,X);U.push({original:q,processed:V,startIndex:O})}catch(F){let L=F instanceof Error?F.message:String(F);if(J.debug)console.error(`Error processing custom directive @${Q}:`,F);U.push({original:q,processed:$0("CustomDirective",`Error in @${Q}${j?`(${j})`:""}: ${L}`,o.EVALUATION_ERROR),startIndex:O})}z=B.exec(_)}for(let q=U.length-1;q>=0;q--){let{original:j,processed:H}=U[q];_=_.replace(j,H)}return _}async function zV($,Z,Y,X,J){let{name:Q,handler:G}=Z,K=$,W=B5(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),_=[],B=W.exec(K);while(B!==null){let[q,j=""]=B,H=B.index||0;try{let O=_W(j),F=await G("",O,Y,X);_.push({original:q,processed:F,startIndex:H})}catch(O){let F=O instanceof Error?O.message:String(O);if(J.debug)console.error(`Error processing custom directive @${Q}:`,O);_.push({original:q,processed:$0("CustomDirective",`Error in @${Q}(${j}): ${F}`,o.EVALUATION_ERROR),startIndex:H})}B=W.exec(K)}let U=B5(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),z=U.exec(K);while(z!==null){let[q]=z,j=z.index||0;try{let H=await G("",[],Y,X);_.push({original:q,processed:H,startIndex:j})}catch(H){let O=H instanceof Error?H.message:String(H);if(J.debug)console.error(`Error processing custom directive @${Q}:`,H);_.push({original:q,processed:$0("CustomDirective",`Error in @${Q}: ${O}`,o.EVALUATION_ERROR),startIndex:j})}z=U.exec(K)}for(let q=_.length-1;q>=0;q--){let{original:j,processed:H}=_[q];K=K.replace(j,H)}return K}function _W($){if(!$.trim())return[];let Z=[],Y="",X=!1,J="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!X)X=!0,J=G;else if(G===J)X=!1;else Y+=G;else if(G===","&&!X)Z.push(Y.trim()),Y="";else Y+=G}if(Y.trim())Z.push(Y.trim());return Z.map((Q)=>{let G=Q.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var gX=D(()=>{X1();g$()});var f3={};Q0(f3,{useTitle:()=>zW,useSeoMeta:()=>Q4,usePageTitle:()=>zW,useHead:()=>O$,resetHead:()=>BW,renderHtmlAttrs:()=>jW,renderHead:()=>qW,renderBodyAttrs:()=>HW,processTitleDirective:()=>FW,processMetaDirective:()=>VW,processHeadDirective:()=>LW,getPageMeta:()=>v3,getHead:()=>m5,definePageMeta:()=>UW,applyHead:()=>OW});function m5(){return H$}function v3(){return x3}function BW(){H$={},qV.length=0,x3={}}function O$($){H$=jV(H$,$)}function jV($,Z){return{title:Z.title??$.title,titleTemplate:Z.titleTemplate??$.titleTemplate,base:Z.base??$.base,meta:[...$.meta||[],...Z.meta||[]],link:[...$.link||[],...Z.link||[]],script:[...$.script||[],...Z.script||[]],style:[...$.style||[],...Z.style||[]],htmlAttrs:{...$.htmlAttrs,...Z.htmlAttrs},bodyAttrs:{...$.bodyAttrs,...Z.bodyAttrs}}}function Q4($){let Z=[];if($.description)Z.push({name:"description",content:$.description});if($.keywords){let W=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Z.push({name:"keywords",content:W})}if($.author)Z.push({name:"author",content:$.author});if($.robots)Z.push({name:"robots",content:$.robots});let Y=$.ogTitle??$.title,X=$.ogDescription??$.description;if(Y)Z.push({property:"og:title",content:Y});if(X)Z.push({property:"og:description",content:X});if($.ogImage)Z.push({property:"og:image",content:$.ogImage});if($.ogUrl)Z.push({property:"og:url",content:$.ogUrl});if($.ogType)Z.push({property:"og:type",content:$.ogType});if($.ogSiteName)Z.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)Z.push({property:"og:locale",content:$.ogLocale});let J=$.twitterTitle??$.title,Q=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(J)Z.push({name:"twitter:title",content:J});if(Q)Z.push({name:"twitter:description",content:Q});if(G)Z.push({name:"twitter:image",content:G});if($.twitterSite)Z.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)Z.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)Z.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)Z.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)Z.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)Z.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let W of $.articleTags)Z.push({property:"article:tag",content:W});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});O$({title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K})}function UW($){if(x3={...x3,...$},$.title||$.description)Q4({title:$.title,description:$.description})}function zW($){let Z=typeof $==="function"?$():$;O$({title:Z})}function qW($=H$){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${d$(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([X,J])=>`${X}="${d$(J)}"`).join(" ");Z.push(`<base ${Y}>`)}for(let Y of $.meta||[]){let X=Object.entries(Y).filter(([J,Q])=>Q!==void 0).map(([J,Q])=>{return`${J==="httpEquiv"?"http-equiv":J}="${d$(String(Q))}"`}).join(" ");Z.push(`<meta ${X}>`)}for(let Y of $.link||[]){let X=Object.entries(Y).filter(([J,Q])=>Q!==void 0).map(([J,Q])=>`${J}="${d$(String(Q))}"`).join(" ");Z.push(`<link ${X}>`)}for(let Y of $.script||[]){let{content:X,...J}=Y,Q=Object.entries(J).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${d$(String(K))}"`}).filter(Boolean).join(" ");if(X)Z.push(`<script ${Q}>${X}</script>`);else Z.push(`<script ${Q}></script>`)}for(let Y of $.style||[]){let X=Y.type?` type="${Y.type}"`:"";Z.push(`<style${X}>${Y.content}</style>`)}return Z.join(`
3812
+ `)}function jW($=H$){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${d$(Y)}"`).join(" ")}function HW($=H$){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${d$(Y)}"`).join(" ")}function d$($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function OW($=H$){if(typeof document>"u")return;if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);document.title=Z}for(let Z of $.meta||[]){let Y=Z.name?`meta[name="${Z.name}"]`:Z.property?`meta[property="${Z.property}"]`:null;if(Y){let X=document.querySelector(Y);if(!X){if(X=document.createElement("meta"),Z.name)X.setAttribute("name",Z.name);if(Z.property)X.setAttribute("property",Z.property);document.head.appendChild(X)}X.setAttribute("content",Z.content)}}for(let Z of $.link||[]){let Y=`link[rel="${Z.rel}"]${Z.href?`[href="${Z.href}"]`:""}`,X=document.querySelector(Y);if(!X)X=document.createElement("link"),document.head.appendChild(X);for(let[J,Q]of Object.entries(Z))if(Q!==void 0)X.setAttribute(J,String(Q))}if($.htmlAttrs)for(let[Z,Y]of Object.entries($.htmlAttrs))document.documentElement.setAttribute(Z,Y);if($.bodyAttrs)for(let[Z,Y]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,Y)}function LW($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(X,J)=>{return Z+=J.trim()+`
3813
+ `,""}),headContent:Z.trim()}}function FW($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,X,J,Q)=>{let G=X?J:Z[(Q||"").trim()]??Q;return O$({title:G}),""})}function VW($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Y,X,J,Q,G,K)=>{let W=Q?G:K,_=Q?W:Z[(W||"").trim()]??W,U=J.includes(":")?{property:J,content:_}:{name:J,content:_};return O$({meta:[U]}),""})}var H$,qV,x3;var L$=D(()=>{H$={},qV=[],x3={}});import HV from"crypto";function g0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function OV($){return{...h3,...$.forms?.classes}}function g3($,Z,Y,X){let J=$||Z;return Y?`${J} ${X}`:J}function LV(){return HV.randomUUID()}function FV($,Z,Y,X){let J=OV(X),Q=$;return Q=RW(Q,Z),Q=p5(Q,Z),Q=d3(Q,Z,J),Q=u3(Q,Z,J),Q}function p5($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=LV();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${g0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,J)=>{let Q=J.toUpperCase();if(J&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${g0(Q)}">`;return X}),Y}function d3($,Z,Y=h3){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(J,Q,G,K,W,_="")=>{let B=Q||G||"POST",U=K||W||"",z=F$(_),q=B.toUpperCase(),j=["GET","POST"].includes(q)?q:"POST",H=`<form method="${g0(j)}" action="${g0(U)}"${z?` ${z}`:""}>`;if(H+=`
3814
3814
  ${p5("@csrf",Z)}`,!["GET","POST"].includes(q))H+=`
3815
- ${p5(`@method('${q}')`,Z)}`;return H}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(J,Q,G,K,W,_="")=>{let B=Q||G||"",U=K||W||"",z=L$(_),q=G4(B,Z),j=q!==void 0&&q!==null?q:U||"",H=z.match(/type=['"]([^'"]+)['"]/i),O=H?H[1]:"text",F=K4(B,Z),L=z.match(/class=['"]([^'"]+)['"]/i),V=g3(L?L[1]:"",Y.input,F,Y.inputError),A=z.replace(/class=['"][^'"]+['"]/i,"");return A=A.replace(/type=['"][^'"]+['"]/i,""),`<input type="${g0(O)}" name="${g0(B)}" value="${g0(j)}" class="${V}"${A?` ${A}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(J,Q,G="",K="")=>{let W=L$(G),_=G4(Q,Z)||K.trim(),B=K4(Q,Z),U=W.match(/class=['"]([^'"]+)['"]/i),z=g3(U?U[1]:"",Y.input,B,Y.inputError),q=W.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${g0(Q)}" class="${z}"${q?` ${q}`:""}>${g0(_)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(J,Q,G="",K)=>{let W=L$(G),_=G4(Q,Z),B=K4(Q,Z),U=W.match(/class=['"]([^'"]+)['"]/i),z=g3(U?U[1]:"",Y.input,B,Y.inputError),q=W.replace(/class=['"][^'"]+['"]/i,""),j=K;if(_!==void 0)j=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,O,F)=>{if((Array.isArray(_)?_.some((V)=>String(V)===F):String(_)===F)&&!O.includes("selected"))return O.replace(/(<option)/,"$1 selected");return H});return`<select name="${g0(Q)}" class="${z}"${q?` ${q}`:""}>${j}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(J,Q,G="1",K="")=>{let W=L$(K),_=G4(Q,Z),B=_!==void 0&&(Array.isArray(_)?_.some((j)=>String(j)===G):_===!0||String(_)===G),U=W.match(/class=['"]([^'"]+)['"]/i),z=U?U[1]:Y.checkInput,q=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${g0(Q)}" value="${g0(G)}" class="${z}"${B?" checked":""}${q?` ${q}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,Q,G,K="")=>{let W=L$(K),_=G4(Q,Z),B=_!==void 0&&_===G,U=W.match(/class=['"]([^'"]+)['"]/i),z=U?U[1]:Y.checkInput,q=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${g0(Q)}" value="${g0(G)}" class="${z}"${B?" checked":""}${q?` ${q}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,Q,G="")=>{let K=L$(G),W=K.match(/accept=['"]([^'"]+)['"]/i),_=W?W[1]:"",B=K.includes("multiple"),U=K4(Q,Z),z=K.match(/class=['"]([^'"]+)['"]/i),q=g3(z?z[1]:"",Y.input,U,Y.inputError),j=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${g0(Q)}"`,`class="${q}"`];if(_)H.push(`accept="${g0(_)}"`);if(B)H.push("multiple");if(j)H.push(j);return`${H.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(J,Q,G="",K)=>{let W=L$(G),_=W.match(/class=['"]([^'"]+)['"]/i),B=_?_[1]:Y.label,U=W.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${g0(Q)}" class="${B}"${U?` ${U}`:""}>${K}</label>`}),X}function u3($,Z,Y=h3){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,J,Q)=>{try{if(K4(J,Z))return Q.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return NW(J,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(J);return NW(J,Z)}let W=K.trim();if(B0(W)){let _=L0(W,Z);return _!==void 0?String(_):W}return W}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function K4($,Z){if(!Z.errors)return!1;if(typeof Z.errors.has==="function")return Z.errors.has($);if(typeof Z.errors==="object")return Object.prototype.hasOwnProperty.call(Z.errors,$);return!1}function NW($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let Y=Z.errors[$];return Array.isArray(Y)?Y[0]:String(Y)}return""}function G4($,Z){let Y;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let X=$.slice(0,-2);if(Y=Z[X],Y!==void 0)return Y}return Z[$]}function L$($){if(!$.trim())return"";let Z=[],Y=$.trim(),X=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,J;while((J=X.exec(Y))!==null){let[,Q,,G]=J;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}function VV($,Z){AW[$]=Z}function dX($){let[Z,...Y]=$.split(":"),X=Y.length>0?Y.join(":").split(","):[];return{name:Z.trim(),params:X}}function wW($,Z,Y,X={}){let J=[],Q=Y.split("|").map((G)=>G.trim()).filter(Boolean);for(let G of Q){let K=dX(G),W=AW[K.name];if(!W){console.warn(`Unknown validation rule: ${K.name}`);continue}if(K.name==="confirmed"){let B=`${$}_confirmation`;K.params=[X[B]]}let _=W(Z,K.params||[],$);if(_)J.push(K.message||_)}return{field:$,valid:J.length===0,errors:J}}function NV($,Z){let Y={};for(let[X,J]of Object.entries(Z)){let Q=wW(X,$[X],J,$);if(!Q.valid)Y[X]=Q.errors}return Y}function RW($,Z){return $.replace(/@validate\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]*)\})?\s*\)/g,(Y,X,J,Q)=>{let G=J.split("|").map((W)=>W.trim()),K=[];for(let W of G){let _=dX(W);switch(_.name){case"required":K.push("required");break;case"email":K.push('type="email"');break;case"url":K.push('type="url"');break;case"numeric":case"integer":if(K.push('type="number"'),_.name==="integer")K.push('step="1"');break;case"min":if(_.params?.[0])K.push(`minlength="${_.params[0]}"`);break;case"max":if(_.params?.[0])K.push(`maxlength="${_.params[0]}"`);break;case"regex":if(_.params?.[0])K.push(`pattern="${_.params[0]}"`);break}}return`<!-- @validate:${X}:${J} -->${K.length>0?`<!-- attrs:${K.join(" ")} -->`:""}`})}function AV($){uX[$.name]=$}function MW($,Z,Y={}){let X=[],J=Z.split("|").map((Q)=>Q.trim());for(let Q of J){let G=dX(Q),K=uX[G.name];if(!K){console.warn(`Unknown validation rule: ${G.name}`);continue}let W=K.validate($,G.params||[],Y);if(W!==!0)X.push(W)}return{valid:X.length===0,errors:X}}function wV($,Z){let Y={},X=!0;for(let[J,Q]of Object.entries(Z)){let G=MW($[J],Q,$);if(!G.valid)X=!1,Y[J]=G.errors}return{valid:X,errors:Y}}function RV($,Z){let Y=JSON.stringify(Z);return`
3815
+ ${p5(`@method('${q}')`,Z)}`;return H}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(J,Q,G,K,W,_="")=>{let B=Q||G||"",U=K||W||"",z=F$(_),q=G4(B,Z),j=q!==void 0&&q!==null?q:U||"",H=z.match(/type=['"]([^'"]+)['"]/i),O=H?H[1]:"text",F=K4(B,Z),L=z.match(/class=['"]([^'"]+)['"]/i),V=g3(L?L[1]:"",Y.input,F,Y.inputError),A=z.replace(/class=['"][^'"]+['"]/i,"");return A=A.replace(/type=['"][^'"]+['"]/i,""),`<input type="${g0(O)}" name="${g0(B)}" value="${g0(j)}" class="${V}"${A?` ${A}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(J,Q,G="",K="")=>{let W=F$(G),_=G4(Q,Z)||K.trim(),B=K4(Q,Z),U=W.match(/class=['"]([^'"]+)['"]/i),z=g3(U?U[1]:"",Y.input,B,Y.inputError),q=W.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${g0(Q)}" class="${z}"${q?` ${q}`:""}>${g0(_)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(J,Q,G="",K)=>{let W=F$(G),_=G4(Q,Z),B=K4(Q,Z),U=W.match(/class=['"]([^'"]+)['"]/i),z=g3(U?U[1]:"",Y.input,B,Y.inputError),q=W.replace(/class=['"][^'"]+['"]/i,""),j=K;if(_!==void 0)j=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,O,F)=>{if((Array.isArray(_)?_.some((V)=>String(V)===F):String(_)===F)&&!O.includes("selected"))return O.replace(/(<option)/,"$1 selected");return H});return`<select name="${g0(Q)}" class="${z}"${q?` ${q}`:""}>${j}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(J,Q,G="1",K="")=>{let W=F$(K),_=G4(Q,Z),B=_!==void 0&&(Array.isArray(_)?_.some((j)=>String(j)===G):_===!0||String(_)===G),U=W.match(/class=['"]([^'"]+)['"]/i),z=U?U[1]:Y.checkInput,q=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${g0(Q)}" value="${g0(G)}" class="${z}"${B?" checked":""}${q?` ${q}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,Q,G,K="")=>{let W=F$(K),_=G4(Q,Z),B=_!==void 0&&_===G,U=W.match(/class=['"]([^'"]+)['"]/i),z=U?U[1]:Y.checkInput,q=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${g0(Q)}" value="${g0(G)}" class="${z}"${B?" checked":""}${q?` ${q}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,Q,G="")=>{let K=F$(G),W=K.match(/accept=['"]([^'"]+)['"]/i),_=W?W[1]:"",B=K.includes("multiple"),U=K4(Q,Z),z=K.match(/class=['"]([^'"]+)['"]/i),q=g3(z?z[1]:"",Y.input,U,Y.inputError),j=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${g0(Q)}"`,`class="${q}"`];if(_)H.push(`accept="${g0(_)}"`);if(B)H.push("multiple");if(j)H.push(j);return`${H.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(J,Q,G="",K)=>{let W=F$(G),_=W.match(/class=['"]([^'"]+)['"]/i),B=_?_[1]:Y.label,U=W.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${g0(Q)}" class="${B}"${U?` ${U}`:""}>${K}</label>`}),X}function u3($,Z,Y=h3){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,J,Q)=>{try{if(K4(J,Z))return Q.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return NW(J,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(J);return NW(J,Z)}let W=K.trim();if(B0(W)){let _=L0(W,Z);return _!==void 0?String(_):W}return W}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function K4($,Z){if(!Z.errors)return!1;if(typeof Z.errors.has==="function")return Z.errors.has($);if(typeof Z.errors==="object")return Object.prototype.hasOwnProperty.call(Z.errors,$);return!1}function NW($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let Y=Z.errors[$];return Array.isArray(Y)?Y[0]:String(Y)}return""}function G4($,Z){let Y;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let X=$.slice(0,-2);if(Y=Z[X],Y!==void 0)return Y}return Z[$]}function F$($){if(!$.trim())return"";let Z=[],Y=$.trim(),X=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,J;while((J=X.exec(Y))!==null){let[,Q,,G]=J;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}function VV($,Z){AW[$]=Z}function hX($){let[Z,...Y]=$.split(":"),X=Y.length>0?Y.join(":").split(","):[];return{name:Z.trim(),params:X}}function wW($,Z,Y,X={}){let J=[],Q=Y.split("|").map((G)=>G.trim()).filter(Boolean);for(let G of Q){let K=hX(G),W=AW[K.name];if(!W){console.warn(`Unknown validation rule: ${K.name}`);continue}if(K.name==="confirmed"){let B=`${$}_confirmation`;K.params=[X[B]]}let _=W(Z,K.params||[],$);if(_)J.push(K.message||_)}return{field:$,valid:J.length===0,errors:J}}function NV($,Z){let Y={};for(let[X,J]of Object.entries(Z)){let Q=wW(X,$[X],J,$);if(!Q.valid)Y[X]=Q.errors}return Y}function RW($,Z){return $.replace(/@validate\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]*)\})?\s*\)/g,(Y,X,J,Q)=>{let G=J.split("|").map((W)=>W.trim()),K=[];for(let W of G){let _=hX(W);switch(_.name){case"required":K.push("required");break;case"email":K.push('type="email"');break;case"url":K.push('type="url"');break;case"numeric":case"integer":if(K.push('type="number"'),_.name==="integer")K.push('step="1"');break;case"min":if(_.params?.[0])K.push(`minlength="${_.params[0]}"`);break;case"max":if(_.params?.[0])K.push(`maxlength="${_.params[0]}"`);break;case"regex":if(_.params?.[0])K.push(`pattern="${_.params[0]}"`);break}}return`<!-- @validate:${X}:${J} -->${K.length>0?`<!-- attrs:${K.join(" ")} -->`:""}`})}function AV($){dX[$.name]=$}function MW($,Z,Y={}){let X=[],J=Z.split("|").map((Q)=>Q.trim());for(let Q of J){let G=hX(Q),K=dX[G.name];if(!K){console.warn(`Unknown validation rule: ${G.name}`);continue}let W=K.validate($,G.params||[],Y);if(W!==!0)X.push(W)}return{valid:X.length===0,errors:X}}function wV($,Z){let Y={},X=!0;for(let[J,Q]of Object.entries(Z)){let G=MW($[J],Q,$);if(!G.valid)X=!1,Y[J]=G.errors}return{valid:X,errors:Y}}function RV($,Z){let Y=JSON.stringify(Z);return`
3816
3816
  <script>
3817
3817
  (function() {
3818
3818
  const form = document.getElementById('${$}');
@@ -3864,22 +3864,22 @@ catch { return 'Please enter a valid URL'; } },
3864
3864
  }
3865
3865
  });
3866
3866
  })();
3867
- </script>`.trim()}var h3,AW,uX;var mX=D(()=>{h0();h3={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};AW={required:($,Z,Y)=>{if($===void 0||$===null||$===""||Array.isArray($)&&$.length===0)return`The ${Y} field is required.`;return null},email:($,Z,Y)=>{if(!$)return null;if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($)))return`The ${Y} field must be a valid email address.`;return null},min:($,Z,Y)=>{if(!$)return null;let X=Number(Z[0]);if(typeof $==="string"&&$.length<X)return`The ${Y} field must be at least ${X} characters.`;if(typeof $==="number"&&$<X)return`The ${Y} field must be at least ${X}.`;if(Array.isArray($)&&$.length<X)return`The ${Y} field must have at least ${X} items.`;return null},max:($,Z,Y)=>{if(!$)return null;let X=Number(Z[0]);if(typeof $==="string"&&$.length>X)return`The ${Y} field must not exceed ${X} characters.`;if(typeof $==="number"&&$>X)return`The ${Y} field must not exceed ${X}.`;if(Array.isArray($)&&$.length>X)return`The ${Y} field must not have more than ${X} items.`;return null},confirmed:($,Z,Y)=>{if(Z[0]!==void 0&&$!==Z[0])return`The ${Y} confirmation does not match.`;return null},numeric:($,Z,Y)=>{if(!$)return null;if(Number.isNaN(Number($)))return`The ${Y} field must be a number.`;return null},integer:($,Z,Y)=>{if(!$)return null;if(!Number.isInteger(Number($)))return`The ${Y} field must be an integer.`;return null},alpha:($,Z,Y)=>{if(!$)return null;if(!/^[a-z]+$/i.test(String($)))return`The ${Y} field must only contain letters.`;return null},alphanumeric:($,Z,Y)=>{if(!$)return null;if(!/^[a-z0-9]+$/i.test(String($)))return`The ${Y} field must only contain letters and numbers.`;return null},url:($,Z,Y)=>{if(!$)return null;try{return new URL(String($))?null:null}catch{return`The ${Y} field must be a valid URL.`}},regex:($,Z,Y)=>{if(!$)return null;try{if(!new RegExp(Z[0]).test(String($)))return`The ${Y} field format is invalid.`;return null}catch{return`The ${Y} field has an invalid validation pattern.`}},in:($,Z,Y)=>{if(!$)return null;if(!Z.includes(String($)))return`The ${Y} field must be one of: ${Z.join(", ")}.`;return null},notIn:($,Z,Y)=>{if(!$)return null;if(Z.includes(String($)))return`The ${Y} field must not be: ${Z.join(", ")}.`;return null},date:($,Z,Y)=>{if(!$)return null;let X=new Date($);if(Number.isNaN(X.getTime()))return`The ${Y} field must be a valid date.`;return null},before:($,Z,Y)=>{if(!$)return null;let X=new Date($),J=new Date(Z[0]);if(X>=J)return`The ${Y} field must be before ${Z[0]}.`;return null},after:($,Z,Y)=>{if(!$)return null;let X=new Date($),J=new Date(Z[0]);if(X<=J)return`The ${Y} field must be after ${Z[0]}.`;return null}};uX={required:{name:"required",validate:($)=>{if($===null||$===void 0||$==="")return"This field is required";if(Array.isArray($)&&$.length===0)return"This field is required";return!0},toHtml5:()=>["required"],message:"This field is required"},email:{name:"email",validate:($)=>{if(!$)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($))||"Please enter a valid email address"},toHtml5:()=>['type="email"'],message:"Please enter a valid email address"},url:{name:"url",validate:($)=>{if(!$)return!0;try{return new URL(String($)).protocol.startsWith("http")||"Please enter a valid URL"}catch{return"Please enter a valid URL"}},toHtml5:()=>['type="url"'],message:"Please enter a valid URL"},numeric:{name:"numeric",validate:($)=>{if(!$)return!0;return!Number.isNaN(Number($))||"Please enter a number"},toHtml5:()=>['type="number"'],message:"Please enter a number"},integer:{name:"integer",validate:($)=>{if(!$)return!0;let Z=Number($);return Number.isInteger(Z)||"Please enter a whole number"},toHtml5:()=>['type="number"','step="1"'],message:"Please enter a whole number"},alpha:{name:"alpha",validate:($)=>{if(!$)return!0;return/^[a-z]+$/i.test(String($))||"Please enter only letters"},toHtml5:()=>['pattern="[a-zA-Z]+"'],message:"Please enter only letters"},alphanumeric:{name:"alphanumeric",validate:($)=>{if(!$)return!0;return/^[a-z0-9]+$/i.test(String($))||"Please enter only letters and numbers"},toHtml5:()=>['pattern="[a-zA-Z0-9]+"'],message:"Please enter only letters and numbers"},min:{name:"min",validate:($,Z)=>{if(!$)return!0;let Y=Number(Z[0]);if(typeof $==="string")return $.length>=Y||`Must be at least ${Y} characters`;if(typeof $==="number")return $>=Y||`Must be at least ${Y}`;if(Array.isArray($))return $.length>=Y||`Must have at least ${Y} items`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`min="${$[0]}"`],message:"Must be at least {{param}} characters"},max:{name:"max",validate:($,Z)=>{if(!$)return!0;let Y=Number(Z[0]);if(typeof $==="string")return $.length<=Y||`Must be no more than ${Y} characters`;if(typeof $==="number")return $<=Y||`Must be no more than ${Y}`;if(Array.isArray($))return $.length<=Y||`Must have no more than ${Y} items`;return!0},toHtml5:($)=>[`maxlength="${$[0]}"`,`max="${$[0]}"`],message:"Must be no more than {{param}} characters"},between:{name:"between",validate:($,Z)=>{if(!$)return!0;let[Y,X]=Z.map(Number);if(typeof $==="string")return $.length>=Y&&$.length<=X||`Must be between ${Y} and ${X} characters`;if(typeof $==="number")return $>=Y&&$<=X||`Must be between ${Y} and ${X}`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`maxlength="${$[1]}"`],message:"Must be between {{min}} and {{max}}"},confirmed:{name:"confirmed",validate:($,Z,Y)=>{let X=Object.keys(Y);for(let J of X)if(J.endsWith("_confirmation")&&Y[J]===$)return!0;return"Confirmation does not match"},message:"Confirmation does not match"},in:{name:"in",validate:($,Z)=>{if(!$)return!0;return Z.includes(String($))||`Must be one of: ${Z.join(", ")}`},message:"Must be one of: {{values}}"},notIn:{name:"notIn",validate:($,Z)=>{if(!$)return!0;return!Z.includes(String($))||`Must not be: ${Z.join(", ")}`},message:"Must not be: {{values}}"},regex:{name:"regex",validate:($,Z)=>{if(!$)return!0;try{return new RegExp(Z[0]).test(String($))||"Invalid format"}catch{return"Invalid format"}},toHtml5:($)=>[`pattern="${$[0]}"`],message:"Invalid format"},date:{name:"date",validate:($)=>{if(!$)return!0;let Z=new Date(String($));return!Number.isNaN(Z.getTime())||"Please enter a valid date"},toHtml5:()=>['type="date"'],message:"Please enter a valid date"},before:{name:"before",validate:($,Z)=>{if(!$)return!0;let Y=new Date(String($)),X=new Date(Z[0]);return Y<X||`Must be before ${Z[0]}`},toHtml5:($)=>[`max="${$[0]}"`],message:"Must be before {{date}}"},after:{name:"after",validate:($,Z)=>{if(!$)return!0;let Y=new Date(String($)),X=new Date(Z[0]);return Y>X||`Must be after ${Z[0]}`},toHtml5:($)=>[`min="${$[0]}"`],message:"Must be after {{date}}"},size:{name:"size",validate:($,Z)=>{if(!$)return!0;let Y=Number(Z[0]);if(typeof $==="string")return $.length===Y||`Must be exactly ${Y} characters`;if(Array.isArray($))return $.length===Y||`Must have exactly ${Y} items`;return!0},message:"Must be exactly {{size}}"},phone:{name:"phone",validate:($)=>{if(!$)return!0;return/^\+?\(?\d{1,4}\)?[-\s./\d]*$/.test(String($))||"Please enter a valid phone number"},toHtml5:()=>['type="tel"','pattern="\\+?\\(?\\d{1,4}\\)?[-\\s./\\d]*"'],message:"Please enter a valid phone number"}}});import TW from"path";function MV($){if($)delete e0[$];else for(let Z of Object.keys(e0))delete e0[Z]}function TV(){let $=Object.entries(e0).map(([Z,Y])=>({locale:Z,loadedAt:new Date(Y.loadedAt),keyCount:IW(Y.translations)}));return{size:Object.keys(e0).length,locales:Object.keys(e0),entries:$}}function IW($,Z=0){for(let Y of Object.values($))if(Z++,Y&&typeof Y==="object"&&!Array.isArray(Y))Z=IW(Y,Z);return Z}function EV($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}function IV($){if(e0[$])return"loaded";return i1[$]||"idle"}function DV($){return i1[$]==="loading"}function kV($){return!!e0[$]}async function DW($,Z){let{locales:Y,parallel:X=!0,priority:J={},onLocaleLoaded:Q,onComplete:G,onError:K}=$,W=X?Y:[...Y].sort((_,B)=>(J[B]||0)-(J[_]||0));if(X){let _=W.map(async(B)=>{try{await W4(B,Z),Q?.(B)}catch(U){K?.(B,U instanceof Error?U:Error(String(U)))}});await Promise.all(_)}else for(let _ of W)try{await W4(_,Z),Q?.(_)}catch(B){K?.(_,B instanceof Error?B:Error(String(B)))}G?.()}function SV($,Z){queueMicrotask(()=>{DW($,Z).catch((Y)=>{if(Z.debug)console.error("Background preload error:",Y)})})}async function W4($,Z){if({...p3,...Z.i18n}.cache&&e0[$]){let J=e0[$],Q=Z.i18n?.cacheMaxAge??0;if(!EV(J,Q))return J.translations}if(L1[$]?.state==="loading")return L1[$].promise;i1[$]="loading";let X=SW($,Z).then((J)=>{return i1[$]="loaded",delete L1[$],J}).catch((J)=>{throw i1[$]="error",L1[$]={promise:X,state:"error",error:J instanceof Error?J:Error(String(J))},J});return L1[$]={promise:X,state:"loading"},X}function kW($){return e0[$]?.translations}async function bV($,Z){let Y=kW($);if(Y)return Y;return W4($,Z)}async function CV($,Z){if(e0[$])return e0[$].translations;if(L1[$]){if(Z)return Promise.race([L1[$].promise,new Promise((Y,X)=>setTimeout(()=>X(Error(`Timeout waiting for locale: ${$}`)),Z))]);return L1[$].promise}throw Error(`Locale "${$}" is not loading. Call loadTranslationLazy first.`)}function yV(){return Object.entries(i1).filter(([$,Z])=>Z==="loading").map(([$])=>$)}function PV($){if($)delete L1[$],delete i1[$];else{for(let Z of Object.keys(L1))delete L1[Z];for(let Z of Object.keys(i1))delete i1[Z]}}async function SW($,Z){let Y={...p3,...Z.i18n},X=TW.resolve(import.meta.dir,"..",Y.translationsDir),J=fV(Y.format),Q=TW.join(X,`${$}${J}`);try{let G={};try{let K=await import(Q);G=K.default||K}catch(K){let W=await Bun.file(Q).text();if(Y.format==="yaml"||Y.format==="yml")G=xV(W);else if(Y.format==="json")G=JSON.parse(W);else throw K}if(Y.cache)e0[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(G){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,G);if($!==Y.defaultLocale)return SW(Y.defaultLocale,Z);return{}}}async function bW($,Z){return W4($,Z)}function xV($){let Z={},Y=$.split(`
3868
- `),X=[{obj:Z,indent:-1}];for(let J of Y){let Q=J.replace(/#.*$/,"").trimEnd();if(!Q.trim())continue;let G=Q.search(/\S/);if(G===-1)continue;while(X.length>1&&X[X.length-1].indent>=G)X.pop();let K=X[X.length-1].obj,W=Q.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(W){let[,,_,B]=W,U=_.trim(),z=B.trim();if(z==="")K[U]={},X.push({obj:K[U],indent:G});else K[U]=vV(z)}}return Z}function vV($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Z=$.toLowerCase();if(Z==="true"||Z==="yes")return!0;if(Z==="false"||Z==="no")return!1;if(Z==="null"||Z==="~")return null;let Y=Number($);if(!Number.isNaN(Y))return Y;return $}function fV($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"json":default:return".json"}}function gV($,Z){for(let Y of $){let X=Y.trim(),J=X.match(/^\{(\d+)\}\s*(.*)$/);if(J){let G=Number.parseInt(J[1],10);if(Z===G)return J[2];continue}let Q=X.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10),K=Q[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(Q[2],10);if(Z>=G&&Z<=K)return Q[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function CW($,Z={}){return yW($,Z)}function yW($,Z){let Y="",X=0;while(X<$.length)if($[X]==="{"){let J=hV($,X);if(J===-1){Y+=$[X],X++;continue}let Q=$.slice(X+1,J);Y+=dV(Q,Z),X=J+1}else if($[X]==="'"&&X+1<$.length)if($[X+1]==="'")Y+="'",X+=2;else if($[X+1]==="{"||$[X+1]==="}")Y+=$[X+1],X+=2;else Y+=$[X],X++;else Y+=$[X],X++;return Y}function hV($,Z){let Y=0;for(let X=Z;X<$.length;X++)if($[X]==="{")Y++;else if($[X]==="}"){if(Y--,Y===0)return X}return-1}function dV($,Z){let Y=uV($);if(Y.length===0)return`{${$}}`;let X=Y[0].trim(),J=Z[X];if(Y.length===1)return J!==void 0?String(J):`{${X}}`;switch(Y[1].trim().toLowerCase()){case"plural":return mV(J,Y.slice(2).join(","),Z);case"select":return cV(J,Y.slice(2).join(","));case"selectordinal":return lV(J,Y.slice(2).join(","));case"number":return nV(J,Y[2]?.trim());case"date":return sV(J,Y[2]?.trim());case"time":return rV(J,Y[2]?.trim());default:return J!==void 0?String(J):`{${$}}`}}function uV($){let Z=[],Y="",X=0;for(let J=0;J<$.length;J++){let Q=$[J];if(Q==="{")X++,Y+=Q;else if(Q==="}")X--,Y+=Q;else if(Q===","&&X===0)Z.push(Y),Y="";else Y+=Q}if(Y)Z.push(Y);return Z}function mV($,Z,Y){let X=Number($)||0,J=cX(Z),Q=`=${X}`;if(J[Q])return pX(J[Q],X,Y);let G=pV(X);if(J[G])return pX(J[G],X,Y);if(J.other)return pX(J.other,X,Y);return String(X)}function pX($,Z,Y){let X=$.replace(/#/g,String(Z));return yW(X,Y)}function pV($){let Z=Math.abs($),Y=Math.floor(Z),X=String($).includes(".")?String($).split(".")[1].length:0;if(Y===1&&X===0)return"one";return"other"}function cV($,Z){let Y=String($||""),X=cX(Z);if(X[Y])return X[Y];return X.other||String($)}function lV($,Z){let Y=Number($)||0,X=cX(Z),J=iV(Y);if(X[J])return X[J].replace(/#/g,String(Y));if(X.other)return X.other.replace(/#/g,String(Y));return String(Y)}function iV($){let Z=Math.abs($),Y=Z%10,X=Z%100;if(Y===1&&X!==11)return"one";if(Y===2&&X!==12)return"two";if(Y===3&&X!==13)return"few";return"other"}function cX($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,X=Y.exec($);while(X!==null)Z[X[1]]=X[2],X=Y.exec($);return Z}function nV($,Z){let Y=Number($);if(Number.isNaN(Y))return String($);switch(Z){case"integer":return Math.floor(Y).toLocaleString();case"percent":return`${(Y*100).toFixed(0)}%`;case"currency":return Y.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Y.toLocaleString()}}function sV($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.dateStyle="short";break;case"medium":X.dateStyle="medium";break;case"long":X.dateStyle="long";break;case"full":X.dateStyle="full";break;default:X.dateStyle="medium"}return Y.toLocaleDateString(void 0,X)}function rV($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.timeStyle="short";break;case"medium":X.timeStyle="medium";break;case"long":X.timeStyle="long";break;case"full":X.timeStyle="full";break;default:X.timeStyle="short"}return Y.toLocaleTimeString(void 0,X)}function PW($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function m3($,Z,Y=!0,X={}){let J=$.split("."),Q=Z;for(let K of J){if(Q===void 0||Q===null)break;Q=Q[K]}if(Q===void 0||Q===null)return Y?$:"";let G=String(Q);if(PW(G))return CW(G,X);if(G.includes("|")&&"count"in X){let K=Number(X.count),W=G.split("|");G=gV(W,K)}for(let[K,W]of Object.entries(X)){let _=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${_}`,"g"),String(W))}return G}async function lX($,Z,Y,X){let J=$,Q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...p3,...X.i18n},K=await bW(G.locale,X);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,J=await EW(J,Q,async(B,U,z,q,j)=>{try{let H={};if(z)try{let F=[()=>JSON.parse(z),()=>{let L=`{"data":${z}}`,V=JSON.parse(L);return typeof V.data==="object"?V.data:{}},()=>{return k0(z,Z)}];for(let L of F)try{if(H=L(),Object.keys(H).length>0)break}catch{}}catch(F){if(X.debug)console.error("Error parsing parameters for @translate directive:",F)}return m3(U,K,G.fallbackToKey,H)||q.trim()}catch(H){if(X.debug)console.error("Error processing @translate directive:",H);return $0("Translate",`Error in @translate('${U}'): ${H instanceof Error?H.message:String(H)}`,o.EVALUATION_ERROR)}});let W=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(X.debug){console.warn(`Processing translations in template. Sections: ${J.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let B=[...J.matchAll(W)];console.warn(`Found ${B.length} @translate matches`),B.forEach((U,z)=>console.warn(`Match ${z}: ${U[0]}, Key: ${U[1]}, Params: ${U[2]||"none"}`))}return J=await EW(J,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(B,U,z,q)=>{try{let j={};if(z)try{let H=[()=>JSON.parse(z),()=>{let O=`{"data":${z}}`,F=JSON.parse(O);return typeof F.data==="object"?F.data:{}},()=>{return k0(z,Z)}];for(let O of H)try{if(j=O(),Object.keys(j).length>0)break}catch{}}catch(H){if(X.debug)console.error("Error parsing parameters for @translate directive:",H)}return m3(U,K,G.fallbackToKey,j)}catch(j){if(X.debug)console.error("Error processing @translate directive:",j);return $0("Translate",`Error in @translate('${U}'): ${j instanceof Error?j.message:String(j)}`,o.EVALUATION_ERROR)}}),J}async function EW($,Z,Y){let X=[];return $.replace(Z,(Q,...G)=>{let K=Y(Q,...G).then((W)=>({match:Q,replacement:W}));return X.push(K),Q}),(await Promise.all(X)).reduce((Q,{match:G,replacement:K})=>Q.replace(G,K),$)}function oV($,Z=!0){return(Y,X={})=>{return m3(Y,$,Z,X)}}var p3,e0,L1,i1;var iX=D(()=>{X1();h0();p3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},e0={},L1={},i1={}});var l3={};Q0(l3,{stripTypeScript:()=>gW,hasVariables:()=>rX,extractVariables:()=>R0,extractScriptFromTemplate:()=>sX,convertToCommonJS:()=>c3});import _4 from"path";function aV($){let Z=[],Y=0,X=$.split(`
3867
+ </script>`.trim()}var h3,AW,dX;var uX=D(()=>{h0();h3={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};AW={required:($,Z,Y)=>{if($===void 0||$===null||$===""||Array.isArray($)&&$.length===0)return`The ${Y} field is required.`;return null},email:($,Z,Y)=>{if(!$)return null;if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($)))return`The ${Y} field must be a valid email address.`;return null},min:($,Z,Y)=>{if(!$)return null;let X=Number(Z[0]);if(typeof $==="string"&&$.length<X)return`The ${Y} field must be at least ${X} characters.`;if(typeof $==="number"&&$<X)return`The ${Y} field must be at least ${X}.`;if(Array.isArray($)&&$.length<X)return`The ${Y} field must have at least ${X} items.`;return null},max:($,Z,Y)=>{if(!$)return null;let X=Number(Z[0]);if(typeof $==="string"&&$.length>X)return`The ${Y} field must not exceed ${X} characters.`;if(typeof $==="number"&&$>X)return`The ${Y} field must not exceed ${X}.`;if(Array.isArray($)&&$.length>X)return`The ${Y} field must not have more than ${X} items.`;return null},confirmed:($,Z,Y)=>{if(Z[0]!==void 0&&$!==Z[0])return`The ${Y} confirmation does not match.`;return null},numeric:($,Z,Y)=>{if(!$)return null;if(Number.isNaN(Number($)))return`The ${Y} field must be a number.`;return null},integer:($,Z,Y)=>{if(!$)return null;if(!Number.isInteger(Number($)))return`The ${Y} field must be an integer.`;return null},alpha:($,Z,Y)=>{if(!$)return null;if(!/^[a-z]+$/i.test(String($)))return`The ${Y} field must only contain letters.`;return null},alphanumeric:($,Z,Y)=>{if(!$)return null;if(!/^[a-z0-9]+$/i.test(String($)))return`The ${Y} field must only contain letters and numbers.`;return null},url:($,Z,Y)=>{if(!$)return null;try{return new URL(String($))?null:null}catch{return`The ${Y} field must be a valid URL.`}},regex:($,Z,Y)=>{if(!$)return null;try{if(!new RegExp(Z[0]).test(String($)))return`The ${Y} field format is invalid.`;return null}catch{return`The ${Y} field has an invalid validation pattern.`}},in:($,Z,Y)=>{if(!$)return null;if(!Z.includes(String($)))return`The ${Y} field must be one of: ${Z.join(", ")}.`;return null},notIn:($,Z,Y)=>{if(!$)return null;if(Z.includes(String($)))return`The ${Y} field must not be: ${Z.join(", ")}.`;return null},date:($,Z,Y)=>{if(!$)return null;let X=new Date($);if(Number.isNaN(X.getTime()))return`The ${Y} field must be a valid date.`;return null},before:($,Z,Y)=>{if(!$)return null;let X=new Date($),J=new Date(Z[0]);if(X>=J)return`The ${Y} field must be before ${Z[0]}.`;return null},after:($,Z,Y)=>{if(!$)return null;let X=new Date($),J=new Date(Z[0]);if(X<=J)return`The ${Y} field must be after ${Z[0]}.`;return null}};dX={required:{name:"required",validate:($)=>{if($===null||$===void 0||$==="")return"This field is required";if(Array.isArray($)&&$.length===0)return"This field is required";return!0},toHtml5:()=>["required"],message:"This field is required"},email:{name:"email",validate:($)=>{if(!$)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($))||"Please enter a valid email address"},toHtml5:()=>['type="email"'],message:"Please enter a valid email address"},url:{name:"url",validate:($)=>{if(!$)return!0;try{return new URL(String($)).protocol.startsWith("http")||"Please enter a valid URL"}catch{return"Please enter a valid URL"}},toHtml5:()=>['type="url"'],message:"Please enter a valid URL"},numeric:{name:"numeric",validate:($)=>{if(!$)return!0;return!Number.isNaN(Number($))||"Please enter a number"},toHtml5:()=>['type="number"'],message:"Please enter a number"},integer:{name:"integer",validate:($)=>{if(!$)return!0;let Z=Number($);return Number.isInteger(Z)||"Please enter a whole number"},toHtml5:()=>['type="number"','step="1"'],message:"Please enter a whole number"},alpha:{name:"alpha",validate:($)=>{if(!$)return!0;return/^[a-z]+$/i.test(String($))||"Please enter only letters"},toHtml5:()=>['pattern="[a-zA-Z]+"'],message:"Please enter only letters"},alphanumeric:{name:"alphanumeric",validate:($)=>{if(!$)return!0;return/^[a-z0-9]+$/i.test(String($))||"Please enter only letters and numbers"},toHtml5:()=>['pattern="[a-zA-Z0-9]+"'],message:"Please enter only letters and numbers"},min:{name:"min",validate:($,Z)=>{if(!$)return!0;let Y=Number(Z[0]);if(typeof $==="string")return $.length>=Y||`Must be at least ${Y} characters`;if(typeof $==="number")return $>=Y||`Must be at least ${Y}`;if(Array.isArray($))return $.length>=Y||`Must have at least ${Y} items`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`min="${$[0]}"`],message:"Must be at least {{param}} characters"},max:{name:"max",validate:($,Z)=>{if(!$)return!0;let Y=Number(Z[0]);if(typeof $==="string")return $.length<=Y||`Must be no more than ${Y} characters`;if(typeof $==="number")return $<=Y||`Must be no more than ${Y}`;if(Array.isArray($))return $.length<=Y||`Must have no more than ${Y} items`;return!0},toHtml5:($)=>[`maxlength="${$[0]}"`,`max="${$[0]}"`],message:"Must be no more than {{param}} characters"},between:{name:"between",validate:($,Z)=>{if(!$)return!0;let[Y,X]=Z.map(Number);if(typeof $==="string")return $.length>=Y&&$.length<=X||`Must be between ${Y} and ${X} characters`;if(typeof $==="number")return $>=Y&&$<=X||`Must be between ${Y} and ${X}`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`maxlength="${$[1]}"`],message:"Must be between {{min}} and {{max}}"},confirmed:{name:"confirmed",validate:($,Z,Y)=>{let X=Object.keys(Y);for(let J of X)if(J.endsWith("_confirmation")&&Y[J]===$)return!0;return"Confirmation does not match"},message:"Confirmation does not match"},in:{name:"in",validate:($,Z)=>{if(!$)return!0;return Z.includes(String($))||`Must be one of: ${Z.join(", ")}`},message:"Must be one of: {{values}}"},notIn:{name:"notIn",validate:($,Z)=>{if(!$)return!0;return!Z.includes(String($))||`Must not be: ${Z.join(", ")}`},message:"Must not be: {{values}}"},regex:{name:"regex",validate:($,Z)=>{if(!$)return!0;try{return new RegExp(Z[0]).test(String($))||"Invalid format"}catch{return"Invalid format"}},toHtml5:($)=>[`pattern="${$[0]}"`],message:"Invalid format"},date:{name:"date",validate:($)=>{if(!$)return!0;let Z=new Date(String($));return!Number.isNaN(Z.getTime())||"Please enter a valid date"},toHtml5:()=>['type="date"'],message:"Please enter a valid date"},before:{name:"before",validate:($,Z)=>{if(!$)return!0;let Y=new Date(String($)),X=new Date(Z[0]);return Y<X||`Must be before ${Z[0]}`},toHtml5:($)=>[`max="${$[0]}"`],message:"Must be before {{date}}"},after:{name:"after",validate:($,Z)=>{if(!$)return!0;let Y=new Date(String($)),X=new Date(Z[0]);return Y>X||`Must be after ${Z[0]}`},toHtml5:($)=>[`min="${$[0]}"`],message:"Must be after {{date}}"},size:{name:"size",validate:($,Z)=>{if(!$)return!0;let Y=Number(Z[0]);if(typeof $==="string")return $.length===Y||`Must be exactly ${Y} characters`;if(Array.isArray($))return $.length===Y||`Must have exactly ${Y} items`;return!0},message:"Must be exactly {{size}}"},phone:{name:"phone",validate:($)=>{if(!$)return!0;return/^\+?\(?\d{1,4}\)?[-\s./\d]*$/.test(String($))||"Please enter a valid phone number"},toHtml5:()=>['type="tel"','pattern="\\+?\\(?\\d{1,4}\\)?[-\\s./\\d]*"'],message:"Please enter a valid phone number"}}});import TW from"path";function MV($){if($)delete e0[$];else for(let Z of Object.keys(e0))delete e0[Z]}function TV(){let $=Object.entries(e0).map(([Z,Y])=>({locale:Z,loadedAt:new Date(Y.loadedAt),keyCount:IW(Y.translations)}));return{size:Object.keys(e0).length,locales:Object.keys(e0),entries:$}}function IW($,Z=0){for(let Y of Object.values($))if(Z++,Y&&typeof Y==="object"&&!Array.isArray(Y))Z=IW(Y,Z);return Z}function EV($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}function IV($){if(e0[$])return"loaded";return i1[$]||"idle"}function DV($){return i1[$]==="loading"}function kV($){return!!e0[$]}async function DW($,Z){let{locales:Y,parallel:X=!0,priority:J={},onLocaleLoaded:Q,onComplete:G,onError:K}=$,W=X?Y:[...Y].sort((_,B)=>(J[B]||0)-(J[_]||0));if(X){let _=W.map(async(B)=>{try{await W4(B,Z),Q?.(B)}catch(U){K?.(B,U instanceof Error?U:Error(String(U)))}});await Promise.all(_)}else for(let _ of W)try{await W4(_,Z),Q?.(_)}catch(B){K?.(_,B instanceof Error?B:Error(String(B)))}G?.()}function SV($,Z){queueMicrotask(()=>{DW($,Z).catch((Y)=>{if(Z.debug)console.error("Background preload error:",Y)})})}async function W4($,Z){if({...p3,...Z.i18n}.cache&&e0[$]){let J=e0[$],Q=Z.i18n?.cacheMaxAge??0;if(!EV(J,Q))return J.translations}if(L1[$]?.state==="loading")return L1[$].promise;i1[$]="loading";let X=SW($,Z).then((J)=>{return i1[$]="loaded",delete L1[$],J}).catch((J)=>{throw i1[$]="error",L1[$]={promise:X,state:"error",error:J instanceof Error?J:Error(String(J))},J});return L1[$]={promise:X,state:"loading"},X}function kW($){return e0[$]?.translations}async function bV($,Z){let Y=kW($);if(Y)return Y;return W4($,Z)}async function CV($,Z){if(e0[$])return e0[$].translations;if(L1[$]){if(Z)return Promise.race([L1[$].promise,new Promise((Y,X)=>setTimeout(()=>X(Error(`Timeout waiting for locale: ${$}`)),Z))]);return L1[$].promise}throw Error(`Locale "${$}" is not loading. Call loadTranslationLazy first.`)}function yV(){return Object.entries(i1).filter(([$,Z])=>Z==="loading").map(([$])=>$)}function PV($){if($)delete L1[$],delete i1[$];else{for(let Z of Object.keys(L1))delete L1[Z];for(let Z of Object.keys(i1))delete i1[Z]}}async function SW($,Z){let Y={...p3,...Z.i18n},X=TW.resolve(import.meta.dir,"..",Y.translationsDir),J=fV(Y.format),Q=TW.join(X,`${$}${J}`);try{let G={};try{let K=await import(Q);G=K.default||K}catch(K){let W=await Bun.file(Q).text();if(Y.format==="yaml"||Y.format==="yml")G=xV(W);else if(Y.format==="json")G=JSON.parse(W);else throw K}if(Y.cache)e0[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(G){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,G);if($!==Y.defaultLocale)return SW(Y.defaultLocale,Z);return{}}}async function bW($,Z){return W4($,Z)}function xV($){let Z={},Y=$.split(`
3868
+ `),X=[{obj:Z,indent:-1}];for(let J of Y){let Q=J.replace(/#.*$/,"").trimEnd();if(!Q.trim())continue;let G=Q.search(/\S/);if(G===-1)continue;while(X.length>1&&X[X.length-1].indent>=G)X.pop();let K=X[X.length-1].obj,W=Q.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(W){let[,,_,B]=W,U=_.trim(),z=B.trim();if(z==="")K[U]={},X.push({obj:K[U],indent:G});else K[U]=vV(z)}}return Z}function vV($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Z=$.toLowerCase();if(Z==="true"||Z==="yes")return!0;if(Z==="false"||Z==="no")return!1;if(Z==="null"||Z==="~")return null;let Y=Number($);if(!Number.isNaN(Y))return Y;return $}function fV($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"json":default:return".json"}}function gV($,Z){for(let Y of $){let X=Y.trim(),J=X.match(/^\{(\d+)\}\s*(.*)$/);if(J){let G=Number.parseInt(J[1],10);if(Z===G)return J[2];continue}let Q=X.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10),K=Q[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(Q[2],10);if(Z>=G&&Z<=K)return Q[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function CW($,Z={}){return yW($,Z)}function yW($,Z){let Y="",X=0;while(X<$.length)if($[X]==="{"){let J=hV($,X);if(J===-1){Y+=$[X],X++;continue}let Q=$.slice(X+1,J);Y+=dV(Q,Z),X=J+1}else if($[X]==="'"&&X+1<$.length)if($[X+1]==="'")Y+="'",X+=2;else if($[X+1]==="{"||$[X+1]==="}")Y+=$[X+1],X+=2;else Y+=$[X],X++;else Y+=$[X],X++;return Y}function hV($,Z){let Y=0;for(let X=Z;X<$.length;X++)if($[X]==="{")Y++;else if($[X]==="}"){if(Y--,Y===0)return X}return-1}function dV($,Z){let Y=uV($);if(Y.length===0)return`{${$}}`;let X=Y[0].trim(),J=Z[X];if(Y.length===1)return J!==void 0?String(J):`{${X}}`;switch(Y[1].trim().toLowerCase()){case"plural":return mV(J,Y.slice(2).join(","),Z);case"select":return cV(J,Y.slice(2).join(","));case"selectordinal":return lV(J,Y.slice(2).join(","));case"number":return nV(J,Y[2]?.trim());case"date":return sV(J,Y[2]?.trim());case"time":return rV(J,Y[2]?.trim());default:return J!==void 0?String(J):`{${$}}`}}function uV($){let Z=[],Y="",X=0;for(let J=0;J<$.length;J++){let Q=$[J];if(Q==="{")X++,Y+=Q;else if(Q==="}")X--,Y+=Q;else if(Q===","&&X===0)Z.push(Y),Y="";else Y+=Q}if(Y)Z.push(Y);return Z}function mV($,Z,Y){let X=Number($)||0,J=pX(Z),Q=`=${X}`;if(J[Q])return mX(J[Q],X,Y);let G=pV(X);if(J[G])return mX(J[G],X,Y);if(J.other)return mX(J.other,X,Y);return String(X)}function mX($,Z,Y){let X=$.replace(/#/g,String(Z));return yW(X,Y)}function pV($){let Z=Math.abs($),Y=Math.floor(Z),X=String($).includes(".")?String($).split(".")[1].length:0;if(Y===1&&X===0)return"one";return"other"}function cV($,Z){let Y=String($||""),X=pX(Z);if(X[Y])return X[Y];return X.other||String($)}function lV($,Z){let Y=Number($)||0,X=pX(Z),J=iV(Y);if(X[J])return X[J].replace(/#/g,String(Y));if(X.other)return X.other.replace(/#/g,String(Y));return String(Y)}function iV($){let Z=Math.abs($),Y=Z%10,X=Z%100;if(Y===1&&X!==11)return"one";if(Y===2&&X!==12)return"two";if(Y===3&&X!==13)return"few";return"other"}function pX($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,X=Y.exec($);while(X!==null)Z[X[1]]=X[2],X=Y.exec($);return Z}function nV($,Z){let Y=Number($);if(Number.isNaN(Y))return String($);switch(Z){case"integer":return Math.floor(Y).toLocaleString();case"percent":return`${(Y*100).toFixed(0)}%`;case"currency":return Y.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Y.toLocaleString()}}function sV($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.dateStyle="short";break;case"medium":X.dateStyle="medium";break;case"long":X.dateStyle="long";break;case"full":X.dateStyle="full";break;default:X.dateStyle="medium"}return Y.toLocaleDateString(void 0,X)}function rV($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.timeStyle="short";break;case"medium":X.timeStyle="medium";break;case"long":X.timeStyle="long";break;case"full":X.timeStyle="full";break;default:X.timeStyle="short"}return Y.toLocaleTimeString(void 0,X)}function PW($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function m3($,Z,Y=!0,X={}){let J=$.split("."),Q=Z;for(let K of J){if(Q===void 0||Q===null)break;Q=Q[K]}if(Q===void 0||Q===null)return Y?$:"";let G=String(Q);if(PW(G))return CW(G,X);if(G.includes("|")&&"count"in X){let K=Number(X.count),W=G.split("|");G=gV(W,K)}for(let[K,W]of Object.entries(X)){let _=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${_}`,"g"),String(W))}return G}async function cX($,Z,Y,X){let J=$,Q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...p3,...X.i18n},K=await bW(G.locale,X);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,J=await EW(J,Q,async(B,U,z,q,j)=>{try{let H={};if(z)try{let F=[()=>JSON.parse(z),()=>{let L=`{"data":${z}}`,V=JSON.parse(L);return typeof V.data==="object"?V.data:{}},()=>{return k0(z,Z)}];for(let L of F)try{if(H=L(),Object.keys(H).length>0)break}catch{}}catch(F){if(X.debug)console.error("Error parsing parameters for @translate directive:",F)}return m3(U,K,G.fallbackToKey,H)||q.trim()}catch(H){if(X.debug)console.error("Error processing @translate directive:",H);return $0("Translate",`Error in @translate('${U}'): ${H instanceof Error?H.message:String(H)}`,o.EVALUATION_ERROR)}});let W=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(X.debug){console.warn(`Processing translations in template. Sections: ${J.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let B=[...J.matchAll(W)];console.warn(`Found ${B.length} @translate matches`),B.forEach((U,z)=>console.warn(`Match ${z}: ${U[0]}, Key: ${U[1]}, Params: ${U[2]||"none"}`))}return J=await EW(J,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(B,U,z,q)=>{try{let j={};if(z)try{let H=[()=>JSON.parse(z),()=>{let O=`{"data":${z}}`,F=JSON.parse(O);return typeof F.data==="object"?F.data:{}},()=>{return k0(z,Z)}];for(let O of H)try{if(j=O(),Object.keys(j).length>0)break}catch{}}catch(H){if(X.debug)console.error("Error parsing parameters for @translate directive:",H)}return m3(U,K,G.fallbackToKey,j)}catch(j){if(X.debug)console.error("Error processing @translate directive:",j);return $0("Translate",`Error in @translate('${U}'): ${j instanceof Error?j.message:String(j)}`,o.EVALUATION_ERROR)}}),J}async function EW($,Z,Y){let X=[];return $.replace(Z,(Q,...G)=>{let K=Y(Q,...G).then((W)=>({match:Q,replacement:W}));return X.push(K),Q}),(await Promise.all(X)).reduce((Q,{match:G,replacement:K})=>Q.replace(G,K),$)}function oV($,Z=!0){return(Y,X={})=>{return m3(Y,$,Z,X)}}var p3,e0,L1,i1;var lX=D(()=>{X1();h0();p3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},e0={},L1={},i1={}});var l3={};Q0(l3,{stripTypeScript:()=>gW,hasVariables:()=>sX,extractVariables:()=>R0,extractScriptFromTemplate:()=>nX,convertToCommonJS:()=>c3});import _4 from"path";function aV($){let Z=[],Y=0,X=$.split(`
3869
3869
  `);for(let J of X){let Q=null,G=!1;for(let K=0;K<J.length;K++){let W=J[K];if(G){G=!1;continue}if(W==="\\"){G=!0;continue}if(Q){if(W===Q)Q=null;continue}if(W==="'"||W==='"'||W==="`"){Q=W;continue}if(W==="/"&&K+1<J.length&&J[K+1]==="/")break;if(W==="{")Y++;else if(W==="}")Y--}if(Y===0){let K=J.match(/(?:const|let|var)\s+(\w+)\s*=/);if(K)Z.push(K[1]);else{let W=J.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let B=W[1].slice(1,-1).split(",").map((U)=>{let z=U.split(":");return(z.length>1?z[1]:z[0]).trim()}).filter((U)=>/^\w+$/.test(U));Z.push(...B)}}}}return[...new Set(Z)]}function gW($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Y(X){if(!X.includes(":"))return X;let J=[],Q="",G=0,K=0,W=null;for(let _=0;_<X.length;_++){let B=X[_];if(W){if(Q+=B,B===W)W=null;continue}if(B==='"'||B==="'"||B==="`"){W=B,Q+=B;continue}if(B==="<")G++;else if(B===">"&&G>0)G--;else if(B==="(")K++;else if(B===")")K--;if(B===","&&G===0&&K===0){J.push(Q),Q="";continue}Q+=B}if(Q)J.push(Q);return J.map((_)=>{let B=_.trim(),U=B.startsWith("..."),z=U?B.slice(3):B,q=-1,j=0;for(let N=0;N<z.length;N++)if(z[N]==="<")j++;else if(z[N]===">")j--;else if(z[N]===":"&&j===0){q=N;break}if(q===-1)return _;let O=z.substring(0,q).trim().replace(/\?$/,""),F=z.substring(q+1),L=-1,V=0;for(let N=0;N<F.length;N++)if(F[N]==="<")V++;else if(F[N]===">")V--;else if(F[N]==="="&&V===0){L=N;break}let A=U?"...":"";if(L!==-1)return`${A}${O} = ${F.substring(L+1).trim()}`;return`${A}${O}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(X,J,Q)=>{if(!Q.includes(":"))return X;return`${J}(${Y(Q)})`});{let X=/\b(function\s+\w*\s*)\(/g,J,Q=[];while((J=X.exec(Z))!==null){let G=J.index+J[0].length-1,K=1,W=G+1,_=0,B=null;while(W<Z.length&&K>0){let q=Z[W];if(B){if(q===B)B=null;W++;continue}if(q==='"'||q==="'"||q==="`"){B=q,W++;continue}if(q==="<")_++;else if(q===">"&&_>0)_--;else if(_===0){if(q==="(")K++;else if(q===")")K--}if(K>0)W++}if(K!==0)continue;let U=Z.substring(G+1,W);if(!U.includes(":"))continue;let z=Y(U);Q.push({start:G+1,end:W,replacement:z})}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:_}=Q[G];Z=Z.substring(0,K)+_+Z.substring(W)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(X,J)=>{if(!J.includes(":"))return X;if(J.includes("{")||J.includes("}"))return X;return`(${J.split(",").map((G)=>{let[K,...W]=G.split("="),_=K.split(":")[0].trim();if(W.length>0)return`${_} = ${W.join("=").trim()}`;return _}).join(", ")}) =>`}),Z=Z.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
3870
3870
 
3871
- `),Z}async function R0($,Z,Y){if(!$.trim())return;let X;try{let v=new Bun.Transpiler({loader:"ts",target:"browser",define:K1()}),d=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");d=d.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),X=v.transformSync(d)}catch{X=gW($)}let J={exports:{}},Q=J.exports,G=process.cwd(),K={},W=[...X.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((v)=>v[1]).filter((v)=>!v.startsWith("node:")&&!v.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(v));for(let v of W)try{let d=_4.resolve(G,"node_modules",v),n=_4.join(d,"package.json"),p=JSON.parse(K0("fs").readFileSync(n,"utf8")),u=p.main||"index.js";if(p.exports){let m=typeof p.exports==="string"?p.exports:p.exports["."];if(typeof m==="string")u=m;else if(m?.bun)u=m.bun;else if(m?.import)u=m.import;else if(m?.default)u=m.default}K[v]=await import(_4.resolve(d,u))}catch{}let _=(v)=>{if(K[v])return K[v];return K0(v)},B=Z.props||{},U=Object.assign((v)=>{if(!v)return B;let d={};for(let[n,p]of Object.entries(v)){let u=B[n];if(u!==void 0)d[n]=u;else if(typeof p==="function")d[n]=p();else d[n]=p}return d},B),z=()=>B,q=(v,d)=>{let n={...v};for(let[p,u]of Object.entries(d))if(n[p]===void 0)if(typeof u==="function")n[p]=u();else n[p]=u;return n},j=(v)=>{let d=()=>v;return d.set=(n)=>{},d.update=(n)=>{},d},H=(v)=>{let d,n=!1;return()=>{if(!n)try{d=v(),n=!0}catch{d=void 0}return d}},O=(v)=>{},F=(v)=>v(),L=(v)=>{},V=(v)=>{},A=(v)=>{},N=()=>({params:{},query:{},path:"",name:"",fullPath:"",hash:"",matched:[]}),w=()=>({push:(v)=>{},replace:(v)=>{},back:()=>{},forward:()=>{},go:(v)=>{}}),M=(v)=>{H$(v);let d=Z.__stx_runtime_head||{},n=v||{};Z.__stx_runtime_head={...d,...n.title&&{title:n.title},meta:[...d.meta||[],...n.meta||[]],link:[...d.link||[],...n.link||[]],script:[...d.script||[],...n.script||[]],htmlAttrs:{...d.htmlAttrs||{},...n.htmlAttrs||{}},bodyAttrs:{...d.bodyAttrs||{},...n.bodyAttrs||{}}}},T=(v)=>{Q4(v);let d=m5();Z.__stx_runtime_head={...Z.__stx_runtime_head||{},...d.title&&{title:d.title},meta:d.meta?[...d.meta]:[]}},I=(v)=>({value:v}),E=(v)=>v,S=(v)=>({value:typeof v==="function"?v():v}),k=(v,d)=>{},b=(v)=>{},P=(v)=>{},x=(v)=>v?v():Promise.resolve(),C=(v)=>(d,...n)=>{},f=(v)=>{},g=(v,d)=>{},h=(v,d)=>d,l=()=>({value:"light"}),i=()=>({value:!1}),Y0={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:{}},W0=new Proxy(Y0,{get(v,d){if(d in v)return v[d];return},set(v,d,n){return v[d]=n,!0}}),D0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},M0=console;try{let v=c3(X,Y),d=new Set(Object.keys(B)),n=Object.keys(Z).filter((_0)=>!d.has(_0)&&_0!=="props"),p=n.map((_0)=>Z[_0]),u=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","let","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","await","async","module","exports","require","params","window","document","console","state","derived","effect"]),m=[],a=[];for(let[_0,HZ]of Object.entries(B)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_0))continue;if(u.has(_0))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${_0}\\b`).test(v))continue;m.push(_0),a.push(HZ)}let s=aV(v).map((_0)=>`module.exports.${_0} = typeof ${_0} !== 'undefined' ? ${_0} : module.exports.${_0};`).join(`
3871
+ `),Z}async function R0($,Z,Y){if(!$.trim())return;let X;try{let v=new Bun.Transpiler({loader:"ts",target:"browser",define:K1()}),d=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");d=d.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),X=v.transformSync(d)}catch{X=gW($)}let J={exports:{}},Q=J.exports,G=process.cwd(),K={},W=[...X.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((v)=>v[1]).filter((v)=>!v.startsWith("node:")&&!v.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(v));for(let v of W)try{let d=_4.resolve(G,"node_modules",v),n=_4.join(d,"package.json"),p=JSON.parse(K0("fs").readFileSync(n,"utf8")),u=p.main||"index.js";if(p.exports){let m=typeof p.exports==="string"?p.exports:p.exports["."];if(typeof m==="string")u=m;else if(m?.bun)u=m.bun;else if(m?.import)u=m.import;else if(m?.default)u=m.default}K[v]=await import(_4.resolve(d,u))}catch{}let _=(v)=>{if(K[v])return K[v];return K0(v)},B=Z.props||{},U=Object.assign((v)=>{if(!v)return B;let d={};for(let[n,p]of Object.entries(v)){let u=B[n];if(u!==void 0)d[n]=u;else if(typeof p==="function")d[n]=p();else d[n]=p}return d},B),z=()=>B,q=(v,d)=>{let n={...v};for(let[p,u]of Object.entries(d))if(n[p]===void 0)if(typeof u==="function")n[p]=u();else n[p]=u;return n},j=(v)=>{let d=()=>v;return d.set=(n)=>{},d.update=(n)=>{},d},H=(v)=>{let d,n=!1;return()=>{if(!n)try{d=v(),n=!0}catch{d=void 0}return d}},O=(v)=>{},F=(v)=>v(),L=(v)=>{},V=(v)=>{},A=(v)=>{},N=()=>({params:{},query:{},path:"",name:"",fullPath:"",hash:"",matched:[]}),w=()=>({push:(v)=>{},replace:(v)=>{},back:()=>{},forward:()=>{},go:(v)=>{}}),M=(v)=>{O$(v);let d=Z.__stx_runtime_head||{},n=v||{};Z.__stx_runtime_head={...d,...n.title&&{title:n.title},meta:[...d.meta||[],...n.meta||[]],link:[...d.link||[],...n.link||[]],script:[...d.script||[],...n.script||[]],htmlAttrs:{...d.htmlAttrs||{},...n.htmlAttrs||{}},bodyAttrs:{...d.bodyAttrs||{},...n.bodyAttrs||{}}}},T=(v)=>{Q4(v);let d=m5();Z.__stx_runtime_head={...Z.__stx_runtime_head||{},...d.title&&{title:d.title},meta:d.meta?[...d.meta]:[]}},I=(v)=>({value:v}),E=(v)=>v,S=(v)=>({value:typeof v==="function"?v():v}),k=(v,d)=>{},b=(v)=>{},P=(v)=>{},x=(v)=>v?v():Promise.resolve(),C=(v)=>(d,...n)=>{},f=(v)=>{},g=(v,d)=>{},h=(v,d)=>d,l=()=>({value:"light"}),i=()=>({value:!1}),Y0={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:{}},W0=new Proxy(Y0,{get(v,d){if(d in v)return v[d];return},set(v,d,n){return v[d]=n,!0}}),D0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},M0=console;try{let v=c3(X,Y),d=new Set(Object.keys(B)),n=Object.keys(Z).filter((_0)=>!d.has(_0)&&_0!=="props"),p=n.map((_0)=>Z[_0]),u=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","let","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","await","async","module","exports","require","params","window","document","console","state","derived","effect"]),m=[],a=[];for(let[_0,jZ]of Object.entries(B)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_0))continue;if(u.has(_0))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${_0}\\b`).test(v))continue;m.push(_0),a.push(jZ)}let s=aV(v).map((_0)=>`module.exports.${_0} = typeof ${_0} !== 'undefined' ? ${_0} : module.exports.${_0};`).join(`
3872
3872
  `),J0=Z.params??{},z0=[],l0=[];for(let _0=0;_0<n.length;_0++){if(n[_0]==="params")continue;z0.push(n[_0]),l0.push(p[_0])}let J5=await Function("module","exports","require","props","$props","defineProps","withDefaults","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","provide","inject","useColorMode","useDark","window","document","console","confirm","alert","fetch","params",...m,...z0,`return (async () => {
3873
3873
  ${v}
3874
3874
  ${s}
3875
3875
  return module.exports
3876
- })()`)(J,Q,_,B,U,z,q,j,H,O,F,L,V,A,N,w,M,T,I,E,S,k,b,P,x,C,f,g,h,l,i,W0,D0,M0,Y0.confirm,Y0.alert,Y0.fetch,J0,...a,...l0);Object.assign(Z,J5);for(let[_0,HZ]of Object.entries(B))if(!(_0 in Z))Z[_0]=HZ}catch{try{await $N(X,Z,Y)}catch{}}}function c3($,Z){let Y=Z?_4.dirname(Z):process.cwd(),X=$.split(`
3877
- `),J=[],Q=0;while(Q<X.length){let G=X[Q].trim();if(G.startsWith("interface ")||G.startsWith("export interface ")||G.startsWith("type ")||G.startsWith("export type ")){if(G.includes("{")&&!G.includes("}")){let K=0;for(;Q<X.length;Q++){for(let W of X[Q])if(W==="{")K++;else if(W==="}")K--;if(K<=0)break}}Q++;continue}if(G.startsWith("definePageMeta(")){let K=0,W=!1;for(let _=Q;_<X.length&&!W;_++){let B=null,U=!1,z=X[_];for(let q=0;q<z.length;q++){let j=z[q];if(U){U=!1;continue}if(j==="\\"){U=!0;continue}if(B){if(j===B)B=null;continue}if(j==='"'||j==="'"||j==="`"){B=j;continue}if(j==="(")K++;else if(j===")"){if(K--,K===0){Q=_+1,W=!0;break}}}}if(!W)Q=X.length;continue}if(G.startsWith("import ")){let K=G.match(/^import\s+(\w+)\s+from\s+['"](.+)['"]/),W=G.match(/^import\s+\{([^}]+)\}\s+from\s+['"](.+)['"]/),_=G.match(/^import\s+['"](.+)['"]/),B=(U)=>{if(U.startsWith("."))return _4.resolve(Y,U);return U};if(K){let[,U,z]=K,q=B(z);J.push(`const ${U} = await import('${q}')`),J.push(`module.exports.${U} = ${U};`)}else if(W){let[,U,z]=W,q=U.trim(),j=B(z);J.push(`const { ${q} } = await import('${j}')`);for(let H of q.split(",")){let O=H.trim().split(/\s+as\s+/).pop()?.trim();if(O)J.push(`module.exports.${O} = ${O};`)}}else if(_){let U=B(_[1]);J.push(`await import('${U}')`)}else J.push(G);Q++;continue}if(G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var ")){let K=xW(X,Q),{type:W,name:_,value:B}=K;J.push(`${W} ${_} = ${B};`),J.push(`module.exports.${_} = ${_};`),Q=K.nextIndex}else if(G.startsWith("export function ")||G.startsWith("export async function ")){let K=nX(X,Q);J.push(K.functionCode),J.push(`module.exports.${K.name} = ${K.name};`),Q=K.nextIndex}else if(G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")){let K=xW(X,Q),{type:W,name:_,value:B}=K;J.push(`${W} ${_} = ${B};`),J.push(`module.exports.${_} = ${_};`),Q=K.nextIndex}else if(G.startsWith("function ")||G.startsWith("async function ")){let K=nX(X,Q);J.push(K.functionCode),J.push(`module.exports.${K.name} = ${K.name};`),Q=K.nextIndex}else if(G.startsWith("export default function ")||G.startsWith("export default async function ")){let K=X[Q].replace(/^(\s*)export\s+default\s+/,"$1"),W=[...X];W[Q]=K;let _=nX(W,Q);if(J.push(_.functionCode),_.name)J.push(`module.exports.default = ${_.name};`);Q=_.nextIndex}else if(G.startsWith("export default ")){let K=G.replace(/^export\s+default\s+/,"").replace(/;$/,"");J.push(`module.exports.default = ${K};`),Q++}else if(G.startsWith("class ")||G.startsWith("export class ")){let K=G.match(/(?:export\s+)?class\s+(\w+)/);if(K){let W=K[1],_=X[Q].replace(/^export\s+/,""),B=0,U=Q;for(;U<X.length;U++){let z=X[U];for(let q of z)if(q==="{")B++;else if(q==="}")B--;if(U>Q)_+=`
3876
+ })()`)(J,Q,_,B,U,z,q,j,H,O,F,L,V,A,N,w,M,T,I,E,S,k,b,P,x,C,f,g,h,l,i,W0,D0,M0,Y0.confirm,Y0.alert,Y0.fetch,J0,...a,...l0);Object.assign(Z,J5);for(let[_0,jZ]of Object.entries(B))if(!(_0 in Z))Z[_0]=jZ}catch{try{await $N(X,Z,Y)}catch{}}}function c3($,Z){let Y=Z?_4.dirname(Z):process.cwd(),X=$.split(`
3877
+ `),J=[],Q=0;while(Q<X.length){let G=X[Q].trim();if(G.startsWith("interface ")||G.startsWith("export interface ")||G.startsWith("type ")||G.startsWith("export type ")){if(G.includes("{")&&!G.includes("}")){let K=0;for(;Q<X.length;Q++){for(let W of X[Q])if(W==="{")K++;else if(W==="}")K--;if(K<=0)break}}Q++;continue}if(G.startsWith("definePageMeta(")){let K=0,W=!1;for(let _=Q;_<X.length&&!W;_++){let B=null,U=!1,z=X[_];for(let q=0;q<z.length;q++){let j=z[q];if(U){U=!1;continue}if(j==="\\"){U=!0;continue}if(B){if(j===B)B=null;continue}if(j==='"'||j==="'"||j==="`"){B=j;continue}if(j==="(")K++;else if(j===")"){if(K--,K===0){Q=_+1,W=!0;break}}}}if(!W)Q=X.length;continue}if(G.startsWith("import ")){let K=G.match(/^import\s+(\w+)\s+from\s+['"](.+)['"]/),W=G.match(/^import\s+\{([^}]+)\}\s+from\s+['"](.+)['"]/),_=G.match(/^import\s+['"](.+)['"]/),B=(U)=>{if(U.startsWith("."))return _4.resolve(Y,U);return U};if(K){let[,U,z]=K,q=B(z);J.push(`const ${U} = await import('${q}')`),J.push(`module.exports.${U} = ${U};`)}else if(W){let[,U,z]=W,q=U.trim(),j=B(z);J.push(`const { ${q} } = await import('${j}')`);for(let H of q.split(",")){let O=H.trim().split(/\s+as\s+/).pop()?.trim();if(O)J.push(`module.exports.${O} = ${O};`)}}else if(_){let U=B(_[1]);J.push(`await import('${U}')`)}else J.push(G);Q++;continue}if(G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var ")){let K=xW(X,Q),{type:W,name:_,value:B}=K;J.push(`${W} ${_} = ${B};`),J.push(`module.exports.${_} = ${_};`),Q=K.nextIndex}else if(G.startsWith("export function ")||G.startsWith("export async function ")){let K=iX(X,Q);J.push(K.functionCode),J.push(`module.exports.${K.name} = ${K.name};`),Q=K.nextIndex}else if(G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")){let K=xW(X,Q),{type:W,name:_,value:B}=K;J.push(`${W} ${_} = ${B};`),J.push(`module.exports.${_} = ${_};`),Q=K.nextIndex}else if(G.startsWith("function ")||G.startsWith("async function ")){let K=iX(X,Q);J.push(K.functionCode),J.push(`module.exports.${K.name} = ${K.name};`),Q=K.nextIndex}else if(G.startsWith("export default function ")||G.startsWith("export default async function ")){let K=X[Q].replace(/^(\s*)export\s+default\s+/,"$1"),W=[...X];W[Q]=K;let _=iX(W,Q);if(J.push(_.functionCode),_.name)J.push(`module.exports.default = ${_.name};`);Q=_.nextIndex}else if(G.startsWith("export default ")){let K=G.replace(/^export\s+default\s+/,"").replace(/;$/,"");J.push(`module.exports.default = ${K};`),Q++}else if(G.startsWith("class ")||G.startsWith("export class ")){let K=G.match(/(?:export\s+)?class\s+(\w+)/);if(K){let W=K[1],_=X[Q].replace(/^export\s+/,""),B=0,U=Q;for(;U<X.length;U++){let z=X[U];for(let q of z)if(q==="{")B++;else if(q==="}")B--;if(U>Q)_+=`
3878
3878
  `+z;if(B<=0&&U>=Q)break}J.push(_),J.push(`module.exports.${W} = ${W};`),Q=U+1}else J.push(G),Q++}else if(G.includes("module.exports"))J.push(G),Q++;else if(G.trim()&&!G.startsWith("//"))J.push(G),Q++;else Q++}return J.join(`
3879
3879
  `)}function hW($,Z){let Y=$[Z];if(Y!=="{"&&Y!=="[")return null;let J=b0($,Y,Y==="{"?"}":"]",Z);if(J===-1)return null;return{pattern:$.slice(Z,J+1),endPos:J+1}}function dW($){let Z=[],Y=$.slice(1,-1).trim();if(!Y)return Z;let X=0,J=0,Q="";while(X<Y.length){let G=Y[X];if(G==="{"||G==="["){if(J++,J===1){let K=hW(Y,X);if(K){let W=dW(K.pattern);Z.push(...W),X=K.endPos,Q="";continue}}}else if(G==="}"||G==="]")J--;if(J>0){X++;continue}if(G===","){if(Q.trim())Z.push(Q.trim());Q="",X++;continue}if(G===":"){Q="",X++;continue}if(G==="="){if(Q.trim())Z.push(Q.trim());Q="",X++;while(X<Y.length&&Y[X]!==","&&J===0){if(Y[X]==="{"||Y[X]==="[")J++;else if(Y[X]==="}"||Y[X]==="]")J--;X++}continue}if(/[\w$]/.test(G))Q+=G;X++}if(Q.trim())Z.push(Q.trim());return Z}function xW($,Z){let Y=$[Z].trim(),X=Y.match(/^(?:export\s+)?(const|let|var)\s+(\w+)\s*=\s*(.*)$/);if(!X){let _=Y.match(/^(?:export\s+)?(const|let|var)\s+/);if(_){let B=Y.slice(_[0].length),U=Z;if((B.startsWith("{")||B.startsWith("["))&&!B.includes(B.startsWith("{")?"}":"]")){let q=B.startsWith("{")?"}":"]",j=B;for(let H=Z+1;H<$.length;H++)if(j+=" "+$[H].trim(),U=H,$[H].includes(q))break;B=j}let z=hW(B,0);if(z){let q=_[1],j=z.pattern,H=B.slice(z.endPos).trim();if(H.startsWith("=")){let O=H.slice(1).trim(),F=O,L=Math.max(U,Z);if(vW(O)){let w=fW($,L,O);F=w.value,L=w.nextIndex}else L=L+1;F=F.trim().replace(/;$/,"");let V=dW(j),A=`__stx_src_${Z}`,N=V.map((w)=>`module.exports.${w} = ${w};`).join(`
3880
3880
  `);return{type:q,name:A,value:`${F}; ${q} ${j} = ${A};
3881
3881
  ${N}`,nextIndex:L}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}let[,J,Q,G]=X,K=G,W=Z;if(vW(G)){let _=fW($,Z,G);K=_.value,W=_.nextIndex}else W=Z+1;while(W<$.length){let _=$[W].trim();if(_.startsWith(".")||_.startsWith("?."))K+=`
3882
- ${$[W]}`,W++;else break}return K=K.trim().replace(/;$/,""),{type:J,name:Q,value:K,nextIndex:W}}function nX($,Z){let Y=$[Z].trim(),X=Y.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!X)throw Error(`Failed to parse function declaration: ${Y}`);let[,J]=X,Q=Y.replace(/^export\s+/,""),G=Z;if(tV(Y)){let K=eV($,Z,Q);Q=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:J,functionCode:Q,nextIndex:G}}function vW($){let Z=$.trim();if(Z.startsWith("{"))return b0(Z,"{","}",0)===-1;if(Z.startsWith("["))return b0(Z,"[","]",0)===-1;return!uW(Z)}function uW($){let Z={paren:0,bracket:0,brace:0},Y=null,X=0;for(let J=0;J<$.length;J++){let Q=$[J];if((J>0?$[J-1]:"")==="\\"&&Y)continue;if((Q==='"'||Q==="'")&&!Y){Y=Q;continue}if(Q===Y&&Y!=="`"){Y=null;continue}if(Q==="`"&&!Y){Y="`";continue}if(Q==="`"&&Y==="`"&&X===0){Y=null;continue}if(Y==="`"&&Q==="$"&&$[J+1]==="{"){X++,J++;continue}if(X>0&&Q==="{"){X++;continue}if(X>0&&Q==="}"){X--;continue}if(Y)continue;if(Q==="(")Z.paren++;else if(Q===")")Z.paren--;else if(Q==="[")Z.bracket++;else if(Q==="]")Z.bracket--;else if(Q==="{")Z.brace++;else if(Q==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&Y===null}function tV($){let Z=$.indexOf("{");if(Z===-1)return!0;return b0($,"{","}",Z)===-1}function fW($,Z,Y){let X=Y,J=Z+1;while(J<$.length&&!uW(X)){let Q=$[J];X+=`
3882
+ ${$[W]}`,W++;else break}return K=K.trim().replace(/;$/,""),{type:J,name:Q,value:K,nextIndex:W}}function iX($,Z){let Y=$[Z].trim(),X=Y.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!X)throw Error(`Failed to parse function declaration: ${Y}`);let[,J]=X,Q=Y.replace(/^export\s+/,""),G=Z;if(tV(Y)){let K=eV($,Z,Q);Q=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:J,functionCode:Q,nextIndex:G}}function vW($){let Z=$.trim();if(Z.startsWith("{"))return b0(Z,"{","}",0)===-1;if(Z.startsWith("["))return b0(Z,"[","]",0)===-1;return!uW(Z)}function uW($){let Z={paren:0,bracket:0,brace:0},Y=null,X=0;for(let J=0;J<$.length;J++){let Q=$[J];if((J>0?$[J-1]:"")==="\\"&&Y)continue;if((Q==='"'||Q==="'")&&!Y){Y=Q;continue}if(Q===Y&&Y!=="`"){Y=null;continue}if(Q==="`"&&!Y){Y="`";continue}if(Q==="`"&&Y==="`"&&X===0){Y=null;continue}if(Y==="`"&&Q==="$"&&$[J+1]==="{"){X++,J++;continue}if(X>0&&Q==="{"){X++;continue}if(X>0&&Q==="}"){X--;continue}if(Y)continue;if(Q==="(")Z.paren++;else if(Q===")")Z.paren--;else if(Q==="[")Z.bracket++;else if(Q==="]")Z.bracket--;else if(Q==="{")Z.brace++;else if(Q==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&Y===null}function tV($){let Z=$.indexOf("{");if(Z===-1)return!0;return b0($,"{","}",Z)===-1}function fW($,Z,Y){let X=Y,J=Z+1;while(J<$.length&&!uW(X)){let Q=$[J];X+=`
3883
3883
  ${Q}`,J++}while(J<$.length){let Q=$[J].trim();if(Q.startsWith(".")||Q.startsWith("?."))X+=`
3884
3884
  ${$[J]}`,J++;else break}return{value:X,nextIndex:J}}function eV($,Z,Y){let X=Y,J=Z+1;while(J<$.length){let Q=X.indexOf("{");if(Q!==-1){if(b0(X,"{","}",Q)!==-1)break}let G=$[J];X+=`
3885
3885
  ${G}`,J++}return{functionCode:X,nextIndex:J}}async function $N($,Z,Y){let X=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of X){let[,,G,K]=Q;try{let W=K.trim().replace(/;$/,""),_=Function(`return ${W}`);Z[G]=_()}catch{try{let W=K.trim().replace(/;$/,""),_=Function(`return (${W})`);Z[G]=_()}catch(W){console.warn(`Failed to parse export ${G} in fallback:`,W)}}}let J=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of J){let[,,G,K]=Q;if(!(G in Z))try{let W=K.trim().replace(/;$/,""),_=Function(`return ${W}`);Z[G]=_()}catch{}}try{let Q=$.replace(/^export\s+/gm,""),K=Function(`
@@ -3888,7 +3888,7 @@ ${G}`,J++}return{functionCode:X,nextIndex:J}}async function $N($,Z,Y){let X=$.ma
3888
3888
  ${Array.from($.matchAll(/(?:const|let|var)\s+(\w+)\s*=/g)).map((W)=>`if (typeof ${W[1]} !== 'undefined') result.${W[1]} = ${W[1]};`).join(`
3889
3889
  `)}
3890
3890
  return result;
3891
- `)();Object.entries(K).forEach(([W,_])=>{if(_!==void 0&&!(W in Z))Z[W]=_})}catch{}}function sX($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1]:"",X=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Y,templateWithoutScript:X}}function rX($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var F$=D(()=>{O$();x$()});var nW={};Q0(nW,{processLoops:()=>r3});function XN($,Z){let Y=/@component\s*\(/g,X=$,J,Q=[];while((J=Y.exec(X))!==null){let G=J.index,K=G+J[0].length-1,W=1,_=K+1;while(_<X.length&&W>0){if(X[_]==="(")W++;else if(X[_]===")"){if(W--,W===0)break}_++}if(W!==0)continue;let B=X.substring(K+1,_),U=_+1,z=B.match(/^\s*['"]([^'"]+)['"]/);if(!z)continue;let q=z[1],j=B.slice(z[0].length),H=j.match(/^\s*,\s*/);if(!H)continue;let O=j.slice(H[0].length).trim();if(!O)continue;try{let F=k0(O,Z),L=JSON.stringify(F),V=`@component('${q}', ${L})`;Q.push({start:G,end:U,replacement:V})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:_}=Q[G];X=X.substring(0,K)+_+X.substring(W)}return X}function i3($,Z,Y){let X=$,J=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=J.exec(X))!==null){let G=Q.index,K=G+Q[0].length-1,W=1,_=K+1,B=null,U=!1;while(_<X.length&&W>0){let j=X[_];if(U){U=!1,_++;continue}if(j==="\\"&&B){U=!0,_++;continue}if(B){if(j===B)B=null;_++;continue}if(j==='"'||j==="'"||j==="`"){B=j,_++;continue}if(j==="(")W++;else if(j===")"){if(W--,W===0)break}_++}if(W!==0)break;let z=X.substring(K+1,_),q=Y(z);X=X.substring(0,G)+q+X.substring(_+1)}return X}function JN($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,J)=>{if(J in Z)return`:${J}="${J}"`;return X}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,J,Q)=>{try{let G=Object.keys(Z),K=Object.values(Z);D7(Q);let _=j0(Q,G)(...K),U=JSON.stringify(_).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return`__stx_${J}="${U}"`}catch(G){return X}}),Y}function QN($,Z){let Y=$;return Y=i3(Y,"@break",(X)=>{try{let Q=`!!(${X.trim()})`,G;if(B0(Q)){let K=j0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(L0(Q,Z));return G?n3:""}catch{return""}}),Y=i3(Y,"@continue",(X)=>{try{let Q=`!!(${X.trim()})`,G;if(B0(Q)){let K=j0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(L0(Q,Z));return G?s3:""}catch{return""}}),Y}function GN($){let Z=$;return Z=Z.replace(/@break(?!\()/g,n3),Z=Z.replace(/@continue(?!\()/g,s3),Z}function mW($){let Z=$.includes(n3),Y=Z?$.substring(0,$.indexOf(n3)):$;return{hasBreak:Z,content:Y}}function pW($){let Z=$.includes(s3),Y=Z?$.substring(0,$.indexOf(s3)):$;return{hasContinue:Z,content:Y}}function lW($){let Z=$;return Z=i3(Z,"@break",(Y)=>{let X=Y.trim();if(!D6(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=i3(Z,"@continue",(Y)=>{let X=Y.trim();if(!D6(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function KN($){let Z=/@forelse\s*\(/g,Y,X=[],J=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=J.exec($))!==null)X.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)X.push({pos:G.index,delta:-1});X.sort((B,U)=>B.pos-U.pos);let K=[],W=0;for(let B of X)W+=B.delta,K.push({pos:B.pos,depth:W});function _(B){let U=0,z=K.length-1,q=0;while(U<=z){let j=U+z>>1;if(K[j].pos<=B)q=K[j].depth,U=j+1;else z=j-1}return q}while((Y=Z.exec($))!==null){if(_(Y.index)>0)continue;let B=Y.index,U=Y.index+Y[0].length-1,z=1,q=U+1,j=-1;while(q<$.length&&z>0){if($[q]==="(")z++;else if($[q]===")"){if(z--,z===0){j=q;break}}q++}if(j===-1)continue;let H=$.substring(U+1,j),O=H.indexOf(" as ");if(O===-1)continue;let F=H.substring(0,O).trim(),L=H.substring(O+4).trim(),V=j+1,A=1,N=V,w=/@forelse\s*\(/g,M=/@endforelse/g,T=-1;while(A>0&&N<$.length){w.lastIndex=N,M.lastIndex=N;let P=w.exec($),x=M.exec($);if(!x)break;if(P&&P.index<x.index)A++,N=P.index+P[0].length;else{if(A--,A===0){T=x.index;break}N=x.index+11}}if(T===-1)continue;let I=$.substring(V,T),E=T+11,S=-1,k=0,b=0;while(b<I.length){let P=I.indexOf("@",b);if(P===-1)break;let x=I.substring(P);if(/^@forelse\s*\(/.test(x))k++,b=P+1;else if(x.startsWith("@endforelse"))k--,b=P+11;else if(k===0&&x.startsWith("@empty")){if(I.length<=P+6||!/[a-z]/i.test(I[P+6])){S=P;break}b=P+1}else b=P+1}if(S===-1)continue;return{start:B,end:E,arrayExpr:F,itemVar:L,foreachContent:I.substring(0,S),emptyContent:I.substring(S+6)}}return null}function cW($,Z){let Y=$;while(!0){let X=KN(Y);if(!X)break;let{start:J,end:Q,arrayExpr:G,itemVar:K,foreachContent:W,emptyContent:_}=X;try{let B;if(B0(G))B=j0(G,Object.keys(Z))(...Object.values(Z));else B=L0(G,Z);let U;if(!Array.isArray(B)||B.length===0)U=_;else U=`@foreach (${G} as ${K})${W}@endforeach`;Y=Y.substring(0,J)+U+Y.substring(Q)}catch(B){let U=B instanceof Error?B.message:String(B),z=$0("Forelse",`Error in @forelse(${G} as ${K}): ${U}`,o.EVALUATION_ERROR);Y=Y.substring(0,J)+z+Y.substring(Q)}}return Y}function r3($,Z,Y,X){let J=$;J=cW(J,Z);function Q(W){let _=/@foreach\s*\(/g,B;while((B=_.exec(W))!==null){let U=B.index,z=B.index+B[0].length-1,q=1,j=z+1,H=-1;while(j<W.length&&q>0){if(W[j]==="(")q++;else if(W[j]===")"){if(q--,q===0){H=j;break}}j++}if(H===-1)continue;let O=W.substring(z+1,H),F=O.indexOf(" as ");if(F===-1)continue;let L=U,V=O.substring(0,F),A=O.substring(F+4),N=H+1,w=1,M=N,T=/@foreach\s*\(/g,I=/@endforeach/g;while(w>0&&M<W.length){T.lastIndex=M,I.lastIndex=M;let E=T.exec(W),S=I.exec(W);if(!S)break;if(E&&E.index<S.index)w++,M=E.index+E[0].length;else{if(w--,w===0){let k=W.substring(N,S.index),b=S.index+11;return{start:L,end:b,arrayExpr:V,itemVar:A,content:k}}M=S.index+11}}}return null}function G(W,_){let B=W;while(!0){let U=Q(B);if(!U)break;let{start:z,end:q,arrayExpr:j,itemVar:H,content:O}=U;try{let F=j.trim(),L;if(B0(F))L=j0(F,Object.keys(_))(...Object.values(_));else L=L0(F,_);let V=!1;if(!Array.isArray(L))if(L instanceof Map)L=Array.from(L),V=!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),V=!0;else{let E=$0("Foreach",`Error in @foreach: ${F} is not iterable`,o.TYPE_ERROR);B=B.substring(0,z)+E+B.substring(q);continue}let A=X?.loops?.useAltLoopVariable??YN,N=H.trim(),w=null,M;if(N.includes("=>")){let E=N.split("=>").map((S)=>S.trim());if(E.length===2)w=E[0],M=E[1];else M=N}else M=N;let T="",I=L;for(let E=0;E<I.length;E++){let S=I[E],k={index:E,iteration:E+1,first:E===0,last:E===I.length-1,count:I.length},b={..._,loop:k,$loop:k};if(M.startsWith("[")&&M.endsWith("]")){let f=M.slice(1,-1).split(",").map((g)=>g.trim());if(Array.isArray(S))f.forEach((g,h)=>{if(g)b[g]=S[h]});else b[M]=S}else b[M]=S;if(w)if(V&&Array.isArray(S)&&S.length===2)b[w]=S[0],b[M]=S[1];else b[w]=E;let P=QN(O,b),x=pW(P);if(x.hasContinue){T+=x.content;continue}let C=mW(P);if(C.hasBreak){T+=C.content;break}if(P=cW(P,b),P=G(P,b),P=u5(P,b,Y),P=GN(P),C=mW(P),C.hasBreak){T+=C.content;break}if(x=pW(P),x.hasContinue){T+=x.content;continue}P=q1(P,b,Y),P=JN(P,b),P=XN(P,b),T+=P}B=B.substring(0,z)+T+B.substring(q)}catch(F){let L=$0("Foreach",`Error in @foreach(${j.trim()} as ${H.trim()}): ${F instanceof Error?F.message:String(F)}`,o.EVALUATION_ERROR);B=B.substring(0,z)+L+B.substring(q)}}return B}J=G(J,Z),J=WN(J,Z);let K=X?.loops?.maxWhileIterations??ZN;return J=_N(J,Z,K),J}function iW($){return D6($)}function WN($,Z){let Y=$,X=!0;while(X){X=!1;let J=Y.match(/@for\s*\(/);if(!J||J.index===void 0)break;let Q=J.index,G=Q+J[0].length-1,K=b0(Y,"(",")",G);if(K===-1)break;let W=Y.slice(G+1,K),_=K+1,B=J4(Y.slice(Q),"for","endfor");if(B.length===0)break;let U=B[0].content,z=Q+B[0].end;if(!iW(W)){let q=$0("For",`Unsafe expression in @for: ${W}`,o.UNSAFE_EXPRESSION);Y=Y.substring(0,Q)+q+Y.substring(z),X=!0;continue}try{let q=Object.keys(Z),j=Object.values(Z),H=U.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(L,V)=>{return`\${${V}}`});H=lW(H);let F=Function(...q,`
3891
+ `)();Object.entries(K).forEach(([W,_])=>{if(_!==void 0&&!(W in Z))Z[W]=_})}catch{}}function nX($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1]:"",X=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Y,templateWithoutScript:X}}function sX($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var V$=D(()=>{L$();x$()});var nW={};Q0(nW,{processLoops:()=>r3});function XN($,Z){let Y=/@component\s*\(/g,X=$,J,Q=[];while((J=Y.exec(X))!==null){let G=J.index,K=G+J[0].length-1,W=1,_=K+1;while(_<X.length&&W>0){if(X[_]==="(")W++;else if(X[_]===")"){if(W--,W===0)break}_++}if(W!==0)continue;let B=X.substring(K+1,_),U=_+1,z=B.match(/^\s*['"]([^'"]+)['"]/);if(!z)continue;let q=z[1],j=B.slice(z[0].length),H=j.match(/^\s*,\s*/);if(!H)continue;let O=j.slice(H[0].length).trim();if(!O)continue;try{let F=k0(O,Z),L=JSON.stringify(F),V=`@component('${q}', ${L})`;Q.push({start:G,end:U,replacement:V})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:_}=Q[G];X=X.substring(0,K)+_+X.substring(W)}return X}function i3($,Z,Y){let X=$,J=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=J.exec(X))!==null){let G=Q.index,K=G+Q[0].length-1,W=1,_=K+1,B=null,U=!1;while(_<X.length&&W>0){let j=X[_];if(U){U=!1,_++;continue}if(j==="\\"&&B){U=!0,_++;continue}if(B){if(j===B)B=null;_++;continue}if(j==='"'||j==="'"||j==="`"){B=j,_++;continue}if(j==="(")W++;else if(j===")"){if(W--,W===0)break}_++}if(W!==0)break;let z=X.substring(K+1,_),q=Y(z);X=X.substring(0,G)+q+X.substring(_+1)}return X}function JN($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,J)=>{if(J in Z)return`:${J}="${J}"`;return X}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,J,Q)=>{try{let G=Object.keys(Z),K=Object.values(Z);D7(Q);let _=j0(Q,G)(...K),U=JSON.stringify(_).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return`__stx_${J}="${U}"`}catch(G){return X}}),Y}function QN($,Z){let Y=$;return Y=i3(Y,"@break",(X)=>{try{let Q=`!!(${X.trim()})`,G;if(B0(Q)){let K=j0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(L0(Q,Z));return G?n3:""}catch{return""}}),Y=i3(Y,"@continue",(X)=>{try{let Q=`!!(${X.trim()})`,G;if(B0(Q)){let K=j0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(L0(Q,Z));return G?s3:""}catch{return""}}),Y}function GN($){let Z=$;return Z=Z.replace(/@break(?!\()/g,n3),Z=Z.replace(/@continue(?!\()/g,s3),Z}function mW($){let Z=$.includes(n3),Y=Z?$.substring(0,$.indexOf(n3)):$;return{hasBreak:Z,content:Y}}function pW($){let Z=$.includes(s3),Y=Z?$.substring(0,$.indexOf(s3)):$;return{hasContinue:Z,content:Y}}function lW($){let Z=$;return Z=i3(Z,"@break",(Y)=>{let X=Y.trim();if(!D6(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=i3(Z,"@continue",(Y)=>{let X=Y.trim();if(!D6(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function KN($){let Z=/@forelse\s*\(/g,Y,X=[],J=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=J.exec($))!==null)X.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)X.push({pos:G.index,delta:-1});X.sort((B,U)=>B.pos-U.pos);let K=[],W=0;for(let B of X)W+=B.delta,K.push({pos:B.pos,depth:W});function _(B){let U=0,z=K.length-1,q=0;while(U<=z){let j=U+z>>1;if(K[j].pos<=B)q=K[j].depth,U=j+1;else z=j-1}return q}while((Y=Z.exec($))!==null){if(_(Y.index)>0)continue;let B=Y.index,U=Y.index+Y[0].length-1,z=1,q=U+1,j=-1;while(q<$.length&&z>0){if($[q]==="(")z++;else if($[q]===")"){if(z--,z===0){j=q;break}}q++}if(j===-1)continue;let H=$.substring(U+1,j),O=H.indexOf(" as ");if(O===-1)continue;let F=H.substring(0,O).trim(),L=H.substring(O+4).trim(),V=j+1,A=1,N=V,w=/@forelse\s*\(/g,M=/@endforelse/g,T=-1;while(A>0&&N<$.length){w.lastIndex=N,M.lastIndex=N;let P=w.exec($),x=M.exec($);if(!x)break;if(P&&P.index<x.index)A++,N=P.index+P[0].length;else{if(A--,A===0){T=x.index;break}N=x.index+11}}if(T===-1)continue;let I=$.substring(V,T),E=T+11,S=-1,k=0,b=0;while(b<I.length){let P=I.indexOf("@",b);if(P===-1)break;let x=I.substring(P);if(/^@forelse\s*\(/.test(x))k++,b=P+1;else if(x.startsWith("@endforelse"))k--,b=P+11;else if(k===0&&x.startsWith("@empty")){if(I.length<=P+6||!/[a-z]/i.test(I[P+6])){S=P;break}b=P+1}else b=P+1}if(S===-1)continue;return{start:B,end:E,arrayExpr:F,itemVar:L,foreachContent:I.substring(0,S),emptyContent:I.substring(S+6)}}return null}function cW($,Z){let Y=$;while(!0){let X=KN(Y);if(!X)break;let{start:J,end:Q,arrayExpr:G,itemVar:K,foreachContent:W,emptyContent:_}=X;try{let B;if(B0(G))B=j0(G,Object.keys(Z))(...Object.values(Z));else B=L0(G,Z);let U;if(!Array.isArray(B)||B.length===0)U=_;else U=`@foreach (${G} as ${K})${W}@endforeach`;Y=Y.substring(0,J)+U+Y.substring(Q)}catch(B){let U=B instanceof Error?B.message:String(B),z=$0("Forelse",`Error in @forelse(${G} as ${K}): ${U}`,o.EVALUATION_ERROR);Y=Y.substring(0,J)+z+Y.substring(Q)}}return Y}function r3($,Z,Y,X){let J=$;J=cW(J,Z);function Q(W){let _=/@foreach\s*\(/g,B;while((B=_.exec(W))!==null){let U=B.index,z=B.index+B[0].length-1,q=1,j=z+1,H=-1;while(j<W.length&&q>0){if(W[j]==="(")q++;else if(W[j]===")"){if(q--,q===0){H=j;break}}j++}if(H===-1)continue;let O=W.substring(z+1,H),F=O.indexOf(" as ");if(F===-1)continue;let L=U,V=O.substring(0,F),A=O.substring(F+4),N=H+1,w=1,M=N,T=/@foreach\s*\(/g,I=/@endforeach/g;while(w>0&&M<W.length){T.lastIndex=M,I.lastIndex=M;let E=T.exec(W),S=I.exec(W);if(!S)break;if(E&&E.index<S.index)w++,M=E.index+E[0].length;else{if(w--,w===0){let k=W.substring(N,S.index),b=S.index+11;return{start:L,end:b,arrayExpr:V,itemVar:A,content:k}}M=S.index+11}}}return null}function G(W,_){let B=W;while(!0){let U=Q(B);if(!U)break;let{start:z,end:q,arrayExpr:j,itemVar:H,content:O}=U;try{let F=j.trim(),L;if(B0(F))L=j0(F,Object.keys(_))(...Object.values(_));else L=L0(F,_);let V=!1;if(!Array.isArray(L))if(L instanceof Map)L=Array.from(L),V=!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),V=!0;else{let E=$0("Foreach",`Error in @foreach: ${F} is not iterable`,o.TYPE_ERROR);B=B.substring(0,z)+E+B.substring(q);continue}let A=X?.loops?.useAltLoopVariable??YN,N=H.trim(),w=null,M;if(N.includes("=>")){let E=N.split("=>").map((S)=>S.trim());if(E.length===2)w=E[0],M=E[1];else M=N}else M=N;let T="",I=L;for(let E=0;E<I.length;E++){let S=I[E],k={index:E,iteration:E+1,first:E===0,last:E===I.length-1,count:I.length},b={..._,loop:k,$loop:k};if(M.startsWith("[")&&M.endsWith("]")){let f=M.slice(1,-1).split(",").map((g)=>g.trim());if(Array.isArray(S))f.forEach((g,h)=>{if(g)b[g]=S[h]});else b[M]=S}else b[M]=S;if(w)if(V&&Array.isArray(S)&&S.length===2)b[w]=S[0],b[M]=S[1];else b[w]=E;let P=QN(O,b),x=pW(P);if(x.hasContinue){T+=x.content;continue}let C=mW(P);if(C.hasBreak){T+=C.content;break}if(P=cW(P,b),P=G(P,b),P=u5(P,b,Y),P=GN(P),C=mW(P),C.hasBreak){T+=C.content;break}if(x=pW(P),x.hasContinue){T+=x.content;continue}P=q1(P,b,Y),P=JN(P,b),P=XN(P,b),T+=P}B=B.substring(0,z)+T+B.substring(q)}catch(F){let L=$0("Foreach",`Error in @foreach(${j.trim()} as ${H.trim()}): ${F instanceof Error?F.message:String(F)}`,o.EVALUATION_ERROR);B=B.substring(0,z)+L+B.substring(q)}}return B}J=G(J,Z),J=WN(J,Z);let K=X?.loops?.maxWhileIterations??ZN;return J=_N(J,Z,K),J}function iW($){return D6($)}function WN($,Z){let Y=$,X=!0;while(X){X=!1;let J=Y.match(/@for\s*\(/);if(!J||J.index===void 0)break;let Q=J.index,G=Q+J[0].length-1,K=b0(Y,"(",")",G);if(K===-1)break;let W=Y.slice(G+1,K),_=K+1,B=J4(Y.slice(Q),"for","endfor");if(B.length===0)break;let U=B[0].content,z=Q+B[0].end;if(!iW(W)){let q=$0("For",`Unsafe expression in @for: ${W}`,o.UNSAFE_EXPRESSION);Y=Y.substring(0,Q)+q+Y.substring(z),X=!0;continue}try{let q=Object.keys(Z),j=Object.values(Z),H=U.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(L,V)=>{return`\${${V}}`});H=lW(H);let F=Function(...q,`
3892
3892
  let result = '';
3893
3893
  for (${W}) {
3894
3894
  result += \`${H}\`;
@@ -3906,7 +3906,7 @@ ${G}`,J++}return{functionCode:X,nextIndex:J}}async function $N($,Z,Y){let X=$.ma
3906
3906
  result += '<!-- [While Error [1104]]: Maximum iterations (${Y}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
3907
3907
  }
3908
3908
  return result;
3909
- `)(...j);X=X.substring(0,G)+F+X.substring(z),J=!0}catch(q){let j=$0("While",`Error in @while(${_}): ${q instanceof Error?q.message:String(q)}`,o.EVALUATION_ERROR);X=X.substring(0,G)+j+X.substring(z),J=!0}}return X}var ZN=1000,YN=!1,n3="<!--__STX_BREAK__-->",s3="<!--__STX_CONTINUE__-->";var o3=D(()=>{C3();X1();d0();b3();h0()});import N0 from"path";function oX($,Z){let Y=0;for(let X=Z;X<$.length;X++){let J=$[X];if(J==="("||J==="["||J==="{")Y++;else if(J===")"||J==="]"||J==="}")Y--;else if(J===","&&Y===0)return X}return-1}function BN($,Z,Y){let X=$,J=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Q=J.exec(X);while(Q){let G=Q.index,K=G+Q[0].length-1,W=1,_=K+1;while(_<X.length&&W>0){if(X[_]==="(")W++;else if(X[_]===")")W--;_++}if(W!==0)break;let B=X.substring(K+1,_-1),U=`${Y}(${B})`;X=X.substring(0,G)+U+X.substring(_),J.lastIndex=G+U.length,Q=J.exec(X)}return X}function UN($){return/\b(state|derived|effect)\s*\(/.test($)}function zN($){let Z=$,Y=[],X=new Set,J=0,Q=0,G=Z.length,K=(U)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===U){Q++;return}Q++}},W=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let U=1;while(Q<G&&U>0)if(Z[Q]==="{")U++;else if(Z[Q]==="}")U--;else if(Z[Q]==="'"||Z[Q]==='"')K(Z[Q]);else if(Z[Q]==="`")W();else Q++;continue}Q++}},_=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
3909
+ `)(...j);X=X.substring(0,G)+F+X.substring(z),J=!0}catch(q){let j=$0("While",`Error in @while(${_}): ${q instanceof Error?q.message:String(q)}`,o.EVALUATION_ERROR);X=X.substring(0,G)+j+X.substring(z),J=!0}}return X}var ZN=1000,YN=!1,n3="<!--__STX_BREAK__-->",s3="<!--__STX_CONTINUE__-->";var o3=D(()=>{C3();X1();d0();b3();h0()});import N0 from"path";function rX($,Z){let Y=0;for(let X=Z;X<$.length;X++){let J=$[X];if(J==="("||J==="["||J==="{")Y++;else if(J===")"||J==="]"||J==="}")Y--;else if(J===","&&Y===0)return X}return-1}function BN($,Z,Y){let X=$,J=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Q=J.exec(X);while(Q){let G=Q.index,K=G+Q[0].length-1,W=1,_=K+1;while(_<X.length&&W>0){if(X[_]==="(")W++;else if(X[_]===")")W--;_++}if(W!==0)break;let B=X.substring(K+1,_-1),U=`${Y}(${B})`;X=X.substring(0,G)+U+X.substring(_),J.lastIndex=G+U.length,Q=J.exec(X)}return X}function UN($){return/\b(state|derived|effect)\s*\(/.test($)}function zN($){let Z=$,Y=[],X=new Set,J=0,Q=0,G=Z.length,K=(U)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===U){Q++;return}Q++}},W=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let U=1;while(Q<G&&U>0)if(Z[Q]==="{")U++;else if(Z[Q]==="}")U--;else if(Z[Q]==="'"||Z[Q]==='"')K(Z[Q]);else if(Z[Q]==="`")W();else Q++;continue}Q++}},_=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
3910
3910
  `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},B=()=>{if(J!==0)return;let U=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let j=U[2];if(!X.has(j))Y.push(j),X.add(j);return}let z=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let j=z[1];if(!X.has(j))Y.push(j),X.add(j);return}let q=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(q){let j=q[1];if(!X.has(j))Y.push(j),X.add(j)}};while(Q<G){if(_())continue;if(Z[Q]==="'"||Z[Q]==='"'){K(Z[Q]);continue}if(Z[Q]==="`"){W();continue}if(Z[Q]==="{"){J++,Q++;continue}if(Z[Q]==="}"){J--,Q++;continue}if(J===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))B();Q++}return Y.join(", ")}function qN($,Z){let Y=zN($);return`
3911
3911
  (function() {
3912
3912
  var { state, derived, effect, batch, onMount, onDestroy, useFetch, useRef, useQuery, useMutation, useDebounce, useDebouncedValue, useThrottle, useInterval, useTimeout, useToggle, useCounter, useClickOutside, useFocus, useAsync, useLocalStorage, useEventListener, useWebSocket, useColorMode, useDark, useHead, useSeoMeta, useRoute, useSearchParams, navigate, goBack, goForward, provide, ref, reactive, computed, watch, watchEffect } = window.stx;
@@ -3920,28 +3920,28 @@ ${$}
3920
3920
  if (!window.stx._scopes) window.stx._scopes = {};
3921
3921
  window.stx._scopes['${Z}'] = { ${Y}, __destroyCallbacks: __destroyHooks };
3922
3922
  })();
3923
- `}function jN($,Z){let Y=$.match(/^(\s*(?:<!--[\s\S]*?-->\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Y){let J=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(J)return{html:$,mergedIntoExisting:J[1]};let Q=Y[1],G=Y[2],K=Y[3];return{html:`${Q}${G} data-stx-scope="${Z}"${K}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function ON(){aX.clear()}function LN($){if($.__onceStore instanceof Set)return $.__onceStore;return aX}async function a3($,Z,Y,X,J,Q=new Set){let G=X.partialsDir||N0.join(N0.dirname(Y),"partials");if(G&&!N0.isAbsolute(G)){let j=N0.resolve(__dirname,"..");G=N0.resolve(j,G)}let K=BN($,"@partial","@include"),W=LN(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(j,H,O)=>{let F=H.trim(),L=`${Y}:${F}`;if(W.has(L))return"";return W.add(L),H});{let j=/@includeIf\s*\(/g,H;while((H=j.exec(K))!==null){let O=H.index,F=O+H[0].length-1,L=1,V=F+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")")L--;V++}if(L!==0)break;let A=K.substring(F+1,V-1),N=A.match(/^\s*['"]([^'"]+)['"]/);if(!N){j.lastIndex=V;continue}let w=N[1],M=_(w,G,Y),T="";if(M&&await Bun.file(M).exists())J.add(M),T=`@include(${A})`;K=K.substring(0,O)+T+K.substring(V),j.lastIndex=0}}for(let[j,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=O.exec(K))!==null){let L=F.index,V=L+F[0].length-1,A=1,N=V+1;while(N<K.length&&A>0){if(K[N]==="(")A++;else if(K[N]===")")A--;N++}if(A!==0)break;let w=K.substring(V+1,N-1),M=oX(w,0);if(M===-1){O.lastIndex=N;continue}let T=w.substring(0,M).trim(),I=w.substring(M+1).trim(),E=I.match(/^\s*['"]([^'"]+)['"]/);if(!E){O.lastIndex=N;continue}let S=E[1],k=I.substring(E[0].length),b,P=oX(k,0);if(P!==-1)b=k.substring(P+1).trim();try{let x=`Boolean(${T})`,C;if(B0(x)){let h=j0(x,Object.keys(Z));C=Boolean(h(...Object.values(Z)))}else C=Boolean(L0(x,Z));let f=H?!C:C,g="";if(f){let h=_(S,G,Y);if(h&&await Bun.file(h).exists())J.add(h);g=`@include('${S}'${b?`, ${b}`:""})`}K=K.substring(0,L)+g+K.substring(N),O.lastIndex=0}catch(x){let C=x instanceof Error?x.message:String(x),f=U0("Include",`Error evaluating ${j} condition: ${C}`,Y,$,L);K=K.substring(0,L)+f+K.substring(N),O.lastIndex=0}}}{let j=/@each\s*\(/g,H;while((H=j.exec(K))!==null){let O=H.index,F=O+H[0].length-1,L=1,V=F+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")"){if(L--,L===0)break}V++}if(L!==0)break;let A=K.substring(F+1,V),N=K.substring(O,V+1),w=A.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!w){j.lastIndex=0,K=K.replace(N,"");continue}let[,M,T,I,E]=w;try{let S,k=T.trim();if(B0(k))S=j0(k,Object.keys(Z))(...Object.values(Z));else S=L0(k,Z);let b="";if(Array.isArray(S)&&S.length>0)for(let P of S){let x={...Z,[I]:P},C=await U(M,x,$,O);b+=C}else if(E)b=await U(E,{},$,O);K=K.substring(0,O)+b+K.substring(V+1),j.lastIndex=0}catch(S){let k=S instanceof Error?S.message:String(S);K=K.substring(0,O)+U0("Each",`Error in @each: ${k}`,Y,$,O)+K.substring(V+1),j.lastIndex=0}}}{let j=/@includeFirst\s*\(/g,H;while((H=j.exec(K))!==null){let O=H.index,F=O+H[0].length-1,L=1,V=F+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")"){if(L--,L===0)break}V++}if(L!==0)break;let A=K.substring(F+1,V),N=K.substring(O,V+1),w=A.match(/^\s*(\[[^\]]+\])/);if(!w){j.lastIndex=0,K=K.replace(N,"");continue}let M=w[1],T=A.slice(w[0].length),I,E=T.match(/^\s*,\s*\{/);if(E){T=T.slice(E[0].length-1);let b=1,P=1;while(P<T.length&&b>0){if(T[P]==="{")b++;else if(T[P]==="}"){if(b--,b===0)break}P++}I=T.substring(0,P+1),T=T.slice(P+1)}let S,k=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(k)S=k[1];try{let b=JSON.parse(M.replace(/'/g,'"')),P={};if(I)try{P=k0(I,Z)}catch(C){let f=C instanceof Error?C.message:String(C);if(X.debug){let g=U0("Include",`Error parsing includeFirst variables: ${f}`,Y,$,O,N);K=K.replace(N,()=>g)}else K=K.replace(N,()=>S||"");continue}let x=!1;for(let C of b){let f=_(C,G,Y);if(!f)continue;if(await t(f)){let g=await U(C,P,$,O);K=K.replace(N,()=>g),x=!0;break}}if(!x)if(S!==void 0)K=K.replace(N,()=>S);else if(X.debug){let C=U0("Include",`None of the includeFirst paths exist: ${M}`,Y,$,O,N);K=K.replace(N,()=>C)}else K=K.replace(N,"")}catch(b){let P=b instanceof Error?b.message:String(b),x=U0("Include",`Error processing @includeFirst: ${P}`,Y,$,O,N);K=K.replace(N,()=>x)}j.lastIndex=0}}function _(j,H,O){try{let F=j;if(!j.endsWith(".stx"))F=`${j}.stx`;let L=N0.resolve(H),V=N0.resolve(N0.dirname(O)),A;if(!F.startsWith("./")&&!F.startsWith("../"))A=N0.resolve(H,F);else A=N0.resolve(V,F);let N=N0.normalize(A),w=N.startsWith(L+N0.sep)||N===L,M=N.startsWith(V+N0.sep)||N===V,T=!1,I=N0.dirname(V);if(N.startsWith(I+N0.sep)){if(!N0.relative(I,N).split(N0.sep).some((b)=>b.startsWith(".")&&b!=="."&&b!==".."))T=!0}if(!w&&!M&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${j}`),console.error(` Resolved to: ${N}`),console.error(` Allowed dirs: ${L}, ${V}`),null;return N}catch(F){return console.error(`Error resolving path ${j}: ${F}`),null}}let B=N0.resolve(Y);Q.add(B);async function U(j,H={},O,F){let L=_(j,G,Y);if(!L)return U0("Include",`Could not resolve path for include: ${j}`,Y,O,F);let V=N0.resolve(L);if(Q.has(V)){let A=[...Q,V].map((N)=>N0.basename(N)).join(" -> ");return U0("Include",`Circular include detected: ${A}`,Y,O,F)}try{J.add(L);let A;if(!A)try{A=await Bun.file(L).text()}catch(C){let f=C instanceof Error?C.message:String(C);return U0("Include",`Error loading include file ${j}: ${f}`,Y,O,F)}let N=A,w=N.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(w)N=w[1].trim();let M=A.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),T="";if(M)T=`<style${M[1]}>${M[2]}</style>`;N=N.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),N=N.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};for(let[C,f]of Object.entries(H))I[C]=f;let E=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...A.matchAll(E)],k="",b=null;for(let C of S){let f=C[1]||"",g=C[2]||"",h=f.includes("server");if(Y$(f)&&g.trim())g=X$(g);let i=UN(g);if(i&&!h){b=`stx_scope_${N0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++HN}`;let Y0=Z$(g),W0=qN(Y0,b);k+=`<script data-stx-scoped>${W0}</script>
3924
- `;continue}if(h)try{let{extractVariables:Y0}=await Promise.resolve().then(() => (F$(),l3));await Y0(g,I,L)}catch(Y0){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,Y0)}if(!h&&!i){let Y0=f.replace(/\bclient\b/i,"").trim();k+=`<script data-stx-scoped${Y0?` ${Y0}`:""}>${g}</script>
3923
+ `}function jN($,Z){let Y=$.match(/^(\s*(?:<!--[\s\S]*?-->\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Y){let J=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(J)return{html:$,mergedIntoExisting:J[1]};let Q=Y[1],G=Y[2],K=Y[3];return{html:`${Q}${G} data-stx-scope="${Z}"${K}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function ON(){oX.clear()}function LN($){if($.__onceStore instanceof Set)return $.__onceStore;return oX}async function a3($,Z,Y,X,J,Q=new Set){let G=X.partialsDir||N0.join(N0.dirname(Y),"partials");if(G&&!N0.isAbsolute(G)){let j=N0.resolve(__dirname,"..");G=N0.resolve(j,G)}let K=BN($,"@partial","@include"),W=LN(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(j,H,O)=>{let F=H.trim(),L=`${Y}:${F}`;if(W.has(L))return"";return W.add(L),H});{let j=/@includeIf\s*\(/g,H;while((H=j.exec(K))!==null){let O=H.index,F=O+H[0].length-1,L=1,V=F+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")")L--;V++}if(L!==0)break;let A=K.substring(F+1,V-1),N=A.match(/^\s*['"]([^'"]+)['"]/);if(!N){j.lastIndex=V;continue}let w=N[1],M=_(w,G,Y),T="";if(M&&await Bun.file(M).exists())J.add(M),T=`@include(${A})`;K=K.substring(0,O)+T+K.substring(V),j.lastIndex=0}}for(let[j,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=O.exec(K))!==null){let L=F.index,V=L+F[0].length-1,A=1,N=V+1;while(N<K.length&&A>0){if(K[N]==="(")A++;else if(K[N]===")")A--;N++}if(A!==0)break;let w=K.substring(V+1,N-1),M=rX(w,0);if(M===-1){O.lastIndex=N;continue}let T=w.substring(0,M).trim(),I=w.substring(M+1).trim(),E=I.match(/^\s*['"]([^'"]+)['"]/);if(!E){O.lastIndex=N;continue}let S=E[1],k=I.substring(E[0].length),b,P=rX(k,0);if(P!==-1)b=k.substring(P+1).trim();try{let x=`Boolean(${T})`,C;if(B0(x)){let h=j0(x,Object.keys(Z));C=Boolean(h(...Object.values(Z)))}else C=Boolean(L0(x,Z));let f=H?!C:C,g="";if(f){let h=_(S,G,Y);if(h&&await Bun.file(h).exists())J.add(h);g=`@include('${S}'${b?`, ${b}`:""})`}K=K.substring(0,L)+g+K.substring(N),O.lastIndex=0}catch(x){let C=x instanceof Error?x.message:String(x),f=U0("Include",`Error evaluating ${j} condition: ${C}`,Y,$,L);K=K.substring(0,L)+f+K.substring(N),O.lastIndex=0}}}{let j=/@each\s*\(/g,H;while((H=j.exec(K))!==null){let O=H.index,F=O+H[0].length-1,L=1,V=F+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")"){if(L--,L===0)break}V++}if(L!==0)break;let A=K.substring(F+1,V),N=K.substring(O,V+1),w=A.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!w){j.lastIndex=0,K=K.replace(N,"");continue}let[,M,T,I,E]=w;try{let S,k=T.trim();if(B0(k))S=j0(k,Object.keys(Z))(...Object.values(Z));else S=L0(k,Z);let b="";if(Array.isArray(S)&&S.length>0)for(let P of S){let x={...Z,[I]:P},C=await U(M,x,$,O);b+=C}else if(E)b=await U(E,{},$,O);K=K.substring(0,O)+b+K.substring(V+1),j.lastIndex=0}catch(S){let k=S instanceof Error?S.message:String(S);K=K.substring(0,O)+U0("Each",`Error in @each: ${k}`,Y,$,O)+K.substring(V+1),j.lastIndex=0}}}{let j=/@includeFirst\s*\(/g,H;while((H=j.exec(K))!==null){let O=H.index,F=O+H[0].length-1,L=1,V=F+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")"){if(L--,L===0)break}V++}if(L!==0)break;let A=K.substring(F+1,V),N=K.substring(O,V+1),w=A.match(/^\s*(\[[^\]]+\])/);if(!w){j.lastIndex=0,K=K.replace(N,"");continue}let M=w[1],T=A.slice(w[0].length),I,E=T.match(/^\s*,\s*\{/);if(E){T=T.slice(E[0].length-1);let b=1,P=1;while(P<T.length&&b>0){if(T[P]==="{")b++;else if(T[P]==="}"){if(b--,b===0)break}P++}I=T.substring(0,P+1),T=T.slice(P+1)}let S,k=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(k)S=k[1];try{let b=JSON.parse(M.replace(/'/g,'"')),P={};if(I)try{P=k0(I,Z)}catch(C){let f=C instanceof Error?C.message:String(C);if(X.debug){let g=U0("Include",`Error parsing includeFirst variables: ${f}`,Y,$,O,N);K=K.replace(N,()=>g)}else K=K.replace(N,()=>S||"");continue}let x=!1;for(let C of b){let f=_(C,G,Y);if(!f)continue;if(await t(f)){let g=await U(C,P,$,O);K=K.replace(N,()=>g),x=!0;break}}if(!x)if(S!==void 0)K=K.replace(N,()=>S);else if(X.debug){let C=U0("Include",`None of the includeFirst paths exist: ${M}`,Y,$,O,N);K=K.replace(N,()=>C)}else K=K.replace(N,"")}catch(b){let P=b instanceof Error?b.message:String(b),x=U0("Include",`Error processing @includeFirst: ${P}`,Y,$,O,N);K=K.replace(N,()=>x)}j.lastIndex=0}}function _(j,H,O){try{let F=j;if(!j.endsWith(".stx"))F=`${j}.stx`;let L=N0.resolve(H),V=N0.resolve(N0.dirname(O)),A;if(!F.startsWith("./")&&!F.startsWith("../"))A=N0.resolve(H,F);else A=N0.resolve(V,F);let N=N0.normalize(A),w=N.startsWith(L+N0.sep)||N===L,M=N.startsWith(V+N0.sep)||N===V,T=!1,I=N0.dirname(V);if(N.startsWith(I+N0.sep)){if(!N0.relative(I,N).split(N0.sep).some((b)=>b.startsWith(".")&&b!=="."&&b!==".."))T=!0}if(!w&&!M&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${j}`),console.error(` Resolved to: ${N}`),console.error(` Allowed dirs: ${L}, ${V}`),null;return N}catch(F){return console.error(`Error resolving path ${j}: ${F}`),null}}let B=N0.resolve(Y);Q.add(B);async function U(j,H={},O,F){let L=_(j,G,Y);if(!L)return U0("Include",`Could not resolve path for include: ${j}`,Y,O,F);let V=N0.resolve(L);if(Q.has(V)){let A=[...Q,V].map((N)=>N0.basename(N)).join(" -> ");return U0("Include",`Circular include detected: ${A}`,Y,O,F)}try{J.add(L);let A;if(!A)try{A=await Bun.file(L).text()}catch(C){let f=C instanceof Error?C.message:String(C);return U0("Include",`Error loading include file ${j}: ${f}`,Y,O,F)}let N=A,w=N.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(w)N=w[1].trim();let M=A.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),T="";if(M)T=`<style${M[1]}>${M[2]}</style>`;N=N.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),N=N.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};for(let[C,f]of Object.entries(H))I[C]=f;let E=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...A.matchAll(E)],k="",b=null;for(let C of S){let f=C[1]||"",g=C[2]||"",h=f.includes("server");if(X$(f)&&g.trim())g=J$(g);let i=UN(g);if(i&&!h){b=`stx_scope_${N0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++HN}`;let Y0=Y$(g),W0=qN(Y0,b);k+=`<script data-stx-scoped>${W0}</script>
3924
+ `;continue}if(h)try{let{extractVariables:Y0}=await Promise.resolve().then(() => (V$(),l3));await Y0(g,I,L)}catch(Y0){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,Y0)}if(!h&&!i){let Y0=f.replace(/\bclient\b/i,"").trim();k+=`<script data-stx-scoped${Y0?` ${Y0}`:""}>${g}</script>
3925
3925
  `}}if(b){let C=jN(N,b);if(N=C.html,C.mergedIntoExisting)k=k.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${C.mergedIntoExisting}']`),b=C.mergedIntoExisting}if(N.includes("@include")||N.includes("@partial"))N=await a3(N,I,L,X,J,Q);let{processLoops:P}=await Promise.resolve().then(() => (o3(),nW)),x=P(N,I,L);if(x=u5(x,I,L),x=q1(x,I,L),T)x+=`
3926
3926
  `+T;if(k)x+=`
3927
- `+k;return x}catch(A){let N=A instanceof Error?A.message:String(A);return U0("Include",`Error processing include ${j}: ${N}`,Y,O,F)}}let z=/@include\s*\(/g,q;while((q=z.exec(K))!==null){let j=q.index,H=j+q[0].length-1,O=1,F=H+1;while(F<K.length&&O>0){if(K[F]==="(")O++;else if(K[F]===")")O--;F++}if(O!==0)break;let L=K.substring(j,F),V=K.substring(H+1,F-1),A=V.match(/^\s*['"]([^'"]+)['"]/);if(!A){z.lastIndex=F;continue}let N=A[1],w,M=V.substring(A[0].length),T=oX(M,0);if(T!==-1)w=M.substring(T+1).trim();let I={};if(w)try{I=k0(w,Z)}catch(S){let k=S instanceof Error?S.message:String(S);K=K.replace(L,U0("Include",`Error parsing include variables for ${N}: ${k}`,Y,$,j)),z.lastIndex=0;continue}let E=await U(N,I,$,j);K=K.substring(0,j)+E+K.substring(F),z.lastIndex=0}return K}function t3($,Z){let Y=$;function X(J,Q,G,K){let W=J,_=!0;while(_){_=!1;let B=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),U=W.match(B);if(!U||U.index===void 0)break;let z=U.index,q=U[1],j=z+U[0].length,H=new RegExp(`@${Q}\\(`),O=new RegExp(`@${G}(?![a-z])`),F=1,L=j,V=-1;while(F>0&&L<W.length){let N=W.slice(L),w=N.match(H),M=N.match(O),T=w?L+w.index:1/0,I=M?L+M.index:1/0;if(T<I)F++,L=T+(w[0].length||1);else if(I<1/0){if(F--,F===0){V=I;break}L=I+G.length+1}else break}if(V===-1)break;let A=W.slice(j,V);if(!Z[q])Z[q]=[];if(K)Z[q].unshift(A);else Z[q].push(A);W=W.substring(0,z)+W.substring(V+`@${G}`.length),_=!0}return W}return Y=X(Y,"push","endpush",!1),Y=X(Y,"prepend","endprepend",!0),Y}function e3($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
3928
- `)})}var __dirname="/home/runner/work/stx/stx/packages/stx/src",HN=0,V$,aX;var c5=D(()=>{C3();d0();g$();h0();q0();V$=new P7(500),aX=new Set});import*as tX from"path";async function sW($,Z,Y=""){if(tX.basename(Y)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return oW($,Z,Y,"@js","@endjs")}async function rW($,Z,Y=""){if(tX.basename(Y)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((Q)=>({...Q,displayName:`User ${Q.id}: ${Q.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return oW($,Z,Y,"@ts","@endts")}async function oW($,Z,Y,X,J){let Q=$,G=B5(`${X}([\\s\\S]*?)${J}`,"g"),K=[],W;while((W=G.exec($))!==null)K.push({fullMatch:W[0],content:W[1]||"",index:W.index});for(let{fullMatch:_,content:B,index:U}of K)try{let z=Object.keys(Z),q=Object.values(Z),j=B.trim();if(X==="@ts")j=j.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let O=(j.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((N)=>N.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=O.length>0?`return { ${O.join(", ")} };`:"return {};",L=`
3927
+ `+k;return x}catch(A){let N=A instanceof Error?A.message:String(A);return U0("Include",`Error processing include ${j}: ${N}`,Y,O,F)}}let z=/@include\s*\(/g,q;while((q=z.exec(K))!==null){let j=q.index,H=j+q[0].length-1,O=1,F=H+1;while(F<K.length&&O>0){if(K[F]==="(")O++;else if(K[F]===")")O--;F++}if(O!==0)break;let L=K.substring(j,F),V=K.substring(H+1,F-1),A=V.match(/^\s*['"]([^'"]+)['"]/);if(!A){z.lastIndex=F;continue}let N=A[1],w,M=V.substring(A[0].length),T=rX(M,0);if(T!==-1)w=M.substring(T+1).trim();let I={};if(w)try{I=k0(w,Z)}catch(S){let k=S instanceof Error?S.message:String(S);K=K.replace(L,U0("Include",`Error parsing include variables for ${N}: ${k}`,Y,$,j)),z.lastIndex=0;continue}let E=await U(N,I,$,j);K=K.substring(0,j)+E+K.substring(F),z.lastIndex=0}return K}function t3($,Z){let Y=$;function X(J,Q,G,K){let W=J,_=!0;while(_){_=!1;let B=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),U=W.match(B);if(!U||U.index===void 0)break;let z=U.index,q=U[1],j=z+U[0].length,H=new RegExp(`@${Q}\\(`),O=new RegExp(`@${G}(?![a-z])`),F=1,L=j,V=-1;while(F>0&&L<W.length){let N=W.slice(L),w=N.match(H),M=N.match(O),T=w?L+w.index:1/0,I=M?L+M.index:1/0;if(T<I)F++,L=T+(w[0].length||1);else if(I<1/0){if(F--,F===0){V=I;break}L=I+G.length+1}else break}if(V===-1)break;let A=W.slice(j,V);if(!Z[q])Z[q]=[];if(K)Z[q].unshift(A);else Z[q].push(A);W=W.substring(0,z)+W.substring(V+`@${G}`.length),_=!0}return W}return Y=X(Y,"push","endpush",!1),Y=X(Y,"prepend","endprepend",!0),Y}function e3($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
3928
+ `)})}var __dirname="/home/runner/work/stx/stx/packages/stx/src",HN=0,N$,oX;var c5=D(()=>{C3();d0();g$();h0();q0();N$=new P7(500),oX=new Set});import*as aX from"path";async function sW($,Z,Y=""){if(aX.basename(Y)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return oW($,Z,Y,"@js","@endjs")}async function rW($,Z,Y=""){if(aX.basename(Y)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((Q)=>({...Q,displayName:`User ${Q.id}: ${Q.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return oW($,Z,Y,"@ts","@endts")}async function oW($,Z,Y,X,J){let Q=$,G=B5(`${X}([\\s\\S]*?)${J}`,"g"),K=[],W;while((W=G.exec($))!==null)K.push({fullMatch:W[0],content:W[1]||"",index:W.index});for(let{fullMatch:_,content:B,index:U}of K)try{let z=Object.keys(Z),q=Object.values(Z),j=B.trim();if(X==="@ts")j=j.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let O=(j.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((N)=>N.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=O.length>0?`return { ${O.join(", ")} };`:"return {};",L=`
3929
3929
  ${j}
3930
3930
  ${F}
3931
- `,A=Function(...z,L)(...q);if(A&&typeof A==="object")Object.assign(Z,A);Q=Q.replace(_,"")}catch(z){console.error(`Error executing ${X} code block in ${Y}:`,z);let q=z instanceof Error?z.message:String(z),j=U0(`${X} Directive`,`Error executing code: ${q}`,Y,$,U,_);console.error(j),Q=Q.replace(_,"")}return Q}var aW=D(()=>{g$();q0()});function FN($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function tW($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,X,J,Q)=>{return FN(X,Q||"_method")})}async function eX($,Z,Y,X,J){if(!X.middleware||X.middleware.length===0)return $;let Q=$,G=X.middleware.filter((K)=>K.timing===J);if(G.length===0)return Q;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(X.debug)console.warn("Invalid middleware:",K);continue}try{let W=await K.handler(Q,Z,Y,X);if(typeof W==="string")Q=W;else if(X.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(W){if(X.debug)console.error(`Error in middleware ${K.name}:`,W);if(X.debug){let _=U0("Middleware",`Error in middleware '${K.name}': ${W instanceof Error?W.message:String(W)}`,Y,$);Q=Q.replace(/<body[^>]*>/,`$&
3931
+ `,A=Function(...z,L)(...q);if(A&&typeof A==="object")Object.assign(Z,A);Q=Q.replace(_,"")}catch(z){console.error(`Error executing ${X} code block in ${Y}:`,z);let q=z instanceof Error?z.message:String(z),j=U0(`${X} Directive`,`Error executing code: ${q}`,Y,$,U,_);console.error(j),Q=Q.replace(_,"")}return Q}var aW=D(()=>{g$();q0()});function FN($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function tW($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,X,J,Q)=>{return FN(X,Q||"_method")})}async function tX($,Z,Y,X,J){if(!X.middleware||X.middleware.length===0)return $;let Q=$,G=X.middleware.filter((K)=>K.timing===J);if(G.length===0)return Q;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(X.debug)console.warn("Invalid middleware:",K);continue}try{let W=await K.handler(Q,Z,Y,X);if(typeof W==="string")Q=W;else if(X.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(W){if(X.debug)console.error(`Error in middleware ${K.name}:`,W);if(X.debug){let _=U0("Middleware",`Error in middleware '${K.name}': ${W instanceof Error?W.message:String(W)}`,Y,$);Q=Q.replace(/<body[^>]*>/,`$&
3932
3932
  <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${w0(_)}</div>
3933
- `)}}}return Q}async function $2($,Z,Y,X){return eX($,Z,Y,X,"before")}async function Z2($,Z,Y,X){return eX($,Z,Y,X,"after")}var Y2=D(()=>{d0();q0()});import{defineRoute as QC,defineRoutes as GC,resetRoutes as KC,route as WC,setAppUrl as _C}from"stx-router";import{route as VN}from"stx-router";function eW($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,X,J,Q)=>{try{let G=J?k0(J,{}):{};return VN(X,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var $_=D(()=>{h0()});async function Z_($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(B4.exact[$])for(let X of B4.exact[$])await Promise.resolve(X(Z,$));if(B4.exact[Y])for(let X of B4.exact[Y])await Promise.resolve(X(Z,$));for(let{pattern:X,callback:J}of B4.patterns)if(X.test($)||X.test(Y))await Promise.resolve(J(Z,$))}var B4;var Y_=D(()=>{B4={patterns:[],exact:{}}});function X_($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>X_(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function $8($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,J=[],Q;while((Q=X.exec($))!==null)J.push([Q.index,Q.index+Q[0].length]);function G(_){return J.some(([B,U])=>_>=B&&_<U)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,W=[];while((Q=K.exec(Y))!==null){if(G(Q.index))continue;let _=Q[0],B=Q[2];if(!B||!B.includes(":"))continue;let U=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,z,q=B,j=!1;while((z=U.exec(B))!==null){let H=z[1],O=z[2];if(O.includes("()")&&!O.includes(".get(")||O.includes("$store")||O.includes("$ref"))continue;try{let F=Object.keys(Z),L=Object.values(Z),V=O.match(/^([a-zA-Z_$][\w$]*)/);if(V&&!F.includes(V[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(V[1]))continue;let N=Function(...F,`return (${O})`)(...L);if(H==="class"){let w=X_(N);if(w){let M=q.match(/\sclass="([^"]*)"/);if(M)q=q.replace(M[0],` class="${M[1]} ${w}"`);else q=q.replace(z[0],` class="${w}"`)}else q=q.replace(z[0],"");j=!0;continue}if(NN.has(H)){if(N)q=q.replace(z[0],` ${H}`);else q=q.replace(z[0],"");j=!0;continue}if(N===null||N===void 0||N===!1)q=q.replace(z[0],"");else{let w=String(N).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");q=q.replace(z[0],` ${H}="${w}"`)}j=!0}catch{continue}}if(j){let H=_.endsWith("/>")?" /":"",F=`<${Q[1]}${q}${H}>`;W.push({start:Q.index,end:Q.index+_.length,replacement:F})}}for(let _=W.length-1;_>=0;_--){let{start:B,end:U,replacement:z}=W[_];Y=Y.slice(0,B)+z+Y.slice(U)}return Y}var NN;var X2=D(()=>{NN=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function u$($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let X=Y.exec($);if(!X)return null;return{full:X[0],tag:X[1],attrs:X[2],selfClosing:X[3].includes("/")||AN.has(X[1].toLowerCase()),start:X.index,end:X.index+X[0].length}}function RN($,Z,Y){let X=1,J=Y,Q=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(X>0&&J<$.length){Q.lastIndex=J,G.lastIndex=J;let K=Q.exec($),W=G.exec($);if(!W)return-1;if(K&&K.index<W.index)X++,J=K.index+K[0].length;else{if(X--,X===0)return W.index+W[0].length;J=W.index+W[0].length}}return-1}function I1($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=RN($,Z.tag,Z.end);if(Y===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:Y,innerHTML:$.slice(Z.end,Y-`</${Z.tag}>`.length)}}function J_($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function l5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return X?X[1]:null}function N$($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${Y}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Y}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Y}(?=\\s|$|>|/)`,"g"),"")}function A$($,Z,Y){let X=Z.selfClosing?" /":"",J=`<${Z.tag}${Y}${X}>`;return $.slice(0,Z.start)+J+$.slice(Z.end)}function Q_($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function MN($){let Z=$,Y=0;while(Y<Z.length){let X=u$(Z,Y);if(!X)break;let J=l5(X.attrs,"v-for");if(J===null){Y=X.end;continue}let Q=J.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!Q){Y=X.end;continue}let G=Q[1].trim(),K=Q[2].trim(),W;if(G.includes(",")){let O=G.split(",").map((V)=>V.trim()),F=O[0],L=O[1];W=`${K} as ${L} => ${F}`}else W=`${K} as ${G}`;let _=N$(X.attrs,"v-for"),B=N$(_,":key").replace(/\s*v-bind:key="[^"]*"/g,""),U=I1(Z,X),z=Z.slice(U.outerStart,U.outerEnd),q=A$(z,{...X,start:0,end:X.end-X.start},B),j=`@foreach(${W})
3933
+ `)}}}return Q}async function eX($,Z,Y,X){return tX($,Z,Y,X,"before")}async function $J($,Z,Y,X){return tX($,Z,Y,X,"after")}var ZJ=D(()=>{d0();q0()});import{defineRoute as QC,defineRoutes as GC,resetRoutes as KC,route as WC,setAppUrl as _C}from"stx-router";import{route as VN}from"stx-router";function eW($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,X,J,Q)=>{try{let G=J?k0(J,{}):{};return VN(X,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var $_=D(()=>{h0()});async function Z_($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(B4.exact[$])for(let X of B4.exact[$])await Promise.resolve(X(Z,$));if(B4.exact[Y])for(let X of B4.exact[Y])await Promise.resolve(X(Z,$));for(let{pattern:X,callback:J}of B4.patterns)if(X.test($)||X.test(Y))await Promise.resolve(J(Z,$))}var B4;var Y_=D(()=>{B4={patterns:[],exact:{}}});function X_($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>X_(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function $8($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,J=[],Q;while((Q=X.exec($))!==null)J.push([Q.index,Q.index+Q[0].length]);function G(_){return J.some(([B,U])=>_>=B&&_<U)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,W=[];while((Q=K.exec(Y))!==null){if(G(Q.index))continue;let _=Q[0],B=Q[2];if(!B||!B.includes(":"))continue;let U=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,z,q=B,j=!1;while((z=U.exec(B))!==null){let H=z[1],O=z[2];if(O.includes("()")&&!O.includes(".get(")||O.includes("$store")||O.includes("$ref"))continue;try{let F=Object.keys(Z),L=Object.values(Z),V=O.match(/^([a-zA-Z_$][\w$]*)/);if(V&&!F.includes(V[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(V[1]))continue;let N=Function(...F,`return (${O})`)(...L);if(H==="class"){let w=X_(N);if(w){let M=q.match(/\sclass="([^"]*)"/);if(M)q=q.replace(M[0],` class="${M[1]} ${w}"`);else q=q.replace(z[0],` class="${w}"`)}else q=q.replace(z[0],"");j=!0;continue}if(NN.has(H)){if(N)q=q.replace(z[0],` ${H}`);else q=q.replace(z[0],"");j=!0;continue}if(N===null||N===void 0||N===!1)q=q.replace(z[0],"");else{let w=String(N).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");q=q.replace(z[0],` ${H}="${w}"`)}j=!0}catch{continue}}if(j){let H=_.endsWith("/>")?" /":"",F=`<${Q[1]}${q}${H}>`;W.push({start:Q.index,end:Q.index+_.length,replacement:F})}}for(let _=W.length-1;_>=0;_--){let{start:B,end:U,replacement:z}=W[_];Y=Y.slice(0,B)+z+Y.slice(U)}return Y}var NN;var YJ=D(()=>{NN=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function u$($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let X=Y.exec($);if(!X)return null;return{full:X[0],tag:X[1],attrs:X[2],selfClosing:X[3].includes("/")||AN.has(X[1].toLowerCase()),start:X.index,end:X.index+X[0].length}}function RN($,Z,Y){let X=1,J=Y,Q=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(X>0&&J<$.length){Q.lastIndex=J,G.lastIndex=J;let K=Q.exec($),W=G.exec($);if(!W)return-1;if(K&&K.index<W.index)X++,J=K.index+K[0].length;else{if(X--,X===0)return W.index+W[0].length;J=W.index+W[0].length}}return-1}function I1($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=RN($,Z.tag,Z.end);if(Y===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:Y,innerHTML:$.slice(Z.end,Y-`</${Z.tag}>`.length)}}function J_($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function l5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return X?X[1]:null}function A$($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${Y}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Y}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Y}(?=\\s|$|>|/)`,"g"),"")}function w$($,Z,Y){let X=Z.selfClosing?" /":"",J=`<${Z.tag}${Y}${X}>`;return $.slice(0,Z.start)+J+$.slice(Z.end)}function Q_($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function MN($){let Z=$,Y=0;while(Y<Z.length){let X=u$(Z,Y);if(!X)break;let J=l5(X.attrs,"v-for");if(J===null){Y=X.end;continue}let Q=J.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!Q){Y=X.end;continue}let G=Q[1].trim(),K=Q[2].trim(),W;if(G.includes(",")){let O=G.split(",").map((V)=>V.trim()),F=O[0],L=O[1];W=`${K} as ${L} => ${F}`}else W=`${K} as ${G}`;let _=A$(X.attrs,"v-for"),B=A$(_,":key").replace(/\s*v-bind:key="[^"]*"/g,""),U=I1(Z,X),z=Z.slice(U.outerStart,U.outerEnd),q=w$(z,{...X,start:0,end:X.end-X.start},B),j=`@foreach(${W})
3934
3934
  `,H=`${j}${q}
3935
- @endforeach`;Z=Z.slice(0,U.outerStart)+H+Z.slice(U.outerEnd),Y=U.outerStart+j.length}return Z}function TN($){let Z=$,Y=0;while(Y<Z.length){let X=u$(Z,Y);if(!X)break;let J=l5(X.attrs,"v-if");if(J===null){Y=X.end;continue}let Q=[],G=I1(Z,X),K=N$(X.attrs,"v-if"),W=A$(Z.slice(G.outerStart,G.outerEnd),{...X,start:0,end:X.end-X.start},K);Q.push({type:"if",expr:J,outerStart:G.outerStart,outerEnd:G.outerEnd,element:W,parsedTag:X});let _=G.outerEnd,B=!0;while(B){let H=Z.slice(_).match(/^\s*/),O=H?H[0].length:0,F=u$(Z,_+O);if(!F){B=!1;break}let L=l5(F.attrs,"v-else-if"),V=J_(F.attrs,"v-else");if(L!==null){let A=I1(Z,F),N=N$(F.attrs,"v-else-if"),w=A$(Z.slice(A.outerStart,A.outerEnd),{...F,start:0,end:F.end-F.start},N);Q.push({type:"else-if",expr:L,outerStart:_,outerEnd:A.outerEnd,element:w,parsedTag:F}),_=A.outerEnd}else if(V){let A=I1(Z,F),N=N$(F.attrs,"v-else"),w=A$(Z.slice(A.outerStart,A.outerEnd),{...F,start:0,end:F.end-F.start},N);Q.push({type:"else",outerStart:_,outerEnd:A.outerEnd,element:w,parsedTag:F}),B=!1}else B=!1}let U=[];for(let H of Q)if(H.type==="if")U.push(`@if(${H.expr})
3935
+ @endforeach`;Z=Z.slice(0,U.outerStart)+H+Z.slice(U.outerEnd),Y=U.outerStart+j.length}return Z}function TN($){let Z=$,Y=0;while(Y<Z.length){let X=u$(Z,Y);if(!X)break;let J=l5(X.attrs,"v-if");if(J===null){Y=X.end;continue}let Q=[],G=I1(Z,X),K=A$(X.attrs,"v-if"),W=w$(Z.slice(G.outerStart,G.outerEnd),{...X,start:0,end:X.end-X.start},K);Q.push({type:"if",expr:J,outerStart:G.outerStart,outerEnd:G.outerEnd,element:W,parsedTag:X});let _=G.outerEnd,B=!0;while(B){let H=Z.slice(_).match(/^\s*/),O=H?H[0].length:0,F=u$(Z,_+O);if(!F){B=!1;break}let L=l5(F.attrs,"v-else-if"),V=J_(F.attrs,"v-else");if(L!==null){let A=I1(Z,F),N=A$(F.attrs,"v-else-if"),w=w$(Z.slice(A.outerStart,A.outerEnd),{...F,start:0,end:F.end-F.start},N);Q.push({type:"else-if",expr:L,outerStart:_,outerEnd:A.outerEnd,element:w,parsedTag:F}),_=A.outerEnd}else if(V){let A=I1(Z,F),N=A$(F.attrs,"v-else"),w=w$(Z.slice(A.outerStart,A.outerEnd),{...F,start:0,end:F.end-F.start},N);Q.push({type:"else",outerStart:_,outerEnd:A.outerEnd,element:w,parsedTag:F}),B=!1}else B=!1}let U=[];for(let H of Q)if(H.type==="if")U.push(`@if(${H.expr})
3936
3936
  ${H.element}`);else if(H.type==="else-if")U.push(`@elseif(${H.expr})
3937
3937
  ${H.element}`);else U.push(`@else
3938
3938
  ${H.element}`);U.push("@endif");let z=U.join(`
3939
- `),q=Q[0].outerStart,j=Q[Q.length-1].outerEnd;Z=Z.slice(0,q)+z+Z.slice(j),Y=q+z.length}return Z}function EN($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function IN($){let Z=$,Y=0;while(Y<Z.length){let X=u$(Z,Y);if(!X)break;let J=X.attrs,Q=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=J.match(G);while(K){Q=!0;let B=K[1],U=K[2],z=K[3];J=J.replace(K[0],""),J+=` :${B}="${z}" @update:${B}="${z} = $event"`,K=J.match(G)}if(Q){let B=I1(Z,X),U=Z.slice(B.outerStart,B.outerEnd),z=A$(U,{...X,start:0,end:X.end-X.start},J);Z=Z.slice(0,B.outerStart)+z+Z.slice(B.outerEnd),Y=B.outerStart+z.length;continue}let W=l5(X.attrs,"v-model");if(W===null){Y=X.end;continue}if(wN.has(X.tag.toLowerCase())){let B=X.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${W}"`,U=I1(Z,X),z=Z.slice(U.outerStart,U.outerEnd),q=A$(z,{...X,start:0,end:X.end-X.start},B);Z=Z.slice(0,U.outerStart)+q+Z.slice(U.outerEnd),Y=U.outerStart+q.length}else{let B=X.attrs.replace(/\s*v-model="[^"]*"/g,"");B+=` :modelValue="${W}" @update:modelValue="${W} = $event"`;let U=I1(Z,X),z=Z.slice(U.outerStart,U.outerEnd),q=A$(z,{...X,start:0,end:X.end-X.start},B);Z=Z.slice(0,U.outerStart)+q+Z.slice(U.outerEnd),Y=U.outerStart+q.length}}return Z}function DN($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function kN($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function SN($){let Z=$,Y=0;while(Y<Z.length){let X=u$(Z,Y);if(!X)break;let J=l5(X.attrs,"v-html");if(J===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let Q=I1(Z,X),G=N$(X.attrs,"v-html"),K=X.selfClosing?" /":"",W=`<${X.tag}${G}${K}>{!! ${J} !!}</${X.tag}>`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function bN($){let Z=$,Y=0;while(Y<Z.length){let X=u$(Z,Y);if(!X)break;let J=l5(X.attrs,"v-text");if(J===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let Q=I1(Z,X),G=N$(X.attrs,"v-text"),K=X.selfClosing?" /":"",W=`<${X.tag}${G}${K}>{{ ${J} }}</${X.tag}>`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function CN($){return $.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function yN($){let Z=$,Y=0;while(Y<Z.length){let X=u$(Z,Y);if(!X)break;if(!J_(X.attrs,"v-once")){Y=X.end;continue}let J=N$(X.attrs,"v-once"),Q=I1(Z,X),G=Z.slice(Q.outerStart,Q.outerEnd),W=`@once
3940
- ${A$(G,{...X,start:0,end:X.end-X.start},J)}
3941
- @endonce`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function PN($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function xN($){return $.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function J2($){if(!Q_($))return $;let Z=$;return Z=MN(Z),Z=TN(Z),Z=yN(Z),Z=DN(Z),Z=kN(Z),Z=IN(Z),Z=EN(Z),Z=xN(Z),Z=SN(Z),Z=bN(Z),Z=CN(Z),Z=PN(Z),Z}var AN,wN;var Q2=D(()=>{AN=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),wN=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"])});async function G2($,Z,Y,X,J){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],W;while((W=G.exec(Q))!==null)K.push({full:W[0],expr:W[1],attrs:W[2],slotContent:W[3],index:W.index});for(let _=K.length-1;_>=0;_--){let B=K[_];try{let U=L0(B.expr,Z);if(!U||typeof U!=="string"){let L=`<!-- dynamic component: could not resolve "${B.expr}" -->`;Q=Q.slice(0,B.index)+L+Q.slice(B.index+B.full.length);continue}let z=B.attrs.trim(),q={},j=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=j.exec(z))!==null){let L=H[1]||H[2],V=H[3];if(H[1])try{q[L]=L0(V,Z)}catch{q[L]=V}else q[L]=V}let O=X.componentsDir||"components",F=await D1(U,q,B.slotContent,O,Z,Y,X,new Set,J??new Set);Q=Q.slice(0,B.index)+F+Q.slice(B.index+B.full.length)}catch(U){let q=`<!-- dynamic component error: ${U instanceof Error?U.message:String(U)} -->`;Q=Q.slice(0,B.index)+q+Q.slice(B.index+B.full.length)}}return Q=await vN(Q,Z,Y,X,J),Q}async function vN($,Z,Y,X,J){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],W;while((W=G.exec(Q))!==null)K.push({full:W[0],expr:W[1],attrs:W[2],index:W.index});for(let _=K.length-1;_>=0;_--){let B=K[_];try{let U=L0(B.expr,Z);if(!U||typeof U!=="string"){let j=`<!-- dynamic component: could not resolve "${B.expr}" -->`;Q=Q.slice(0,B.index)+j+Q.slice(B.index+B.full.length);continue}let z=X.componentsDir||"components",q=await D1(U,{},"",z,Z,Y,X,new Set,J??new Set);Q=Q.slice(0,B.index)+q+Q.slice(B.index+B.full.length)}catch(U){let q=`<!-- dynamic component error: ${U instanceof Error?U.message:String(U)} -->`;Q=Q.slice(0,B.index)+q+Q.slice(B.index+B.full.length)}}return Q}var K2=D(()=>{q0();h0()});function G_($,Z=""){let Y=`${$}${Z}`,X=0;for(let J=0;J<Y.length;J++){let Q=Y.charCodeAt(J);X=(X<<5)-X+Q,X=X&X}return`stx-${Math.abs(X).toString(36)}`}function K_($,Z,Y={}){let{prefix:X="",preserveHost:J=!0,scopeKeyframes:Q=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=W2($),W=[],_=new Map;if(Q)for(let B of K){let U=B.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(U){let z=U[1],q=`${Z}_${z}`;_.set(z,q)}}for(let B of K){let U=W_(B,Z,X,J,_,G);W.push(U)}return W.join(`
3939
+ `),q=Q[0].outerStart,j=Q[Q.length-1].outerEnd;Z=Z.slice(0,q)+z+Z.slice(j),Y=q+z.length}return Z}function EN($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function IN($){let Z=$,Y=0;while(Y<Z.length){let X=u$(Z,Y);if(!X)break;let J=X.attrs,Q=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=J.match(G);while(K){Q=!0;let B=K[1],U=K[2],z=K[3];J=J.replace(K[0],""),J+=` :${B}="${z}" @update:${B}="${z} = $event"`,K=J.match(G)}if(Q){let B=I1(Z,X),U=Z.slice(B.outerStart,B.outerEnd),z=w$(U,{...X,start:0,end:X.end-X.start},J);Z=Z.slice(0,B.outerStart)+z+Z.slice(B.outerEnd),Y=B.outerStart+z.length;continue}let W=l5(X.attrs,"v-model");if(W===null){Y=X.end;continue}if(wN.has(X.tag.toLowerCase())){let B=X.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${W}"`,U=I1(Z,X),z=Z.slice(U.outerStart,U.outerEnd),q=w$(z,{...X,start:0,end:X.end-X.start},B);Z=Z.slice(0,U.outerStart)+q+Z.slice(U.outerEnd),Y=U.outerStart+q.length}else{let B=X.attrs.replace(/\s*v-model="[^"]*"/g,"");B+=` :modelValue="${W}" @update:modelValue="${W} = $event"`;let U=I1(Z,X),z=Z.slice(U.outerStart,U.outerEnd),q=w$(z,{...X,start:0,end:X.end-X.start},B);Z=Z.slice(0,U.outerStart)+q+Z.slice(U.outerEnd),Y=U.outerStart+q.length}}return Z}function DN($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function kN($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function SN($){let Z=$,Y=0;while(Y<Z.length){let X=u$(Z,Y);if(!X)break;let J=l5(X.attrs,"v-html");if(J===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let Q=I1(Z,X),G=A$(X.attrs,"v-html"),K=X.selfClosing?" /":"",W=`<${X.tag}${G}${K}>{!! ${J} !!}</${X.tag}>`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function bN($){let Z=$,Y=0;while(Y<Z.length){let X=u$(Z,Y);if(!X)break;let J=l5(X.attrs,"v-text");if(J===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let Q=I1(Z,X),G=A$(X.attrs,"v-text"),K=X.selfClosing?" /":"",W=`<${X.tag}${G}${K}>{{ ${J} }}</${X.tag}>`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function CN($){return $.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function yN($){let Z=$,Y=0;while(Y<Z.length){let X=u$(Z,Y);if(!X)break;if(!J_(X.attrs,"v-once")){Y=X.end;continue}let J=A$(X.attrs,"v-once"),Q=I1(Z,X),G=Z.slice(Q.outerStart,Q.outerEnd),W=`@once
3940
+ ${w$(G,{...X,start:0,end:X.end-X.start},J)}
3941
+ @endonce`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function PN($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function xN($){return $.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function XJ($){if(!Q_($))return $;let Z=$;return Z=MN(Z),Z=TN(Z),Z=yN(Z),Z=DN(Z),Z=kN(Z),Z=IN(Z),Z=EN(Z),Z=xN(Z),Z=SN(Z),Z=bN(Z),Z=CN(Z),Z=PN(Z),Z}var AN,wN;var JJ=D(()=>{AN=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),wN=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"])});async function QJ($,Z,Y,X,J){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],W;while((W=G.exec(Q))!==null)K.push({full:W[0],expr:W[1],attrs:W[2],slotContent:W[3],index:W.index});for(let _=K.length-1;_>=0;_--){let B=K[_];try{let U=L0(B.expr,Z);if(!U||typeof U!=="string"){let L=`<!-- dynamic component: could not resolve "${B.expr}" -->`;Q=Q.slice(0,B.index)+L+Q.slice(B.index+B.full.length);continue}let z=B.attrs.trim(),q={},j=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=j.exec(z))!==null){let L=H[1]||H[2],V=H[3];if(H[1])try{q[L]=L0(V,Z)}catch{q[L]=V}else q[L]=V}let O=X.componentsDir||"components",F=await D1(U,q,B.slotContent,O,Z,Y,X,new Set,J??new Set);Q=Q.slice(0,B.index)+F+Q.slice(B.index+B.full.length)}catch(U){let q=`<!-- dynamic component error: ${U instanceof Error?U.message:String(U)} -->`;Q=Q.slice(0,B.index)+q+Q.slice(B.index+B.full.length)}}return Q=await vN(Q,Z,Y,X,J),Q}async function vN($,Z,Y,X,J){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],W;while((W=G.exec(Q))!==null)K.push({full:W[0],expr:W[1],attrs:W[2],index:W.index});for(let _=K.length-1;_>=0;_--){let B=K[_];try{let U=L0(B.expr,Z);if(!U||typeof U!=="string"){let j=`<!-- dynamic component: could not resolve "${B.expr}" -->`;Q=Q.slice(0,B.index)+j+Q.slice(B.index+B.full.length);continue}let z=X.componentsDir||"components",q=await D1(U,{},"",z,Z,Y,X,new Set,J??new Set);Q=Q.slice(0,B.index)+q+Q.slice(B.index+B.full.length)}catch(U){let q=`<!-- dynamic component error: ${U instanceof Error?U.message:String(U)} -->`;Q=Q.slice(0,B.index)+q+Q.slice(B.index+B.full.length)}}return Q}var GJ=D(()=>{q0();h0()});function G_($,Z=""){let Y=`${$}${Z}`,X=0;for(let J=0;J<Y.length;J++){let Q=Y.charCodeAt(J);X=(X<<5)-X+Q,X=X&X}return`stx-${Math.abs(X).toString(36)}`}function K_($,Z,Y={}){let{prefix:X="",preserveHost:J=!0,scopeKeyframes:Q=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=KJ($),W=[],_=new Map;if(Q)for(let B of K){let U=B.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(U){let z=U[1],q=`${Z}_${z}`;_.set(z,q)}}for(let B of K){let U=W_(B,Z,X,J,_,G);W.push(U)}return W.join(`
3942
3942
 
3943
- `)}function W2($){let Z=[],Y=$.replace(/\/\*[\s\S]*?\*\//g,""),X=0,J="",Q=!1,G="";for(let K=0;K<Y.length;K++){let W=Y[K];if(W==="@"&&X===0)Q=!0;if(W==="{")X++;else if(W==="}"){if(X--,X===0){if(Q){G+=W;let _=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(_){let[,B,U,z]=_;if(B==="keyframes")Z.push({selector:`@keyframes ${U.trim()}`,declarations:z.trim()});else if(B==="media"||B==="supports"||B==="container"){let q=W2(z);Z.push({selector:`@${B} ${U.trim()}`,declarations:q.map((j)=>`${j.selector} { ${j.declarations} }`).join(`
3944
- `)})}else Z.push({selector:`@${B} ${U.trim()}`,declarations:z.trim()})}G="",Q=!1}else if(J.trim()){J+=W;let _=J.match(/([^{]+)\{([^}]*)\}/);if(_)Z.push({selector:_[1].trim(),declarations:_[2].trim()});J=""}continue}}if(Q)G+=W;else J+=W}return Z}function W_($,Z,Y,X,J,Q){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let B=G.replace("@keyframes ","").trim();return`@keyframes ${J.get(B)||B} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let U=W2(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((z)=>W_(z,Z,Y,X,J,Q)).join(`
3943
+ `)}function KJ($){let Z=[],Y=$.replace(/\/\*[\s\S]*?\*\//g,""),X=0,J="",Q=!1,G="";for(let K=0;K<Y.length;K++){let W=Y[K];if(W==="@"&&X===0)Q=!0;if(W==="{")X++;else if(W==="}"){if(X--,X===0){if(Q){G+=W;let _=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(_){let[,B,U,z]=_;if(B==="keyframes")Z.push({selector:`@keyframes ${U.trim()}`,declarations:z.trim()});else if(B==="media"||B==="supports"||B==="container"){let q=KJ(z);Z.push({selector:`@${B} ${U.trim()}`,declarations:q.map((j)=>`${j.selector} { ${j.declarations} }`).join(`
3944
+ `)})}else Z.push({selector:`@${B} ${U.trim()}`,declarations:z.trim()})}G="",Q=!1}else if(J.trim()){J+=W;let _=J.match(/([^{]+)\{([^}]*)\}/);if(_)Z.push({selector:_[1].trim(),declarations:_[2].trim()});J=""}continue}}if(Q)G+=W;else J+=W}return Z}function W_($,Z,Y,X,J,Q){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let B=G.replace("@keyframes ","").trim();return`@keyframes ${J.get(B)||B} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let U=KJ(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((z)=>W_(z,Z,Y,X,J,Q)).join(`
3945
3945
  `);return`${G} {
3946
3946
  ${U}
3947
3947
  }`}return`${G} { ${K} }`}let W=fN(G,Z,Y,X),_=K;for(let[B,U]of J)_=_.replace(new RegExp(`\\b${B}\\b`,"g"),U);if(Q)_=_.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${W} { ${_} }`}function fN($,Z,Y,X){let J=$.split(",").map((G)=>G.trim()),Q=[];for(let G of J){if(G.startsWith(":host")){if(X)Q.push(G);else{let W=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);Q.push(W)}continue}if(G.includes("::slotted")){Q.push(G);continue}if(G===":root"){Q.push(`:root .${Z}`);continue}let K=Y?`${Y} .${Z}`:`.${Z}`;Q.push(`${K} ${G}`)}return Q.join(", ")}function U4($,Z){if(!/<style\s+[^>]*\bscoped\b/i.test($))return{html:$,hasScoped:!1};let Y=G_(Z),X=`data-v-${Y}`,J=$,Q=/<style\s+([^>]*\bscoped\b[^>]*)>([\s\S]*?)<\/style>/gi,G=!1;if(J=J.replace(Q,(K,W,_)=>{G=!0;let B=gN(_,X),U=W.replace(/\bscoped\b/gi,"").trim(),z=U?` ${U}`:"";return`<style data-stx-scoped="${Y}"${z}>${B}</style>`}),!G)return{html:$,hasScoped:!1};return J=hN(J,X),{html:J,hasScoped:!0}}function gN($,Z){return K_($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function hN($,Z){let Y=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(X,J,Q)=>{if(Y.has(J.toLowerCase()))return X;if(X.includes(Z))return X;if(J.toLowerCase()==="style"||J.toLowerCase()==="script")return X;if(Q)return X.replace(`<${J}${Q}`,`<${J} ${Z}${Q}`);if(X.endsWith("/>"))return`<${J} ${Z} />`;return`<${J} ${Z}>`})}var Z8=()=>{};function __($,Z={},Y={}){let{title:X="stx App",lang:J="en",meta:Q=[],link:G=[],script:K=[],headRaw:W="",bodyClass:_="",bodyAttrs:B={}}=Z,U=Y.title||X,j=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...Q].map((N)=>{return` <meta ${Object.entries(N).map(([M,T])=>`${M}="${T}"`).join(" ")}>`}).join(`
@@ -3957,7 +3957,7 @@ ${V.join(`
3957
3957
  ${A.join(`
3958
3958
  `)}
3959
3959
  </body>
3960
- </html>`}function B_($){let Z=$.trim();while(Z.startsWith("<!--")){let Y=Z.indexOf("-->");if(Y===-1)break;Z=Z.slice(Y+3).trim()}return/^<!DOCTYPE\b/i.test(Z)||/^<html[\s>]/i.test(Z)}function z4($,Z={},Y={}){if(B_($))return $;return __($,Z,Y)}function J8($){let Z=$,Y=new Set,X=new Set,J=()=>{if(Q1)X.add(Q1);return Z};return J.set=(Q)=>{if(!Object.is(Q,Z)){let G=Z;if(Z=Q,Y.forEach((K)=>K(Z,G)),q4)X.forEach((K)=>X8.add(K));else X.forEach((K)=>K())}},J.update=(Q)=>{J.set(Q(Z))},J.subscribe=(Q)=>{return Y.add(Q),()=>Y.delete(Q)},Object.defineProperty(J,"_isSignal",{value:!0,writable:!1}),J}function Q8($){let Z,Y=!0,X=new Set,J=()=>{if(!Y)if(Y=!0,q4)X.forEach((G)=>X8.add(G));else X.forEach((G)=>G())},Q=()=>{if(Q1)X.add(Q1);if(Y){let G=Q1;Q1=J,Y8.push(J);try{Z=$()}finally{Y8.pop(),Q1=G}Y=!1}return Z};return Object.defineProperty(Q,"_isDerived",{value:!0,writable:!1}),Q}function G8($,Z={}){let Y,X=!1,J=()=>{if(X)return;if(Y)Y(),Y=void 0;let Q=Q1;Q1=J,Y8.push(J);try{Y=$()}finally{Y8.pop(),Q1=Q}};if(Z.immediate!==!1)J();return()=>{if(X=!0,Y)Y()}}function K8($){if(q4){$();return}q4=!0;try{$()}finally{q4=!1,X8.forEach((Z)=>Z()),X8.clear()}}function W8($){dN.push($)}function _8($){uN.push($)}function j4($){return typeof $==="function"&&$._isSignal===!0}function H4($){return typeof $==="function"&&$._isDerived===!0}function B8($){if(j4($)||H4($))return $();return $}function U8($){let Z=Q1;Q1=null;try{return $()}finally{Q1=Z}}var Q1=null,Y8,q4=!1,X8,dN,uN;var _2=D(()=>{Y8=[],X8=new Set,dN=[],uN=[]});var B2={};Q0(B2,{untrack:()=>B8,state:()=>J8,peek:()=>U8,onMount:()=>W8,onDestroy:()=>_8,isSignal:()=>j4,isDerived:()=>H4,generateSignalsRuntimeDev:()=>m$,generateSignalsRuntime:()=>O4,effect:()=>G8,derived:()=>Q8,default:()=>mN,batch:()=>K8});function O4(){try{let Z=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(m$());return Z=Z.replace(/\}(var |let |const |function )/g,"};$1"),Z}catch{return m$()}}function m$(){return`
3960
+ </html>`}function B_($){let Z=$.trim();while(Z.startsWith("<!--")){let Y=Z.indexOf("-->");if(Y===-1)break;Z=Z.slice(Y+3).trim()}return/^<!DOCTYPE\b/i.test(Z)||/^<html[\s>]/i.test(Z)}function z4($,Z={},Y={}){if(B_($))return $;return __($,Z,Y)}function J8($){let Z=$,Y=new Set,X=new Set,J=()=>{if(Q1)X.add(Q1);return Z};return J.set=(Q)=>{if(!Object.is(Q,Z)){let G=Z;if(Z=Q,Y.forEach((K)=>K(Z,G)),q4)X.forEach((K)=>X8.add(K));else X.forEach((K)=>K())}},J.update=(Q)=>{J.set(Q(Z))},J.subscribe=(Q)=>{return Y.add(Q),()=>Y.delete(Q)},Object.defineProperty(J,"_isSignal",{value:!0,writable:!1}),J}function Q8($){let Z,Y=!0,X=new Set,J=()=>{if(!Y)if(Y=!0,q4)X.forEach((G)=>X8.add(G));else X.forEach((G)=>G())},Q=()=>{if(Q1)X.add(Q1);if(Y){let G=Q1;Q1=J,Y8.push(J);try{Z=$()}finally{Y8.pop(),Q1=G}Y=!1}return Z};return Object.defineProperty(Q,"_isDerived",{value:!0,writable:!1}),Q}function G8($,Z={}){let Y,X=!1,J=()=>{if(X)return;if(Y)Y(),Y=void 0;let Q=Q1;Q1=J,Y8.push(J);try{Y=$()}finally{Y8.pop(),Q1=Q}};if(Z.immediate!==!1)J();return()=>{if(X=!0,Y)Y()}}function K8($){if(q4){$();return}q4=!0;try{$()}finally{q4=!1,X8.forEach((Z)=>Z()),X8.clear()}}function W8($){dN.push($)}function _8($){uN.push($)}function j4($){return typeof $==="function"&&$._isSignal===!0}function H4($){return typeof $==="function"&&$._isDerived===!0}function B8($){if(j4($)||H4($))return $();return $}function U8($){let Z=Q1;Q1=null;try{return $()}finally{Q1=Z}}var Q1=null,Y8,q4=!1,X8,dN,uN;var WJ=D(()=>{Y8=[],X8=new Set,dN=[],uN=[]});var _J={};Q0(_J,{untrack:()=>B8,state:()=>J8,peek:()=>U8,onMount:()=>W8,onDestroy:()=>_8,isSignal:()=>j4,isDerived:()=>H4,generateSignalsRuntimeDev:()=>m$,generateSignalsRuntime:()=>O4,effect:()=>G8,derived:()=>Q8,default:()=>mN,batch:()=>K8});function O4(){try{let Z=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(m$());return Z=Z.replace(/\}(var |let |const |function )/g,"};$1"),Z}catch{return m$()}}function m$(){return`
3961
3961
  // STX Signals Runtime (Development Build)
3962
3962
  console.log('[stx] signals runtime loading');
3963
3963
  // Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
@@ -8050,7 +8050,7 @@ catch (e) { console.warn('[stx] mount callback error:', e); }
8050
8050
  }
8051
8051
  }
8052
8052
  })();
8053
- `}var mN;var L4=D(()=>{_2();_2();mN={state:J8,derived:Q8,effect:G8,batch:K8,onMount:W8,onDestroy:_8,isSignal:j4,isDerived:H4,untrack:B8,peek:U8,generateSignalsRuntime:O4,generateSignalsRuntimeDev:m$}});var z2={};Q0(z2,{templateCache:()=>U2,readFileCached:()=>U_,invalidateFileCacheByDir:()=>q_,invalidateFileCache:()=>z_,hashFilePath:()=>n5,getCachedSignalsRuntime:()=>j_,getCachedRouterScript:()=>H_,clearDevCaches:()=>O_,checkCache:()=>j8,cacheTemplate:()=>H8});import w$ from"fs";import i5 from"path";async function U_($){let Y;for(let X=0;X<3;X++)try{let Q=(await w$.promises.stat($)).mtime.getTime(),G=p$.get($);if(G&&G.mtime===Q)return G.content;let K=await Bun.file($).text(),_=(await w$.promises.stat($)).mtime.getTime();if(_!==Q)continue;return p$.set($,{content:K,mtime:_}),K}catch(J){Y=J;break}throw p$.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function z_($){p$.delete($)}function q_($){for(let Z of p$.keys())if(Z.startsWith($))p$.delete(Z)}async function j_($=!1){if($){let{generateSignalsRuntimeDev:Z}=await Promise.resolve().then(() => (L4(),B2));return Z()}if(z8===null){let{generateSignalsRuntime:Z}=await Promise.resolve().then(() => (L4(),B2));z8=Z()}return z8}async function H_(){if(q8===null){let{getRouterScript:$}=await import("stx-router");q8=$()}return q8}function O_(){p$.clear(),z8=null,pN=null,q8=null}async function j8($,Z){try{if(!Z.cachePath)return null;let Y=i5.resolve(Z.cachePath),X=i5.join(Y,`${n5($)}.html`),J=i5.join(Y,`${n5($)}.meta.json`);if(!await t(X)||!await t(J))return null;let Q=await Bun.file(J).text(),G=JSON.parse(Q);if(G.cacheVersion!==Z.cacheVersion)return null;if((await w$.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let W of G.dependencies)if(await t(W)){if((await w$.promises.stat(W)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(X).text()}catch(Y){return console.warn(`Cache error for ${$}:`,Y),null}}async function H8($,Z,Y,X){try{if(!X.cachePath)return;let J=i5.resolve(X.cachePath);await w$.promises.mkdir(J,{recursive:!0});let Q=i5.join(J,`${n5($)}.html`),G=i5.join(J,`${n5($)}.meta.json`),K=await w$.promises.stat($);await Bun.write(Q,Z);let W={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:X.cacheVersion,generatedAt:Date.now()};await Bun.write(G,JSON.stringify(W,null,2)),U2.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(J){console.warn(`Failed to cache template ${$}:`,J)}}function n5($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,cN)}var U2,p$,z8=null,pN=null,q8=null,cN=16;var O8=D(()=>{q0();U2=new Map,p$=new Map});function L_($){if($.includes("window.StacksBrowser")||$.includes("StacksBrowser ="))return $;let Z=/<script\b(?![^>]*\bserver\b)[^>]*>([\s\S]*?)<\/script>/gi,Y="",X;while((X=Z.exec($))!==null)Y+=X[1]+`
8053
+ `}var mN;var L4=D(()=>{WJ();WJ();mN={state:J8,derived:Q8,effect:G8,batch:K8,onMount:W8,onDestroy:_8,isSignal:j4,isDerived:H4,untrack:B8,peek:U8,generateSignalsRuntime:O4,generateSignalsRuntimeDev:m$}});var UJ={};Q0(UJ,{templateCache:()=>BJ,readFileCached:()=>U_,invalidateFileCacheByDir:()=>q_,invalidateFileCache:()=>z_,hashFilePath:()=>n5,getCachedSignalsRuntime:()=>j_,getCachedRouterScript:()=>H_,clearDevCaches:()=>O_,checkCache:()=>j8,cacheTemplate:()=>H8});import R$ from"fs";import i5 from"path";async function U_($){let Y;for(let X=0;X<3;X++)try{let Q=(await R$.promises.stat($)).mtime.getTime(),G=p$.get($);if(G&&G.mtime===Q)return G.content;let K=await Bun.file($).text(),_=(await R$.promises.stat($)).mtime.getTime();if(_!==Q)continue;return p$.set($,{content:K,mtime:_}),K}catch(J){Y=J;break}throw p$.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function z_($){p$.delete($)}function q_($){for(let Z of p$.keys())if(Z.startsWith($))p$.delete(Z)}async function j_($=!1){if($){let{generateSignalsRuntimeDev:Z}=await Promise.resolve().then(() => (L4(),_J));return Z()}if(z8===null){let{generateSignalsRuntime:Z}=await Promise.resolve().then(() => (L4(),_J));z8=Z()}return z8}async function H_(){if(q8===null){let{getRouterScript:$}=await import("stx-router");q8=$()}return q8}function O_(){p$.clear(),z8=null,pN=null,q8=null}async function j8($,Z){try{if(!Z.cachePath)return null;let Y=i5.resolve(Z.cachePath),X=i5.join(Y,`${n5($)}.html`),J=i5.join(Y,`${n5($)}.meta.json`);if(!await t(X)||!await t(J))return null;let Q=await Bun.file(J).text(),G=JSON.parse(Q);if(G.cacheVersion!==Z.cacheVersion)return null;if((await R$.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let W of G.dependencies)if(await t(W)){if((await R$.promises.stat(W)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(X).text()}catch(Y){return console.warn(`Cache error for ${$}:`,Y),null}}async function H8($,Z,Y,X){try{if(!X.cachePath)return;let J=i5.resolve(X.cachePath);await R$.promises.mkdir(J,{recursive:!0});let Q=i5.join(J,`${n5($)}.html`),G=i5.join(J,`${n5($)}.meta.json`),K=await R$.promises.stat($);await Bun.write(Q,Z);let W={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:X.cacheVersion,generatedAt:Date.now()};await Bun.write(G,JSON.stringify(W,null,2)),BJ.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(J){console.warn(`Failed to cache template ${$}:`,J)}}function n5($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,cN)}var BJ,p$,z8=null,pN=null,q8=null,cN=16;var O8=D(()=>{q0();BJ=new Map,p$=new Map});function L_($){if($.includes("window.StacksBrowser")||$.includes("StacksBrowser ="))return $;let Z=/<script\b(?![^>]*\bserver\b)[^>]*>([\s\S]*?)<\/script>/gi,Y="",X;while((X=Z.exec($))!==null)Y+=X[1]+`
8054
8054
  `;let J=/\{\{([\s\S]*?)\}\}/g;while((X=J.exec($))!==null)Y+=X[1]+`
8055
8055
  `;if(!Y.trim())return $;let G=["browserQuery","BrowserQueryBuilder","configureBrowser","createBrowserModel"].some((z)=>{return new RegExp(`\\b${z}\\b`).test(Y)}),K=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process"]),W=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,_,B=!1;while((_=W.exec(Y))!==null)if(!K.has(_[1])){B=!0;break}if(!G&&!B)return $;let U=`<script type="module">
8056
8056
  // STX: Auto-load @stacksjs/browser (auto-initializes API and loads models)
@@ -8062,15 +8062,15 @@ ${U}`);return U+`
8062
8062
  `+$}async function F_($,Z){if($.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="compile"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script src="/__stx/runtime.__STX_HASH__.js"></script>
8063
8063
  `+$.slice(K);if($.includes("</head>")){let W=$.indexOf("</head>");return $.slice(0,W)+`<script src="/__stx/runtime.__STX_HASH__.js"></script>
8064
8064
  `+$.slice(W)}return`<script src="/__stx/runtime.__STX_HASH__.js"></script>
8065
- `+$}let{getCachedSignalsRuntime:Y}=await Promise.resolve().then(() => (O8(),z2)),J=`<script data-stx-scoped>${await Y(Z.debug)}</script>`,Q=$.indexOf("<script");if(Q!==-1)return $.slice(0,Q)+J+`
8065
+ `+$}let{getCachedSignalsRuntime:Y}=await Promise.resolve().then(() => (O8(),UJ)),J=`<script data-stx-scoped>${await Y(Z.debug)}</script>`,Q=$.indexOf("<script");if(Q!==-1)return $.slice(0,Q)+J+`
8066
8066
  `+$.slice(Q);if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+J+`
8067
8067
  `+$.slice(G)}if($.includes("<body")){let G=$.indexOf("<body"),K=$.indexOf(">",G);return $.slice(0,K+1)+`
8068
8068
  `+J+$.slice(K+1)}return J+`
8069
8069
  `+$}async function c$($,Z){if(!$.includes("</body>"))return $;if($.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Y=Z?.router,X="";if(Y){let K={};if(Y.container)K.container=Y.container;if(Y.viewTransitions!==void 0)K.viewTransitions=Y.viewTransitions;if(Y.viewTransitionDuration!==void 0)K.viewTransitionDuration=Y.viewTransitionDuration;if(Y.viewTransitionEasing!==void 0)K.viewTransitionEasing=Y.viewTransitionEasing;if(Y.scrollToTop!==void 0)K.scrollToTop=Y.scrollToTop;if(Y.prefetch!==void 0)K.prefetch=Y.prefetch;if(Y.cache!==void 0)K.cache=Y.cache;if(Y.progressColor!==void 0)K.progressColor=Y.progressColor;if(Y.progressHeight!==void 0)K.progressHeight=Y.progressHeight;if(Object.keys(K).length>0)X=`<script>window.__stxRouterConfig=${JSON.stringify(K)};</script>
8070
- `}let{getCachedRouterScript:J}=await Promise.resolve().then(() => (O8(),z2)),Q=Z?.buildMode==="compile"?'<script src="/__stx/router.__STX_HASH__.js"></script>':`<script>${await J()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+X+Q+`
8071
- </body>`+$.slice(G+7)}var T_={};Q0(T_,{scanScriptTags:()=>A_,processSignals:()=>H2,processScriptSetup:()=>R_,parseLoopExpression:()=>w_,hasSignalsSyntax:()=>F8,extractExports:()=>M_,convertSignalLoopsToAttributes:()=>j2,convertSignalDirectivesToAttributes:()=>q2});function A_($,Z={}){let Y=[];L8.lastIndex=0;let X;while((X=L8.exec($))!==null){let J=X[1],Q=X.index+X[0].length,G=$.toLowerCase().indexOf("</script>",Q);if(G===-1)break;let K=G+9;if(Z.skipAttrs&&Z.skipAttrs.test(J)){L8.lastIndex=K;continue}Y.push({fullMatch:$.slice(X.index,K),attrs:J,body:$.slice(Q,G),start:X.index,end:K}),L8.lastIndex=K}return Y}function w_($){let Z=$.trim(),Y=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Y){let J=Y[1].trim(),Q=Y[2].trim(),{itemVar:G,indexVar:K}=V_(Q);if(G)return{style:"as",iterable:J,itemVar:G,indexVar:K}}let X=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(X){let J=X[1].trim(),Q=X[2].trim(),{itemVar:G,indexVar:K}=V_(J);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function V_($){let Z=$.trim(),Y=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(Y)return{itemVar:Y[2],indexVar:Y[1]};let X=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(X)return{itemVar:X[1],indexVar:X[2]||null};let J=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(J)return{itemVar:J[1],indexVar:J[2]};let Q=Z.match(/^(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:null};return{itemVar:null,indexVar:null}}function F8($){return[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/].some((Y)=>Y.test($))}function iN($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Y=0,X;while((X=Z.exec($))!==null){let J=X[1];if(J.startsWith("if"))Y++;else if(J==="endif")Y--;else if(Y===0)return!0}return!1}function q2($){let Z=$,Y=/@if\s*\(/g,X,J=[];while((X=Y.exec(Z))!==null){let Q=X.index,G=Q+X[0].length,K=1,W=G;while(W<Z.length&&K>0){if(Z[W]==="(")K++;else if(Z[W]===")")K--;W++}if(K!==0)continue;let _=Z.substring(G,W-1).trim(),B=W,U=1,z=B,q=/@(if\s*\(|endif)/g;q.lastIndex=B;let j;while((j=q.exec(Z))!==null)if(j[1].startsWith("if"))U++;else if(j[1]==="endif"){if(U--,U===0){z=j.index+j[0].length;break}}if(U!==0)continue;let H=Z.substring(B,z-6).trim();if(iN(H))continue;let O=H.match(N_),F;if(O){let[,L,V,A]=O,N=_.replace(/"/g,"&quot;");F=`<${L}${V} @if="${N}">${A}</${L}>`}else F=`<template @if="${_.replace(/"/g,"&quot;")}">${H}</template>`;J.push({start:Q,end:z,replacement:F})}for(let Q=J.length-1;Q>=0;Q--){let{start:G,end:K,replacement:W}=J[Q];Z=Z.substring(0,G)+W+Z.substring(K)}return Z}function j2($,Z){let Y=$,X=/@(for|foreach)\s*\(/g,J,Q=[];while((J=X.exec(Y))!==null){let G=J[1],K=J.index,W=K+J[0].length,_=1,B=W;while(B<Y.length&&_>0){if(Y[B]==="(")_++;else if(Y[B]===")")_--;B++}if(_!==0)continue;let U=Y.substring(W,B-1).trim(),z=B,q=w_(U);if(q.iterable){let w=q.iterable.trim();if(w.startsWith("[")||w.startsWith("{")||w.startsWith("'")||w.startsWith('"')||w.startsWith("`")||/^-?\d/.test(w))continue;if(Z){let M=w.split(/[.[(]/)[0].trim();if(M&&M in Z)continue}}if(q.style==="as")U=q.indexVar?`(${q.itemVar}, ${q.indexVar}) in ${q.iterable}`:`${q.itemVar} in ${q.iterable}`;let j=G==="for"?"@endfor":"@endforeach",H=1,O=z,F=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");F.lastIndex=z;let L;while((L=F.exec(Y))!==null)if(L[1].startsWith(G))H++;else if(H--,H===0){O=L.index+L[0].length;break}if(H!==0)continue;let V=Y.substring(z,O-j.length).trim(),A=V.match(N_),N;if(A){let[,w,M,T]=A;N=`<${w}${M} @for="${U}">${T}</${w}>`}else N=`<template @for="${U}">${V}</template>`;Q.push({start:K,end:O,replacement:N})}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:_}=Q[G];Y=Y.substring(0,K)+_+Y.substring(W)}return Y}function nN($){let Z=new Set,Y=[],X=0,J=0,Q=$.length,G=(B)=>{let U=X+1;while(U<Q){let z=$[U];if(z==="\\"){U+=2;continue}if(z===B)return U+1;U++}return Q},K=()=>{let B=X+2;while(B<Q&&$[B]!==`
8070
+ `}let{getCachedRouterScript:J}=await Promise.resolve().then(() => (O8(),UJ)),Q=Z?.buildMode==="compile"?'<script src="/__stx/router.__STX_HASH__.js"></script>':`<script>${await J()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+X+Q+`
8071
+ </body>`+$.slice(G+7)}var T_={};Q0(T_,{scanScriptTags:()=>A_,processSignals:()=>jJ,processScriptSetup:()=>R_,parseLoopExpression:()=>w_,hasSignalsSyntax:()=>F8,extractExports:()=>M_,convertSignalLoopsToAttributes:()=>qJ,convertSignalDirectivesToAttributes:()=>zJ});function A_($,Z={}){let Y=[];L8.lastIndex=0;let X;while((X=L8.exec($))!==null){let J=X[1],Q=X.index+X[0].length,G=$.toLowerCase().indexOf("</script>",Q);if(G===-1)break;let K=G+9;if(Z.skipAttrs&&Z.skipAttrs.test(J)){L8.lastIndex=K;continue}Y.push({fullMatch:$.slice(X.index,K),attrs:J,body:$.slice(Q,G),start:X.index,end:K}),L8.lastIndex=K}return Y}function w_($){let Z=$.trim(),Y=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Y){let J=Y[1].trim(),Q=Y[2].trim(),{itemVar:G,indexVar:K}=V_(Q);if(G)return{style:"as",iterable:J,itemVar:G,indexVar:K}}let X=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(X){let J=X[1].trim(),Q=X[2].trim(),{itemVar:G,indexVar:K}=V_(J);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function V_($){let Z=$.trim(),Y=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(Y)return{itemVar:Y[2],indexVar:Y[1]};let X=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(X)return{itemVar:X[1],indexVar:X[2]||null};let J=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(J)return{itemVar:J[1],indexVar:J[2]};let Q=Z.match(/^(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:null};return{itemVar:null,indexVar:null}}function F8($){return[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/].some((Y)=>Y.test($))}function iN($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Y=0,X;while((X=Z.exec($))!==null){let J=X[1];if(J.startsWith("if"))Y++;else if(J==="endif")Y--;else if(Y===0)return!0}return!1}function zJ($){let Z=$,Y=/@if\s*\(/g,X,J=[];while((X=Y.exec(Z))!==null){let Q=X.index,G=Q+X[0].length,K=1,W=G;while(W<Z.length&&K>0){if(Z[W]==="(")K++;else if(Z[W]===")")K--;W++}if(K!==0)continue;let _=Z.substring(G,W-1).trim(),B=W,U=1,z=B,q=/@(if\s*\(|endif)/g;q.lastIndex=B;let j;while((j=q.exec(Z))!==null)if(j[1].startsWith("if"))U++;else if(j[1]==="endif"){if(U--,U===0){z=j.index+j[0].length;break}}if(U!==0)continue;let H=Z.substring(B,z-6).trim();if(iN(H))continue;let O=H.match(N_),F;if(O){let[,L,V,A]=O,N=_.replace(/"/g,"&quot;");F=`<${L}${V} @if="${N}">${A}</${L}>`}else F=`<template @if="${_.replace(/"/g,"&quot;")}">${H}</template>`;J.push({start:Q,end:z,replacement:F})}for(let Q=J.length-1;Q>=0;Q--){let{start:G,end:K,replacement:W}=J[Q];Z=Z.substring(0,G)+W+Z.substring(K)}return Z}function qJ($,Z){let Y=$,X=/@(for|foreach)\s*\(/g,J,Q=[];while((J=X.exec(Y))!==null){let G=J[1],K=J.index,W=K+J[0].length,_=1,B=W;while(B<Y.length&&_>0){if(Y[B]==="(")_++;else if(Y[B]===")")_--;B++}if(_!==0)continue;let U=Y.substring(W,B-1).trim(),z=B,q=w_(U);if(q.iterable){let w=q.iterable.trim();if(w.startsWith("[")||w.startsWith("{")||w.startsWith("'")||w.startsWith('"')||w.startsWith("`")||/^-?\d/.test(w))continue;if(Z){let M=w.split(/[.[(]/)[0].trim();if(M&&M in Z)continue}}if(q.style==="as")U=q.indexVar?`(${q.itemVar}, ${q.indexVar}) in ${q.iterable}`:`${q.itemVar} in ${q.iterable}`;let j=G==="for"?"@endfor":"@endforeach",H=1,O=z,F=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");F.lastIndex=z;let L;while((L=F.exec(Y))!==null)if(L[1].startsWith(G))H++;else if(H--,H===0){O=L.index+L[0].length;break}if(H!==0)continue;let V=Y.substring(z,O-j.length).trim(),A=V.match(N_),N;if(A){let[,w,M,T]=A;N=`<${w}${M} @for="${U}">${T}</${w}>`}else N=`<template @for="${U}">${V}</template>`;Q.push({start:K,end:O,replacement:N})}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:_}=Q[G];Y=Y.substring(0,K)+_+Y.substring(W)}return Y}function nN($){let Z=new Set,Y=[],X=0,J=0,Q=$.length,G=(B)=>{let U=X+1;while(U<Q){let z=$[U];if(z==="\\"){U+=2;continue}if(z===B)return U+1;U++}return Q},K=()=>{let B=X+2;while(B<Q&&$[B]!==`
8072
8072
  `)B++;return B},W=()=>{let B=X+2;while(B<Q-1){if($[B]==="*"&&$[B+1]==="/")return B+2;B++}return Q},_=(B)=>{let U=B,z=0;while(U<Q){let q=$[U];if(q==="/"&&$[U+1]==="/"){let j=U+2;while(j<Q&&$[j]!==`
8073
- `)j++;U=j;continue}if(q==="/"&&$[U+1]==="*"){let j=U+2;while(j<Q-1&&!($[j]==="*"&&$[j+1]==="/"))j++;U=j+2;continue}if(q==='"'||q==="'"||q==="`"){let j=U+1;while(j<Q){if($[j]==="\\"){j+=2;continue}if($[j]===q){j++;break}j++}U=j;continue}if(q==="("||q==="["||q==="{"){z++,U++;continue}if(q===")"||q==="]"||q==="}"){z--,U++;continue}if(q===";"&&z===0)return U+1;U++}return Q};while(X<Q){let B=$[X];if(B==="/"&&$[X+1]==="/"){let U=K();Y.push($.slice(X,U)),X=U;continue}if(B==="/"&&$[X+1]==="*"){let U=W();Y.push($.slice(X,U)),X=U;continue}if(B==='"'||B==="'"||B==="`"){let U=G(B);Y.push($.slice(X,U)),X=U;continue}if(B==="{"){J++,Y.push(B),X++;continue}if(B==="}"){J--,Y.push(B),X++;continue}if(J===0){let U=X>0?$[X-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let q=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(q){let j=q[2],H=_(X+q[0].length);if(Z.has(j)){Y.push(`/* stx: deduped const ${j} */`),X=H;continue}Z.add(j),Y.push($.slice(X,H)),X=H;continue}}}Y.push(B),X++}return Y.join("")}async function R_($,Z){let Y=A_($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),X=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useWebSocket|useRoute|useSearchParams|onMount|onDestroy)\s*(?:<[^>]*>)?\s*\(/,J=[];for(let q of Y){let j=q.body;if(Y$(q.attrs))j=X$(j);if(X.test(j))J.push({fullMatch:q.fullMatch,attrs:q.attrs,content:j})}if(J.length===0)return{output:$,setupCode:null};let Q=`__stx_setup_${Date.now()}_${lN++}`,{hasUserImports:G,bundleClientScript:K}=await Promise.resolve().then(() => (PZ(),yZ)),W=[];for(let q=0;q<J.length;q++){let j=J[q].content;if(G(j))console.log("[stx:bundler] bundling signal script imports"),j=await K(j,Z||"",{projectRoot:process.cwd()});j=j.replace(/^\s*import\s+(?:type\s+)?\{[^}]*\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,"// [stx import stripped \u2014 resolved via window.stx in __stx_setup]");let H=Z$(j);W.push(`// \u2500\u2500 merged signal script #${q+1} \u2500\u2500
8073
+ `)j++;U=j;continue}if(q==="/"&&$[U+1]==="*"){let j=U+2;while(j<Q-1&&!($[j]==="*"&&$[j+1]==="/"))j++;U=j+2;continue}if(q==='"'||q==="'"||q==="`"){let j=U+1;while(j<Q){if($[j]==="\\"){j+=2;continue}if($[j]===q){j++;break}j++}U=j;continue}if(q==="("||q==="["||q==="{"){z++,U++;continue}if(q===")"||q==="]"||q==="}"){z--,U++;continue}if(q===";"&&z===0)return U+1;U++}return Q};while(X<Q){let B=$[X];if(B==="/"&&$[X+1]==="/"){let U=K();Y.push($.slice(X,U)),X=U;continue}if(B==="/"&&$[X+1]==="*"){let U=W();Y.push($.slice(X,U)),X=U;continue}if(B==='"'||B==="'"||B==="`"){let U=G(B);Y.push($.slice(X,U)),X=U;continue}if(B==="{"){J++,Y.push(B),X++;continue}if(B==="}"){J--,Y.push(B),X++;continue}if(J===0){let U=X>0?$[X-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let q=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(q){let j=q[2],H=_(X+q[0].length);if(Z.has(j)){Y.push(`/* stx: deduped const ${j} */`),X=H;continue}Z.add(j),Y.push($.slice(X,H)),X=H;continue}}}Y.push(B),X++}return Y.join("")}async function R_($,Z){let Y=A_($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),X=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useWebSocket|useRoute|useSearchParams|onMount|onDestroy)\s*(?:<[^>]*>)?\s*\(/,J=[];for(let q of Y){let j=q.body;if(X$(q.attrs))j=J$(j);if(X.test(j))J.push({fullMatch:q.fullMatch,attrs:q.attrs,content:j})}if(J.length===0)return{output:$,setupCode:null};let Q=`__stx_setup_${Date.now()}_${lN++}`,{hasUserImports:G,bundleClientScript:K}=await Promise.resolve().then(() => (yZ(),CZ)),W=[];for(let q=0;q<J.length;q++){let j=J[q].content;if(G(j))console.log("[stx:bundler] bundling signal script imports"),j=await K(j,Z||"",{projectRoot:process.cwd()});j=j.replace(/^\s*import\s+(?:type\s+)?\{[^}]*\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,"// [stx import stripped \u2014 resolved via window.stx in __stx_setup]");let H=Y$(j);W.push(`// \u2500\u2500 merged signal script #${q+1} \u2500\u2500
8074
8074
  ${H}`)}let _=W.join(`
8075
8075
 
8076
8076
  `);_=nN(_);let B=M_(_),U=`
@@ -8082,22 +8082,22 @@ ${_}
8082
8082
  }
8083
8083
  if(window.stx)window.stx._latestSetup=${Q};
8084
8084
  </script>`,z=$;for(let q of J)z=z.split(q.fullMatch).join("");if(z.includes("<body"))z=z.replace(/<body([^>]*)>/,`<body$1 data-stx="${Q}">`);else{let q=["script","style","html","head","meta","link","title","!doctype"];z=z.replace(/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>/i,(j,H,O)=>{if(q.includes(H.toLowerCase()))return j;return`<${H}${O} data-stx="${Q}">`})}return{output:z,setupCode:U}}function M_($){let Z=$,Y=[],X=new Set,J=0,Q=0,G=Z.length,K=(U)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===U){Q++;return}Q++}},W=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let U=1;while(Q<G&&U>0)if(Z[Q]==="{")U++;else if(Z[Q]==="}")U--;else if(Z[Q]==="'"||Z[Q]==='"')K(Z[Q]);else if(Z[Q]==="`")W();else Q++;continue}Q++}},_=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
8085
- `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},B=()=>{if(J!==0)return;let U=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let j=U[2];if(!X.has(j))Y.push(j),X.add(j);return}let z=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let j=z[1];if(!X.has(j))Y.push(j),X.add(j);return}let q=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(q){let j=q[1];if(!X.has(j))Y.push(j),X.add(j)}};while(Q<G){if(_())continue;if(Z[Q]==="'"||Z[Q]==='"'){K(Z[Q]);continue}if(Z[Q]==="`"){W();continue}if(Z[Q]==="{"){J++,Q++;continue}if(Z[Q]==="}"){J--,Q++;continue}if(J===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))B();Q++}return Y.join(", ")}async function H2($,Z,Y){if(!F8($))return $;let X=$;if(Z.skipSignalsRuntime)return X;let{output:J,setupCode:Q}=await R_(X,Y);if(X=J,X=await F_(X,Z),X=L_(X),Q)if(X.includes("</head>"))X=X.replace("</head>",`${Q}
8085
+ `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},B=()=>{if(J!==0)return;let U=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let j=U[2];if(!X.has(j))Y.push(j),X.add(j);return}let z=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let j=z[1];if(!X.has(j))Y.push(j),X.add(j);return}let q=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(q){let j=q[1];if(!X.has(j))Y.push(j),X.add(j)}};while(Q<G){if(_())continue;if(Z[Q]==="'"||Z[Q]==='"'){K(Z[Q]);continue}if(Z[Q]==="`"){W();continue}if(Z[Q]==="{"){J++,Q++;continue}if(Z[Q]==="}"){J--,Q++;continue}if(J===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))B();Q++}return Y.join(", ")}async function jJ($,Z,Y){if(!F8($))return $;let X=$;if(Z.skipSignalsRuntime)return X;let{output:J,setupCode:Q}=await R_(X,Y);if(X=J,X=await F_(X,Z),X=L_(X),Q)if(X.includes("</head>"))X=X.replace("</head>",`${Q}
8086
8086
  </head>`);else if(X.includes("<body"))X=X.replace(/<body([^>]*)>/,`<body$1>
8087
8087
  ${Q}`);else X=X+`
8088
- `+Q;let G=X.match(/<body([^>]*)>/i),K=G&&/data-stx/.test(G[1]);if(!Q&&!K){if(X.includes("<body")&&G&&!/data-stx-auto/.test(G[1]))X=X.replace(/<body([^>]*)>/,"<body$1 data-stx-auto>")}return X}var lN=0,L8,N_;var O2=D(()=>{q0();L8=/<script\b([^>]*)>/gi,N_=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s});import W1 from"path";import L2 from"fs";function E_($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function I_($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class D_{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,Y,X){let J=$.endsWith(".stx")?$.slice(0,-4):$,Q=X?.__importedComponents;if(Q){let q=[J,J.toLowerCase(),E_(J),I_(J)];for(let j of q)if(Q.has(j))return Q.get(j)}let G=[...new Set([`${J}.stx`,`${E_(J)}.stx`,`${I_(J)}.stx`])];if(J.startsWith("./")||J.startsWith("../")){let q=W1.resolve(W1.dirname(Z),`${J}.stx`);if(await t(q))return q;return null}let K=[],W=Y.componentsDir||"",_=X?.__originalFilePath;if(_)K.push(W1.join(W1.dirname(_),"components"));if(W)K.push(W);let B=W1.join(W1.dirname(Z),"components");if(!K.includes(B))K.push(B);let U=process.cwd(),z=[W1.resolve(U,"src/components"),W1.resolve(U,"components"),W1.resolve(import.meta.dir,"components")];for(let q of z)if(!K.includes(q))K.push(q);for(let q of K){if(!q)continue;for(let j of G){let H=W1.join(q,j);if(await t(H))return H}try{if(!L2.statSync(q,{throwIfNoEntry:!1})?.isDirectory())continue;let H=L2.readdirSync(q,{withFileTypes:!0});for(let O of H)if(O.isDirectory()){let F=W1.join(q,O.name);for(let L of G){let V=W1.join(F,L);if(await t(V))return V}}}catch{}}return null}}var k1;var F2=D(()=>{q0();k1=new D_});function S1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function sN($){if($.clientReactive.to)return{value:$.clientReactive.to,reactive:!0};if($.serverDynamic.to!==void 0)return{value:String($.serverDynamic.to),reactive:!1};if(typeof $.static.to==="string")return{value:$.static.to,reactive:!1};return{value:"#",reactive:!1}}var V2;var N2=D(()=>{V2={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let X=sN($),J=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),Q=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",K=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,W=[];if(X.reactive)W.push(`:href="${S1(X.value)}"`);else W.push(`href="${S1(X.value)}"`);if(J)W.push(`class="${S1(J)}"`);if(W.push("data-stx-link"),W.push(`data-stx-active-class="${S1(Q)}"`),W.push(`data-stx-exact-active-class="${S1(G)}"`),K)W.push("data-stx-prefetch");for(let[B,U]of Object.entries($.events))W.push(`@${S1(B)}="${S1(U)}"`);let _=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);for(let[B,U]of Object.entries($.static)){if(_.has(B))continue;if(typeof U==="boolean"){if(U)W.push(S1(B))}else W.push(`${S1(B)}="${S1(U)}"`)}return`<a ${W.join(" ")}>${Z}</a>`}}});function C0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function n0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function w2($,Z,Y=!1){let X=$.serverDynamic[Z];if(X!==void 0)return X!==!1&&X!=="false";let J=$.static[Z];if(J!==void 0)return J!=="false"&&J!==!1;return Y}function k_($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let X of Z)if(X.includes(":")){let[J,Q]=X.split(":"),G=rN[J];if(G)Y.push(`(max-width: ${G}px) ${Q}`);else{let K=Number.parseInt(J);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${Q}`)}}else Y.push(X);return Y.join(", ")}function R2($,Z,Y,X){return Z.map((J)=>`${F4($,J,void 0,Y,X)} ${J}w`).join(", ")}function oN($,Z,Y,X,J){return Z.map((Q)=>{let G=Y?Y*Q:void 0;return`${F4($,G,void 0,X,J)} ${Q}x`}).join(", ")}function F4($,Z,Y,X,J){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let Q=[];if(Z)Q.push(`w_${Z}`);if(Y)Q.push(`h_${Y}`);if(J)Q.push(`f_${J}`);Q.push("q_auto");let G=Q.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(X==="imgix"){let Q=new URLSearchParams;if(Z)Q.set("w",String(Z));if(Y)Q.set("h",String(Y));if(J)Q.set("fm",J);Q.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}if(X==="bunny"){let Q=new URLSearchParams;if(Z)Q.set("width",String(Z));if(Y)Q.set("height",String(Y));if(J)Q.set("format",J);let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}return $}function aN($,Z,Y="#e5e7eb"){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${Y}"/></svg>`;return`data:image/svg+xml;base64,${btoa(X)}`}var rN,A2,M2;var T2=D(()=>{rN={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},A2=[320,640,768,1024,1280,1536,1920];M2={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let X=n0($,"src")||"",J=n0($,"alt")||"",Q=n0($,"width"),G=n0($,"height"),K=n0($,"sizes"),W=n0($,"srcset"),_=n0($,"densities"),B=n0($,"format"),U=n0($,"placeholder"),z=n0($,"placeholderColor")||"#e5e7eb",q=n0($,"provider"),j=n0($,"class")||n0($,"className")||"",H=n0($,"style")||"",O=n0($,"quality"),F=w2($,"lazy",!0),L=w2($,"preload",!1),V=w2($,"picture",!1)||!!B,A=Q?Number.parseInt(Q):void 0,N=G?Number.parseInt(G):void 0,w=W||"",M="";if(!w&&K)w=R2(X,A2,q,B),M=k_(K);else if(!w&&_){let P=_.split(/\s+/).map((x)=>Number.parseFloat(x.replace("x","")));w=oN(X,P,A,q,B)}else if(K)M=k_(K);let T=[];if(H)T.push(H);if(A&&N)T.push(`aspect-ratio:${A}/${N}`);if(U==="blur"||U==="color"){let P=aN(A||16,N||9,z);T.push(`background-image:url(${P})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(U&&U!=="empty"&&U!=="none")T.push(`background-image:url(${C0(U)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let I=F4(X,A,N,q,B),E=[];if(E.push(`src="${C0(I)}"`),E.push(`alt="${C0(J)}"`),Q)E.push(`width="${C0(Q)}"`);if(G)E.push(`height="${C0(G)}"`);if(F)E.push('loading="lazy"');if(E.push('decoding="async"'),j)E.push(`class="${C0(j)}"`);if(T.length>0)E.push(`style="${C0(T.join(";"))}"`);if(w)E.push(`srcset="${C0(w)}"`);if(M)E.push(`sizes="${C0(M)}"`);let S=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);for(let[P,x]of Object.entries($.static)){if(S.has(P))continue;if(typeof x==="boolean"){if(x)E.push(C0(P))}else E.push(`${C0(P)}="${C0(x)}"`)}let k=`<img ${E.join(" ")} />`,b="";if(L){let x=B==="webp"?"image/webp":B==="avif"?"image/avif":"";b=`<link rel="preload" as="image" href="${C0(I)}"${x?` type="${x}"`:""}${w?` imagesrcset="${C0(w)}"`:""}${M?` imagesizes="${C0(M)}"`:""} />
8089
- `}if(V){let P=[];if(B==="avif"||B==="auto"){let x=F4(X,A,N,q,"avif"),C=w?R2(X,A2,q,"avif"):`${x}`;P.push(`<source type="image/avif" srcset="${C0(C)}"${M?` sizes="${C0(M)}"`:""} />`)}if(B==="webp"||B==="auto"){let x=F4(X,A,N,q,"webp"),C=w?R2(X,A2,q,"webp"):`${x}`;P.push(`<source type="image/webp" srcset="${C0(C)}"${M?` sizes="${C0(M)}"`:""} />`)}return`${b}<picture>
8088
+ `+Q;let G=X.match(/<body([^>]*)>/i),K=G&&/data-stx/.test(G[1]);if(!Q&&!K){if(X.includes("<body")&&G&&!/data-stx-auto/.test(G[1]))X=X.replace(/<body([^>]*)>/,"<body$1 data-stx-auto>")}return X}var lN=0,L8,N_;var HJ=D(()=>{q0();L8=/<script\b([^>]*)>/gi,N_=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s});import W1 from"path";import OJ from"fs";function E_($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function I_($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class D_{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,Y,X){let J=$.endsWith(".stx")?$.slice(0,-4):$,Q=X?.__importedComponents;if(Q){let q=[J,J.toLowerCase(),E_(J),I_(J)];for(let j of q)if(Q.has(j))return Q.get(j)}let G=[...new Set([`${J}.stx`,`${E_(J)}.stx`,`${I_(J)}.stx`])];if(J.startsWith("./")||J.startsWith("../")){let q=W1.resolve(W1.dirname(Z),`${J}.stx`);if(await t(q))return q;return null}let K=[],W=Y.componentsDir||"",_=X?.__originalFilePath;if(_)K.push(W1.join(W1.dirname(_),"components"));if(W)K.push(W);let B=W1.join(W1.dirname(Z),"components");if(!K.includes(B))K.push(B);let U=process.cwd(),z=[W1.resolve(U,"src/components"),W1.resolve(U,"components"),W1.resolve(import.meta.dir,"components")];for(let q of z)if(!K.includes(q))K.push(q);for(let q of K){if(!q)continue;for(let j of G){let H=W1.join(q,j);if(await t(H))return H}try{if(!OJ.statSync(q,{throwIfNoEntry:!1})?.isDirectory())continue;let H=OJ.readdirSync(q,{withFileTypes:!0});for(let O of H)if(O.isDirectory()){let F=W1.join(q,O.name);for(let L of G){let V=W1.join(F,L);if(await t(V))return V}}}catch{}}return null}}var k1;var LJ=D(()=>{q0();k1=new D_});function S1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function sN($){if($.clientReactive.to)return{value:$.clientReactive.to,reactive:!0};if($.serverDynamic.to!==void 0)return{value:String($.serverDynamic.to),reactive:!1};if(typeof $.static.to==="string")return{value:$.static.to,reactive:!1};return{value:"#",reactive:!1}}var FJ;var VJ=D(()=>{FJ={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let X=sN($),J=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),Q=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",K=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,W=[];if(X.reactive)W.push(`:href="${S1(X.value)}"`);else W.push(`href="${S1(X.value)}"`);if(J)W.push(`class="${S1(J)}"`);if(W.push("data-stx-link"),W.push(`data-stx-active-class="${S1(Q)}"`),W.push(`data-stx-exact-active-class="${S1(G)}"`),K)W.push("data-stx-prefetch");for(let[B,U]of Object.entries($.events))W.push(`@${S1(B)}="${S1(U)}"`);let _=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);for(let[B,U]of Object.entries($.static)){if(_.has(B))continue;if(typeof U==="boolean"){if(U)W.push(S1(B))}else W.push(`${S1(B)}="${S1(U)}"`)}return`<a ${W.join(" ")}>${Z}</a>`}}});function C0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function n0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function AJ($,Z,Y=!1){let X=$.serverDynamic[Z];if(X!==void 0)return X!==!1&&X!=="false";let J=$.static[Z];if(J!==void 0)return J!=="false"&&J!==!1;return Y}function k_($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let X of Z)if(X.includes(":")){let[J,Q]=X.split(":"),G=rN[J];if(G)Y.push(`(max-width: ${G}px) ${Q}`);else{let K=Number.parseInt(J);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${Q}`)}}else Y.push(X);return Y.join(", ")}function wJ($,Z,Y,X){return Z.map((J)=>`${F4($,J,void 0,Y,X)} ${J}w`).join(", ")}function oN($,Z,Y,X,J){return Z.map((Q)=>{let G=Y?Y*Q:void 0;return`${F4($,G,void 0,X,J)} ${Q}x`}).join(", ")}function F4($,Z,Y,X,J){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let Q=[];if(Z)Q.push(`w_${Z}`);if(Y)Q.push(`h_${Y}`);if(J)Q.push(`f_${J}`);Q.push("q_auto");let G=Q.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(X==="imgix"){let Q=new URLSearchParams;if(Z)Q.set("w",String(Z));if(Y)Q.set("h",String(Y));if(J)Q.set("fm",J);Q.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}if(X==="bunny"){let Q=new URLSearchParams;if(Z)Q.set("width",String(Z));if(Y)Q.set("height",String(Y));if(J)Q.set("format",J);let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}return $}function aN($,Z,Y="#e5e7eb"){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${Y}"/></svg>`;return`data:image/svg+xml;base64,${btoa(X)}`}var rN,NJ,RJ;var MJ=D(()=>{rN={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},NJ=[320,640,768,1024,1280,1536,1920];RJ={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let X=n0($,"src")||"",J=n0($,"alt")||"",Q=n0($,"width"),G=n0($,"height"),K=n0($,"sizes"),W=n0($,"srcset"),_=n0($,"densities"),B=n0($,"format"),U=n0($,"placeholder"),z=n0($,"placeholderColor")||"#e5e7eb",q=n0($,"provider"),j=n0($,"class")||n0($,"className")||"",H=n0($,"style")||"",O=n0($,"quality"),F=AJ($,"lazy",!0),L=AJ($,"preload",!1),V=AJ($,"picture",!1)||!!B,A=Q?Number.parseInt(Q):void 0,N=G?Number.parseInt(G):void 0,w=W||"",M="";if(!w&&K)w=wJ(X,NJ,q,B),M=k_(K);else if(!w&&_){let P=_.split(/\s+/).map((x)=>Number.parseFloat(x.replace("x","")));w=oN(X,P,A,q,B)}else if(K)M=k_(K);let T=[];if(H)T.push(H);if(A&&N)T.push(`aspect-ratio:${A}/${N}`);if(U==="blur"||U==="color"){let P=aN(A||16,N||9,z);T.push(`background-image:url(${P})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(U&&U!=="empty"&&U!=="none")T.push(`background-image:url(${C0(U)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let I=F4(X,A,N,q,B),E=[];if(E.push(`src="${C0(I)}"`),E.push(`alt="${C0(J)}"`),Q)E.push(`width="${C0(Q)}"`);if(G)E.push(`height="${C0(G)}"`);if(F)E.push('loading="lazy"');if(E.push('decoding="async"'),j)E.push(`class="${C0(j)}"`);if(T.length>0)E.push(`style="${C0(T.join(";"))}"`);if(w)E.push(`srcset="${C0(w)}"`);if(M)E.push(`sizes="${C0(M)}"`);let S=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);for(let[P,x]of Object.entries($.static)){if(S.has(P))continue;if(typeof x==="boolean"){if(x)E.push(C0(P))}else E.push(`${C0(P)}="${C0(x)}"`)}let k=`<img ${E.join(" ")} />`,b="";if(L){let x=B==="webp"?"image/webp":B==="avif"?"image/avif":"";b=`<link rel="preload" as="image" href="${C0(I)}"${x?` type="${x}"`:""}${w?` imagesrcset="${C0(w)}"`:""}${M?` imagesizes="${C0(M)}"`:""} />
8089
+ `}if(V){let P=[];if(B==="avif"||B==="auto"){let x=F4(X,A,N,q,"avif"),C=w?wJ(X,NJ,q,"avif"):`${x}`;P.push(`<source type="image/avif" srcset="${C0(C)}"${M?` sizes="${C0(M)}"`:""} />`)}if(B==="webp"||B==="auto"){let x=F4(X,A,N,q,"webp"),C=w?wJ(X,NJ,q,"webp"):`${x}`;P.push(`<source type="image/webp" srcset="${C0(C)}"${M?` sizes="${C0(M)}"`:""} />`)}return`${b}<picture>
8090
8090
  ${P.join(`
8091
8091
  `)}
8092
8092
  ${k}
8093
- </picture>`}return`${b}${k}`}}});function E2($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function V4($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function V8($,Z,Y){let X=V4($,Z);if(X!==void 0){let J=Number.parseInt(X,10);if(!Number.isNaN(J))return J}return Y}var I2;var D2=D(()=>{I2={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,Y){let X=E2(V4($,"color")||"#6366f1"),J=E2(V4($,"initialColor")||V4($,"initial-color")||""),Q=E2(V4($,"height")||"3px"),G=V8($,"duration",2000),K=V8($,"throttle",200),W=V8($,"zIndex",999999)||V8($,"z-index",999999),_=J?`linear-gradient(to right, ${J}, ${X})`:X;return`
8093
+ </picture>`}return`${b}${k}`}}});function TJ($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function V4($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function V8($,Z,Y){let X=V4($,Z);if(X!==void 0){let J=Number.parseInt(X,10);if(!Number.isNaN(J))return J}return Y}var EJ;var IJ=D(()=>{EJ={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,Y){let X=TJ(V4($,"color")||"#6366f1"),J=TJ(V4($,"initialColor")||V4($,"initial-color")||""),Q=TJ(V4($,"height")||"3px"),G=V8($,"duration",2000),K=V8($,"throttle",200),W=V8($,"zIndex",999999)||V8($,"z-index",999999),_=J?`linear-gradient(to right, ${J}, ${X})`:X;return`
8094
8094
  <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${Q};background:${_};z-index:${W};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
8095
8095
  <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>
8096
8096
  </div>
8097
8097
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
8098
8098
  <script>
8099
8099
  (function(){var el=document.getElementById('stx-loading-indicator'),p=0,l=!1,i=null;function u(v){p=Math.min(Math.max(v,0),100);if(el){el.style.opacity=p>0?'1':'0';el.style.transform='scaleX('+(p/100)+')'}}window.stxLoading={start:function(){l=!0;p=0;u(10);if(i)clearInterval(i);i=setInterval(function(){if(!l)return;var r=90-p,inc=Math.max(0.5,r*0.1);if(p<90)u(p+inc)},${K})},finish:function(){l=!1;if(i){clearInterval(i);i=null}u(100);setTimeout(function(){if(el)el.style.opacity='0';setTimeout(function(){p=0;if(el)el.style.transform='scaleX(0)'},300)},200)},set:function(v){u(v)},clear:function(){l=!1;p=0;if(i){clearInterval(i);i=null}if(el){el.style.opacity='0';el.style.transform='scaleX(0)'}}};document.addEventListener('click',function(e){var a=e.target.closest&&e.target.closest('a');if(!a)return;var h=a.getAttribute('href');if(!h||h.startsWith('http')||h.startsWith('#')||h.startsWith('mailto:')||h.startsWith('tel:')||a.target==='_blank')return;window.stxLoading.start()});window.addEventListener('popstate',function(){window.stxLoading.start()});window.addEventListener('load',function(){window.stxLoading.finish()})})();
8100
- </script>`}}});function b_($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function tN($,Z,Y){let X=b_($,Z);if(X!==void 0){let J=Number.parseInt(X,10);if(!Number.isNaN(J))return J}return Y}var S_,k2;var S2=D(()=>{S_={"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%)"},k2={name:"StxToast",aliases:["stx-toast"],render($,Z,Y){let X=b_($,"position")||"top-right",J=tN($,"max",5),Q=S_[X]||S_["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${X}" data-stx-toast-max="${J}" style="position:fixed;${Q};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
8100
+ </script>`}}});function b_($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function tN($,Z,Y){let X=b_($,Z);if(X!==void 0){let J=Number.parseInt(X,10);if(!Number.isNaN(J))return J}return Y}var S_,DJ;var kJ=D(()=>{S_={"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%)"},DJ={name:"StxToast",aliases:["stx-toast"],render($,Z,Y){let X=b_($,"position")||"top-right",J=tN($,"max",5),Q=S_[X]||S_["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${X}" data-stx-toast-max="${J}" style="position:fixed;${Q};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
8101
8101
  <style>
8102
8102
  @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
8103
8103
  @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
@@ -8105,7 +8105,7 @@ ${k}
8105
8105
  @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
8106
8106
  @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
8107
8107
  @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
8108
- </style>`}}});function N8($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var C_,b2;var C2=D(()=>{C_={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)"},b2={name:"StxModal",aliases:["stx-modal"],render($,Z,Y){let X=N8($,"id");if(!X)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let J=N8($,"size")||"md",Q=N8($,"closeOnBackdrop")!=="false",G=N8($,"closeOnEscape")!=="false",K=C_[J]||C_.md;return`<div id="stx-modal-${X}" class="stx-modal-backdrop" data-stx-modal="${X}" data-close-backdrop="${Q}" data-close-escape="${G}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
8108
+ </style>`}}});function N8($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var C_,SJ;var bJ=D(()=>{C_={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)"},SJ={name:"StxModal",aliases:["stx-modal"],render($,Z,Y){let X=N8($,"id");if(!X)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let J=N8($,"size")||"md",Q=N8($,"closeOnBackdrop")!=="false",G=N8($,"closeOnEscape")!=="false",K=C_[J]||C_.md;return`<div id="stx-modal-${X}" class="stx-modal-backdrop" data-stx-modal="${X}" data-close-backdrop="${Q}" data-close-escape="${G}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
8109
8109
  <div class="stx-modal-panel" style="${K};width:100%;margin:1rem;border-radius:0.75rem;box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow:hidden;transform:scale(0.95) translateY(8px);transition:transform 0.2s ease,opacity 0.2s ease;opacity:0;background:var(--stx-modal-bg,#fff);color:var(--stx-modal-text,#1f2937)">
8110
8110
  <div style="padding:1.5rem">${Z}</div>
8111
8111
  </div>
@@ -8114,7 +8114,7 @@ ${k}
8114
8114
  @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
8115
8115
  .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
8116
8116
  .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
8117
- </style>`}}});function s5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var y_,y2;var P2=D(()=>{y_={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},y2={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,Y){let X=s5($,"id");if(!X)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let J=s5($,"side")||"right",Q=s5($,"size")||"md",G=s5($,"closeOnBackdrop")!=="false",K=s5($,"closeOnEscape")!=="false",W=s5($,"overlay")!=="false",_=y_[Q]||y_.md,B=J==="left",U=B?"left:0":"right:0",z=B?"translateX(-100%)":"translateX(100%)",q=B?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${X}" class="stx-drawer-backdrop" data-stx-drawer="${X}" data-close-backdrop="${G}" data-close-escape="${K}" style="display:none;position:fixed;inset:0;z-index:99999;${W?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
8117
+ </style>`}}});function s5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var y_,CJ;var yJ=D(()=>{y_={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},CJ={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,Y){let X=s5($,"id");if(!X)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let J=s5($,"side")||"right",Q=s5($,"size")||"md",G=s5($,"closeOnBackdrop")!=="false",K=s5($,"closeOnEscape")!=="false",W=s5($,"overlay")!=="false",_=y_[Q]||y_.md,B=J==="left",U=B?"left:0":"right:0",z=B?"translateX(-100%)":"translateX(100%)",q=B?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${X}" class="stx-drawer-backdrop" data-stx-drawer="${X}" data-close-backdrop="${G}" data-close-escape="${K}" style="display:none;position:fixed;inset:0;z-index:99999;${W?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
8118
8118
  <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${U};width:${_};max-width:100vw;transform:${z};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">
8119
8119
  <div style="padding:1.5rem">${Z}</div>
8120
8120
  </div>
@@ -8123,19 +8123,19 @@ ${k}
8123
8123
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
8124
8124
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
8125
8125
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
8126
- </style>`}}});var v_={};Q0(v_,{preloadIconCollection:()=>x_,IconBuiltin:()=>A8});async function P_($){if(N4.has($))return N4.get($);try{let Z=K0.resolve(`@iconify/json/json/${$}.json`),Y=await Bun.file(Z).json();return N4.set($,Y.icons),Y.icons}catch{try{let Y=`${process.cwd()}/node_modules/@iconify/json/json/${$}.json`,X=Bun.file(Y);if(await X.exists()){let J=await X.json();return N4.set($,J.icons),J.icons}}catch{}}return null}function r5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);if($.static[Z]!==void 0)return String($.static[Z]);if($.clientReactive[Z]!==void 0)return $.clientReactive[Z];return}async function x_($="lucide"){await P_($)}var N4,A8;var w8=D(()=>{N4=new Map;A8={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let X=r5($,"name")??r5($,"icon");if(!X)return"<!-- Icon: missing name/icon prop -->";let J="lucide",Q=X;if(X.includes(":")){let L=X.split(":");J=L[0],Q=L[1]}let G=r5($,"size")||"24",K=r5($,"color")||"currentColor",W=r5($,"class")||"",_=r5($,"style")||"",B=N4.get(J);if(!B)return P_(J),`<!-- Icon: collection "${J}" not loaded -->`;let U=B[Q];if(!U)return`<!-- Icon: "${Q}" not found in ${J} -->`;let z=U.width||24,q=U.height||24,j=`0 0 ${z} ${q}`,H=U.body;if(K!=="currentColor")H=H.replace(/currentColor/g,K);let O=W?` class="${W}"`:"",F=_?` style="${_}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${j}" fill="none"${O}${F}>${H}</svg>`}}});function f_(){k1.registerBuiltin(V2),k1.registerBuiltin(M2),k1.registerBuiltin(I2),k1.registerBuiltin(k2),k1.registerBuiltin(b2),k1.registerBuiltin(y2),k1.registerBuiltin(A8)}var g_=D(()=>{N2();T2();D2();S2();C2();P2();w8();F2();N2();T2();D2();S2();C2();P2();w8()});function h_($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function d_($,Z,Y){let X=[],J=0;while(J<$.length){let Q=$.indexOf("<",J);if(Q===-1)break;let K=$.slice(Q+1).match(new RegExp(`^(${Z.source})`));if(!K){J=Q+1;continue}let W=K[1];if(Y&&Y.has(W.toLowerCase())){let H=Q+1+W.length;while(H<$.length&&$[H]!==">")H++;J=H+1;continue}let _=Q+1+W.length,B=null,U=_,z=-1,q=!1;while(_<$.length){let H=$[_];if(B){if(H==="\\"&&_+1<$.length){_+=2;continue}if(H===B)B=null;_++;continue}if(H==='"'||H==="'"){B=H,_++;continue}if(H==="/"&&_+1<$.length&&$[_+1]===">"){z=_+2,q=!0;break}if(H===">"){z=_+1;break}_++}if(z===-1){J=Q+1;continue}let j=$.slice(U,q?z-2:z-1).trim();if(q)X.push({fullMatch:$.slice(Q,z),tagName:W,attributes:j,content:"",startIndex:Q,endIndex:z,isSelfClosing:!0}),J=z;else{let H=`<${W}`,O=`</${W}>`,F=1,L=z,V=-1;while(F>0&&L<$.length){let w=$.indexOf(H,L),M=$.indexOf(O,L);if(M===-1)break;if(w!==-1&&w<M){let T=$[w+H.length];if(T===" "||T===">"||T==="/"||T===`
8127
- `||T==="\t")F++;L=w+H.length}else{if(F--,F===0){V=M;break}L=M+O.length}}if(V===-1){J=z;continue}let A=$.slice(z,V),N=V+O.length;X.push({fullMatch:$.slice(Q,N),tagName:W,attributes:j,content:A,startIndex:Q,endIndex:N,isSelfClosing:!1}),J=N}}return X}var u_=D(()=>{h0();q0()});import o5 from"path";function $A($,Z,Y){let X={static:{},serverDynamic:{},clientReactive:{},events:{}},J=new Set(["x-cloak","x-show","x-if","x-for","x-data","x-init","x-transition","x-ref","x-effect","x-model","x-text","x-html","x-class","x-style","x-on","x-bind"]),Q=(G)=>{if(!G.includes("-")||G.startsWith("@")||G.startsWith(":")||G.startsWith("x-")||G.startsWith("__"))return G;return G.replace(/-([a-z0-9])/g,(K,W)=>W.toUpperCase())};for(let[G,K]of Object.entries($)){let W=G.startsWith("x-")&&!J.has(G)&&!G.startsWith("x-bind:")&&!G.startsWith("x-on:")?`:${G.slice(2)}`:G;if(W.startsWith("@")){X.events[W]=K;continue}if(W.startsWith("__stx_")){let _=Q(W.slice(6));try{let B=K.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");X.serverDynamic[_]=JSON.parse(B)}catch(B){if(Y.debug)console.error(`Error parsing __stx_${_}:`,B);X.serverDynamic[_]=K}continue}if(W.startsWith(":")){let _=Q(W.slice(1)),B=K==="true"?_:K;try{if(!B0(B)){if(Y.debug)console.error(`Unsafe expression in :${_} binding: ${B}`);X.clientReactive[_]=B;continue}let U=Object.keys(Z),q=j0(B,U)(...Object.values(Z));if(q===void 0){let j=B.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],H=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(j.some((F)=>!H.has(F)&&!U.includes(F))){X.clientReactive[_]=B;continue}}X.serverDynamic[_]=q}catch{X.clientReactive[_]=B}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let _=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(_)try{let B=_[1];if(B0(B)){let z=j0(B,Object.keys(Z))(...Object.values(Z));X.static[W]=z!=null?String(z):""}else{if(Y.debug)console.error(`Unsafe expression in ${W}: ${B}`);X.static[W]=K}}catch(B){if(Y.debug)console.error(`Error evaluating expression for ${W}:`,B);X.static[W]=K}else{let B=K,U=/\{\{\s*([\s\S]+?)\s*\}\}/g,z;while((z=U.exec(K))!==null)try{let q=z[1];if(!B0(q)){if(Y.debug)console.error(`Unsafe expression in ${W}: ${q}`);continue}let H=j0(q,Object.keys(Z))(...Object.values(Z));B=B.replace(z[0],String(H??""))}catch(q){if(Y.debug)console.error(`Error evaluating expression in ${W}:`,q)}X.static[W]=B}continue}X.static[W]=K}return X}function ZA($){let Z={},Y=0,X=$.length;while(Y<X){while(Y<X&&/\s/.test($[Y]))Y++;if(Y>=X)break;let J="";while(Y<X&&!/[\s=]/.test($[Y]))J+=$[Y],Y++;if(!J)break;while(Y<X&&/\s/.test($[Y]))Y++;if(Y<X&&$[Y]==="="){Y++;while(Y<X&&/\s/.test($[Y]))Y++;let Q="";if(Y<X&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<X){let K=$[Y];if(K==="\\"&&Y+1<X){Y++,Q+=$[Y],Y++;continue}if(K===G){Y++;break}Q+=K,Y++}}else while(Y<X&&!/\s/.test($[Y]))Q+=$[Y],Y++;Z[J]=Q}else Z[J]="true"}return Z}async function YA($,Z,Y,X,J){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,W;while((W=K.exec(Q))!==null){let[_,B]=W,U=B.split(",").map((z)=>z.trim().replace(/^['"]|['"]$/g,"")).filter((z)=>z.length>0);for(let z of U){let q=z.split("/"),H=q[q.length-1].replace(/\.stx$/,""),O=H.includes("-")?H.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),F=null,L=[o5.resolve(o5.dirname(Y),`${z}.stx`),o5.resolve(o5.dirname(Y),z),o5.resolve(X.componentsDir||"components",`${z}.stx`),o5.resolve(X.componentsDir||"components",z),z.endsWith(".stx")?z:`${z}.stx`];for(let V of L)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(O,F),G.set(H,F),G.set(H.toLowerCase(),F);let V=O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),J.add(F),X.debug)console.log(`Imported component: ${O} -> ${F}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${z}`)}Q=Q.replace(_,""),K.lastIndex=0}return Q}async function XA($,Z,Y,X,J){let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,W=/@component\s*\(/g,_;while((_=W.exec(Q))!==null){let B=_.index,U=B+_[0].length-1,z=1,q=U+1;while(q<Q.length&&z>0){if(Q[q]==="(")z++;else if(Q[q]===")"){if(z--,z===0)break}q++}if(z!==0)break;let j=Q.substring(U+1,q),H=q+1,O=j.match(/^\s*['"]([^'"]+)['"]/);if(!O){W.lastIndex=0;continue}let F=O[1],L,V=j.slice(O[0].length),A=V.match(/^\s*,\s*/);if(A)L=V.slice(A[0].length).trim();let N={};if(L)try{N=k0(L,Z)}catch(S){let k=S instanceof Error?S.message:String(S);Q=Q.replace(Q.substring(B,H),`[Error parsing component props: ${k}]`);continue}let w="",M=H,I=Q.substring(H).match(/^([\s\S]*?)@endcomponent/);if(I)w=I[1].trim(),M=H+I[0].length;let E=await D1(F,N,w,G,Z,Y,X,K,J);Q=Q.substring(0,B)+E+Q.substring(M),W.lastIndex=0}return Q}async function JA($,Z,Y,X,J){if(!$)return $;let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents;return Q=await U(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await U(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await U(Q,/[a-z][a-z0-9]*/,!1,eN),Q;async function U(z,q,j,H){if(!z)return z;let O=z,F=d_(O,q,H);for(let L=F.length-1;L>=0;L--){let V=F[L],A=j?h_(V.tagName):V.tagName,N=ZA(V.attributes),w=$A(N,Z,X),M=k1.getBuiltin(V.tagName);if(M){let S={context:Z,filePath:Y,options:X,dependencies:J},k=M.render(w,V.content,S);if(Object.keys(w.clientReactive).length>0)k=p_(k,w.clientReactive);if(Object.keys(w.events).length>0){let b=Object.entries(w.events).map(([P,x])=>`${P}="${x.replace(/"/g,"&quot;")}"`).join(" ");k=k.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${b}`)}O=O.substring(0,V.startIndex)+k+O.substring(V.endIndex);continue}let T={};for(let[S,k]of Object.entries(w.static))T[S]=k;for(let[S,k]of Object.entries(w.serverDynamic))T[S]=k;let E=await D1(A,T,V.content,G,Z,Y,X,K,J);if(Object.keys(w.clientReactive).length>0)E=p_(E,w.clientReactive);if(Object.keys(w.events).length>0){let S=E.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(S){let k=Object.entries(w.events).map(([P,x])=>`${P}="${x}"`).join(" "),b=S[1].length+S[2].length;E=E.substring(0,b)+" "+k+E.substring(b)}}O=O.substring(0,V.startIndex)+E+O.substring(V.endIndex)}return O}}function p_($,Z){let Y=$.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(!Y)return $;let X=Object.entries(Z).map(([Q,G])=>`:${Q}="${G.replace(/"/g,"&quot;")}"`).join(" "),J=Y[1].length+Y[2].length;return $.substring(0,J)+" "+X+$.substring(J)}async function x2($,Z,Y,X,J){if(!m_)f_(),m_=!0;let Q=await YA($,Z,Y,X,J);Q=await XA(Q,Z,Y,X,J);for(let G=0;G<3;G++){let K=Q;if(Q=await JA(Q,Z,Y,X,J),Q===K)break}return Q}var m_=!1,eN;var c_=D(()=>{F2();g_();u_();q0();h0();eN=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"])});import a5 from"path";function l_($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}function i_($,Z,Y){try{let X;if($.startsWith("/")){let J=Z;for(let Q=0;Q<5;Q++){let G=a5.join(J,$);if(K0("fs").existsSync(G))return G;J=a5.dirname(J)}X=a5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))X=a5.resolve(Z,$);else X=a5.resolve(Z,$);if(K0("fs").existsSync(X))return X;return null}catch{return null}}async function n_($,Z,Y){let X=$,J=a5.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(X))!==null){let[_,B,U,z]=G;if(l_(U))continue;let q=i_(U,J,Z);if(q)try{let j=await Bun.file(q).text();if(Y.add(q),U.endsWith(".ts")||U.endsWith(".tsx")){let O=await Bun.build({entrypoints:[q],target:"browser",minify:!1,define:K1()});if(O.outputs.length>0)j=await O.outputs[0].text()}let H=`<script>
8126
+ </style>`}}});var v_={};Q0(v_,{preloadIconCollection:()=>x_,IconBuiltin:()=>A8});async function P_($){if(N4.has($))return N4.get($);try{let Z=K0.resolve(`@iconify/json/json/${$}.json`),Y=await Bun.file(Z).json();return N4.set($,Y.icons),Y.icons}catch{try{let Y=`${process.cwd()}/node_modules/@iconify/json/json/${$}.json`,X=Bun.file(Y);if(await X.exists()){let J=await X.json();return N4.set($,J.icons),J.icons}}catch{}}return null}function r5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);if($.static[Z]!==void 0)return String($.static[Z]);if($.clientReactive[Z]!==void 0)return $.clientReactive[Z];return}async function x_($="lucide"){await P_($)}var N4,A8;var w8=D(()=>{N4=new Map;A8={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let X=r5($,"name")??r5($,"icon");if(!X)return"<!-- Icon: missing name/icon prop -->";let J="lucide",Q=X;if(X.includes(":")){let L=X.split(":");J=L[0],Q=L[1]}let G=r5($,"size")||"24",K=r5($,"color")||"currentColor",W=r5($,"class")||"",_=r5($,"style")||"",B=N4.get(J);if(!B)return P_(J),`<!-- Icon: collection "${J}" not loaded -->`;let U=B[Q];if(!U)return`<!-- Icon: "${Q}" not found in ${J} -->`;let z=U.width||24,q=U.height||24,j=`0 0 ${z} ${q}`,H=U.body;if(K!=="currentColor")H=H.replace(/currentColor/g,K);let O=W?` class="${W}"`:"",F=_?` style="${_}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${j}" fill="none"${O}${F}>${H}</svg>`}}});function f_(){k1.registerBuiltin(FJ),k1.registerBuiltin(RJ),k1.registerBuiltin(EJ),k1.registerBuiltin(DJ),k1.registerBuiltin(SJ),k1.registerBuiltin(CJ),k1.registerBuiltin(A8)}var g_=D(()=>{VJ();MJ();IJ();kJ();bJ();yJ();w8();LJ();VJ();MJ();IJ();kJ();bJ();yJ();w8()});function h_($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function d_($,Z,Y){let X=[],J=0;while(J<$.length){let Q=$.indexOf("<",J);if(Q===-1)break;let K=$.slice(Q+1).match(new RegExp(`^(${Z.source})`));if(!K){J=Q+1;continue}let W=K[1];if(Y&&Y.has(W.toLowerCase())){let H=Q+1+W.length;while(H<$.length&&$[H]!==">")H++;J=H+1;continue}let _=Q+1+W.length,B=null,U=_,z=-1,q=!1;while(_<$.length){let H=$[_];if(B){if(H==="\\"&&_+1<$.length){_+=2;continue}if(H===B)B=null;_++;continue}if(H==='"'||H==="'"){B=H,_++;continue}if(H==="/"&&_+1<$.length&&$[_+1]===">"){z=_+2,q=!0;break}if(H===">"){z=_+1;break}_++}if(z===-1){J=Q+1;continue}let j=$.slice(U,q?z-2:z-1).trim();if(q)X.push({fullMatch:$.slice(Q,z),tagName:W,attributes:j,content:"",startIndex:Q,endIndex:z,isSelfClosing:!0}),J=z;else{let H=`<${W}`,O=`</${W}>`,F=1,L=z,V=-1;while(F>0&&L<$.length){let w=$.indexOf(H,L),M=$.indexOf(O,L);if(M===-1)break;if(w!==-1&&w<M){let T=$[w+H.length];if(T===" "||T===">"||T==="/"||T===`
8127
+ `||T==="\t")F++;L=w+H.length}else{if(F--,F===0){V=M;break}L=M+O.length}}if(V===-1){J=z;continue}let A=$.slice(z,V),N=V+O.length;X.push({fullMatch:$.slice(Q,N),tagName:W,attributes:j,content:A,startIndex:Q,endIndex:N,isSelfClosing:!1}),J=N}}return X}var u_=D(()=>{h0();q0()});import o5 from"path";function $A($,Z,Y){let X={static:{},serverDynamic:{},clientReactive:{},events:{}},J=new Set(["x-cloak","x-show","x-if","x-for","x-data","x-init","x-transition","x-ref","x-effect","x-model","x-text","x-html","x-class","x-style","x-on","x-bind"]),Q=(G)=>{if(!G.includes("-")||G.startsWith("@")||G.startsWith(":")||G.startsWith("x-")||G.startsWith("__"))return G;return G.replace(/-([a-z0-9])/g,(K,W)=>W.toUpperCase())};for(let[G,K]of Object.entries($)){let W=G.startsWith("x-")&&!J.has(G)&&!G.startsWith("x-bind:")&&!G.startsWith("x-on:")?`:${G.slice(2)}`:G;if(W.startsWith("@")){X.events[W]=K;continue}if(W.startsWith("__stx_")){let _=Q(W.slice(6));try{let B=K.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");X.serverDynamic[_]=JSON.parse(B)}catch(B){if(Y.debug)console.error(`Error parsing __stx_${_}:`,B);X.serverDynamic[_]=K}continue}if(W.startsWith(":")){let _=Q(W.slice(1)),B=K==="true"?_:K;try{if(!B0(B)){if(Y.debug)console.error(`Unsafe expression in :${_} binding: ${B}`);X.clientReactive[_]=B;continue}let U=Object.keys(Z),q=j0(B,U)(...Object.values(Z));if(q===void 0){let j=B.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],H=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(j.some((F)=>!H.has(F)&&!U.includes(F))){X.clientReactive[_]=B;continue}}X.serverDynamic[_]=q}catch{X.clientReactive[_]=B}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let _=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(_)try{let B=_[1];if(B0(B)){let z=j0(B,Object.keys(Z))(...Object.values(Z));X.static[W]=z!=null?String(z):""}else{if(Y.debug)console.error(`Unsafe expression in ${W}: ${B}`);X.static[W]=K}}catch(B){if(Y.debug)console.error(`Error evaluating expression for ${W}:`,B);X.static[W]=K}else{let B=K,U=/\{\{\s*([\s\S]+?)\s*\}\}/g,z;while((z=U.exec(K))!==null)try{let q=z[1];if(!B0(q)){if(Y.debug)console.error(`Unsafe expression in ${W}: ${q}`);continue}let H=j0(q,Object.keys(Z))(...Object.values(Z));B=B.replace(z[0],String(H??""))}catch(q){if(Y.debug)console.error(`Error evaluating expression in ${W}:`,q)}X.static[W]=B}continue}X.static[W]=K}return X}function ZA($){let Z={},Y=0,X=$.length;while(Y<X){while(Y<X&&/\s/.test($[Y]))Y++;if(Y>=X)break;let J="";while(Y<X&&!/[\s=]/.test($[Y]))J+=$[Y],Y++;if(!J)break;while(Y<X&&/\s/.test($[Y]))Y++;if(Y<X&&$[Y]==="="){Y++;while(Y<X&&/\s/.test($[Y]))Y++;let Q="";if(Y<X&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<X){let K=$[Y];if(K==="\\"&&Y+1<X){Y++,Q+=$[Y],Y++;continue}if(K===G){Y++;break}Q+=K,Y++}}else while(Y<X&&!/\s/.test($[Y]))Q+=$[Y],Y++;Z[J]=Q}else Z[J]="true"}return Z}async function YA($,Z,Y,X,J){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,W;while((W=K.exec(Q))!==null){let[_,B]=W,U=B.split(",").map((z)=>z.trim().replace(/^['"]|['"]$/g,"")).filter((z)=>z.length>0);for(let z of U){let q=z.split("/"),H=q[q.length-1].replace(/\.stx$/,""),O=H.includes("-")?H.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),F=null,L=[o5.resolve(o5.dirname(Y),`${z}.stx`),o5.resolve(o5.dirname(Y),z),o5.resolve(X.componentsDir||"components",`${z}.stx`),o5.resolve(X.componentsDir||"components",z),z.endsWith(".stx")?z:`${z}.stx`];for(let V of L)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(O,F),G.set(H,F),G.set(H.toLowerCase(),F);let V=O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),J.add(F),X.debug)console.log(`Imported component: ${O} -> ${F}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${z}`)}Q=Q.replace(_,""),K.lastIndex=0}return Q}async function XA($,Z,Y,X,J){let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,W=/@component\s*\(/g,_;while((_=W.exec(Q))!==null){let B=_.index,U=B+_[0].length-1,z=1,q=U+1;while(q<Q.length&&z>0){if(Q[q]==="(")z++;else if(Q[q]===")"){if(z--,z===0)break}q++}if(z!==0)break;let j=Q.substring(U+1,q),H=q+1,O=j.match(/^\s*['"]([^'"]+)['"]/);if(!O){W.lastIndex=0;continue}let F=O[1],L,V=j.slice(O[0].length),A=V.match(/^\s*,\s*/);if(A)L=V.slice(A[0].length).trim();let N={};if(L)try{N=k0(L,Z)}catch(S){let k=S instanceof Error?S.message:String(S);Q=Q.replace(Q.substring(B,H),`[Error parsing component props: ${k}]`);continue}let w="",M=H,I=Q.substring(H).match(/^([\s\S]*?)@endcomponent/);if(I)w=I[1].trim(),M=H+I[0].length;let E=await D1(F,N,w,G,Z,Y,X,K,J);Q=Q.substring(0,B)+E+Q.substring(M),W.lastIndex=0}return Q}async function JA($,Z,Y,X,J){if(!$)return $;let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents;return Q=await U(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await U(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await U(Q,/[a-z][a-z0-9]*/,!1,eN),Q;async function U(z,q,j,H){if(!z)return z;let O=z,F=d_(O,q,H);for(let L=F.length-1;L>=0;L--){let V=F[L],A=j?h_(V.tagName):V.tagName,N=ZA(V.attributes),w=$A(N,Z,X),M=k1.getBuiltin(V.tagName);if(M){let S={context:Z,filePath:Y,options:X,dependencies:J},k=M.render(w,V.content,S);if(Object.keys(w.clientReactive).length>0)k=p_(k,w.clientReactive);if(Object.keys(w.events).length>0){let b=Object.entries(w.events).map(([P,x])=>`${P}="${x.replace(/"/g,"&quot;")}"`).join(" ");k=k.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${b}`)}O=O.substring(0,V.startIndex)+k+O.substring(V.endIndex);continue}let T={};for(let[S,k]of Object.entries(w.static))T[S]=k;for(let[S,k]of Object.entries(w.serverDynamic))T[S]=k;let E=await D1(A,T,V.content,G,Z,Y,X,K,J);if(Object.keys(w.clientReactive).length>0)E=p_(E,w.clientReactive);if(Object.keys(w.events).length>0){let S=E.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(S){let k=Object.entries(w.events).map(([P,x])=>`${P}="${x}"`).join(" "),b=S[1].length+S[2].length;E=E.substring(0,b)+" "+k+E.substring(b)}}O=O.substring(0,V.startIndex)+E+O.substring(V.endIndex)}return O}}function p_($,Z){let Y=$.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(!Y)return $;let X=Object.entries(Z).map(([Q,G])=>`:${Q}="${G.replace(/"/g,"&quot;")}"`).join(" "),J=Y[1].length+Y[2].length;return $.substring(0,J)+" "+X+$.substring(J)}async function PJ($,Z,Y,X,J){if(!m_)f_(),m_=!0;let Q=await YA($,Z,Y,X,J);Q=await XA(Q,Z,Y,X,J);for(let G=0;G<3;G++){let K=Q;if(Q=await JA(Q,Z,Y,X,J),Q===K)break}return Q}var m_=!1,eN;var c_=D(()=>{LJ();g_();u_();q0();h0();eN=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"])});import a5 from"path";function l_($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}function i_($,Z,Y){try{let X;if($.startsWith("/")){let J=Z;for(let Q=0;Q<5;Q++){let G=a5.join(J,$);if(K0("fs").existsSync(G))return G;J=a5.dirname(J)}X=a5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))X=a5.resolve(Z,$);else X=a5.resolve(Z,$);if(K0("fs").existsSync(X))return X;return null}catch{return null}}async function n_($,Z,Y){let X=$,J=a5.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(X))!==null){let[_,B,U,z]=G;if(l_(U))continue;let q=i_(U,J,Z);if(q)try{let j=await Bun.file(q).text();if(Y.add(q),U.endsWith(".ts")||U.endsWith(".tsx")){let O=await Bun.build({entrypoints:[q],target:"browser",minify:!1,define:K1()});if(O.outputs.length>0)j=await O.outputs[0].text()}let H=`<script>
8128
8128
  // Source: ${U}
8129
8129
  ${j}
8130
8130
  </script>`;X=X.replace(_,H),Q.lastIndex=0}catch(j){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,W;while((W=K.exec(X))!==null){let[_,B,U,z]=W,q=B+z;if(l_(U))continue;if(/rel=["']stylesheet["']/.test(q)||U.endsWith(".css")){let H=i_(U,J,Z);if(H)try{let O=await Bun.file(H).text();Y.add(H);let F=`<style>
8131
8131
  /* Source: ${U} */
8132
8132
  ${O}
8133
- </style>`;X=X.replace(_,F),K.lastIndex=0}catch(O){}}}return X}var s_=D(()=>{x$()});function R8($,Z){let Y=$,X=/@json\s*\(/g,J;while((J=X.exec(Y))!==null){let Q=J.index,G=Q+J[0].length-1,K=1,W=G+1,_=null,B=!1;while(W<Y.length&&K>0){let V=Y[W];if(B){B=!1,W++;continue}if(V==="\\"&&_){B=!0,W++;continue}if(_){if(V===_)_=null;W++;continue}if(V==='"'||V==="'"||V==="`"){_=V,W++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}W++}if(K!==0)break;let U=Y.substring(G+1,W).trim(),z=Y.substring(Q,W+1),q=-1,j=0,H=null,O=!1;for(let V=0;V<U.length;V++){let A=U[V];if(O){O=!1;continue}if(A==="\\"&&H){O=!0;continue}if(H){if(A===H)H=null;continue}if(A==='"'||A==="'"||A==="`"){H=A;continue}if(A==="("||A==="["||A==="{")j++;else if(A===")"||A==="]"||A==="}")j--;if(A===","&&j===0){q=V;break}}let F=q>=0?U.substring(0,q).trim():U,L=q>=0?U.substring(q+1).trim():void 0;try{let V=F.trim(),A;if(B0(V))A=j0(V,Object.keys(Z))(...Object.values(Z));else A=void 0;let N;if(L==="true")N=JSON.stringify(A,null,2);else N=JSON.stringify(A);let w=N.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,Q)+w+Y.substring(W+1),X.lastIndex=Q+w.length}catch(V){u0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),X.lastIndex=Q+z.length}}return Y}function M8($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function r_($){let Z=$,Y=/@memo\s*\(/g,X,J=[];while((X=Y.exec(Z))!==null){let Q=X.index,G=Q+X[0].length,K=1,W=G;while(W<Z.length&&K>0){if(Z[W]==="(")K++;else if(Z[W]===")")K--;W++}if(K!==0)continue;let _=Z.slice(G,W-1).trim(),B=W,U=Z.slice(B),z=U.indexOf("@endmemo");if(z===-1)continue;let q=U.slice(0,z),j=B+z+8,H=q.match(/^(\s*(?:<!--[\s\S]*?-->\s*)*)/),O=H?H[0].length:0,F=q.slice(O),L=q.match(/(\s*)$/),V=L?L[0].length:0,A=F.slice(0,F.length-V),N=A.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),w;if(N){let[M,T,I="",E]=N,S=`<${T}${I} data-stx-memo="${_}"${E}>`;w=q.slice(0,O)+S+A.slice(M.length)+q.slice(O+A.length)}else w=`${q.slice(0,O)}<div data-stx-memo="${_}">${A}</div>${q.slice(O+A.length)}`;J.push({start:Q,end:j,replacement:w}),Y.lastIndex=j}for(let Q=J.length-1;Q>=0;Q--){let G=J[Q];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function v2($){let Z=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Z=Z.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Z}function o_($){let Y=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),X="",J=0,Q;while((Q=Y.exec($))!==null){let G=Q.index,K=G+Q[0].length,W=!1,_=!1,B=-1;while(K<$.length){let H=$[K];if(W){if(H==="'")W=!1}else if(_){if(H==='"')_=!1}else if(H==="'")W=!0;else if(H==='"')_=!0;else if(H===">"){B=K;break}K++}if(B===-1)continue;if($.slice(G,B+1).includes("x-cloak"))continue;let z=$.slice(B+1),q=z.indexOf("</"),j=q>=0?z.slice(0,q):z.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(j))X+=$.slice(J,B)+" x-cloak>",J=B+1}return X+=$.slice(J),X}var f2=D(()=>{X1();h0()});function T8($,Z,Y){let X=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},J=X.allowPatterns??[],Q=[];for(let{pattern:G,message:K,suggestion:W}of QA){if(J.some((B)=>K.includes(B)||G.source.includes(B)))continue;G.lastIndex=0;let _=$.match(G);if(_&&_.length>0){let B=$.split(`
8133
+ </style>`;X=X.replace(_,F),K.lastIndex=0}catch(O){}}}return X}var s_=D(()=>{x$()});function R8($,Z){let Y=$,X=/@json\s*\(/g,J;while((J=X.exec(Y))!==null){let Q=J.index,G=Q+J[0].length-1,K=1,W=G+1,_=null,B=!1;while(W<Y.length&&K>0){let V=Y[W];if(B){B=!1,W++;continue}if(V==="\\"&&_){B=!0,W++;continue}if(_){if(V===_)_=null;W++;continue}if(V==='"'||V==="'"||V==="`"){_=V,W++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}W++}if(K!==0)break;let U=Y.substring(G+1,W).trim(),z=Y.substring(Q,W+1),q=-1,j=0,H=null,O=!1;for(let V=0;V<U.length;V++){let A=U[V];if(O){O=!1;continue}if(A==="\\"&&H){O=!0;continue}if(H){if(A===H)H=null;continue}if(A==='"'||A==="'"||A==="`"){H=A;continue}if(A==="("||A==="["||A==="{")j++;else if(A===")"||A==="]"||A==="}")j--;if(A===","&&j===0){q=V;break}}let F=q>=0?U.substring(0,q).trim():U,L=q>=0?U.substring(q+1).trim():void 0;try{let V=F.trim(),A;if(B0(V))A=j0(V,Object.keys(Z))(...Object.values(Z));else A=void 0;let N;if(L==="true")N=JSON.stringify(A,null,2);else N=JSON.stringify(A);let w=N.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,Q)+w+Y.substring(W+1),X.lastIndex=Q+w.length}catch(V){u0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),X.lastIndex=Q+z.length}}return Y}function M8($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function r_($){let Z=$,Y=/@memo\s*\(/g,X,J=[];while((X=Y.exec(Z))!==null){let Q=X.index,G=Q+X[0].length,K=1,W=G;while(W<Z.length&&K>0){if(Z[W]==="(")K++;else if(Z[W]===")")K--;W++}if(K!==0)continue;let _=Z.slice(G,W-1).trim(),B=W,U=Z.slice(B),z=U.indexOf("@endmemo");if(z===-1)continue;let q=U.slice(0,z),j=B+z+8,H=q.match(/^(\s*(?:<!--[\s\S]*?-->\s*)*)/),O=H?H[0].length:0,F=q.slice(O),L=q.match(/(\s*)$/),V=L?L[0].length:0,A=F.slice(0,F.length-V),N=A.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),w;if(N){let[M,T,I="",E]=N,S=`<${T}${I} data-stx-memo="${_}"${E}>`;w=q.slice(0,O)+S+A.slice(M.length)+q.slice(O+A.length)}else w=`${q.slice(0,O)}<div data-stx-memo="${_}">${A}</div>${q.slice(O+A.length)}`;J.push({start:Q,end:j,replacement:w}),Y.lastIndex=j}for(let Q=J.length-1;Q>=0;Q--){let G=J[Q];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function xJ($){let Z=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Z=Z.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Z}function o_($){let Y=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),X="",J=0,Q;while((Q=Y.exec($))!==null){let G=Q.index,K=G+Q[0].length,W=!1,_=!1,B=-1;while(K<$.length){let H=$[K];if(W){if(H==="'")W=!1}else if(_){if(H==='"')_=!1}else if(H==="'")W=!0;else if(H==='"')_=!0;else if(H===">"){B=K;break}K++}if(B===-1)continue;if($.slice(G,B+1).includes("x-cloak"))continue;let z=$.slice(B+1),q=z.indexOf("</"),j=q>=0?z.slice(0,q):z.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(j))X+=$.slice(J,B)+" x-cloak>",J=B+1}return X+=$.slice(J),X}var vJ=D(()=>{X1();h0()});function T8($,Z,Y){let X=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},J=X.allowPatterns??[],Q=[];for(let{pattern:G,message:K,suggestion:W}of QA){if(J.some((B)=>K.includes(B)||G.source.includes(B)))continue;G.lastIndex=0;let _=$.match(G);if(_&&_.length>0){let B=$.split(`
8134
8134
  `),U=[];B.forEach((q,j)=>{if(G.lastIndex=0,G.test(q))U.push(j+1)});let z=U.length>0?` (line${U.length>1?"s":""}: ${U.join(", ")})`:"";Q.push(` \u2717 ${K}${z}
8135
8135
  \u2192 ${W}`)}}if(Q.length>0&&X.enabled){let K=`[STX] DOM API violation in ${Z.split("/").pop()||Z}:
8136
8136
  ${Q.join(`
8137
8137
  `)}
8138
- Tip: prefer useRef(), navigate(), and composables for component code`;if(X.failOnViolation)throw Error(K);else console.warn(K)}}var QA;var g2=D(()=>{QA=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/window\.localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}]});var a_={};Q0(a_,{getStoreScript:()=>GA,clearStoreCache:()=>KA});import E8 from"path";async function GA($){let Z;if($)Z=E8.resolve($);else{let B=await S0();Z=E8.resolve(B.root||process.cwd(),B.storesDir||"stores")}let Y=t5.get(Z);if(Y!==void 0)return Y||null;let X=new Bun.Glob("*.ts"),J=[];try{for await(let B of X.scan({cwd:Z,absolute:!0})){let U=E8.basename(B,".ts");if(["index","types"].includes(U))continue;if(B.includes(".d.ts"))continue;J.push(B)}}catch{return t5.set(Z,""),null}if(J.length===0)return t5.set(Z,""),null;let Q=[];for(let B of J){let U=await Bun.file(B).text();Q.push({file:B,hasUseStore:/useStore\s*\(/.test(U)})}Q.sort((B,U)=>{if(B.hasUseStore===U.hasUseStore)return 0;return B.hasUseStore?1:-1});let G=Q.map((B)=>B.file),K=[],W=new Bun.Transpiler({loader:"ts",target:"browser",define:K1()});for(let B of G)try{let U=await Bun.file(B).text(),z=E8.basename(B,".ts");U=U.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),U=U.replace(/^export\s+(default\s+)?/gm,""),U=W.transformSync(U),K.push(`// Store: ${z}
8138
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(X.failOnViolation)throw Error(K);else console.warn(K)}}var QA;var fJ=D(()=>{QA=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/window\.localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}]});var a_={};Q0(a_,{getStoreScript:()=>GA,clearStoreCache:()=>KA});import E8 from"path";async function GA($){let Z;if($)Z=E8.resolve($);else{let B=await S0();Z=E8.resolve(B.root||process.cwd(),B.storesDir||"stores")}let Y=t5.get(Z);if(Y!==void 0)return Y||null;let X=new Bun.Glob("*.ts"),J=[];try{for await(let B of X.scan({cwd:Z,absolute:!0})){let U=E8.basename(B,".ts");if(["index","types"].includes(U))continue;if(B.includes(".d.ts"))continue;J.push(B)}}catch{return t5.set(Z,""),null}if(J.length===0)return t5.set(Z,""),null;let Q=[];for(let B of J){let U=await Bun.file(B).text();Q.push({file:B,hasUseStore:/useStore\s*\(/.test(U)})}Q.sort((B,U)=>{if(B.hasUseStore===U.hasUseStore)return 0;return B.hasUseStore?1:-1});let G=Q.map((B)=>B.file),K=[],W=new Bun.Transpiler({loader:"ts",target:"browser",define:K1()});for(let B of G)try{let U=await Bun.file(B).text(),z=E8.basename(B,".ts");U=U.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),U=U.replace(/^export\s+(default\s+)?/gm,""),U=W.transformSync(U),K.push(`// Store: ${z}
8139
8139
  ${U.trim()}`)}catch(U){console.warn(`[stx] Failed to load store ${B}:`,U)}if(K.length===0)return t5.set(Z,""),null;let _=`;(function(){
8140
8140
  ${K.join(`
8141
8141
 
@@ -9825,7 +9825,7 @@ else {
9825
9825
 
9826
9826
  console.log('[stx] Keep-alive runtime initialized');
9827
9827
  })();
9828
- `}function hB($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function dB($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var SA=0;var mB={};Q0(mB,{useVirtualList:()=>d2,processVirtualListDirectives:()=>D8,processVirtualGridDirectives:()=>m2,processInfiniteListDirectives:()=>u2,generateVirtualListCSS:()=>h2,default:()=>yA,createVirtualList:()=>I8});function I8($,Z){let{itemHeight:Y,containerHeight:X,overscan:J=3,keyProperty:Q="id",dynamicHeight:G=!1,estimatedItemHeight:K=Y,direction:W="vertical"}=Z,_=[...$],B=0,U=new Map;function z(){if(G)return q();let w=Math.max(0,Math.floor(B/Y)-J),M=Math.ceil(X/Y),T=Math.min(_.length-1,w+M+J*2);return{startIndex:w,endIndex:T}}function q(){let w=0,M=0,T=_.length-1;for(let I=0;I<_.length;I++){let E=U.get(I)||K;if(w+E>B){M=Math.max(0,I-J);break}w+=E}w=0;for(let I=0;I<_.length;I++){let E=U.get(I)||K;if(w+=E,w>B+X){T=Math.min(_.length-1,I+J);break}}return{startIndex:M,endIndex:T}}function j(){if(G){let w=0;for(let M=0;M<_.length;M++)w+=U.get(M)||K;return w}return _.length*Y}function H(w){if(G){let M=0;for(let T=0;T<w;T++)M+=U.get(T)||K;return M}return w*Y}function O(){let{startIndex:w,endIndex:M}=z();return{startIndex:w,endIndex:M,scrollTop:B,totalHeight:j(),visibleItems:_.slice(w,M+1),itemHeights:new Map(U)}}function F(w,M="auto"){let T=H(w);L(T,M)}function L(w,M="auto"){B=Math.max(0,Math.min(w,j()-X))}function V(){z()}function A(w){_=[...w],U.clear(),V()}function N(){_=[],U.clear()}return{scrollToIndex:F,scrollToOffset:L,getState:O,refresh:V,setItems:A,destroy:N}}function D8($,Z={},Y){let X=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(X,(J,Q,G,K)=>{let W=Q.trim(),_=Z[W];if(!_||!Array.isArray(_))return`<!-- virtualList: items "${W}" not found or not an array -->`;let B={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let L=G.trim(),V=Function(`return ${L}`)();B={...B,...V}}catch{}let U=`vlist-${Math.random().toString(36).substring(2,9)}`,z=Math.ceil(B.containerHeight/B.itemHeight),q=B.overscan||3,j=0,H=Math.min(_.length-1,z+q),O="";for(let L=j;L<=H&&L<_.length;L++){let V=_[L],A=K.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(N,w)=>{if(typeof V==="object"&&V!==null)return String(V[w]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(L));O+=`
9828
+ `}function hB($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function dB($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var SA=0;var mB={};Q0(mB,{useVirtualList:()=>hJ,processVirtualListDirectives:()=>D8,processVirtualGridDirectives:()=>uJ,processInfiniteListDirectives:()=>dJ,generateVirtualListCSS:()=>gJ,default:()=>yA,createVirtualList:()=>I8});function I8($,Z){let{itemHeight:Y,containerHeight:X,overscan:J=3,keyProperty:Q="id",dynamicHeight:G=!1,estimatedItemHeight:K=Y,direction:W="vertical"}=Z,_=[...$],B=0,U=new Map;function z(){if(G)return q();let w=Math.max(0,Math.floor(B/Y)-J),M=Math.ceil(X/Y),T=Math.min(_.length-1,w+M+J*2);return{startIndex:w,endIndex:T}}function q(){let w=0,M=0,T=_.length-1;for(let I=0;I<_.length;I++){let E=U.get(I)||K;if(w+E>B){M=Math.max(0,I-J);break}w+=E}w=0;for(let I=0;I<_.length;I++){let E=U.get(I)||K;if(w+=E,w>B+X){T=Math.min(_.length-1,I+J);break}}return{startIndex:M,endIndex:T}}function j(){if(G){let w=0;for(let M=0;M<_.length;M++)w+=U.get(M)||K;return w}return _.length*Y}function H(w){if(G){let M=0;for(let T=0;T<w;T++)M+=U.get(T)||K;return M}return w*Y}function O(){let{startIndex:w,endIndex:M}=z();return{startIndex:w,endIndex:M,scrollTop:B,totalHeight:j(),visibleItems:_.slice(w,M+1),itemHeights:new Map(U)}}function F(w,M="auto"){let T=H(w);L(T,M)}function L(w,M="auto"){B=Math.max(0,Math.min(w,j()-X))}function V(){z()}function A(w){_=[...w],U.clear(),V()}function N(){_=[],U.clear()}return{scrollToIndex:F,scrollToOffset:L,getState:O,refresh:V,setItems:A,destroy:N}}function D8($,Z={},Y){let X=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(X,(J,Q,G,K)=>{let W=Q.trim(),_=Z[W];if(!_||!Array.isArray(_))return`<!-- virtualList: items "${W}" not found or not an array -->`;let B={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let L=G.trim(),V=Function(`return ${L}`)();B={...B,...V}}catch{}let U=`vlist-${Math.random().toString(36).substring(2,9)}`,z=Math.ceil(B.containerHeight/B.itemHeight),q=B.overscan||3,j=0,H=Math.min(_.length-1,z+q),O="";for(let L=j;L<=H&&L<_.length;L++){let V=_[L],A=K.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(N,w)=>{if(typeof V==="object"&&V!==null)return String(V[w]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(L));O+=`
9829
9829
  <div class="virtual-item ${B.itemClass||""}"
9830
9830
  style="position: absolute; top: ${L*B.itemHeight}px; height: ${B.itemHeight}px; width: 100%;"
9831
9831
  data-index="${L}">
@@ -9902,7 +9902,7 @@ else {
9902
9902
  };
9903
9903
  })();
9904
9904
  </script>
9905
- `})}function h2(){return`
9905
+ `})}function gJ(){return`
9906
9906
  .virtual-list-container {
9907
9907
  position: relative;
9908
9908
  overflow-y: auto;
@@ -9950,7 +9950,7 @@ else {
9950
9950
  0% { background-position: 200% 0; }
9951
9951
  100% { background-position: -200% 0; }
9952
9952
  }
9953
- `}function d2($,Z){let Y=null,X=()=>{if(!Y)Y=I8($(),Z);return Y};return{visibleItems:()=>{return X().getState().visibleItems},totalHeight:()=>{return X().getState().totalHeight},containerProps:()=>({style:{height:`${Z.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(J)=>{let Q=J.target;if(Y)Y.scrollToOffset(Q.scrollTop)}}),itemProps:(J)=>({style:{position:"absolute",top:`${J*Z.itemHeight}px`,height:`${Z.itemHeight}px`,width:"100%"},"data-index":J}),scrollToIndex:(J)=>{X().scrollToIndex(J)}}}function u2($,Z={},Y){let X=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(X,(J,Q,G,K,W)=>{let _=Q.trim(),B=Z[_];if(!B||!Array.isArray(B))return`<!-- infiniteList: items "${_}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(G)try{let j=Function(`return ${G.trim()}`)();U={...U,...j}}catch{}let z=`ilist-${Math.random().toString(36).substring(2,9)}`,q=D8(`@virtualList(${_}, ${JSON.stringify({itemHeight:U.itemHeight,containerHeight:U.containerHeight,overscan:U.overscan,containerClass:U.containerClass})})${K}@endvirtualList`,Z);return q=q.replace("</script>",`
9953
+ `}function hJ($,Z){let Y=null,X=()=>{if(!Y)Y=I8($(),Z);return Y};return{visibleItems:()=>{return X().getState().visibleItems},totalHeight:()=>{return X().getState().totalHeight},containerProps:()=>({style:{height:`${Z.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(J)=>{let Q=J.target;if(Y)Y.scrollToOffset(Q.scrollTop)}}),itemProps:(J)=>({style:{position:"absolute",top:`${J*Z.itemHeight}px`,height:`${Z.itemHeight}px`,width:"100%"},"data-index":J}),scrollToIndex:(J)=>{X().scrollToIndex(J)}}}function dJ($,Z={},Y){let X=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(X,(J,Q,G,K,W)=>{let _=Q.trim(),B=Z[_];if(!B||!Array.isArray(B))return`<!-- infiniteList: items "${_}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(G)try{let j=Function(`return ${G.trim()}`)();U={...U,...j}}catch{}let z=`ilist-${Math.random().toString(36).substring(2,9)}`,q=D8(`@virtualList(${_}, ${JSON.stringify({itemHeight:U.itemHeight,containerHeight:U.containerHeight,overscan:U.overscan,containerClass:U.containerClass})})${K}@endvirtualList`,Z);return q=q.replace("</script>",`
9954
9954
  // Infinite scroll detection
9955
9955
  container.addEventListener('scroll', function() {
9956
9956
  const scrollBottom = container.scrollTop + container.clientHeight;
@@ -9968,7 +9968,7 @@ else {
9968
9968
  ${W}
9969
9969
  </div>
9970
9970
  </div>
9971
- `})}function m2($,Z={},Y){let X=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(X,(J,Q,G,K)=>{let W=Q.trim(),_=Z[W];if(!_||!Array.isArray(_))return`<!-- virtualGrid: items "${W}" not found or not an array -->`;let B={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(G)try{let V=Function(`return ${G.trim()}`)();B={...B,...V}}catch{}let U=`vgrid-${Math.random().toString(36).substring(2,9)}`,z=Math.ceil(_.length/B.columns),q=z*(B.rowHeight+(B.gap||0)),j=Math.ceil(B.containerHeight/(B.rowHeight+(B.gap||0))),H=B.overscan||2,O=0,F=Math.min(z-1,j+H),L="";for(let V=O;V<=F;V++)for(let A=0;A<B.columns;A++){let N=V*B.columns+A;if(N>=_.length)break;let w=_[N],M=A*(100/B.columns),T=V*(B.rowHeight+(B.gap||0)),I=K.replace(/\{\{\s*item\s*\}\}/g,typeof w==="object"?JSON.stringify(w):String(w)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(E,S)=>{if(typeof w==="object"&&w!==null)return String(w[S]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(N));L+=`
9971
+ `})}function uJ($,Z={},Y){let X=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(X,(J,Q,G,K)=>{let W=Q.trim(),_=Z[W];if(!_||!Array.isArray(_))return`<!-- virtualGrid: items "${W}" not found or not an array -->`;let B={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(G)try{let V=Function(`return ${G.trim()}`)();B={...B,...V}}catch{}let U=`vgrid-${Math.random().toString(36).substring(2,9)}`,z=Math.ceil(_.length/B.columns),q=z*(B.rowHeight+(B.gap||0)),j=Math.ceil(B.containerHeight/(B.rowHeight+(B.gap||0))),H=B.overscan||2,O=0,F=Math.min(z-1,j+H),L="";for(let V=O;V<=F;V++)for(let A=0;A<B.columns;A++){let N=V*B.columns+A;if(N>=_.length)break;let w=_[N],M=A*(100/B.columns),T=V*(B.rowHeight+(B.gap||0)),I=K.replace(/\{\{\s*item\s*\}\}/g,typeof w==="object"?JSON.stringify(w):String(w)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(E,S)=>{if(typeof w==="object"&&w!==null)return String(w[S]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(N));L+=`
9972
9972
  <div class="virtual-grid-item"
9973
9973
  style="position: absolute; top: ${T}px; left: ${M}%; width: calc(${100/B.columns}% - ${B.gap||0}px); height: ${B.rowHeight}px;"
9974
9974
  data-index="${N}">
@@ -10038,7 +10038,7 @@ else {
10038
10038
  });
10039
10039
  })();
10040
10040
  </script>
10041
- `})}var yA;var p2=D(()=>{yA={createVirtualList:I8,processVirtualListDirectives:D8,processInfiniteListDirectives:u2,processVirtualGridDirectives:m2,generateVirtualListCSS:h2,useVirtualList:d2}});function c2(){return`<script data-stx-hydration-runtime>
10041
+ `})}var yA;var mJ=D(()=>{yA={createVirtualList:I8,processVirtualListDirectives:D8,processInfiniteListDirectives:dJ,processVirtualGridDirectives:uJ,generateVirtualListCSS:gJ,useVirtualList:hJ}});function pJ(){return`<script data-stx-hydration-runtime>
10042
10042
  (function() {
10043
10043
  'use strict';
10044
10044
 
@@ -10204,7 +10204,7 @@ else {
10204
10204
  ${Array.from($.entries()).map(([Y,X])=>` window.__stxIslands.register('${Y}', function() { return import('${X}'); });`).join(`
10205
10205
  `)}
10206
10206
  })();
10207
- </script>`}function l2($){let Z=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Z)return Z[1];let Y=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Y)return Y[1];return null}function i2($,Z){let Y={},X=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,J;while((J=X.exec($))!==null){let Q=J[1],G=J[2];if(G in Z)Y[Q]=Z[G];else Y[Q]=G}return Y}var pB={};Q0(pB,{processStaticDirectives:()=>ZJ,processPartialHydrationDirectives:()=>s2,onHydrated:()=>$J,isHydrated:()=>e2,hydrateIsland:()=>o2,hydrateByStrategy:()=>a2,hydrateAll:()=>t2,generatePartialHydrationCSS:()=>r2,generateIslandManifest:()=>YJ,default:()=>mA,createIslandRegistry:()=>n2});function n2(){let $=new Map;return{islands:$,register(Z){$.set(Z.id,Z)},get(Z){return $.get(Z)},async hydrate(Z){let Y=$.get(Z);if(!Y||Y.hydrated)return;if(Y.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:Z,component:Y.component}}))},async hydrateAll(){let Z=Array.from($.values()).filter((Y)=>!Y.hydrated).map((Y)=>this.hydrate(Y.id));await Promise.all(Z)}}}function xA($){return`
10207
+ </script>`}function cJ($){let Z=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Z)return Z[1];let Y=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Y)return Y[1];return null}function lJ($,Z){let Y={},X=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,J;while((J=X.exec($))!==null){let Q=J[1],G=J[2];if(G in Z)Y[Q]=Z[G];else Y[Q]=G}return Y}var pB={};Q0(pB,{processStaticDirectives:()=>$2,processPartialHydrationDirectives:()=>nJ,onHydrated:()=>eJ,isHydrated:()=>tJ,hydrateIsland:()=>rJ,hydrateByStrategy:()=>oJ,hydrateAll:()=>aJ,generatePartialHydrationCSS:()=>sJ,generateIslandManifest:()=>Z2,default:()=>mA,createIslandRegistry:()=>iJ});function iJ(){let $=new Map;return{islands:$,register(Z){$.set(Z.id,Z)},get(Z){return $.get(Z)},async hydrate(Z){let Y=$.get(Z);if(!Y||Y.hydrated)return;if(Y.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:Z,component:Y.component}}))},async hydrateAll(){let Z=Array.from($.values()).filter((Y)=>!Y.hydrated).map((Y)=>this.hydrate(Y.id));await Promise.all(Z)}}}function xA($){return`
10208
10208
  <script data-hydrate="${$}">
10209
10209
  (function() {
10210
10210
  const island = document.querySelector('[data-island="${$}"]');
@@ -10356,8 +10356,8 @@ else {
10356
10356
  });
10357
10357
  })();
10358
10358
  </script>
10359
- `}function s2($,Z={},Y){let X=$,J=!1,Q=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(X=e5(X,"load",Z),X=e5(X,"idle",Z),X=e5(X,"visible",Z),X=e5(X,"media",Z),X=uA(X),X=e5(X,"hover",Z),X=e5(X,"event",Z),J=Q&&X!==$,J)X+=`
10360
- `+c2();return X}function e5($,Z,Y){let X=new RegExp(`@client:${Z}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(X,(J,Q,G)=>{let K={strategy:Z};if(Q)try{let H=Q.split(",").map((O)=>O.trim());for(let O of H){let[F,L]=O.split(":").map((V)=>V.trim());if(F&&L){let V=L.replace(/^['"]|['"]$/g,"");K[F]=V}}}catch{}let W=`island-${Math.random().toString(36).substring(2,9)}`,_=l2(G.trim()),B=i2(G.trim(),Y),U=[];if(K.rootMargin)U.push(`data-root-margin="${K.rootMargin}"`);if(K.threshold!==void 0)U.push(`data-threshold="${K.threshold}"`);if(K.media)U.push(`data-media="${K.media}"`);if(K.event)U.push(`data-event="${K.event}"`);if(_)U.push(`data-component="${_}"`);let q=Object.keys(B).length>0?`
10359
+ `}function nJ($,Z={},Y){let X=$,J=!1,Q=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(X=e5(X,"load",Z),X=e5(X,"idle",Z),X=e5(X,"visible",Z),X=e5(X,"media",Z),X=uA(X),X=e5(X,"hover",Z),X=e5(X,"event",Z),J=Q&&X!==$,J)X+=`
10360
+ `+pJ();return X}function e5($,Z,Y){let X=new RegExp(`@client:${Z}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(X,(J,Q,G)=>{let K={strategy:Z};if(Q)try{let H=Q.split(",").map((O)=>O.trim());for(let O of H){let[F,L]=O.split(":").map((V)=>V.trim());if(F&&L){let V=L.replace(/^['"]|['"]$/g,"");K[F]=V}}}catch{}let W=`island-${Math.random().toString(36).substring(2,9)}`,_=cJ(G.trim()),B=lJ(G.trim(),Y),U=[];if(K.rootMargin)U.push(`data-root-margin="${K.rootMargin}"`);if(K.threshold!==void 0)U.push(`data-threshold="${K.threshold}"`);if(K.media)U.push(`data-media="${K.media}"`);if(K.event)U.push(`data-event="${K.event}"`);if(_)U.push(`data-component="${_}"`);let q=Object.keys(B).length>0?`
10361
10361
  <script type="application/json" data-island-props="${W}">${JSON.stringify(B)}</script>`:"",j="";switch(Z){case"load":j=xA(W);break;case"idle":j=vA(W,K);break;case"visible":j=fA(W,K);break;case"media":j=gA(W,K);break;case"hover":j=hA(W);break;case"event":j=dA(W,K);break}return`
10362
10362
  <div data-island="${W}"
10363
10363
  data-strategy="${Z}"
@@ -10387,7 +10387,7 @@ else {
10387
10387
  }
10388
10388
  })();
10389
10389
  </script>
10390
- `})}function r2(){return`
10390
+ `})}function sJ(){return`
10391
10391
  /* Island base styles */
10392
10392
  .stx-island {
10393
10393
  display: contents;
@@ -10428,11 +10428,11 @@ else {
10428
10428
  .stx-island.hydrated {
10429
10429
  opacity: 1;
10430
10430
  }
10431
- `}function o2($){if(typeof window>"u")return;let Z=document.querySelector(`[data-island="${$}"]`);if(!Z||Z.classList.contains("hydrated"))return;Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function a2($){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${$}"]:not(.hydrated)`).forEach((Y)=>{Y.classList.add("hydrated"),Y.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function t2(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach((Z)=>{Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function e2($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function $J($){return new Promise((Z)=>{if(typeof window>"u"){Z();return}let Y=document.querySelector(`[data-island="${$}"]`);if(!Y){Z();return}if(Y.classList.contains("hydrated")){Z();return}Y.addEventListener("stx:hydrated",()=>Z(),{once:!0})})}function ZJ($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,Y)=>{return`<div class="stx-static">${Y.trim()}</div>`})}function YJ($){let Z=$.map((Y)=>({id:Y.id,component:Y.component,strategy:Y.options.strategy,props:Y.props}));return`
10431
+ `}function rJ($){if(typeof window>"u")return;let Z=document.querySelector(`[data-island="${$}"]`);if(!Z||Z.classList.contains("hydrated"))return;Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function oJ($){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${$}"]:not(.hydrated)`).forEach((Y)=>{Y.classList.add("hydrated"),Y.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function aJ(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach((Z)=>{Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function tJ($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function eJ($){return new Promise((Z)=>{if(typeof window>"u"){Z();return}let Y=document.querySelector(`[data-island="${$}"]`);if(!Y){Z();return}if(Y.classList.contains("hydrated")){Z();return}Y.addEventListener("stx:hydrated",()=>Z(),{once:!0})})}function $2($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,Y)=>{return`<div class="stx-static">${Y.trim()}</div>`})}function Z2($){let Z=$.map((Y)=>({id:Y.id,component:Y.component,strategy:Y.options.strategy,props:Y.props}));return`
10432
10432
  <script type="application/json" id="stx-island-manifest">
10433
10433
  ${JSON.stringify(Z)}
10434
10434
  </script>
10435
- `}var mA;var XJ=D(()=>{mA={processPartialHydrationDirectives:s2,processStaticDirectives:ZJ,generatePartialHydrationCSS:r2,generateIslandManifest:YJ,createIslandRegistry:n2,hydrateIsland:o2,hydrateByStrategy:a2,hydrateAll:t2,isHydrated:e2,onHydrated:$J}});var $U={};Q0($U,{watchMultiple:()=>sB,watchEffect:()=>rB,watch:()=>nB,unref:()=>cB,toRefs:()=>lB,throttledComputed:()=>eB,stxWatchMultiple:()=>sB,stxWatchEffect:()=>rB,stxWatch:()=>nB,stxUnref:()=>cB,stxToRefs:()=>lB,stxThrottledComputed:()=>eB,stxShallowRef:()=>iB,stxRef:()=>$7,stxIsRef:()=>R$,stxDebouncedComputed:()=>tB,stxComputed:()=>w4,shallowRef:()=>iB,ref:()=>$7,processWatchDirectives:()=>aB,processComputedDirectives:()=>oB,isRef:()=>R$,default:()=>pA,debouncedComputed:()=>tB,computed:()=>w4});function $7($){let Z=$,Y=new Set,X={get value(){if(b1){let J=A4.get(X);if(!J)J=new Set,A4.set(X,J);J.add(b1)}return Z},set value(J){if(!Object.is(Z,J)){Z=J,Y.forEach((G)=>G(J));let Q=A4.get(X);if(Q)Q.forEach((G)=>G())}},subscribe(J){return Y.add(J),()=>Y.delete(J)},peek(){return Z}};return X}function R$($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function cB($){return R$($)?$.value:$}function lB($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=$7($[Y]);return Z}function iB($){return $7($)}function w4($){let Z=typeof $==="function",Y=Z?$:$.get,X=Z?void 0:$.set,J=Z?Object.is:$.equals||Object.is,Q,G=!0,K=new Set,W=new Set,_=()=>{if(G=!0,W.size>0){let z=U.value;W.forEach((q)=>q(z))}};function B(){K.clear();let z=b1;b1=_,k8.push(_);try{return Y()}finally{k8.pop(),b1=z}}let U={get value(){if(b1){let z=A4.get(U);if(!z)z=new Set,A4.set(U,z);z.add(b1)}if(G){let z=B();if(!J(Q,z))Q=z;G=!1}return Q},set value(z){if(X)X(z);else console.warn("Computed property is readonly")},subscribe(z){return W.add(z),()=>W.delete(z)},peek(){if(G)Q=Y(),G=!1;return Q},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return U}function nB($,Z,Y={}){let{immediate:X=!1,deep:J=!1,flush:Q="pre",once:G=!1}=Y,K,W=!0,_=!1,B=()=>{if(R$($))return J?l$($.value):$.value;return $()},U=()=>{if(!W||_)return;let j=B();if(K!==void 0&&Object.is(K,j)&&!J)return;let H=()=>{if(Z(j,K),K=J?l$(j):j,G)q()};if(Q==="sync")H();else if(Q==="post")queueMicrotask(H);else Promise.resolve().then(H)},z=null;if(R$($))z=$.subscribe(()=>U());else z=w4($).subscribe(()=>U());if(X)K=void 0,U();else K=B();let q=()=>{if(W=!1,z)z(),z=null};return q.pause=()=>{_=!0},q.resume=()=>{_=!1},q}function sB($,Z,Y={}){let{immediate:X=!1,once:J=!1}=Y,Q=$.map((U)=>R$(U)?U.value:void 0),G=!0,K=!1,W=()=>{if(!G||K)return;let U=$.map((z)=>R$(z)?z.value:void 0);if(Z(U,Q),Q=[...U],J)B()},_=$.map((U)=>{if(R$(U))return U.subscribe(()=>W());return()=>{}});if(X)W();let B=()=>{G=!1,_.forEach((U)=>U())};return B.pause=()=>{K=!0},B.resume=()=>{K=!1},B}function rB($,Z={}){let{flush:Y="pre"}=Z,X,J=!0,Q=!1,G=()=>{if(!J||Q)return;if(X)X();let W=b1;b1=G,k8.push(G);try{X=$()}finally{k8.pop(),b1=W}};if(Y==="sync")G();else if(Y==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(J=!1,X)X()};return K.pause=()=>{Q=!0},K.resume=()=>{Q=!1},K}function oB($,Z={},Y){let X=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(X,(J,Q,G)=>{try{let W=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[Q]=W,`<!-- computed: ${Q} = ${W} -->`}catch(K){return`<!-- computed error: ${Q} - ${K} -->`}})}function aB($,Z={},Y){let X=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(X,(J,Q,G)=>{return`
10435
+ `}var mA;var Y2=D(()=>{mA={processPartialHydrationDirectives:nJ,processStaticDirectives:$2,generatePartialHydrationCSS:sJ,generateIslandManifest:Z2,createIslandRegistry:iJ,hydrateIsland:rJ,hydrateByStrategy:oJ,hydrateAll:aJ,isHydrated:tJ,onHydrated:eJ}});var $U={};Q0($U,{watchMultiple:()=>sB,watchEffect:()=>rB,watch:()=>nB,unref:()=>cB,toRefs:()=>lB,throttledComputed:()=>eB,stxWatchMultiple:()=>sB,stxWatchEffect:()=>rB,stxWatch:()=>nB,stxUnref:()=>cB,stxToRefs:()=>lB,stxThrottledComputed:()=>eB,stxShallowRef:()=>iB,stxRef:()=>$7,stxIsRef:()=>M$,stxDebouncedComputed:()=>tB,stxComputed:()=>w4,shallowRef:()=>iB,ref:()=>$7,processWatchDirectives:()=>aB,processComputedDirectives:()=>oB,isRef:()=>M$,default:()=>pA,debouncedComputed:()=>tB,computed:()=>w4});function $7($){let Z=$,Y=new Set,X={get value(){if(b1){let J=A4.get(X);if(!J)J=new Set,A4.set(X,J);J.add(b1)}return Z},set value(J){if(!Object.is(Z,J)){Z=J,Y.forEach((G)=>G(J));let Q=A4.get(X);if(Q)Q.forEach((G)=>G())}},subscribe(J){return Y.add(J),()=>Y.delete(J)},peek(){return Z}};return X}function M$($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function cB($){return M$($)?$.value:$}function lB($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=$7($[Y]);return Z}function iB($){return $7($)}function w4($){let Z=typeof $==="function",Y=Z?$:$.get,X=Z?void 0:$.set,J=Z?Object.is:$.equals||Object.is,Q,G=!0,K=new Set,W=new Set,_=()=>{if(G=!0,W.size>0){let z=U.value;W.forEach((q)=>q(z))}};function B(){K.clear();let z=b1;b1=_,k8.push(_);try{return Y()}finally{k8.pop(),b1=z}}let U={get value(){if(b1){let z=A4.get(U);if(!z)z=new Set,A4.set(U,z);z.add(b1)}if(G){let z=B();if(!J(Q,z))Q=z;G=!1}return Q},set value(z){if(X)X(z);else console.warn("Computed property is readonly")},subscribe(z){return W.add(z),()=>W.delete(z)},peek(){if(G)Q=Y(),G=!1;return Q},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return U}function nB($,Z,Y={}){let{immediate:X=!1,deep:J=!1,flush:Q="pre",once:G=!1}=Y,K,W=!0,_=!1,B=()=>{if(M$($))return J?l$($.value):$.value;return $()},U=()=>{if(!W||_)return;let j=B();if(K!==void 0&&Object.is(K,j)&&!J)return;let H=()=>{if(Z(j,K),K=J?l$(j):j,G)q()};if(Q==="sync")H();else if(Q==="post")queueMicrotask(H);else Promise.resolve().then(H)},z=null;if(M$($))z=$.subscribe(()=>U());else z=w4($).subscribe(()=>U());if(X)K=void 0,U();else K=B();let q=()=>{if(W=!1,z)z(),z=null};return q.pause=()=>{_=!0},q.resume=()=>{_=!1},q}function sB($,Z,Y={}){let{immediate:X=!1,once:J=!1}=Y,Q=$.map((U)=>M$(U)?U.value:void 0),G=!0,K=!1,W=()=>{if(!G||K)return;let U=$.map((z)=>M$(z)?z.value:void 0);if(Z(U,Q),Q=[...U],J)B()},_=$.map((U)=>{if(M$(U))return U.subscribe(()=>W());return()=>{}});if(X)W();let B=()=>{G=!1,_.forEach((U)=>U())};return B.pause=()=>{K=!0},B.resume=()=>{K=!1},B}function rB($,Z={}){let{flush:Y="pre"}=Z,X,J=!0,Q=!1,G=()=>{if(!J||Q)return;if(X)X();let W=b1;b1=G,k8.push(G);try{X=$()}finally{k8.pop(),b1=W}};if(Y==="sync")G();else if(Y==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(J=!1,X)X()};return K.pause=()=>{Q=!0},K.resume=()=>{Q=!1},K}function oB($,Z={},Y){let X=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(X,(J,Q,G)=>{try{let W=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[Q]=W,`<!-- computed: ${Q} = ${W} -->`}catch(K){return`<!-- computed error: ${Q} - ${K} -->`}})}function aB($,Z={},Y){let X=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(X,(J,Q,G)=>{return`
10436
10436
  <script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
10437
10437
  (function() {
10438
10438
  // Watch implementation for ${Q}
@@ -10444,7 +10444,7 @@ else {
10444
10444
  }
10445
10445
  })();
10446
10446
  </script>
10447
- `})}function l$($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>l$(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((X,J)=>Y.set(l$(J),l$(X))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((X)=>Y.add(l$(X))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=l$($[Y]);return Z}function tB($,Z=100){let Y=$7($()),X=null,J=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{Y.value=$()},Z)};return w4($).subscribe(()=>J()),{get value(){return Y.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){J()},get dirty(){return!1},get deps(){return new Set}}}function eB($,Z=100){let Y=$7($()),X=0,J=()=>{let G=Date.now();if(G-X>=Z)X=G,Y.value=$()};return w4($).subscribe(()=>J()),{get value(){return Y.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){J()},get dirty(){return!1},get deps(){return new Set}}}var b1=null,k8,A4,pA;var ZU=D(()=>{k8=[],A4=new WeakMap;pA={ref:$7,computed:w4,watch:nB,watchMultiple:sB,watchEffect:rB,isRef:R$,unref:cB,toRefs:lB,shallowRef:iB,debouncedComputed:tB,throttledComputed:eB,processComputedDirectives:oB,processWatchDirectives:aB}});var QU={};Q0(QU,{v:()=>cA,processHasErrorsDirective:()=>JU,processFormValidationDirectives:()=>iA,processErrorsDirective:()=>XU,processErrorDirective:()=>YU,defineForm:()=>lA,Validator:()=>Z7});class Z7{rules=[];defaultValue="";addRule($){let Z=new Z7;return Z.rules=[...this.rules,$],Z.defaultValue=this.defaultValue,Z}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(Z)=>{if(Z===null||Z===void 0)return $;if(typeof Z==="string"&&Z.trim()==="")return $;if(Array.isArray(Z)&&Z.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(Z)=>{if(!Z)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(Z))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(Z)=>{if(!Z)return!0;try{return new URL(String(Z)),!0}catch{return $}}})}min($,Z){let Y=Z||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length>=$||Y}})}max($,Z){let Y=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length<=$||Y}})}length($,Z,Y){let X=Y||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:X,validate:(J)=>{if(!J)return!0;let Q=String(J).length;return Q>=$&&Q<=Z||X}})}pattern($,Z="Invalid format"){return this.addRule({name:"pattern",message:Z,validate:(Y)=>{if(!Y)return!0;return $.test(String(Y))||Z}})}hasUppercase($="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,$)}hasLowercase($="Must contain a lowercase letter"){return this.pattern(/[a-z]/,$)}hasNumber($="Must contain a number"){return this.pattern(/\d/,$)}hasSpecial($="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,$)}alphanumeric($="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,$)}startsWithLetter($="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,$)}noSpaces($="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:$,validate:(Z)=>{if(!Z)return!0;return!String(Z).includes(" ")||$}})}number($="Must be a number"){let Z=this.addRule({name:"number",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return!Number.isNaN(Number(Y))||$}});return Z.defaultValue=0,Z}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number.isInteger(Number(Z))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)<0||$}})}minValue($,Z){let Y=Z||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)>=$||Y}})}maxValue($,Z){let Y=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)<=$||Y}})}between($,Z,Y){let X=Y||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:X,validate:(J)=>{if(!J&&J!==0)return!0;let Q=Number(J);return Q>=$&&Q<=Z||X}})}matches($,Z){let Y=Z||`Must match ${$}`;return this.addRule({name:"matches",message:Y,validate:(X,J)=>{if(!J)return!0;return X===J[$]||Y}})}oneOf($,Z){let Y=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Y,validate:(X)=>{if(!X)return!0;return $.includes(X)||Y}})}notOneOf($,Z){let Y=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Y,validate:(X)=>{if(!X)return!0;return!$.includes(X)||Y}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Z)=>{if(!Z)return!0;let Y=new Date(String(Z));return!Number.isNaN(Y.getTime())||$}})}before($,Z){let Y=new Date($),X=Z||`Must be before ${Y.toLocaleDateString()}`;return this.addRule({name:"before",message:X,validate:(J)=>{if(!J)return!0;return new Date(String(J))<Y||X}})}after($,Z){let Y=new Date($),X=Z||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:X,validate:(J)=>{if(!J)return!0;return new Date(String(J))>Y||X}})}custom($,Z="Invalid value"){return this.addRule({name:"custom",message:Z,validate:$})}async($,Z="Invalid value"){return this.addRule({name:"async",message:Z,async:!0,validate:$})}when($,Z){let Y=new Z7;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let X of Z.getRules())Y.rules.push({...X,validate:(J,Q)=>{if(!$(J,Q||{}))return!0;return X.validate(J,Q)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new Z7;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let Y=[];for(let X of this.rules){let J=await X.validate($,Z);if(J!==!0)Y.push(J)}return Y}validateSync($,Z){let Y=[];for(let X of this.rules){if(X.async)continue;let J=X.validate($,Z);if(J!==!0)Y.push(J)}return Y}}function lA($,Z){let Y=Object.keys($),X={},J={},Q={},G={},K={};for(let L of Y)X[L]=Z?.[L]??$[L].getDefaultValue(),J[L]=[],Q[L]=!1,G[L]=!1,K[L]=!1;let W=!1;async function _(L){K[L]=!0;let V=await $[L].validate(X[L],X);return J[L]=V,K[L]=!1,V.length===0}async function B(){W=!0;let L=await Promise.all(Y.map(_));return W=!1,L.every(Boolean)}function U(){for(let L of Y)X[L]=Z?.[L]??$[L].getDefaultValue(),J[L]=[],Q[L]=!1,G[L]=!1}function z(L){for(let V of Y)if(V in L)X[V]=L[V],G[V]=!0}function q(L,V){X[L]=V,G[L]=!0}function j(L,V=!0){if(Q[L]=V,V)_(L)}function H(L){return{value:X[L],errors:J[L],touched:Q[L],dirty:G[L],valid:J[L].length===0,validating:K[L]}}function O(L){return async(V)=>{V?.preventDefault?.();for(let N of Y)Q[N]=!0;if(await B())await L(X)}}return{values:X,errors:J,touched:Q,dirty:G,get isValid(){return Y.every((L)=>J[L].length===0)},get isValidating(){return W||Y.some((L)=>K[L])},get isDirty(){return Y.some((L)=>G[L])},validate:B,validateField:_,reset:U,setValues:z,setFieldValue:q,setFieldTouched:j,getFieldState:H,handleSubmit:O}}function YU($,Z,Y){let X=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(X,(J,Q,G)=>{try{let K=Q.trim().split("."),W=Z;for(let B of K)if(W&&typeof W==="object"&&B in W)W=W[B];else return"";let _=W;if(!_||!Array.isArray(_)||_.length===0)return"";return _.map((B)=>{return G.replace(/\{\{\s*message\s*\}\}/g,B)}).join(`
10447
+ `})}function l$($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>l$(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((X,J)=>Y.set(l$(J),l$(X))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((X)=>Y.add(l$(X))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=l$($[Y]);return Z}function tB($,Z=100){let Y=$7($()),X=null,J=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{Y.value=$()},Z)};return w4($).subscribe(()=>J()),{get value(){return Y.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){J()},get dirty(){return!1},get deps(){return new Set}}}function eB($,Z=100){let Y=$7($()),X=0,J=()=>{let G=Date.now();if(G-X>=Z)X=G,Y.value=$()};return w4($).subscribe(()=>J()),{get value(){return Y.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){J()},get dirty(){return!1},get deps(){return new Set}}}var b1=null,k8,A4,pA;var ZU=D(()=>{k8=[],A4=new WeakMap;pA={ref:$7,computed:w4,watch:nB,watchMultiple:sB,watchEffect:rB,isRef:M$,unref:cB,toRefs:lB,shallowRef:iB,debouncedComputed:tB,throttledComputed:eB,processComputedDirectives:oB,processWatchDirectives:aB}});var QU={};Q0(QU,{v:()=>cA,processHasErrorsDirective:()=>JU,processFormValidationDirectives:()=>iA,processErrorsDirective:()=>XU,processErrorDirective:()=>YU,defineForm:()=>lA,Validator:()=>Z7});class Z7{rules=[];defaultValue="";addRule($){let Z=new Z7;return Z.rules=[...this.rules,$],Z.defaultValue=this.defaultValue,Z}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(Z)=>{if(Z===null||Z===void 0)return $;if(typeof Z==="string"&&Z.trim()==="")return $;if(Array.isArray(Z)&&Z.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(Z)=>{if(!Z)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(Z))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(Z)=>{if(!Z)return!0;try{return new URL(String(Z)),!0}catch{return $}}})}min($,Z){let Y=Z||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length>=$||Y}})}max($,Z){let Y=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length<=$||Y}})}length($,Z,Y){let X=Y||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:X,validate:(J)=>{if(!J)return!0;let Q=String(J).length;return Q>=$&&Q<=Z||X}})}pattern($,Z="Invalid format"){return this.addRule({name:"pattern",message:Z,validate:(Y)=>{if(!Y)return!0;return $.test(String(Y))||Z}})}hasUppercase($="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,$)}hasLowercase($="Must contain a lowercase letter"){return this.pattern(/[a-z]/,$)}hasNumber($="Must contain a number"){return this.pattern(/\d/,$)}hasSpecial($="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,$)}alphanumeric($="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,$)}startsWithLetter($="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,$)}noSpaces($="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:$,validate:(Z)=>{if(!Z)return!0;return!String(Z).includes(" ")||$}})}number($="Must be a number"){let Z=this.addRule({name:"number",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return!Number.isNaN(Number(Y))||$}});return Z.defaultValue=0,Z}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number.isInteger(Number(Z))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)<0||$}})}minValue($,Z){let Y=Z||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)>=$||Y}})}maxValue($,Z){let Y=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)<=$||Y}})}between($,Z,Y){let X=Y||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:X,validate:(J)=>{if(!J&&J!==0)return!0;let Q=Number(J);return Q>=$&&Q<=Z||X}})}matches($,Z){let Y=Z||`Must match ${$}`;return this.addRule({name:"matches",message:Y,validate:(X,J)=>{if(!J)return!0;return X===J[$]||Y}})}oneOf($,Z){let Y=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Y,validate:(X)=>{if(!X)return!0;return $.includes(X)||Y}})}notOneOf($,Z){let Y=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Y,validate:(X)=>{if(!X)return!0;return!$.includes(X)||Y}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Z)=>{if(!Z)return!0;let Y=new Date(String(Z));return!Number.isNaN(Y.getTime())||$}})}before($,Z){let Y=new Date($),X=Z||`Must be before ${Y.toLocaleDateString()}`;return this.addRule({name:"before",message:X,validate:(J)=>{if(!J)return!0;return new Date(String(J))<Y||X}})}after($,Z){let Y=new Date($),X=Z||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:X,validate:(J)=>{if(!J)return!0;return new Date(String(J))>Y||X}})}custom($,Z="Invalid value"){return this.addRule({name:"custom",message:Z,validate:$})}async($,Z="Invalid value"){return this.addRule({name:"async",message:Z,async:!0,validate:$})}when($,Z){let Y=new Z7;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let X of Z.getRules())Y.rules.push({...X,validate:(J,Q)=>{if(!$(J,Q||{}))return!0;return X.validate(J,Q)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new Z7;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let Y=[];for(let X of this.rules){let J=await X.validate($,Z);if(J!==!0)Y.push(J)}return Y}validateSync($,Z){let Y=[];for(let X of this.rules){if(X.async)continue;let J=X.validate($,Z);if(J!==!0)Y.push(J)}return Y}}function lA($,Z){let Y=Object.keys($),X={},J={},Q={},G={},K={};for(let L of Y)X[L]=Z?.[L]??$[L].getDefaultValue(),J[L]=[],Q[L]=!1,G[L]=!1,K[L]=!1;let W=!1;async function _(L){K[L]=!0;let V=await $[L].validate(X[L],X);return J[L]=V,K[L]=!1,V.length===0}async function B(){W=!0;let L=await Promise.all(Y.map(_));return W=!1,L.every(Boolean)}function U(){for(let L of Y)X[L]=Z?.[L]??$[L].getDefaultValue(),J[L]=[],Q[L]=!1,G[L]=!1}function z(L){for(let V of Y)if(V in L)X[V]=L[V],G[V]=!0}function q(L,V){X[L]=V,G[L]=!0}function j(L,V=!0){if(Q[L]=V,V)_(L)}function H(L){return{value:X[L],errors:J[L],touched:Q[L],dirty:G[L],valid:J[L].length===0,validating:K[L]}}function O(L){return async(V)=>{V?.preventDefault?.();for(let N of Y)Q[N]=!0;if(await B())await L(X)}}return{values:X,errors:J,touched:Q,dirty:G,get isValid(){return Y.every((L)=>J[L].length===0)},get isValidating(){return W||Y.some((L)=>K[L])},get isDirty(){return Y.some((L)=>G[L])},validate:B,validateField:_,reset:U,setValues:z,setFieldValue:q,setFieldTouched:j,getFieldState:H,handleSubmit:O}}function YU($,Z,Y){let X=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(X,(J,Q,G)=>{try{let K=Q.trim().split("."),W=Z;for(let B of K)if(W&&typeof W==="object"&&B in W)W=W[B];else return"";let _=W;if(!_||!Array.isArray(_)||_.length===0)return"";return _.map((B)=>{return G.replace(/\{\{\s*message\s*\}\}/g,B)}).join(`
10448
10448
  `)}catch{return""}})}function XU($,Z,Y){let X=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(X,(J,Q,G)=>{try{let K=Q.trim().split("."),W=Z;for(let B of K)if(W&&typeof W==="object"&&B in W)W=W[B];else return"";let _=W;if(!_||!Array.isArray(_)||_.length===0)return"";return _.map((B)=>G.replace(/\{\{\s*message\s*\}\}/g,B)).join(`
10449
10449
  `)}catch{return""}})}function JU($,Z,Y){let X=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(X,(J,Q,G)=>{try{let K=Q.trim().split("."),W=Z;for(let B of K)if(W&&typeof W==="object"&&B in W)W=W[B];else return"";let _=W;if(!_||!Array.isArray(_)||_.length===0)return"";return G}catch{return""}})}function iA($,Z,Y){let X=$;return X=YU(X,Z,Y),X=XU(X,Z,Y),X=JU(X,Z,Y),X}var cA;var GU=D(()=>{cA=new Z7});var _U={};Q0(_U,{processXElementDirectives:()=>nA,hasXElementDirectives:()=>WU,generateXElementRuntime:()=>KU});function KU(){return`<script data-stx-scoped>
10450
10450
  (function() {
@@ -10732,14 +10732,14 @@ else {
10732
10732
  })();
10733
10733
  </script>`}function WU($){return/\bx-(data|model|text|show|init|html)\b/.test($)||/\s:[a-z]/.test($)}function nA($){if(!WU($))return $;let Z=KU(),Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+Z+`
10734
10734
  `+$.slice(Y);return $+`
10735
- `+Z}var BU=()=>{};function JJ($){return $.pwa?.serviceWorker?.fileName||"sw.js"}var UU=D(()=>{BU()});var zU={};Q0(zU,{injectPwaTags:()=>sA,generateThemeColorMeta:()=>aA,generateSwRegistrationScript:()=>rA,generatePwaTags:()=>S8,generateManifestLink:()=>oA});function S8($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,X=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",J=JJ($),Q=`
10735
+ `+Z}var BU=()=>{};function X2($){return $.pwa?.serviceWorker?.fileName||"sw.js"}var UU=D(()=>{BU()});var zU={};Q0(zU,{injectPwaTags:()=>sA,generateThemeColorMeta:()=>aA,generateSwRegistrationScript:()=>rA,generatePwaTags:()=>S8,generateManifestLink:()=>oA});function S8($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,X=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",J=X2($),Q=`
10736
10736
  <!-- stx PWA Meta Tags -->
10737
10737
  <link rel="manifest" href="/manifest.json">
10738
- <meta name="theme-color" content="${QJ(Y?.themeColor||"#000000")}">
10738
+ <meta name="theme-color" content="${J2(Y?.themeColor||"#000000")}">
10739
10739
  <meta name="mobile-web-app-capable" content="yes">
10740
10740
  <meta name="apple-mobile-web-app-capable" content="yes">
10741
10741
  <meta name="apple-mobile-web-app-status-bar-style" content="default">
10742
- <meta name="apple-mobile-web-app-title" content="${QJ(Y?.shortName||Y?.name||"App")}">`;if(Z.icons?.generateAppleIcons!==!1)Q+=`
10742
+ <meta name="apple-mobile-web-app-title" content="${J2(Y?.shortName||Y?.name||"App")}">`;if(Z.icons?.generateAppleIcons!==!1)Q+=`
10743
10743
  <link rel="apple-touch-icon" href="${X}/apple-touch-icon.png">
10744
10744
  <link rel="apple-touch-icon" sizes="120x120" href="${X}/apple-touch-icon-120x120.png">
10745
10745
  <link rel="apple-touch-icon" sizes="152x152" href="${X}/apple-touch-icon-152x152.png">
@@ -10781,7 +10781,7 @@ if ('serviceWorker' in navigator) {
10781
10781
  </head>`)}function rA($){if(!$.pwa?.enabled)return"";return`<script>
10782
10782
  if ('serviceWorker' in navigator) {
10783
10783
  window.addEventListener('load', function() {
10784
- navigator.serviceWorker.register('/${JJ($)}')
10784
+ navigator.serviceWorker.register('/${X2($)}')
10785
10785
  .then(function(registration) {
10786
10786
  console.log('[PWA] Service Worker registered:', registration.scope);
10787
10787
  })
@@ -10790,32 +10790,32 @@ if ('serviceWorker' in navigator) {
10790
10790
  });
10791
10791
  });
10792
10792
  }
10793
- </script>`}function oA(){return'<link rel="manifest" href="/manifest.json">'}function aA($){return`<meta name="theme-color" content="${QJ($)}">`}function QJ($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var qU=D(()=>{UU()});import $1 from"path";function tA($,Z){let Y=$.length,X=Z,J=!0,Q=[],G=(K)=>K+9<=Y&&$[K]==="<"&&$[K+1]==="/"&&($[K+2]==="s"||$[K+2]==="S")&&($[K+3]==="c"||$[K+3]==="C")&&($[K+4]==="r"||$[K+4]==="R")&&($[K+5]==="i"||$[K+5]==="I")&&($[K+6]==="p"||$[K+6]==="P")&&($[K+7]==="t"||$[K+7]==="T")&&($[K+8]===">"||/\s/.test($[K+8]));while(X<Y){let K=$[X];if(G(X))return X;if(K==="/"&&$[X+1]==="/"){if(X=$.indexOf(`
10793
+ </script>`}function oA(){return'<link rel="manifest" href="/manifest.json">'}function aA($){return`<meta name="theme-color" content="${J2($)}">`}function J2($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var qU=D(()=>{UU()});import $1 from"path";function tA($,Z){let Y=$.length,X=Z,J=!0,Q=[],G=(K)=>K+9<=Y&&$[K]==="<"&&$[K+1]==="/"&&($[K+2]==="s"||$[K+2]==="S")&&($[K+3]==="c"||$[K+3]==="C")&&($[K+4]==="r"||$[K+4]==="R")&&($[K+5]==="i"||$[K+5]==="I")&&($[K+6]==="p"||$[K+6]==="P")&&($[K+7]==="t"||$[K+7]==="T")&&($[K+8]===">"||/\s/.test($[K+8]));while(X<Y){let K=$[X];if(G(X))return X;if(K==="/"&&$[X+1]==="/"){if(X=$.indexOf(`
10794
10794
  `,X+2),X===-1)return-1;X+=1,J=!0;continue}if(K==="/"&&$[X+1]==="*"){let W=$.indexOf("*/",X+2);if(W===-1)return-1;X=W+2,J=!0;continue}if(K==="/"&&J){let W=X+1,_=!1;while(W<Y){let B=$[W];if(B==="\\"){W+=2;continue}if(B==="[")_=!0;else if(B==="]")_=!1;else if(B==="/"&&!_){W++;break}else if(B===`
10795
10795
  `){W=-1;break}W++}if(W===-1){X++,J=!1;continue}while(W<Y&&/[a-z]/.test($[W]))W++;X=W,J=!1;continue}if(K==="'"||K==='"'){let W=K;X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]===W){X++;break}if($[X]===`
10796
- `)break;X++}J=!1;continue}if(K==="`"){X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,J=!0;break}X++}if(Q.length===0)J=!1;continue}if(K==="}"&&Q.length>0){Q.pop(),X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++,J=!1;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,J=!0;break}X++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))J=!1;else J=!0;X++}return-1}async function Z0($,Z,Y,X,J){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;let Q=!Z.__stxProcessingDepth;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;try{return await x7.timeAsync("template-processing",async()=>{let G=await eA($,Z,Y,X,J);if(Q)G=v2(G);if(Q&&X.autoShell&&X.buildMode!=="compile"){let K=X.app?.head||{},_=(Z.__stx_runtime_head||null)??m5(),B={...K,..._.title&&{title:_.title},meta:[...K.meta||[],..._.meta||[]],link:[...K.link||[],..._.link||[]],script:[...K.script||[],..._.script||[]],..._.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},..._.htmlAttrs}},..._.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},..._.bodyAttrs}}};G=z4(G,B);let U=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(U&&G.includes("<head")){let q=U[1];G=G.replace("<head>",`<head>
10796
+ `)break;X++}J=!1;continue}if(K==="`"){X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,J=!0;break}X++}if(Q.length===0)J=!1;continue}if(K==="}"&&Q.length>0){Q.pop(),X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++,J=!1;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,J=!0;break}X++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))J=!1;else J=!0;X++}return-1}async function Z0($,Z,Y,X,J){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;let Q=!Z.__stxProcessingDepth;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;try{return await x7.timeAsync("template-processing",async()=>{let G=await eA($,Z,Y,X,J);if(Q)G=xJ(G);if(Q&&X.autoShell&&X.buildMode!=="compile"){let K=X.app?.head||{},_=(Z.__stx_runtime_head||null)??m5(),B={...K,..._.title&&{title:_.title},meta:[...K.meta||[],..._.meta||[]],link:[...K.link||[],..._.link||[]],script:[...K.script||[],..._.script||[]],..._.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},..._.htmlAttrs}},..._.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},..._.bodyAttrs}}};G=z4(G,B);let U=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(U&&G.includes("<head")){let q=U[1];G=G.replace("<head>",`<head>
10797
10797
  <meta name="stx-layout" content="${q}">`)}let z=G.match(/function (__stx_setup_\d+_\d+)\(/);if(z&&G.includes("<body")&&!G.match(/<body[^>]*data-stx=/)){G=G.replace(/<body([^>]*)>/,`<body$1 data-stx="${z[1]}">`);let q=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${z[1]}"`,"i");G=G.replace(q,"$1")}}if(Q)try{let{getStoreScript:K}=await Promise.resolve().then(() => (t_(),a_)),W=X.storesDir,_=await K(W);if(_){let B=`<script data-stx-stores>${_}</script>`,U=G.indexOf("<script data-stx-scoped>");if(U!==-1){let z=G.indexOf("</script>",U+24);if(z!==-1){let q=z+9;G=G.slice(0,q)+`
10798
- `+B+G.slice(q)}}}}catch{}if(Q&&Z.__stx_inject_css!==!1)G=await V0(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof t7)throw G;let K=G instanceof Error?G.message:String(G),W=new O1(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(u0.log(W,{filePath:Y,context:Z}),y5.logDetailedError(W,{filePath:Y,template:$.substring(0,500)}),X.debug)throw W;return q3.createFallbackContent("Template Processing",W)}}async function eA($,Z,Y,X,J){let Q=process.cwd(),G={...X,partialsDir:X.partialsDir&&!$1.isAbsolute(X.partialsDir)?$1.resolve(Q,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!$1.isAbsolute(X.componentsDir)?$1.resolve(Q,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!$1.isAbsolute(X.layoutsDir)?$1.resolve(Q,X.layoutsDir):X.layoutsDir},K=G,W=$;W=W.replace(/\{\{--[\s\S]*?--\}\}/g,"");let _="\x00STX_ESCAPED_AT\x00";W=W.replace(/@@/g,_),W=W.replace(/@\{\{([\s\S]*?)\}\}/g,(H,O)=>{return`{{ ${O} }}`}),W=J2(W),W=await n_(W,Y,J);let B={};W=t3(W,B);let U={...Z.__sections||{}},z="",q=/@nolayout\b/.test(W);if(q)W=W.replace(/@nolayout\b\s*/g,"");let j=W.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(j)z=j[1],W=W.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!z&&!q&&K.defaultLayout){let H=/<!DOCTYPE\s/i.test(W),O=/@section\s*\(/.test(W);if(!H||O){let F="",L=$1.dirname(Y),V=K.layoutsDir?$1.dirname(K.layoutsDir):process.cwd();for(let A=0;A<20;A++){let N=$1.join(L,"_layout.stx");if(await t(N)){F=N;break}let w=$1.dirname(L);if(w===L||w.length<V.length)break;L=w}if(F)z=F;else if(K.layoutsDir){let A=$1.isAbsolute(K.layoutsDir)?K.layoutsDir:$1.resolve(process.cwd(),K.layoutsDir),N=$1.join(A,`${K.defaultLayout}.stx`);if(await t(N))z=N}if(z&&!O)W=`@section('content')
10798
+ `+B+G.slice(q)}}}}catch{}if(Q&&Z.__stx_inject_css!==!1)G=await V0(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof t7)throw G;let K=G instanceof Error?G.message:String(G),W=new O1(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(u0.log(W,{filePath:Y,context:Z}),y5.logDetailedError(W,{filePath:Y,template:$.substring(0,500)}),X.debug)throw W;return q3.createFallbackContent("Template Processing",W)}}async function eA($,Z,Y,X,J){let Q=process.cwd(),G={...X,partialsDir:X.partialsDir&&!$1.isAbsolute(X.partialsDir)?$1.resolve(Q,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!$1.isAbsolute(X.componentsDir)?$1.resolve(Q,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!$1.isAbsolute(X.layoutsDir)?$1.resolve(Q,X.layoutsDir):X.layoutsDir},K=G,W=$;W=W.replace(/\{\{--[\s\S]*?--\}\}/g,"");let _="\x00STX_ESCAPED_AT\x00";W=W.replace(/@@/g,_),W=W.replace(/@\{\{([\s\S]*?)\}\}/g,(H,O)=>{return`{{ ${O} }}`}),W=XJ(W),W=await n_(W,Y,J);let B={};W=t3(W,B);let U={...Z.__sections||{}},z="",q=/@nolayout\b/.test(W);if(q)W=W.replace(/@nolayout\b\s*/g,"");let j=W.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(j)z=j[1],W=W.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!z&&!q&&K.defaultLayout){let H=/<!DOCTYPE\s/i.test(W),O=/@section\s*\(/.test(W);if(!H||O){let F="",L=$1.dirname(Y),V=K.layoutsDir?$1.dirname(K.layoutsDir):process.cwd();for(let A=0;A<20;A++){let N=$1.join(L,"_layout.stx");if(await t(N)){F=N;break}let w=$1.dirname(L);if(w===L||w.length<V.length)break;L=w}if(F)z=F;else if(K.layoutsDir){let A=$1.isAbsolute(K.layoutsDir)?K.layoutsDir:$1.resolve(process.cwd(),K.layoutsDir),N=$1.join(A,`${K.defaultLayout}.stx`);if(await t(N))z=N}if(z&&!O)W=`@section('content')
10799
10799
  ${W.trim()}
10800
10800
  @endsection`}}if(W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(H,O,F)=>{return U[O]=F,""}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(H,O,F)=>{if(F.includes("@parent"))U[O]=F.replace("@parent",i$);else U[O]=F.trim();return""}),Z.__sections=U,W=W.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(H,O,F)=>{return U[O]||F||""}),!("slot"in Z)||Z.slot===void 0)W=W.replace(/\{\{\s*slot\s*\}\}/g,()=>{return U.content||""});if(W=e3(W,B),z)try{let H=$1.isAbsolute(z)?z:await M1(()=>$4(z,Y,G,J),null,()=>{throw new O1(`Failed to resolve layout path: ${z}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!H){let N=`Layout not found: ${z} (referenced from ${Y})`;if(u0.log(Error(N),{layoutPath:z,filePath:Y},"warning"),G.debug)throw new O1(N,Y);return W}let O=await M1(()=>Bun.file(H).text(),"",()=>{throw new O1(`Failed to read layout file: ${H}`,Y,void 0,void 0,"Layout content could not be loaded")}),F=O.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F){if(G.debug)console.log(`Found nested layout: ${F[1]} in ${H}`);let N={},w=O.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(I,E,S)=>{return N[E]=S.trim(),""});for(let[I,E]of Object.entries(N))if(U[I]&&U[I].includes(i$)){let S=U[I].indexOf(i$);U[I]=U[I].slice(0,S)+E+U[I].slice(S+i$.length)}else if(!U[I])U[I]=E;let M={...Z,__sections:U},T=`@layout('${F[1]}')${w}`;return await Z0(T,M,H,G,J)}let L=O.replace(/\{\{--[\s\S]*?--\}\}/g,""),V=t3(L,B),A={};return V=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(N,w,M)=>{return A[w]=M.trim(),`@slot('${w}')`}),V=V.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(N,w,M)=>{if(U[w]){let T=U[w];if(T.includes(i$)){let I=A[w]||"",E=T.indexOf(i$);T=T.slice(0,E)+I+T.slice(E+i$.length)}return T}return M||""}),V=V.replace(/\{\{\s*slot\s*\}\}/g,()=>{return U.content||""}),V=e3(V,B),Z.__originalFilePath=Y,W=await jU(V,Z,H,G,J),W=`<!-- stx-layout: ${z} -->
10801
- ${W}`,W}catch(H){return u0.log(H instanceof Error?H:Error(String(H)),{layoutPath:z,filePath:Y},"error"),`[Error processing layout: ${H instanceof Error?H.message:String(H)}]`}return await jU(W,Z,Y,G,J)}async function jU($,Z,Y,X,J){let Q=$;Z.__stx_sfc_mode=!0;let G=X;if(await M1(()=>Z_(Y,Z),void 0,(u)=>{u0.log(u,{filePath:Y,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${Y}: ${u.message}`)}),Z.__stx_options=G,G.buildMode)Z.__stx_buildMode=G.buildMode;let K=G.envPrefix||"STX_PUBLIC_",W={};for(let[u,m]of Object.entries(process.env))if(u.startsWith(K)&&m!==void 0)W[u]=m;Z.$env=W,Q=await M1(()=>$2(Q,Z,Y,G),Q,(u)=>{u0.log(u,{filePath:Y,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Y}: ${u.message}`)});let _=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,B;while((B=_.exec(Q))!==null){let u=B[1],m=B[2];if(/\bserver\b/.test(u)&&m.trim())try{let{extractVariables:r}=await Promise.resolve().then(() => (F$(),l3));await r(m,Z,Y)}catch(r){let s=r instanceof Error?r:Error(String(r));u0.log(s,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${s.message}`)}}try{let{interpolateScriptsInTemplate:u}=await Promise.resolve().then(() => (d0(),y7));Q=u(Q,Z,{skipServer:!0})}catch(u){let m=u instanceof Error?u:Error(String(u));u0.log(m,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${m.message}`)}if(Q=await sW(Q,Z,Y),Q=await rW(Q,Z,Y),Q=await gX(Q,Z,Y,G),C7(Q))Q=q2(Q),Q=j2(Q,Z);Q=r3(Q,Z,Y,G),Q=await x2(Q,Z,Y,G,J),Q=await G2(Q,Z,Y,G,J),Q=lZ(Q,Z,Y,G);let{processDeferDirectives:U}=await Promise.resolve().then(() => ZB);Q=U(Q,Z,Y);let{processTeleportDirectives:z}=await Promise.resolve().then(() => QB);Q=z(Q,Z,Y);let{processTransitionDirectives:q,processTransitionAttributes:j}=await Promise.resolve().then(() => HB);Q=q(Q,Z,Y),Q=j(Q);let{processErrorBoundaryDirectives:H}=await Promise.resolve().then(() => LB);Q=H(Q,Z,Y);let{processSuspenseDirectives:O}=await Promise.resolve().then(() => RB);Q=O(Q,Z,Y);let{processAsyncDirectives:F}=await Promise.resolve().then(() => CB);Q=F(Q,Z,Y);let{processKeepAliveDirectives:L}=await Promise.resolve().then(() => uB);Q=L(Q,Z,Y);let{processVirtualListDirectives:V,processVirtualGridDirectives:A,processInfiniteListDirectives:N}=await Promise.resolve().then(() => (p2(),mB));Q=V(Q,Z,Y),Q=A(Q,Z,Y),Q=N(Q,Z,Y);let{processPartialHydrationDirectives:w,processStaticDirectives:M}=await Promise.resolve().then(() => (XJ(),pB));Q=w(Q,Z,Y),Q=M(Q);let{processComputedDirectives:T,processWatchDirectives:I}=await Promise.resolve().then(() => (ZU(),$U));Q=T(Q,Z,Y),Q=I(Q,Z,Y);let{processFormValidationDirectives:E}=await Promise.resolve().then(() => (GU(),QU));Q=E(Q,Z,Y);let{processHeadDirective:S,processTitleDirective:k,processMetaDirective:b,resetHead:P}=await Promise.resolve().then(() => (O$(),f3));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)P();let x=S(Q);if(Q=x.content,Q=k(Q,Z),Q=b(Q,Z),Q=eW(Q),Q=DX(Q,Z),Q=KW(Q),Q=tW(Q),Q=await a3(Q,Z,Y,G,J),Q=await x2(Q,Z,Y,G,J),Q=v2(Q),Q=u5(Q,Z,Y),Q=kX(Q,Z),Q=SX(Q,Z),Q=p5(Q,Z),Q=d3(Q,Z),Q=u3(Q,Z),Q=await RX(Q,Z,Y,G),Q=await aZ(Q,Z,Y),Q=await lX(Q,Z,Y,G),Q=pZ(Q,Z,Y,G),Q=eY(Q,Z,Y,G),Q=$X(Q,Z,Y),Q=ZX(Q,Z,Y,G),Q=xX(Q,Z,Y,G),Q=R8(Q,Z),Q=M8(Q),Q=r_(Q),!G.skipEventDirectives)Q=NX(Q,Z,Y);if(Q=cK(Q,Z,Y),G.debug){let u=/\bx-data\s*=/.test(Q),m=F8($);if(u&&m)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
10801
+ ${W}`,W}catch(H){return u0.log(H instanceof Error?H:Error(String(H)),{layoutPath:z,filePath:Y},"error"),`[Error processing layout: ${H instanceof Error?H.message:String(H)}]`}return await jU(W,Z,Y,G,J)}async function jU($,Z,Y,X,J){let Q=$;Z.__stx_sfc_mode=!0;let G=X;if(await M1(()=>Z_(Y,Z),void 0,(u)=>{u0.log(u,{filePath:Y,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${Y}: ${u.message}`)}),Z.__stx_options=G,G.buildMode)Z.__stx_buildMode=G.buildMode;let K=G.envPrefix||"STX_PUBLIC_",W={};for(let[u,m]of Object.entries(process.env))if(u.startsWith(K)&&m!==void 0)W[u]=m;Z.$env=W,Q=await M1(()=>eX(Q,Z,Y,G),Q,(u)=>{u0.log(u,{filePath:Y,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Y}: ${u.message}`)});let _=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,B;while((B=_.exec(Q))!==null){let u=B[1],m=B[2];if(/\bserver\b/.test(u)&&m.trim())try{let{extractVariables:r}=await Promise.resolve().then(() => (V$(),l3));await r(m,Z,Y)}catch(r){let s=r instanceof Error?r:Error(String(r));u0.log(s,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${s.message}`)}}try{let{interpolateScriptsInTemplate:u}=await Promise.resolve().then(() => (d0(),y7));Q=u(Q,Z,{skipServer:!0})}catch(u){let m=u instanceof Error?u:Error(String(u));u0.log(m,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${m.message}`)}if(Q=await sW(Q,Z,Y),Q=await rW(Q,Z,Y),Q=await fX(Q,Z,Y,G),C7(Q))Q=zJ(Q),Q=qJ(Q,Z);Q=r3(Q,Z,Y,G),Q=await PJ(Q,Z,Y,G,J),Q=await QJ(Q,Z,Y,G,J),Q=cZ(Q,Z,Y,G);let{processDeferDirectives:U}=await Promise.resolve().then(() => ZB);Q=U(Q,Z,Y);let{processTeleportDirectives:z}=await Promise.resolve().then(() => QB);Q=z(Q,Z,Y);let{processTransitionDirectives:q,processTransitionAttributes:j}=await Promise.resolve().then(() => HB);Q=q(Q,Z,Y),Q=j(Q);let{processErrorBoundaryDirectives:H}=await Promise.resolve().then(() => LB);Q=H(Q,Z,Y);let{processSuspenseDirectives:O}=await Promise.resolve().then(() => RB);Q=O(Q,Z,Y);let{processAsyncDirectives:F}=await Promise.resolve().then(() => CB);Q=F(Q,Z,Y);let{processKeepAliveDirectives:L}=await Promise.resolve().then(() => uB);Q=L(Q,Z,Y);let{processVirtualListDirectives:V,processVirtualGridDirectives:A,processInfiniteListDirectives:N}=await Promise.resolve().then(() => (mJ(),mB));Q=V(Q,Z,Y),Q=A(Q,Z,Y),Q=N(Q,Z,Y);let{processPartialHydrationDirectives:w,processStaticDirectives:M}=await Promise.resolve().then(() => (Y2(),pB));Q=w(Q,Z,Y),Q=M(Q);let{processComputedDirectives:T,processWatchDirectives:I}=await Promise.resolve().then(() => (ZU(),$U));Q=T(Q,Z,Y),Q=I(Q,Z,Y);let{processFormValidationDirectives:E}=await Promise.resolve().then(() => (GU(),QU));Q=E(Q,Z,Y);let{processHeadDirective:S,processTitleDirective:k,processMetaDirective:b,resetHead:P}=await Promise.resolve().then(() => (L$(),f3));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)P();let x=S(Q);if(Q=x.content,Q=k(Q,Z),Q=b(Q,Z),Q=eW(Q),Q=IX(Q,Z),Q=KW(Q),Q=tW(Q),Q=await a3(Q,Z,Y,G,J),Q=await PJ(Q,Z,Y,G,J),Q=xJ(Q),Q=u5(Q,Z,Y),Q=DX(Q,Z),Q=kX(Q,Z),Q=p5(Q,Z),Q=d3(Q,Z),Q=u3(Q,Z),Q=await wX(Q,Z,Y,G),Q=await oZ(Q,Z,Y),Q=await cX(Q,Z,Y,G),Q=mZ(Q,Z,Y,G),Q=tY(Q,Z,Y,G),Q=eY(Q,Z,Y),Q=$X(Q,Z,Y,G),Q=PX(Q,Z,Y,G),Q=R8(Q,Z),Q=M8(Q),Q=r_(Q),!G.skipEventDirectives)Q=VX(Q,Z,Y);if(Q=cK(Q,Z,Y),G.debug){let u=/\bx-data\s*=/.test(Q),m=F8($);if(u&&m)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
10802
10802
  Both work on the same page, but they manage separate scopes.
10803
- Prefer signals (state/derived/effect) for new components.`)}Q=$8(Q,Z),Q=await q1(Q,Z,Y),Q=o_(Q),Q=HX(Q);let{processXElementDirectives:C}=await Promise.resolve().then(() => _U);if(Q=C(Q),Q=await H2(Q,G,Y),Q=await Z2(Q,Z,Y,G),G.seo?.enabled)Q=YX(Q,Z,G);let{renderHead:f,getHead:g}=await Promise.resolve().then(() => (O$(),f3)),h=Z.__stx_runtime_head,l=h&&(h.title||h.meta?.length||h.link?.length)?h:g();if(l.title||l.meta?.length||l.link?.length){let u=f(l);if(u){if(Q.includes("</head>"))Q=Q.replace("</head>",`${u}
10803
+ Prefer signals (state/derived/effect) for new components.`)}Q=$8(Q,Z),Q=await q1(Q,Z,Y),Q=o_(Q),Q=jX(Q);let{processXElementDirectives:C}=await Promise.resolve().then(() => _U);if(Q=C(Q),Q=await jJ(Q,G,Y),Q=await $J(Q,Z,Y,G),G.seo?.enabled)Q=ZX(Q,Z,G);let{renderHead:f,getHead:g}=await Promise.resolve().then(() => (L$(),f3)),h=Z.__stx_runtime_head,l=h&&(h.title||h.meta?.length||h.link?.length)?h:g();if(l.title||l.meta?.length||l.link?.length){let u=f(l);if(u){if(Q.includes("</head>"))Q=Q.replace("</head>",`${u}
10804
10804
  </head>`);else if(Q.includes("<head>"))Q=Q.replace("<head>",`<head>
10805
10805
  ${u}`)}}if(x.headContent){if(Q.includes("</head>"))Q=Q.replace("</head>",`${x.headContent}
10806
10806
  </head>`);else if(Q.includes("<head>"))Q=Q.replace("<head>",`<head>
10807
- ${x.headContent}`)}if(G.csp?.enabled&&G.csp.addMetaTag)Q=PX(Q,G.csp,Z);if(G.analytics?.enabled)Q=FX(Q,G);if(G.heatmap?.enabled)Q=sZ(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:u}=await Promise.resolve().then(() => (qU(),zU));Q=u(Q,G)}let i=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),Y0=/\bSTX\.\w+/.test(Q),W0=/window\.STX\s*=/.test(Q);if(i&&Y0&&!W0){let m=`<script data-stx-scoped>
10807
+ ${x.headContent}`)}if(G.csp?.enabled&&G.csp.addMetaTag)Q=yX(Q,G.csp,Z);if(G.analytics?.enabled)Q=LX(Q,G);if(G.heatmap?.enabled)Q=nZ(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:u}=await Promise.resolve().then(() => (qU(),zU));Q=u(Q,G)}let i=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),Y0=/\bSTX\.\w+/.test(Q),W0=/window\.STX\s*=/.test(Q);if(i&&Y0&&!W0){let m=`<script data-stx-scoped>
10808
10808
  ${SK()}
10809
10809
  </script>`;if(Q.includes("</head>")){let a=Q.indexOf("</head>"),s=Q.slice(0,a).indexOf("<script");if(s!==-1){let J0=Q.slice(0,s),z0=Q.slice(s);Q=J0+m+`
10810
10810
  `+z0}else Q=Q.replace("</head>",`${m}
10811
10811
  </head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
10812
10812
  ${m}`);else Q=m+`
10813
- `+Q}{let u=/<script\s+server\b[^>]*>/gi,m,a=[];while((m=u.exec(Q))!==null){let r=m.index+m[0].length,s=tA(Q,r);if(s===-1)continue;let J0=s+9;while(J0<Q.length&&/\s/.test(Q[J0]))J0++;a.push({start:m.index,end:J0})}for(let r=a.length-1;r>=0;r--){let{start:s,end:J0}=a[r];Q=Q.substring(0,s)+Q.substring(J0)}}let D0=U4(Q,Y);if(D0.hasScoped)Q=D0.html;let M0=Z.__stx_event_bindings||[],v=!1,d=[],n=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:p}=await Promise.resolve().then(() => (O2(),T_));for(let u of p(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}))d.push({match:u.fullMatch,attrs:u.attrs,content:u.body});for(let{match:u,attrs:m,content:a}of d){v=!0;let r=a;T8(a,Y,X.strict);let s=await f$(a,{eventBindings:M0,attrs:m,hasColonDirectives:n,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:X.buildMode==="compile"});Q=Q.replace(u,()=>s)}if(v)Z.__stx_event_bindings=[];return Q}var i$="<!--PARENT_CONTENT_PLACEHOLDER-->";var _1=D(()=>{E1();x6();bK();OX();VX();u6();d6();AX();I7();d5();C3();vX();WW();hX();X1();O$();d0();mX();iX();c5();aW();o3();m6();Y2();g$();$_();F3();q0();Y_();X2();Q2();K2();Z8();O2();c_();s_();f2();g2();f2();g2()});function HU($){let Z=[],Y=[];return Xw($,Z),Jw($,Z,Y),Qw($,Y),Gw($,Z),{valid:Z.length===0,errors:Z,warnings:Y}}function Xw($,Z){let Y=($.match(/\{\{/g)||[]).length,X=($.match(/\}\}/g)||[]).length;if(Y!==X)Z.push({type:"expression",message:`Unclosed expression brackets: found ${Y} opening '{{' and ${X} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function Jw($,Z,Y){for(let X of $w){let J=new RegExp(`${X.open}(?:\\s|\\()`,"g"),Q=new RegExp(X.close,"g"),G=($.match(J)||[]).length,K=($.match(Q)||[]).length;if(X.altClose){let W=new RegExp(X.altClose,"g");K+=($.match(W)||[]).length}if(G>K)Z.push({type:"directive",message:`Unclosed @${X.name} directive: found ${G} opening and ${K} closing`,suggestion:`Add ${G-K} missing ${X.close} tag(s)`});else if(K>G)Y.push({type:"directive",message:`Extra ${X.close} found: ${K-G} more closing than opening`,suggestion:`Check for orphaned ${X.close} tags`})}}function Qw($,Z){for(let Y of Zw)if(Y.pattern.test($))Z.push({type:"syntax",message:Y.message,suggestion:Y.suggestion})}function Gw($,Z){for(let Y of Yw)if(Y.pattern.test($))Z.push({type:"expression",message:`Security warning: ${Y.message}`,suggestion:"Remove dangerous code from template expressions"})}function OU($,Z){let Y=$.slice(0,Z).split(`
10814
- `);return{line:Y.length,column:Y[Y.length-1].length+1}}function LU($,Z,Y){let X=[];switch($){case"if":case"elseif":case"unless":if(Y.length===0)X.push({type:"syntax",message:`@${$} requires a condition`,suggestion:`Use @${$}(condition)`});break;case"foreach":if(Y.length===0||!Y[0].includes(" as "))X.push({type:"syntax",message:'@foreach requires "items as item" syntax',suggestion:"Use @foreach(items as item) or @foreach(items as key => value)"});break;case"for":if(Y.length===0)X.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(Y.length===0)X.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(Y.length===0)X.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(Y.length===0)X.push({type:"syntax",message:`@${$} requires a path`,suggestion:`Use @${$}('path/to/template')`});break}return X}function FU($){return/@[a-z]+/i.test($)||/\{\{/.test($)}function VU($){let Z=$.matchAll(/@([a-z]+)/gi),Y=new Set;for(let X of Z){let J=X[1].toLowerCase();if(!J.startsWith("end"))Y.add(J)}return Array.from(Y)}var $w,Zw,Yw;var NU=D(()=>{$w=[{open:"@if",close:"@endif",name:"if"},{open:"@unless",close:"@endunless",name:"unless"},{open:"@foreach",close:"@endforeach",name:"foreach"},{open:"@for",close:"@endfor",name:"for"},{open:"@while",close:"@endwhile",name:"while"},{open:"@forelse",close:"@endforelse",name:"forelse"},{open:"@switch",close:"@endswitch",name:"switch"},{open:"@isset",close:"@endisset",name:"isset"},{open:"@empty",close:"@endempty",name:"empty"},{open:"@auth",close:"@endauth",name:"auth"},{open:"@guest",close:"@endguest",name:"guest"},{open:"@can",close:"@endcan",name:"can"},{open:"@cannot",close:"@endcannot",name:"cannot"},{open:"@section",close:"@endsection",name:"section",altClose:"@show"},{open:"@push",close:"@endpush",name:"push"},{open:"@prepend",close:"@endprepend",name:"prepend"},{open:"@once",close:"@endonce",name:"once"},{open:"@markdown",close:"@endmarkdown",name:"markdown"},{open:"@component",close:"@endcomponent",name:"component"}],Zw=[{pattern:/@if\s*[^(]/,message:"@if directive missing parentheses",suggestion:"Use @if(condition)"},{pattern:/@foreach\s*[^(]/,message:"@foreach directive missing parentheses",suggestion:"Use @foreach(items as item)"},{pattern:/@foreach\([^)]*\)\s*[^@\n<]/,message:"@foreach may have content on same line",suggestion:"Put content on new line after @foreach()"},{pattern:/@include\s*[^(]/,message:"@include directive missing parentheses",suggestion:"Use @include('partial-name')"},{pattern:/@extends\s*[^(]/,message:"@extends directive missing parentheses",suggestion:"Use @extends('layout-name') or @layout('layout-name')"},{pattern:/@layout\s*[^(]/,message:"@layout directive missing parentheses",suggestion:"Use @layout('layout-name')"}],Yw=[{pattern:/\{\{\s*constructor\s*\}\}/,message:"Attempting to access constructor property"},{pattern:/\{\{\s*__proto__\s*\}\}/,message:"Attempting to access __proto__ property"},{pattern:/\{\{\s*eval\s*\(/,message:"Attempting to use eval in expression"}]});var TU={};Q0(TU,{renderSlot:()=>KJ,processSlots:()=>WJ,parseSlots:()=>GJ,parseSlotElement:()=>AU,extractSlotContent:()=>RU,applySlots:()=>MU});function Kw($,Z){let Y=1,X=Z,J="<template",Q="</template";while(X<$.length&&Y>0){let G=$.indexOf("<",X);if(G===-1)break;if(X=G,$.startsWith(J,X)&&(X+J.length>=$.length||/[\s>\/]/.test($[X+J.length]))){Y++,X+=J.length;continue}if($.startsWith(Q,X)){let K=$.indexOf(">",X+Q.length);if(K!==-1){if(Y--,Y===0)return K+1;X=K+1;continue}}X++}return Y===0?X:-1}function GJ($){let Z={default:"",named:new Map},Y=$,X=/<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>/gi,J=[],Q;while((Q=X.exec($))!==null){let[B,U,z,q,j]=Q,H=U||z||q,O=Q.index+B.length,F=Kw($,O);if(F!==-1){let L=$.slice(O,F-11).trim();J.push({start:Q.index,end:F,slotName:H,content:L,propsBinding:j||void 0}),Z.named.set(H,{name:H,content:L,propsBinding:j||void 0})}}J.sort((B,U)=>U.start-B.start);for(let B of J)Y=Y.slice(0,B.start)+Y.slice(B.end);let G=[],K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,W;while((W=K.exec(Y))!==null){let[B,U,z,q,j,H]=W,O=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=(O+F).trim(),V=`<${U}${L?" "+L:""}>${H}</${U}>`;G.push({start:W.index,end:W.index+B.length,slotName:q,element:V})}let _=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((W=_.exec(Y))!==null){let[B,U,z,q,j]=W,H=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),O=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=(H+O).trim(),L=`<${U}${F?" "+F:""} />`;G.push({start:W.index,end:W.index+B.length,slotName:q,element:L})}G.sort((B,U)=>U.start-B.start);for(let B of G){let U=Z.named.get(B.slotName);if(U)U.content+=B.element;else Z.named.set(B.slotName,{name:B.slotName,content:B.element});Y=Y.slice(0,B.start)+Y.slice(B.end)}return Z.default=Y.trim(),Z}function AU($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[1]:"",X={},J=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,Q;while((Q=J.exec($))!==null)X[Q[1]]=Q[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:Y,props:X,defaultContent:K}}async function KJ($,Z,Y,X){if(!$)return Y;let J=$.content;if($.propsBinding&&Object.keys(Z).length>0){let Q=$.propsBinding.trim(),G={...X};if(Q.startsWith("{")&&Q.endsWith("}")){let K=Q.slice(1,-1).split(",").map((W)=>W.trim()).filter(Boolean);for(let W of K){let[_,B]=W.split(":").map((z)=>z.trim()),U=B||_;if(Z[_]!==void 0)G[U]=Z[_]}}else G[Q]=Z;J=Ww(J,G)}return J}function Ww($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,X)=>{try{let J=X.trim(),Q=wU(J,Z);return w0(String(Q??""))}catch{return`{{ ${X} }}`}})}function wU($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let X=$.split("."),J=Z;for(let Q of X)if(J&&typeof J==="object"&&Q in J)J=J[Q];else return;return J}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,X,J,Q]=Y,G=Z[X],K=parseInt(Q,10);if(typeof G==="number")switch(J){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!B0($))return;return j0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function WJ($,Z,Y){let X=$;X=await _w(X,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,W,_)=>{let B=Z.named.get(K),U=_?.trim()||"",z=W||"",q={},j=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=j.exec(z))!==null){let O=H[1],F=H[2];q[O]=wU(F,Y)}return await KJ(B,q,U,Y)});let Q=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return X=X.replace(Q,(G,K)=>{if(G.includes("name="))return G;let W=K?.trim()||"";return Z.default||W}),X}async function _w($,Z,Y){let X=[],J=[];$.replace(Z,(K,...W)=>{let _=W[W.length-2];return J.push({match:K,index:_}),X.push(Y(K,...W.slice(0,-2))),K});let Q=await Promise.all(X),G=$;for(let K=J.length-1;K>=0;K--){let{match:W,index:_}=J[K];G=G.slice(0,_)+Q[K]+G.slice(_+W.length)}return G}function RU($){let Z=GJ($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function MU($,Z,Y,X){return await WJ($,{default:Z,named:Y},X)}var _J=D(()=>{d0();h0()});import Bw from"fs";import X0 from"path";function zw($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function EU($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function Y$($){return!EU($)}function X$($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Y=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`});let J=new Bun.Transpiler({loader:"ts",target:"browser",define:K1()}).transformSync(Z);for(let Q=0;Q<Y.length;Q++)J=J.replace(`"__STX_EXPR_${Q}__"`,Y[Q]),J=J.replace(`'__STX_EXPR_${Q}__'`,Y[Q]);return J}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function qw($){let Z=[],Y=new Set,X=0,J=0,Q=$.length,G=(B)=>{J++;while(J<Q){if($[J]==="\\"){J+=2;continue}if($[J]===B){J++;return}J++}},K=()=>{J++;while(J<Q){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;return}if($[J]==="$"&&$[J+1]==="{"){J+=2;let B=1;while(J<Q&&B>0)if($[J]==="{")B++;else if($[J]==="}")B--;else if($[J]==="'"||$[J]==='"')G($[J]);else if($[J]==="`")K();else J++;continue}J++}},W=()=>{if($[J]==="/"&&$[J+1]==="/"){while(J<Q&&$[J]!==`
10815
- `)J++;return!0}if($[J]==="/"&&$[J+1]==="*"){J+=2;while(J<Q-1&&!($[J]==="*"&&$[J+1]==="/"))J++;return J+=2,!0}return!1},_=()=>{if(X!==0)return;let B=$.slice(J).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(B){let j=B[2].split(",").map((H)=>{let O=H.trim().split(":");return O[O.length-1].trim()});for(let H of j)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!Y.has(H))Z.push(H),Y.add(H);return}let U=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let j=U[2];if(!Y.has(j))Z.push(j),Y.add(j);return}let z=$.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let j=z[1];if(!Y.has(j))Z.push(j),Y.add(j);return}let q=$.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(q){let j=q[1];if(!Y.has(j))Z.push(j),Y.add(j)}};while(J<Q){if(W())continue;if($[J]==="'"||$[J]==='"'){G($[J]);continue}if($[J]==="`"){K();continue}if($[J]==="{"){X++,J++;continue}if($[J]==="}"){X--,J++;continue}if(X===0&&/[a-z]/i.test($[J])&&(J===0||/\s|[;{}()]/.test($[J-1])))_();J++}return Z}async function D1($,Z,Y,X,J,Q,G,K=new Set,W){let{extractVariables:_}=await Promise.resolve().then(() => (F$(),l3)),B=K??new Set;if(B.has($))return`[Circular component reference: ${$}]`;let U=new Set(B);U.add($);try{let z=(v)=>v.split("-").map((d)=>d.charAt(0).toUpperCase()+d.slice(1)).join(""),q=(v)=>v.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),j=$.endsWith(".stx")?$.slice(0,-4):$,H=null,O=J.__importedComponents;if(O){let v=[j,j.toLowerCase(),z(j),q(j)];for(let d of v)if(O.has(d)){H=O.get(d);break}}let F=[];if(!H){let v=[`${j}.stx`,`${z(j)}.stx`,`${q(j)}.stx`],d=[...new Set(v)],n=J.__originalFilePath,p=[];if(n){let r=X0.join(X0.dirname(n),"components");p.push(r)}if(X)p.push(X);let u=X0.join(X0.dirname(Q),"components");if(!p.includes(u))p.push(u);if(G.componentsDir&&G.componentsDir!==X&&!p.includes(G.componentsDir))p.push(G.componentsDir);let m=process.cwd(),a=[X0.resolve(m,"src/components"),X0.resolve(m,"components"),X0.resolve(import.meta.dir,"components")];for(let r of a)if(!p.includes(r))p.push(r);if(j.startsWith("./")||j.startsWith("../"))H=X0.resolve(X0.dirname(Q),`${j}.stx`),F.push(H);else for(let r of p){if(!r)continue;for(let s of d){let J0=X0.join(r,s);if(F.push(J0),await t(J0)){H=J0;break}}if(H)break;if(!H)try{let s=await import("fs");if(!s.statSync(r,{throwIfNoEntry:!1})?.isDirectory())continue;let z0=s.readdirSync(r,{withFileTypes:!0});for(let l0 of z0)if(l0.isDirectory()){let X5=X0.join(r,l0.name);for(let J5 of d){let _0=X0.join(X5,J5);if(F.push(_0),await t(_0)){H=_0;break}}if(H)break}}catch{}if(H)break}}if(!H||!await t(H)){let v=F.length>0?`
10813
+ `+Q}{let u=/<script\s+server\b[^>]*>/gi,m,a=[];while((m=u.exec(Q))!==null){let r=m.index+m[0].length,s=tA(Q,r);if(s===-1)continue;let J0=s+9;while(J0<Q.length&&/\s/.test(Q[J0]))J0++;a.push({start:m.index,end:J0})}for(let r=a.length-1;r>=0;r--){let{start:s,end:J0}=a[r];Q=Q.substring(0,s)+Q.substring(J0)}}let D0=U4(Q,Y);if(D0.hasScoped)Q=D0.html;let M0=Z.__stx_event_bindings||[],v=!1,d=[],n=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:p}=await Promise.resolve().then(() => (HJ(),T_));for(let u of p(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}))d.push({match:u.fullMatch,attrs:u.attrs,content:u.body});for(let{match:u,attrs:m,content:a}of d){v=!0;let r=a;T8(a,Y,X.strict);let s=await f$(a,{eventBindings:M0,attrs:m,hasColonDirectives:n,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:X.buildMode==="compile"});Q=Q.replace(u,()=>s)}if(v)Z.__stx_event_bindings=[];return Q}var i$="<!--PARENT_CONTENT_PLACEHOLDER-->";var _1=D(()=>{E1();x6();bK();HX();FX();u6();d6();NX();I7();d5();C3();xX();WW();gX();X1();L$();d0();uX();lX();c5();aW();o3();m6();ZJ();g$();$_();F3();q0();Y_();YJ();JJ();GJ();Z8();HJ();c_();s_();vJ();fJ();vJ();fJ()});function HU($){let Z=[],Y=[];return Xw($,Z),Jw($,Z,Y),Qw($,Y),Gw($,Z),{valid:Z.length===0,errors:Z,warnings:Y}}function Xw($,Z){let Y=($.match(/\{\{/g)||[]).length,X=($.match(/\}\}/g)||[]).length;if(Y!==X)Z.push({type:"expression",message:`Unclosed expression brackets: found ${Y} opening '{{' and ${X} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function Jw($,Z,Y){for(let X of $w){let J=new RegExp(`${X.open}(?:\\s|\\()`,"g"),Q=new RegExp(X.close,"g"),G=($.match(J)||[]).length,K=($.match(Q)||[]).length;if(X.altClose){let W=new RegExp(X.altClose,"g");K+=($.match(W)||[]).length}if(G>K)Z.push({type:"directive",message:`Unclosed @${X.name} directive: found ${G} opening and ${K} closing`,suggestion:`Add ${G-K} missing ${X.close} tag(s)`});else if(K>G)Y.push({type:"directive",message:`Extra ${X.close} found: ${K-G} more closing than opening`,suggestion:`Check for orphaned ${X.close} tags`})}}function Qw($,Z){for(let Y of Zw)if(Y.pattern.test($))Z.push({type:"syntax",message:Y.message,suggestion:Y.suggestion})}function Gw($,Z){for(let Y of Yw)if(Y.pattern.test($))Z.push({type:"expression",message:`Security warning: ${Y.message}`,suggestion:"Remove dangerous code from template expressions"})}function OU($,Z){let Y=$.slice(0,Z).split(`
10814
+ `);return{line:Y.length,column:Y[Y.length-1].length+1}}function LU($,Z,Y){let X=[];switch($){case"if":case"elseif":case"unless":if(Y.length===0)X.push({type:"syntax",message:`@${$} requires a condition`,suggestion:`Use @${$}(condition)`});break;case"foreach":if(Y.length===0||!Y[0].includes(" as "))X.push({type:"syntax",message:'@foreach requires "items as item" syntax',suggestion:"Use @foreach(items as item) or @foreach(items as key => value)"});break;case"for":if(Y.length===0)X.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(Y.length===0)X.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(Y.length===0)X.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(Y.length===0)X.push({type:"syntax",message:`@${$} requires a path`,suggestion:`Use @${$}('path/to/template')`});break}return X}function FU($){return/@[a-z]+/i.test($)||/\{\{/.test($)}function VU($){let Z=$.matchAll(/@([a-z]+)/gi),Y=new Set;for(let X of Z){let J=X[1].toLowerCase();if(!J.startsWith("end"))Y.add(J)}return Array.from(Y)}var $w,Zw,Yw;var NU=D(()=>{$w=[{open:"@if",close:"@endif",name:"if"},{open:"@unless",close:"@endunless",name:"unless"},{open:"@foreach",close:"@endforeach",name:"foreach"},{open:"@for",close:"@endfor",name:"for"},{open:"@while",close:"@endwhile",name:"while"},{open:"@forelse",close:"@endforelse",name:"forelse"},{open:"@switch",close:"@endswitch",name:"switch"},{open:"@isset",close:"@endisset",name:"isset"},{open:"@empty",close:"@endempty",name:"empty"},{open:"@auth",close:"@endauth",name:"auth"},{open:"@guest",close:"@endguest",name:"guest"},{open:"@can",close:"@endcan",name:"can"},{open:"@cannot",close:"@endcannot",name:"cannot"},{open:"@section",close:"@endsection",name:"section",altClose:"@show"},{open:"@push",close:"@endpush",name:"push"},{open:"@prepend",close:"@endprepend",name:"prepend"},{open:"@once",close:"@endonce",name:"once"},{open:"@markdown",close:"@endmarkdown",name:"markdown"},{open:"@component",close:"@endcomponent",name:"component"}],Zw=[{pattern:/@if\s*[^(]/,message:"@if directive missing parentheses",suggestion:"Use @if(condition)"},{pattern:/@foreach\s*[^(]/,message:"@foreach directive missing parentheses",suggestion:"Use @foreach(items as item)"},{pattern:/@foreach\([^)]*\)\s*[^@\n<]/,message:"@foreach may have content on same line",suggestion:"Put content on new line after @foreach()"},{pattern:/@include\s*[^(]/,message:"@include directive missing parentheses",suggestion:"Use @include('partial-name')"},{pattern:/@extends\s*[^(]/,message:"@extends directive missing parentheses",suggestion:"Use @extends('layout-name') or @layout('layout-name')"},{pattern:/@layout\s*[^(]/,message:"@layout directive missing parentheses",suggestion:"Use @layout('layout-name')"}],Yw=[{pattern:/\{\{\s*constructor\s*\}\}/,message:"Attempting to access constructor property"},{pattern:/\{\{\s*__proto__\s*\}\}/,message:"Attempting to access __proto__ property"},{pattern:/\{\{\s*eval\s*\(/,message:"Attempting to use eval in expression"}]});var TU={};Q0(TU,{renderSlot:()=>G2,processSlots:()=>K2,parseSlots:()=>Q2,parseSlotElement:()=>AU,extractSlotContent:()=>RU,applySlots:()=>MU});function Kw($,Z){let Y=1,X=Z,J="<template",Q="</template";while(X<$.length&&Y>0){let G=$.indexOf("<",X);if(G===-1)break;if(X=G,$.startsWith(J,X)&&(X+J.length>=$.length||/[\s>\/]/.test($[X+J.length]))){Y++,X+=J.length;continue}if($.startsWith(Q,X)){let K=$.indexOf(">",X+Q.length);if(K!==-1){if(Y--,Y===0)return K+1;X=K+1;continue}}X++}return Y===0?X:-1}function Q2($){let Z={default:"",named:new Map},Y=$,X=/<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>/gi,J=[],Q;while((Q=X.exec($))!==null){let[B,U,z,q,j]=Q,H=U||z||q,O=Q.index+B.length,F=Kw($,O);if(F!==-1){let L=$.slice(O,F-11).trim();J.push({start:Q.index,end:F,slotName:H,content:L,propsBinding:j||void 0}),Z.named.set(H,{name:H,content:L,propsBinding:j||void 0})}}J.sort((B,U)=>U.start-B.start);for(let B of J)Y=Y.slice(0,B.start)+Y.slice(B.end);let G=[],K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,W;while((W=K.exec(Y))!==null){let[B,U,z,q,j,H]=W,O=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=(O+F).trim(),V=`<${U}${L?" "+L:""}>${H}</${U}>`;G.push({start:W.index,end:W.index+B.length,slotName:q,element:V})}let _=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((W=_.exec(Y))!==null){let[B,U,z,q,j]=W,H=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),O=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=(H+O).trim(),L=`<${U}${F?" "+F:""} />`;G.push({start:W.index,end:W.index+B.length,slotName:q,element:L})}G.sort((B,U)=>U.start-B.start);for(let B of G){let U=Z.named.get(B.slotName);if(U)U.content+=B.element;else Z.named.set(B.slotName,{name:B.slotName,content:B.element});Y=Y.slice(0,B.start)+Y.slice(B.end)}return Z.default=Y.trim(),Z}function AU($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[1]:"",X={},J=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,Q;while((Q=J.exec($))!==null)X[Q[1]]=Q[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:Y,props:X,defaultContent:K}}async function G2($,Z,Y,X){if(!$)return Y;let J=$.content;if($.propsBinding&&Object.keys(Z).length>0){let Q=$.propsBinding.trim(),G={...X};if(Q.startsWith("{")&&Q.endsWith("}")){let K=Q.slice(1,-1).split(",").map((W)=>W.trim()).filter(Boolean);for(let W of K){let[_,B]=W.split(":").map((z)=>z.trim()),U=B||_;if(Z[_]!==void 0)G[U]=Z[_]}}else G[Q]=Z;J=Ww(J,G)}return J}function Ww($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,X)=>{try{let J=X.trim(),Q=wU(J,Z);return w0(String(Q??""))}catch{return`{{ ${X} }}`}})}function wU($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let X=$.split("."),J=Z;for(let Q of X)if(J&&typeof J==="object"&&Q in J)J=J[Q];else return;return J}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,X,J,Q]=Y,G=Z[X],K=parseInt(Q,10);if(typeof G==="number")switch(J){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!B0($))return;return j0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function K2($,Z,Y){let X=$;X=await _w(X,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,W,_)=>{let B=Z.named.get(K),U=_?.trim()||"",z=W||"",q={},j=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=j.exec(z))!==null){let O=H[1],F=H[2];q[O]=wU(F,Y)}return await G2(B,q,U,Y)});let Q=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return X=X.replace(Q,(G,K)=>{if(G.includes("name="))return G;let W=K?.trim()||"";return Z.default||W}),X}async function _w($,Z,Y){let X=[],J=[];$.replace(Z,(K,...W)=>{let _=W[W.length-2];return J.push({match:K,index:_}),X.push(Y(K,...W.slice(0,-2))),K});let Q=await Promise.all(X),G=$;for(let K=J.length-1;K>=0;K--){let{match:W,index:_}=J[K];G=G.slice(0,_)+Q[K]+G.slice(_+W.length)}return G}function RU($){let Z=Q2($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function MU($,Z,Y,X){return await K2($,{default:Z,named:Y},X)}var W2=D(()=>{d0();h0()});import Bw from"fs";import X0 from"path";function zw($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function EU($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function X$($){return!EU($)}function J$($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Y=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`});let J=new Bun.Transpiler({loader:"ts",target:"browser",define:K1()}).transformSync(Z);for(let Q=0;Q<Y.length;Q++)J=J.replace(`"__STX_EXPR_${Q}__"`,Y[Q]),J=J.replace(`'__STX_EXPR_${Q}__'`,Y[Q]);return J}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function qw($){let Z=[],Y=new Set,X=0,J=0,Q=$.length,G=(B)=>{J++;while(J<Q){if($[J]==="\\"){J+=2;continue}if($[J]===B){J++;return}J++}},K=()=>{J++;while(J<Q){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;return}if($[J]==="$"&&$[J+1]==="{"){J+=2;let B=1;while(J<Q&&B>0)if($[J]==="{")B++;else if($[J]==="}")B--;else if($[J]==="'"||$[J]==='"')G($[J]);else if($[J]==="`")K();else J++;continue}J++}},W=()=>{if($[J]==="/"&&$[J+1]==="/"){while(J<Q&&$[J]!==`
10815
+ `)J++;return!0}if($[J]==="/"&&$[J+1]==="*"){J+=2;while(J<Q-1&&!($[J]==="*"&&$[J+1]==="/"))J++;return J+=2,!0}return!1},_=()=>{if(X!==0)return;let B=$.slice(J).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(B){let j=B[2].split(",").map((H)=>{let O=H.trim().split(":");return O[O.length-1].trim()});for(let H of j)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!Y.has(H))Z.push(H),Y.add(H);return}let U=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let j=U[2];if(!Y.has(j))Z.push(j),Y.add(j);return}let z=$.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let j=z[1];if(!Y.has(j))Z.push(j),Y.add(j);return}let q=$.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(q){let j=q[1];if(!Y.has(j))Z.push(j),Y.add(j)}};while(J<Q){if(W())continue;if($[J]==="'"||$[J]==='"'){G($[J]);continue}if($[J]==="`"){K();continue}if($[J]==="{"){X++,J++;continue}if($[J]==="}"){X--,J++;continue}if(X===0&&/[a-z]/i.test($[J])&&(J===0||/\s|[;{}()]/.test($[J-1])))_();J++}return Z}async function D1($,Z,Y,X,J,Q,G,K=new Set,W){let{extractVariables:_}=await Promise.resolve().then(() => (V$(),l3)),B=K??new Set;if(B.has($))return`[Circular component reference: ${$}]`;let U=new Set(B);U.add($);try{let z=(v)=>v.split("-").map((d)=>d.charAt(0).toUpperCase()+d.slice(1)).join(""),q=(v)=>v.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),j=$.endsWith(".stx")?$.slice(0,-4):$,H=null,O=J.__importedComponents;if(O){let v=[j,j.toLowerCase(),z(j),q(j)];for(let d of v)if(O.has(d)){H=O.get(d);break}}let F=[];if(!H){let v=[`${j}.stx`,`${z(j)}.stx`,`${q(j)}.stx`],d=[...new Set(v)],n=J.__originalFilePath,p=[];if(n){let r=X0.join(X0.dirname(n),"components");p.push(r)}if(X)p.push(X);let u=X0.join(X0.dirname(Q),"components");if(!p.includes(u))p.push(u);if(G.componentsDir&&G.componentsDir!==X&&!p.includes(G.componentsDir))p.push(G.componentsDir);let m=process.cwd(),a=[X0.resolve(m,"src/components"),X0.resolve(m,"components"),X0.resolve(import.meta.dir,"components")];for(let r of a)if(!p.includes(r))p.push(r);if(j.startsWith("./")||j.startsWith("../"))H=X0.resolve(X0.dirname(Q),`${j}.stx`),F.push(H);else for(let r of p){if(!r)continue;for(let s of d){let J0=X0.join(r,s);if(F.push(J0),await t(J0)){H=J0;break}}if(H)break;if(!H)try{let s=await import("fs");if(!s.statSync(r,{throwIfNoEntry:!1})?.isDirectory())continue;let z0=s.readdirSync(r,{withFileTypes:!0});for(let l0 of z0)if(l0.isDirectory()){let X5=X0.join(r,l0.name);for(let J5 of d){let _0=X0.join(X5,J5);if(F.push(_0),await t(_0)){H=_0;break}}if(H)break}}catch{}if(H)break}}if(!H||!await t(H)){let v=F.length>0?`
10816
10816
  Searched paths:
10817
10817
  ${F.map((d)=>` - ${d}`).join(`
10818
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${v}`}W.add(H);let L;if(R4.has(H))L=R4.get(H);else try{L=await Bun.file(H).text(),R4.set(H,L)}catch(v){return`[Error loading component: ${v instanceof Error?v.message:String(v)}]`}let V=new Set(["__originalFilePath","__importedComponents"]),A={};for(let[v,d]of Object.entries(J))if(!v.startsWith("__")||V.has(v))A[v]=d;let N={...A,...Z,props:Z,slot:Y,__processedComponents:U,__sections:{}},w=L,M=w.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(M)w=M[1].trim();let T=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,I=[...L.matchAll(T)],E=[];for(let v of I){let d=v[1]||"",n=v[2]||"",p=d.includes("server");if(Y$(d)&&n.trim())n=X$(n);if(p&&n)try{await _(n,N,H)}catch(m){}if(!p){let m=n.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),a=d.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");E.push(`<script${a}>${m}</script>`)}}let S=L.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),k=S?S[1]:"",b=S?S[2]:"",P="",x=k&&/\bscoped\b/i.test(k);if(S)P=`<style${k}>${b}</style>`;let C=w;if(C=C.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),S)C=C.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");if(Y&&C.includes("{{ text || slot }}"))C=C.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{extractSlotContent:f,applySlots:g}=await Promise.resolve().then(() => (_J(),TU)),{defaultSlot:h,namedSlots:l}=f(Y);C=await g(C,h||Y,l,N);for(let[v,d]of Object.entries(N))if(typeof d==="string"){if(d.includes("<")&&d.includes(">")||d.includes("&lt;")||d.includes("&quot;")){let n=b6(d);N[v]=n}}let i=E.some((v)=>/\b(state|derived|effect)\s*\(/.test(v)),Y0={...G,componentsDir:X0.dirname(H),skipSignalsRuntime:!0,skipEventDirectives:i,defaultLayout:void 0};N.__stxProcessingDepth=(J.__stxProcessingDepth||0)+1;let W0=await Z0(C,N,H,Y0,W),D0=`stx_${j.replace(/[^a-zA-Z0-9]/g,"_")}_${++Uw}_${Math.random().toString(36).slice(2,8)}`,M0=W0;if(i){let v="";if(Object.keys(Z).length>0)try{v=` data-stx-props="${zw(JSON.stringify(Z))}"`}catch{}if(M0=`<div data-stx-scope="${D0}"${v}>${W0}</div>`,M0=E.map((n)=>{let p=n.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!p)return n;let[,u,m]=p,a=Z$(m),r=`
10818
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${v}`}W.add(H);let L;if(R4.has(H))L=R4.get(H);else try{L=await Bun.file(H).text(),R4.set(H,L)}catch(v){return`[Error loading component: ${v instanceof Error?v.message:String(v)}]`}let V=new Set(["__originalFilePath","__importedComponents"]),A={};for(let[v,d]of Object.entries(J))if(!v.startsWith("__")||V.has(v))A[v]=d;let N={...A,...Z,props:Z,slot:Y,__processedComponents:U,__sections:{}},w=L,M=w.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(M)w=M[1].trim();let T=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,I=[...L.matchAll(T)],E=[];for(let v of I){let d=v[1]||"",n=v[2]||"",p=d.includes("server");if(X$(d)&&n.trim())n=J$(n);if(p&&n)try{await _(n,N,H)}catch(m){}if(!p){let m=n.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),a=d.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");E.push(`<script${a}>${m}</script>`)}}let S=L.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),k=S?S[1]:"",b=S?S[2]:"",P="",x=k&&/\bscoped\b/i.test(k);if(S)P=`<style${k}>${b}</style>`;let C=w;if(C=C.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),S)C=C.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");if(Y&&C.includes("{{ text || slot }}"))C=C.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{extractSlotContent:f,applySlots:g}=await Promise.resolve().then(() => (W2(),TU)),{defaultSlot:h,namedSlots:l}=f(Y);C=await g(C,h||Y,l,N);for(let[v,d]of Object.entries(N))if(typeof d==="string"){if(d.includes("<")&&d.includes(">")||d.includes("&lt;")||d.includes("&quot;")){let n=b6(d);N[v]=n}}let i=E.some((v)=>/\b(state|derived|effect)\s*\(/.test(v)),Y0={...G,componentsDir:X0.dirname(H),skipSignalsRuntime:!0,skipEventDirectives:i,defaultLayout:void 0};N.__stxProcessingDepth=(J.__stxProcessingDepth||0)+1;let W0=await Z0(C,N,H,Y0,W),D0=`stx_${j.replace(/[^a-zA-Z0-9]/g,"_")}_${++Uw}_${Math.random().toString(36).slice(2,8)}`,M0=W0;if(i){let v="";if(Object.keys(Z).length>0)try{v=` data-stx-props="${zw(JSON.stringify(Z))}"`}catch{}if(M0=`<div data-stx-scope="${D0}"${v}>${W0}</div>`,M0=E.map((n)=>{let p=n.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!p)return n;let[,u,m]=p,a=Y$(m),r=`
10819
10819
  (function() {
10820
10820
  const { state, derived, effect, batch } = window.stx;
10821
10821
  const __scope = window.stx._scopes = window.stx._scopes || {};
@@ -10843,9 +10843,9 @@ catch (e) {}
10843
10843
  `+P}else{if(P)M0+=`
10844
10844
  `+P;if(E.length>0){let v=N.__stx_event_bindings||[],d=await Promise.all(E.map(async(n)=>{let p=n.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!p)return n;return await f$(p[1],{eventBindings:v,templateContent:M0,filePath:H,projectRoot:process.cwd()})}));M0+=`
10845
10845
  `+d.join(`
10846
- `),N.__stx_event_bindings=[]}}if(x){let v=U4(M0,H);if(v.hasScoped)M0=v.html}return M0}catch(z){return`[Error processing component: ${z instanceof Error?z.message:String(z)}]`}finally{B.delete($)}}async function t($){return Bun.file($).exists()}function IU($,Z){let Y=X0.resolve(Z),X=X0.resolve($),J=Y.endsWith(X0.sep)?Y:Y+X0.sep;if(X===Y||X.startsWith(J))return X;return null}async function $4($,Z,Y,X){let J=await jw($,Z,Y,X);if(J===null)return null;let Q=IU(J,process.cwd());if(!Q)return console.warn(`[stx] rejected resolved template path that escapes project root: ${J} (template: ${$}, from: ${Z})`),null;return Q}async function jw($,Z,Y,X){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let J=X0.dirname(Z),Q=process.cwd();if($.startsWith("/")){let z=X0.join(Q,$),q=IU(z,Q);if(!q)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${q}`);if(await t(q)&&X)X.add(q);return q}let G=X0.join(J,$);if(await t(G)){if(Y.debug)console.log(`Found direct path: ${G}`);if(X)X.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let z of[".stx",".tsx",".jsx"]){let q=`${G}${z}`;if(await t(q)){if(Y.debug)console.log(`Found direct path with extension: ${q}`);if(X)X.add(q);return q}}let K="",W=X0.resolve(J),_=process.cwd();for(let z=0;z<10;z++){let q=X0.join(W,"layouts"),j=!1;try{j=Bw.statSync(q,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){K=q;break}let H=X0.dirname(W);if(H===W||H.length<_.length)break;W=H}if(K){let z=$.startsWith("layouts/")?$.slice(8):$,q=X0.join(K,z);if(await t(q)){if(Y.debug)console.log(`Found in current layouts dir: ${q}`);if(X)X.add(q);return q}if(!z.endsWith(".stx")){let j=`${q}.stx`;if(await t(j)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${j}`);if(X)X.add(j);return j}}}if(Y.layoutsDir){let z=X0.isAbsolute(Y.layoutsDir)?Y.layoutsDir:X0.resolve(process.cwd(),Y.layoutsDir),q=$.startsWith("layouts/")?$.slice(8):$,j=X0.join(z,q);if(await t(j)){if(Y.debug)console.log(`Found in options.layoutsDir: ${j}`);if(X)X.add(j);return j}if(!$.endsWith(".stx")){let H=`${j}.stx`;if(await t(H)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${H}`);if(X)X.add(H);return H}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let z=$.split("layouts/"),q=X0.join(Y.partialsDir||J,"layouts",z[1]);if(await t(q)){if(Y.debug)console.log(`Found in layouts path: ${q}`);if(X)X.add(q);return q}if(!q.endsWith(".stx")){let j=`${q}.stx`;if(await t(j)){if(Y.debug)console.log(`Found in layouts path with extension: ${j}`);if(X)X.add(j);return j}}}if(Y.partialsDir){if(K=X0.join(Y.partialsDir,"layouts"),await t(K)){let z=X0.join(K,$);if(await t(z)){if(Y.debug)console.log(`Found in partials layouts dir: ${z}`);if(X)X.add(z);return z}if(!$.endsWith(".stx")){let q=`${z}.stx`;if(await t(q)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${q}`);if(X)X.add(q);return q}}}}let B=Y.partialsDir||X0.join(process.cwd(),"views"),U=X0.join(B,$);if(await t(U)){if(Y.debug)console.log(`Found in views path: ${U}`);if(X)X.add(U);return U}if(!$.endsWith(".stx")){let z=`${U}.stx`;if(await t(z)){if(Y.debug)console.log(`Found in views path with extension: ${z}`);if(X)X.add(z);return z}}if(J.includes("temp")){let z=X0.join(X0.dirname(J),"layouts",$);if(await t(z)){if(Y.debug)console.log(`Found in temp layouts dir: ${z}`);if(X)X.add(z);return z}if(!$.endsWith(".stx")){let q=`${z}.stx`;if(await t(q)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${q}`);if(X)X.add(q);return q}}}if(Y.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function BJ($,Z,Y){let X=0,J="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
10846
+ `),N.__stx_event_bindings=[]}}if(x){let v=U4(M0,H);if(v.hasScoped)M0=v.html}return M0}catch(z){return`[Error processing component: ${z instanceof Error?z.message:String(z)}]`}finally{B.delete($)}}async function t($){return Bun.file($).exists()}function IU($,Z){let Y=X0.resolve(Z),X=X0.resolve($),J=Y.endsWith(X0.sep)?Y:Y+X0.sep;if(X===Y||X.startsWith(J))return X;return null}async function $4($,Z,Y,X){let J=await jw($,Z,Y,X);if(J===null)return null;let Q=IU(J,process.cwd());if(!Q)return console.warn(`[stx] rejected resolved template path that escapes project root: ${J} (template: ${$}, from: ${Z})`),null;return Q}async function jw($,Z,Y,X){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let J=X0.dirname(Z),Q=process.cwd();if($.startsWith("/")){let z=X0.join(Q,$),q=IU(z,Q);if(!q)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${q}`);if(await t(q)&&X)X.add(q);return q}let G=X0.join(J,$);if(await t(G)){if(Y.debug)console.log(`Found direct path: ${G}`);if(X)X.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let z of[".stx",".tsx",".jsx"]){let q=`${G}${z}`;if(await t(q)){if(Y.debug)console.log(`Found direct path with extension: ${q}`);if(X)X.add(q);return q}}let K="",W=X0.resolve(J),_=process.cwd();for(let z=0;z<10;z++){let q=X0.join(W,"layouts"),j=!1;try{j=Bw.statSync(q,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){K=q;break}let H=X0.dirname(W);if(H===W||H.length<_.length)break;W=H}if(K){let z=$.startsWith("layouts/")?$.slice(8):$,q=X0.join(K,z);if(await t(q)){if(Y.debug)console.log(`Found in current layouts dir: ${q}`);if(X)X.add(q);return q}if(!z.endsWith(".stx")){let j=`${q}.stx`;if(await t(j)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${j}`);if(X)X.add(j);return j}}}if(Y.layoutsDir){let z=X0.isAbsolute(Y.layoutsDir)?Y.layoutsDir:X0.resolve(process.cwd(),Y.layoutsDir),q=$.startsWith("layouts/")?$.slice(8):$,j=X0.join(z,q);if(await t(j)){if(Y.debug)console.log(`Found in options.layoutsDir: ${j}`);if(X)X.add(j);return j}if(!$.endsWith(".stx")){let H=`${j}.stx`;if(await t(H)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${H}`);if(X)X.add(H);return H}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let z=$.split("layouts/"),q=X0.join(Y.partialsDir||J,"layouts",z[1]);if(await t(q)){if(Y.debug)console.log(`Found in layouts path: ${q}`);if(X)X.add(q);return q}if(!q.endsWith(".stx")){let j=`${q}.stx`;if(await t(j)){if(Y.debug)console.log(`Found in layouts path with extension: ${j}`);if(X)X.add(j);return j}}}if(Y.partialsDir){if(K=X0.join(Y.partialsDir,"layouts"),await t(K)){let z=X0.join(K,$);if(await t(z)){if(Y.debug)console.log(`Found in partials layouts dir: ${z}`);if(X)X.add(z);return z}if(!$.endsWith(".stx")){let q=`${z}.stx`;if(await t(q)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${q}`);if(X)X.add(q);return q}}}}let B=Y.partialsDir||X0.join(process.cwd(),"views"),U=X0.join(B,$);if(await t(U)){if(Y.debug)console.log(`Found in views path: ${U}`);if(X)X.add(U);return U}if(!$.endsWith(".stx")){let z=`${U}.stx`;if(await t(z)){if(Y.debug)console.log(`Found in views path with extension: ${z}`);if(X)X.add(z);return z}}if(J.includes("temp")){let z=X0.join(X0.dirname(J),"layouts",$);if(await t(z)){if(Y.debug)console.log(`Found in temp layouts dir: ${z}`);if(X)X.add(z);return z}if(!$.endsWith(".stx")){let q=`${z}.stx`;if(await t(q)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${q}`);if(X)X.add(q);return q}}}if(Y.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function _2($,Z,Y){let X=0,J="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
10847
10847
  `),K=0;for(let W=0;W<G.length;W++)if(K+=G[W].length+1,K>=Z){X=W+1,J=G[W].trim();let _=Math.max(0,W-2),B=Math.min(G.length,W+3);Q=G.slice(_,B).map((U,z)=>{let q=_+z+1;return`${q===X?"> ":" "}${q}: ${U}`}).join(`
10848
- `);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return BJ($,G)}}catch{}return{lineNumber:X,lineContent:J,context:Q}}function U0($,Z,Y,X,J,Q){let{lineNumber:G,context:K}=BJ(X,J,Q),W=Y.split("/").pop(),_=0;if(typeof J==="number"&&J>=0&&X){let U=X.lastIndexOf(`
10848
+ `);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return _2($,G)}}catch{}return{lineNumber:X,lineContent:J,context:Q}}function U0($,Z,Y,X,J,Q){let{lineNumber:G,context:K}=_2(X,J,Q),W=Y.split("/").pop(),_=0;if(typeof J==="number"&&J>=0&&X){let U=X.lastIndexOf(`
10849
10849
  `,Math.max(0,J-1));_=J-(U+1)+1}let B="";if(G>0)B+=`
10850
10850
  ${Y}:${G}${_>0?`:${_}`:""}: ${$.toLowerCase()} error: ${Z}
10851
10851
  `;if(B+=`
@@ -10858,7 +10858,7 @@ ${G0.yellow}${G0.bold}Message:${G0.reset} ${Z}
10858
10858
  `,K)B+=`
10859
10859
  ${G0.blue}${G0.bold}Context:${G0.reset}
10860
10860
  ${G0.dim}${K}${G0.reset}
10861
- `;return B}function M$(){R4.clear()}function Hw(){return{size:R4.size,maxSize:500}}var R4,Uw=0,G0;var q0=D(()=>{I7();d0();g$();_1();x$();Z8();NU();F$();R4=new P7(500);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"}});function Ow($){E0=$}function Lw(){return E0}function Fw(){return{isMounted:!1,isUnmounted:!1,hooks:{beforeMount:[],mounted:[],beforeUpdate:[],updated:[],beforeUnmount:[],unmounted:[]},effects:[],scope:kU()}}function kU(){return{refs:new Map,effects:new Set,cleanups:[]}}function Vw($){let Z=new Set,Y=new Set,X=$,J=Symbol("ref"),Q={get value(){if(s0)Y.add(s0);return X},set value(G){if(!Object.is(G,X)){let K=X;X=G;for(let W of Z)W(G,K);for(let W of Y)W()}},subscribe(G){return Z.add(G),()=>{Z.delete(G)}}};if(E0)E0.scope.refs.set(J,Q);return Q}function SU($){let Z=DU.get($);if(Z)return Z;let Y=new Map,X=(G)=>{let K=Y.get(G);if(K)for(let W of[...K])W()},J=(G,K)=>{if(!Y.has(G))Y.set(G,new Set);return Y.get(G).add(K),()=>{Y.get(G)?.delete(K)}},Q=new Proxy($,{get(G,K,W){let _=Reflect.get(G,K,W);if(s0)J(K,s0);if(_!==null&&typeof _==="object"&&!Array.isArray(_)){let B=Object.getPrototypeOf(_);if(B===Object.prototype||B===null)return SU(_)}return _},set(G,K,W,_){let B=Reflect.get(G,K,_),U=Reflect.set(G,K,W,_);if(!Object.is(W,B))X(K);return U},deleteProperty(G,K){let W=Reflect.deleteProperty(G,K);return X(K),W}});return DU.set($,Q),Q}function Nw($){let Z,Y=!0,X=new Set,J=new Set,Q=()=>{Y=!0,G()},G=()=>{if(Y){let W=Z,_=s0;if(s0=Q,Z=$(),s0=_,Y=!1,!Object.is(Z,W)){for(let B of X)B(Z,W);for(let B of J)B()}}},K=s0;return s0=Q,Z=$(),Y=!1,s0=K,{get value(){if(s0)J.add(s0);return G(),Z},set value(W){console.warn("[stx] Computed properties are readonly")},subscribe(W){return X.add(W),()=>{X.delete(W)}}}}function Aw($,Z,Y={}){let{immediate:X=!1,deep:J=!1,flush:Q="post"}=Y,G,K,W=()=>{if(typeof $==="function")return $();return $.value},_=()=>{let U=W();if((J?JSON.stringify(U)!==JSON.stringify(G):!Object.is(U,G))||X)Z(U,G),G=J&&typeof U==="object"?JSON.parse(JSON.stringify(U)):U},B=(U)=>{if(Q==="sync")U();else if(Q==="pre")Promise.resolve().then(U);else requestAnimationFrame(()=>{requestAnimationFrame(U)})};if(typeof $==="function"){let U=setInterval(()=>{B(_)},16);K=()=>clearInterval(U)}else K=$.subscribe(()=>{B(_)});if(G=W(),X)B(_);if(E0)E0.scope.cleanups.push(()=>K?.());return()=>K?.()}function ww($,Z,Y={}){let X=[],J=$.map((Q)=>Q.value);for(let Q of $){let G=Q.subscribe(()=>{let K=$.map((W)=>W.value);Z(K,J),J=[...K]});X.push(G)}if(Y.immediate){let Q=$.map((G)=>G.value);Z(Q,J)}return()=>{for(let Q of X)Q()}}function Rw($){let Z,Y=!1,X=()=>{if(Y)return;if(Z)Z();let J=s0;s0=X,Z=$(),s0=J};if(X(),E0)E0.scope.cleanups.push(()=>{if(Y=!0,Z)Z()});return()=>{if(Y=!0,Z)Z()}}function Mw($){if(E0)E0.hooks.beforeMount.push($);else console.warn("[stx] onBeforeMount called outside of component setup")}function Tw($){if(E0)E0.hooks.mounted.push($);else console.warn("[stx] onMounted called outside of component setup")}function Ew($){if(E0)E0.hooks.beforeUpdate.push($);else console.warn("[stx] onBeforeUpdate called outside of component setup")}function Iw($){if(E0)E0.hooks.updated.push($);else console.warn("[stx] onUpdated called outside of component setup")}function Dw($){if(E0)E0.hooks.beforeUnmount.push($);else console.warn("[stx] onBeforeUnmount called outside of component setup")}function kw($){if(E0)E0.hooks.unmounted.push($);else console.warn("[stx] onUnmounted called outside of component setup")}async function n$($,Z){let Y=$.hooks[Z];for(let X of Y)await X()}async function Sw($){await n$($,"beforeMount"),$.isMounted=!0,await n$($,"mounted")}async function bw($){if(!$.isMounted||$.isUnmounted)return;await n$($,"beforeUpdate"),await n$($,"updated")}async function Cw($){if($.isUnmounted)return;await n$($,"beforeUnmount");for(let Z of $.scope.cleanups)Z();$.isUnmounted=!0,await n$($,"unmounted")}function yw(){return`
10861
+ `;return B}function T$(){R4.clear()}function Hw(){return{size:R4.size,maxSize:500}}var R4,Uw=0,G0;var q0=D(()=>{I7();d0();g$();_1();x$();Z8();NU();V$();R4=new P7(500);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"}});function Ow($){E0=$}function Lw(){return E0}function Fw(){return{isMounted:!1,isUnmounted:!1,hooks:{beforeMount:[],mounted:[],beforeUpdate:[],updated:[],beforeUnmount:[],unmounted:[]},effects:[],scope:kU()}}function kU(){return{refs:new Map,effects:new Set,cleanups:[]}}function Vw($){let Z=new Set,Y=new Set,X=$,J=Symbol("ref"),Q={get value(){if(s0)Y.add(s0);return X},set value(G){if(!Object.is(G,X)){let K=X;X=G;for(let W of Z)W(G,K);for(let W of Y)W()}},subscribe(G){return Z.add(G),()=>{Z.delete(G)}}};if(E0)E0.scope.refs.set(J,Q);return Q}function SU($){let Z=DU.get($);if(Z)return Z;let Y=new Map,X=(G)=>{let K=Y.get(G);if(K)for(let W of[...K])W()},J=(G,K)=>{if(!Y.has(G))Y.set(G,new Set);return Y.get(G).add(K),()=>{Y.get(G)?.delete(K)}},Q=new Proxy($,{get(G,K,W){let _=Reflect.get(G,K,W);if(s0)J(K,s0);if(_!==null&&typeof _==="object"&&!Array.isArray(_)){let B=Object.getPrototypeOf(_);if(B===Object.prototype||B===null)return SU(_)}return _},set(G,K,W,_){let B=Reflect.get(G,K,_),U=Reflect.set(G,K,W,_);if(!Object.is(W,B))X(K);return U},deleteProperty(G,K){let W=Reflect.deleteProperty(G,K);return X(K),W}});return DU.set($,Q),Q}function Nw($){let Z,Y=!0,X=new Set,J=new Set,Q=()=>{Y=!0,G()},G=()=>{if(Y){let W=Z,_=s0;if(s0=Q,Z=$(),s0=_,Y=!1,!Object.is(Z,W)){for(let B of X)B(Z,W);for(let B of J)B()}}},K=s0;return s0=Q,Z=$(),Y=!1,s0=K,{get value(){if(s0)J.add(s0);return G(),Z},set value(W){console.warn("[stx] Computed properties are readonly")},subscribe(W){return X.add(W),()=>{X.delete(W)}}}}function Aw($,Z,Y={}){let{immediate:X=!1,deep:J=!1,flush:Q="post"}=Y,G,K,W=()=>{if(typeof $==="function")return $();return $.value},_=()=>{let U=W();if((J?JSON.stringify(U)!==JSON.stringify(G):!Object.is(U,G))||X)Z(U,G),G=J&&typeof U==="object"?JSON.parse(JSON.stringify(U)):U},B=(U)=>{if(Q==="sync")U();else if(Q==="pre")Promise.resolve().then(U);else requestAnimationFrame(()=>{requestAnimationFrame(U)})};if(typeof $==="function"){let U=setInterval(()=>{B(_)},16);K=()=>clearInterval(U)}else K=$.subscribe(()=>{B(_)});if(G=W(),X)B(_);if(E0)E0.scope.cleanups.push(()=>K?.());return()=>K?.()}function ww($,Z,Y={}){let X=[],J=$.map((Q)=>Q.value);for(let Q of $){let G=Q.subscribe(()=>{let K=$.map((W)=>W.value);Z(K,J),J=[...K]});X.push(G)}if(Y.immediate){let Q=$.map((G)=>G.value);Z(Q,J)}return()=>{for(let Q of X)Q()}}function Rw($){let Z,Y=!1,X=()=>{if(Y)return;if(Z)Z();let J=s0;s0=X,Z=$(),s0=J};if(X(),E0)E0.scope.cleanups.push(()=>{if(Y=!0,Z)Z()});return()=>{if(Y=!0,Z)Z()}}function Mw($){if(E0)E0.hooks.beforeMount.push($);else console.warn("[stx] onBeforeMount called outside of component setup")}function Tw($){if(E0)E0.hooks.mounted.push($);else console.warn("[stx] onMounted called outside of component setup")}function Ew($){if(E0)E0.hooks.beforeUpdate.push($);else console.warn("[stx] onBeforeUpdate called outside of component setup")}function Iw($){if(E0)E0.hooks.updated.push($);else console.warn("[stx] onUpdated called outside of component setup")}function Dw($){if(E0)E0.hooks.beforeUnmount.push($);else console.warn("[stx] onBeforeUnmount called outside of component setup")}function kw($){if(E0)E0.hooks.unmounted.push($);else console.warn("[stx] onUnmounted called outside of component setup")}async function n$($,Z){let Y=$.hooks[Z];for(let X of Y)await X()}async function Sw($){await n$($,"beforeMount"),$.isMounted=!0,await n$($,"mounted")}async function bw($){if(!$.isMounted||$.isUnmounted)return;await n$($,"beforeUpdate"),await n$($,"updated")}async function Cw($){if($.isUnmounted)return;await n$($,"beforeUnmount");for(let Z of $.scope.cleanups)Z();$.isUnmounted=!0,await n$($,"unmounted")}function yw(){return`
10862
10862
  <script data-stx-client-runtime>
10863
10863
  (function() {
10864
10864
  'use strict';
@@ -11038,7 +11038,7 @@ ${G0.dim}${K}${G0.reset}
11038
11038
  </script>`}var E0=null,s0=null,DU;var bU=D(()=>{DU=new WeakMap});import{abortNavigation as Pw,clearMiddleware as M4,createClientCookieManager as xw,createMiddlewareContext as T4,createRouteLocation as E4,createServerCookieManager as vw,createStorageManager as fw,defineMiddleware as gw,getMiddleware as hw,getMiddlewareNames as I4,hasMiddleware as dw,loadMiddlewareFromDirectory as D4,navigateTo as uw,registerMiddleware as mw,runMiddleware as k4}from"stx-router";var b8=()=>{};function Y7($,Z){if(typeof window>"u")return Z;return window[$]??Z}function C8($,Z){if(typeof window>"u")return;window[$]=Z}function CU($){let Y=Y7("__STX_STORES__",{})[$];if(!Y)throw Error(`Store "${$}" not found. Make sure it's defined with defineStore().`);return Y}function pw($){return CU($)}function cw($,Z=5000){return new Promise((Y,X)=>{let J=Date.now(),Q=()=>{let G=CU($);if(G)Y(G);else if(Date.now()-J>Z)X(Error(`Timeout waiting for store "${$}"`));else requestAnimationFrame(Q)};Q()})}function yU(){return Y7("__STX_ROUTE_PARAMS__",{})}function PU($){return yU()[$]}function lw($){let Z=PU($);if(Z===void 0)throw Error(`Route parameter "${$}" not found`);return Z}function xU(){return Y7("__STX_MIDDLEWARE_STATE__",{})}function iw($){return xU()[$]}function nw(){if(typeof window>"u")return;if(!Y7("__STX_STORES__",null))C8("__STX_STORES__",{})}function sw($,Z){let Y=Y7("__STX_STORES__",{});Y[$]=Z,C8("__STX_STORES__",Y)}function rw(){return Y7("__STX_STORE_STATE__",null)}function ow($){C8("__STX_ROUTE_PARAMS__",$)}function aw($){C8("__STX_MIDDLEWARE_STATE__",$)}function vU(){return typeof window>"u"}function fU(){return typeof window<"u"}function tw($){if(fU())$()}function ew($){if(vU())$()}async function hU($){try{let Z=await Bun.file($).text(),Y=$R(Z),X=ZR(Z,$),J=YR(Z,Y),Q=XR(Z,Y);return{file:$,metrics:Y,issues:X,suggestions:J,performance:Q}}catch(Z){throw Error(`Failed to analyze template ${$}: ${Z instanceof Error?Z.message:String(Z)}`)}}function $R($){let Z=$.split(`
11039
11039
  `),Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=(Y?Y[1]:"").split(`
11040
11040
  `).length,Q={conditionals:($.match(/@(if|unless|elseif|else|endif|endunless)\b/g)||[]).length,loops:($.match(/@(foreach|for|endforeach|endfor|while|endwhile)\b/g)||[]).length,includes:($.match(/@(include|component|extends|section|yield)\b/g)||[]).length,custom:0,total:0};Q.total=Q.conditionals+Q.loops+Q.includes+Q.custom;let G=($.match(/\{\{[\s\S]*?\}\}/g)||[]).length,K=($.match(/\{!![\s\S]*?!!\}/g)||[]).length,W=($.match(/@(?:if|unless|elseif|foreach|for|while)\s*\([^)]+\)/g)||[]).length,_=G+K+W,B=($.match(/<[A-Z][^>]*>/g)||[]).length,U=($.match(/@(?:layout|extends)\(/g)||[]).length,z=0,q=0;for(let O of Z)if(/@(?:if|unless|foreach|for|while|section)\b/.test(O)&&!/@end/.test(O)&&!/@else/.test(O))q++,z=Math.max(z,q);else if(/@end(?:if|unless|foreach|for|while|section)\b/.test(O))q--;let j=z>=4?3:0,H=Math.min(10,Math.ceil(Q.total*0.5+_*0.1+B*0.3+(J>10?J*0.05:0)+j));return{lines:Z.length,characters:$.length,directives:Q,expressions:_,components:B,layouts:U,scriptLines:J,complexity:H}}function ZR($,Z){let Y=[],X=gU($,"if","endif");if(X>0)Y.push({type:"error",category:"syntax",message:`Found ${X} unmatched @if directive(s)`,suggestion:"Ensure every @if has a corresponding @endif"});let J=gU($,"foreach","endforeach");if(J>0)Y.push({type:"error",category:"syntax",message:`Found ${J} unmatched @foreach directive(s)`,suggestion:"Ensure every @foreach has a corresponding @endforeach"});let Q=$.match(/@foreach[\s\S]*?@foreach[\s\S]*?@endforeach[\s\S]*?@endforeach/g);if(Q&&Q.length>0)Y.push({type:"warning",category:"performance",message:"Nested loops detected which may impact performance",suggestion:"Consider preprocessing data or using more efficient data structures"});let G=($.match(/\{!![\s\S]*?!!\}/g)||[]).length;if(G>0)Y.push({type:"warning",category:"security",message:`Found ${G} raw output expression(s) {!! !!}`,suggestion:"Ensure raw outputs are properly sanitized to prevent XSS"});let K=$.match(/<img[^>]*>/g);if(K){let B=K.filter((U)=>!U.includes("alt="));if(B.length>0)Y.push({type:"warning",category:"accessibility",message:`Found ${B.length} image(s) without alt attributes`,suggestion:"Add alt attributes to all images for screen reader accessibility"})}let W=$.split(`
11041
- `).filter((B)=>B.length>120);if(W.length>0)Y.push({type:"info",category:"maintainability",message:`Found ${W.length} line(s) longer than 120 characters`,suggestion:"Consider breaking long lines for better readability"});let _=($.match(/style\s*=\s*["'][^"']*["']/g)||[]).length;if(_>3)Y.push({type:"info",category:"maintainability",message:`Found ${_} inline style attributes`,suggestion:"Consider moving styles to CSS classes for better maintainability"});return Y}function YR($,Z){let Y=[];if(Z.complexity>7)Y.push({type:"refactor",message:"Template complexity is high. Consider breaking into smaller components.",impact:"high",effort:"medium"});else if(Z.complexity>5&&Z.directives.total>8)Y.push({type:"optimization",message:"Template has moderate complexity. Consider component extraction for reusability.",impact:"medium",effort:"low"});if(Z.lines>100&&Z.components===0)Y.push({type:"refactor",message:"Large template with no components. Consider extracting reusable parts into components.",impact:"medium",effort:"medium"});if(Z.expressions>20)Y.push({type:"optimization",message:"Many template expressions detected. Consider preprocessing some data in the script section.",impact:"medium",effort:"low"});let X=$.match(/@foreach[\s\S]*?@foreach[\s\S]*?@endforeach[\s\S]*?@endforeach/g);if(X&&X.length>0)Y.push({type:"optimization",message:"Nested loops detected. Consider preprocessing data or optimizing data structures.",impact:"high",effort:"medium"});if(Z.directives.total===0&&Z.expressions<5)Y.push({type:"optimization",message:"Template appears static. Consider enabling aggressive caching.",impact:"high",effort:"low"});if(Z.scriptLines>50)Y.push({type:"refactor",message:"Large script section. Consider moving complex logic to external modules.",impact:"medium",effort:"medium"});return Y}function XR($,Z){let Y=1;if(Y+=Z.directives.conditionals*0.1,Y+=Z.directives.loops*0.5,Y+=Z.directives.includes*2,Y+=Z.expressions*0.05,Y+=Z.components*1,Z.scriptLines>10)Y+=Z.scriptLines*0.1;let X;if(Z.expressions===0&&Z.directives.total===0)X="high";else if(Z.expressions<5&&Z.directives.total<3)X="medium";else X="low";let J=[];if(Y>10)J.push("Consider optimizing template complexity");if(X==="low"&&Z.directives.total>5)J.push("Reduce dynamic content for better caching");if(Z.components===0&&Z.lines>40)J.push("Extract components to improve reusability and performance");return{estimatedRenderTime:Math.round(Y*100)/100,complexityScore:Z.complexity,cacheability:X,recommendations:J}}function gU($,Z,Y){let X=$.replace(/<!--[\s\S]*?-->/g,""),J=(X.match(new RegExp(`@${Z}\\b`,"g"))||[]).length,Q=(X.match(new RegExp(`@${Y}\\b`,"g"))||[]).length;return Math.abs(J-Q)}async function JR($=["**/*.stx"],Z){let Y=[],X=[];for(let Q of $){let G=await Array.fromAsync(new Bun.Glob(Q).scan({cwd:Z||process.cwd(),onlyFiles:!0,absolute:!0}));X.push(...G.filter((K)=>K.endsWith(".stx")))}for(let Q of X)try{let G=await hU(Q);Y.push(G)}catch(G){console.warn(`Failed to analyze ${Q}:`,G)}let J=QR(Y);return{results:Y,summary:J}}function QR($){let Z=$.length,Y=$.reduce((_,B)=>_+B.metrics.lines,0),X=Z>0?$.reduce((_,B)=>_+B.metrics.complexity,0)/Z:0,J=$.reduce((_,B)=>_+B.issues.length,0),Q={};$.forEach((_)=>{_.issues.forEach((B)=>{Q[B.category]=(Q[B.category]||0)+1})});let G=Z>0?$.reduce((_,B)=>_+B.performance.estimatedRenderTime,0)/Z:0,K=Math.max(1,Math.min(10,Math.round(10-G/2-X/2))),W=[];if(X>6)W.push("Project has high average complexity. Consider refactoring complex templates.");if(J>Z*2)W.push("High number of issues detected. Run detailed analysis on individual files.");if(Q.security>0)W.push("Security issues found. Review raw output usage and input sanitization.");return{totalFiles:Z,totalLines:Y,avgComplexity:Math.round(X*100)/100,totalIssues:J,issuesByCategory:Q,performanceScore:K,recommendations:W}}function dU($,Z,Y){let X={fullTag:Y,content:Z,attrs:$};if(/\bserver\b/.test($))return{...X,type:"server"};if(/\bdata-stx-scoped\b/.test($))return{...X,type:"client"};if(GR.test(Z))return{...X,type:"signals"};if(/\bclient\b/.test($)||/\btype\s*=\s*["']module["']/.test($)||/\bsrc\s*=/.test($))return{...X,type:"client"};return{...X,type:"server"}}function UJ($){let Z=[],Y=[],X=[],J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Q;while((Q=J.exec($))!==null){let G=dU(Q[1],Q[2],Q[0]);switch(G.type){case"signals":Z.push(G);break;case"client":Y.push(G);break;case"server":X.push(G);break}}return{signals:Z,client:Y,server:X}}var GR;var zJ=D(()=>{GR=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/});import uU from"fs";import qJ from"path";function KR(){if(S4!==null)return S4;try{let{getRouterScript:$}=K0("stx-router");S4=`<script>${$()}</script>`}catch{S4=""}return S4}function jJ($,Z){if(Z===!1)return null;if(Z&&typeof Z==="string"){let X=qJ.resolve($,Z);if(uU.existsSync(X))return X;return null}let Y=qJ.join($,"app.stx");if(uU.existsSync(Y))return Y;return null}async function y8($,Z){try{let Y=await Bun.file($).text(),X=Y,J=Y.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if(J)X=J[1].trim();let Q=UJ(Y),G=[...Q.client.map((A)=>A.fullTag),...Q.signals.map((A)=>A.fullTag)],K=[],W=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,_;while((_=W.exec(Y))!==null)K.push(_[0]);let B=X;for(let A of Q.server)B=B.replace(A.fullTag,"");for(let A of Q.client)B=B.replace(A.fullTag,"");B=B.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let U="<!--__STX_PAGE_SLOT__-->";if(B=B.replace(/<slot\s*\/>/gi,U).replace(/<slot\s*>\s*<\/slot>/gi,U),!B.includes(U))return console.warn(`[stx] Shell ${$} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:z,extractVariables:q,defaultConfig:j,loadStxConfig:H}=await Promise.resolve().then(() => (T$(),r$)),O=await H(),F={__filename:$,__dirname:qJ.dirname($)};for(let A of G){let N=A.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(N&&!A.includes("client")&&!A.includes('type="module"'))await q(N[1],F,$)}let L=await z(B,F,$,{...j,...O,...Z},new Set),V=L.indexOf(U);if(V===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:L.substring(0,V),afterSlot:L.substring(V+U.length),filePath:$,shellScripts:G,shellStyles:K}}catch(Y){return console.error(`[stx] Error processing shell ${$}:`,Y),null}}function b4($,Z,Y){let X=Y||"stx App",J=KR(),Q="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
11041
+ `).filter((B)=>B.length>120);if(W.length>0)Y.push({type:"info",category:"maintainability",message:`Found ${W.length} line(s) longer than 120 characters`,suggestion:"Consider breaking long lines for better readability"});let _=($.match(/style\s*=\s*["'][^"']*["']/g)||[]).length;if(_>3)Y.push({type:"info",category:"maintainability",message:`Found ${_} inline style attributes`,suggestion:"Consider moving styles to CSS classes for better maintainability"});return Y}function YR($,Z){let Y=[];if(Z.complexity>7)Y.push({type:"refactor",message:"Template complexity is high. Consider breaking into smaller components.",impact:"high",effort:"medium"});else if(Z.complexity>5&&Z.directives.total>8)Y.push({type:"optimization",message:"Template has moderate complexity. Consider component extraction for reusability.",impact:"medium",effort:"low"});if(Z.lines>100&&Z.components===0)Y.push({type:"refactor",message:"Large template with no components. Consider extracting reusable parts into components.",impact:"medium",effort:"medium"});if(Z.expressions>20)Y.push({type:"optimization",message:"Many template expressions detected. Consider preprocessing some data in the script section.",impact:"medium",effort:"low"});let X=$.match(/@foreach[\s\S]*?@foreach[\s\S]*?@endforeach[\s\S]*?@endforeach/g);if(X&&X.length>0)Y.push({type:"optimization",message:"Nested loops detected. Consider preprocessing data or optimizing data structures.",impact:"high",effort:"medium"});if(Z.directives.total===0&&Z.expressions<5)Y.push({type:"optimization",message:"Template appears static. Consider enabling aggressive caching.",impact:"high",effort:"low"});if(Z.scriptLines>50)Y.push({type:"refactor",message:"Large script section. Consider moving complex logic to external modules.",impact:"medium",effort:"medium"});return Y}function XR($,Z){let Y=1;if(Y+=Z.directives.conditionals*0.1,Y+=Z.directives.loops*0.5,Y+=Z.directives.includes*2,Y+=Z.expressions*0.05,Y+=Z.components*1,Z.scriptLines>10)Y+=Z.scriptLines*0.1;let X;if(Z.expressions===0&&Z.directives.total===0)X="high";else if(Z.expressions<5&&Z.directives.total<3)X="medium";else X="low";let J=[];if(Y>10)J.push("Consider optimizing template complexity");if(X==="low"&&Z.directives.total>5)J.push("Reduce dynamic content for better caching");if(Z.components===0&&Z.lines>40)J.push("Extract components to improve reusability and performance");return{estimatedRenderTime:Math.round(Y*100)/100,complexityScore:Z.complexity,cacheability:X,recommendations:J}}function gU($,Z,Y){let X=$.replace(/<!--[\s\S]*?-->/g,""),J=(X.match(new RegExp(`@${Z}\\b`,"g"))||[]).length,Q=(X.match(new RegExp(`@${Y}\\b`,"g"))||[]).length;return Math.abs(J-Q)}async function JR($=["**/*.stx"],Z){let Y=[],X=[];for(let Q of $){let G=await Array.fromAsync(new Bun.Glob(Q).scan({cwd:Z||process.cwd(),onlyFiles:!0,absolute:!0}));X.push(...G.filter((K)=>K.endsWith(".stx")))}for(let Q of X)try{let G=await hU(Q);Y.push(G)}catch(G){console.warn(`Failed to analyze ${Q}:`,G)}let J=QR(Y);return{results:Y,summary:J}}function QR($){let Z=$.length,Y=$.reduce((_,B)=>_+B.metrics.lines,0),X=Z>0?$.reduce((_,B)=>_+B.metrics.complexity,0)/Z:0,J=$.reduce((_,B)=>_+B.issues.length,0),Q={};$.forEach((_)=>{_.issues.forEach((B)=>{Q[B.category]=(Q[B.category]||0)+1})});let G=Z>0?$.reduce((_,B)=>_+B.performance.estimatedRenderTime,0)/Z:0,K=Math.max(1,Math.min(10,Math.round(10-G/2-X/2))),W=[];if(X>6)W.push("Project has high average complexity. Consider refactoring complex templates.");if(J>Z*2)W.push("High number of issues detected. Run detailed analysis on individual files.");if(Q.security>0)W.push("Security issues found. Review raw output usage and input sanitization.");return{totalFiles:Z,totalLines:Y,avgComplexity:Math.round(X*100)/100,totalIssues:J,issuesByCategory:Q,performanceScore:K,recommendations:W}}function dU($,Z,Y){let X={fullTag:Y,content:Z,attrs:$};if(/\bserver\b/.test($))return{...X,type:"server"};if(/\bdata-stx-scoped\b/.test($))return{...X,type:"client"};if(GR.test(Z))return{...X,type:"signals"};if(/\bclient\b/.test($)||/\btype\s*=\s*["']module["']/.test($)||/\bsrc\s*=/.test($))return{...X,type:"client"};return{...X,type:"server"}}function B2($){let Z=[],Y=[],X=[],J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Q;while((Q=J.exec($))!==null){let G=dU(Q[1],Q[2],Q[0]);switch(G.type){case"signals":Z.push(G);break;case"client":Y.push(G);break;case"server":X.push(G);break}}return{signals:Z,client:Y,server:X}}var GR;var U2=D(()=>{GR=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/});import uU from"fs";import z2 from"path";function KR(){if(S4!==null)return S4;try{let{getRouterScript:$}=K0("stx-router");S4=`<script>${$()}</script>`}catch{S4=""}return S4}function q2($,Z){if(Z===!1)return null;if(Z&&typeof Z==="string"){let X=z2.resolve($,Z);if(uU.existsSync(X))return X;return null}let Y=z2.join($,"app.stx");if(uU.existsSync(Y))return Y;return null}async function y8($,Z){try{let Y=await Bun.file($).text(),X=Y,J=Y.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if(J)X=J[1].trim();let Q=B2(Y),G=[...Q.client.map((A)=>A.fullTag),...Q.signals.map((A)=>A.fullTag)],K=[],W=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,_;while((_=W.exec(Y))!==null)K.push(_[0]);let B=X;for(let A of Q.server)B=B.replace(A.fullTag,"");for(let A of Q.client)B=B.replace(A.fullTag,"");B=B.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let U="<!--__STX_PAGE_SLOT__-->";if(B=B.replace(/<slot\s*\/>/gi,U).replace(/<slot\s*>\s*<\/slot>/gi,U),!B.includes(U))return console.warn(`[stx] Shell ${$} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:z,extractVariables:q,defaultConfig:j,loadStxConfig:H}=await Promise.resolve().then(() => (E$(),r$)),O=await H(),F={__filename:$,__dirname:z2.dirname($)};for(let A of G){let N=A.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(N&&!A.includes("client")&&!A.includes('type="module"'))await q(N[1],F,$)}let L=await z(B,F,$,{...j,...O,...Z},new Set),V=L.indexOf(U);if(V===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:L.substring(0,V),afterSlot:L.substring(V+U.length),filePath:$,shellScripts:G,shellStyles:K}}catch(Y){return console.error(`[stx] Error processing shell ${$}:`,Y),null}}function b4($,Z,Y){let X=Y||"stx App",J=KR(),Q="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
11042
11042
  <html lang="en">
11043
11043
  <head>
11044
11044
  <meta charset="UTF-8">
@@ -11059,10 +11059,10 @@ ${J}
11059
11059
  </html>`}function s$($){let Z=$.trim();if(!/<!DOCTYPE\b/i.test(Z)&&!/^<html[\s>]/i.test(Z))return $;let Y=[],X=Z.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if(X){let K=X[1],W=/<style\b[^>]*>[\s\S]*?<\/style>/gi,_;while((_=W.exec(K))!==null)Y.push(_[0])}let J=Z.match(/<body\b[^>]*>/i),Q=Z.lastIndexOf("</body>");if(J&&Q!==-1){let K=J.index+J[0].length,W=Z.slice(K,Q).trim();if(Y.length>0)return Y.join(`
11060
11060
  `)+`
11061
11061
  `+W;return W}let G=Z;if(G=G.replace(/<!DOCTYPE\b[^>]*>/i,""),G=G.replace(/<html\b[^>]*>/i,""),G=G.replace(/<\/html\s*>/i,""),X)G=G.replace(/<head\b[^>]*>[\s\S]*?<\/head>/i,Y.join(`
11062
- `));return G=G.replace(/<body\b[^>]*>/i,""),G=G.replace(/<\/body\s*>/i,""),G.trim()}function HJ($){return $.headers.get("X-STX-Router")==="true"}function C4($,Z="main"){let Y=$.trim(),X=[],J=Y.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if(J){let L=J[1],V=/<style\b[^>]*>[\s\S]*?<\/style>/gi,A;while((A=V.exec(L))!==null)X.push(A[0])}let Q=Z.replace(/^[.#]/,"").toLowerCase(),G=new RegExp(`<${Q}\\b[^>]*>`,"i"),K=Y.match(G);if(!K||K.index===void 0)return s$($);let W=K.index+K[0].length,_=new RegExp(`<${Q}\\b[^>]*>`,"gi"),B=new RegExp(`</${Q}\\s*>`,"gi");_.lastIndex=W,B.lastIndex=W;let U=1,z=-1;while(U>0){let L=_.exec(Y),V=B.exec(Y);if(!V)break;if(L&&L.index<V.index)U++,B.lastIndex=L.index+L[0].length;else if(U--,z=V.index,U>0)_.lastIndex=V.index+V[0].length}if(z===-1)return s$($);let q=Y.slice(W,z).trim(),j=[],H=Y.match(/<body\b[^>]*>/i),O=Y.lastIndexOf("</body>");if(H&&H.index!==void 0&&O!==-1){let V=[[H.index+H[0].length,K.index],[z+`</${Q}>`.length,O]],A=/<script\b[^>]*>[\s\S]*?<\/script>/gi;for(let[N,w]of V){if(N>=w)continue;let M=Y.slice(N,w),T;A.lastIndex=0;while((T=A.exec(M))!==null)j.push(T[0])}}let F=[];if(X.length>0)F.push(X.join(`
11062
+ `));return G=G.replace(/<body\b[^>]*>/i,""),G=G.replace(/<\/body\s*>/i,""),G.trim()}function j2($){return $.headers.get("X-STX-Router")==="true"}function C4($,Z="main"){let Y=$.trim(),X=[],J=Y.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if(J){let L=J[1],V=/<style\b[^>]*>[\s\S]*?<\/style>/gi,A;while((A=V.exec(L))!==null)X.push(A[0])}let Q=Z.replace(/^[.#]/,"").toLowerCase(),G=new RegExp(`<${Q}\\b[^>]*>`,"i"),K=Y.match(G);if(!K||K.index===void 0)return s$($);let W=K.index+K[0].length,_=new RegExp(`<${Q}\\b[^>]*>`,"gi"),B=new RegExp(`</${Q}\\s*>`,"gi");_.lastIndex=W,B.lastIndex=W;let U=1,z=-1;while(U>0){let L=_.exec(Y),V=B.exec(Y);if(!V)break;if(L&&L.index<V.index)U++,B.lastIndex=L.index+L[0].length;else if(U--,z=V.index,U>0)_.lastIndex=V.index+V[0].length}if(z===-1)return s$($);let q=Y.slice(W,z).trim(),j=[],H=Y.match(/<body\b[^>]*>/i),O=Y.lastIndexOf("</body>");if(H&&H.index!==void 0&&O!==-1){let V=[[H.index+H[0].length,K.index],[z+`</${Q}>`.length,O]],A=/<script\b[^>]*>[\s\S]*?<\/script>/gi;for(let[N,w]of V){if(N>=w)continue;let M=Y.slice(N,w),T;A.lastIndex=0;while((T=A.exec(M))!==null)j.push(T[0])}}let F=[];if(X.length>0)F.push(X.join(`
11063
11063
  `));if(j.length>0)F.push(j.join(`
11064
11064
  `));return F.push(q),F.join(`
11065
- `)}var S4=null;var y4=D(()=>{zJ()});import{matchRoute as WR,Router as _R}from"stx-router";import{findErrorPage as OJ,formatRoutes as LJ,generateRouteManifest as UR,generateRouteTypes as zR,matchRoute as P8}from"stx-router";function n1($,Z={}){return new _R($,Z).routes}function BR($,Z){let Y=WR($,Z);return Y?Y.params:null}var P4=()=>{};var oU={};Q0(oU,{generateStaticSite:()=>lU,defineStaticPaths:()=>sU,default:()=>MR,createMarkdownLoader:()=>rU,createISRHandler:()=>nU});import x0 from"fs";import O0 from"path";class mU{cacheDir;cache=new Map;loaded=!1;constructor($){this.cacheDir=$}async load(){if(this.loaded)return;let $=O0.join(this.cacheDir,"build-cache.json");if(await Bun.file($).exists())try{let Z=JSON.parse(await Bun.file($).text());for(let[Y,X]of Object.entries(Z))this.cache.set(Y,X)}catch{}this.loaded=!0}async save(){await x0.promises.mkdir(this.cacheDir,{recursive:!0});let $=O0.join(this.cacheDir,"build-cache.json"),Z={};for(let[Y,X]of this.cache)Z[Y]=X;await Bun.write($,JSON.stringify(Z))}getHash($,Z){let Y=x0.statSync($),X=`${$}:${Y.mtimeMs}`;for(let Q of Z)if(x0.existsSync(Q)){let G=x0.statSync(Q);X+=`:${Q}:${G.mtimeMs}`}let J=0;for(let Q=0;Q<X.length;Q++){let G=X.charCodeAt(Q);J=(J<<5)-J+G,J=J&J}return Math.abs(J).toString(36)}get($,Z,Y){let X=this.cache.get($);if(!X)return null;let J=this.getHash(Z,Y);if(X.hash!==J)return this.cache.delete($),null;return X.html}set($,Z,Y,X){let J=this.getHash(Z,Y);this.cache.set($,{hash:J,html:X,generatedAt:Date.now(),dependencies:Y})}}class pU{cacheDir;constructor($){this.cacheDir=$}getFilePath($){let Z=$.replace(/[^a-zA-Z0-9]/g,"_")+".json";return O0.join(this.cacheDir,"isr",Z)}async get($){let Z=this.getFilePath($);if(!await Bun.file(Z).exists())return null;try{return JSON.parse(await Bun.file(Z).text())}catch{return null}}async set($,Z){let Y=this.getFilePath($);await x0.promises.mkdir(O0.dirname(Y),{recursive:!0}),await Bun.write(Y,JSON.stringify(Z))}async invalidate($){let Z=this.getFilePath($);if(await Bun.file(Z).exists())await x0.promises.unlink(Z)}async invalidatePattern($){let Z=O0.join(this.cacheDir,"isr");if(!x0.existsSync(Z))return;let Y=await x0.promises.readdir(Z);for(let X of Y){let J=X.replace(/_/g,"/").replace(".json","");if($.test(J))await x0.promises.unlink(O0.join(Z,X))}}async needsRevalidation($){let Z=await this.get($);if(!Z)return!0;return Date.now()>Z.revalidateAfter}}async function qR($){try{let Y=(await Bun.file($).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!Y)return null;let X=Y[1];if(!X.includes("getStaticPaths"))return null;let J=X.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!J)return null;return await Function(`
11065
+ `)}var S4=null;var y4=D(()=>{U2()});import{matchRoute as WR,Router as _R}from"stx-router";import{findErrorPage as H2,formatRoutes as O2,generateRouteManifest as UR,generateRouteTypes as zR,matchRoute as P8}from"stx-router";function n1($,Z={}){return new _R($,Z).routes}function BR($,Z){let Y=WR($,Z);return Y?Y.params:null}var P4=()=>{};var oU={};Q0(oU,{generateStaticSite:()=>lU,defineStaticPaths:()=>sU,default:()=>MR,createMarkdownLoader:()=>rU,createISRHandler:()=>nU});import x0 from"fs";import O0 from"path";class mU{cacheDir;cache=new Map;loaded=!1;constructor($){this.cacheDir=$}async load(){if(this.loaded)return;let $=O0.join(this.cacheDir,"build-cache.json");if(await Bun.file($).exists())try{let Z=JSON.parse(await Bun.file($).text());for(let[Y,X]of Object.entries(Z))this.cache.set(Y,X)}catch{}this.loaded=!0}async save(){await x0.promises.mkdir(this.cacheDir,{recursive:!0});let $=O0.join(this.cacheDir,"build-cache.json"),Z={};for(let[Y,X]of this.cache)Z[Y]=X;await Bun.write($,JSON.stringify(Z))}getHash($,Z){let Y=x0.statSync($),X=`${$}:${Y.mtimeMs}`;for(let Q of Z)if(x0.existsSync(Q)){let G=x0.statSync(Q);X+=`:${Q}:${G.mtimeMs}`}let J=0;for(let Q=0;Q<X.length;Q++){let G=X.charCodeAt(Q);J=(J<<5)-J+G,J=J&J}return Math.abs(J).toString(36)}get($,Z,Y){let X=this.cache.get($);if(!X)return null;let J=this.getHash(Z,Y);if(X.hash!==J)return this.cache.delete($),null;return X.html}set($,Z,Y,X){let J=this.getHash(Z,Y);this.cache.set($,{hash:J,html:X,generatedAt:Date.now(),dependencies:Y})}}class pU{cacheDir;constructor($){this.cacheDir=$}getFilePath($){let Z=$.replace(/[^a-zA-Z0-9]/g,"_")+".json";return O0.join(this.cacheDir,"isr",Z)}async get($){let Z=this.getFilePath($);if(!await Bun.file(Z).exists())return null;try{return JSON.parse(await Bun.file(Z).text())}catch{return null}}async set($,Z){let Y=this.getFilePath($);await x0.promises.mkdir(O0.dirname(Y),{recursive:!0}),await Bun.write(Y,JSON.stringify(Z))}async invalidate($){let Z=this.getFilePath($);if(await Bun.file(Z).exists())await x0.promises.unlink(Z)}async invalidatePattern($){let Z=O0.join(this.cacheDir,"isr");if(!x0.existsSync(Z))return;let Y=await x0.promises.readdir(Z);for(let X of Y){let J=X.replace(/_/g,"/").replace(".json","");if($.test(J))await x0.promises.unlink(O0.join(Z,X))}}async needsRevalidation($){let Z=await this.get($);if(!Z)return!0;return Date.now()>Z.revalidateAfter}}async function qR($){try{let Y=(await Bun.file($).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!Y)return null;let X=Y[1];if(!X.includes("getStaticPaths"))return null;let J=X.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!J)return null;return await Function(`
11066
11066
  return (async function getStaticPaths() {
11067
11067
  ${J[1]}
11068
11068
  })()
@@ -11146,9 +11146,9 @@ Build complete!
11146
11146
  <p>Redirecting to <a href="${$}">${$}</a>...</p>
11147
11147
  <script>window.location.replace('${$}')</script>
11148
11148
  </body>
11149
- </html>`}function RR($,Z){if($==="/"||$==="")return O0.join(Z.outputDir,"index.html");let Y=$.replace(/^\/|\/$/g,"");if(Z.trailingSlash)return O0.join(Z.outputDir,Y,"index.html");return O0.join(Z.outputDir,`${Y}.html`)}var MR;var aU=D(()=>{P4();_1();m0();E1();b8();MR={generateStaticSite:lU,createISRHandler:nU,defineStaticPaths:sU,createMarkdownLoader:rU}});import{createHash as TR}from"crypto";import{getRouterScript as ER}from"stx-router";function FJ($){return TR("sha256").update($).digest("hex").slice(0,8)}function VJ($=!1){let Z=$?m$():O4(),Y=FJ(Z);return{content:Z,filename:`runtime.${Y}.js`,hash:Y}}function NJ(){let $=ER(),Z=FJ($);return{content:$,filename:`router.${Z}.js`,hash:Z}}function IR($){return{runtimeTag:$.runtime?`<script src="/__stx/${$.runtime.filename}"></script>`:"",routerTag:$.router?`<script src="/__stx/${$.router.filename}"></script>`:"",cssTag:$.css?`<link rel="stylesheet" href="/__stx/${$.css.filename}">`:""}}var AJ=D(()=>{L4()});import tU from"path";import{createHash as DR}from"crypto";function kR($={}){let Z=new Set;return{context:new Proxy($,{get(X,J){if(J in X)return X[J];if(typeof J==="string"&&!J.startsWith("__"))Z.add(J);return},has(X,J){if(J in X)return!0;if(typeof J==="string"&&!J.startsWith("__"))Z.add(J);return!1}}),accessedKeys:Z}}async function wJ($,Z,Y={}){let X=tU.resolve($),J=await Bun.file(X).text(),Q=DR("sha256").update(J).digest("hex").slice(0,16);vZ();let G={};try{G=await S0()}catch{}let K=[],W=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,_;while((_=W.exec(J))!==null){let O=_[1];if(/\bserver\b/.test(O))K.push(_[2])}let{context:B}=kR({__filename:X,__dirname:tU.dirname(X)}),U=new Set,z={...a0,...G,...Y,buildMode:"compile",strict:!1},q=await Z0(J,B,X,z,U),j=s$(q),H=fZ();return{route:Z,sourceFile:$,html:q,fragment:j,placeholders:H,hasServerScripts:K.length>0,serverScriptContent:K,dependencies:Array.from(U),contentHash:Q}}var RJ=D(()=>{_1();m0();S7();y4()});import MJ from"fs";import eU from"path";function TJ($,Z,Y){return{version:1,buildTime:new Date().toISOString(),routes:$,assets:Z,outputDir:Y}}function EJ($,Z){let Y=eU.join(Z,"manifest.json");MJ.writeFileSync(Y,JSON.stringify($,null,2))}function IJ($){let Z=eU.join($,"manifest.json");if(!MJ.existsSync(Z))return null;try{let Y=MJ.readFileSync(Z,"utf-8"),X=JSON.parse(Y);if(X.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${X.version}`),null;return X}catch(Y){return console.warn("[stx] Failed to load manifest:",Y),null}}var x8=()=>{};var Zz={};Q0(Zz,{buildForProduction:()=>$z});import C1 from"fs";import p0 from"path";function bR($,Z){let Y=0,X=0;if(!C1.existsSync($))return{copied:Y,bytes:X};function J(Q,G){let K=C1.readdirSync(Q,{withFileTypes:!0});for(let W of K){if(SR.has(W.name))continue;let _=p0.join(Q,W.name),B=p0.join(G,W.name);if(W.isDirectory())C1.mkdirSync(B,{recursive:!0}),J(_,B);else if(W.isFile()){if(C1.existsSync(B))continue;C1.copyFileSync(_,B),Y++,X+=C1.statSync(B).size}}}return J($,Z),{copied:Y,bytes:X}}async function $z($={}){let Z=Date.now(),Y=p0.resolve($.root||process.cwd()),X=p0.resolve(Y,$.outputDir||".output");console.log("[stx build] Starting production build...");let J={};try{J=await S0()}catch{}let Q=$.componentsDir??J.componentsDir??"components",G=$.partialsDir??J.partialsDir??"partials",K=$.layoutsDir??J.layoutsDir??"layouts",W=$.publicDir??J.publicDir??"public",_=J.app?.head||{},B=J.router?.container||"main";if(C1.existsSync(X))C1.rmSync(X,{recursive:!0});let U=[p0.join(X,"public","__stx"),p0.join(X,"public","assets"),p0.join(X,"server","pages"),p0.join(X,"server","fragments")];for(let M of U)C1.mkdirSync(M,{recursive:!0});console.log("[stx build] Discovering routes...");let z=n1(Y),q=["components","layouts","partials"],j=z.filter((M)=>{return!q.some((T)=>M.pattern.startsWith(`/${T}/`)||M.pattern===`/${T}`)});console.log(`[stx build] Found ${j.length} page routes (${z.length-j.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let H=VJ($.debug),O=NJ();await Bun.write(p0.join(X,"public","__stx",H.filename),H.content),await Bun.write(p0.join(X,"public","__stx",O.filename),O.content),console.log(`[stx build] Runtime: ${H.filename} (${(H.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${O.filename} (${(O.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let F=[],L=[];for(let M of j)try{let T=await wJ(M.filePath,M.pattern,{componentsDir:Q,partialsDir:G,layoutsDir:K,debug:$.debug});if(F.push(T),T.html=T.html.replace(/runtime\.__STX_HASH__\.js/g,H.filename).replace(/router\.__STX_HASH__\.js/g,O.filename),T.html=z4(T.html,_,{bodyScripts:[`<script src="/__stx/${O.filename}"></script>`]}),!/<body[^>]*\bdata-stx=/.test(T.html)){let b=T.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(b&&b[1]){let P=b[1];T.html=T.html.replace(" "+P,""),T.html=T.html.replace(/<body([^>]*)>/,`<body$1 ${P}>`)}}T.html=T.html.replace(/<style data-crosswind="generated">[\s\S]*?<\/style>\s*/g,""),T.html=await V0(T.html),T.fragment=C4(T.html,B);let E=M.pattern==="/"?"index":M.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),S=p0.join("server","pages",`${E}.compiled.json`),k=p0.join("server","fragments",`${E}.html`);await Bun.write(p0.join(X,S),JSON.stringify(T,null,2)),await Bun.write(p0.join(X,k),T.fragment),L.push({pattern:M.pattern,compiledPath:S,fragmentPath:k,isDynamic:T.hasServerScripts,hasParams:M.pattern.includes(":")||M.pattern.includes("[")}),console.log(`[stx build] \u2713 ${M.pattern}`)}catch(T){console.error(`[stx build] \u2717 ${M.pattern}:`,T instanceof Error?T.message:T)}let V=p0.resolve(Y,W);if(C1.existsSync(V)){let{copied:M,bytes:T}=bR(V,p0.join(X,"public"));if(M>0)console.log(`[stx build] Copied ${M} public asset${M===1?"":"s"} (${(T/1024).toFixed(1)}KB) from ${W}/`)}let A={runtime:H.filename,router:O.filename},N=TJ(L,A,X);EJ(N,X);let w=Date.now()-Z;return console.log(`
11150
- [stx build] Done in ${w}ms \u2014 ${F.length} pages compiled`),{pageCount:F.length,assets:A,outputDir:X,duration:w}}var SR;var DJ=D(()=>{P4();AJ();RJ();x8();y4();E1();m0();SR=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"])});import CR from"path";async function yR($={}){let Z=performance.now(),Y=$.root||process.cwd(),X=await S0(),J=X.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${J.toUpperCase()}${X.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let Q,G;if(J==="ssg"){let{generateStaticSite:W}=await Promise.resolve().then(() => (aU(),oU));Q=await W({pagesDir:CR.join(X.root||".",X.pagesDir||X.build?.pagesDir||"pages"),publicDir:X.publicDir||X.build?.publicDir||"public",outputDir:X.build?.outputDir||"dist",generate404:X.build?.generate404??!0,minify:X.build?.minify??!0,cleanOutput:X.build?.cleanOutput??!0,...$.ssg})}else{let{buildForProduction:W}=await Promise.resolve().then(() => (DJ(),Zz));G=await W({outputDir:".output",debug:$.debug,...$.ssr})}let K=Math.round(performance.now()-Z);return{mode:J,ssg:Q,ssr:G,duration:K}}var Yz=D(()=>{m0()});import v8 from"path";async function xR($){let Z=performance.now(),Y=await S0(),X=$||Y.root||process.cwd(),J=[Y.build?.pagesDir||Y.pagesDir||"pages",Y.componentsDir||"components",Y.layoutsDir||"layouts",Y.partialsDir||"partials"].map((K)=>v8.resolve(X,K)),Q=[],G=0;for(let K of J){let W=await Jz(K);for(let _ of W){G++;let B=await Bun.file(_).text();if(Xz.test(B))Q.push(v8.relative(X,_))}}return{mode:Q.length>0?"ssr":"ssg",serverScriptFiles:Q,totalFilesScanned:G,scanDurationMs:Math.round(performance.now()-Z)}}async function vR($){let Z=await S0(),Y=$||Z.root||process.cwd(),X=v8.resolve(Y,Z.componentsDir||"components"),J=[],Q=await Jz(X);for(let G of Q){let K=await Bun.file(G).text(),W=Xz.test(K),_=PR.test(K)||/<script\b(?![^>]*\bserver\b)[^>]*>/i.test(K)&&!W;if(W&&_){let B=v8.relative(Y,G);J.push({file:B,message:`Component "${B}" has both <script server> and <script client>. `+"Components should be server OR client \u2014 compose them via props/slots."})}}return J}async function Jz($){let Z=[];try{let Y=new Bun.Glob("**/*.stx");for await(let X of Y.scan({cwd:$,absolute:!0}))Z.push(X)}catch{}return Z}var Xz,PR;var Qz=D(()=>{m0();Xz=/<script\b[^>]*\bserver\b/i,PR=/<script\b[^>]*\bclient\b/i});function kJ($){let Z=new Map,Y=/@(\w+)/g,X,J=1,Q=0;while((X=Y.exec($))!==null){let G=X[1],K=$.slice(Q,X.index);J+=(K.match(/\n/g)||[]).length,Q=X.index;let W=X.index-$.lastIndexOf(`
11151
- `,X.index-1);if(Kz.includes(G)){let _=Z.get(G);if(_)_.count++,_.locations.push({line:J,column:W});else Z.set(G,{name:G,count:1,locations:[{line:J,column:W}]})}}return Array.from(Z.values())}function Wz($,Z=[]){let Y=kJ($),X=new Set(Y.map((J)=>J.name));for(let J of Z)X.add(J);for(let J of Array.from(X))if(!J.startsWith("end"))X.add(`end${J}`);return Kz.filter((J)=>!X.has(J))}function _z($){let Z=[],Y={conditionals:["if","else","elseif","endif","unless","endunless","switch","case","default","endswitch","isset","endisset"],loops:["for","endfor","foreach","endforeach","forelse","endforelse","while","endwhile","break","continue","empty"],includes:["include","includeIf","includeWhen","includeFirst","once","endonce","extends","section","endsection","yield","parent","push","endpush","prepend","endprepend","stack"],components:["component","endcomponent","slot","endslot","props"],auth:["auth","endauth","guest","endguest","can","endcan","cannot","endcannot","role","endrole","hasRole","endhasRole","hasAnyRole","endhasAnyRole"],forms:["csrf","method","error","enderror","old","input","textarea","select","checkbox","radio","file"],i18n:["translate","lang","choice"],seo:["meta","title","seo","jsonld","canonical","robots","sitemap"]},X=new Set;for(let Q of $)for(let[G,K]of Object.entries(Y))if(K.includes(Q)){X.add(G);break}for(let Q of X)Z.push(`import { process${gR(Q)} } from './${Q}'`);let J=$.filter((Q)=>!Q.startsWith("end")).map((Q)=>` '${Q}': true`).join(`,
11149
+ </html>`}function RR($,Z){if($==="/"||$==="")return O0.join(Z.outputDir,"index.html");let Y=$.replace(/^\/|\/$/g,"");if(Z.trailingSlash)return O0.join(Z.outputDir,Y,"index.html");return O0.join(Z.outputDir,`${Y}.html`)}var MR;var aU=D(()=>{P4();_1();m0();E1();b8();MR={generateStaticSite:lU,createISRHandler:nU,defineStaticPaths:sU,createMarkdownLoader:rU}});import{createHash as TR}from"crypto";import{getRouterScript as ER}from"stx-router";function L2($){return TR("sha256").update($).digest("hex").slice(0,8)}function F2($=!1){let Z=$?m$():O4(),Y=L2(Z);return{content:Z,filename:`runtime.${Y}.js`,hash:Y}}function V2(){let $=ER(),Z=L2($);return{content:$,filename:`router.${Z}.js`,hash:Z}}function IR($){return{runtimeTag:$.runtime?`<script src="/__stx/${$.runtime.filename}"></script>`:"",routerTag:$.router?`<script src="/__stx/${$.router.filename}"></script>`:"",cssTag:$.css?`<link rel="stylesheet" href="/__stx/${$.css.filename}">`:""}}var N2=D(()=>{L4()});import tU from"path";import{createHash as DR}from"crypto";function kR($={}){let Z=new Set;return{context:new Proxy($,{get(X,J){if(J in X)return X[J];if(typeof J==="string"&&!J.startsWith("__"))Z.add(J);return},has(X,J){if(J in X)return!0;if(typeof J==="string"&&!J.startsWith("__"))Z.add(J);return!1}}),accessedKeys:Z}}async function A2($,Z,Y={}){let X=tU.resolve($),J=await Bun.file(X).text(),Q=DR("sha256").update(J).digest("hex").slice(0,16);xZ();let G={};try{G=await S0()}catch{}let K=[],W=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,_;while((_=W.exec(J))!==null){let O=_[1];if(/\bserver\b/.test(O))K.push(_[2])}let{context:B}=kR({__filename:X,__dirname:tU.dirname(X)}),U=new Set,z={...a0,...G,...Y,buildMode:"compile",strict:!1},q=await Z0(J,B,X,z,U),j=s$(q),H=vZ();return{route:Z,sourceFile:$,html:q,fragment:j,placeholders:H,hasServerScripts:K.length>0,serverScriptContent:K,dependencies:Array.from(U),contentHash:Q}}var w2=D(()=>{_1();m0();S7();y4()});import R2 from"fs";import eU from"path";function M2($,Z,Y){return{version:1,buildTime:new Date().toISOString(),routes:$,assets:Z,outputDir:Y}}function T2($,Z){let Y=eU.join(Z,"manifest.json");R2.writeFileSync(Y,JSON.stringify($,null,2))}function E2($){let Z=eU.join($,"manifest.json");if(!R2.existsSync(Z))return null;try{let Y=R2.readFileSync(Z,"utf-8"),X=JSON.parse(Y);if(X.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${X.version}`),null;return X}catch(Y){return console.warn("[stx] Failed to load manifest:",Y),null}}var x8=()=>{};var Zz={};Q0(Zz,{buildForProduction:()=>$z});import C1 from"fs";import p0 from"path";function bR($,Z){let Y=0,X=0;if(!C1.existsSync($))return{copied:Y,bytes:X};function J(Q,G){let K=C1.readdirSync(Q,{withFileTypes:!0});for(let W of K){if(SR.has(W.name))continue;let _=p0.join(Q,W.name),B=p0.join(G,W.name);if(W.isDirectory())C1.mkdirSync(B,{recursive:!0}),J(_,B);else if(W.isFile()){if(C1.existsSync(B))continue;C1.copyFileSync(_,B),Y++,X+=C1.statSync(B).size}}}return J($,Z),{copied:Y,bytes:X}}async function $z($={}){let Z=Date.now(),Y=p0.resolve($.root||process.cwd()),X=p0.resolve(Y,$.outputDir||".output");console.log("[stx build] Starting production build...");let J={};try{J=await S0()}catch{}let Q=$.componentsDir??J.componentsDir??"components",G=$.partialsDir??J.partialsDir??"partials",K=$.layoutsDir??J.layoutsDir??"layouts",W=$.publicDir??J.publicDir??"public",_=J.app?.head||{},B=J.router?.container||"main";if(C1.existsSync(X))C1.rmSync(X,{recursive:!0});let U=[p0.join(X,"public","__stx"),p0.join(X,"public","assets"),p0.join(X,"server","pages"),p0.join(X,"server","fragments")];for(let M of U)C1.mkdirSync(M,{recursive:!0});console.log("[stx build] Discovering routes...");let z=n1(Y),q=["components","layouts","partials"],j=z.filter((M)=>{return!q.some((T)=>M.pattern.startsWith(`/${T}/`)||M.pattern===`/${T}`)});console.log(`[stx build] Found ${j.length} page routes (${z.length-j.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let H=F2($.debug),O=V2();await Bun.write(p0.join(X,"public","__stx",H.filename),H.content),await Bun.write(p0.join(X,"public","__stx",O.filename),O.content),console.log(`[stx build] Runtime: ${H.filename} (${(H.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${O.filename} (${(O.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let F=[],L=[];for(let M of j)try{let T=await A2(M.filePath,M.pattern,{componentsDir:Q,partialsDir:G,layoutsDir:K,debug:$.debug});if(F.push(T),T.html=T.html.replace(/runtime\.__STX_HASH__\.js/g,H.filename).replace(/router\.__STX_HASH__\.js/g,O.filename),T.html=z4(T.html,_,{bodyScripts:[`<script src="/__stx/${O.filename}"></script>`]}),!/<body[^>]*\bdata-stx=/.test(T.html)){let b=T.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(b&&b[1]){let P=b[1];T.html=T.html.replace(" "+P,""),T.html=T.html.replace(/<body([^>]*)>/,`<body$1 ${P}>`)}}T.html=T.html.replace(/<style data-crosswind="generated">[\s\S]*?<\/style>\s*/g,""),T.html=await V0(T.html),T.fragment=C4(T.html,B);let E=M.pattern==="/"?"index":M.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),S=p0.join("server","pages",`${E}.compiled.json`),k=p0.join("server","fragments",`${E}.html`);await Bun.write(p0.join(X,S),JSON.stringify(T,null,2)),await Bun.write(p0.join(X,k),T.fragment),L.push({pattern:M.pattern,compiledPath:S,fragmentPath:k,isDynamic:T.hasServerScripts,hasParams:M.pattern.includes(":")||M.pattern.includes("[")}),console.log(`[stx build] \u2713 ${M.pattern}`)}catch(T){console.error(`[stx build] \u2717 ${M.pattern}:`,T instanceof Error?T.message:T)}let V=p0.resolve(Y,W);if(C1.existsSync(V)){let{copied:M,bytes:T}=bR(V,p0.join(X,"public"));if(M>0)console.log(`[stx build] Copied ${M} public asset${M===1?"":"s"} (${(T/1024).toFixed(1)}KB) from ${W}/`)}let A={runtime:H.filename,router:O.filename},N=M2(L,A,X);T2(N,X);let w=Date.now()-Z;return console.log(`
11150
+ [stx build] Done in ${w}ms \u2014 ${F.length} pages compiled`),{pageCount:F.length,assets:A,outputDir:X,duration:w}}var SR;var I2=D(()=>{P4();N2();w2();x8();y4();E1();m0();SR=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"])});import CR from"path";async function yR($={}){let Z=performance.now(),Y=$.root||process.cwd(),X=await S0(),J=X.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${J.toUpperCase()}${X.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let Q,G;if(J==="ssg"){let{generateStaticSite:W}=await Promise.resolve().then(() => (aU(),oU));Q=await W({pagesDir:CR.join(X.root||".",X.pagesDir||X.build?.pagesDir||"pages"),publicDir:X.publicDir||X.build?.publicDir||"public",outputDir:X.build?.outputDir||"dist",generate404:X.build?.generate404??!0,minify:X.build?.minify??!0,cleanOutput:X.build?.cleanOutput??!0,...$.ssg})}else{let{buildForProduction:W}=await Promise.resolve().then(() => (I2(),Zz));G=await W({outputDir:".output",debug:$.debug,...$.ssr})}let K=Math.round(performance.now()-Z);return{mode:J,ssg:Q,ssr:G,duration:K}}var Yz=D(()=>{m0()});import v8 from"path";async function xR($){let Z=performance.now(),Y=await S0(),X=$||Y.root||process.cwd(),J=[Y.build?.pagesDir||Y.pagesDir||"pages",Y.componentsDir||"components",Y.layoutsDir||"layouts",Y.partialsDir||"partials"].map((K)=>v8.resolve(X,K)),Q=[],G=0;for(let K of J){let W=await Jz(K);for(let _ of W){G++;let B=await Bun.file(_).text();if(Xz.test(B))Q.push(v8.relative(X,_))}}return{mode:Q.length>0?"ssr":"ssg",serverScriptFiles:Q,totalFilesScanned:G,scanDurationMs:Math.round(performance.now()-Z)}}async function vR($){let Z=await S0(),Y=$||Z.root||process.cwd(),X=v8.resolve(Y,Z.componentsDir||"components"),J=[],Q=await Jz(X);for(let G of Q){let K=await Bun.file(G).text(),W=Xz.test(K),_=PR.test(K)||/<script\b(?![^>]*\bserver\b)[^>]*>/i.test(K)&&!W;if(W&&_){let B=v8.relative(Y,G);J.push({file:B,message:`Component "${B}" has both <script server> and <script client>. `+"Components should be server OR client \u2014 compose them via props/slots."})}}return J}async function Jz($){let Z=[];try{let Y=new Bun.Glob("**/*.stx");for await(let X of Y.scan({cwd:$,absolute:!0}))Z.push(X)}catch{}return Z}var Xz,PR;var Qz=D(()=>{m0();Xz=/<script\b[^>]*\bserver\b/i,PR=/<script\b[^>]*\bclient\b/i});function D2($){let Z=new Map,Y=/@(\w+)/g,X,J=1,Q=0;while((X=Y.exec($))!==null){let G=X[1],K=$.slice(Q,X.index);J+=(K.match(/\n/g)||[]).length,Q=X.index;let W=X.index-$.lastIndexOf(`
11151
+ `,X.index-1);if(Kz.includes(G)){let _=Z.get(G);if(_)_.count++,_.locations.push({line:J,column:W});else Z.set(G,{name:G,count:1,locations:[{line:J,column:W}]})}}return Array.from(Z.values())}function Wz($,Z=[]){let Y=D2($),X=new Set(Y.map((J)=>J.name));for(let J of Z)X.add(J);for(let J of Array.from(X))if(!J.startsWith("end"))X.add(`end${J}`);return Kz.filter((J)=>!X.has(J))}function _z($){let Z=[],Y={conditionals:["if","else","elseif","endif","unless","endunless","switch","case","default","endswitch","isset","endisset"],loops:["for","endfor","foreach","endforeach","forelse","endforelse","while","endwhile","break","continue","empty"],includes:["include","includeIf","includeWhen","includeFirst","once","endonce","extends","section","endsection","yield","parent","push","endpush","prepend","endprepend","stack"],components:["component","endcomponent","slot","endslot","props"],auth:["auth","endauth","guest","endguest","can","endcan","cannot","endcannot","role","endrole","hasRole","endhasRole","hasAnyRole","endhasAnyRole"],forms:["csrf","method","error","enderror","old","input","textarea","select","checkbox","radio","file"],i18n:["translate","lang","choice"],seo:["meta","title","seo","jsonld","canonical","robots","sitemap"]},X=new Set;for(let Q of $)for(let[G,K]of Object.entries(Y))if(K.includes(Q)){X.add(G);break}for(let Q of X)Z.push(`import { process${gR(Q)} } from './${Q}'`);let J=$.filter((Q)=>!Q.startsWith("end")).map((Q)=>` '${Q}': true`).join(`,
11152
11152
  `);return`// Tree-shaken directive bundle
11153
11153
  // Only includes: ${$.join(", ")}
11154
11154
  ${Z.join(`
@@ -11161,7 +11161,7 @@ ${J}
11161
11161
  export function isDirectiveActive(name: string): boolean {
11162
11162
  return name in activeDirectives
11163
11163
  }
11164
- `}function Bz($,Z={}){let Y=[],X=/@if\(([^)]+)\)[\s\S]*?@endif/g,J=$.matchAll(X);for(let _ of J){let B=_[1].trim();if(f8(B,Z)===!1)Y.push({start:_.index,end:_.index+_[0].length,reason:`@if condition always false: ${B}`})}let Q=/@unless\(([^)]+)\)[\s\S]*?@endunless/g,G=$.matchAll(Q);for(let _ of G){let B=_[1].trim();if(f8(B,Z)===!0)Y.push({start:_.index,end:_.index+_[0].length,reason:`@unless condition always true: ${B}`})}let K=/@env\(['"]development['"]\)[\s\S]*?@endenv/g;if(Z.__ENV__==="production"){let _=$.matchAll(K);for(let B of _)Y.push({start:B.index,end:B.index+B[0].length,reason:"Development-only code in production build"})}let W=/@debug[\s\S]*?@enddebug/g;if(Z.__ENV__==="production"){let _=$.matchAll(W);for(let B of _)Y.push({start:B.index,end:B.index+B[0].length,reason:"Debug code in production build"})}return Y}function Uz($,Z={}){let Y=Bz($,Z),X=[];Y.sort((Q,G)=>G.start-Q.start);let J=$;for(let Q of Y)J=J.slice(0,Q.start)+J.slice(Q.end),X.push(Q.reason);return{content:J,removed:X}}function f8($,Z){if($==="true")return!0;if($==="false")return!1;if($==="null")return null;if(/^\d+$/.test($))return Number.parseInt($,10);if(/^\d+\.\d+$/.test($))return Number.parseFloat($);if(/^['"].*['"]$/.test($))return $.slice(1,-1);if($ in Z)return Z[$];let Y=$.match(/^(\w+)\s*(===|!==|==|!=|>=|<=|>|<)\s*(.+)$/);if(Y){let[,X,J,Q]=Y,G=X in Z?Z[X]:void 0,K=f8(Q,Z);if(G!==void 0&&K!==void 0)switch(J){case"==":case"===":return G===K;case"!=":case"!==":return G!==K;case">":return G>K;case"<":return G<K;case">=":return G>=K;case"<=":return G<=K}}return}function zz($,Z){let Y=[],X=$;return X=X.replace(/\{\{\s*(\w+)\s*\}\}/g,(J,Q)=>{if(Q in Z)return Y.push(`{{ ${Q} }} -> ${Z[Q]}`),String(Z[Q]);return J}),X=X.replace(/\{\{\s*(\d+)\s*([+\-*])\s*(\d+)\s*\}\}/g,(J,Q,G,K)=>{let W=Number.parseInt(Q,10),_=Number.parseInt(K,10),B;switch(G){case"+":B=W+_;break;case"-":B=W-_;break;case"*":B=W*_;break;default:return J}return Y.push(`{{ ${Q} ${G} ${K} }} -> ${B}`),String(B)}),{content:X,folded:Y}}function qz($){let Z=$,Y=[],X=0;Z=Z.replace(/<(pre|code|script|style)([^>]*)>([\s\S]*?)<\/\1>/gi,(J)=>{let Q=`__PRESERVE_${X++}__`;return Y.push({marker:Q,content:J}),Q}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(J)=>{let Q=`__PRESERVE_${X++}__`;return Y.push({marker:Q,content:J}),Q}),Z=Z.replace(/\{\{--([\s\S]*?)--\}\}/g,""),Z=Z.replace(/<!--[\s\S]*?-->/g,""),Z=Z.replace(/>\s+</g,"><"),Z=Z.replace(/^\s+/gm,""),Z=Z.replace(/\s+$/gm,""),Z=Z.replace(/\s{2,}/g," ");for(let{marker:J,content:Q}of Y){let G=Z.indexOf(J);if(G!==-1)Z=Z.slice(0,G)+Q+Z.slice(G+J.length)}return Z.trim()}function jz($){let Z=new Map,Y=new Map,X=/(['"])([^'"]{10,})\1/g,J;while((J=X.exec($))!==null){let K=J[2];Y.set(K,(Y.get(K)||0)+1)}let Q=0,G=$;for(let[K,W]of Y)if(W>1){let _=`__STR_${Q++}__`;Z.set(_,K);let B=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),U=new RegExp(`(['"])${B}\\1`,"g");G=G.replace(U,_)}return{content:G,pool:Z,count:Z.size}}function Hz($,Z={}){let Y={...Gz,...Z},X=new Blob([$]).size,J=$,Q=[],G=[],K=[],W=[],_=0;if(Y.target==="production")Y.constants={...Y.constants,__ENV__:"production"};if(Y.deadCodeElimination){let z=Uz(J,Y.constants);if(J=z.content,z.removed.length>0)Q.push("Dead code elimination"),G.push(...z.removed.map((q)=>`Removed: ${q}`))}if(Y.constantFolding&&Object.keys(Y.constants).length>0){let z=zz(J,Y.constants);if(J=z.content,W=z.folded,W.length>0)Q.push("Constant folding")}if(Y.treeShake){if(K=Wz(J,Y.preserveDirectives),K.length>0)Q.push("Tree shaking")}if(Y.stringPooling){let z=jz(J);if(J=z.content,_=z.count,_>0)Q.push("String pooling")}if(Y.minifyHtml){let z=qz(J);if(z.length<J.length)J=z,Q.push("HTML minification")}let B=new Blob([J]).size,U=X>0?Math.round((1-B/X)*100):0;return{content:J,originalSize:X,optimizedSize:B,reduction:U,appliedOptimizations:Q,removedDirectives:K,foldedConstants:W,pooledStrings:_,warnings:G}}async function fR($,Z={}){let Y={...Gz,...Z},X=new Map,J=[],Q=0,G=0,K=new Set;for(let[U,z]of $){let q=Hz(z,Y);X.set(U,q),Q+=q.originalSize,G+=q.optimizedSize,J.push(...q.warnings.map((H)=>`${U}: ${H}`));let j=kJ(z);for(let H of j)K.add(H.name)}let W;if(Y.treeShake)W=_z(Array.from(K));let _;if(Y.stringPooling)_=new Map;let B=Q>0?Math.round((1-G/Q)*100):0;return{templates:X,directiveBundle:W,stringPool:_,totalOriginalSize:Q,totalOptimizedSize:G,overallReduction:B,warnings:J}}function gR($){return $.charAt(0).toUpperCase()+$.slice(1)}var Gz,Kz;var Oz=D(()=>{Gz={treeShake:!0,deadCodeElimination:!0,constantFolding:!0,stringPooling:!1,minifyHtml:!0,removeDevCode:!0,constants:{},preserveDirectives:[],target:"production"},Kz=["if","else","elseif","endif","unless","endunless","switch","case","default","endswitch","for","endfor","foreach","endforeach","forelse","endforelse","while","endwhile","break","continue","empty","extends","section","endsection","yield","parent","include","includeIf","includeWhen","includeFirst","once","endonce","push","endpush","prepend","endprepend","stack","component","endcomponent","slot","endslot","props","auth","endauth","guest","endguest","can","endcan","cannot","endcannot","role","endrole","hasRole","endhasRole","hasAnyRole","endhasAnyRole","csrf","method","error","enderror","old","input","textarea","select","checkbox","radio","file","translate","lang","choice","meta","title","seo","jsonld","canonical","robots","sitemap","ts","endts","js","endjs","css","endcss","markdown","endmarkdown","verbatim","endverbatim","env","production","debug","isset","endisset","empty","endempty"]});var CJ={};Q0(CJ,{toUsers:()=>Rz,toUser:()=>wz,stopBroadcasting:()=>Nz,startBroadcasting:()=>Vz,loadChannels:()=>Az,getBroadcastServer:()=>Fz,channel:()=>Ez,broadcastPrivate:()=>Mz,broadcastPresence:()=>Tz,broadcast:()=>bJ,BroadcastServer:()=>Dz,Broadcast:()=>Iz});import{Broadcast as X7,BroadcastServer as hR}from"ts-broadcasting";import{channel as Ez}from"ts-broadcasting";import{Broadcast as Iz,BroadcastServer as Dz}from"ts-broadcasting";function Fz(){return G1}async function Vz($){if(G1)return G1;let Z=$.driver??"bun",Y=$.host??"0.0.0.0",X=$.port??6001,J=$.scheme??"ws",Q={verbose:$.verbose??!1,driver:Z,default:Z,connections:{[Z]:{driver:Z,host:Y,port:X,scheme:J}}};return G1=new hR(Q),X7.setServer(G1),await G1.start(),G1}async function Nz(){for(let $ of SJ)clearInterval($);if(SJ.length=0,!G1)return;await G1.stop(),G1=null}async function Az($){let Z=await import($),Y=Z.default??Z;if(typeof Y!=="function")throw Error(`routes/channels.ts must export a default function, got ${typeof Y}`);let X=0;return Y({channel(Q,G){if(X++,G.authorize&&G1)G1.channels.channel(Q,G.authorize);if(G.interval&&G.data){let K=G.event??`${Q}.updated`,W=G.data,_=setInterval(async()=>{try{let B=await W();bJ(Q,K,B)}catch{}},G.interval);SJ.push(_)}}}),X}function x4(){if(G1)return!0;if(!Lz)Lz=!0,console.warn("[stx] broadcast() called before server started \u2014 messages will be sent once broadcasting is ready");return!1}function bJ($,Z,Y){if(!x4())return;X7.send($,Z,Y)}function wz($,Z,Y){if(!x4())return;X7.toUser($,Z,Y)}function Rz($,Z,Y){if(!x4())return;X7.toUsers($,Z,Y)}function Mz($,Z,Y){if(!x4())return;X7.send(`private-${$}`,Z,Y)}function Tz($,Z,Y){if(!x4())return;X7.presence($,Z,Y)}var G1=null,SJ,Lz=!1;var g8=D(()=>{SJ=[]});function kz($,Z){let Y={},X=$.trim();if(X.startsWith("{"))X=X.slice(1);if(X.endsWith("}"))X=X.slice(0,-1);if(X=X.trim(),!X)return Y;let J=0;while(J<X.length){while(J<X.length&&/\s/.test(X[J]))J++;if(J>=X.length)break;let Q="";if(X[J]==='"'||X[J]==="'"){let W=X[J];J++;while(J<X.length&&X[J]!==W)if(X[J]==="\\"&&J+1<X.length)Q+=X[J+1],J+=2;else Q+=X[J],J++;J++}else while(J<X.length&&/[\w$]/.test(X[J]))Q+=X[J],J++;while(J<X.length&&/\s/.test(X[J]))J++;if(X[J]===":")J++;while(J<X.length&&/\s/.test(X[J]))J++;let G,K=J;if(X[J]==='"'||X[J]==="'"){let W=X[J];J++;let _="";while(J<X.length&&X[J]!==W)if(X[J]==="\\"&&J+1<X.length)_+=X[J+1],J+=2;else _+=X[J],J++;J++,G=_}else if(X[J]==="{"){let W=1;J++;while(J<X.length&&W>0){if(X[J]==="{")W++;else if(X[J]==="}")W--;else if(X[J]==='"'||X[J]==="'"){let B=X[J];J++;while(J<X.length&&X[J]!==B){if(X[J]==="\\")J++;J++}}J++}let _=X.slice(K,J);G=kz(_,Z)}else if(X[J]==="["){let W=1;J++;while(J<X.length&&W>0){if(X[J]==="[")W++;else if(X[J]==="]")W--;else if(X[J]==='"'||X[J]==="'"){let B=X[J];J++;while(J<X.length&&X[J]!==B){if(X[J]==="\\")J++;J++}}J++}let _=X.slice(K,J);try{G=JSON.parse(_.replace(/'/g,'"'))}catch{G=_}}else{let W="";while(J<X.length&&X[J]!==","&&!/\s/.test(X[J]))W+=X[J],J++;if(W=W.trim(),W==="true")G=!0;else if(W==="false")G=!1;else if(W==="null")G=null;else if(W==="undefined")G=void 0;else if(/^-?\d+(\.\d+)?$/.test(W))G=Number(W);else if(W in Z)G=Z[W];else G=W}if(Q)Y[Q]=G;while(J<X.length&&/\s/.test(X[J]))J++;if(X[J]===",")J++}return Y}function dR($,Z,Y){let X=[];for(let[J,Q]of Object.entries(Z)){let G=$[J];if(Q.required&&(G===void 0||G===null)){X.push(`Component "${Y}": Missing required prop "${J}"`);continue}if(G===void 0||G===null)continue;let K=Array.isArray(Q.type)?Q.type:[Q.type];if(!K.includes("any")){let W=mR(G);if(!K.includes(W))X.push(`Component "${Y}": Prop "${J}" expected ${K.join(" | ")}, got ${W}`)}if(Q.validator&&!Q.validator(G))X.push(`Component "${Y}": Prop "${J}" failed custom validation`)}return X}function uR($,Z){let Y={...$};for(let[X,J]of Object.entries(Z))if(Y[X]===void 0&&J.default!==void 0)Y[X]=typeof J.default==="function"?J.default():J.default;return Y}function mR($){if(Array.isArray($))return"array";if($===null)return"null";return typeof $}function pR(){return[Sz]}var Sz;var bz=D(()=>{X1();h0();q0();Sz={name:"component",handler:async($,Z,Y,X)=>{if(Z.length<1)return $0("Component","component directive requires at least the component name",o.INVALID_DIRECTIVE_SYNTAX);let J=Z[0].replace(/['"]/g,""),Q={};if(Z.length>1)try{let B=Z.slice(1).join(",").trim();if(B.startsWith("{")){if(Q=k0(B,Y),Object.keys(Q).length===0)Q=kz(B,Y)}else{let U=B.trim(),z=Y[U];if(z&&typeof z==="object"&&!Array.isArray(z))Q=z}}catch(B){let U=B instanceof Error?B.message:String(B);return console.error("Component props parsing error:",U),$0("Component",`Error parsing component props: ${U}`,o.EVALUATION_ERROR)}let G=Y.__stx_options||{},K=G.componentsDir||"components",W=new Set;if(!Y.__processedComponents)Y.__processedComponents=new Set;let _=Y.__processedComponents;try{return await D1(J,Q,"",K,Y,X,G,_,W)}catch(B){console.error("Component rendering error:",B);let U=B instanceof Error?B.message:String(B);return $0("Component",`Error rendering component: ${U}`,o.COMPONENT_RENDER_ERROR)}},hasEndTag:!1}});function h8(){return`
11164
+ `}function Bz($,Z={}){let Y=[],X=/@if\(([^)]+)\)[\s\S]*?@endif/g,J=$.matchAll(X);for(let _ of J){let B=_[1].trim();if(f8(B,Z)===!1)Y.push({start:_.index,end:_.index+_[0].length,reason:`@if condition always false: ${B}`})}let Q=/@unless\(([^)]+)\)[\s\S]*?@endunless/g,G=$.matchAll(Q);for(let _ of G){let B=_[1].trim();if(f8(B,Z)===!0)Y.push({start:_.index,end:_.index+_[0].length,reason:`@unless condition always true: ${B}`})}let K=/@env\(['"]development['"]\)[\s\S]*?@endenv/g;if(Z.__ENV__==="production"){let _=$.matchAll(K);for(let B of _)Y.push({start:B.index,end:B.index+B[0].length,reason:"Development-only code in production build"})}let W=/@debug[\s\S]*?@enddebug/g;if(Z.__ENV__==="production"){let _=$.matchAll(W);for(let B of _)Y.push({start:B.index,end:B.index+B[0].length,reason:"Debug code in production build"})}return Y}function Uz($,Z={}){let Y=Bz($,Z),X=[];Y.sort((Q,G)=>G.start-Q.start);let J=$;for(let Q of Y)J=J.slice(0,Q.start)+J.slice(Q.end),X.push(Q.reason);return{content:J,removed:X}}function f8($,Z){if($==="true")return!0;if($==="false")return!1;if($==="null")return null;if(/^\d+$/.test($))return Number.parseInt($,10);if(/^\d+\.\d+$/.test($))return Number.parseFloat($);if(/^['"].*['"]$/.test($))return $.slice(1,-1);if($ in Z)return Z[$];let Y=$.match(/^(\w+)\s*(===|!==|==|!=|>=|<=|>|<)\s*(.+)$/);if(Y){let[,X,J,Q]=Y,G=X in Z?Z[X]:void 0,K=f8(Q,Z);if(G!==void 0&&K!==void 0)switch(J){case"==":case"===":return G===K;case"!=":case"!==":return G!==K;case">":return G>K;case"<":return G<K;case">=":return G>=K;case"<=":return G<=K}}return}function zz($,Z){let Y=[],X=$;return X=X.replace(/\{\{\s*(\w+)\s*\}\}/g,(J,Q)=>{if(Q in Z)return Y.push(`{{ ${Q} }} -> ${Z[Q]}`),String(Z[Q]);return J}),X=X.replace(/\{\{\s*(\d+)\s*([+\-*])\s*(\d+)\s*\}\}/g,(J,Q,G,K)=>{let W=Number.parseInt(Q,10),_=Number.parseInt(K,10),B;switch(G){case"+":B=W+_;break;case"-":B=W-_;break;case"*":B=W*_;break;default:return J}return Y.push(`{{ ${Q} ${G} ${K} }} -> ${B}`),String(B)}),{content:X,folded:Y}}function qz($){let Z=$,Y=[],X=0;Z=Z.replace(/<(pre|code|script|style)([^>]*)>([\s\S]*?)<\/\1>/gi,(J)=>{let Q=`__PRESERVE_${X++}__`;return Y.push({marker:Q,content:J}),Q}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(J)=>{let Q=`__PRESERVE_${X++}__`;return Y.push({marker:Q,content:J}),Q}),Z=Z.replace(/\{\{--([\s\S]*?)--\}\}/g,""),Z=Z.replace(/<!--[\s\S]*?-->/g,""),Z=Z.replace(/>\s+</g,"><"),Z=Z.replace(/^\s+/gm,""),Z=Z.replace(/\s+$/gm,""),Z=Z.replace(/\s{2,}/g," ");for(let{marker:J,content:Q}of Y){let G=Z.indexOf(J);if(G!==-1)Z=Z.slice(0,G)+Q+Z.slice(G+J.length)}return Z.trim()}function jz($){let Z=new Map,Y=new Map,X=/(['"])([^'"]{10,})\1/g,J;while((J=X.exec($))!==null){let K=J[2];Y.set(K,(Y.get(K)||0)+1)}let Q=0,G=$;for(let[K,W]of Y)if(W>1){let _=`__STR_${Q++}__`;Z.set(_,K);let B=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),U=new RegExp(`(['"])${B}\\1`,"g");G=G.replace(U,_)}return{content:G,pool:Z,count:Z.size}}function Hz($,Z={}){let Y={...Gz,...Z},X=new Blob([$]).size,J=$,Q=[],G=[],K=[],W=[],_=0;if(Y.target==="production")Y.constants={...Y.constants,__ENV__:"production"};if(Y.deadCodeElimination){let z=Uz(J,Y.constants);if(J=z.content,z.removed.length>0)Q.push("Dead code elimination"),G.push(...z.removed.map((q)=>`Removed: ${q}`))}if(Y.constantFolding&&Object.keys(Y.constants).length>0){let z=zz(J,Y.constants);if(J=z.content,W=z.folded,W.length>0)Q.push("Constant folding")}if(Y.treeShake){if(K=Wz(J,Y.preserveDirectives),K.length>0)Q.push("Tree shaking")}if(Y.stringPooling){let z=jz(J);if(J=z.content,_=z.count,_>0)Q.push("String pooling")}if(Y.minifyHtml){let z=qz(J);if(z.length<J.length)J=z,Q.push("HTML minification")}let B=new Blob([J]).size,U=X>0?Math.round((1-B/X)*100):0;return{content:J,originalSize:X,optimizedSize:B,reduction:U,appliedOptimizations:Q,removedDirectives:K,foldedConstants:W,pooledStrings:_,warnings:G}}async function fR($,Z={}){let Y={...Gz,...Z},X=new Map,J=[],Q=0,G=0,K=new Set;for(let[U,z]of $){let q=Hz(z,Y);X.set(U,q),Q+=q.originalSize,G+=q.optimizedSize,J.push(...q.warnings.map((H)=>`${U}: ${H}`));let j=D2(z);for(let H of j)K.add(H.name)}let W;if(Y.treeShake)W=_z(Array.from(K));let _;if(Y.stringPooling)_=new Map;let B=Q>0?Math.round((1-G/Q)*100):0;return{templates:X,directiveBundle:W,stringPool:_,totalOriginalSize:Q,totalOptimizedSize:G,overallReduction:B,warnings:J}}function gR($){return $.charAt(0).toUpperCase()+$.slice(1)}var Gz,Kz;var Oz=D(()=>{Gz={treeShake:!0,deadCodeElimination:!0,constantFolding:!0,stringPooling:!1,minifyHtml:!0,removeDevCode:!0,constants:{},preserveDirectives:[],target:"production"},Kz=["if","else","elseif","endif","unless","endunless","switch","case","default","endswitch","for","endfor","foreach","endforeach","forelse","endforelse","while","endwhile","break","continue","empty","extends","section","endsection","yield","parent","include","includeIf","includeWhen","includeFirst","once","endonce","push","endpush","prepend","endprepend","stack","component","endcomponent","slot","endslot","props","auth","endauth","guest","endguest","can","endcan","cannot","endcannot","role","endrole","hasRole","endhasRole","hasAnyRole","endhasAnyRole","csrf","method","error","enderror","old","input","textarea","select","checkbox","radio","file","translate","lang","choice","meta","title","seo","jsonld","canonical","robots","sitemap","ts","endts","js","endjs","css","endcss","markdown","endmarkdown","verbatim","endverbatim","env","production","debug","isset","endisset","empty","endempty"]});var b2={};Q0(b2,{toUsers:()=>Rz,toUser:()=>wz,stopBroadcasting:()=>Nz,startBroadcasting:()=>Vz,loadChannels:()=>Az,getBroadcastServer:()=>Fz,channel:()=>Ez,broadcastPrivate:()=>Mz,broadcastPresence:()=>Tz,broadcast:()=>S2,BroadcastServer:()=>Dz,Broadcast:()=>Iz});import{Broadcast as X7,BroadcastServer as hR}from"ts-broadcasting";import{channel as Ez}from"ts-broadcasting";import{Broadcast as Iz,BroadcastServer as Dz}from"ts-broadcasting";function Fz(){return G1}async function Vz($){if(G1)return G1;let Z=$.driver??"bun",Y=$.host??"0.0.0.0",X=$.port??6001,J=$.scheme??"ws",Q={verbose:$.verbose??!1,driver:Z,default:Z,connections:{[Z]:{driver:Z,host:Y,port:X,scheme:J}}};return G1=new hR(Q),X7.setServer(G1),await G1.start(),G1}async function Nz(){for(let $ of k2)clearInterval($);if(k2.length=0,!G1)return;await G1.stop(),G1=null}async function Az($){let Z=await import($),Y=Z.default??Z;if(typeof Y!=="function")throw Error(`routes/channels.ts must export a default function, got ${typeof Y}`);let X=0;return Y({channel(Q,G){if(X++,G.authorize&&G1)G1.channels.channel(Q,G.authorize);if(G.interval&&G.data){let K=G.event??`${Q}.updated`,W=G.data,_=setInterval(async()=>{try{let B=await W();S2(Q,K,B)}catch{}},G.interval);k2.push(_)}}}),X}function x4(){if(G1)return!0;if(!Lz)Lz=!0,console.warn("[stx] broadcast() called before server started \u2014 messages will be sent once broadcasting is ready");return!1}function S2($,Z,Y){if(!x4())return;X7.send($,Z,Y)}function wz($,Z,Y){if(!x4())return;X7.toUser($,Z,Y)}function Rz($,Z,Y){if(!x4())return;X7.toUsers($,Z,Y)}function Mz($,Z,Y){if(!x4())return;X7.send(`private-${$}`,Z,Y)}function Tz($,Z,Y){if(!x4())return;X7.presence($,Z,Y)}var G1=null,k2,Lz=!1;var g8=D(()=>{k2=[]});function kz($,Z){let Y={},X=$.trim();if(X.startsWith("{"))X=X.slice(1);if(X.endsWith("}"))X=X.slice(0,-1);if(X=X.trim(),!X)return Y;let J=0;while(J<X.length){while(J<X.length&&/\s/.test(X[J]))J++;if(J>=X.length)break;let Q="";if(X[J]==='"'||X[J]==="'"){let W=X[J];J++;while(J<X.length&&X[J]!==W)if(X[J]==="\\"&&J+1<X.length)Q+=X[J+1],J+=2;else Q+=X[J],J++;J++}else while(J<X.length&&/[\w$]/.test(X[J]))Q+=X[J],J++;while(J<X.length&&/\s/.test(X[J]))J++;if(X[J]===":")J++;while(J<X.length&&/\s/.test(X[J]))J++;let G,K=J;if(X[J]==='"'||X[J]==="'"){let W=X[J];J++;let _="";while(J<X.length&&X[J]!==W)if(X[J]==="\\"&&J+1<X.length)_+=X[J+1],J+=2;else _+=X[J],J++;J++,G=_}else if(X[J]==="{"){let W=1;J++;while(J<X.length&&W>0){if(X[J]==="{")W++;else if(X[J]==="}")W--;else if(X[J]==='"'||X[J]==="'"){let B=X[J];J++;while(J<X.length&&X[J]!==B){if(X[J]==="\\")J++;J++}}J++}let _=X.slice(K,J);G=kz(_,Z)}else if(X[J]==="["){let W=1;J++;while(J<X.length&&W>0){if(X[J]==="[")W++;else if(X[J]==="]")W--;else if(X[J]==='"'||X[J]==="'"){let B=X[J];J++;while(J<X.length&&X[J]!==B){if(X[J]==="\\")J++;J++}}J++}let _=X.slice(K,J);try{G=JSON.parse(_.replace(/'/g,'"'))}catch{G=_}}else{let W="";while(J<X.length&&X[J]!==","&&!/\s/.test(X[J]))W+=X[J],J++;if(W=W.trim(),W==="true")G=!0;else if(W==="false")G=!1;else if(W==="null")G=null;else if(W==="undefined")G=void 0;else if(/^-?\d+(\.\d+)?$/.test(W))G=Number(W);else if(W in Z)G=Z[W];else G=W}if(Q)Y[Q]=G;while(J<X.length&&/\s/.test(X[J]))J++;if(X[J]===",")J++}return Y}function dR($,Z,Y){let X=[];for(let[J,Q]of Object.entries(Z)){let G=$[J];if(Q.required&&(G===void 0||G===null)){X.push(`Component "${Y}": Missing required prop "${J}"`);continue}if(G===void 0||G===null)continue;let K=Array.isArray(Q.type)?Q.type:[Q.type];if(!K.includes("any")){let W=mR(G);if(!K.includes(W))X.push(`Component "${Y}": Prop "${J}" expected ${K.join(" | ")}, got ${W}`)}if(Q.validator&&!Q.validator(G))X.push(`Component "${Y}": Prop "${J}" failed custom validation`)}return X}function uR($,Z){let Y={...$};for(let[X,J]of Object.entries(Z))if(Y[X]===void 0&&J.default!==void 0)Y[X]=typeof J.default==="function"?J.default():J.default;return Y}function mR($){if(Array.isArray($))return"array";if($===null)return"null";return typeof $}function pR(){return[Sz]}var Sz;var bz=D(()=>{X1();h0();q0();Sz={name:"component",handler:async($,Z,Y,X)=>{if(Z.length<1)return $0("Component","component directive requires at least the component name",o.INVALID_DIRECTIVE_SYNTAX);let J=Z[0].replace(/['"]/g,""),Q={};if(Z.length>1)try{let B=Z.slice(1).join(",").trim();if(B.startsWith("{")){if(Q=k0(B,Y),Object.keys(Q).length===0)Q=kz(B,Y)}else{let U=B.trim(),z=Y[U];if(z&&typeof z==="object"&&!Array.isArray(z))Q=z}}catch(B){let U=B instanceof Error?B.message:String(B);return console.error("Component props parsing error:",U),$0("Component",`Error parsing component props: ${U}`,o.EVALUATION_ERROR)}let G=Y.__stx_options||{},K=G.componentsDir||"components",W=new Set;if(!Y.__processedComponents)Y.__processedComponents=new Set;let _=Y.__processedComponents;try{return await D1(J,Q,"",K,Y,X,G,_,W)}catch(B){console.error("Component rendering error:",B);let U=B instanceof Error?B.message:String(B);return $0("Component",`Error rendering component: ${U}`,o.COMPONENT_RENDER_ERROR)}},hasEndTag:!1}});function h8(){return`
11165
11165
  /* Theme selector for code blocks */
11166
11166
  .theme-selector {
11167
11167
  margin: 1rem 0;
@@ -11241,12 +11241,12 @@ else {
11241
11241
  <span class="frontmatter-label">${Z}:</span>
11242
11242
  <span>${Array.isArray(Y)?Y.join(", "):String(Y)}</span>
11243
11243
  </div>`).join("")}
11244
- </div>`}var Cz=()=>{};import yz from"net";async function cR($){return new Promise((Z)=>{let Y=yz.createServer();Y.once("error",()=>Z(!1)),Y.once("listening",()=>{Y.close(()=>Z(!0))}),Y.listen($,"0.0.0.0")})}async function lR($){return new Promise((Z)=>{let Y=yz.createServer();Y.once("error",()=>Z(!1)),Y.once("listening",()=>{Y.close(()=>Z(!0))}),Y.listen($,"::")})}async function iR($){if(!await cR($))return!1;return await lR($)}async function E$($,Z=20){for(let Y=0;Y<Z;Y++){let X=$+Y;if(await iR(X))return X}throw Error(`Could not find an available port between ${$} and ${$+Z-1}`)}var Pz=()=>{};async function sR(){try{let $=await import("@stacksjs/desktop");if(typeof $.openDevWindow!=="function")return null;return $}catch{return null}}async function J7($,Z={}){let Y={...nR,...Z},X=await sR();if(!X)return console.log(`${R.yellow}\u26A0${R.reset} Native window requested, but @stacksjs/desktop is not available.`),console.log(" Install & build the desktop package to enable --native."),!1;try{let J=await X.openDevWindow($,{title:Y.title,width:Y.width,height:Y.height,darkMode:Y.darkMode,hotReload:Y.hotReload,nativeSidebar:Y.nativeSidebar,sidebarWidth:Y.sidebarWidth,sidebarConfig:Y.sidebarConfig});if(J&&Y.nativeSidebar)console.log(`${R.green}\u2713${R.reset} Native sidebar enabled (macOS Tahoe style)`);return J}catch(J){return console.log(`${R.red}\u2717${R.reset} Could not open native window:`,J),!1}}function p8($){if($.match(/<Sidebar[\s\S]*?variant=["']tahoe["'][\s\S]*?\/>/i)){let J=$.match(/<script\s+server[^>]*>([\s\S]*?)<\/script>/i);if(J){let Q=J[1];try{let G=`
11244
+ </div>`}var Cz=()=>{};import yz from"net";async function cR($){return new Promise((Z)=>{let Y=yz.createServer();Y.once("error",()=>Z(!1)),Y.once("listening",()=>{Y.close(()=>Z(!0))}),Y.listen($,"0.0.0.0")})}async function lR($){return new Promise((Z)=>{let Y=yz.createServer();Y.once("error",()=>Z(!1)),Y.once("listening",()=>{Y.close(()=>Z(!0))}),Y.listen($,"::")})}async function iR($){if(!await cR($))return!1;return await lR($)}async function I$($,Z=20){for(let Y=0;Y<Z;Y++){let X=$+Y;if(await iR(X))return X}throw Error(`Could not find an available port between ${$} and ${$+Z-1}`)}var Pz=()=>{};async function sR(){try{let $=await import("@stacksjs/desktop");if(typeof $.openDevWindow!=="function")return null;return $}catch{return null}}async function J7($,Z={}){let Y={...nR,...Z},X=await sR();if(!X)return console.log(`${R.yellow}\u26A0${R.reset} Native window requested, but @stacksjs/desktop is not available.`),console.log(" Install & build the desktop package to enable --native."),!1;try{let J=await X.openDevWindow($,{title:Y.title,width:Y.width,height:Y.height,darkMode:Y.darkMode,hotReload:Y.hotReload,nativeSidebar:Y.nativeSidebar,sidebarWidth:Y.sidebarWidth,sidebarConfig:Y.sidebarConfig});if(J&&Y.nativeSidebar)console.log(`${R.green}\u2713${R.reset} Native sidebar enabled (macOS Tahoe style)`);return J}catch(J){return console.log(`${R.red}\u2717${R.reset} Could not open native window:`,J),!1}}function p8($){if($.match(/<Sidebar[\s\S]*?variant=["']tahoe["'][\s\S]*?\/>/i)){let J=$.match(/<script\s+server[^>]*>([\s\S]*?)<\/script>/i);if(J){let Q=J[1];try{let G=`
11245
11245
  ${Q}
11246
11246
  return typeof sidebarConfig !== 'undefined' ? sidebarConfig : null;
11247
- `,W=Function(G)();if(W)return W}catch(G){console.warn("Invalid sidebarConfig:",G)}}return{sections:[]}}let Y=$.match(/@nativeSidebar\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(Y)try{return JSON.parse(Y[1])}catch{console.warn("Invalid @nativeSidebar configuration")}let X=$.match(/<script\s+native-sidebar[^>]*>([\s\S]*?)<\/script>/i);if(X)try{let J=X[1].match(/(?:export\s+(?:default\s+)?|const\s+\w+\s*=\s*)(\{[\s\S]*\})/m);if(J)return Function(`return ${J[1]}`)()}catch(J){console.warn("Invalid native-sidebar script configuration:",J)}return}var nR;var xz=D(()=>{v7();nR={title:"stx Development",width:1400,height:900,darkMode:!0,hotReload:!0,nativeSidebar:!1,sidebarWidth:260,sidebarConfig:void 0}});function yJ(){console.log(`
11248
- Keyboard shortcuts:`),console.log(` ${R.cyan}o${R.reset} + Enter - Open in browser`),console.log(` ${R.cyan}c${R.reset} + Enter - Clear console`),console.log(` ${R.cyan}q${R.reset} + Enter (or ${R.cyan}Ctrl+C${R.reset}) - Quit server`),console.log(` ${R.cyan}h${R.reset} + Enter - Show this help`)}function rR($){console.log(`${R.green}Server running at ${R.cyan}${$}${R.reset}`),console.log(`Press ${R.cyan}Ctrl+C${R.reset} to stop the server`),yJ()}function oR($){console.log(`${R.dim}Opening ${R.cyan}${$}${R.dim} in your browser...${R.reset}`),Bun.spawn(["open",$],{stderr:"inherit"})}function I$($,Z,Y){if(!process.stdin.isTTY)return;process.stdin.setRawMode(!0),process.stdin.setEncoding("utf8"),process.stdin.resume(),yJ();let X="";process.stdin.on("data",(J)=>{if(J==="\x03"){if(Y?.onQuit)Y.onQuit();Z(),process.exit(0)}if(X+=J,X.endsWith("\r")||X.endsWith(`
11249
- `)){let Q=X.trim().toLowerCase();X="",aR(Q,$,Z,Y)}})}function aR($,Z,Y,X){switch($){case"o":if(X?.onOpen)X.onOpen();else oR(Z);break;case"c":if(X?.onClear)X.onClear();else console.clear(),rR(Z);break;case"q":if(X?.onQuit)X.onQuit();console.log(`${R.yellow}Stopping server...${R.reset}`),Y(),process.exit(0);break;case"h":if(X?.onHelp)X.onHelp();else yJ();break;default:break}}var vz=D(()=>{v7()});var fz=()=>{};var v4=D(()=>{v7();E1();Cz();Pz();xz();vz();fz()});var{serve:tR}=globalThis.Bun;import PJ from"fs";import Q7 from"path";async function c8($,Z={}){let Y=Z.port||3000,X=Z.watch!==!1,J=Q7.resolve($);if(!PJ.existsSync(J))return console.error(`${R.red}Error: File not found: ${R.bright}${J}${R.reset}`),!1;if(!J.endsWith(".md"))return console.error(`${R.red}Error: File must have .md extension: ${R.bright}${J}${R.reset}`),!1;console.log(`${R.blue}Processing${R.reset} ${R.bright}${$}${R.reset}...`);let Q=null,G=async()=>{try{let{content:U,data:z}=await p1(J,{markdown:{syntaxHighlighting:{serverSide:!0,enabled:!0,defaultTheme:t0.markdown?.syntaxHighlighting?.defaultTheme||"github-dark",highlightUnknownLanguages:!0}}}),q=Z.markdown?.syntaxHighlighting||t0.markdown?.syntaxHighlighting,j=q?.defaultTheme||"github-dark",H=["github-dark"],O=q?.additionalThemes||[],L=[...new Set([...H,...O])].map((V)=>`<option value="${V}"${V===j?" selected":""}>${V}</option>`).join(`
11247
+ `,W=Function(G)();if(W)return W}catch(G){console.warn("Invalid sidebarConfig:",G)}}return{sections:[]}}let Y=$.match(/@nativeSidebar\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(Y)try{return JSON.parse(Y[1])}catch{console.warn("Invalid @nativeSidebar configuration")}let X=$.match(/<script\s+native-sidebar[^>]*>([\s\S]*?)<\/script>/i);if(X)try{let J=X[1].match(/(?:export\s+(?:default\s+)?|const\s+\w+\s*=\s*)(\{[\s\S]*\})/m);if(J)return Function(`return ${J[1]}`)()}catch(J){console.warn("Invalid native-sidebar script configuration:",J)}return}var nR;var xz=D(()=>{v7();nR={title:"stx Development",width:1400,height:900,darkMode:!0,hotReload:!0,nativeSidebar:!1,sidebarWidth:260,sidebarConfig:void 0}});function C2(){console.log(`
11248
+ Keyboard shortcuts:`),console.log(` ${R.cyan}o${R.reset} + Enter - Open in browser`),console.log(` ${R.cyan}c${R.reset} + Enter - Clear console`),console.log(` ${R.cyan}q${R.reset} + Enter (or ${R.cyan}Ctrl+C${R.reset}) - Quit server`),console.log(` ${R.cyan}h${R.reset} + Enter - Show this help`)}function rR($){console.log(`${R.green}Server running at ${R.cyan}${$}${R.reset}`),console.log(`Press ${R.cyan}Ctrl+C${R.reset} to stop the server`),C2()}function oR($){console.log(`${R.dim}Opening ${R.cyan}${$}${R.dim} in your browser...${R.reset}`),Bun.spawn(["open",$],{stderr:"inherit"})}function D$($,Z,Y){if(!process.stdin.isTTY)return;process.stdin.setRawMode(!0),process.stdin.setEncoding("utf8"),process.stdin.resume(),C2();let X="";process.stdin.on("data",(J)=>{if(J==="\x03"){if(Y?.onQuit)Y.onQuit();Z(),process.exit(0)}if(X+=J,X.endsWith("\r")||X.endsWith(`
11249
+ `)){let Q=X.trim().toLowerCase();X="",aR(Q,$,Z,Y)}})}function aR($,Z,Y,X){switch($){case"o":if(X?.onOpen)X.onOpen();else oR(Z);break;case"c":if(X?.onClear)X.onClear();else console.clear(),rR(Z);break;case"q":if(X?.onQuit)X.onQuit();console.log(`${R.yellow}Stopping server...${R.reset}`),Y(),process.exit(0);break;case"h":if(X?.onHelp)X.onHelp();else C2();break;default:break}}var vz=D(()=>{v7()});var fz=()=>{};var v4=D(()=>{v7();E1();Cz();Pz();xz();vz();fz()});var{serve:tR}=globalThis.Bun;import y2 from"fs";import Q7 from"path";async function c8($,Z={}){let Y=Z.port||3000,X=Z.watch!==!1,J=Q7.resolve($);if(!y2.existsSync(J))return console.error(`${R.red}Error: File not found: ${R.bright}${J}${R.reset}`),!1;if(!J.endsWith(".md"))return console.error(`${R.red}Error: File must have .md extension: ${R.bright}${J}${R.reset}`),!1;console.log(`${R.blue}Processing${R.reset} ${R.bright}${$}${R.reset}...`);let Q=null,G=async()=>{try{let{content:U,data:z}=await p1(J,{markdown:{syntaxHighlighting:{serverSide:!0,enabled:!0,defaultTheme:t0.markdown?.syntaxHighlighting?.defaultTheme||"github-dark",highlightUnknownLanguages:!0}}}),q=Z.markdown?.syntaxHighlighting||t0.markdown?.syntaxHighlighting,j=q?.defaultTheme||"github-dark",H=["github-dark"],O=q?.additionalThemes||[],L=[...new Set([...H,...O])].map((V)=>`<option value="${V}"${V===j?" selected":""}>${V}</option>`).join(`
11250
11250
  `);return Q=`
11251
11251
  <!DOCTYPE html>
11252
11252
  <html lang="en">
@@ -11409,12 +11409,12 @@ Keyboard shortcuts:`),console.log(` ${R.cyan}o${R.reset} + Enter - Open in brow
11409
11409
  </script>
11410
11410
  </body>
11411
11411
  </html>
11412
- `,!0}catch(U){return console.error(`${R.red}Error processing Markdown file:${R.reset}`,U),!1}};if(!await G())return!1;let W=Y;try{if(W=await E$(Y),W!==Y)console.log(`${R.yellow}Port ${Y} is busy, using port ${W} instead${R.reset}`)}catch{return console.error(`${R.red}Could not find an available port${R.reset}`),!1}console.log(`${R.blue}Starting server on ${R.cyan}http://localhost:${W}/${R.reset}...`);let _=tR({port:W,fetch(U){if(new URL(U.url).pathname==="/")return new Response(Q,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}});return new Response("Not Found",{status:404})},error(U){return new Response(`<pre>${U}
11412
+ `,!0}catch(U){return console.error(`${R.red}Error processing Markdown file:${R.reset}`,U),!1}};if(!await G())return!1;let W=Y;try{if(W=await I$(Y),W!==Y)console.log(`${R.yellow}Port ${Y} is busy, using port ${W} instead${R.reset}`)}catch{return console.error(`${R.red}Could not find an available port${R.reset}`),!1}console.log(`${R.blue}Starting server on ${R.cyan}http://localhost:${W}/${R.reset}...`);let _=tR({port:W,fetch(U){if(new URL(U.url).pathname==="/")return new Response(Q,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}});return new Response("Not Found",{status:404})},error(U){return new Response(`<pre>${U}
11413
11413
  ${U.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});console.clear(),console.log(`
11414
11414
  ${R.blue}stx${R.reset} ${R.green}${process.env.stx_VERSION||"v0.0.10"}${R.reset} ${R.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${R.reset}`),console.log(`
11415
11415
  ${R.bright}\u2192 ${R.cyan}http://localhost:${W}/${R.reset}`),console.log(`
11416
11416
  ${R.yellow}Routes:${R.reset}`);let B=Q7.relative(process.cwd(),J);if(console.log(` ${R.green}\u2514\u2500 /${R.reset} \u2192 ${R.bright}${B}${R.reset}`),console.log(`
11417
- Press ${R.cyan}h${R.reset} + ${R.cyan}Enter${R.reset} to show shortcuts`),I$(_.url.toString(),()=>{if(X)PJ.watch(Q7.dirname(J),{recursive:!0}).close();_.stop()}),Z.native)await J7(W,{title:Q7.basename(J,".md")});if(X){let U=Q7.dirname(J);console.log(`${R.blue}Watching ${R.bright}${U}${R.reset} for changes...`);let z=PJ.watch(U,{recursive:!0},async(q,j)=>{if(j&&j.endsWith(".md"))console.log(`${R.yellow}File ${R.bright}${j}${R.yellow} changed, reprocessing...${R.reset}`),await G()});process.on("SIGINT",()=>{z.close(),_.stop(),process.exit(0)})}return!0}var xJ=D(()=>{d5();m0();v4()});class vJ{clients=new Set;server=null;options;constructor($={}){this.options={wsPort:$.wsPort??3001,showOverlay:$.showOverlay??!0,reconnectInterval:$.reconnectInterval??1000,maxReconnectAttempts:$.maxReconnectAttempts??10,verbose:$.verbose??!1}}start($){let Z=$??this.options.wsPort,Y=20;for(let X=0;X<Y;X++)try{if(this.server=Bun.serve({port:Z,fetch(J,Q){if(Q.upgrade(J,{data:{}}))return;return new Response("stx Hot Reload Server",{headers:{"Content-Type":"text/plain"}})},websocket:{open:(J)=>{if(this.clients.add(J),this.options.verbose)console.log(`[HMR] Client connected (${this.clients.size} total)`);J.send(JSON.stringify({type:"connected",timestamp:Date.now()}))},close:(J)=>{if(this.clients.delete(J),this.options.verbose)console.log(`[HMR] Client disconnected (${this.clients.size} total)`)},message:(J,Q)=>{let G=typeof Q==="string"?Q:Q.toString();if(G==="ping")return;try{let K=JSON.parse(G);if(K.type==="console"&&Array.isArray(K.args)){let W=K.args.join(" "),B={log:"\x1B[36m",warn:"\x1B[33m",error:"\x1B[31m",info:"\x1B[34m"}[K.level]??"\x1B[36m";console.log(`${B}[browser]${K.level!=="log"?` ${K.level}`:""}\x1B[0m ${W}`)}}catch{}}}}),this.options.verbose)console.log(`[HMR] WebSocket server started on port ${Z}`);return Z}catch(J){if(J?.code==="EADDRINUSE"){Z++;continue}throw J}throw Error(`Could not find an available port after ${Y} attempts starting from ${$??this.options.wsPort}`)}stop(){for(let $ of this.clients)try{$.close()}catch{}if(this.clients.clear(),this.server)this.server.stop(),this.server=null;if(this.options.verbose)console.log("[HMR] Server stopped")}broadcast($){let Z=JSON.stringify($),Y=0;for(let X of this.clients)try{if(X.readyState===1)X.send(Z),Y++}catch{this.clients.delete(X)}if(this.options.verbose&&Y>0)console.log(`[HMR] Broadcast ${$.type} to ${Y} client(s)`)}reload($){if(this.options.verbose)console.log(`[HMR] Sending reload to ${this.clients.size} client(s) for: ${$||"all"}`);this.broadcast({type:"reload",path:$,timestamp:Date.now()})}updateCss($,Z){this.broadcast({type:"css-update",path:$,content:Z,timestamp:Date.now()})}error($){this.broadcast({type:"error",content:$,timestamp:Date.now()})}get clientCount(){return this.clients.size}get port(){return this.options.wsPort}}function gz($,Z={}){let{showOverlay:Y=!0,reconnectInterval:X=1000,maxReconnectAttempts:J=10}=Z;return`
11417
+ Press ${R.cyan}h${R.reset} + ${R.cyan}Enter${R.reset} to show shortcuts`),D$(_.url.toString(),()=>{if(X)y2.watch(Q7.dirname(J),{recursive:!0}).close();_.stop()}),Z.native)await J7(W,{title:Q7.basename(J,".md")});if(X){let U=Q7.dirname(J);console.log(`${R.blue}Watching ${R.bright}${U}${R.reset} for changes...`);let z=y2.watch(U,{recursive:!0},async(q,j)=>{if(j&&j.endsWith(".md"))console.log(`${R.yellow}File ${R.bright}${j}${R.yellow} changed, reprocessing...${R.reset}`),await G()});process.on("SIGINT",()=>{z.close(),_.stop(),process.exit(0)})}return!0}var P2=D(()=>{d5();m0();v4()});class x2{clients=new Set;server=null;options;constructor($={}){this.options={wsPort:$.wsPort??3001,showOverlay:$.showOverlay??!0,reconnectInterval:$.reconnectInterval??1000,maxReconnectAttempts:$.maxReconnectAttempts??10,verbose:$.verbose??!1}}start($){let Z=$??this.options.wsPort,Y=20;for(let X=0;X<Y;X++)try{if(this.server=Bun.serve({port:Z,fetch(J,Q){if(Q.upgrade(J,{data:{}}))return;return new Response("stx Hot Reload Server",{headers:{"Content-Type":"text/plain"}})},websocket:{open:(J)=>{if(this.clients.add(J),this.options.verbose)console.log(`[HMR] Client connected (${this.clients.size} total)`);J.send(JSON.stringify({type:"connected",timestamp:Date.now()}))},close:(J)=>{if(this.clients.delete(J),this.options.verbose)console.log(`[HMR] Client disconnected (${this.clients.size} total)`)},message:(J,Q)=>{let G=typeof Q==="string"?Q:Q.toString();if(G==="ping")return;try{let K=JSON.parse(G);if(K.type==="console"&&Array.isArray(K.args)){let W=K.args.join(" "),B={log:"\x1B[36m",warn:"\x1B[33m",error:"\x1B[31m",info:"\x1B[34m"}[K.level]??"\x1B[36m";console.log(`${B}[browser]${K.level!=="log"?` ${K.level}`:""}\x1B[0m ${W}`)}}catch{}}}}),this.options.verbose)console.log(`[HMR] WebSocket server started on port ${Z}`);return Z}catch(J){if(J?.code==="EADDRINUSE"){Z++;continue}throw J}throw Error(`Could not find an available port after ${Y} attempts starting from ${$??this.options.wsPort}`)}stop(){for(let $ of this.clients)try{$.close()}catch{}if(this.clients.clear(),this.server)this.server.stop(),this.server=null;if(this.options.verbose)console.log("[HMR] Server stopped")}broadcast($){let Z=JSON.stringify($),Y=0;for(let X of this.clients)try{if(X.readyState===1)X.send(Z),Y++}catch{this.clients.delete(X)}if(this.options.verbose&&Y>0)console.log(`[HMR] Broadcast ${$.type} to ${Y} client(s)`)}reload($){if(this.options.verbose)console.log(`[HMR] Sending reload to ${this.clients.size} client(s) for: ${$||"all"}`);this.broadcast({type:"reload",path:$,timestamp:Date.now()})}updateCss($,Z){this.broadcast({type:"css-update",path:$,content:Z,timestamp:Date.now()})}error($){this.broadcast({type:"error",content:$,timestamp:Date.now()})}get clientCount(){return this.clients.size}get port(){return this.options.wsPort}}function gz($,Z={}){let{showOverlay:Y=!0,reconnectInterval:X=1000,maxReconnectAttempts:J=10}=Z;return`
11418
11418
  <script>
11419
11419
  (function() {
11420
11420
  // stx Hot Reload Client
@@ -11607,10 +11607,10 @@ else {
11607
11607
  };
11608
11608
  })();
11609
11609
  </script>
11610
- `}function y1($,Z,Y={}){let X=gz(Z,Y),J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+X+$.slice(J);if($.includes("</html>"))return $.replace("</html>",`${X}</html>`);return $+X}function f4($){let Z=$.toLowerCase();return Z.endsWith(".css")||Z.endsWith(".scss")||Z.endsWith(".sass")||Z.endsWith(".less")}function g4($){let Z=$.toLowerCase();return[".stx",".html",".htm",".md",".js",".ts",".jsx",".tsx",".json"].some((X)=>Z.endsWith(X))}function h4($){return[/^\./,/node_modules/,/\.stx\/output/,/\.stx\/cache/,/~$/,/\.swp$/,/\.swo$/].some((Y)=>Y.test($))}function d4($){if(!G7)G7=new vJ($);return G7}function K7(){if(G7)G7.stop(),G7=null}var G7=null;import u4 from"path";var W7;var l8=D(()=>{T$();X1();d0();g$();_1();W7={name:"bun-plugin-stx",async setup($){let Y={...await S0(),...$.config?.stx},X=new Set,J=Y.webComponents?.enabled?`./${u4.relative(u4.dirname($.config?.outdir||"dist"),Y.webComponents.outputDir||"dist/web-components")}`:"/web-components",Q=[];if(Y.webComponents?.enabled)try{let G=await XX(Y,X);if(Q.push(...G),Y.debug&&G.length>0)console.log(`Successfully built ${G.length} web components`)}catch(G){console.error("Failed to build web components:",G)}$.onLoad({filter:/\.stx$/},async({path:G})=>{try{let K=new Set;if(Y.cache&&Y.cachePath){let H=await j8(G,Y);if(H){if(Y.debug)console.log(`Using cached version of ${G}`);return{contents:H,loader:"html"}}}let W=await M1(()=>Bun.file(G).text(),"",(H)=>{throw new C5(`Failed to read stx file: ${G}`,G,void 0,void 0,`File read error: ${H.message}`)});if(!W)throw new C5(`stx file is empty: ${G}`,G);let{scriptContent:_,templateContent:B,allScripts:U}=x7.time("script-extraction",()=>{let H=W,O=W.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(O)H=O[1].trim();let F=W.match(/<script\b[^>]*>[\s\S]*?<\/script>/gi)||[],L="",V=[];for(let N of F){let w=N.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i)?.[1]||"",M=N.match(/<script\b([^>]*)>/i),T=M?M[1]:"";if(/\bserver\b/i.test(T))L=w;else V.push(N)}let A=H.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"");return{scriptContent:L,templateContent:A,allScripts:V}}),z={__filename:G,__dirname:u4.dirname(G),__stx:{webComponentsPath:J,builtComponents:Q}};await M1(()=>R0(_,z,G),void 0,(H)=>{let O=new O1(`Script execution failed in ${G}: ${H.message}`,G,void 0,void 0,_.substring(0,100));if(u0.log(O,{filePath:G,scriptContent:_}),Y.debug)throw O});let j=await x7.timeAsync("directive-processing",async()=>{return await Z0(B,z,G,Y,K)});if(U.length>0){let{interpolateScriptsInTemplate:H}=await Promise.resolve().then(() => (d0(),y7)),O=H(U.join(`
11610
+ `}function y1($,Z,Y={}){let X=gz(Z,Y),J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+X+$.slice(J);if($.includes("</html>"))return $.replace("</html>",`${X}</html>`);return $+X}function f4($){let Z=$.toLowerCase();return Z.endsWith(".css")||Z.endsWith(".scss")||Z.endsWith(".sass")||Z.endsWith(".less")}function g4($){let Z=$.toLowerCase();return[".stx",".html",".htm",".md",".js",".ts",".jsx",".tsx",".json"].some((X)=>Z.endsWith(X))}function h4($){return[/^\./,/node_modules/,/\.stx\/output/,/\.stx\/cache/,/~$/,/\.swp$/,/\.swo$/].some((Y)=>Y.test($))}function d4($){if(!G7)G7=new x2($);return G7}function K7(){if(G7)G7.stop(),G7=null}var G7=null;import u4 from"path";var W7;var l8=D(()=>{E$();X1();d0();g$();_1();W7={name:"bun-plugin-stx",async setup($){let Y={...await S0(),...$.config?.stx},X=new Set,J=Y.webComponents?.enabled?`./${u4.relative(u4.dirname($.config?.outdir||"dist"),Y.webComponents.outputDir||"dist/web-components")}`:"/web-components",Q=[];if(Y.webComponents?.enabled)try{let G=await YX(Y,X);if(Q.push(...G),Y.debug&&G.length>0)console.log(`Successfully built ${G.length} web components`)}catch(G){console.error("Failed to build web components:",G)}$.onLoad({filter:/\.stx$/},async({path:G})=>{try{let K=new Set;if(Y.cache&&Y.cachePath){let H=await j8(G,Y);if(H){if(Y.debug)console.log(`Using cached version of ${G}`);return{contents:H,loader:"html"}}}let W=await M1(()=>Bun.file(G).text(),"",(H)=>{throw new C5(`Failed to read stx file: ${G}`,G,void 0,void 0,`File read error: ${H.message}`)});if(!W)throw new C5(`stx file is empty: ${G}`,G);let{scriptContent:_,templateContent:B,allScripts:U}=x7.time("script-extraction",()=>{let H=W,O=W.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(O)H=O[1].trim();let F=W.match(/<script\b[^>]*>[\s\S]*?<\/script>/gi)||[],L="",V=[];for(let N of F){let w=N.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i)?.[1]||"",M=N.match(/<script\b([^>]*)>/i),T=M?M[1]:"";if(/\bserver\b/i.test(T))L=w;else V.push(N)}let A=H.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"");return{scriptContent:L,templateContent:A,allScripts:V}}),z={__filename:G,__dirname:u4.dirname(G),__stx:{webComponentsPath:J,builtComponents:Q}};await M1(()=>R0(_,z,G),void 0,(H)=>{let O=new O1(`Script execution failed in ${G}: ${H.message}`,G,void 0,void 0,_.substring(0,100));if(u0.log(O,{filePath:G,scriptContent:_}),Y.debug)throw O});let j=await x7.timeAsync("directive-processing",async()=>{return await Z0(B,z,G,Y,K)});if(U.length>0){let{interpolateScriptsInTemplate:H}=await Promise.resolve().then(() => (d0(),y7)),O=H(U.join(`
11611
11611
  `),z),F=j.search(/<\/body>/i);if(F!==-1)j=j.slice(0,F)+O+`
11612
11612
  `+j.slice(F);else j+=`
11613
- ${O}`}if(j=await c$(j),K.forEach((H)=>X.add(H)),Y.cache&&Y.cachePath){if(await H8(G,j,K,Y),Y.debug)console.log(`Cached template ${G} with ${K.size} dependencies`)}return{contents:j,loader:"html"}}catch(K){let W=K instanceof Error?K:new O1(`Plugin processing failed: ${String(K)}`,G);if(u0.log(W,{filePath:G,buildConfig:$.config}),y5.logDetailedError(W,{filePath:G,plugin:"bun-plugin-stx"}),Y.debug)console.error("stx Plugin Error:",W);let _=W,B=_.line||null,U=_.context||null;return{contents:Y.debug||_$()?`<!DOCTYPE html>
11613
+ ${O}`}if(j=await c$(j),K.forEach((H)=>X.add(H)),Y.cache&&Y.cachePath){if(await H8(G,j,K,Y),Y.debug)console.log(`Cached template ${G} with ${K.size} dependencies`)}return{contents:j,loader:"html"}}catch(K){let W=K instanceof Error?K:new O1(`Plugin processing failed: ${String(K)}`,G);if(u0.log(W,{filePath:G,buildConfig:$.config}),y5.logDetailedError(W,{filePath:G,plugin:"bun-plugin-stx"}),Y.debug)console.error("stx Plugin Error:",W);let _=W,B=_.line||null,U=_.context||null;return{contents:Y.debug||B$()?`<!DOCTYPE html>
11614
11614
  <html lang="en">
11615
11615
  <head>
11616
11616
  <meta charset="UTF-8">
@@ -11670,12 +11670,12 @@ ${O}`}if(j=await c$(j),K.forEach((H)=>X.add(H)),Y.cache&&Y.cachePath){if(await H
11670
11670
  <h1>Something went wrong</h1>
11671
11671
  <p>An internal error occurred. Please try again later.</p>
11672
11672
  </body>
11673
- </html>`,loader:"html"}}})}}});var{serve:eR}=globalThis.Bun;import V1 from"fs";import r0 from"path";async function hz($,Z={}){let Y=Z.port||3000,X=Z.watch!==!1,J=Z.hotReload!==!1&&X,Q=null,G=Z.hmrPort||Y+1,K=r0.resolve($);if(!V1.existsSync(K))return console.error(`${R.red}Error: File not found: ${R.bright}${K}${R.reset}`),!1;if(K.endsWith(".md"))return c8(K,Z);else if(!K.endsWith(".stx"))return console.error(`${R.red}Error: Unsupported file type: ${R.bright}${K}${R.reset}. Only .stx and .md files are supported.`),!1;let W=r0.join(process.cwd(),".stx/output");V1.mkdirSync(W,{recursive:!0}),console.log(`${R.blue}Building ${R.bright}${$}${R.reset}...`);let _=null,B=async()=>{try{let L={name:"public-assets",setup(w){w.onResolve({filter:/^\/(images|fonts|assets|public)\//},(M)=>{return{path:M.path,external:!0}})}},V=await Bun.build({entrypoints:[K],outdir:W,plugins:[L,W7],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...Z.stxOptions});if(!V.success)return console.error(`${R.red}Build failed:${R.reset}`,V.logs),!1;let A=V.outputs.find((w)=>w.path.endsWith(".html"));if(!A)return console.error(`${R.red}No HTML output found${R.reset}`),!1;return _=await Bun.file(A.path).text(),!0}catch(L){return console.error(`${R.red}Error building stx file:${R.reset}`,L),!1}};if(!await B())return!1;let z=r0.dirname(K);await h5(z);let q=Y;try{if(q=await E$(Y),q!==Y)console.log(`${R.yellow}Port ${Y} is busy, using port ${q} instead${R.reset}`)}catch{return console.error(`${R.red}Could not find an available port${R.reset}`),!1}if(J){let L=Z.hmrPort||q+1;Q=d4({wsPort:L,verbose:!1}),G=Q.start(L)}let j={},H=null;try{let{loadStxConfig:L}=await Promise.resolve().then(() => (T$(),r$)),V=await L();if(V?.apiRouter)H=V?.apiRouter,console.log(`${R.blue}Using custom router for API handling${R.reset}`);if(V?.apiRoutes){j=V.apiRoutes;let A=Object.keys(j).length;if(A>0)console.log(`${R.blue}Loaded ${R.bright}${A} API route${A>1?"s":""}${R.reset}`)}if(V?.broadcasting?.enabled)try{let{startBroadcasting:A,loadChannels:N}=await Promise.resolve().then(() => (g8(),CJ)),w=V.broadcasting;await A(w);let M=w.port??6001;console.log(`${R.magenta}Broadcasting on ${R.cyan}ws://localhost:${M}/ws${R.reset}`);let T=r0.join(process.cwd(),"channels.ts");if(V1.existsSync(T))try{let I=await N(T);console.log(`${R.blue}Loaded ${R.bright}${I} broadcast channel${I!==1?"s":""}${R.blue} from channels.ts${R.reset}`)}catch(I){console.warn(`${R.yellow}Failed to load channels.ts: ${I.message}${R.reset}`)}}catch(A){console.warn(`${R.yellow}Broadcasting failed to start: ${A.message}${R.reset}`)}}catch{}if(console.log(`${R.blue}Starting server on ${R.cyan}http://localhost:${q}/${R.reset}...`),J)console.log(`${R.magenta}Hot reload enabled on ws://localhost:${G}${R.reset}`);let O=eR({port:q,async fetch(L){let V=new URL(L.url);if(H)try{let T=await H.handleRequest(L);if(T.status!==404)return T}catch{}if(j[V.pathname])try{return await j[V.pathname](L)}catch(T){return new Response(JSON.stringify({error:T.message}),{status:500,headers:{"Content-Type":"application/json"}})}if(V.pathname==="/")return(async()=>{let I=await V0(_||"");if(J)I=y1(I,G);if(Z.native)if(I.includes("<head>"))I=I.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else if(I.includes("<html"))I=I.replace(/(<html[^>]*>)/,"$1<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>");else I="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+I;return I})().then((I)=>new Response(I,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}}));let A=r0.join(W,V.pathname);if(V1.existsSync(A)&&V1.statSync(A).isFile()){let T=Bun.file(A),I=r0.extname(A).toLowerCase(),E="text/plain";if(I===".ts"||I===".tsx"){let S=new Bun.Transpiler({loader:I===".tsx"?"tsx":"ts"}),k=await T.text(),b=S.transformSync(k);return new Response(b,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(I){case".html":E="text/html";break;case".css":E="text/css";break;case".js":E="text/javascript";break;case".json":E="application/json";break;case".png":E="image/png";break;case".jpg":case".jpeg":E="image/jpeg";break;case".gif":E="image/gif";break;case".woff":E="font/woff";break;case".woff2":E="font/woff2";break;case".ttf":E="font/ttf";break;case".otf":E="font/otf";break;case".eot":E="application/vnd.ms-fontobject";break}return new Response(T,{headers:{"Content-Type":E}})}let N=r0.dirname(K),w=r0.join(N,V.pathname);if(V1.existsSync(w)&&V1.statSync(w).isFile()){let T=Bun.file(w),I=r0.extname(w).toLowerCase(),E="text/plain";if(I===".ts"||I===".tsx"){let S=new Bun.Transpiler({loader:I===".tsx"?"tsx":"ts"}),k=await T.text(),b=S.transformSync(k);return new Response(b,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(I){case".html":E="text/html";break;case".css":E="text/css";break;case".js":E="text/javascript";break;case".json":E="application/json";break;case".png":E="image/png";break;case".jpg":case".jpeg":E="image/jpeg";break;case".gif":E="image/gif";break;case".svg":E="image/svg+xml";break;case".ico":E="image/x-icon";break;case".woff":E="font/woff";break;case".woff2":E="font/woff2";break;case".ttf":E="font/ttf";break;case".otf":E="font/otf";break;case".eot":E="application/vnd.ms-fontobject";break}return new Response(T,{headers:{"Content-Type":E}})}let M=r0.join(process.cwd(),"public",V.pathname);if(V1.existsSync(M)&&V1.statSync(M).isFile()){let T=Bun.file(M),I=r0.extname(M).toLowerCase(),E="application/octet-stream";if(I===".ts"||I===".tsx"){let S=new Bun.Transpiler({loader:I===".tsx"?"tsx":"ts"}),k=await T.text(),b=S.transformSync(k);return new Response(b,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(I){case".html":E="text/html";break;case".css":E="text/css";break;case".js":E="text/javascript";break;case".json":E="application/json";break;case".png":E="image/png";break;case".jpg":case".jpeg":E="image/jpeg";break;case".gif":E="image/gif";break;case".svg":E="image/svg+xml";break;case".ico":E="image/x-icon";break;case".woff":E="font/woff";break;case".woff2":E="font/woff2";break;case".ttf":E="font/ttf";break;case".otf":E="font/otf";break;case".eot":E="application/vnd.ms-fontobject";break}return new Response(T,{headers:{"Content-Type":E}})}return new Response("Not Found",{status:404})},error(L){return new Response(`<pre>${L}
11673
+ </html>`,loader:"html"}}})}}});var{serve:eR}=globalThis.Bun;import V1 from"fs";import r0 from"path";async function hz($,Z={}){let Y=Z.port||3000,X=Z.watch!==!1,J=Z.hotReload!==!1&&X,Q=null,G=Z.hmrPort||Y+1,K=r0.resolve($);if(!V1.existsSync(K))return console.error(`${R.red}Error: File not found: ${R.bright}${K}${R.reset}`),!1;if(K.endsWith(".md"))return c8(K,Z);else if(!K.endsWith(".stx"))return console.error(`${R.red}Error: Unsupported file type: ${R.bright}${K}${R.reset}. Only .stx and .md files are supported.`),!1;let W=r0.join(process.cwd(),".stx/output");V1.mkdirSync(W,{recursive:!0}),console.log(`${R.blue}Building ${R.bright}${$}${R.reset}...`);let _=null,B=async()=>{try{let L={name:"public-assets",setup(w){w.onResolve({filter:/^\/(images|fonts|assets|public)\//},(M)=>{return{path:M.path,external:!0}})}},V=await Bun.build({entrypoints:[K],outdir:W,plugins:[L,W7],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...Z.stxOptions});if(!V.success)return console.error(`${R.red}Build failed:${R.reset}`,V.logs),!1;let A=V.outputs.find((w)=>w.path.endsWith(".html"));if(!A)return console.error(`${R.red}No HTML output found${R.reset}`),!1;return _=await Bun.file(A.path).text(),!0}catch(L){return console.error(`${R.red}Error building stx file:${R.reset}`,L),!1}};if(!await B())return!1;let z=r0.dirname(K);await h5(z);let q=Y;try{if(q=await I$(Y),q!==Y)console.log(`${R.yellow}Port ${Y} is busy, using port ${q} instead${R.reset}`)}catch{return console.error(`${R.red}Could not find an available port${R.reset}`),!1}if(J){let L=Z.hmrPort||q+1;Q=d4({wsPort:L,verbose:!1}),G=Q.start(L)}let j={},H=null;try{let{loadStxConfig:L}=await Promise.resolve().then(() => (E$(),r$)),V=await L();if(V?.apiRouter)H=V?.apiRouter,console.log(`${R.blue}Using custom router for API handling${R.reset}`);if(V?.apiRoutes){j=V.apiRoutes;let A=Object.keys(j).length;if(A>0)console.log(`${R.blue}Loaded ${R.bright}${A} API route${A>1?"s":""}${R.reset}`)}if(V?.broadcasting?.enabled)try{let{startBroadcasting:A,loadChannels:N}=await Promise.resolve().then(() => (g8(),b2)),w=V.broadcasting;await A(w);let M=w.port??6001;console.log(`${R.magenta}Broadcasting on ${R.cyan}ws://localhost:${M}/ws${R.reset}`);let T=r0.join(process.cwd(),"channels.ts");if(V1.existsSync(T))try{let I=await N(T);console.log(`${R.blue}Loaded ${R.bright}${I} broadcast channel${I!==1?"s":""}${R.blue} from channels.ts${R.reset}`)}catch(I){console.warn(`${R.yellow}Failed to load channels.ts: ${I.message}${R.reset}`)}}catch(A){console.warn(`${R.yellow}Broadcasting failed to start: ${A.message}${R.reset}`)}}catch{}if(console.log(`${R.blue}Starting server on ${R.cyan}http://localhost:${q}/${R.reset}...`),J)console.log(`${R.magenta}Hot reload enabled on ws://localhost:${G}${R.reset}`);let O=eR({port:q,async fetch(L){let V=new URL(L.url);if(H)try{let T=await H.handleRequest(L);if(T.status!==404)return T}catch{}if(j[V.pathname])try{return await j[V.pathname](L)}catch(T){return new Response(JSON.stringify({error:T.message}),{status:500,headers:{"Content-Type":"application/json"}})}if(V.pathname==="/")return(async()=>{let I=await V0(_||"");if(J)I=y1(I,G);if(Z.native)if(I.includes("<head>"))I=I.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else if(I.includes("<html"))I=I.replace(/(<html[^>]*>)/,"$1<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>");else I="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+I;return I})().then((I)=>new Response(I,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}}));let A=r0.join(W,V.pathname);if(V1.existsSync(A)&&V1.statSync(A).isFile()){let T=Bun.file(A),I=r0.extname(A).toLowerCase(),E="text/plain";if(I===".ts"||I===".tsx"){let S=new Bun.Transpiler({loader:I===".tsx"?"tsx":"ts"}),k=await T.text(),b=S.transformSync(k);return new Response(b,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(I){case".html":E="text/html";break;case".css":E="text/css";break;case".js":E="text/javascript";break;case".json":E="application/json";break;case".png":E="image/png";break;case".jpg":case".jpeg":E="image/jpeg";break;case".gif":E="image/gif";break;case".woff":E="font/woff";break;case".woff2":E="font/woff2";break;case".ttf":E="font/ttf";break;case".otf":E="font/otf";break;case".eot":E="application/vnd.ms-fontobject";break}return new Response(T,{headers:{"Content-Type":E}})}let N=r0.dirname(K),w=r0.join(N,V.pathname);if(V1.existsSync(w)&&V1.statSync(w).isFile()){let T=Bun.file(w),I=r0.extname(w).toLowerCase(),E="text/plain";if(I===".ts"||I===".tsx"){let S=new Bun.Transpiler({loader:I===".tsx"?"tsx":"ts"}),k=await T.text(),b=S.transformSync(k);return new Response(b,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(I){case".html":E="text/html";break;case".css":E="text/css";break;case".js":E="text/javascript";break;case".json":E="application/json";break;case".png":E="image/png";break;case".jpg":case".jpeg":E="image/jpeg";break;case".gif":E="image/gif";break;case".svg":E="image/svg+xml";break;case".ico":E="image/x-icon";break;case".woff":E="font/woff";break;case".woff2":E="font/woff2";break;case".ttf":E="font/ttf";break;case".otf":E="font/otf";break;case".eot":E="application/vnd.ms-fontobject";break}return new Response(T,{headers:{"Content-Type":E}})}let M=r0.join(process.cwd(),"public",V.pathname);if(V1.existsSync(M)&&V1.statSync(M).isFile()){let T=Bun.file(M),I=r0.extname(M).toLowerCase(),E="application/octet-stream";if(I===".ts"||I===".tsx"){let S=new Bun.Transpiler({loader:I===".tsx"?"tsx":"ts"}),k=await T.text(),b=S.transformSync(k);return new Response(b,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(I){case".html":E="text/html";break;case".css":E="text/css";break;case".js":E="text/javascript";break;case".json":E="application/json";break;case".png":E="image/png";break;case".jpg":case".jpeg":E="image/jpeg";break;case".gif":E="image/gif";break;case".svg":E="image/svg+xml";break;case".ico":E="image/x-icon";break;case".woff":E="font/woff";break;case".woff2":E="font/woff2";break;case".ttf":E="font/ttf";break;case".otf":E="font/otf";break;case".eot":E="application/vnd.ms-fontobject";break}return new Response(T,{headers:{"Content-Type":E}})}return new Response("Not Found",{status:404})},error(L){return new Response(`<pre>${L}
11674
11674
  ${L.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});console.clear(),console.log(`
11675
11675
  ${R.blue}stx${R.reset} ${R.green}${process.env.stx_VERSION||"v0.0.10"}${R.reset} ${R.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${R.reset}`),console.log(`
11676
11676
  ${R.bright}\u2192 ${R.cyan}http://localhost:${q}/${R.reset}`),console.log(`
11677
11677
  ${R.yellow}Routes:${R.reset}`);let F=r0.relative(process.cwd(),K);if(console.log(` ${R.green}\u2514\u2500 /${R.reset} \u2192 ${R.bright}${F}${R.reset}`),console.log(`
11678
- Press ${R.cyan}h${R.reset} + ${R.cyan}Enter${R.reset} to show shortcuts`),I$(O.url.toString(),()=>{if(X)V1.watch(r0.dirname(K),{recursive:!0}).close();O.stop()}),Z.native){let L=await Bun.file(K).text(),V=p8(L);await J7(q,{title:r0.basename(K,".stx"),nativeSidebar:!!V,sidebarConfig:V})}if(X){let L=r0.dirname(K);console.log(`${R.blue}Watching ${R.bright}${L}${R.reset} for changes...`);let V=V1.watch(L,{recursive:!0},async(A,N)=>{if(!N||h4(N))return;if(g4(N)){console.log(`${R.yellow}File ${R.bright}${N}${R.yellow} changed, rebuilding...${R.reset}`),V$.clear(),M$();let w=await B();if(await Y4(z),J&&Q)if(w)Q.reload(N);else Q.error("Build failed - check console for details")}else if(f4(N)){if(console.log(`${R.cyan}CSS ${R.bright}${N}${R.cyan} changed${R.reset}`),J&&Q)Q.updateCss(N)}});process.on("SIGINT",()=>{if(V.close(),Q)K7();O.stop(),process.exit(0)})}return!0}var dz=D(()=>{c5();l8();q0();v4();xJ()});var fJ=`
11678
+ Press ${R.cyan}h${R.reset} + ${R.cyan}Enter${R.reset} to show shortcuts`),D$(O.url.toString(),()=>{if(X)V1.watch(r0.dirname(K),{recursive:!0}).close();O.stop()}),Z.native){let L=await Bun.file(K).text(),V=p8(L);await J7(q,{title:r0.basename(K,".stx"),nativeSidebar:!!V,sidebarConfig:V})}if(X){let L=r0.dirname(K);console.log(`${R.blue}Watching ${R.bright}${L}${R.reset} for changes...`);let V=V1.watch(L,{recursive:!0},async(A,N)=>{if(!N||h4(N))return;if(g4(N)){console.log(`${R.yellow}File ${R.bright}${N}${R.yellow} changed, rebuilding...${R.reset}`),N$.clear(),T$();let w=await B();if(await Y4(z),J&&Q)if(w)Q.reload(N);else Q.error("Build failed - check console for details")}else if(f4(N)){if(console.log(`${R.cyan}CSS ${R.bright}${N}${R.cyan} changed${R.reset}`),J&&Q)Q.updateCss(N)}});process.on("SIGINT",()=>{if(V.close(),Q)K7();O.stop(),process.exit(0)})}return!0}var dz=D(()=>{c5();l8();q0();v4();P2()});var v2=`
11679
11679
  <script data-stx-helpers>
11680
11680
  (function() {
11681
11681
  'use strict'
@@ -11986,7 +11986,7 @@ else {
11986
11986
 
11987
11987
  })()
11988
11988
  </script>
11989
- `;var{serve:$M}=globalThis.Bun;import D$ from"fs";import c0 from"path";function gJ($){if($.length===0)return"";if($.length===1)return $[0];let Z=$.map((X)=>X.split(c0.sep)),Y=[];for(let X=0;X<Z[0].length;X++){let J=Z[0][X];if(Z.every((Q)=>Q[X]===J))Y.push(J);else break}return Y.join(c0.sep)}async function uz($,Z={}){let Y=Z.port||3000,X=Z.watch!==!1;for(let j of $){let H=c0.resolve(j);if(!D$.existsSync(H))return console.error(`${R.red}Error: File not found: ${R.bright}${H}${R.reset}`),!1;if(!H.endsWith(".stx")&&!H.endsWith(".md"))return console.error(`${R.red}Error: Unsupported file type: ${R.bright}${H}${R.reset}. Only .stx and .md files are supported.`),!1}let J=c0.join(process.cwd(),".stx/output");D$.mkdirSync(J,{recursive:!0});let Q=gJ($.map((j)=>c0.dirname(c0.resolve(j))));console.log(`${R.blue}Processing ${R.bright}${$.length}${R.reset} files...`);let G={},K=[],W=async()=>{try{for(let j of $){let H=c0.resolve(j);if(H.endsWith(".md"))try{let{content:F,data:L}=await p1(H,{markdown:{syntaxHighlighting:{serverSide:!0,enabled:!0,defaultTheme:t0.markdown?.syntaxHighlighting?.defaultTheme||"github-dark",highlightUnknownLanguages:!0}}}),V=Z.markdown?.syntaxHighlighting||t0.markdown?.syntaxHighlighting,A=V?.defaultTheme||"github-dark",N=["github-dark"],w=V?.additionalThemes||[],T=[...new Set([...N,...w])].map((k)=>`<option value="${k}"${k===A?" selected":""}>${k}</option>`).join(`
11989
+ `;var{serve:$M}=globalThis.Bun;import k$ from"fs";import c0 from"path";function f2($){if($.length===0)return"";if($.length===1)return $[0];let Z=$.map((X)=>X.split(c0.sep)),Y=[];for(let X=0;X<Z[0].length;X++){let J=Z[0][X];if(Z.every((Q)=>Q[X]===J))Y.push(J);else break}return Y.join(c0.sep)}async function uz($,Z={}){let Y=Z.port||3000,X=Z.watch!==!1;for(let j of $){let H=c0.resolve(j);if(!k$.existsSync(H))return console.error(`${R.red}Error: File not found: ${R.bright}${H}${R.reset}`),!1;if(!H.endsWith(".stx")&&!H.endsWith(".md"))return console.error(`${R.red}Error: Unsupported file type: ${R.bright}${H}${R.reset}. Only .stx and .md files are supported.`),!1}let J=c0.join(process.cwd(),".stx/output");k$.mkdirSync(J,{recursive:!0});let Q=f2($.map((j)=>c0.dirname(c0.resolve(j))));console.log(`${R.blue}Processing ${R.bright}${$.length}${R.reset} files...`);let G={},K=[],W=async()=>{try{for(let j of $){let H=c0.resolve(j);if(H.endsWith(".md"))try{let{content:F,data:L}=await p1(H,{markdown:{syntaxHighlighting:{serverSide:!0,enabled:!0,defaultTheme:t0.markdown?.syntaxHighlighting?.defaultTheme||"github-dark",highlightUnknownLanguages:!0}}}),V=Z.markdown?.syntaxHighlighting||t0.markdown?.syntaxHighlighting,A=V?.defaultTheme||"github-dark",N=["github-dark"],w=V?.additionalThemes||[],T=[...new Set([...N,...w])].map((k)=>`<option value="${k}"${k===A?" selected":""}>${k}</option>`).join(`
11990
11990
  `),I=`
11991
11991
  <!DOCTYPE html>
11992
11992
  <html lang="en">
@@ -12149,24 +12149,24 @@ else {
12149
12149
  </script>
12150
12150
  </body>
12151
12151
  </html>
12152
- `,S=`/${c0.relative(Q,H).replace(/\.md$/,"")}`;if(S.endsWith("/index"))S=S.slice(0,-6)||"/";G[S||"/"]={filePath:H,content:I,fileType:"md"}}catch(F){console.error(`${R.red}Error processing Markdown file ${R.bright}${j}${R.reset}:`,F);continue}else{let F={name:"public-assets",setup(M){M.onResolve({filter:/^\/(images|fonts|assets|public)\//},(T)=>{return{path:T.path,external:!0}})}},L=await Bun.build({entrypoints:[H],outdir:J,plugins:[F,W7],define:{"process.env.NODE_ENV":'"development"'},...Z.stxOptions});if(!L.success){console.error(`${R.red}Build failed for ${R.bright}${j}${R.reset}:`,L.logs);continue}let V=L.outputs.find((M)=>M.path.endsWith(".html"));if(!V){console.error(`${R.red}No HTML output found for ${R.bright}${j}${R.reset}`);continue}let A=await Bun.file(V.path).text(),w=`/${c0.relative(Q,H).replace(/\.stx$/,"")}`;if(w.endsWith("/index"))w=w.slice(0,-6)||"/";if(w.includes("[")){let M=[...w.matchAll(/\[([^\]]+)\]/g)].map((I)=>I[1]),T=w.replace(/\[([^\]]+)\]/g,"([^/]+)");K.push({pattern:new RegExp(`^${T}$`),paramNames:M,filePath:H,routeTemplate:w,fileType:"stx"}),G[w]={filePath:H,content:A,fileType:"stx"}}else G[w||"/"]={filePath:H,content:A,fileType:"stx"}}}if(Object.keys(G).length===0)return console.error(`${R.red}No files were successfully processed${R.reset}`),!1;return!0}catch(j){return console.error(`${R.red}Error processing files:${R.reset}`,j),!1}};if(!await W())return!1;let B=Y;try{if(B=await E$(Y),B!==Y)console.log(`${R.yellow}Port ${Y} is busy, using port ${B} instead${R.reset}`)}catch{return console.error(`${R.red}Could not find an available port${R.reset}`),!1}console.log(`${R.blue}Starting server on ${R.cyan}http://localhost:${B}/${R.reset}...`);let U=$M({port:B,async fetch(j){let H=new URL(j.url),O=c0.join(process.cwd(),"public",H.pathname);if(D$.existsSync(O)&&D$.statSync(O).isFile()){let V=Bun.file(O),A=c0.extname(O).toLowerCase(),N="application/octet-stream";if(A===".ts"||A===".tsx"){let w=new Bun.Transpiler({loader:A===".tsx"?"tsx":"ts"}),M=await V.text(),T=w.transformSync(M);return new Response(T,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(A){case".html":N="text/html";break;case".css":N="text/css";break;case".js":N="text/javascript";break;case".json":N="application/json";break;case".png":N="image/png";break;case".jpg":case".jpeg":N="image/jpeg";break;case".gif":N="image/gif";break;case".svg":N="image/svg+xml";break;case".ico":N="image/x-icon";break;case".woff":N="font/woff";break;case".woff2":N="font/woff2";break;case".ttf":N="font/ttf";break;case".otf":N="font/otf";break;case".eot":N="application/vnd.ms-fontobject";break}return new Response(V,{headers:{"Content-Type":N}})}let F=G[H.pathname];if(!F&&!H.pathname.endsWith("/"))F=G[`${H.pathname}/`];if(!F)for(let V of K){let A=H.pathname.match(V.pattern);if(A){let N=G[V.routeTemplate];if(N){let w={};for(let I=0;I<V.paramNames.length;I++)w[V.paramNames[I]]=decodeURIComponent(A[I+1]);let M=N.content,T=`<script>window.__routeParams = ${JSON.stringify(w)};</script>`;if(M.includes("</head>"))M=M.replace("</head>",`${T}
12153
- </head>`);else M=T+M;F={...N,content:M}}break}}if(F)return V0(F.content).then((V)=>{if(V.includes("</head>"))V=V.replace("</head>",`${fJ}
12154
- </head>`);return new Response(V,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})});let L=c0.join(J,H.pathname);if(D$.existsSync(L)&&D$.statSync(L).isFile()){let V=Bun.file(L),A=c0.extname(L).toLowerCase(),N="text/plain";if(A===".ts"||A===".tsx"){let w=new Bun.Transpiler({loader:A===".tsx"?"tsx":"ts"}),M=await V.text(),T=w.transformSync(M);return new Response(T,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(A){case".html":N="text/html";break;case".css":N="text/css";break;case".js":N="text/javascript";break;case".json":N="application/json";break;case".png":N="image/png";break;case".jpg":case".jpeg":N="image/jpeg";break;case".gif":N="image/gif";break;case".svg":N="image/svg+xml";break;case".ico":N="image/x-icon";break;case".woff":N="font/woff";break;case".woff2":N="font/woff2";break;case".ttf":N="font/ttf";break;case".otf":N="font/otf";break;case".eot":N="application/vnd.ms-fontobject";break}return new Response(V,{headers:{"Content-Type":N}})}if(H.pathname!=="/"&&G["/"]){let V=j.headers.get("X-STX-Router")==="true";return V0(G["/"].content).then((A)=>{if(V){let N=A.match(/<main[^>]*>([\s\S]*?)<\/main>/i);if(N){let w=A.match(/<title[^>]*>([\s\S]*?)<\/title>/i),T=`<!DOCTYPE html><html><head><title>${w?w[1]:""}</title></head><body><main>${N[1]}</main></body></html>`;return new Response(T,{headers:{"Content-Type":"text/html","X-STX-Partial":"true","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}return new Response(A,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})})}return new Response("Not Found",{status:404})},error(j){return new Response(`<pre>${j}
12152
+ `,S=`/${c0.relative(Q,H).replace(/\.md$/,"")}`;if(S.endsWith("/index"))S=S.slice(0,-6)||"/";G[S||"/"]={filePath:H,content:I,fileType:"md"}}catch(F){console.error(`${R.red}Error processing Markdown file ${R.bright}${j}${R.reset}:`,F);continue}else{let F={name:"public-assets",setup(M){M.onResolve({filter:/^\/(images|fonts|assets|public)\//},(T)=>{return{path:T.path,external:!0}})}},L=await Bun.build({entrypoints:[H],outdir:J,plugins:[F,W7],define:{"process.env.NODE_ENV":'"development"'},...Z.stxOptions});if(!L.success){console.error(`${R.red}Build failed for ${R.bright}${j}${R.reset}:`,L.logs);continue}let V=L.outputs.find((M)=>M.path.endsWith(".html"));if(!V){console.error(`${R.red}No HTML output found for ${R.bright}${j}${R.reset}`);continue}let A=await Bun.file(V.path).text(),w=`/${c0.relative(Q,H).replace(/\.stx$/,"")}`;if(w.endsWith("/index"))w=w.slice(0,-6)||"/";if(w.includes("[")){let M=[...w.matchAll(/\[([^\]]+)\]/g)].map((I)=>I[1]),T=w.replace(/\[([^\]]+)\]/g,"([^/]+)");K.push({pattern:new RegExp(`^${T}$`),paramNames:M,filePath:H,routeTemplate:w,fileType:"stx"}),G[w]={filePath:H,content:A,fileType:"stx"}}else G[w||"/"]={filePath:H,content:A,fileType:"stx"}}}if(Object.keys(G).length===0)return console.error(`${R.red}No files were successfully processed${R.reset}`),!1;return!0}catch(j){return console.error(`${R.red}Error processing files:${R.reset}`,j),!1}};if(!await W())return!1;let B=Y;try{if(B=await I$(Y),B!==Y)console.log(`${R.yellow}Port ${Y} is busy, using port ${B} instead${R.reset}`)}catch{return console.error(`${R.red}Could not find an available port${R.reset}`),!1}console.log(`${R.blue}Starting server on ${R.cyan}http://localhost:${B}/${R.reset}...`);let U=$M({port:B,async fetch(j){let H=new URL(j.url),O=c0.join(process.cwd(),"public",H.pathname);if(k$.existsSync(O)&&k$.statSync(O).isFile()){let V=Bun.file(O),A=c0.extname(O).toLowerCase(),N="application/octet-stream";if(A===".ts"||A===".tsx"){let w=new Bun.Transpiler({loader:A===".tsx"?"tsx":"ts"}),M=await V.text(),T=w.transformSync(M);return new Response(T,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(A){case".html":N="text/html";break;case".css":N="text/css";break;case".js":N="text/javascript";break;case".json":N="application/json";break;case".png":N="image/png";break;case".jpg":case".jpeg":N="image/jpeg";break;case".gif":N="image/gif";break;case".svg":N="image/svg+xml";break;case".ico":N="image/x-icon";break;case".woff":N="font/woff";break;case".woff2":N="font/woff2";break;case".ttf":N="font/ttf";break;case".otf":N="font/otf";break;case".eot":N="application/vnd.ms-fontobject";break}return new Response(V,{headers:{"Content-Type":N}})}let F=G[H.pathname];if(!F&&!H.pathname.endsWith("/"))F=G[`${H.pathname}/`];if(!F)for(let V of K){let A=H.pathname.match(V.pattern);if(A){let N=G[V.routeTemplate];if(N){let w={};for(let I=0;I<V.paramNames.length;I++)w[V.paramNames[I]]=decodeURIComponent(A[I+1]);let M=N.content,T=`<script>window.__routeParams = ${JSON.stringify(w)};</script>`;if(M.includes("</head>"))M=M.replace("</head>",`${T}
12153
+ </head>`);else M=T+M;F={...N,content:M}}break}}if(F)return V0(F.content).then((V)=>{if(V.includes("</head>"))V=V.replace("</head>",`${v2}
12154
+ </head>`);return new Response(V,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})});let L=c0.join(J,H.pathname);if(k$.existsSync(L)&&k$.statSync(L).isFile()){let V=Bun.file(L),A=c0.extname(L).toLowerCase(),N="text/plain";if(A===".ts"||A===".tsx"){let w=new Bun.Transpiler({loader:A===".tsx"?"tsx":"ts"}),M=await V.text(),T=w.transformSync(M);return new Response(T,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(A){case".html":N="text/html";break;case".css":N="text/css";break;case".js":N="text/javascript";break;case".json":N="application/json";break;case".png":N="image/png";break;case".jpg":case".jpeg":N="image/jpeg";break;case".gif":N="image/gif";break;case".svg":N="image/svg+xml";break;case".ico":N="image/x-icon";break;case".woff":N="font/woff";break;case".woff2":N="font/woff2";break;case".ttf":N="font/ttf";break;case".otf":N="font/otf";break;case".eot":N="application/vnd.ms-fontobject";break}return new Response(V,{headers:{"Content-Type":N}})}if(H.pathname!=="/"&&G["/"]){let V=j.headers.get("X-STX-Router")==="true";return V0(G["/"].content).then((A)=>{if(V){let N=A.match(/<main[^>]*>([\s\S]*?)<\/main>/i);if(N){let w=A.match(/<title[^>]*>([\s\S]*?)<\/title>/i),T=`<!DOCTYPE html><html><head><title>${w?w[1]:""}</title></head><body><main>${N[1]}</main></body></html>`;return new Response(T,{headers:{"Content-Type":"text/html","X-STX-Partial":"true","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}return new Response(A,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})})}return new Response("Not Found",{status:404})},error(j){return new Response(`<pre>${j}
12155
12155
  ${j.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});console.clear(),console.log(`
12156
12156
  ${R.blue}stx${R.reset} ${R.green}${process.env.stx_VERSION||"v0.0.10"}${R.reset} ${R.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${R.reset}`),console.log(`
12157
12157
  ${R.bright}\u2192 ${R.cyan}http://localhost:${B}/${R.reset}`),console.log(`
12158
12158
  ${R.yellow}Routes:${R.reset}`);let z=new Set(K.map((j)=>j.routeTemplate)),q=Object.entries(G).filter(([j])=>!z.has(j)).sort(([j],[H])=>j.localeCompare(H)).map(([j,H])=>({route:j==="/"?"/":j,filePath:c0.relative(process.cwd(),H.filePath),fileType:H.fileType}));for(let j of K){let H=j.routeTemplate.replace(/\[([^\]]+)\]/g,":$1");q.push({route:H,filePath:c0.relative(process.cwd(),j.filePath),fileType:"stx"})}if(q.sort((j,H)=>j.route.localeCompare(H.route)),q.forEach((j,H)=>{let F=H===q.length-1?"\u2514\u2500 ":"\u251C\u2500 ",L=j.fileType==="md"?`${R.magenta}(markdown)${R.reset}`:"";console.log(` ${R.green}${F}${j.route}${R.reset} \u2192 ${R.bright}${j.filePath}${R.reset} ${L}`)}),console.log(`
12159
- Press ${R.cyan}h${R.reset} + ${R.cyan}Enter${R.reset} to show shortcuts`),I$(U.url.toString(),()=>{if(X)D$.watch(Q,{recursive:!0}).close();U.stop()}),X){console.log(`${R.blue}Watching for changes...${R.reset}`);let j=D$.watch(Q,{recursive:!0},async(H,O)=>{if(!O)return;if(O.endsWith(".stx")||O.endsWith(".js")||O.endsWith(".ts")||O.endsWith(".md"))console.log(`${R.yellow}File ${R.bright}${O}${R.yellow} changed, rebuilding...${R.reset}`),V$.clear(),M$(),await W()});process.on("SIGINT",()=>{j.close(),U.stop(),process.exit(0)})}return!0}var mz=D(()=>{d5();m0();c5();l8();q0();v4()});var{serve:ZM}=globalThis.Bun;import s1 from"fs";import A0 from"path";function hJ($){let Z=Bun.file($),Y=A0.extname($).toLowerCase(),X={".html":"text/html",".css":"text/css",".js":"text/javascript",".json":"application/json",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".ico":"image/x-icon",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"},Q=[".js",".css",".json"].includes(Y)?{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}:{};return new Response(Z,{headers:{"Content-Type":X[Y]||"application/octet-stream",...Q}})}async function pz($=".",Z={}){let Y=Z.port||3000,X=Z.watch!==!1,J=Z.hotReload!==!1&&X,Q=null,G=Z.hmrPort||Y+1,K=A0.resolve($),{loadStxConfig:W}=await Promise.resolve().then(() => (T$(),r$)),_=await W(K),B=_.root&&_.root!=="."?A0.join(K,_.root):K,U=_.pagesDir||"pages",z=A0.join(B,U);if(!s1.existsSync(z))return console.error(`${R.red}Error: No '${U}' directory found in ${R.bright}${B}${R.reset}`),console.log(`${R.dim}Create a ${U}/ directory with .stx files to define your routes.${R.reset}`),console.log(`${R.dim}Example: ${U}/index.stx for the homepage.${R.reset}`),!1;let q=n1(B);if(q.length===0)return console.error(`${R.red}Error: No page files found in ${R.bright}${z}${R.reset}`),!1;console.log(`${R.blue}Found ${R.bright}${q.length}${R.blue} routes${R.reset}`);let j=_?._pluginPageDirs||[],H=[];for(let{dir:f,prefix:g}of j)if(s1.existsSync(f)){let h=n1(A0.dirname(f),{pagesDir:A0.basename(f)});for(let l of h){let i=g==="/"?l.pattern:`${g}${l.pattern==="/"?"":l.pattern}`;H.push({route:{...l,pattern:i},prefix:g})}if(h.length>0)console.log(`${R.blue}Plugin pages: ${R.bright}${h.length}${R.blue} routes at ${R.cyan}${g}${R.reset}`)}let O=new Map,F=null,L=null;if(Z.stxOptions?.shell!==!1){if(L=jJ(K,Z.stxOptions?.shell),L){if(F=await y8(L,Z.stxOptions||{}),F)console.log(`${R.blue}Using app shell: ${R.bright}${A0.relative(K,L)}${R.reset} ${R.dim}(deprecated: use layouts/default.stx instead)${R.reset}`)}}M4(),await D4(K);let V=I4();if(V.length>0)console.log(`${R.blue}Loaded ${R.bright}${V.length}${R.blue} middleware: ${R.dim}${V.join(", ")}${R.reset}`);let A={},N=null;try{let{loadStxConfig:f}=await Promise.resolve().then(() => (T$(),r$)),g=await f(K);if(g?.apiRouter)N=g?.apiRouter,console.log(`${R.blue}Using custom router for API handling${R.reset}`);if(g?.apiRoutes){A=g.apiRoutes;let h=Object.keys(A).length;if(h>0)console.log(`${R.blue}Loaded ${R.bright}${h} API route${h>1?"s":""}${R.reset}`)}if(g?.broadcasting?.enabled)try{let{startBroadcasting:h,loadChannels:l}=await Promise.resolve().then(() => (g8(),CJ)),i=g.broadcasting;await h(i);let Y0=i.port??6001;console.log(`${R.magenta}Broadcasting on ${R.cyan}ws://localhost:${Y0}/ws${R.reset}`);let W0=A0.join(process.cwd(),"channels.ts");if(s1.existsSync(W0))try{let D0=await l(W0);console.log(`${R.blue}Loaded ${R.bright}${D0} broadcast channel${D0!==1?"s":""}${R.blue} from channels.ts${R.reset}`)}catch(D0){console.warn(`${R.yellow}Failed to load channels.ts: ${D0.message}${R.reset}`)}}catch(h){console.warn(`${R.yellow}Broadcasting failed to start: ${h.message}${R.reset}`)}}catch{}let w=A0.join(K,".stx/output");s1.mkdirSync(w,{recursive:!0});let M=new Map,T=async(f)=>{let g=OJ(z,f);if(!g)return null;try{let h=await Bun.build({entrypoints:[g],outdir:w,plugins:[W7],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...Z.stxOptions});if(!h.success)return null;let l=h.outputs.find((i)=>i.path.endsWith(".html"));if(!l)return null;return await Bun.file(l.path).text()}catch{return null}},I=async(f,g)=>{try{let{processDirectives:h,extractVariables:l,defaultConfig:i,loadStxConfig:Y0,injectRouterScript:W0}=await Promise.resolve().then(() => (T$(),r$)),D0=await Y0(K),M0=await Bun.file(f.filePath).text(),{classifyAllScripts:v}=await Promise.resolve().then(() => (T$(),r$)),d=v(M0),n=d.server.map((z0)=>z0.content),p=M0;for(let z0 of d.server)p=p.replace(z0.fullTag,"");let u={__filename:f.filePath,__dirname:A0.dirname(f.filePath),params:g??{}},{resetHead:m}=await Promise.resolve().then(() => (O$(),f3));m();for(let z0 of n)try{await l(z0,u,f.filePath)}catch(l0){if(Z.stxOptions?.debug)console.error("[stx] variable extraction error",f.filePath,l0?.message||l0)}let a=new Set,r=(z0)=>{if(!z0)return z0;if(A0.isAbsolute(z0))return z0;return A0.resolve(K,z0)},s={...i,...D0,...Z.stxOptions,autoShell:!0};if(Z.debugDirectives)s.debug=!0;s.partialsDir=r(s.partialsDir),s.componentsDir=r(s.componentsDir),s.layoutsDir=r(s.layoutsDir),s.storesDir=r(s.storesDir||"stores");let J0;if(Z.profile){let z0=performance.now();J0=await h(p,u,f.filePath,s,a);let l0=performance.now()-z0,X5=A0.relative(K,f.filePath)||f.filePath;console.log(`[stx:profile] ${X5} \u2192 ${l0.toFixed(2)}ms`)}else J0=await h(p,u,f.filePath,s,a);if(!F)J0=await W0(J0);{let{interpolateScriptExpressions:z0}=await Promise.resolve().then(() => (d0(),y7));J0=J0.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/g,(l0,X5,J5)=>{if(!/function\s+__stx_setup_/.test(J5))return l0;return`<script${X5}>${z0(J5,u)}</script>`})}if(F)J0=s$(J0);return{route:f,content:J0}}catch(h){return console.error(`${R.red}Error building ${R.bright}${f.pattern}${R.reset}:`,h),null}},E=async()=>{M.clear(),O.clear();for(let f of q){let g=await I(f);if(g)M.set(f.pattern,g)}for(let{route:f}of H){let g=await I(f);if(g)O.set(f.pattern,g)}return M.size>0};if(console.log(`${R.blue}Building pages...${R.reset}`),!await E())return console.error(`${R.red}No pages were successfully built${R.reset}`),!1;await h5(K);let k=Y;try{if(k=await E$(Y),k!==Y)console.log(`${R.yellow}Port ${Y} is busy, using port ${k} instead${R.reset}`)}catch{return console.error(`${R.red}Could not find an available port${R.reset}`),!1}if(J){let f=Z.hmrPort||k+1;Q=d4({wsPort:f,verbose:!1}),G=Q.start(f)}let b=(f,g)=>{let h=`<script>(function(){var s=typeof stx!=='undefined'?stx:{};s._rp=${JSON.stringify(g)};if(s.setRouteParams)s.setRouteParams(s._rp);})()</script>`;if(f.includes("</head>"))return f.replace("</head>",`${h}</head>`);if(f.includes("<body"))return f.replace(/<body([^>]*)>/,`<body$1>${h}`);return h+f};console.log(`${R.blue}Starting server...${R.reset}`);let P=ZM({port:k,async fetch(f){let g=new URL(f.url),h=_?.publicDir||"public",l=A0.join(K,h,g.pathname),i=A0.join(K,g.pathname),Y0=A0.join(w,g.pathname),[W0,D0,M0]=await Promise.all([s1.promises.stat(l).catch(()=>null),s1.promises.stat(i).catch(()=>null),s1.promises.stat(Y0).catch(()=>null)]);if(W0?.isFile())return hJ(l);if(D0?.isFile())return hJ(i);if(M0?.isFile())return hJ(Y0);if(g.pathname.startsWith("/_stx/component/")){let p=decodeURIComponent(g.pathname.slice(16));if(p)try{let u=`<${p} />`,m={...buildConfig,autoShell:!1},a=await processDirectives(u,{},A0.join(K,"components",`${p}.stx`),m,new Set);return new Response(a,{headers:{"Content-Type":"text/html"}})}catch(u){return new Response(`<div class="stx-async-error">${u.message}</div>`,{status:500,headers:{"Content-Type":"text/html"}})}}if(N)try{let p=await N.handleRequest(f);if(p.status!==404)return p}catch{}if(A[g.pathname])try{return await A[g.pathname](f)}catch(p){return new Response(JSON.stringify({error:p.message}),{status:500,headers:{"Content-Type":"application/json"}})}let v=P8(g.pathname,q);if(v){let p=M.get(v.route.pattern);if(v.route.isDynamic&&Object.keys(v.params).length>0){let u=await I(v.route,v.params);if(u)p=u}if(p){let u=v3();if(u.validate){if(!await u.validate({params:v.params})){let r=await T(404);if(r){let s=r;if(s=await V0(s,K),J)s=y1(s,G);return new Response(s,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}}if(u.middleware){let a=E4(g.pathname,v.params,u,g.search),r=T4(a,null,f),s=await k4(u.middleware,r);if(s.redirect){let J0=s.redirect.path,z0=s.redirect.options.redirectCode||302,l0=new Headers(s.responseHeaders);return l0.set("Location",J0),new Response(null,{status:z0,headers:l0})}if(s.abort){let{statusCode:J0,message:z0}=s.abort.error;return new Response(`<!DOCTYPE html><html><head><title>Error ${J0}</title></head><body><h1>Error ${J0}</h1><p>${z0}</p></body></html>`,{status:J0,headers:{"Content-Type":"text/html"}})}if(Object.keys(s.state).length>0){let J0=`<script>(function(){var s=typeof stx!=='undefined'?stx:{};s._ms=${JSON.stringify(s.state)};if(s.setMiddlewareState)s.setMiddlewareState(s._ms);})()</script>`;p.content=p.content.replace("</head>",`${J0}</head>`)}}let m=p.content;if(F&&HJ(f)){if(Object.keys(v.params).length>0)m=b(m,v.params);m=await V0(m,K);let a=_?.router?.container||"main";return m=C4(m,a),new Response(m,{headers:{"Content-Type":"text/html","X-STX-Fragment":"true","Cache-Control":"no-store, no-cache, must-revalidate"}})}if(F)m=b4(F,m);if(Object.keys(v.params).length>0)m=b(m,v.params);if(m=await V0(m,K),J)m=y1(m,G);if(Z.native)if(m.includes("<head>"))m=m.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else m="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+m;return new Response(m,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}if(H.length>0){let p=H.map((m)=>m.route),u=P8(g.pathname,p);if(u){let m=O.get(u.route.pattern);if(m){let a=m.content;if(F)a=b4(F,a);if(Object.keys(u.params).length>0)a=b(a,u.params);if(a=await V0(a,K),J)a=y1(a,G);return new Response(a,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}for(let{prefix:m}of j)if(m!=="/"&&g.pathname.startsWith(m)){let a=O.get(m)||O.get(m+"/");if(a){let r=a.content;if(F)r=b4(F,r);if(r=await V0(r,K),J)r=y1(r,G);return new Response(r,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}}let d=M.get("/");if(d){let p=d.content;if(p=await V0(p,K),J)p=y1(p,G);if(Z.native)if(p.includes("<head>"))p=p.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else p="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+p;return new Response(p,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}let n=await T(404);if(n){let p=n;if(p=await V0(p,K),J)p=y1(p,G);return new Response(p,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})},async error(f){let g=await T(500);if(g)return new Response(g,{status:500,headers:{"Content-Type":"text/html"}});return new Response(`<pre>${f}
12159
+ Press ${R.cyan}h${R.reset} + ${R.cyan}Enter${R.reset} to show shortcuts`),D$(U.url.toString(),()=>{if(X)k$.watch(Q,{recursive:!0}).close();U.stop()}),X){console.log(`${R.blue}Watching for changes...${R.reset}`);let j=k$.watch(Q,{recursive:!0},async(H,O)=>{if(!O)return;if(O.endsWith(".stx")||O.endsWith(".js")||O.endsWith(".ts")||O.endsWith(".md"))console.log(`${R.yellow}File ${R.bright}${O}${R.yellow} changed, rebuilding...${R.reset}`),N$.clear(),T$(),await W()});process.on("SIGINT",()=>{j.close(),U.stop(),process.exit(0)})}return!0}var mz=D(()=>{d5();m0();c5();l8();q0();v4()});var{serve:ZM}=globalThis.Bun;import s1 from"fs";import A0 from"path";function g2($){let Z=Bun.file($),Y=A0.extname($).toLowerCase(),X={".html":"text/html",".css":"text/css",".js":"text/javascript",".json":"application/json",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".ico":"image/x-icon",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"},Q=[".js",".css",".json"].includes(Y)?{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}:{};return new Response(Z,{headers:{"Content-Type":X[Y]||"application/octet-stream",...Q}})}async function pz($=".",Z={}){let Y=Z.port||3000,X=Z.watch!==!1,J=Z.hotReload!==!1&&X,Q=null,G=Z.hmrPort||Y+1,K=A0.resolve($),{loadStxConfig:W}=await Promise.resolve().then(() => (E$(),r$)),_=await W(K),B=_.root&&_.root!=="."?A0.join(K,_.root):K,U=_.pagesDir||"pages",z=A0.join(B,U);if(!s1.existsSync(z))return console.error(`${R.red}Error: No '${U}' directory found in ${R.bright}${B}${R.reset}`),console.log(`${R.dim}Create a ${U}/ directory with .stx files to define your routes.${R.reset}`),console.log(`${R.dim}Example: ${U}/index.stx for the homepage.${R.reset}`),!1;let q=n1(B);if(q.length===0)return console.error(`${R.red}Error: No page files found in ${R.bright}${z}${R.reset}`),!1;console.log(`${R.blue}Found ${R.bright}${q.length}${R.blue} routes${R.reset}`);let j=_?._pluginPageDirs||[],H=[];for(let{dir:f,prefix:g}of j)if(s1.existsSync(f)){let h=n1(A0.dirname(f),{pagesDir:A0.basename(f)});for(let l of h){let i=g==="/"?l.pattern:`${g}${l.pattern==="/"?"":l.pattern}`;H.push({route:{...l,pattern:i},prefix:g})}if(h.length>0)console.log(`${R.blue}Plugin pages: ${R.bright}${h.length}${R.blue} routes at ${R.cyan}${g}${R.reset}`)}let O=new Map,F=null,L=null;if(Z.stxOptions?.shell!==!1){if(L=q2(K,Z.stxOptions?.shell),L){if(F=await y8(L,Z.stxOptions||{}),F)console.log(`${R.blue}Using app shell: ${R.bright}${A0.relative(K,L)}${R.reset} ${R.dim}(deprecated: use layouts/default.stx instead)${R.reset}`)}}M4(),await D4(K);let V=I4();if(V.length>0)console.log(`${R.blue}Loaded ${R.bright}${V.length}${R.blue} middleware: ${R.dim}${V.join(", ")}${R.reset}`);let A={},N=null;try{let{loadStxConfig:f}=await Promise.resolve().then(() => (E$(),r$)),g=await f(K);if(g?.apiRouter)N=g?.apiRouter,console.log(`${R.blue}Using custom router for API handling${R.reset}`);if(g?.apiRoutes){A=g.apiRoutes;let h=Object.keys(A).length;if(h>0)console.log(`${R.blue}Loaded ${R.bright}${h} API route${h>1?"s":""}${R.reset}`)}if(g?.broadcasting?.enabled)try{let{startBroadcasting:h,loadChannels:l}=await Promise.resolve().then(() => (g8(),b2)),i=g.broadcasting;await h(i);let Y0=i.port??6001;console.log(`${R.magenta}Broadcasting on ${R.cyan}ws://localhost:${Y0}/ws${R.reset}`);let W0=A0.join(process.cwd(),"channels.ts");if(s1.existsSync(W0))try{let D0=await l(W0);console.log(`${R.blue}Loaded ${R.bright}${D0} broadcast channel${D0!==1?"s":""}${R.blue} from channels.ts${R.reset}`)}catch(D0){console.warn(`${R.yellow}Failed to load channels.ts: ${D0.message}${R.reset}`)}}catch(h){console.warn(`${R.yellow}Broadcasting failed to start: ${h.message}${R.reset}`)}}catch{}let w=A0.join(K,".stx/output");s1.mkdirSync(w,{recursive:!0});let M=new Map,T=async(f)=>{let g=H2(z,f);if(!g)return null;try{let h=await Bun.build({entrypoints:[g],outdir:w,plugins:[W7],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...Z.stxOptions});if(!h.success)return null;let l=h.outputs.find((i)=>i.path.endsWith(".html"));if(!l)return null;return await Bun.file(l.path).text()}catch{return null}},I=async(f,g)=>{try{let{processDirectives:h,extractVariables:l,defaultConfig:i,loadStxConfig:Y0,injectRouterScript:W0}=await Promise.resolve().then(() => (E$(),r$)),D0=await Y0(K),M0=await Bun.file(f.filePath).text(),{classifyAllScripts:v}=await Promise.resolve().then(() => (E$(),r$)),d=v(M0),n=d.server.map((z0)=>z0.content),p=M0;for(let z0 of d.server)p=p.replace(z0.fullTag,"");let u={__filename:f.filePath,__dirname:A0.dirname(f.filePath),params:g??{}},{resetHead:m}=await Promise.resolve().then(() => (L$(),f3));m();for(let z0 of n)try{await l(z0,u,f.filePath)}catch(l0){if(Z.stxOptions?.debug)console.error("[stx] variable extraction error",f.filePath,l0?.message||l0)}let a=new Set,r=(z0)=>{if(!z0)return z0;if(A0.isAbsolute(z0))return z0;return A0.resolve(K,z0)},s={...i,...D0,...Z.stxOptions,autoShell:!0};if(Z.debugDirectives)s.debug=!0;s.partialsDir=r(s.partialsDir),s.componentsDir=r(s.componentsDir),s.layoutsDir=r(s.layoutsDir),s.storesDir=r(s.storesDir||"stores");let J0;if(Z.profile){let z0=performance.now();J0=await h(p,u,f.filePath,s,a);let l0=performance.now()-z0,X5=A0.relative(K,f.filePath)||f.filePath;console.log(`[stx:profile] ${X5} \u2192 ${l0.toFixed(2)}ms`)}else J0=await h(p,u,f.filePath,s,a);if(!F)J0=await W0(J0);{let{interpolateScriptExpressions:z0}=await Promise.resolve().then(() => (d0(),y7));J0=J0.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/g,(l0,X5,J5)=>{if(!/function\s+__stx_setup_/.test(J5))return l0;return`<script${X5}>${z0(J5,u)}</script>`})}if(F)J0=s$(J0);return{route:f,content:J0}}catch(h){return console.error(`${R.red}Error building ${R.bright}${f.pattern}${R.reset}:`,h),null}},E=async()=>{M.clear(),O.clear();for(let f of q){let g=await I(f);if(g)M.set(f.pattern,g)}for(let{route:f}of H){let g=await I(f);if(g)O.set(f.pattern,g)}return M.size>0};if(console.log(`${R.blue}Building pages...${R.reset}`),!await E())return console.error(`${R.red}No pages were successfully built${R.reset}`),!1;await h5(K);let k=Y;try{if(k=await I$(Y),k!==Y)console.log(`${R.yellow}Port ${Y} is busy, using port ${k} instead${R.reset}`)}catch{return console.error(`${R.red}Could not find an available port${R.reset}`),!1}if(J){let f=Z.hmrPort||k+1;Q=d4({wsPort:f,verbose:!1}),G=Q.start(f)}let b=(f,g)=>{let h=`<script>(function(){var s=typeof stx!=='undefined'?stx:{};s._rp=${JSON.stringify(g)};if(s.setRouteParams)s.setRouteParams(s._rp);})()</script>`;if(f.includes("</head>"))return f.replace("</head>",`${h}</head>`);if(f.includes("<body"))return f.replace(/<body([^>]*)>/,`<body$1>${h}`);return h+f};console.log(`${R.blue}Starting server...${R.reset}`);let P=ZM({port:k,async fetch(f){let g=new URL(f.url),h=_?.publicDir||"public",l=A0.join(K,h,g.pathname),i=A0.join(K,g.pathname),Y0=A0.join(w,g.pathname),[W0,D0,M0]=await Promise.all([s1.promises.stat(l).catch(()=>null),s1.promises.stat(i).catch(()=>null),s1.promises.stat(Y0).catch(()=>null)]);if(W0?.isFile())return g2(l);if(D0?.isFile())return g2(i);if(M0?.isFile())return g2(Y0);if(g.pathname.startsWith("/_stx/component/")){let p=decodeURIComponent(g.pathname.slice(16));if(p)try{let u=`<${p} />`,m={...buildConfig,autoShell:!1},a=await processDirectives(u,{},A0.join(K,"components",`${p}.stx`),m,new Set);return new Response(a,{headers:{"Content-Type":"text/html"}})}catch(u){return new Response(`<div class="stx-async-error">${u.message}</div>`,{status:500,headers:{"Content-Type":"text/html"}})}}if(N)try{let p=await N.handleRequest(f);if(p.status!==404)return p}catch{}if(A[g.pathname])try{return await A[g.pathname](f)}catch(p){return new Response(JSON.stringify({error:p.message}),{status:500,headers:{"Content-Type":"application/json"}})}let v=P8(g.pathname,q);if(v){let p=M.get(v.route.pattern);if(v.route.isDynamic&&Object.keys(v.params).length>0){let u=await I(v.route,v.params);if(u)p=u}if(p){let u=v3();if(u.validate){if(!await u.validate({params:v.params})){let r=await T(404);if(r){let s=r;if(s=await V0(s,K),J)s=y1(s,G);return new Response(s,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}}if(u.middleware){let a=E4(g.pathname,v.params,u,g.search),r=T4(a,null,f),s=await k4(u.middleware,r);if(s.redirect){let J0=s.redirect.path,z0=s.redirect.options.redirectCode||302,l0=new Headers(s.responseHeaders);return l0.set("Location",J0),new Response(null,{status:z0,headers:l0})}if(s.abort){let{statusCode:J0,message:z0}=s.abort.error;return new Response(`<!DOCTYPE html><html><head><title>Error ${J0}</title></head><body><h1>Error ${J0}</h1><p>${z0}</p></body></html>`,{status:J0,headers:{"Content-Type":"text/html"}})}if(Object.keys(s.state).length>0){let J0=`<script>(function(){var s=typeof stx!=='undefined'?stx:{};s._ms=${JSON.stringify(s.state)};if(s.setMiddlewareState)s.setMiddlewareState(s._ms);})()</script>`;p.content=p.content.replace("</head>",`${J0}</head>`)}}let m=p.content;if(F&&j2(f)){if(Object.keys(v.params).length>0)m=b(m,v.params);m=await V0(m,K);let a=_?.router?.container||"main";return m=C4(m,a),new Response(m,{headers:{"Content-Type":"text/html","X-STX-Fragment":"true","Cache-Control":"no-store, no-cache, must-revalidate"}})}if(F)m=b4(F,m);if(Object.keys(v.params).length>0)m=b(m,v.params);if(m=await V0(m,K),J)m=y1(m,G);if(Z.native)if(m.includes("<head>"))m=m.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else m="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+m;return new Response(m,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}if(H.length>0){let p=H.map((m)=>m.route),u=P8(g.pathname,p);if(u){let m=O.get(u.route.pattern);if(m){let a=m.content;if(F)a=b4(F,a);if(Object.keys(u.params).length>0)a=b(a,u.params);if(a=await V0(a,K),J)a=y1(a,G);return new Response(a,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}for(let{prefix:m}of j)if(m!=="/"&&g.pathname.startsWith(m)){let a=O.get(m)||O.get(m+"/");if(a){let r=a.content;if(F)r=b4(F,r);if(r=await V0(r,K),J)r=y1(r,G);return new Response(r,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}}let d=M.get("/");if(d){let p=d.content;if(p=await V0(p,K),J)p=y1(p,G);if(Z.native)if(p.includes("<head>"))p=p.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else p="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+p;return new Response(p,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}let n=await T(404);if(n){let p=n;if(p=await V0(p,K),J)p=y1(p,G);return new Response(p,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})},async error(f){let g=await T(500);if(g)return new Response(g,{status:500,headers:{"Content-Type":"text/html"}});return new Response(`<pre>${f}
12160
12160
  ${f.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});if(console.clear(),console.log(`
12161
12161
  ${R.blue}stx${R.reset} ${R.green}${process.env.stx_VERSION||"v0.0.10"}${R.reset} ${R.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${R.reset}`),console.log(`
12162
12162
  ${R.bright}\u2192 ${R.cyan}http://localhost:${k}/${R.reset}`),J)console.log(`${R.dim} HMR: ws://localhost:${G}${R.reset}`);console.log(`
12163
- ${R.yellow}Routes:${R.reset}`);let C=[...LJ(q,K)];for(let{route:f}of H)C.push(`${f.pattern}`);if(C.forEach((f,g)=>{let l=g===C.length-1?"\u2514\u2500 ":"\u251C\u2500 ";console.log(` ${R.green}${l}${R.reset}${f}`)}),console.log(`
12164
- Press ${R.cyan}h${R.reset} + ${R.cyan}Enter${R.reset} to show shortcuts`),I$(P.url.toString(),()=>{if(Q)K7();P.stop()}),Z.native){let f,g=A0.join(z,"index.stx");if(s1.existsSync(g)){let l=await Bun.file(g).text();f=p8(l)}let h=_?.app?.window??{};await J7(k,{title:_?.app?.head?.title||A0.basename(K)||"stx App",width:h.width,height:h.height,darkMode:h.darkMode,hotReload:h.hotReload,nativeSidebar:!!f,sidebarConfig:f})}if(X){console.log(`${R.blue}Watching for changes...${R.reset}`);let f=(l)=>{return l.startsWith("public/")||l.startsWith("public\\")},g=(l)=>{let i=l.toLowerCase();return i.endsWith(".stx")||i.endsWith(".html")||i.endsWith(".md")},h=s1.watch(K,{recursive:!0},async(l,i)=>{if(!i||h4(i))return;if(g4(i)){if(f(i)){if(console.log(`${R.cyan}${i} changed${R.reset}`),J&&Q)Q.reload(i)}else if(g(i)){if(console.log(`${R.yellow}${i} changed, rebuilding...${R.reset}`),V$.clear(),M$(),L&&i){if(A0.resolve(K,i)===L||A0.basename(L)===i){let W0=await y8(L,Z.stxOptions||{});if(W0)F=W0}}if(await E(),await Y4(K),J&&Q)Q.reload(i)}else if(console.log(`${R.yellow}${i} changed, rebuilding...${R.reset}`),V$.clear(),M$(),await E(),J&&Q)Q.reload(i)}else if(f4(i)){if(console.log(`${R.cyan}CSS ${i} changed${R.reset}`),J&&Q)Q.updateCss(i)}});process.on("SIGINT",()=>{if(h.close(),Q)K7();P.stop(),process.exit(0)})}return!0}var cz=D(()=>{y4();c5();l8();P4();b8();O$();q0();v4()});var lz=D(()=>{xJ();dz();mz();cz()});import dJ from"fs";import m4 from"path";async function iz($){try{let Y=(await Bun.file($).text()).match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(!Y)return[];let X=Y[1],J=[],Q=/\/\*\*\s*([\s\S]*?)\s*\*\/\s*(?:(?:const|let|var)\s*)?(?:([\w$]+)\s*=|module\.exports\.([\w$]+)\s*=|\s*([\w$]+)\s*:)/g,G;while((G=Q.exec(X))!==null){let K=G[1],W=G[2]||G[3]||G[4];if(!W)continue;let _={name:W},B=K.match(/@type\s+\{([^}]+)\}/i);if(B)_.type=B[1].trim();if(K.match(/@required/i))_.required=!0;let z=K.match(/@default\s+(.+?)(?:\s+|$)/i);if(z)_.default=z[1].trim();let q=K.split(`
12163
+ ${R.yellow}Routes:${R.reset}`);let C=[...O2(q,K)];for(let{route:f}of H)C.push(`${f.pattern}`);if(C.forEach((f,g)=>{let l=g===C.length-1?"\u2514\u2500 ":"\u251C\u2500 ";console.log(` ${R.green}${l}${R.reset}${f}`)}),console.log(`
12164
+ Press ${R.cyan}h${R.reset} + ${R.cyan}Enter${R.reset} to show shortcuts`),D$(P.url.toString(),()=>{if(Q)K7();P.stop()}),Z.native){let f,g=A0.join(z,"index.stx");if(s1.existsSync(g)){let l=await Bun.file(g).text();f=p8(l)}let h=_?.app?.window??{};await J7(k,{title:_?.app?.head?.title||A0.basename(K)||"stx App",width:h.width,height:h.height,darkMode:h.darkMode,hotReload:h.hotReload,nativeSidebar:!!f,sidebarConfig:f})}if(X){console.log(`${R.blue}Watching for changes...${R.reset}`);let f=(l)=>{return l.startsWith("public/")||l.startsWith("public\\")},g=(l)=>{let i=l.toLowerCase();return i.endsWith(".stx")||i.endsWith(".html")||i.endsWith(".md")},h=s1.watch(K,{recursive:!0},async(l,i)=>{if(!i||h4(i))return;if(g4(i)){if(f(i)){if(console.log(`${R.cyan}${i} changed${R.reset}`),J&&Q)Q.reload(i)}else if(g(i)){if(console.log(`${R.yellow}${i} changed, rebuilding...${R.reset}`),N$.clear(),T$(),L&&i){if(A0.resolve(K,i)===L||A0.basename(L)===i){let W0=await y8(L,Z.stxOptions||{});if(W0)F=W0}}if(await E(),await Y4(K),J&&Q)Q.reload(i)}else if(console.log(`${R.yellow}${i} changed, rebuilding...${R.reset}`),N$.clear(),T$(),await E(),J&&Q)Q.reload(i)}else if(f4(i)){if(console.log(`${R.cyan}CSS ${i} changed${R.reset}`),J&&Q)Q.updateCss(i)}});process.on("SIGINT",()=>{if(h.close(),Q)K7();P.stop(),process.exit(0)})}return!0}var cz=D(()=>{y4();c5();l8();P4();b8();L$();q0();v4()});var lz=D(()=>{P2();dz();mz();cz()});import h2 from"fs";import m4 from"path";async function iz($){try{let Y=(await Bun.file($).text()).match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(!Y)return[];let X=Y[1],J=[],Q=/\/\*\*\s*([\s\S]*?)\s*\*\/\s*(?:(?:const|let|var)\s*)?(?:([\w$]+)\s*=|module\.exports\.([\w$]+)\s*=|\s*([\w$]+)\s*:)/g,G;while((G=Q.exec(X))!==null){let K=G[1],W=G[2]||G[3]||G[4];if(!W)continue;let _={name:W},B=K.match(/@type\s+\{([^}]+)\}/i);if(B)_.type=B[1].trim();if(K.match(/@required/i))_.required=!0;let z=K.match(/@default\s+(.+?)(?:\s+|$)/i);if(z)_.default=z[1].trim();let q=K.split(`
12165
12165
  `).map((j)=>j.trim().replace(/^\*\s*/,"")).filter((j)=>!j.startsWith("@")&&j.length>0);_.description=q.join(" ").trim(),J.push(_)}if(J.length===0){let K=X.match(/module\.exports\s*=\s*\{([^}]+)\}/i);if(K){let _=K[1].split(",").map((B)=>B.trim()).filter(Boolean);for(let B of _){let[U]=B.split(":").map((z)=>z.trim());if(U)J.push({name:U})}}}return J}catch(Z){return console.error(`Error extracting props from ${$}:`,Z),[]}}async function nz($){try{let Z=await Bun.file($).text(),Y=Z.match(/^\s*<!--\s*([\s\S]*?)\s*-->/)||Z.match(/^\s*\/\*\*\s*([\s\S]*?)\s*\*\//);if(Y)return Y[1].split(`
12166
12166
  `).map((X)=>X.trim().replace(/^\*\s*/,"")).join(" ").trim();return""}catch{return""}}async function sz($,Z=!1,Y){let X=m4.basename($,".stx"),J=await iz($),Q=await nz($),G="";if(Z&&Y)G=`<${Y}></${Y}>`;else{let K=J.map((W)=>{if(W.type==="boolean")return`:${W.name}="true"`;return`${W.name}="value"`}).join(`
12167
12167
  `);G=`<${X}
12168
12168
  ${K}
12169
- />`}return{name:X,path:$,description:Q,props:J,example:G,isWebComponent:Z,tag:Y}}async function uJ($){try{if(!await t($))return console.warn(`Components directory does not exist: ${$}`),[];let Z=await dJ.promises.readdir($,{withFileTypes:!0}),Y=[];for(let X of Z){let J=m4.join($,X.name);if(X.isDirectory()){let Q=await uJ(J);Y.push(...Q)}else if(X.isFile()&&X.name.endsWith(".stx"))Y.push(J)}return Y}catch(Z){return console.error(`Error finding component files in ${$}:`,Z),[]}}async function rz($,Z){try{if(!await t($))return[];let Y=await uJ($),X=[],J=new Map;if(Z?.components?.length)for(let Q of Z.components)J.set(Q.file,Q);for(let Q of Y){let G=J.get(Q),K=!!G,W=G?.tag,_=await sz(Q,K,W);X.push(_)}return X}catch(Y){return console.error("Error generating component docs:",Y),[]}}async function oz($){try{if(!await t($))return[];let Z=await dJ.promises.readdir($,{withFileTypes:!0}),Y=[];for(let X of Z){if(!X.isFile()||!X.name.endsWith(".stx"))continue;let J=m4.join($,X.name),Q=await Bun.file(J).text(),G=m4.basename(J,".stx"),K=Q.match(/^\s*<!--\s*([\s\S]*?)\s*-->/)||Q.match(/^\s*\/\*\*\s*([\s\S]*?)\s*\*\//),W=K?K[1].split(`
12169
+ />`}return{name:X,path:$,description:Q,props:J,example:G,isWebComponent:Z,tag:Y}}async function d2($){try{if(!await t($))return console.warn(`Components directory does not exist: ${$}`),[];let Z=await h2.promises.readdir($,{withFileTypes:!0}),Y=[];for(let X of Z){let J=m4.join($,X.name);if(X.isDirectory()){let Q=await d2(J);Y.push(...Q)}else if(X.isFile()&&X.name.endsWith(".stx"))Y.push(J)}return Y}catch(Z){return console.error(`Error finding component files in ${$}:`,Z),[]}}async function rz($,Z){try{if(!await t($))return[];let Y=await d2($),X=[],J=new Map;if(Z?.components?.length)for(let Q of Z.components)J.set(Q.file,Q);for(let Q of Y){let G=J.get(Q),K=!!G,W=G?.tag,_=await sz(Q,K,W);X.push(_)}return X}catch(Y){return console.error("Error generating component docs:",Y),[]}}async function oz($){try{if(!await t($))return[];let Z=await h2.promises.readdir($,{withFileTypes:!0}),Y=[];for(let X of Z){if(!X.isFile()||!X.name.endsWith(".stx"))continue;let J=m4.join($,X.name),Q=await Bun.file(J).text(),G=m4.basename(J,".stx"),K=Q.match(/^\s*<!--\s*([\s\S]*?)\s*-->/)||Q.match(/^\s*\/\*\*\s*([\s\S]*?)\s*\*\//),W=K?K[1].split(`
12170
12170
  `).map((H)=>H.trim().replace(/^\*\s*/,"")).join(" ").trim():"",_=/@component\(\s*['"]([^'"]+)['"]/g,B=/<([A-Z][a-zA-Z0-9]*|[a-z]+-[a-z0-9-]+)(?:\s[^>]*)?\/?>|\{\{\s*slot\s*\}\}/g,U=new Set,z;while((z=_.exec(Q))!==null)U.add(z[1]);while((z=B.exec(Q))!==null)if(z[1]&&z[1]!=="slot")U.add(z[1]);let q=/@([a-z]+)(?:\s*\(|\s+|$)/g,j=new Set;while((z=q.exec(Q))!==null)j.add(z[1]);Y.push({name:G,path:J,description:W,components:[...U],directives:[...j]})}return Y}catch(Z){return console.error("Error generating template docs:",Z),[]}}async function az($=[]){try{let Z=[{name:"if",description:"Conditionally render content based on a condition",hasEndTag:!0,example:`@if(user.isLoggedIn)
12171
12171
  <p>Welcome, {{ user.name }}!</p>
12172
12172
  @endif`},{name:"else",description:"Provides an alternative if a condition is not met",hasEndTag:!1,example:`@if(user.isLoggedIn)
@@ -12300,7 +12300,7 @@ Press ${R.cyan}h${R.reset} + ${R.cyan}Enter${R.reset} to show shortcuts`),I$(P.u
12300
12300
  <td>@${Q.name}</td>
12301
12301
  <td>${Q.description||"-"}</td>
12302
12302
  <td>${Q.hasEndTag?"Yes":"No"}</td>
12303
- </tr>`;J+="</tbody></table>";for(let Q of Y)if(Q.example)J+=`<h3>@${Q.name}</h3>`,J+=`<p>${Q.description||""}</p>`,J+="<h4>Example</h4>",J+=`<pre><code>${Q.example.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}</code></pre>`}return J+="</body></html>",J}function $q($=[],Z=[],Y=[],X){return JSON.stringify({components:$,templates:Z,directives:Y,extraContent:X||""},null,2)}async function Zq($){try{let{componentsDir:Z,templatesDir:Y,webComponentsConfig:X,customDirectives:J,config:Q}=$;if(!Q.enabled)return!1;let G=Q.outputDir||"docs";if(await dJ.promises.mkdir(G,{recursive:!0}),console.log("Generating documentation..."),Z)console.log(`Components directory: ${Z}`);if(Y)console.log(`Templates directory: ${Y}`);console.log(`Output directory: ${G}`);let K=[];if(Q.components!==!1&&Z)console.log("Generating component documentation..."),K=await rz(Z,X),console.log(`Found ${K.length} components`);let W=[];if(Q.templates!==!1&&Y)console.log("Generating template documentation..."),W=await oz(Y),console.log(`Found ${W.length} templates`);let _=[];if(Q.directives!==!1)console.log("Generating directive documentation..."),_=await az(J),console.log(`Found ${_.length} directives`);let B=Q.format||"markdown",U=Q.extraContent,z="",q="";switch(B){case"markdown":z=tz(K,W,_,U),q="md";break;case"html":z=ez(K,W,_,U),q="html";break;case"json":z=$q(K,W,_,U),q="json";break;default:throw Error(`Unsupported documentation format: ${B}`)}let j=m4.join(G,`stx-docs.${q}`);return await Bun.write(j,z),console.log(`Documentation generated: ${j}`),!0}catch(Z){return console.error("Error generating documentation:",Z),!1}}async function YM($){let Z={enabled:!0,outputDir:$.output||"docs",format:$.format||"markdown",components:$.components!==!1,templates:$.templates!==!1,directives:$.directives!==!1,extraContent:$.extraContent},Y=$.componentsDir||t0.componentsDir,X=$.templatesDir||".";return Zq({componentsDir:Y,templatesDir:X,webComponentsConfig:t0.webComponents,customDirectives:t0.customDirectives,config:Z})}var Yq=D(()=>{m0();q0()});import _7 from"process";function B7(){if(typeof globalThis<"u"&&"caches"in globalThis&&"CF"in globalThis)return{platform:"cloudflare",supportsStreaming:!0,supportsCrypto:!0,supportsKV:!0,supportsCache:!0,capabilities:["kv","r2","d1","durable-objects","queues"]};if(typeof globalThis<"u"&&"Deno"in globalThis)return{platform:"deno",version:globalThis.Deno.version?.deno,supportsStreaming:!0,supportsCrypto:!0,supportsKV:!0,supportsCache:!0,capabilities:["kv","deploy","ffi"]};if(typeof globalThis<"u"&&"Bun"in globalThis)return{platform:"bun",version:globalThis.Bun.version,supportsStreaming:!0,supportsCrypto:!0,supportsKV:!1,supportsCache:!1,capabilities:["sqlite","ffi","native-modules"]};if(typeof globalThis<"u"&&"EdgeRuntime"in globalThis)return{platform:"vercel",supportsStreaming:!0,supportsCrypto:!0,supportsKV:!0,supportsCache:!0,capabilities:["edge-config","blob"]};if(typeof globalThis<"u"&&"Netlify"in globalThis)return{platform:"netlify",supportsStreaming:!0,supportsCrypto:!0,supportsKV:!0,supportsCache:!1,capabilities:["blobs","edge-functions"]};if(typeof globalThis<"u"&&"fastly"in globalThis)return{platform:"fastly",supportsStreaming:!0,supportsCrypto:!0,supportsKV:!0,supportsCache:!0,capabilities:["dictionary","backend","geolocation"]};if(_7.versions?.node)return{platform:"node",version:_7.versions.node,supportsStreaming:!0,supportsCrypto:!0,supportsKV:!1,supportsCache:!1,capabilities:["fs","child-process","native-modules"]};return{platform:"unknown",supportsStreaming:!1,supportsCrypto:!1,supportsKV:!1,supportsCache:!1,capabilities:[]}}function XM(){let $=B7();return["cloudflare","deno","vercel","netlify","fastly"].includes($.platform)}function JM(){return B7().platform!=="unknown"}function Jq($){return{get(Z){if($&&Z in $){let Y=$[Z];return typeof Y==="string"?Y:void 0}if(typeof globalThis<"u"&&"Deno"in globalThis)return globalThis.Deno.env.get(Z);if(_7.env)return _7.env[Z];return},getOrThrow(Z){let Y=this.get(Z);if(Y===void 0)throw Error(`Environment variable "${Z}" is not set`);return Y},has(Z){return this.get(Z)!==void 0},all(){let Z={};if($){for(let[Y,X]of Object.entries($))if(typeof X==="string")Z[Y]=X}if(typeof globalThis<"u"&&"Deno"in globalThis){let Y=globalThis.Deno.env.toObject();Object.assign(Z,Y)}if(_7.env){for(let[Y,X]of Object.entries(_7.env))if(X!==void 0)Z[Y]=X}return Z}}}function Qq($){let Z=B7();if(Z.platform==="cloudflare"&&$)return $;if(Z.platform==="deno"&&"Deno"in globalThis)return QM();if(Z.platform==="node"||Z.platform==="bun")return GM();return}function QM(){let $=null,Z=async()=>{if(!$)$=await globalThis.Deno.openKv();return $};return{async get(Y){return(await(await Z()).get(["stx",Y])).value},async getWithMetadata(Y){let X=await Z(),J=await X.get(["stx",Y]),Q=await X.get(["stx-meta",Y]);return{value:J.value,metadata:Q.value}},async put(Y,X,J){let Q=await Z(),G=J?.expirationTtl?J.expirationTtl*1000:void 0;if(await Q.set(["stx",Y],X,G?{expireIn:G}:void 0),J?.metadata)await Q.set(["stx-meta",Y],J.metadata,G?{expireIn:G}:void 0)},async delete(Y){let X=await Z();await X.delete(["stx",Y]),await X.delete(["stx-meta",Y])},async list(Y){let X=await Z(),J=Y?.prefix?["stx",Y.prefix]:["stx"],Q=X.list({prefix:J,limit:Y?.limit||100}),G=[];for await(let K of Q){let _=K.key.slice(1).join("/");if(!_.startsWith("stx-meta/"))G.push({name:_})}return{keys:G,list_complete:!0}}}}function GM(){let $=new Map,Z=()=>{let Y=Date.now();for(let[X,J]of $.entries())if(J.expiration&&J.expiration<Y)$.delete(X)};return{async get(Y){Z();let X=$.get(Y);if(!X)return null;if(X.expiration&&X.expiration<Date.now())return $.delete(Y),null;return X.value},async getWithMetadata(Y){Z();let X=$.get(Y);if(!X)return{value:null,metadata:null};if(X.expiration&&X.expiration<Date.now())return $.delete(Y),{value:null,metadata:null};return{value:X.value,metadata:X.metadata||null}},async put(Y,X,J){let Q=J?.expiration?J.expiration*1000:J?.expirationTtl?Date.now()+J.expirationTtl*1000:void 0;$.set(Y,{value:X,metadata:J?.metadata,expiration:Q})},async delete(Y){$.delete(Y)},async list(Y){Z();let X=[];for(let[J,Q]of $.entries()){if(Y?.prefix&&!J.startsWith(Y.prefix))continue;if(X.push({name:J,expiration:Q.expiration,metadata:Q.metadata}),Y?.limit&&X.length>=Y.limit)break}return{keys:X,list_complete:!0}}}}function Gq(){let $=B7();if($.platform==="cloudflare"&&"caches"in globalThis)return KM();if($.supportsStreaming)return WM();return}function KM(){return{async match($){return(await caches.default).match($)},async put($,Z){await(await caches.default).put($,Z.clone())},async delete($){return(await caches.default).delete($)}}}function WM(){let $=new Map,Z=60000;return{async match(Y){let X=Y.url,J=$.get(X);if(!J)return;if(Date.now()>J.expiration){$.delete(X);return}return J.response.clone()},async put(Y,X){let J=Y.url,Q=X.headers.get("Cache-Control"),G=60000;if(Q){let K=Q.match(/max-age=(\d+)/);if(K)G=Number.parseInt(K[1],10)*1000}$.set(J,{response:X.clone(),expiration:Date.now()+G})},async delete(Y){return $.delete(Y.url)}}}function _M(){return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,9)}`}function BM($,Z){if(Z.platform==="cloudflare"){let Y=$.cf;if(Y)return{city:Y.city,country:Y.country,countryCode:Y.country,region:Y.region,latitude:Y.latitude?Number.parseFloat(Y.latitude):void 0,longitude:Y.longitude?Number.parseFloat(Y.longitude):void 0,timezone:Y.timezone}}if(Z.platform==="vercel"){let Y={},X=$.headers.get("x-vercel-ip-city"),J=$.headers.get("x-vercel-ip-country"),Q=$.headers.get("x-vercel-ip-country-region"),G=$.headers.get("x-vercel-ip-latitude"),K=$.headers.get("x-vercel-ip-longitude");if(X)Y.city=decodeURIComponent(X);if(J)Y.countryCode=J;if(Q)Y.region=Q;if(G)Y.latitude=Number.parseFloat(G);if(K)Y.longitude=Number.parseFloat(K);return Object.keys(Y).length>0?Y:void 0}if(Z.platform==="netlify"){let Y={},X=$.headers.get("x-nf-geo-city"),J=$.headers.get("x-nf-geo-country");if(X)Y.city=X;if(J)Y.countryCode=J;return Object.keys(Y).length>0?Y:void 0}return}function mJ($,Z,Y){let X=new Headers($.headers);if(Z.origins==="*")X.set("Access-Control-Allow-Origin","*");else if(Z.origins&&Y&&Z.origins.includes(Y))X.set("Access-Control-Allow-Origin",Y),X.set("Vary","Origin");if(Z.methods)X.set("Access-Control-Allow-Methods",Z.methods.join(", "));if(Z.headers)X.set("Access-Control-Allow-Headers",Z.headers.join(", "));if(Z.exposeHeaders)X.set("Access-Control-Expose-Headers",Z.exposeHeaders.join(", "));if(Z.credentials)X.set("Access-Control-Allow-Credentials","true");if(Z.maxAge)X.set("Access-Control-Max-Age",String(Z.maxAge));return new Response($.body,{status:$.status,statusText:$.statusText,headers:X})}function p4($){let Z=B7();return async(Y,X)=>{let J=performance.now(),Q=_M(),G={runtime:Z,platform:X||{},requestId:Q,geo:BM(Y,Z),timing:{start:J,getElapsed:()=>performance.now()-J},kv:Qq(X?.KV),cache:Gq(),env:Jq(X?.env)};try{if(Y.method==="OPTIONS"&&$.cors){let W=new Response(null,{status:204});return W=mJ(W,$.cors,Y.headers.get("Origin")||void 0),W}if($.cache?.enabled&&Y.method==="GET"&&G.cache){if(Xq(Y,$.cache)){let _=await G.cache.match(Y);if(_){let B=new Response(_.body,_);return B.headers.set("X-Cache","HIT"),B.headers.set("X-Request-Id",Q),$.cors?mJ(B,$.cors,Y.headers.get("Origin")||void 0):B}}}let K;if($.middleware&&$.middleware.length>0)K=await UM(Y,G,$.middleware,async()=>{let W=await $.render(Y,G);return typeof W==="string"?new Response(W,{headers:{"Content-Type":"text/html; charset=utf-8"}}):W});else{let W=await $.render(Y,G);K=typeof W==="string"?new Response(W,{headers:{"Content-Type":"text/html; charset=utf-8"}}):W}if(K.headers.set("X-Request-Id",Q),K.headers.set("X-Response-Time",`${G.timing.getElapsed().toFixed(2)}ms`),$.cache?.enabled&&Y.method==="GET"&&G.cache){if(Xq(Y,$.cache)&&K.status===200){let _=$.cache.ttl||60,B=K.clone();B.headers.set("Cache-Control",`public, max-age=${_}`),await G.cache.put(Y,B),K.headers.set("X-Cache","MISS")}}if($.cors)K=mJ(K,$.cors,Y.headers.get("Origin")||void 0);return K}catch(K){let W=K instanceof Error?K:Error(String(K));if($.onError)return $.onError(W,Y);return new Response(`Internal Server Error: ${W.message}`,{status:500,headers:{"Content-Type":"text/plain","X-Request-Id":Q}})}}}function Xq($,Z){let X=new URL($.url).pathname;if(Z.excludePaths){for(let J of Z.excludePaths)if(J.test(X))return!1}if(Z.includePaths){for(let J of Z.includePaths)if(J.test(X))return!0;return!1}return!0}async function UM($,Z,Y,X){let J=0,Q=async()=>{if(J>=Y.length)return X();let G=Y[J];return J++,G($,Z,Q)};return Q()}function zM($,Z){let Y=new Headers(Z?.headers);return Y.set("Content-Type","text/html; charset=utf-8"),Y.set("Transfer-Encoding","chunked"),new Response($,{...Z,headers:Y})}function qM(){let $=new TextEncoder;return new TransformStream({transform(Z,Y){Y.enqueue($.encode(Z))}})}function jM($){let Z=new TextEncoder;return new ReadableStream({async start(Y){for await(let X of $)Y.enqueue(Z.encode(X));Y.close()}})}function HM($){let Z=p4($);return{async fetch(Y,X,J){return Z(Y,{env:X,ctx:J,KV:X.KV})}}}function OM($){let Z=p4($);return(Y)=>Z(Y,{})}function LM($){let Z=p4($);return(Y)=>Z(Y,{})}function FM($){let Z=p4($);return(Y,X)=>{return Z(Y,{netlifyContext:X})}}function VM($){let Z=$.headers.get("Cookie");if(!Z)return{};let Y={};for(let X of Z.split(";")){let[J,Q]=X.split("=").map((G)=>G.trim());if(J&&Q)Y[J]=decodeURIComponent(Q)}return Y}function NM($,Z,Y){let X=`${encodeURIComponent($)}=${encodeURIComponent(Z)}`;if(Y?.maxAge!==void 0)X+=`; Max-Age=${Y.maxAge}`;if(Y?.expires)X+=`; Expires=${Y.expires.toUTCString()}`;if(Y?.path)X+=`; Path=${Y.path}`;if(Y?.domain)X+=`; Domain=${Y.domain}`;if(Y?.secure)X+="; Secure";if(Y?.httpOnly)X+="; HttpOnly";if(Y?.sameSite)X+=`; SameSite=${Y.sameSite}`;return X}function AM($,Z){let Y=new Headers(Z?.headers);return Y.set("Content-Type","application/json; charset=utf-8"),new Response(JSON.stringify($),{...Z,headers:Y})}function wM($,Z=302){return new Response(null,{status:Z,headers:{Location:$}})}function RM($="Not Found"){return new Response($,{status:404,headers:{"Content-Type":"text/plain"}})}var Kq=()=>{};function Bq($,Z={}){let Y={..._q,...Z};if($.trim()==="")return`
12303
+ </tr>`;J+="</tbody></table>";for(let Q of Y)if(Q.example)J+=`<h3>@${Q.name}</h3>`,J+=`<p>${Q.description||""}</p>`,J+="<h4>Example</h4>",J+=`<pre><code>${Q.example.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}</code></pre>`}return J+="</body></html>",J}function $q($=[],Z=[],Y=[],X){return JSON.stringify({components:$,templates:Z,directives:Y,extraContent:X||""},null,2)}async function Zq($){try{let{componentsDir:Z,templatesDir:Y,webComponentsConfig:X,customDirectives:J,config:Q}=$;if(!Q.enabled)return!1;let G=Q.outputDir||"docs";if(await h2.promises.mkdir(G,{recursive:!0}),console.log("Generating documentation..."),Z)console.log(`Components directory: ${Z}`);if(Y)console.log(`Templates directory: ${Y}`);console.log(`Output directory: ${G}`);let K=[];if(Q.components!==!1&&Z)console.log("Generating component documentation..."),K=await rz(Z,X),console.log(`Found ${K.length} components`);let W=[];if(Q.templates!==!1&&Y)console.log("Generating template documentation..."),W=await oz(Y),console.log(`Found ${W.length} templates`);let _=[];if(Q.directives!==!1)console.log("Generating directive documentation..."),_=await az(J),console.log(`Found ${_.length} directives`);let B=Q.format||"markdown",U=Q.extraContent,z="",q="";switch(B){case"markdown":z=tz(K,W,_,U),q="md";break;case"html":z=ez(K,W,_,U),q="html";break;case"json":z=$q(K,W,_,U),q="json";break;default:throw Error(`Unsupported documentation format: ${B}`)}let j=m4.join(G,`stx-docs.${q}`);return await Bun.write(j,z),console.log(`Documentation generated: ${j}`),!0}catch(Z){return console.error("Error generating documentation:",Z),!1}}async function YM($){let Z={enabled:!0,outputDir:$.output||"docs",format:$.format||"markdown",components:$.components!==!1,templates:$.templates!==!1,directives:$.directives!==!1,extraContent:$.extraContent},Y=$.componentsDir||t0.componentsDir,X=$.templatesDir||".";return Zq({componentsDir:Y,templatesDir:X,webComponentsConfig:t0.webComponents,customDirectives:t0.customDirectives,config:Z})}var Yq=D(()=>{m0();q0()});import _7 from"process";function B7(){if(typeof globalThis<"u"&&"caches"in globalThis&&"CF"in globalThis)return{platform:"cloudflare",supportsStreaming:!0,supportsCrypto:!0,supportsKV:!0,supportsCache:!0,capabilities:["kv","r2","d1","durable-objects","queues"]};if(typeof globalThis<"u"&&"Deno"in globalThis)return{platform:"deno",version:globalThis.Deno.version?.deno,supportsStreaming:!0,supportsCrypto:!0,supportsKV:!0,supportsCache:!0,capabilities:["kv","deploy","ffi"]};if(typeof globalThis<"u"&&"Bun"in globalThis)return{platform:"bun",version:globalThis.Bun.version,supportsStreaming:!0,supportsCrypto:!0,supportsKV:!1,supportsCache:!1,capabilities:["sqlite","ffi","native-modules"]};if(typeof globalThis<"u"&&"EdgeRuntime"in globalThis)return{platform:"vercel",supportsStreaming:!0,supportsCrypto:!0,supportsKV:!0,supportsCache:!0,capabilities:["edge-config","blob"]};if(typeof globalThis<"u"&&"Netlify"in globalThis)return{platform:"netlify",supportsStreaming:!0,supportsCrypto:!0,supportsKV:!0,supportsCache:!1,capabilities:["blobs","edge-functions"]};if(typeof globalThis<"u"&&"fastly"in globalThis)return{platform:"fastly",supportsStreaming:!0,supportsCrypto:!0,supportsKV:!0,supportsCache:!0,capabilities:["dictionary","backend","geolocation"]};if(_7.versions?.node)return{platform:"node",version:_7.versions.node,supportsStreaming:!0,supportsCrypto:!0,supportsKV:!1,supportsCache:!1,capabilities:["fs","child-process","native-modules"]};return{platform:"unknown",supportsStreaming:!1,supportsCrypto:!1,supportsKV:!1,supportsCache:!1,capabilities:[]}}function XM(){let $=B7();return["cloudflare","deno","vercel","netlify","fastly"].includes($.platform)}function JM(){return B7().platform!=="unknown"}function Jq($){return{get(Z){if($&&Z in $){let Y=$[Z];return typeof Y==="string"?Y:void 0}if(typeof globalThis<"u"&&"Deno"in globalThis)return globalThis.Deno.env.get(Z);if(_7.env)return _7.env[Z];return},getOrThrow(Z){let Y=this.get(Z);if(Y===void 0)throw Error(`Environment variable "${Z}" is not set`);return Y},has(Z){return this.get(Z)!==void 0},all(){let Z={};if($){for(let[Y,X]of Object.entries($))if(typeof X==="string")Z[Y]=X}if(typeof globalThis<"u"&&"Deno"in globalThis){let Y=globalThis.Deno.env.toObject();Object.assign(Z,Y)}if(_7.env){for(let[Y,X]of Object.entries(_7.env))if(X!==void 0)Z[Y]=X}return Z}}}function Qq($){let Z=B7();if(Z.platform==="cloudflare"&&$)return $;if(Z.platform==="deno"&&"Deno"in globalThis)return QM();if(Z.platform==="node"||Z.platform==="bun")return GM();return}function QM(){let $=null,Z=async()=>{if(!$)$=await globalThis.Deno.openKv();return $};return{async get(Y){return(await(await Z()).get(["stx",Y])).value},async getWithMetadata(Y){let X=await Z(),J=await X.get(["stx",Y]),Q=await X.get(["stx-meta",Y]);return{value:J.value,metadata:Q.value}},async put(Y,X,J){let Q=await Z(),G=J?.expirationTtl?J.expirationTtl*1000:void 0;if(await Q.set(["stx",Y],X,G?{expireIn:G}:void 0),J?.metadata)await Q.set(["stx-meta",Y],J.metadata,G?{expireIn:G}:void 0)},async delete(Y){let X=await Z();await X.delete(["stx",Y]),await X.delete(["stx-meta",Y])},async list(Y){let X=await Z(),J=Y?.prefix?["stx",Y.prefix]:["stx"],Q=X.list({prefix:J,limit:Y?.limit||100}),G=[];for await(let K of Q){let _=K.key.slice(1).join("/");if(!_.startsWith("stx-meta/"))G.push({name:_})}return{keys:G,list_complete:!0}}}}function GM(){let $=new Map,Z=()=>{let Y=Date.now();for(let[X,J]of $.entries())if(J.expiration&&J.expiration<Y)$.delete(X)};return{async get(Y){Z();let X=$.get(Y);if(!X)return null;if(X.expiration&&X.expiration<Date.now())return $.delete(Y),null;return X.value},async getWithMetadata(Y){Z();let X=$.get(Y);if(!X)return{value:null,metadata:null};if(X.expiration&&X.expiration<Date.now())return $.delete(Y),{value:null,metadata:null};return{value:X.value,metadata:X.metadata||null}},async put(Y,X,J){let Q=J?.expiration?J.expiration*1000:J?.expirationTtl?Date.now()+J.expirationTtl*1000:void 0;$.set(Y,{value:X,metadata:J?.metadata,expiration:Q})},async delete(Y){$.delete(Y)},async list(Y){Z();let X=[];for(let[J,Q]of $.entries()){if(Y?.prefix&&!J.startsWith(Y.prefix))continue;if(X.push({name:J,expiration:Q.expiration,metadata:Q.metadata}),Y?.limit&&X.length>=Y.limit)break}return{keys:X,list_complete:!0}}}}function Gq(){let $=B7();if($.platform==="cloudflare"&&"caches"in globalThis)return KM();if($.supportsStreaming)return WM();return}function KM(){return{async match($){return(await caches.default).match($)},async put($,Z){await(await caches.default).put($,Z.clone())},async delete($){return(await caches.default).delete($)}}}function WM(){let $=new Map,Z=60000;return{async match(Y){let X=Y.url,J=$.get(X);if(!J)return;if(Date.now()>J.expiration){$.delete(X);return}return J.response.clone()},async put(Y,X){let J=Y.url,Q=X.headers.get("Cache-Control"),G=60000;if(Q){let K=Q.match(/max-age=(\d+)/);if(K)G=Number.parseInt(K[1],10)*1000}$.set(J,{response:X.clone(),expiration:Date.now()+G})},async delete(Y){return $.delete(Y.url)}}}function _M(){return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,9)}`}function BM($,Z){if(Z.platform==="cloudflare"){let Y=$.cf;if(Y)return{city:Y.city,country:Y.country,countryCode:Y.country,region:Y.region,latitude:Y.latitude?Number.parseFloat(Y.latitude):void 0,longitude:Y.longitude?Number.parseFloat(Y.longitude):void 0,timezone:Y.timezone}}if(Z.platform==="vercel"){let Y={},X=$.headers.get("x-vercel-ip-city"),J=$.headers.get("x-vercel-ip-country"),Q=$.headers.get("x-vercel-ip-country-region"),G=$.headers.get("x-vercel-ip-latitude"),K=$.headers.get("x-vercel-ip-longitude");if(X)Y.city=decodeURIComponent(X);if(J)Y.countryCode=J;if(Q)Y.region=Q;if(G)Y.latitude=Number.parseFloat(G);if(K)Y.longitude=Number.parseFloat(K);return Object.keys(Y).length>0?Y:void 0}if(Z.platform==="netlify"){let Y={},X=$.headers.get("x-nf-geo-city"),J=$.headers.get("x-nf-geo-country");if(X)Y.city=X;if(J)Y.countryCode=J;return Object.keys(Y).length>0?Y:void 0}return}function u2($,Z,Y){let X=new Headers($.headers);if(Z.origins==="*")X.set("Access-Control-Allow-Origin","*");else if(Z.origins&&Y&&Z.origins.includes(Y))X.set("Access-Control-Allow-Origin",Y),X.set("Vary","Origin");if(Z.methods)X.set("Access-Control-Allow-Methods",Z.methods.join(", "));if(Z.headers)X.set("Access-Control-Allow-Headers",Z.headers.join(", "));if(Z.exposeHeaders)X.set("Access-Control-Expose-Headers",Z.exposeHeaders.join(", "));if(Z.credentials)X.set("Access-Control-Allow-Credentials","true");if(Z.maxAge)X.set("Access-Control-Max-Age",String(Z.maxAge));return new Response($.body,{status:$.status,statusText:$.statusText,headers:X})}function p4($){let Z=B7();return async(Y,X)=>{let J=performance.now(),Q=_M(),G={runtime:Z,platform:X||{},requestId:Q,geo:BM(Y,Z),timing:{start:J,getElapsed:()=>performance.now()-J},kv:Qq(X?.KV),cache:Gq(),env:Jq(X?.env)};try{if(Y.method==="OPTIONS"&&$.cors){let W=new Response(null,{status:204});return W=u2(W,$.cors,Y.headers.get("Origin")||void 0),W}if($.cache?.enabled&&Y.method==="GET"&&G.cache){if(Xq(Y,$.cache)){let _=await G.cache.match(Y);if(_){let B=new Response(_.body,_);return B.headers.set("X-Cache","HIT"),B.headers.set("X-Request-Id",Q),$.cors?u2(B,$.cors,Y.headers.get("Origin")||void 0):B}}}let K;if($.middleware&&$.middleware.length>0)K=await UM(Y,G,$.middleware,async()=>{let W=await $.render(Y,G);return typeof W==="string"?new Response(W,{headers:{"Content-Type":"text/html; charset=utf-8"}}):W});else{let W=await $.render(Y,G);K=typeof W==="string"?new Response(W,{headers:{"Content-Type":"text/html; charset=utf-8"}}):W}if(K.headers.set("X-Request-Id",Q),K.headers.set("X-Response-Time",`${G.timing.getElapsed().toFixed(2)}ms`),$.cache?.enabled&&Y.method==="GET"&&G.cache){if(Xq(Y,$.cache)&&K.status===200){let _=$.cache.ttl||60,B=K.clone();B.headers.set("Cache-Control",`public, max-age=${_}`),await G.cache.put(Y,B),K.headers.set("X-Cache","MISS")}}if($.cors)K=u2(K,$.cors,Y.headers.get("Origin")||void 0);return K}catch(K){let W=K instanceof Error?K:Error(String(K));if($.onError)return $.onError(W,Y);return new Response(`Internal Server Error: ${W.message}`,{status:500,headers:{"Content-Type":"text/plain","X-Request-Id":Q}})}}}function Xq($,Z){let X=new URL($.url).pathname;if(Z.excludePaths){for(let J of Z.excludePaths)if(J.test(X))return!1}if(Z.includePaths){for(let J of Z.includePaths)if(J.test(X))return!0;return!1}return!0}async function UM($,Z,Y,X){let J=0,Q=async()=>{if(J>=Y.length)return X();let G=Y[J];return J++,G($,Z,Q)};return Q()}function zM($,Z){let Y=new Headers(Z?.headers);return Y.set("Content-Type","text/html; charset=utf-8"),Y.set("Transfer-Encoding","chunked"),new Response($,{...Z,headers:Y})}function qM(){let $=new TextEncoder;return new TransformStream({transform(Z,Y){Y.enqueue($.encode(Z))}})}function jM($){let Z=new TextEncoder;return new ReadableStream({async start(Y){for await(let X of $)Y.enqueue(Z.encode(X));Y.close()}})}function HM($){let Z=p4($);return{async fetch(Y,X,J){return Z(Y,{env:X,ctx:J,KV:X.KV})}}}function OM($){let Z=p4($);return(Y)=>Z(Y,{})}function LM($){let Z=p4($);return(Y)=>Z(Y,{})}function FM($){let Z=p4($);return(Y,X)=>{return Z(Y,{netlifyContext:X})}}function VM($){let Z=$.headers.get("Cookie");if(!Z)return{};let Y={};for(let X of Z.split(";")){let[J,Q]=X.split("=").map((G)=>G.trim());if(J&&Q)Y[J]=decodeURIComponent(Q)}return Y}function NM($,Z,Y){let X=`${encodeURIComponent($)}=${encodeURIComponent(Z)}`;if(Y?.maxAge!==void 0)X+=`; Max-Age=${Y.maxAge}`;if(Y?.expires)X+=`; Expires=${Y.expires.toUTCString()}`;if(Y?.path)X+=`; Path=${Y.path}`;if(Y?.domain)X+=`; Domain=${Y.domain}`;if(Y?.secure)X+="; Secure";if(Y?.httpOnly)X+="; HttpOnly";if(Y?.sameSite)X+=`; SameSite=${Y.sameSite}`;return X}function AM($,Z){let Y=new Headers(Z?.headers);return Y.set("Content-Type","application/json; charset=utf-8"),new Response(JSON.stringify($),{...Z,headers:Y})}function wM($,Z=302){return new Response(null,{status:Z,headers:{Location:$}})}function RM($="Not Found"){return new Response($,{status:404,headers:{"Content-Type":"text/plain"}})}var Kq=()=>{};function Bq($,Z={}){let Y={..._q,...Z};if($.trim()==="")return`
12304
12304
  `;let X=$;if(Y.trimTrailingWhitespace)X=X.replace(/[ \t]+$/gm,"");if(X=EM(X,Y),X=SM(X,Y),X=IM(X,Y),Y.trimTrailingWhitespace)X=X.replace(/[ \t]+$/gm,""),X=X.replace(/(\S)[ \t]+(<\/[^>]+>)/g,"$1$2");if(X=X.replace(/\r\n/g,`
12305
12305
  `).replace(/\r/g,`
12306
12306
  `),!X.endsWith(`
@@ -12333,7 +12333,7 @@ ${G}`}),Z=Z.replace(/(<\/[^>]+>)(?=<|$)/g,(J,Q,G,K)=>{let W=K.substring(Math.max
12333
12333
  `),Z=Z.replace(/^\n+/,"").replace(/\n+$/,""),Z}function EM($,Z){let X=TM($).split(`
12334
12334
  `),J=[],Q=0,G=!1,K=Z.useTabs?"\t":" ".repeat(Z.indentSize);for(let W=0;W<X.length;W++){let _=X[W],B=_.trim();if(B===""){J.push("");continue}let U=B.match(/<script\b/i),z=B.match(/<\/script>/i);if(G&&!z){J.push(_);continue}let q=B===">";if(Wq(B)&&!B.startsWith("<")&&!B.startsWith("@")){J.push(K.repeat(Q)+B);continue}let j=B.startsWith("@end"),H=B.startsWith("@else")||B.startsWith("@elseif"),O=B.startsWith("@")&&kM(B),F=B.startsWith("<!DOCTYPE")||B.startsWith("<!doctype"),L=B.startsWith("<!--"),V=B.startsWith("</"),A=B.startsWith("<")&&!V&&!L&&!F,N=B.includes("/>")||DM(B),w=Wq(B);if(V||j)Q=Math.max(0,Q-1);let M=H?Math.max(0,Q-1):Q;if(q)J.push(_);else J.push(K.repeat(M)+B);if(A&&!N&&!w&&!q||O)Q++;if(U)G=!0;if(z)G=!1}return J.join(`
12335
12335
  `)}function IM($,Z){if($=$.replace(/@(if|elseif|foreach|for|while)\s*\(\s*([^)]+)\s*\)/g,(Y,X,J)=>{let Q=J.trim().replace(/\s+/g," ");return`@${X}(${Q})`}),$=$.replace(/@(csrf|method)\s*\(\s*([^)]*)\s*\)/g,(Y,X,J)=>{if(J.trim()==="")return`@${X}`;return`@${X}(${J.trim()})`}),Z.normalizeWhitespace)$=$.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,X)=>{return`{{ ${X.trim()} }}`}),$=$.replace(/\{!!\s*([^!]+)\s*!!\}/g,(Y,X)=>{return`{!! ${X.trim()} !!}`});return $}function DM($){let Z=["br","hr","img","input","meta","link","area","base","col","embed","source","track","wbr"];if($.includes("/>"))return!0;let Y=$.match(/<(\w+)/);if(Y){let X=Y[1];return Z.includes(X.toLowerCase())}return!1}function Wq($){return/<(\w+)(?:\s[^>]*)?>[\s\S]*?<\/\1>/.test($)}function kM($){let Z=["if","unless","foreach","for","while","section","push","component","slot","markdown","wrap","error"];for(let Y of Z)if($.startsWith(`@${Y}`))return!$.includes(`@end${Y}`);return!1}function SM($,Z){if(!Z.sortAttributes)return $;return $.replace(/<(\w+)([^>]*)>/g,(Y,X,J)=>{if(!J.trim())return Y;if(J.includes("<")||J.includes(`
12336
- `)||J.includes("@"))return Y;let Q=/(\w+)(?:=("[^"]*"|'[^']*'|[^\s>]+))?/g,G=[],K;while((K=Q.exec(J))!==null)G.push({name:K[1],value:K[2]});G.sort((_,B)=>{if(_.name==="id")return-1;if(B.name==="id")return 1;if(_.name==="class")return-1;if(B.name==="class")return 1;return _.name.localeCompare(B.name)});let W=G.map((_)=>_.value?`${_.name}=${_.value}`:_.name).join(" ");return`<${X}${W?` ${W}`:""}>`})}var _q;var Uq=D(()=>{_q={indentSize:2,useTabs:!1,maxLineLength:120,normalizeWhitespace:!0,sortAttributes:!1,trimTrailingWhitespace:!0}});import zq from"fs";import pJ from"path";async function CM($="index.stx",Z={}){try{let Y=Z.force||!1,X=pJ.resolve(process.cwd(),$);if(await Bun.file(X).exists()){if(!Y)throw Error(`File ${$} already exists. Use --force to overwrite.`);console.warn(`File ${$} already exists. Overwriting...`)}let J=pJ.dirname(X);if(!zq.existsSync(J))zq.mkdirSync(J,{recursive:!0});let Q;if(Z.template){let G=pJ.resolve(process.cwd(),Z.template);if(!await Bun.file(G).exists())throw Error(`Template file ${Z.template} does not exist.`);if(!G.endsWith(".stx"))console.warn(`Warning: Template file ${Z.template} does not have a .stx extension. Using it anyway.`);Q=await Bun.file(G).text(),console.warn(`Using template from ${Z.template}`)}else if(Z.preset)Q=qq(Z.preset),console.warn(`Using '${Z.preset}' preset template`);else Q=qq("basic");return await Bun.write(X,Q),console.warn(`Created new stx file: ${$}`),!0}catch(Y){return console.error(`Error creating file: ${Y instanceof Error?Y.message:String(Y)}`),!1}}function qq($){switch($){case"basic":return jq();case"component":return yM();case"layout":return PM();case"blog":return xM();case"api":return vM();case"app":return fM();default:return jq()}}function jq(){return`<script>
12336
+ `)||J.includes("@"))return Y;let Q=/(\w+)(?:=("[^"]*"|'[^']*'|[^\s>]+))?/g,G=[],K;while((K=Q.exec(J))!==null)G.push({name:K[1],value:K[2]});G.sort((_,B)=>{if(_.name==="id")return-1;if(B.name==="id")return 1;if(_.name==="class")return-1;if(B.name==="class")return 1;return _.name.localeCompare(B.name)});let W=G.map((_)=>_.value?`${_.name}=${_.value}`:_.name).join(" ");return`<${X}${W?` ${W}`:""}>`})}var _q;var Uq=D(()=>{_q={indentSize:2,useTabs:!1,maxLineLength:120,normalizeWhitespace:!0,sortAttributes:!1,trimTrailingWhitespace:!0}});import zq from"fs";import m2 from"path";async function CM($="index.stx",Z={}){try{let Y=Z.force||!1,X=m2.resolve(process.cwd(),$);if(await Bun.file(X).exists()){if(!Y)throw Error(`File ${$} already exists. Use --force to overwrite.`);console.warn(`File ${$} already exists. Overwriting...`)}let J=m2.dirname(X);if(!zq.existsSync(J))zq.mkdirSync(J,{recursive:!0});let Q;if(Z.template){let G=m2.resolve(process.cwd(),Z.template);if(!await Bun.file(G).exists())throw Error(`Template file ${Z.template} does not exist.`);if(!G.endsWith(".stx"))console.warn(`Warning: Template file ${Z.template} does not have a .stx extension. Using it anyway.`);Q=await Bun.file(G).text(),console.warn(`Using template from ${Z.template}`)}else if(Z.preset)Q=qq(Z.preset),console.warn(`Using '${Z.preset}' preset template`);else Q=qq("basic");return await Bun.write(X,Q),console.warn(`Created new stx file: ${$}`),!0}catch(Y){return console.error(`Error creating file: ${Y instanceof Error?Y.message:String(Y)}`),!1}}function qq($){switch($){case"basic":return jq();case"component":return yM();case"layout":return PM();case"blog":return xM();case"api":return vM();case"app":return fM();default:return jq()}}function jq(){return`<script>
12337
12337
  const title = "My stx Page"
12338
12338
  const description = "A page built with stx"
12339
12339
  const features = [
@@ -12759,7 +12759,7 @@ const features = [
12759
12759
  })();
12760
12760
  </script>
12761
12761
  </body>
12762
- </html>`}var bM;var Hq=D(()=>{bM={basic:{description:"Simple page with script, style, and template sections"},component:{description:"Reusable component with props and slots"},layout:{description:"Layout template with sections and yields"},blog:{description:"Blog post with frontmatter-style variables"},api:{description:"API endpoint template with JSON response"},app:{description:"Full app with stores and components"}}});import c4 from"fs";import k$ from"path";import*as Oq from"readline";function gM($,Z){let Y=$.split(" "),X=Y[0];if(Y.length===1)return Object.keys(o$).filter((J)=>J.startsWith(X));if(["render","cat","load","cd"].includes(X)){let J=Y.slice(1).join(" "),Q=k$.dirname(J)||".",G=k$.basename(J),K=k$.resolve(Z.cwd,Q);if(c4.existsSync(K)&&c4.statSync(K).isDirectory())try{return c4.readdirSync(K).filter((_)=>_.startsWith(G)).map((_)=>`${X} ${Q==="."?"":`${Q}/`}${_}`)}catch{return[]}}if(["unset","eval","set"].includes(X)){let J=Y[1]||"";return Object.keys(Z.context).filter((Q)=>Q.startsWith(J)).map((Q)=>`${X} ${Q}`)}return[]}async function hM($={}){let Z={context:$.context||{},cwd:$.cwd||process.cwd(),history:[],running:!0,lastResult:null},Y=Oq.createInterface({input:process.stdin,output:process.stdout,completer:(J)=>{return[gM(J,Z),J]},historySize:$.maxHistory||100});console.log(`
12762
+ </html>`}var bM;var Hq=D(()=>{bM={basic:{description:"Simple page with script, style, and template sections"},component:{description:"Reusable component with props and slots"},layout:{description:"Layout template with sections and yields"},blog:{description:"Blog post with frontmatter-style variables"},api:{description:"API endpoint template with JSON response"},app:{description:"Full app with stores and components"}}});import c4 from"fs";import S$ from"path";import*as Oq from"readline";function gM($,Z){let Y=$.split(" "),X=Y[0];if(Y.length===1)return Object.keys(o$).filter((J)=>J.startsWith(X));if(["render","cat","load","cd"].includes(X)){let J=Y.slice(1).join(" "),Q=S$.dirname(J)||".",G=S$.basename(J),K=S$.resolve(Z.cwd,Q);if(c4.existsSync(K)&&c4.statSync(K).isDirectory())try{return c4.readdirSync(K).filter((_)=>_.startsWith(G)).map((_)=>`${X} ${Q==="."?"":`${Q}/`}${_}`)}catch{return[]}}if(["unset","eval","set"].includes(X)){let J=Y[1]||"";return Object.keys(Z.context).filter((Q)=>Q.startsWith(J)).map((Q)=>`${X} ${Q}`)}return[]}async function hM($={}){let Z={context:$.context||{},cwd:$.cwd||process.cwd(),history:[],running:!0,lastResult:null},Y=Oq.createInterface({input:process.stdin,output:process.stdout,completer:(J)=>{return[gM(J,Z),J]},historySize:$.maxHistory||100});console.log(`
12763
12763
  ${y.bold}${y.blue}stx Interactive Mode${y.reset}
12764
12764
  ${y.dim}Type 'help' for available commands, 'exit' to quit${y.reset}
12765
12765
  `);let X=()=>{let J=Z.cwd.replace(process.env.HOME||"","~");Y.question(`${y.cyan}stx${y.reset} ${y.dim}${J}${y.reset} ${y.green}>${y.reset} `,async(Q)=>{let G=Q.trim();if(!G){if(Z.running)X();return}Z.history.push(G);let K=G.match(/(?:[^\s"]|"[^"]*")+/g)||[],W=K[0]?.toLowerCase(),_=K.slice(1).map((B)=>B.replace(/^"|"$/g,""));if(W&&o$[W])try{await o$[W].handler(_,Z)}catch(B){console.log(`${y.red}Error:${y.reset}`,B)}else if(W)if(G.includes("{{")||G.includes("}}"))try{let B=await q1(G,Z.context,"eval");console.log(`${y.green}\u2192${y.reset} ${B}`)}catch{console.log(`${y.red}Unknown command: ${W}${y.reset}`),console.log(`${y.dim}Type 'help' for available commands${y.reset}`)}else console.log(`${y.red}Unknown command: ${W}${y.reset}`),console.log(`${y.dim}Type 'help' for available commands${y.reset}`);if(Z.running)X();else Y.close()})};Y.on("SIGINT",()=>{console.log(`
@@ -12769,19 +12769,19 @@ ${y.bold}${$[0]}${y.reset} - ${Y.description}`),console.log(` Usage: ${y.cyan}$
12769
12769
  ${y.bold}Available Commands:${y.reset}
12770
12770
  `);for(let[Y,X]of Object.entries(o$))console.log(` ${y.cyan}${Y.padEnd(12)}${y.reset} ${X.description}`);console.log(`
12771
12771
  ${y.dim}Type 'help <command>' for more details${y.reset}
12772
- `)}}},render:{description:"Render a template file",usage:"render <file> [--raw]",handler:async($,Z)=>{if(!$[0]){console.log(`${y.red}Error: Please specify a file to render${y.reset}`);return}let Y=k$.resolve(Z.cwd,$[0]);if(!await Bun.file(Y).exists()){console.log(`${y.red}Error: File not found: ${Y}${y.reset}`);return}try{let X=await Bun.file(Y).text(),J=$.includes("--raw");console.log(`
12772
+ `)}}},render:{description:"Render a template file",usage:"render <file> [--raw]",handler:async($,Z)=>{if(!$[0]){console.log(`${y.red}Error: Please specify a file to render${y.reset}`);return}let Y=S$.resolve(Z.cwd,$[0]);if(!await Bun.file(Y).exists()){console.log(`${y.red}Error: File not found: ${Y}${y.reset}`);return}try{let X=await Bun.file(Y).text(),J=$.includes("--raw");console.log(`
12773
12773
  ${y.dim}Rendering ${Y}...${y.reset}
12774
12774
  `);let Q=await Z0(X,Z.context,Y,{},new Set);if(Z.lastResult=Q,J)console.log(Q);else Q.split(`
12775
12775
  `).forEach((K,W)=>{let _=String(W+1).padStart(3," ");console.log(`${y.dim}${_}${y.reset} ${K}`)});console.log()}catch(X){console.log(`${y.red}Error rendering template:${y.reset}`,X)}}},eval:{description:"Evaluate an expression",usage:"eval <expression>",handler:async($,Z)=>{if(!$.length){console.log(`${y.red}Error: Please provide an expression to evaluate${y.reset}`);return}let Y=$.join(" ");try{let X=`{{ ${Y} }}`,Q=(await q1(X,Z.context,"eval")).trim();Z.lastResult=Q,console.log(`${y.green}\u2192${y.reset} ${Q}`)}catch(X){console.log(`${y.red}Error:${y.reset}`,X)}}},set:{description:"Set a context variable",usage:"set <key> <value>",handler:async($,Z)=>{if($.length<2){console.log(`${y.red}Error: Usage: set <key> <value>${y.reset}`);return}let Y=$[0],X=$.slice(1).join(" "),J;try{J=JSON.parse(X)}catch{J=X}Z.context[Y]=J,console.log(`${y.green}\u2713${y.reset} ${Y} = ${JSON.stringify(J)}`)}},unset:{description:"Remove a context variable",usage:"unset <key>",handler:async($,Z)=>{if(!$[0]){console.log(`${y.red}Error: Please specify a variable to remove${y.reset}`);return}if($[0]in Z.context)delete Z.context[$[0]],console.log(`${y.green}\u2713${y.reset} Removed ${$[0]}`);else console.log(`${y.yellow}Variable not found: ${$[0]}${y.reset}`)}},context:{description:"Show current context variables",usage:"context",handler:async($,Z)=>{let Y=Object.keys(Z.context);if(Y.length===0){console.log(`${y.dim}Context is empty${y.reset}`);return}console.log(`
12776
12776
  ${y.bold}Context Variables:${y.reset}
12777
- `);for(let X of Y){let J=Z.context[X],Q=Array.isArray(J)?"array":typeof J,G=JSON.stringify(J).slice(0,50);console.log(` ${y.cyan}${X}${y.reset} ${y.dim}(${Q})${y.reset}: ${G}${G.length>=50?"...":""}`)}console.log()}},clear:{description:"Clear context or screen",usage:"clear [context|screen]",handler:async($,Z)=>{if($[0]==="context"||!$[0])Z.context={},console.log(`${y.green}\u2713${y.reset} Context cleared`);if($[0]==="screen"||!$[0])console.clear()}},cd:{description:"Change working directory",usage:"cd <directory>",handler:async($,Z)=>{if(!$[0]){console.log(`${y.cyan}${Z.cwd}${y.reset}`);return}let Y=k$.resolve(Z.cwd,$[0]);if(!c4.existsSync(Y)){console.log(`${y.red}Error: Directory not found: ${Y}${y.reset}`);return}if(!c4.statSync(Y).isDirectory()){console.log(`${y.red}Error: Not a directory: ${Y}${y.reset}`);return}Z.cwd=Y,console.log(`${y.green}\u2713${y.reset} ${Y}`)}},ls:{description:"List files in current directory",usage:"ls [pattern]",handler:async($,Z)=>{let Y=$[0]||"*",X=new Bun.Glob(Y),J=[];for await(let W of X.scan({cwd:Z.cwd,onlyFiles:!1}))J.push(W);if(J.length===0){console.log(`${y.dim}No files found${y.reset}`);return}J.sort();let Q=J.filter((W)=>W.endsWith(".stx")),G=J.filter((W)=>W.endsWith(".md")),K=J.filter((W)=>!W.endsWith(".stx")&&!W.endsWith(".md"));if(Q.length>0)console.log(`
12777
+ `);for(let X of Y){let J=Z.context[X],Q=Array.isArray(J)?"array":typeof J,G=JSON.stringify(J).slice(0,50);console.log(` ${y.cyan}${X}${y.reset} ${y.dim}(${Q})${y.reset}: ${G}${G.length>=50?"...":""}`)}console.log()}},clear:{description:"Clear context or screen",usage:"clear [context|screen]",handler:async($,Z)=>{if($[0]==="context"||!$[0])Z.context={},console.log(`${y.green}\u2713${y.reset} Context cleared`);if($[0]==="screen"||!$[0])console.clear()}},cd:{description:"Change working directory",usage:"cd <directory>",handler:async($,Z)=>{if(!$[0]){console.log(`${y.cyan}${Z.cwd}${y.reset}`);return}let Y=S$.resolve(Z.cwd,$[0]);if(!c4.existsSync(Y)){console.log(`${y.red}Error: Directory not found: ${Y}${y.reset}`);return}if(!c4.statSync(Y).isDirectory()){console.log(`${y.red}Error: Not a directory: ${Y}${y.reset}`);return}Z.cwd=Y,console.log(`${y.green}\u2713${y.reset} ${Y}`)}},ls:{description:"List files in current directory",usage:"ls [pattern]",handler:async($,Z)=>{let Y=$[0]||"*",X=new Bun.Glob(Y),J=[];for await(let W of X.scan({cwd:Z.cwd,onlyFiles:!1}))J.push(W);if(J.length===0){console.log(`${y.dim}No files found${y.reset}`);return}J.sort();let Q=J.filter((W)=>W.endsWith(".stx")),G=J.filter((W)=>W.endsWith(".md")),K=J.filter((W)=>!W.endsWith(".stx")&&!W.endsWith(".md"));if(Q.length>0)console.log(`
12778
12778
  ${y.bold}Templates:${y.reset}`),Q.forEach((W)=>console.log(` ${y.green}${W}${y.reset}`));if(G.length>0)console.log(`
12779
12779
  ${y.bold}Markdown:${y.reset}`),G.forEach((W)=>console.log(` ${y.blue}${W}${y.reset}`));if(K.length>0)console.log(`
12780
- ${y.bold}Other:${y.reset}`),K.forEach((W)=>console.log(` ${y.dim}${W}${y.reset}`));console.log()}},cat:{description:"Show file contents",usage:"cat <file>",handler:async($,Z)=>{if(!$[0]){console.log(`${y.red}Error: Please specify a file${y.reset}`);return}let Y=k$.resolve(Z.cwd,$[0]);if(!await Bun.file(Y).exists()){console.log(`${y.red}Error: File not found: ${Y}${y.reset}`);return}let J=(await Bun.file(Y).text()).split(`
12781
- `);console.log(),J.forEach((Q,G)=>{let K=String(G+1).padStart(3," ");console.log(`${y.dim}${K}${y.reset} ${Q}`)}),console.log()}},load:{description:"Load context from JSON file",usage:"load <file.json>",handler:async($,Z)=>{if(!$[0]){console.log(`${y.red}Error: Please specify a JSON file${y.reset}`);return}let Y=k$.resolve(Z.cwd,$[0]);if(!await Bun.file(Y).exists()){console.log(`${y.red}Error: File not found: ${Y}${y.reset}`);return}try{let X=await Bun.file(Y).text(),J=JSON.parse(X);Z.context={...Z.context,...J},console.log(`${y.green}\u2713${y.reset} Loaded ${Object.keys(J).length} variables from ${$[0]}`)}catch(X){console.log(`${y.red}Error parsing JSON:${y.reset}`,X)}}},save:{description:"Save context to JSON file",usage:"save <file.json>",handler:async($,Z)=>{if(!$[0]){console.log(`${y.red}Error: Please specify a file name${y.reset}`);return}let Y=k$.resolve(Z.cwd,$[0]);try{await Bun.write(Y,JSON.stringify(Z.context,null,2)),console.log(`${y.green}\u2713${y.reset} Context saved to ${$[0]}`)}catch(X){console.log(`${y.red}Error saving file:${y.reset}`,X)}}},history:{description:"Show command history",usage:"history [count]",handler:async($,Z)=>{let Y=$[0]?Number.parseInt($[0],10):20,X=Z.history.slice(-Y);if(X.length===0){console.log(`${y.dim}No history${y.reset}`);return}console.log(),X.forEach((J,Q)=>{let G=String(Z.history.length-X.length+Q+1).padStart(3," ");console.log(`${y.dim}${G}${y.reset} ${J}`)}),console.log()}},exit:{description:"Exit interactive mode",usage:"exit",handler:async($,Z)=>{Z.running=!1,console.log(`
12780
+ ${y.bold}Other:${y.reset}`),K.forEach((W)=>console.log(` ${y.dim}${W}${y.reset}`));console.log()}},cat:{description:"Show file contents",usage:"cat <file>",handler:async($,Z)=>{if(!$[0]){console.log(`${y.red}Error: Please specify a file${y.reset}`);return}let Y=S$.resolve(Z.cwd,$[0]);if(!await Bun.file(Y).exists()){console.log(`${y.red}Error: File not found: ${Y}${y.reset}`);return}let J=(await Bun.file(Y).text()).split(`
12781
+ `);console.log(),J.forEach((Q,G)=>{let K=String(G+1).padStart(3," ");console.log(`${y.dim}${K}${y.reset} ${Q}`)}),console.log()}},load:{description:"Load context from JSON file",usage:"load <file.json>",handler:async($,Z)=>{if(!$[0]){console.log(`${y.red}Error: Please specify a JSON file${y.reset}`);return}let Y=S$.resolve(Z.cwd,$[0]);if(!await Bun.file(Y).exists()){console.log(`${y.red}Error: File not found: ${Y}${y.reset}`);return}try{let X=await Bun.file(Y).text(),J=JSON.parse(X);Z.context={...Z.context,...J},console.log(`${y.green}\u2713${y.reset} Loaded ${Object.keys(J).length} variables from ${$[0]}`)}catch(X){console.log(`${y.red}Error parsing JSON:${y.reset}`,X)}}},save:{description:"Save context to JSON file",usage:"save <file.json>",handler:async($,Z)=>{if(!$[0]){console.log(`${y.red}Error: Please specify a file name${y.reset}`);return}let Y=S$.resolve(Z.cwd,$[0]);try{await Bun.write(Y,JSON.stringify(Z.context,null,2)),console.log(`${y.green}\u2713${y.reset} Context saved to ${$[0]}`)}catch(X){console.log(`${y.red}Error saving file:${y.reset}`,X)}}},history:{description:"Show command history",usage:"history [count]",handler:async($,Z)=>{let Y=$[0]?Number.parseInt($[0],10):20,X=Z.history.slice(-Y);if(X.length===0){console.log(`${y.dim}No history${y.reset}`);return}console.log(),X.forEach((J,Q)=>{let G=String(Z.history.length-X.length+Q+1).padStart(3," ");console.log(`${y.dim}${G}${y.reset} ${J}`)}),console.log()}},exit:{description:"Exit interactive mode",usage:"exit",handler:async($,Z)=>{Z.running=!1,console.log(`
12782
12782
  ${y.dim}Goodbye!${y.reset}
12783
- `)}},quit:{description:"Exit interactive mode (alias for exit)",usage:"quit",handler:async($,Z)=>o$.exit.handler($,Z)}}});import{createHash as dM}from"crypto";import{existsSync as l4,mkdirSync as uM,readFileSync as cJ,writeFileSync as mM,readdirSync as pM,statSync as cM}from"fs";import{basename as i4,dirname as r1,extname as n4,join as P1,relative as Fq}from"path";import{gzipSync as lM}from"zlib";class i8{config;startTime=0;outputs=[];chunks=[];assets=[];warnings=[];errors=[];moduleGraph=new Map;assetHashes=new Map;constructor($){this.config={...Vq,...$}}async build(){this.startTime=Date.now(),this.outputs=[],this.chunks=[],this.assets=[],this.warnings=[],this.errors=[];try{this.ensureDir(this.config.outDir),await this.runPluginHook("setup"),await this.runPluginHook("buildStart");let $=this.collectEntries();for(let[Y,X]of $)await this.buildEntry(Y,X);if(this.config.css?.extract)await this.extractCss();if(await this.processAssets(),this.config.splitting)await this.performCodeSplitting();if(this.config.minify)await this.minifyOutputs();if(this.config.sourcemaps)await this.generateSourceMaps();if(await this.fingerprintAssets(),this.config.compression)await this.compressOutputs();if(this.config.analyze)await this.analyzeBundle();let Z=this.getResult();return await this.runPluginHook("buildEnd",Z),Z}catch($){return this.errors.push(String($)),this.getResult()}}collectEntries(){let $=new Map,{entry:Z}=this.config;if(typeof Z==="string")$.set("main",Z);else if(Array.isArray(Z))Z.forEach((Y,X)=>{let J=i4(Y,n4(Y));$.set(J,Y)});else if(typeof Z==="object")Object.entries(Z).forEach(([Y,X])=>{$.set(Y,X)});return $}async buildEntry($,Z){if(!await Bun.file(Z).exists()){this.errors.push(`Entry point not found: ${Z}`);return}let Y=await Bun.file(Z).text(),X=n4(Z),J=Y,Q="js";if(X===".stx"||X===".html")Q="html",J=await this.processTemplate(Y,Z);else if(X===".css")Q="css",J=await this.processCss(Y,Z);else if(X===".js"||X===".ts")Q="js",J=await this.processScript(Y,Z);J=await this.runPluginTransform(J,Z);let G=this.generateHash(J),K=this.getOutputName($,Q,G),W=P1(this.config.outDir,K);this.ensureDir(r1(W)),await Bun.write(W,J),this.outputs.push({path:W,type:Q,size:Buffer.byteLength(J),hash:G,sources:[Z],isEntry:!0})}resolveRelativePath($,Z){if(Z.startsWith("/"))return P1(r1($),"..",Z);return P1(r1($),Z)}async processTemplate($,Z){let Y=$,X=[],J=[];if(Y=Y.replace(/<script\b([^>]*)\bstx-inline\b([^>]*)(?:><\/script>|><\/script>|\/>)/gi,(Q,G,K)=>{let W=(G+K).match(/src=["']([^"']+)["']/);if(W){let _=this.resolveRelativePath(Z,W[1]);if(l4(_)){let B=cJ(_,"utf-8");X.push(`// Source: ${W[1]}
12784
- ${B}`)}else this.warnings.push(`External script not found: ${_}`)}return""}),Y=Y.replace(/<link\b([^>]*)\bstx-inline\b([^>]*)(?:\/>|>)/gi,(Q,G,K)=>{let W=(G+K).match(/href=["']([^"']+)["']/);if(W){let _=this.resolveRelativePath(Z,W[1]);if(l4(_)){let B=cJ(_,"utf-8");J.push(`/* Source: ${W[1]} */
12783
+ `)}},quit:{description:"Exit interactive mode (alias for exit)",usage:"quit",handler:async($,Z)=>o$.exit.handler($,Z)}}});import{createHash as dM}from"crypto";import{existsSync as l4,mkdirSync as uM,readFileSync as p2,writeFileSync as mM,readdirSync as pM,statSync as cM}from"fs";import{basename as i4,dirname as r1,extname as n4,join as P1,relative as Fq}from"path";import{gzipSync as lM}from"zlib";class i8{config;startTime=0;outputs=[];chunks=[];assets=[];warnings=[];errors=[];moduleGraph=new Map;assetHashes=new Map;constructor($){this.config={...Vq,...$}}async build(){this.startTime=Date.now(),this.outputs=[],this.chunks=[],this.assets=[],this.warnings=[],this.errors=[];try{this.ensureDir(this.config.outDir),await this.runPluginHook("setup"),await this.runPluginHook("buildStart");let $=this.collectEntries();for(let[Y,X]of $)await this.buildEntry(Y,X);if(this.config.css?.extract)await this.extractCss();if(await this.processAssets(),this.config.splitting)await this.performCodeSplitting();if(this.config.minify)await this.minifyOutputs();if(this.config.sourcemaps)await this.generateSourceMaps();if(await this.fingerprintAssets(),this.config.compression)await this.compressOutputs();if(this.config.analyze)await this.analyzeBundle();let Z=this.getResult();return await this.runPluginHook("buildEnd",Z),Z}catch($){return this.errors.push(String($)),this.getResult()}}collectEntries(){let $=new Map,{entry:Z}=this.config;if(typeof Z==="string")$.set("main",Z);else if(Array.isArray(Z))Z.forEach((Y,X)=>{let J=i4(Y,n4(Y));$.set(J,Y)});else if(typeof Z==="object")Object.entries(Z).forEach(([Y,X])=>{$.set(Y,X)});return $}async buildEntry($,Z){if(!await Bun.file(Z).exists()){this.errors.push(`Entry point not found: ${Z}`);return}let Y=await Bun.file(Z).text(),X=n4(Z),J=Y,Q="js";if(X===".stx"||X===".html")Q="html",J=await this.processTemplate(Y,Z);else if(X===".css")Q="css",J=await this.processCss(Y,Z);else if(X===".js"||X===".ts")Q="js",J=await this.processScript(Y,Z);J=await this.runPluginTransform(J,Z);let G=this.generateHash(J),K=this.getOutputName($,Q,G),W=P1(this.config.outDir,K);this.ensureDir(r1(W)),await Bun.write(W,J),this.outputs.push({path:W,type:Q,size:Buffer.byteLength(J),hash:G,sources:[Z],isEntry:!0})}resolveRelativePath($,Z){if(Z.startsWith("/"))return P1(r1($),"..",Z);return P1(r1($),Z)}async processTemplate($,Z){let Y=$,X=[],J=[];if(Y=Y.replace(/<script\b([^>]*)\bstx-inline\b([^>]*)(?:><\/script>|><\/script>|\/>)/gi,(Q,G,K)=>{let W=(G+K).match(/src=["']([^"']+)["']/);if(W){let _=this.resolveRelativePath(Z,W[1]);if(l4(_)){let B=p2(_,"utf-8");X.push(`// Source: ${W[1]}
12784
+ ${B}`)}else this.warnings.push(`External script not found: ${_}`)}return""}),Y=Y.replace(/<link\b([^>]*)\bstx-inline\b([^>]*)(?:\/>|>)/gi,(Q,G,K)=>{let W=(G+K).match(/href=["']([^"']+)["']/);if(W){let _=this.resolveRelativePath(Z,W[1]);if(l4(_)){let B=p2(_,"utf-8");J.push(`/* Source: ${W[1]} */
12785
12785
  ${B}`)}else this.warnings.push(`External stylesheet not found: ${_}`)}return""}),Y=Y.replace(/<script\b(?![^>]*\bstx-inline\b)([^>]*)>([\s\S]*?)<\/script>/gi,(Q,G,K)=>{if(/\bsrc=/.test(G))return Q;if(K.trim())X.push(K);return""}),Y=Y.replace(/<style\b[^>]*>([\s\S]*?)<\/style>/gi,(Q,G)=>{if(G.trim())J.push(G);return""}),X.length>0){let Q=X.join(`
12786
12786
 
12787
12787
  `),G=this.generateHash(Q).slice(0,8),K=`assets/app.${G}.js`,W=P1(this.config.outDir,K);this.ensureDir(r1(W)),await Bun.write(W,Q),this.outputs.push({path:W,type:"js",size:Buffer.byteLength(Q),hash:G,sources:[Z]});let _=Y.lastIndexOf("</body>");if(_!==-1)Y=Y.slice(0,_)+`<script src="${this.config.publicPath}${K}"></script>
@@ -12789,7 +12789,7 @@ ${B}`)}else this.warnings.push(`External stylesheet not found: ${_}`)}return""})
12789
12789
 
12790
12790
  `),G=this.generateHash(Q).slice(0,8),K=`assets/app.${G}.css`,W=P1(this.config.outDir,K);this.ensureDir(r1(W)),await Bun.write(W,Q),this.outputs.push({path:W,type:"css",size:Buffer.byteLength(Q),hash:G,sources:[Z]}),Y=Y.replace("</head>",`<link rel="stylesheet" href="${this.config.publicPath}${K}">
12791
12791
  </head>`)}return Y}async processCss($,Z){let Y=$;if(typeof this.config.minify==="object"&&this.config.minify.css)Y=this.minifyCss(Y);return Y}async processScript($,Z){let Y=$;if(this.config.define)for(let[X,J]of Object.entries(this.config.define))Y=Y.replace(new RegExp(X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),J);return Y}async extractCss(){let $=[];for(let Q of this.outputs)if(Q.type==="css"){let G=await Bun.file(Q.path).text();$.push(G)}if($.length===0)return;let Z=$.join(`
12792
- `),Y=this.generateHash(Z).slice(0,8),X=(this.config.css?.filename||"assets/[name].[hash].css").replace("[name]","styles").replace("[hash]",Y),J=P1(this.config.outDir,X);this.ensureDir(r1(J)),await Bun.write(J,Z),this.outputs.push({path:J,type:"css",size:Buffer.byteLength(Z),hash:Y})}async processAssets(){let $=P1(r1(this.config.outDir),"public");if(!l4($))return;let Z=this.config.assets||{},Y=Z.include||[];this.walkDir($,(X)=>{let J=n4(X).slice(1).toLowerCase();if(!Y.includes(J))return;let Q=cJ(X),G=Q.length;if(Z.inlineLimit&&G<Z.inlineLimit)return;let K=Z.hash?this.generateHash(Q).slice(0,Z.hashLength||8):"",W=(Z.filename||"assets/[name].[hash][ext]").replace("[name]",i4(X,n4(X))).replace("[hash]",K).replace("[ext]",n4(X)),_=P1(this.config.outDir,W);this.ensureDir(r1(_)),mM(_,Q),this.assetHashes.set(X,W),this.assets.push({name:i4(X),file:W,size:G,source:X}),this.outputs.push({path:_,type:"asset",size:G,hash:K,sources:[X]})})}async performCodeSplitting(){if((typeof this.config.splitting==="object"?this.config.splitting:{}).vendor){let Z=[];this.chunks.push({name:"vendor",file:"assets/vendor.js",size:0,modules:Z,isVendor:!0,imports:[],dynamicImports:[]})}}async minifyOutputs(){let $=typeof this.config.minify==="object"?this.config.minify:{};for(let Z of this.outputs){let Y=await Bun.file(Z.path).text(),X=Y;if(Z.type==="js"&&$.js)X=this.minifyJs(Y);else if(Z.type==="css"&&$.css)X=this.minifyCss(Y);else if(Z.type==="html"&&$.html)X=this.minifyHtml(Y);if(X!==Y)await Bun.write(Z.path,X),Z.size=Buffer.byteLength(X)}}minifyJs($){let Z=typeof this.config.minify==="object"?this.config.minify:{},Y=$;if(Y=Y.replace(/\/\*[\s\S]*?\*\//g,""),Y=Y.replace(/\/\/.*$/gm,""),Z.dropConsole)Y=Y.replace(/console\.(log|debug|info|warn)\([^)]*\);?/g,"");if(Z.dropDebugger)Y=Y.replace(/debugger;?/g,"");return Y=Y.replace(/\s+/g," "),Y=Y.replace(/\s*([{};,:])\s*/g,"$1"),Y=Y.replace(/;\}/g,"}"),Y.trim()}minifyCss($){let Z=$;return Z=Z.replace(/\/\*[\s\S]*?\*\//g,""),Z=Z.replace(/\s+/g," "),Z=Z.replace(/\s*([{};:,>+~])\s*/g,"$1"),Z=Z.replace(/;}/g,"}"),Z=Z.replace(/[^{}]+\{\s*\}/g,""),Z.trim()}minifyHtml($){let Z=$;return Z=Z.replace(/<!--(?!\[if)[\s\S]*?-->/g,""),Z=Z.replace(/>\s+</g,"><"),Z=Z.replace(/\s+>/g,">"),Z=Z.replace(/<\s+/g,"<"),Z=Z.replace(/\s{2,}/g," "),Z.trim()}async generateSourceMaps(){if(!this.config.sourcemaps)return;for(let $ of this.outputs)if($.type==="js"||$.type==="css"){let Z=await Bun.file($.path).text(),Y=[];for(let G of $.sources||[])if(await Bun.file(G).exists())Y.push(await Bun.file(G).text());else Y.push(null);let X={version:3,file:i4($.path),sources:$.sources||[],sourcesContent:Y,mappings:"",names:[]},J=`${$.path}.map`;await Bun.write(J,JSON.stringify(X));let Q=this.config.sourcemaps==="inline"?`
12792
+ `),Y=this.generateHash(Z).slice(0,8),X=(this.config.css?.filename||"assets/[name].[hash].css").replace("[name]","styles").replace("[hash]",Y),J=P1(this.config.outDir,X);this.ensureDir(r1(J)),await Bun.write(J,Z),this.outputs.push({path:J,type:"css",size:Buffer.byteLength(Z),hash:Y})}async processAssets(){let $=P1(r1(this.config.outDir),"public");if(!l4($))return;let Z=this.config.assets||{},Y=Z.include||[];this.walkDir($,(X)=>{let J=n4(X).slice(1).toLowerCase();if(!Y.includes(J))return;let Q=p2(X),G=Q.length;if(Z.inlineLimit&&G<Z.inlineLimit)return;let K=Z.hash?this.generateHash(Q).slice(0,Z.hashLength||8):"",W=(Z.filename||"assets/[name].[hash][ext]").replace("[name]",i4(X,n4(X))).replace("[hash]",K).replace("[ext]",n4(X)),_=P1(this.config.outDir,W);this.ensureDir(r1(_)),mM(_,Q),this.assetHashes.set(X,W),this.assets.push({name:i4(X),file:W,size:G,source:X}),this.outputs.push({path:_,type:"asset",size:G,hash:K,sources:[X]})})}async performCodeSplitting(){if((typeof this.config.splitting==="object"?this.config.splitting:{}).vendor){let Z=[];this.chunks.push({name:"vendor",file:"assets/vendor.js",size:0,modules:Z,isVendor:!0,imports:[],dynamicImports:[]})}}async minifyOutputs(){let $=typeof this.config.minify==="object"?this.config.minify:{};for(let Z of this.outputs){let Y=await Bun.file(Z.path).text(),X=Y;if(Z.type==="js"&&$.js)X=this.minifyJs(Y);else if(Z.type==="css"&&$.css)X=this.minifyCss(Y);else if(Z.type==="html"&&$.html)X=this.minifyHtml(Y);if(X!==Y)await Bun.write(Z.path,X),Z.size=Buffer.byteLength(X)}}minifyJs($){let Z=typeof this.config.minify==="object"?this.config.minify:{},Y=$;if(Y=Y.replace(/\/\*[\s\S]*?\*\//g,""),Y=Y.replace(/\/\/.*$/gm,""),Z.dropConsole)Y=Y.replace(/console\.(log|debug|info|warn)\([^)]*\);?/g,"");if(Z.dropDebugger)Y=Y.replace(/debugger;?/g,"");return Y=Y.replace(/\s+/g," "),Y=Y.replace(/\s*([{};,:])\s*/g,"$1"),Y=Y.replace(/;\}/g,"}"),Y.trim()}minifyCss($){let Z=$;return Z=Z.replace(/\/\*[\s\S]*?\*\//g,""),Z=Z.replace(/\s+/g," "),Z=Z.replace(/\s*([{};:,>+~])\s*/g,"$1"),Z=Z.replace(/;}/g,"}"),Z=Z.replace(/[^{}]+\{\s*\}/g,""),Z.trim()}minifyHtml($){let Z=$;return Z=Z.replace(/<!--(?!\[if)[\s\S]*?-->/g,""),Z=Z.replace(/>\s+</g,"><"),Z=Z.replace(/\s+>/g,">"),Z=Z.replace(/<\s+/g,"<"),Z=Z.replace(/\s{2,}/g," "),Z.trim()}async generateSourceMaps(){if(!this.config.sourcemaps)return;for(let $ of this.outputs)if($.type==="js"||$.type==="css"){let Z=await Bun.file($.path).text(),Y=[];for(let G of $.sources||[])if(await Bun.file(G).exists())Y.push(await Bun.file(G).text());else Y.push(null);let X={version:3,file:i4($.path),sources:$.sources||[],sourcesContent:Y,mappings:"",names:[]},J=`${$.path}.map`;await Bun.write(J,JSON.stringify(X));let Q=this.config.sourcemaps==="inline"?`
12793
12793
  //# sourceMappingURL=data:application/json;base64,${Buffer.from(JSON.stringify(X)).toString("base64")}`:`
12794
12794
  //# sourceMappingURL=${i4(J)}`;if(this.config.sourcemaps!=="hidden")await Bun.write($.path,Z+Q);this.outputs.push({path:J,type:"map",size:cM(J).size})}}async fingerprintAssets(){for(let $ of this.outputs)if($.type==="html"){let Z=await Bun.file($.path).text();for(let[Y,X]of this.assetHashes){let J=Fq(r1($.path),Y);Z=Z.replace(new RegExp(J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),`${this.config.publicPath}${X}`)}await Bun.write($.path,Z)}}async compressOutputs(){let $=this.config.compression||{},Z=$.threshold||1024;for(let Y of this.outputs){if(Y.type==="map")continue;if(Y.size<Z)continue;let X=Buffer.from(await Bun.file(Y.path).arrayBuffer());if($.gzip){let J=lM(X,{level:9}),Q=`${Y.path}.gz`;await Bun.write(Q,J),Y.gzipSize=J.length}if($.brotli)try{let{brotliCompressSync:J}=await import("zlib"),Q=J(X);await Bun.write(`${Y.path}.br`,Q)}catch{}}}async analyzeBundle(){let $=typeof this.config.analyze==="object"?this.config.analyze:{},Z=$.format||"text",Y={outputs:this.outputs.map((G)=>({path:Fq(this.config.outDir,G.path),type:G.type,size:G.size,gzipSize:G.gzipSize,sizeFormatted:this.formatSize(G.size),gzipSizeFormatted:G.gzipSize?this.formatSize(G.gzipSize):void 0})),chunks:this.chunks,assets:this.assets,totalSize:this.outputs.reduce((G,K)=>G+K.size,0),totalGzipSize:this.outputs.reduce((G,K)=>G+(K.gzipSize||0),0)},X;if(Z==="json")X=JSON.stringify(Y,null,2);else if(Z==="html")X=this.generateAnalysisHtml(Y);else X=this.generateAnalysisText(Y);let J=$.filename||`bundle-analysis.${Z==="html"?"html":Z==="json"?"json":"txt"}`,Q=P1(this.config.outDir,J);await Bun.write(Q,X),console.log(`
12795
12795
  \uD83D\uDCCA Bundle Analysis`),console.log("\u2500".repeat(50));for(let G of Y.outputs){let K=G.gzipSizeFormatted?` (gzip: ${G.gzipSizeFormatted})`:"";console.log(` ${G.path}: ${G.sizeFormatted}${K}`)}console.log("\u2500".repeat(50)),console.log(` Total: ${this.formatSize(Y.totalSize)} (gzip: ${this.formatSize(Y.totalGzipSize)})`),console.log("")}generateAnalysisHtml($){return`<!DOCTYPE html>
@@ -12832,14 +12832,14 @@ ${B}`)}else this.warnings.push(`External stylesheet not found: ${_}`)}return""})
12832
12832
  </table>
12833
12833
  </body>
12834
12834
  </html>`}generateAnalysisText($){let Z=["Bundle Analysis","=".repeat(50),""];for(let Y of $.outputs)Z.push(`${Y.path}`),Z.push(` Size: ${Y.sizeFormatted}${Y.gzipSizeFormatted?` (gzip: ${Y.gzipSizeFormatted})`:""}`),Z.push("");return Z.push("=".repeat(50)),Z.push(`Total: ${this.formatSize($.totalSize)} (gzip: ${this.formatSize($.totalGzipSize)})`),Z.join(`
12835
- `)}async runPluginHook($,Z){if(!this.config.plugins)return;for(let Y of this.config.plugins){let X=Y[$];if(typeof X==="function")await X.call(Y,Z||this)}}async runPluginTransform($,Z){if(!this.config.plugins)return $;let Y=$;for(let X of this.config.plugins)if(X.transform){let J=await X.transform(Y,Z);if(J!=null)Y=J}return Y}generateHash($){return dM("sha256").update($).digest("hex")}getOutputName($,Z,Y){let X=Z==="html"?".html":Z==="css"?".css":Z==="js"?".js":"";return`${$}.${Y.slice(0,8)}${X}`}formatSize($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(2)} KB`;return`${($/1048576).toFixed(2)} MB`}ensureDir($){if(!l4($))uM($,{recursive:!0})}walkDir($,Z){if(!l4($))return;let Y=pM($,{withFileTypes:!0});for(let X of Y){let J=P1($,X.name);if(X.isDirectory())this.walkDir(J,Z);else Z(J)}}getResult(){let $=Date.now()-this.startTime,Z=this.outputs.reduce((X,J)=>X+J.size,0),Y=this.outputs.reduce((X,J)=>X+(J.gzipSize||0),0);return{outputs:this.outputs,duration:$,totalSize:Z,gzipSize:Y,chunks:this.chunks,assets:this.assets,warnings:this.warnings,errors:this.errors}}}async function iM($){return new i8($).build()}function nM($){return new i8($)}function sM($){return{...Vq,...$}}var Vq;var Nq=D(()=>{Vq={outDir:"dist",publicPath:"/",sourcemaps:!0,minify:{js:!0,css:!0,html:!0,dropConsole:!0,dropDebugger:!0,mangle:!0},splitting:{vendor:!0,minSize:20000,maxSize:250000,chunkNames:"deterministic"},css:{extract:!0,minify:!0,filename:"assets/[name].[hash].css"},assets:{inlineLimit:4096,filename:"assets/[name].[hash][ext]",hash:!0,hashLength:8,include:["png","jpg","jpeg","gif","svg","webp","woff","woff2","ttf","eot"]},compression:{gzip:!0,brotli:!0,threshold:1024,deleteOriginal:!1}}});async function lJ($,Z={}){if(!$.hasServerScripts&&!K5($.html))return $.html;let Y={__filename:$.sourceFile,__dirname:$.sourceFile.replace(/[/\\][^/\\]+$/,""),...Z};for(let J of $.serverScriptContent)try{await R0(J,Y,$.sourceFile)}catch(Q){console.warn(`[stx] Server script error in ${$.sourceFile}:`,Q)}if(!K5($.html))return $.html;let X=new Map;for(let[J,Q]of Object.entries($.placeholders))if(Q.expression)try{let G=Y1(Q.expression,Y);if(Q.type==="raw")X.set(J,G!==void 0&&G!==null?String(G):"");else X.set(J,G!==void 0&&G!==null?w0(String(G)):"")}catch{X.set(J,"")}return S6($.html,X)}async function rM($,Z={}){if(!$.hasServerScripts&&!K5($.fragment))return $.fragment;let Y={__filename:$.sourceFile,__dirname:$.sourceFile.replace(/[/\\][^/\\]+$/,""),...Z};for(let J of $.serverScriptContent)try{await R0(J,Y,$.sourceFile)}catch(Q){console.warn(`[stx] Server script error in ${$.sourceFile}:`,Q)}if(!K5($.fragment))return $.fragment;let X=new Map;for(let[J,Q]of Object.entries($.placeholders))if(Q.expression)try{let G=Y1(Q.expression,Y);if(Q.type==="raw")X.set(J,G!==void 0&&G!==null?String(G):"");else X.set(J,G!==void 0&&G!==null?w0(String(G)):"")}catch{X.set(J,"")}return S6($.fragment,X)}var iJ=D(()=>{F$();d0();S7()});import Aq from"fs";import S$ from"path";var{serve:oM}=globalThis.Bun;async function tM($={}){let Z=S$.resolve($.outputDir||".output"),Y=$.port||3000,X=IJ(Z);if(!X)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${X.routes.length} routes...`);let J=new Map,Q=new Map;for(let _ of X.routes)try{let B=S$.join(Z,_.compiledPath),U=JSON.parse(await Bun.file(B).text());J.set(_.pattern,U);let z=S$.join(Z,_.fragmentPath);if(await Bun.file(z).exists())Q.set(_.pattern,await Bun.file(z).text())}catch(B){console.warn(`[stx] Failed to load route ${_.pattern}:`,B)}let G=new Map,K=[];for(let _ of X.routes)if(_.hasParams){let B=[],U=_.pattern.replace(/:([^/]+)/g,(z,q)=>{return B.push(q),"([^/]+)"});K.push({regex:new RegExp(`^${U}$`),route:_,paramNames:B})}else G.set(_.pattern,_);let W=oM({port:Y,async fetch(_){let U=new URL(_.url).pathname;if($.onRequest){let O=await $.onRequest(_);if(O)return O}if($.apiRoutes?.[U])return $.apiRoutes[U](_);if((_.method==="GET"||_.method==="HEAD")&&U!=="/"){let O=S$.resolve(Z,"public"),F;try{F=decodeURIComponent(U)}catch{F=U}if(!F.includes("\x00")){let L=S$.resolve(O,`.${F}`);if(L===O||L.startsWith(`${O}${S$.sep}`))try{if(Aq.existsSync(L)&&Aq.statSync(L).isFile()){let A=S$.extname(L).toLowerCase(),N=aM[A]||"application/octet-stream",w=U.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(U);return new Response(Bun.file(L),{headers:{"Content-Type":N,"Cache-Control":w?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let z=_.headers.get("X-STX-Router")==="true",q=null,j={};if(q=G.get(U)||null,!q)for(let{regex:O,route:F,paramNames:L}of K){let V=U.match(O);if(V){q=F,L.forEach((A,N)=>{j[A]=V[N+1]});break}}if(!q){let O=G.get("/404")||null;if(O){let F=J.get(O.compiledPath);if(F)return new Response(F.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}if(z){let O=Q.get(q.pattern);if(O)return new Response(O,{headers:{"Content-Type":"text/html","X-STX-Fragment":"true","Cache-Control":"no-cache"}})}let H=J.get(q.pattern);if(!H)return new Response("Internal Server Error",{status:500});if(!H.hasServerScripts&&Object.keys(H.placeholders).length===0)return new Response(H.html,{headers:{"Content-Type":"text/html","Cache-Control":"public, max-age=60"}});try{let O=await lJ(H,{params:j,request:_});return new Response(O,{headers:{"Content-Type":"text/html","Cache-Control":"no-cache"}})}catch(O){return console.error(`[stx] Hydration error for ${U}:`,O),new Response(H.html,{headers:{"Content-Type":"text/html"}})}}});return console.log(`[stx] Production server running at http://localhost:${Y}`),console.log(`[stx] Serving ${X.routes.length} routes (${J.size} pre-loaded)`),{port:Y,stop:()=>W.stop()}}var aM;var wq=D(()=>{x8();iJ();aM={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"}});var eM="f9c3713";import{existsSync as s4,mkdirSync as nJ}from"fs";import{join as b$,dirname as $T}from"path";import{execSync as Rq}from"child_process";async function YT($,Z={}){let Y={success:!0,message:"",files:[],errors:[]},X=Z.template||"default",J=b$(process.cwd(),$);if(s4(J))return Y.success=!1,Y.message=`Directory ${$} already exists`,Y;try{nJ(J,{recursive:!0});let Q=XT(X);for(let K of Q)nJ(b$(J,K),{recursive:!0});let G=JT(X,$,Z);for(let[K,W]of Object.entries(G)){let _=b$(J,K);r4($T(_)),await Bun.write(_,W),Y.files.push(K)}if(!Z.skipGit)try{Rq("git init",{cwd:J,stdio:"ignore"}),await Bun.write(b$(J,".gitignore"),LT()),Y.files.push(".gitignore")}catch{Y.errors.push("Failed to initialize git repository")}if(!Z.skipInstall){let K=Z.packageManager||gT();try{console.log(`
12835
+ `)}async runPluginHook($,Z){if(!this.config.plugins)return;for(let Y of this.config.plugins){let X=Y[$];if(typeof X==="function")await X.call(Y,Z||this)}}async runPluginTransform($,Z){if(!this.config.plugins)return $;let Y=$;for(let X of this.config.plugins)if(X.transform){let J=await X.transform(Y,Z);if(J!=null)Y=J}return Y}generateHash($){return dM("sha256").update($).digest("hex")}getOutputName($,Z,Y){let X=Z==="html"?".html":Z==="css"?".css":Z==="js"?".js":"";return`${$}.${Y.slice(0,8)}${X}`}formatSize($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(2)} KB`;return`${($/1048576).toFixed(2)} MB`}ensureDir($){if(!l4($))uM($,{recursive:!0})}walkDir($,Z){if(!l4($))return;let Y=pM($,{withFileTypes:!0});for(let X of Y){let J=P1($,X.name);if(X.isDirectory())this.walkDir(J,Z);else Z(J)}}getResult(){let $=Date.now()-this.startTime,Z=this.outputs.reduce((X,J)=>X+J.size,0),Y=this.outputs.reduce((X,J)=>X+(J.gzipSize||0),0);return{outputs:this.outputs,duration:$,totalSize:Z,gzipSize:Y,chunks:this.chunks,assets:this.assets,warnings:this.warnings,errors:this.errors}}}async function iM($){return new i8($).build()}function nM($){return new i8($)}function sM($){return{...Vq,...$}}var Vq;var Nq=D(()=>{Vq={outDir:"dist",publicPath:"/",sourcemaps:!0,minify:{js:!0,css:!0,html:!0,dropConsole:!0,dropDebugger:!0,mangle:!0},splitting:{vendor:!0,minSize:20000,maxSize:250000,chunkNames:"deterministic"},css:{extract:!0,minify:!0,filename:"assets/[name].[hash].css"},assets:{inlineLimit:4096,filename:"assets/[name].[hash][ext]",hash:!0,hashLength:8,include:["png","jpg","jpeg","gif","svg","webp","woff","woff2","ttf","eot"]},compression:{gzip:!0,brotli:!0,threshold:1024,deleteOriginal:!1}}});async function c2($,Z={}){if(!$.hasServerScripts&&!K5($.html))return $.html;let Y={__filename:$.sourceFile,__dirname:$.sourceFile.replace(/[/\\][^/\\]+$/,""),...Z};for(let J of $.serverScriptContent)try{await R0(J,Y,$.sourceFile)}catch(Q){console.warn(`[stx] Server script error in ${$.sourceFile}:`,Q)}if(!K5($.html))return $.html;let X=new Map;for(let[J,Q]of Object.entries($.placeholders))if(Q.expression)try{let G=Y1(Q.expression,Y);if(Q.type==="raw")X.set(J,G!==void 0&&G!==null?String(G):"");else X.set(J,G!==void 0&&G!==null?w0(String(G)):"")}catch{X.set(J,"")}return S6($.html,X)}async function rM($,Z={}){if(!$.hasServerScripts&&!K5($.fragment))return $.fragment;let Y={__filename:$.sourceFile,__dirname:$.sourceFile.replace(/[/\\][^/\\]+$/,""),...Z};for(let J of $.serverScriptContent)try{await R0(J,Y,$.sourceFile)}catch(Q){console.warn(`[stx] Server script error in ${$.sourceFile}:`,Q)}if(!K5($.fragment))return $.fragment;let X=new Map;for(let[J,Q]of Object.entries($.placeholders))if(Q.expression)try{let G=Y1(Q.expression,Y);if(Q.type==="raw")X.set(J,G!==void 0&&G!==null?String(G):"");else X.set(J,G!==void 0&&G!==null?w0(String(G)):"")}catch{X.set(J,"")}return S6($.fragment,X)}var l2=D(()=>{V$();d0();S7()});import Aq from"fs";import b$ from"path";var{serve:oM}=globalThis.Bun;async function tM($={}){let Z=b$.resolve($.outputDir||".output"),Y=$.port||3000,X=E2(Z);if(!X)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${X.routes.length} routes...`);let J=new Map,Q=new Map;for(let _ of X.routes)try{let B=b$.join(Z,_.compiledPath),U=JSON.parse(await Bun.file(B).text());J.set(_.pattern,U);let z=b$.join(Z,_.fragmentPath);if(await Bun.file(z).exists())Q.set(_.pattern,await Bun.file(z).text())}catch(B){console.warn(`[stx] Failed to load route ${_.pattern}:`,B)}let G=new Map,K=[];for(let _ of X.routes)if(_.hasParams){let B=[],U=_.pattern.replace(/:([^/]+)/g,(z,q)=>{return B.push(q),"([^/]+)"});K.push({regex:new RegExp(`^${U}$`),route:_,paramNames:B})}else G.set(_.pattern,_);let W=oM({port:Y,async fetch(_){let U=new URL(_.url).pathname;if($.onRequest){let O=await $.onRequest(_);if(O)return O}if($.apiRoutes?.[U])return $.apiRoutes[U](_);if((_.method==="GET"||_.method==="HEAD")&&U!=="/"){let O=b$.resolve(Z,"public"),F;try{F=decodeURIComponent(U)}catch{F=U}if(!F.includes("\x00")){let L=b$.resolve(O,`.${F}`);if(L===O||L.startsWith(`${O}${b$.sep}`))try{if(Aq.existsSync(L)&&Aq.statSync(L).isFile()){let A=b$.extname(L).toLowerCase(),N=aM[A]||"application/octet-stream",w=U.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(U);return new Response(Bun.file(L),{headers:{"Content-Type":N,"Cache-Control":w?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let z=_.headers.get("X-STX-Router")==="true",q=null,j={};if(q=G.get(U)||null,!q)for(let{regex:O,route:F,paramNames:L}of K){let V=U.match(O);if(V){q=F,L.forEach((A,N)=>{j[A]=V[N+1]});break}}if(!q){let O=G.get("/404")||null;if(O){let F=J.get(O.compiledPath);if(F)return new Response(F.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}if(z){let O=Q.get(q.pattern);if(O)return new Response(O,{headers:{"Content-Type":"text/html","X-STX-Fragment":"true","Cache-Control":"no-cache"}})}let H=J.get(q.pattern);if(!H)return new Response("Internal Server Error",{status:500});if(!H.hasServerScripts&&Object.keys(H.placeholders).length===0)return new Response(H.html,{headers:{"Content-Type":"text/html","Cache-Control":"public, max-age=60"}});try{let O=await c2(H,{params:j,request:_});return new Response(O,{headers:{"Content-Type":"text/html","Cache-Control":"no-cache"}})}catch(O){return console.error(`[stx] Hydration error for ${U}:`,O),new Response(H.html,{headers:{"Content-Type":"text/html"}})}}});return console.log(`[stx] Production server running at http://localhost:${Y}`),console.log(`[stx] Serving ${X.routes.length} routes (${J.size} pre-loaded)`),{port:Y,stop:()=>W.stop()}}var aM;var wq=D(()=>{x8();l2();aM={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"}});var eM="f9c3713";import{existsSync as s4,mkdirSync as i2}from"fs";import{join as C$,dirname as $T}from"path";import{execSync as Rq}from"child_process";async function YT($,Z={}){let Y={success:!0,message:"",files:[],errors:[]},X=Z.template||"default",J=C$(process.cwd(),$);if(s4(J))return Y.success=!1,Y.message=`Directory ${$} already exists`,Y;try{i2(J,{recursive:!0});let Q=XT(X);for(let K of Q)i2(C$(J,K),{recursive:!0});let G=JT(X,$,Z);for(let[K,W]of Object.entries(G)){let _=C$(J,K);r4($T(_)),await Bun.write(_,W),Y.files.push(K)}if(!Z.skipGit)try{Rq("git init",{cwd:J,stdio:"ignore"}),await Bun.write(C$(J,".gitignore"),LT()),Y.files.push(".gitignore")}catch{Y.errors.push("Failed to initialize git repository")}if(!Z.skipInstall){let K=Z.packageManager||gT();try{console.log(`
12836
12836
  Installing dependencies with ${K}...`),Rq(`${K} install`,{cwd:J,stdio:"inherit"})}catch{Y.errors.push("Failed to install dependencies")}}Y.message=`Created project: ${$}`,console.log(`
12837
12837
  \u2705 ${Y.message}
12838
12838
 
12839
12839
  Next steps:
12840
12840
  cd ${$}
12841
12841
  ${Z.packageManager||"bun"} run dev
12842
- `)}catch(Q){Y.success=!1,Y.message=`Failed to create project: ${Q}`}return Y}function XT($){let Z=["pages","components","layouts","partials","public"];switch($){case"minimal":return["src","public"];case"full":return[...Z,"src/stores","src/api","src/i18n","src/utils","test"];case"blog":return[...Z,"src/posts","src/utils"];case"dashboard":return[...Z,"src/stores","src/api","src/utils"];case"landing":return[...Z,"src/sections"];default:return[...Z,"src/stores"]}}function JT($,Z,Y){let X={};if(X["package.json"]=qT(Z,$,Y),X["stx.config.ts"]=jT($,Y),X["README.md"]=OT(Z,$),Y.typescript!==!1)X["tsconfig.json"]=HT();switch($){case"minimal":X["src/index.stx"]=FT();break;case"blog":X["pages/index.stx"]=wT(),X["pages/[slug].stx"]=RT(),X["layouts/app.stx"]=MT(),X["components/PostCard.stx"]=TT();break;case"dashboard":X["pages/index.stx"]=ET(),X["pages/settings.stx"]=IT(),X["layouts/app.stx"]=DT(),X["components/Sidebar.stx"]=kT(),X["components/StatsCard.stx"]=ST(),X["src/stores/dashboard.ts"]=bT();break;case"landing":X["pages/index.stx"]=CT(),X["layouts/app.stx"]=yT(),X["src/sections/Hero.stx"]=PT(),X["src/sections/Features.stx"]=xT(),X["src/sections/Pricing.stx"]=vT(),X["components/Button.stx"]=fT();break;case"full":X["pages/index.stx"]=Mq(),X["pages/about.stx"]=VT(),X["layouts/app.stx"]=Tq(),X["components/Header.stx"]=Eq(),X["components/Footer.stx"]=Iq(),X["src/stores/app.ts"]=Dq(),X["src/i18n/en.json"]=NT("en"),X["test/example.test.ts"]=AT();break;default:X["pages/index.stx"]=Mq(),X["layouts/app.stx"]=Tq(),X["components/Header.stx"]=Eq(),X["components/Footer.stx"]=Iq(),X["src/stores/app.ts"]=Dq()}return X}async function QT($,Z={}){let Y={success:!0,message:"",files:[],errors:[]},X=Z.dir||"components",J=sJ($),Q=b$(X,`${J}.stx`);if(await Bun.file(Q).exists()&&!Z.force)return Y.success=!1,Y.message=`Component ${J} already exists. Use --force to overwrite.`,Y;try{r4(X);let G=_T(J,Z);await Bun.write(Q,G),Y.files.push(Q),Y.message=`Created component: ${Q}`,console.log(`\u2705 ${Y.message}`)}catch(G){Y.success=!1,Y.message=`Failed to create component: ${G}`}return Y}async function GT($,Z={}){let Y={success:!0,message:"",files:[],errors:[]},X=Z.dir||"pages",J=$.toLowerCase().replace(/\s+/g,"-"),Q=b$(X,`${J}.stx`);if(await Bun.file(Q).exists()&&!Z.force)return Y.success=!1,Y.message=`Page ${J} already exists. Use --force to overwrite.`,Y;try{r4(X);let G=BT(J,Z);await Bun.write(Q,G),Y.files.push(Q),Y.message=`Created page: ${Q}`,console.log(`\u2705 ${Y.message}`)}catch(G){Y.success=!1,Y.message=`Failed to create page: ${G}`}return Y}async function KT($,Z={}){let Y={success:!0,message:"",files:[],errors:[]},X=Z.dir||"src/stores",J=hT($),Q=b$(X,`${J}.ts`);if(await Bun.file(Q).exists()&&!Z.force)return Y.success=!1,Y.message=`Store ${J} already exists. Use --force to overwrite.`,Y;try{r4(X);let G=UT(J,Z);await Bun.write(Q,G),Y.files.push(Q),Y.message=`Created store: ${Q}`,console.log(`\u2705 ${Y.message}`)}catch(G){Y.success=!1,Y.message=`Failed to create store: ${G}`}return Y}async function WT($,Z={}){let Y={success:!0,message:"",files:[],errors:[]},X=Z.dir||"layouts",J=$.toLowerCase().replace(/\s+/g,"-"),Q=b$(X,`${J}.stx`);if(await Bun.file(Q).exists()&&!Z.force)return Y.success=!1,Y.message=`Layout ${J} already exists. Use --force to overwrite.`,Y;try{r4(X);let G=zT(J,Z);await Bun.write(Q,G),Y.files.push(Q),Y.message=`Created layout: ${Q}`,console.log(`\u2705 ${Y.message}`)}catch(G){Y.success=!1,Y.message=`Failed to create layout: ${G}`}return Y}function _T($,Z){let Y=[];if(Y.push(`{{-- Component: ${$} --}}`),Z.props!==!1)Y.push(`<script>
12842
+ `)}catch(Q){Y.success=!1,Y.message=`Failed to create project: ${Q}`}return Y}function XT($){let Z=["pages","components","layouts","partials","public"];switch($){case"minimal":return["src","public"];case"full":return[...Z,"src/stores","src/api","src/i18n","src/utils","test"];case"blog":return[...Z,"src/posts","src/utils"];case"dashboard":return[...Z,"src/stores","src/api","src/utils"];case"landing":return[...Z,"src/sections"];default:return[...Z,"src/stores"]}}function JT($,Z,Y){let X={};if(X["package.json"]=qT(Z,$,Y),X["stx.config.ts"]=jT($,Y),X["README.md"]=OT(Z,$),Y.typescript!==!1)X["tsconfig.json"]=HT();switch($){case"minimal":X["src/index.stx"]=FT();break;case"blog":X["pages/index.stx"]=wT(),X["pages/[slug].stx"]=RT(),X["layouts/app.stx"]=MT(),X["components/PostCard.stx"]=TT();break;case"dashboard":X["pages/index.stx"]=ET(),X["pages/settings.stx"]=IT(),X["layouts/app.stx"]=DT(),X["components/Sidebar.stx"]=kT(),X["components/StatsCard.stx"]=ST(),X["src/stores/dashboard.ts"]=bT();break;case"landing":X["pages/index.stx"]=CT(),X["layouts/app.stx"]=yT(),X["src/sections/Hero.stx"]=PT(),X["src/sections/Features.stx"]=xT(),X["src/sections/Pricing.stx"]=vT(),X["components/Button.stx"]=fT();break;case"full":X["pages/index.stx"]=Mq(),X["pages/about.stx"]=VT(),X["layouts/app.stx"]=Tq(),X["components/Header.stx"]=Eq(),X["components/Footer.stx"]=Iq(),X["src/stores/app.ts"]=Dq(),X["src/i18n/en.json"]=NT("en"),X["test/example.test.ts"]=AT();break;default:X["pages/index.stx"]=Mq(),X["layouts/app.stx"]=Tq(),X["components/Header.stx"]=Eq(),X["components/Footer.stx"]=Iq(),X["src/stores/app.ts"]=Dq()}return X}async function QT($,Z={}){let Y={success:!0,message:"",files:[],errors:[]},X=Z.dir||"components",J=n2($),Q=C$(X,`${J}.stx`);if(await Bun.file(Q).exists()&&!Z.force)return Y.success=!1,Y.message=`Component ${J} already exists. Use --force to overwrite.`,Y;try{r4(X);let G=_T(J,Z);await Bun.write(Q,G),Y.files.push(Q),Y.message=`Created component: ${Q}`,console.log(`\u2705 ${Y.message}`)}catch(G){Y.success=!1,Y.message=`Failed to create component: ${G}`}return Y}async function GT($,Z={}){let Y={success:!0,message:"",files:[],errors:[]},X=Z.dir||"pages",J=$.toLowerCase().replace(/\s+/g,"-"),Q=C$(X,`${J}.stx`);if(await Bun.file(Q).exists()&&!Z.force)return Y.success=!1,Y.message=`Page ${J} already exists. Use --force to overwrite.`,Y;try{r4(X);let G=BT(J,Z);await Bun.write(Q,G),Y.files.push(Q),Y.message=`Created page: ${Q}`,console.log(`\u2705 ${Y.message}`)}catch(G){Y.success=!1,Y.message=`Failed to create page: ${G}`}return Y}async function KT($,Z={}){let Y={success:!0,message:"",files:[],errors:[]},X=Z.dir||"src/stores",J=hT($),Q=C$(X,`${J}.ts`);if(await Bun.file(Q).exists()&&!Z.force)return Y.success=!1,Y.message=`Store ${J} already exists. Use --force to overwrite.`,Y;try{r4(X);let G=UT(J,Z);await Bun.write(Q,G),Y.files.push(Q),Y.message=`Created store: ${Q}`,console.log(`\u2705 ${Y.message}`)}catch(G){Y.success=!1,Y.message=`Failed to create store: ${G}`}return Y}async function WT($,Z={}){let Y={success:!0,message:"",files:[],errors:[]},X=Z.dir||"layouts",J=$.toLowerCase().replace(/\s+/g,"-"),Q=C$(X,`${J}.stx`);if(await Bun.file(Q).exists()&&!Z.force)return Y.success=!1,Y.message=`Layout ${J} already exists. Use --force to overwrite.`,Y;try{r4(X);let G=zT(J,Z);await Bun.write(Q,G),Y.files.push(Q),Y.message=`Created layout: ${Q}`,console.log(`\u2705 ${Y.message}`)}catch(G){Y.success=!1,Y.message=`Failed to create layout: ${G}`}return Y}function _T($,Z){let Y=[];if(Y.push(`{{-- Component: ${$} --}}`),Z.props!==!1)Y.push(`<script>
12843
12843
  // Props
12844
12844
  const title = props.title || '${$}'
12845
12845
  const variant = props.variant || 'default'
@@ -12869,7 +12869,7 @@ const variant = props.variant || 'default'
12869
12869
  margin-top: 0.5rem;
12870
12870
  }
12871
12871
  </style>`);return Y.join(`
12872
- `)}function BT($,Z){let Y=sJ($.replace(/-/g," ")),X=[];if(X.push(`<script>
12872
+ `)}function BT($,Z){let Y=n2($.replace(/-/g," ")),X=[];if(X.push(`<script>
12873
12873
  const title = '${Y}'
12874
12874
  const description = 'Page description'
12875
12875
  </script>
@@ -12882,7 +12882,7 @@ const description = 'Page description'
12882
12882
  <p>{{ description }}</p>
12883
12883
  </div>
12884
12884
  @endsection`),X.join(`
12885
- `)}function UT($,Z){let Y=`${$}Store`,X=`${sJ($)}State`,J=`import { defineStore } from 'stx'
12885
+ `)}function UT($,Z){let Y=`${$}Store`,X=`${n2($)}State`,J=`import { defineStore } from 'stx'
12886
12886
 
12887
12887
  interface ${X} {
12888
12888
  // Add your state properties here
@@ -13306,14 +13306,14 @@ describe('Example', () => {
13306
13306
  </footer>
13307
13307
  @yield('scripts')
13308
13308
  </body>
13309
- </html>`}function PT(){return"<!-- Hero section -->"}function xT(){return"<!-- Features -->"}function vT(){return"<!-- Pricing -->"}function fT(){return"<!-- Button -->"}function r4($){if(!s4($))nJ($,{recursive:!0})}function gT(){if(s4("bun.lockb"))return"bun";if(s4("pnpm-lock.yaml"))return"pnpm";if(s4("yarn.lock"))return"yarn";return"bun"}function sJ($){return $.replace(/[-_\s]+(.)?/g,(Z,Y)=>Y?Y.toUpperCase():"").replace(/^./,(Z)=>Z.toUpperCase())}function hT($){return $.replace(/[-_\s]+(.)?/g,(Z,Y)=>Y?Y.toUpperCase():"").replace(/^./,(Z)=>Z.toLowerCase())}function a$($){return $.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}var ZT;var kq=D(()=>{ZT={default:{description:"Standard stx project with pages, components, and stores",features:["Pages","Components","Layouts","Stores","Dev server"]},minimal:{description:"Minimal setup with just the essentials",features:["Single page","Basic styles"]},full:{description:"Full-featured project with all stx capabilities",features:["Pages","Components","Layouts","Stores","API routes","PWA","i18n","Testing"]},blog:{description:"Blog template with markdown support",features:["Blog layout","Post pages","Tags","RSS feed","Markdown"]},dashboard:{description:"Admin dashboard template",features:["Sidebar","Charts","Tables","Forms","Auth pages"]},landing:{description:"Marketing landing page template",features:["Hero section","Features","Pricing","CTA","Contact form"]}}});var{serve:dT}=globalThis.Bun;import o4 from"fs";import C$ from"path";function uT($,Z=200,Y={}){return new Response($,{status:Z,headers:{"Content-Type":"text/html; charset=utf-8",...Y}})}async function Sq($={}){let{port:Z=3000,root:Y=".",stxOptions:X={},watch:J=!0,onRequest:Q,routes:G={},middleware:K=[],on404:W,onError:_}=$,B=C$.resolve(Y),U=new Map;async function z(L){let V=o4.statSync(L),A=`${L}:${V.mtimeMs}`,N=U.get(A);if(N)return N.content;for(let h of U.keys())if(h.startsWith(`${L}:`)&&h!==A)U.delete(h);let w=await Bun.file(L).text(),M=w,T=w.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>/i);if(T&&T.index!==void 0){let h=T.index+T[0].length,l=1,i=h;while(i<w.length&&l>0){let Y0=w.indexOf("<template",i),W0=w.indexOf("</template>",i);if(W0===-1)break;if(Y0!==-1&&Y0<W0)l++,i=Y0+9;else{if(l--,l===0){M=w.substring(h,W0).trim();break}i=W0+11}}}let I=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,E=[],S=[],k;while((k=I.exec(w))!==null){let h=k[1],l=k[2],i=k[0];if(h.includes("server"))S.push(l);else E.push(i)}let b=w.match(/<style\b[^>]*>[\s\S]*?<\/style>/gi)||[],P=M.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,""),x={__filename:L,__dirname:C$.dirname(L)};for(let h of S)await R0(h,x,L);let g=await Z0(P,x,L,X,new Set);if(b.length>0){let h=b.join(`
13309
+ </html>`}function PT(){return"<!-- Hero section -->"}function xT(){return"<!-- Features -->"}function vT(){return"<!-- Pricing -->"}function fT(){return"<!-- Button -->"}function r4($){if(!s4($))i2($,{recursive:!0})}function gT(){if(s4("bun.lockb"))return"bun";if(s4("pnpm-lock.yaml"))return"pnpm";if(s4("yarn.lock"))return"yarn";return"bun"}function n2($){return $.replace(/[-_\s]+(.)?/g,(Z,Y)=>Y?Y.toUpperCase():"").replace(/^./,(Z)=>Z.toUpperCase())}function hT($){return $.replace(/[-_\s]+(.)?/g,(Z,Y)=>Y?Y.toUpperCase():"").replace(/^./,(Z)=>Z.toLowerCase())}function a$($){return $.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}var ZT;var kq=D(()=>{ZT={default:{description:"Standard stx project with pages, components, and stores",features:["Pages","Components","Layouts","Stores","Dev server"]},minimal:{description:"Minimal setup with just the essentials",features:["Single page","Basic styles"]},full:{description:"Full-featured project with all stx capabilities",features:["Pages","Components","Layouts","Stores","API routes","PWA","i18n","Testing"]},blog:{description:"Blog template with markdown support",features:["Blog layout","Post pages","Tags","RSS feed","Markdown"]},dashboard:{description:"Admin dashboard template",features:["Sidebar","Charts","Tables","Forms","Auth pages"]},landing:{description:"Marketing landing page template",features:["Hero section","Features","Pricing","CTA","Contact form"]}}});var{serve:dT}=globalThis.Bun;import o4 from"fs";import y$ from"path";function uT($,Z=200,Y={}){return new Response($,{status:Z,headers:{"Content-Type":"text/html; charset=utf-8",...Y}})}async function Sq($={}){let{port:Z=3000,root:Y=".",stxOptions:X={},watch:J=!0,onRequest:Q,routes:G={},middleware:K=[],on404:W,onError:_}=$,B=y$.resolve(Y),U=new Map;async function z(L){let V=o4.statSync(L),A=`${L}:${V.mtimeMs}`,N=U.get(A);if(N)return N.content;for(let h of U.keys())if(h.startsWith(`${L}:`)&&h!==A)U.delete(h);let w=await Bun.file(L).text(),M=w,T=w.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>/i);if(T&&T.index!==void 0){let h=T.index+T[0].length,l=1,i=h;while(i<w.length&&l>0){let Y0=w.indexOf("<template",i),W0=w.indexOf("</template>",i);if(W0===-1)break;if(Y0!==-1&&Y0<W0)l++,i=Y0+9;else{if(l--,l===0){M=w.substring(h,W0).trim();break}i=W0+11}}}let I=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,E=[],S=[],k;while((k=I.exec(w))!==null){let h=k[1],l=k[2],i=k[0];if(h.includes("server"))S.push(l);else E.push(i)}let b=w.match(/<style\b[^>]*>[\s\S]*?<\/style>/gi)||[],P=M.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,""),x={__filename:L,__dirname:y$.dirname(L)};for(let h of S)await R0(h,x,L);let g=await Z0(P,x,L,X,new Set);if(b.length>0){let h=b.join(`
13310
13310
  `);if(g.match(/(<\/head>)/i))g=g.replace(/(<\/head>)/i,`${h}
13311
13311
  $1`)}if(E.length>0){let{interpolateScriptsInTemplate:h}=await Promise.resolve().then(() => (d0(),y7)),l=h(E.join(`
13312
13312
  `),x);if(g.match(/(<\/body>)/i))g=g.replace(/(<\/body>)/i,`${l}
13313
13313
  $1`);else g+=`
13314
- ${l}`}return U.set(A,{content:g,mtime:V.mtimeMs}),g}async function q(L){let V=o4.statSync(L),A=`${L}:${V.mtimeMs}`,N=U.get(A);if(N)return N.content;let{content:w}=await p1(L,X);return U.set(A,{content:w,mtime:V.mtimeMs}),w}function j(L){let V=L.startsWith("/")?L.slice(1):L,A=[V,`${V}.stx`,`${V}.md`,`${V}.html`,C$.join(V,"index.stx"),C$.join(V,"index.md"),C$.join(V,"index.html")];for(let N of A){let w=C$.join(B,N);if(o4.existsSync(w)&&o4.statSync(w).isFile())return w}return null}async function H(L){let V=new URL(L.url),A=async()=>{if(G[V.pathname])return await G[V.pathname](L);if(Q){let w=await Q(L);if(w)return w}let N=j(V.pathname);if(!N){if(W)return await W(L);return new Response("Not Found",{status:404})}try{let w,M="text/html";if(N.endsWith(".stx"))w=await z(N);else if(N.endsWith(".md"))w=await q(N);else if(N.endsWith(".html"))w=await Bun.file(N).text();else if(N.endsWith(".css"))w=await Bun.file(N).text(),M="text/css";else if(N.endsWith(".js"))w=await Bun.file(N).text(),M="text/javascript";else if(N.endsWith(".json"))w=await Bun.file(N).text(),M="application/json";else return new Response(Bun.file(N));return new Response(w,{headers:{"Content-Type":M}})}catch(w){if(_)return await _(w,L);let M=w instanceof Error?w.message:String(w),I=X?.debug===!0?`<h1>Error</h1><pre>${M}
13315
- ${w instanceof Error?w.stack:""}</pre>`:"<h1>Internal Server Error</h1><p>An error occurred while processing your request.</p>";return new Response(I,{status:500,headers:{"Content-Type":"text/html"}})}};for(let N=K.length-1;N>=0;N--){let w=K[N],M=A;A=async()=>await w(L,M)}return await A()}let O=dT({port:Z,fetch:H}),F=null;if(J)F=o4.watch(B,{recursive:!0},(L,V)=>{if(V&&(V.endsWith(".stx")||V.endsWith(".md")||V.endsWith(".html")))U.clear()});return{server:O,url:O.url.toString(),stop(){if(F)F.close();O.stop()}}}async function mT($,Z={}){let Y=C$.resolve($);if(!await Bun.file(Y).exists())throw Error(`File not found: ${Y}`);let X=Y.endsWith(".md"),J=Y.endsWith(".stx");if(!X&&!J)throw Error(`Unsupported file type: ${Y}. Only .stx and .md files are supported.`);return await Sq({...Z,root:C$.dirname(Y),routes:{"/":async()=>{let Q;if(X){let{content:G}=await p1(Y,Z.stxOptions);Q=G}else{let G=await Bun.file(Y).text(),K=[],W=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,_;while((_=W.exec(G))!==null)if(_[1].includes("server"))K.push(_[2]);let B=K.join(`
13316
- `),U=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),z={};if(B.trim())await R0(B,z,Y);let q=new Set;Q=await Z0(U,z,Y,Z.stxOptions||{},q)}return new Response(Q,{headers:{"Content-Type":"text/html"}})},...Z.routes}})}function pT($){return $}function cT($){return $}var bq=D(()=>{d5();_1();q0()});import n8 from"path";function lT($){let Z=[],Y=0,X;Cq.lastIndex=0;while((X=Cq.exec($))!==null){if(X.index>Y){let G=$.slice(Y,X.index);if(G.trim())Z.push({type:Z.length===0?"shell":"content",content:G})}let J=X[1],Q=X[2];Z.push({type:"suspense",name:J,content:Q}),Y=X.index+X[0].length}if(Y<$.length){let J=$.slice(Y);if(J.trim())Z.push({type:Z.length===0?"shell":"content",content:J})}if(Z.length===0)Z.push({type:"shell",content:$});return Z}async function iT($,Z={},Y={}){let X={...a0,...Y,streaming:{...rJ,...Y.streaming}},J=X.streaming?.bufferSize||16384;return new ReadableStream({async start(Q){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),W=K?K[1]:"",_=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),B={...Z,__filename:$,__dirname:n8.dirname($)};if(W.trim())await R0(W,B,$);let U=lT(_),z=new Set;if(!U.some((j)=>j.type==="suspense")){let j=X.streaming?.strategy||"auto",H=new RegExp(t$.source,"g");if(!(j!=="manual"&&H.test(_))){let F=await Z0(_,B,$,X,z);for(let L=0;L<F.length;L+=J)Q.enqueue(F.slice(L,L+J)),await new Promise((V)=>setTimeout(V,0))}else{let F=[],L=new RegExp(t$.source,"g"),V;while((V=L.exec(_))!==null)F.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let A=0;for(let N of F){if(N.start>A){let M=_.slice(A,N.start);if(M.trim()){let T=await Z0(M,B,$,X,z);Q.enqueue(T),await new Promise((I)=>setTimeout(I,0))}}let w=await Z0(N.content,B,$,X,z);Q.enqueue(w),await new Promise((M)=>setTimeout(M,0)),A=N.end}if(A<_.length){let N=_.slice(A);if(N.trim()){let w=await Z0(N,B,$,X,z);Q.enqueue(w)}}}}else{let j=new Map;for(let O of U)if(O.type==="shell"||O.type==="content"){let F=await Z0(O.content,B,$,X,z);Q.enqueue(F)}else if(O.type==="suspense"&&O.name){let F=`stx-suspense-${O.name}`;Q.enqueue(`<div id="${F}" data-suspense="${O.name}" style="display:contents;">
13314
+ ${l}`}return U.set(A,{content:g,mtime:V.mtimeMs}),g}async function q(L){let V=o4.statSync(L),A=`${L}:${V.mtimeMs}`,N=U.get(A);if(N)return N.content;let{content:w}=await p1(L,X);return U.set(A,{content:w,mtime:V.mtimeMs}),w}function j(L){let V=L.startsWith("/")?L.slice(1):L,A=[V,`${V}.stx`,`${V}.md`,`${V}.html`,y$.join(V,"index.stx"),y$.join(V,"index.md"),y$.join(V,"index.html")];for(let N of A){let w=y$.join(B,N);if(o4.existsSync(w)&&o4.statSync(w).isFile())return w}return null}async function H(L){let V=new URL(L.url),A=async()=>{if(G[V.pathname])return await G[V.pathname](L);if(Q){let w=await Q(L);if(w)return w}let N=j(V.pathname);if(!N){if(W)return await W(L);return new Response("Not Found",{status:404})}try{let w,M="text/html";if(N.endsWith(".stx"))w=await z(N);else if(N.endsWith(".md"))w=await q(N);else if(N.endsWith(".html"))w=await Bun.file(N).text();else if(N.endsWith(".css"))w=await Bun.file(N).text(),M="text/css";else if(N.endsWith(".js"))w=await Bun.file(N).text(),M="text/javascript";else if(N.endsWith(".json"))w=await Bun.file(N).text(),M="application/json";else return new Response(Bun.file(N));return new Response(w,{headers:{"Content-Type":M}})}catch(w){if(_)return await _(w,L);let M=w instanceof Error?w.message:String(w),I=X?.debug===!0?`<h1>Error</h1><pre>${M}
13315
+ ${w instanceof Error?w.stack:""}</pre>`:"<h1>Internal Server Error</h1><p>An error occurred while processing your request.</p>";return new Response(I,{status:500,headers:{"Content-Type":"text/html"}})}};for(let N=K.length-1;N>=0;N--){let w=K[N],M=A;A=async()=>await w(L,M)}return await A()}let O=dT({port:Z,fetch:H}),F=null;if(J)F=o4.watch(B,{recursive:!0},(L,V)=>{if(V&&(V.endsWith(".stx")||V.endsWith(".md")||V.endsWith(".html")))U.clear()});return{server:O,url:O.url.toString(),stop(){if(F)F.close();O.stop()}}}async function mT($,Z={}){let Y=y$.resolve($);if(!await Bun.file(Y).exists())throw Error(`File not found: ${Y}`);let X=Y.endsWith(".md"),J=Y.endsWith(".stx");if(!X&&!J)throw Error(`Unsupported file type: ${Y}. Only .stx and .md files are supported.`);return await Sq({...Z,root:y$.dirname(Y),routes:{"/":async()=>{let Q;if(X){let{content:G}=await p1(Y,Z.stxOptions);Q=G}else{let G=await Bun.file(Y).text(),K=[],W=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,_;while((_=W.exec(G))!==null)if(_[1].includes("server"))K.push(_[2]);let B=K.join(`
13316
+ `),U=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),z={};if(B.trim())await R0(B,z,Y);let q=new Set;Q=await Z0(U,z,Y,Z.stxOptions||{},q)}return new Response(Q,{headers:{"Content-Type":"text/html"}})},...Z.routes}})}function pT($){return $}function cT($){return $}var bq=D(()=>{d5();_1();q0()});import n8 from"path";function lT($){let Z=[],Y=0,X;Cq.lastIndex=0;while((X=Cq.exec($))!==null){if(X.index>Y){let G=$.slice(Y,X.index);if(G.trim())Z.push({type:Z.length===0?"shell":"content",content:G})}let J=X[1],Q=X[2];Z.push({type:"suspense",name:J,content:Q}),Y=X.index+X[0].length}if(Y<$.length){let J=$.slice(Y);if(J.trim())Z.push({type:Z.length===0?"shell":"content",content:J})}if(Z.length===0)Z.push({type:"shell",content:$});return Z}async function iT($,Z={},Y={}){let X={...a0,...Y,streaming:{...s2,...Y.streaming}},J=X.streaming?.bufferSize||16384;return new ReadableStream({async start(Q){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),W=K?K[1]:"",_=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),B={...Z,__filename:$,__dirname:n8.dirname($)};if(W.trim())await R0(W,B,$);let U=lT(_),z=new Set;if(!U.some((j)=>j.type==="suspense")){let j=X.streaming?.strategy||"auto",H=new RegExp(t$.source,"g");if(!(j!=="manual"&&H.test(_))){let F=await Z0(_,B,$,X,z);for(let L=0;L<F.length;L+=J)Q.enqueue(F.slice(L,L+J)),await new Promise((V)=>setTimeout(V,0))}else{let F=[],L=new RegExp(t$.source,"g"),V;while((V=L.exec(_))!==null)F.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let A=0;for(let N of F){if(N.start>A){let M=_.slice(A,N.start);if(M.trim()){let T=await Z0(M,B,$,X,z);Q.enqueue(T),await new Promise((I)=>setTimeout(I,0))}}let w=await Z0(N.content,B,$,X,z);Q.enqueue(w),await new Promise((M)=>setTimeout(M,0)),A=N.end}if(A<_.length){let N=_.slice(A);if(N.trim()){let w=await Z0(N,B,$,X,z);Q.enqueue(w)}}}}else{let j=new Map;for(let O of U)if(O.type==="shell"||O.type==="content"){let F=await Z0(O.content,B,$,X,z);Q.enqueue(F)}else if(O.type==="suspense"&&O.name){let F=`stx-suspense-${O.name}`;Q.enqueue(`<div id="${F}" data-suspense="${O.name}" style="display:contents;">
13317
13317
  <template data-suspense-fallback>Loading...</template>
13318
13318
  </div>`),j.set(O.name,Z0(O.content,B,$,X,z))}Q.enqueue(`
13319
13319
  <script>
@@ -13337,7 +13337,7 @@ window.__stxSuspense.resolve('${O}', \`${V}\`);
13337
13337
  </script>`)}catch(L){let V=L instanceof Error?L.message:String(L);Q.enqueue(`
13338
13338
  <script>
13339
13339
  window.__stxSuspense.resolve('${O}', '<div class="stx-error">Error loading content: ${w0(V)}</div>');
13340
- </script>`)}});await Promise.all(H)}Q.close()}catch(G){Q.error(G)}}})}async function nT($,Z={},Y={}){let X={...a0,...Y,streaming:{...rJ,...Y.streaming}},J=X.streaming?.bufferSize||16384;return new ReadableStream({async start(Q){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),W=K?K[1]:"",_=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),B={...Z,__filename:$,__dirname:n8.dirname($)};if(W.trim())await R0(W,B,$);let U=new Set,z=X.streaming?.strategy||"auto",q=new RegExp(t$.source,"g");if(!(z!=="manual"&&q.test(_))){let H=await Z0(_,B,$,X,U);for(let O=0;O<H.length;O+=J)Q.enqueue(H.slice(O,O+J))}else{let H=[],O=new RegExp(t$.source,"g"),F;while((F=O.exec(_))!==null)H.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let L=0;for(let V of H){if(V.start>L){let N=_.slice(L,V.start);if(N.trim()){let w=await Z0(N,B,$,X,U);Q.enqueue(w)}}let A=await Z0(V.content,B,$,X,U);Q.enqueue(A),L=V.end}if(L<_.length){let V=_.slice(L);if(V.trim()){let A=await Z0(V,B,$,X,U);Q.enqueue(A)}}}Q.close()}catch(G){Q.error(G)}}})}async function sT($,Z={}){let Y={...a0,...Z,streaming:{...rJ,...Z.streaming}},X=await Bun.file($).text(),J=X.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),Q=J?J[1]:"",G=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K=G,W={},_;t$.lastIndex=0;while((_=t$.exec(G))!==null){let z=_[1],q=_[2];W[z]=q}let B=G.replace(t$,"");return{renderShell:async(z={})=>{let q={...z,__filename:$,__dirname:n8.dirname($)};return await R0(Q,q,$),Z0(B,q,$,Y,new Set)},renderSection:async(z,q={})=>{try{if(!W[z])return`<div class="error-message">Section "${w0(z)}" not found in template "${w0($)}"</div>`;let j={...q,__filename:$,__dirname:n8.dirname($)};await R0(Q,j,$);let H=new Set;return await Z0(W[z],j,$,Y,H)}catch(j){let H=j instanceof Error?j.message:String(j);return U0("Expression",H,$,W[z]||"",0,W[z]||"")}},getSections:()=>{return Object.keys(W)},getTemplate:()=>{return K}}}function rT($={}){let Z=[];if($.streaming?.enabled)Z.push(yq);if($.hydration?.enabled)Z.push(Pq);return Z}async function oT($,Z,Y,X={}){return $}function aT($,Z={}){let Y=new TextEncoder,X=$.pipeThrough(new TransformStream({transform(Q,G){G.enqueue(Y.encode(Q))}})),J=new Headers(Z.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");return new Response(X,{...Z,headers:J})}function tT($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:X=!0}=$,J=Object.entries(Y).map(([Q,G])=>`'${Q}': ${X?`() => import('${G}')`:`require('${G}')`}`).join(`,
13340
+ </script>`)}});await Promise.all(H)}Q.close()}catch(G){Q.error(G)}}})}async function nT($,Z={},Y={}){let X={...a0,...Y,streaming:{...s2,...Y.streaming}},J=X.streaming?.bufferSize||16384;return new ReadableStream({async start(Q){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),W=K?K[1]:"",_=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),B={...Z,__filename:$,__dirname:n8.dirname($)};if(W.trim())await R0(W,B,$);let U=new Set,z=X.streaming?.strategy||"auto",q=new RegExp(t$.source,"g");if(!(z!=="manual"&&q.test(_))){let H=await Z0(_,B,$,X,U);for(let O=0;O<H.length;O+=J)Q.enqueue(H.slice(O,O+J))}else{let H=[],O=new RegExp(t$.source,"g"),F;while((F=O.exec(_))!==null)H.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let L=0;for(let V of H){if(V.start>L){let N=_.slice(L,V.start);if(N.trim()){let w=await Z0(N,B,$,X,U);Q.enqueue(w)}}let A=await Z0(V.content,B,$,X,U);Q.enqueue(A),L=V.end}if(L<_.length){let V=_.slice(L);if(V.trim()){let A=await Z0(V,B,$,X,U);Q.enqueue(A)}}}Q.close()}catch(G){Q.error(G)}}})}async function sT($,Z={}){let Y={...a0,...Z,streaming:{...s2,...Z.streaming}},X=await Bun.file($).text(),J=X.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),Q=J?J[1]:"",G=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K=G,W={},_;t$.lastIndex=0;while((_=t$.exec(G))!==null){let z=_[1],q=_[2];W[z]=q}let B=G.replace(t$,"");return{renderShell:async(z={})=>{let q={...z,__filename:$,__dirname:n8.dirname($)};return await R0(Q,q,$),Z0(B,q,$,Y,new Set)},renderSection:async(z,q={})=>{try{if(!W[z])return`<div class="error-message">Section "${w0(z)}" not found in template "${w0($)}"</div>`;let j={...q,__filename:$,__dirname:n8.dirname($)};await R0(Q,j,$);let H=new Set;return await Z0(W[z],j,$,Y,H)}catch(j){let H=j instanceof Error?j.message:String(j);return U0("Expression",H,$,W[z]||"",0,W[z]||"")}},getSections:()=>{return Object.keys(W)},getTemplate:()=>{return K}}}function rT($={}){let Z=[];if($.streaming?.enabled)Z.push(yq);if($.hydration?.enabled)Z.push(Pq);return Z}async function oT($,Z,Y,X={}){return $}function aT($,Z={}){let Y=new TextEncoder,X=$.pipeThrough(new TransformStream({transform(Q,G){G.enqueue(Y.encode(Q))}})),J=new Headers(Z.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");return new Response(X,{...Z,headers:J})}function tT($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:X=!0}=$,J=Object.entries(Y).map(([Q,G])=>`'${Q}': ${X?`() => import('${G}')`:`require('${G}')`}`).join(`,
13341
13341
  `);if(Z==="loader")return`
13342
13342
  (function() {
13343
13343
  window.__stx = window.__stx || {};
@@ -13479,15 +13479,15 @@ else {
13479
13479
  else {
13480
13480
  stx.hydrate();
13481
13481
  }
13482
- })();`}var rJ,t$,Cq,yq,Pq;var xq=D(()=>{m0();d0();_1();q0();rJ={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},t$=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,Cq=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;yq={name:"suspense",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let J=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${J} -->${$}<!-- @endsuspense:${J} -->`}},Pq={name:"island",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Island directive requires a name parameter");let J=Z[0].replace(/['"`]/g,""),Q=Z[1]?Z[1].replace(/['"`]/g,""):"lazy",G=`island-${J}-${Math.random().toString(36).substring(2,9)}`,K=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),W=K?K[1].trim():"",_=K?$.replace(K[0],""):$;return`<div data-island="${J}" data-island-id="${G}" data-priority="${Q}">
13482
+ })();`}var s2,t$,Cq,yq,Pq;var xq=D(()=>{m0();d0();_1();q0();s2={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},t$=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,Cq=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;yq={name:"suspense",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let J=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${J} -->${$}<!-- @endsuspense:${J} -->`}},Pq={name:"island",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Island directive requires a name parameter");let J=Z[0].replace(/['"`]/g,""),Q=Z[1]?Z[1].replace(/['"`]/g,""):"lazy",G=`island-${J}-${Math.random().toString(36).substring(2,9)}`,K=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),W=K?K[1].trim():"",_=K?$.replace(K[0],""):$;return`<div data-island="${J}" data-island-id="${G}" data-priority="${Q}">
13483
13483
  ${_}
13484
13484
  <script type="application/json" data-island-props="${G}">
13485
13485
  ${W?`{${W}}`:"{}"}
13486
13486
  </script>
13487
- </div>`}}});import{existsSync as eT,readFileSync as $E}from"fs";class oJ{options;variables=new Map;errors=[];warnings=[];currentFile="";constructor($={}){if(this.options={...ZE,...$},this.options.includeBuiltins)Object.entries(vq).forEach(([Z,Y])=>{this.variables.set(Z,Y)});if(this.options.customTypes)Object.entries(this.options.customTypes).forEach(([Z,Y])=>{this.variables.set(Z,Y)})}checkFile($){if(this.currentFile=$,this.errors=[],this.warnings=[],!eT($))return this.errors.push({message:`File not found: ${$}`,file:$,line:0,column:0,expression:"",severity:"error"}),this.getResult();let Z=$E($,"utf-8");return this.checkTemplate(Z,$)}checkTemplate($,Z="<inline>"){this.currentFile=Z,this.errors=[],this.warnings=[];let Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(Y)this.analyzeScript(Y[1],$.indexOf(Y[0]));return this.checkDirectives($),this.checkExpressions($),this.getResult()}analyzeScript($,Z){let Y=$.split(`
13487
+ </div>`}}});import{existsSync as eT,readFileSync as $E}from"fs";class r2{options;variables=new Map;errors=[];warnings=[];currentFile="";constructor($={}){if(this.options={...ZE,...$},this.options.includeBuiltins)Object.entries(vq).forEach(([Z,Y])=>{this.variables.set(Z,Y)});if(this.options.customTypes)Object.entries(this.options.customTypes).forEach(([Z,Y])=>{this.variables.set(Z,Y)})}checkFile($){if(this.currentFile=$,this.errors=[],this.warnings=[],!eT($))return this.errors.push({message:`File not found: ${$}`,file:$,line:0,column:0,expression:"",severity:"error"}),this.getResult();let Z=$E($,"utf-8");return this.checkTemplate(Z,$)}checkTemplate($,Z="<inline>"){this.currentFile=Z,this.errors=[],this.warnings=[];let Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(Y)this.analyzeScript(Y[1],$.indexOf(Y[0]));return this.checkDirectives($),this.checkExpressions($),this.getResult()}analyzeScript($,Z){let Y=$.split(`
13488
13488
  `),X=this.getLineNumber(Z);for(let J=0;J<Y.length;J++){let Q=Y[J],G=X+J;this.extractTypedVariables(Q,G),this.extractInterfaces(Q,Y,J,G),this.extractTypeAliases(Q,G)}}extractTypedVariables($,Z){let Y=$.match(/(?:export\s+)?(?:const|let|var)\s+(\w+)\s*:\s*([^=]+?)\s*=/);if(Y){let[,Q,G]=Y,K=this.parseTypeAnnotation(G.trim());this.variables.set(Q,K);return}let X=$.match(/(?:export\s+)?(?:const|let|var)\s+(\w+)\s*=\s*(.+)/);if(X){let[,Q,G]=X,K=this.inferType(G.trim());this.variables.set(Q,K);return}let J=$.match(/(?:export\s+)?function\s+(\w+)\s*\(([^)]*)\)(?:\s*:\s*(\w+))?/);if(J){let[,Q,G,K]=J,W=this.parseParams(G),_=K?this.parseTypeAnnotation(K):{kind:"primitive",value:"any"};this.variables.set(Q,{kind:"function",params:W,returnType:_})}}extractInterfaces($,Z,Y,X){let J=$.match(/(?:export\s+)?interface\s+(\w+)\s*\{/);if(J){let[,Q]=J,G={},K=1,W=Y+1;while(W<Z.length&&K>0){let _=Z[W].trim();if(_.includes("{"))K++;if(_.includes("}"))K--;let B=_.match(/(\w+)\??\s*:\s*([^;]+)/);if(B&&K>0){let[,U,z]=B;G[U]=this.parseTypeAnnotation(z.trim())}W++}this.variables.set(Q,{kind:"object",name:Q,properties:G})}}extractTypeAliases($,Z){let Y=$.match(/(?:export\s+)?type\s+(\w+)\s*=\s*(.+)/);if(Y){let[,X,J]=Y,Q=this.parseTypeAnnotation(J.trim());Q.name=X,this.variables.set(X,Q)}}parseTypeAnnotation($){let Z=$.trim();if(Z.includes("|"))return{kind:"union",types:Z.split("|").map((Q)=>this.parseTypeAnnotation(Q.trim()))};if(Z.includes("&"))return{kind:"intersection",types:Z.split("&").map((Q)=>this.parseTypeAnnotation(Q.trim()))};if(Z.endsWith("[]"))return{kind:"array",elementType:this.parseTypeAnnotation(Z.slice(0,-2))};let Y=Z.match(/^Array<(.+)>$/);if(Y)return{kind:"array",elementType:this.parseTypeAnnotation(Y[1])};if(Z.startsWith("{")&&Z.endsWith("}")){let J={},Q=Z.slice(1,-1).trim();if(Q){let G=this.splitByComma(Q);for(let K of G){let W=K.match(/(\w+)\??\s*:\s*(.+)/);if(W){let[,_,B]=W;J[_]=this.parseTypeAnnotation(B.trim())}}}return{kind:"object",properties:J}}if(Z.startsWith('"')||Z.startsWith("'"))return{kind:"literal",value:Z.slice(1,-1)};if(/^\d+$/.test(Z))return{kind:"literal",value:Z};if(Z==="true"||Z==="false")return{kind:"literal",value:Z};if(["string","number","boolean","null","undefined","any","unknown","void","never"].includes(Z))return{kind:"primitive",value:Z};if(this.variables.has(Z))return this.variables.get(Z);return{kind:"primitive",value:"any"}}inferType($){let Z=$.trim().replace(/;$/,"");if(Z.startsWith('"')&&Z.endsWith('"')||Z.startsWith("'")&&Z.endsWith("'")||Z.startsWith("`")&&Z.endsWith("`"))return{kind:"primitive",value:"string"};if(/^-?\d+(\.\d+)?$/.test(Z))return{kind:"primitive",value:"number"};if(Z==="true"||Z==="false")return{kind:"primitive",value:"boolean"};if(Z==="null")return{kind:"primitive",value:"null"};if(Z==="undefined")return{kind:"primitive",value:"undefined"};if(Z.startsWith("[")){let Y=Z.slice(1,-1).trim();if(Y){let X=this.splitByComma(Y)[0];if(X)return{kind:"array",elementType:this.inferType(X.trim())}}return{kind:"array",elementType:{kind:"primitive",value:"any"}}}if(Z.startsWith("{")){let Y={},X=this.extractObjectLiteral(Z);for(let[J,Q]of Object.entries(X))Y[J]=this.inferType(Q);return{kind:"object",properties:Y}}if(Z.includes("=>")){let Y=Z.match(/^\(([^)]*)\)\s*(?::\s*(\w+))?\s*=>/);if(Y){let X=this.parseParams(Y[1]),J=Y[2]?this.parseTypeAnnotation(Y[2]):{kind:"primitive",value:"any"};return{kind:"function",params:X,returnType:J}}}if(/^\w+$/.test(Z)&&this.variables.has(Z))return this.variables.get(Z);if(Z.includes("."))return this.resolvePropertyAccess(Z);if(Z.includes("(")){let Y=Z.split("(")[0],X=this.variables.get(Y);if(X?.kind==="function"&&X.returnType)return X.returnType}return{kind:"primitive",value:"any"}}parseParams($){if(!$.trim())return[];let Z=[],Y=this.splitByComma($);for(let X of Y){let J=X.trim(),Q=J.includes("?"),G=J.match(/(\w+)\??\s*(?::\s*([^=]+))?(?:\s*=)?/);if(G){let[,K,W]=G,_=W?this.parseTypeAnnotation(W.trim()):{kind:"primitive",value:"any"};Z.push({name:K,type:_,optional:Q})}}return Z}checkExpressions($){let Z=/\{\{([\s\S]*?)\}\}/g,Y;while((Y=Z.exec($))!==null){let J=Y[1].trim(),Q=Y.index,G=this.getLineNumber(Q,$),K=this.getColumn(Q,$);if(!J)continue;if(J.startsWith("!")||J.endsWith("!"))continue;this.checkExpression(J,G,K)}let X=/\{!!([\s\S]*?)!!\}/g;while((Y=X.exec($))!==null){let J=Y[1].trim(),Q=Y.index,G=this.getLineNumber(Q,$),K=this.getColumn(Q,$);if(!J)continue;this.checkExpression(J,G,K)}}checkExpression($,Z,Y){if($.includes("?")&&$.includes(":")){let Q=$.split("?");this.checkExpression(Q[0].trim(),Z,Y);let G=Q.slice(1).join("?").split(":");if(G.length>=2)this.checkExpression(G[0].trim(),Z,Y),this.checkExpression(G.slice(1).join(":").trim(),Z,Y);return}for(let Q of["&&","||","??"])if($.includes(Q)){$.split(Q).forEach((K)=>this.checkExpression(K.trim(),Z,Y));return}for(let Q of["===","!==","==","!=",">=","<=",">","<"])if($.includes(Q)){$.split(Q).forEach((K)=>this.checkExpression(K.trim(),Z,Y));return}if($.startsWith("!")){this.checkExpression($.slice(1).trim(),Z,Y);return}if(this.isLiteral($))return;let X=$.match(/^(\w+(?:\.\w+)*)\s*\(/);if(X){let Q=X[1],G=this.resolvePropertyAccess(Q);if(G.kind!=="function"&&G.value!=="any")this.addWarning(`'${Q}' is not a function`,Z,Y,$);return}if($.includes(".")){if(this.resolvePropertyAccess($).value==="undefined"&&this.options.checkPropertyAccess)this.addWarning(`Property access '${$}' may be undefined`,Z,Y,$);return}let J=$.match(/^\w+/)?.[0];if(J&&!this.variables.has(J))this.addError(`Variable '${J}' is not defined`,Z,Y,$)}checkDirectives($){let Z=/@if\s*\(([^)]+)\)/g,Y;while((Y=Z.exec($))!==null){let G=Y[1].trim(),K=Y.index,W=this.getLineNumber(K,$),_=this.getColumn(K,$);this.checkExpression(G,W,_)}let X=/@foreach\s*\((\w+)\s+(?:as|in)\s+(\w+)(?:\s*,\s*(\w+))?\)/g;while((Y=X.exec($))!==null){let[,G,K,W]=Y,_=Y.index,B=this.getLineNumber(_,$),U=this.getColumn(_,$);if(!this.variables.has(G))this.addError(`Collection '${G}' is not defined`,B,U,Y[0]);else{let z=this.variables.get(G);if(z.kind==="array"&&z.elementType)this.variables.set(K,z.elementType);else this.variables.set(K,{kind:"primitive",value:"any"});if(W)this.variables.set(W,{kind:"primitive",value:"number"})}}let J=/@unless\s*\(([^)]+)\)/g;while((Y=J.exec($))!==null){let G=Y[1].trim(),K=Y.index,W=this.getLineNumber(K,$),_=this.getColumn(K,$);this.checkExpression(G,W,_)}let Q=/@switch\s*\(([^)]+)\)/g;while((Y=Q.exec($))!==null){let G=Y[1].trim(),K=Y.index,W=this.getLineNumber(K,$),_=this.getColumn(K,$);this.checkExpression(G,W,_)}}resolvePropertyAccess($){let Z=$.split("."),Y=this.variables.get(Z[0])||{kind:"primitive",value:"any"};for(let X=1;X<Z.length;X++){let J=Z[X].replace(/\(\)$/,"");if(Y.kind==="object"&&Y.properties)if(Y.properties[J])Y=Y.properties[J];else if(!this.options.allowAny)return{kind:"primitive",value:"undefined"};else Y={kind:"primitive",value:"any"};else if(Y.kind==="array"&&Y.elementType)if(["length"].includes(J))Y={kind:"primitive",value:"number"};else if(["map","filter","find","forEach","some","every","reduce"].includes(J))Y={kind:"function",returnType:{kind:"primitive",value:"any"}};else if(["join"].includes(J))Y={kind:"function",returnType:{kind:"primitive",value:"string"}};else Y={kind:"primitive",value:"any"};else if(Y.kind==="primitive"&&Y.value==="string")if(["length"].includes(J))Y={kind:"primitive",value:"number"};else if(["toUpperCase","toLowerCase","trim","slice","substring"].includes(J))Y={kind:"function",returnType:{kind:"primitive",value:"string"}};else if(["split"].includes(J))Y={kind:"function",returnType:{kind:"array",elementType:{kind:"primitive",value:"string"}}};else Y={kind:"primitive",value:"any"};else Y={kind:"primitive",value:"any"}}return Y}isLiteral($){let Z=$.trim();if(Z.startsWith('"')&&Z.endsWith('"')||Z.startsWith("'")&&Z.endsWith("'")||Z.startsWith("`")&&Z.endsWith("`"))return!0;if(/^-?\d+(\.\d+)?$/.test(Z))return!0;if(Z==="true"||Z==="false")return!0;if(Z==="null"||Z==="undefined")return!0;return!1}extractObjectLiteral($){let Z={},Y=$.slice(1,-1).trim();if(!Y)return Z;let X=this.splitByComma(Y);for(let J of X){let Q=J.indexOf(":");if(Q>0){let G=J.slice(0,Q).trim(),K=J.slice(Q+1).trim();Z[G]=K}}return Z}splitByComma($){let Z=[],Y="",X=0,J=null;for(let Q=0;Q<$.length;Q++){let G=$[Q],K=Q>0?$[Q-1]:"";if((G==='"'||G==="'"||G==="`")&&K!=="\\"){if(J===G)J=null;else if(!J)J=G}if(!J){if(G==="{"||G==="["||G==="(")X++;if(G==="}"||G==="]"||G===")")X--;if(G===","&&X===0){Z.push(Y.trim()),Y="";continue}}Y+=G}if(Y.trim())Z.push(Y.trim());return Z}getLineNumber($,Z){return((Z||"").slice(0,$).match(/\n/g)||[]).length+1}getColumn($,Z){let X=Z.slice(0,$).lastIndexOf(`
13489
- `);return $-X}addError($,Z,Y,X,J,Q){this.errors.push({message:$,file:this.currentFile,line:Z,column:Y,expression:X,expected:J,received:Q,severity:"error"})}addWarning($,Z,Y,X,J,Q){let G={message:$,file:this.currentFile,line:Z,column:Y,expression:X,expected:J,received:Q,severity:"warning"};if(this.options.strict)this.errors.push(G);else this.warnings.push(G)}getResult(){return{valid:this.errors.length===0,errors:this.errors,warnings:this.warnings,variables:new Map(this.variables)}}addVariable($,Z){this.variables.set($,Z)}reset(){if(this.errors=[],this.warnings=[],this.variables.clear(),this.options.includeBuiltins)Object.entries(vq).forEach(([$,Z])=>{this.variables.set($,Z)})}}function aJ($){return new oJ($)}function YE($,Z){return aJ(Z).checkFile($)}function XE($,Z){return aJ(Z).checkTemplate($)}function JE($){let Z=[];for(let Y of $.errors){if(Z.push(`\x1B[31merror\x1B[0m: ${Y.message}`),Z.push(` --> ${Y.file}:${Y.line}:${Y.column}`),Y.expression)Z.push(" |"),Z.push(` | ${Y.expression}`),Z.push(" |");if(Y.expected&&Y.received)Z.push(` expected: ${Y.expected}`),Z.push(` received: ${Y.received}`);Z.push("")}for(let Y of $.warnings){if(Z.push(`\x1B[33mwarning\x1B[0m: ${Y.message}`),Z.push(` --> ${Y.file}:${Y.line}:${Y.column}`),Y.expression)Z.push(" |"),Z.push(` | ${Y.expression}`),Z.push(" |");Z.push("")}if($.valid)Z.push("\x1B[32m\u2713 No type errors found\x1B[0m");else Z.push(`\x1B[31m\u2717 Found ${$.errors.length} error(s) and ${$.warnings.length} warning(s)\x1B[0m`);return Z.join(`
13490
- `)}var ZE,vq;var fq=D(()=>{ZE={strict:!1,allowAny:!0,checkPropertyAccess:!0,checkFunctionCalls:!0,includeBuiltins:!0},vq={console:{kind:"object",properties:{log:{kind:"function",params:[{name:"message",type:{kind:"primitive",value:"any"}}],returnType:{kind:"primitive",value:"void"}},error:{kind:"function",params:[{name:"message",type:{kind:"primitive",value:"any"}}],returnType:{kind:"primitive",value:"void"}},warn:{kind:"function",params:[{name:"message",type:{kind:"primitive",value:"any"}}],returnType:{kind:"primitive",value:"void"}}}},Math:{kind:"object",properties:{abs:{kind:"function",params:[{name:"x",type:{kind:"primitive",value:"number"}}],returnType:{kind:"primitive",value:"number"}},floor:{kind:"function",params:[{name:"x",type:{kind:"primitive",value:"number"}}],returnType:{kind:"primitive",value:"number"}},ceil:{kind:"function",params:[{name:"x",type:{kind:"primitive",value:"number"}}],returnType:{kind:"primitive",value:"number"}},round:{kind:"function",params:[{name:"x",type:{kind:"primitive",value:"number"}}],returnType:{kind:"primitive",value:"number"}},max:{kind:"function",params:[{name:"values",type:{kind:"primitive",value:"number"}}],returnType:{kind:"primitive",value:"number"}},min:{kind:"function",params:[{name:"values",type:{kind:"primitive",value:"number"}}],returnType:{kind:"primitive",value:"number"}},random:{kind:"function",params:[],returnType:{kind:"primitive",value:"number"}},PI:{kind:"primitive",value:"number"},E:{kind:"primitive",value:"number"}}},JSON:{kind:"object",properties:{stringify:{kind:"function",params:[{name:"value",type:{kind:"primitive",value:"any"}}],returnType:{kind:"primitive",value:"string"}},parse:{kind:"function",params:[{name:"text",type:{kind:"primitive",value:"string"}}],returnType:{kind:"primitive",value:"any"}}}},Date:{kind:"function",returnType:{kind:"object",properties:{getTime:{kind:"function",params:[],returnType:{kind:"primitive",value:"number"}},toISOString:{kind:"function",params:[],returnType:{kind:"primitive",value:"string"}},toLocaleDateString:{kind:"function",params:[],returnType:{kind:"primitive",value:"string"}}}}},Array:{kind:"object",properties:{isArray:{kind:"function",params:[{name:"value",type:{kind:"primitive",value:"any"}}],returnType:{kind:"primitive",value:"boolean"}},from:{kind:"function",params:[{name:"arrayLike",type:{kind:"primitive",value:"any"}}],returnType:{kind:"array",elementType:{kind:"primitive",value:"any"}}}}},Object:{kind:"object",properties:{keys:{kind:"function",params:[{name:"obj",type:{kind:"primitive",value:"any"}}],returnType:{kind:"array",elementType:{kind:"primitive",value:"string"}}},values:{kind:"function",params:[{name:"obj",type:{kind:"primitive",value:"any"}}],returnType:{kind:"array",elementType:{kind:"primitive",value:"any"}}},entries:{kind:"function",params:[{name:"obj",type:{kind:"primitive",value:"any"}}],returnType:{kind:"array",elementType:{kind:"primitive",value:"any"}}}}},String:{kind:"function",params:[{name:"value",type:{kind:"primitive",value:"any"}}],returnType:{kind:"primitive",value:"string"}},Number:{kind:"function",params:[{name:"value",type:{kind:"primitive",value:"any"}}],returnType:{kind:"primitive",value:"number"}},Boolean:{kind:"function",params:[{name:"value",type:{kind:"primitive",value:"any"}}],returnType:{kind:"primitive",value:"boolean"}},props:{kind:"object",properties:{}},slot:{kind:"primitive",value:"string"},loop:{kind:"object",properties:{index:{kind:"primitive",value:"number"},iteration:{kind:"primitive",value:"number"},first:{kind:"primitive",value:"boolean"},last:{kind:"primitive",value:"boolean"},even:{kind:"primitive",value:"boolean"},odd:{kind:"primitive",value:"boolean"},count:{kind:"primitive",value:"number"},remaining:{kind:"primitive",value:"number"},depth:{kind:"primitive",value:"number"},parent:{kind:"object",properties:{}}}}}});async function tJ($,Z,Y){if(!eJ)return;try{let X=$.getAttribute("data-island-id"),J=document.querySelector(`script[data-island-props="${X}"]`),Q=J?JSON.parse(J.textContent||"{}"):{},G=await Y(),K=G.default||G.hydrate;if(typeof K!=="function"){console.error(`Island handler for "${Z}" does not export a valid hydration function`);return}await K($,Q),$.setAttribute("data-hydrated","true")}catch(X){console.error(`Failed to hydrate island "${Z}":`,X)}}function QE($){if(!eJ)return;let Z=document.querySelectorAll("[data-island]"),Y=[];if(Z.forEach((X)=>{let J=X.getAttribute("data-island"),Q=X.getAttribute("data-priority")||"lazy";if(!J||!$[J]||X.getAttribute("data-hydrated")==="true")return;if(Q==="eager")tJ(X,J,$[J]);else Y.push([X,J])}),Y.length>0&&"IntersectionObserver"in window){let X=new IntersectionObserver((J)=>{J.forEach((Q)=>{if(Q.isIntersecting){let G=Q.target,K=G.getAttribute("data-island");if(K&&$[K]&&G.getAttribute("data-hydrated")!=="true")tJ(G,K,$[K]),X.unobserve(G)}})},{rootMargin:"200px",threshold:0});Y.forEach(([J])=>{X.observe(J)})}else setTimeout(()=>{Y.forEach(([X,J])=>{if(X.getAttribute("data-hydrated")!=="true")tJ(X,J,$[J])})},1000)}function GE($){if(!eJ)return;Object.entries($).forEach(([Z,Y])=>{try{let J=Y.toString().match(/import\(['"](.+)['"]\)/);if(J&&J[1]){let Q=document.createElement("link");Q.rel="modulepreload",Q.href=J[1],Q.setAttribute("data-island-module",Z),document.head.appendChild(Q)}}catch(X){console.warn(`Failed to preload island handler for "${Z}":`,X)}})}var eJ;var gq=D(()=>{eJ=typeof window<"u"&&typeof document<"u"});function hq($){if(!z7)return null;let Z=document.getElementById("stx-loading-indicator");if(Z)Z.remove();let Y=document.createElement("div");Y.id="stx-loading-indicator";let X=$.initialColor?`linear-gradient(to right, ${$.initialColor}, ${$.color})`:$.color;Y.style.cssText=`
13489
+ `);return $-X}addError($,Z,Y,X,J,Q){this.errors.push({message:$,file:this.currentFile,line:Z,column:Y,expression:X,expected:J,received:Q,severity:"error"})}addWarning($,Z,Y,X,J,Q){let G={message:$,file:this.currentFile,line:Z,column:Y,expression:X,expected:J,received:Q,severity:"warning"};if(this.options.strict)this.errors.push(G);else this.warnings.push(G)}getResult(){return{valid:this.errors.length===0,errors:this.errors,warnings:this.warnings,variables:new Map(this.variables)}}addVariable($,Z){this.variables.set($,Z)}reset(){if(this.errors=[],this.warnings=[],this.variables.clear(),this.options.includeBuiltins)Object.entries(vq).forEach(([$,Z])=>{this.variables.set($,Z)})}}function o2($){return new r2($)}function YE($,Z){return o2(Z).checkFile($)}function XE($,Z){return o2(Z).checkTemplate($)}function JE($){let Z=[];for(let Y of $.errors){if(Z.push(`\x1B[31merror\x1B[0m: ${Y.message}`),Z.push(` --> ${Y.file}:${Y.line}:${Y.column}`),Y.expression)Z.push(" |"),Z.push(` | ${Y.expression}`),Z.push(" |");if(Y.expected&&Y.received)Z.push(` expected: ${Y.expected}`),Z.push(` received: ${Y.received}`);Z.push("")}for(let Y of $.warnings){if(Z.push(`\x1B[33mwarning\x1B[0m: ${Y.message}`),Z.push(` --> ${Y.file}:${Y.line}:${Y.column}`),Y.expression)Z.push(" |"),Z.push(` | ${Y.expression}`),Z.push(" |");Z.push("")}if($.valid)Z.push("\x1B[32m\u2713 No type errors found\x1B[0m");else Z.push(`\x1B[31m\u2717 Found ${$.errors.length} error(s) and ${$.warnings.length} warning(s)\x1B[0m`);return Z.join(`
13490
+ `)}var ZE,vq;var fq=D(()=>{ZE={strict:!1,allowAny:!0,checkPropertyAccess:!0,checkFunctionCalls:!0,includeBuiltins:!0},vq={console:{kind:"object",properties:{log:{kind:"function",params:[{name:"message",type:{kind:"primitive",value:"any"}}],returnType:{kind:"primitive",value:"void"}},error:{kind:"function",params:[{name:"message",type:{kind:"primitive",value:"any"}}],returnType:{kind:"primitive",value:"void"}},warn:{kind:"function",params:[{name:"message",type:{kind:"primitive",value:"any"}}],returnType:{kind:"primitive",value:"void"}}}},Math:{kind:"object",properties:{abs:{kind:"function",params:[{name:"x",type:{kind:"primitive",value:"number"}}],returnType:{kind:"primitive",value:"number"}},floor:{kind:"function",params:[{name:"x",type:{kind:"primitive",value:"number"}}],returnType:{kind:"primitive",value:"number"}},ceil:{kind:"function",params:[{name:"x",type:{kind:"primitive",value:"number"}}],returnType:{kind:"primitive",value:"number"}},round:{kind:"function",params:[{name:"x",type:{kind:"primitive",value:"number"}}],returnType:{kind:"primitive",value:"number"}},max:{kind:"function",params:[{name:"values",type:{kind:"primitive",value:"number"}}],returnType:{kind:"primitive",value:"number"}},min:{kind:"function",params:[{name:"values",type:{kind:"primitive",value:"number"}}],returnType:{kind:"primitive",value:"number"}},random:{kind:"function",params:[],returnType:{kind:"primitive",value:"number"}},PI:{kind:"primitive",value:"number"},E:{kind:"primitive",value:"number"}}},JSON:{kind:"object",properties:{stringify:{kind:"function",params:[{name:"value",type:{kind:"primitive",value:"any"}}],returnType:{kind:"primitive",value:"string"}},parse:{kind:"function",params:[{name:"text",type:{kind:"primitive",value:"string"}}],returnType:{kind:"primitive",value:"any"}}}},Date:{kind:"function",returnType:{kind:"object",properties:{getTime:{kind:"function",params:[],returnType:{kind:"primitive",value:"number"}},toISOString:{kind:"function",params:[],returnType:{kind:"primitive",value:"string"}},toLocaleDateString:{kind:"function",params:[],returnType:{kind:"primitive",value:"string"}}}}},Array:{kind:"object",properties:{isArray:{kind:"function",params:[{name:"value",type:{kind:"primitive",value:"any"}}],returnType:{kind:"primitive",value:"boolean"}},from:{kind:"function",params:[{name:"arrayLike",type:{kind:"primitive",value:"any"}}],returnType:{kind:"array",elementType:{kind:"primitive",value:"any"}}}}},Object:{kind:"object",properties:{keys:{kind:"function",params:[{name:"obj",type:{kind:"primitive",value:"any"}}],returnType:{kind:"array",elementType:{kind:"primitive",value:"string"}}},values:{kind:"function",params:[{name:"obj",type:{kind:"primitive",value:"any"}}],returnType:{kind:"array",elementType:{kind:"primitive",value:"any"}}},entries:{kind:"function",params:[{name:"obj",type:{kind:"primitive",value:"any"}}],returnType:{kind:"array",elementType:{kind:"primitive",value:"any"}}}}},String:{kind:"function",params:[{name:"value",type:{kind:"primitive",value:"any"}}],returnType:{kind:"primitive",value:"string"}},Number:{kind:"function",params:[{name:"value",type:{kind:"primitive",value:"any"}}],returnType:{kind:"primitive",value:"number"}},Boolean:{kind:"function",params:[{name:"value",type:{kind:"primitive",value:"any"}}],returnType:{kind:"primitive",value:"boolean"}},props:{kind:"object",properties:{}},slot:{kind:"primitive",value:"string"},loop:{kind:"object",properties:{index:{kind:"primitive",value:"number"},iteration:{kind:"primitive",value:"number"},first:{kind:"primitive",value:"boolean"},last:{kind:"primitive",value:"boolean"},even:{kind:"primitive",value:"boolean"},odd:{kind:"primitive",value:"boolean"},count:{kind:"primitive",value:"number"},remaining:{kind:"primitive",value:"number"},depth:{kind:"primitive",value:"number"},parent:{kind:"object",properties:{}}}}}});async function a2($,Z,Y){if(!t2)return;try{let X=$.getAttribute("data-island-id"),J=document.querySelector(`script[data-island-props="${X}"]`),Q=J?JSON.parse(J.textContent||"{}"):{},G=await Y(),K=G.default||G.hydrate;if(typeof K!=="function"){console.error(`Island handler for "${Z}" does not export a valid hydration function`);return}await K($,Q),$.setAttribute("data-hydrated","true")}catch(X){console.error(`Failed to hydrate island "${Z}":`,X)}}function QE($){if(!t2)return;let Z=document.querySelectorAll("[data-island]"),Y=[];if(Z.forEach((X)=>{let J=X.getAttribute("data-island"),Q=X.getAttribute("data-priority")||"lazy";if(!J||!$[J]||X.getAttribute("data-hydrated")==="true")return;if(Q==="eager")a2(X,J,$[J]);else Y.push([X,J])}),Y.length>0&&"IntersectionObserver"in window){let X=new IntersectionObserver((J)=>{J.forEach((Q)=>{if(Q.isIntersecting){let G=Q.target,K=G.getAttribute("data-island");if(K&&$[K]&&G.getAttribute("data-hydrated")!=="true")a2(G,K,$[K]),X.unobserve(G)}})},{rootMargin:"200px",threshold:0});Y.forEach(([J])=>{X.observe(J)})}else setTimeout(()=>{Y.forEach(([X,J])=>{if(X.getAttribute("data-hydrated")!=="true")a2(X,J,$[J])})},1000)}function GE($){if(!t2)return;Object.entries($).forEach(([Z,Y])=>{try{let J=Y.toString().match(/import\(['"](.+)['"]\)/);if(J&&J[1]){let Q=document.createElement("link");Q.rel="modulepreload",Q.href=J[1],Q.setAttribute("data-island-module",Z),document.head.appendChild(Q)}}catch(X){console.warn(`Failed to preload island handler for "${Z}":`,X)}})}var t2;var gq=D(()=>{t2=typeof window<"u"&&typeof document<"u"});function hq($){if(!z7)return null;let Z=document.getElementById("stx-loading-indicator");if(Z)Z.remove();let Y=document.createElement("div");Y.id="stx-loading-indicator";let X=$.initialColor?`linear-gradient(to right, ${$.initialColor}, ${$.color})`:$.color;Y.style.cssText=`
13491
13491
  position: fixed;
13492
13492
  top: 0;
13493
13493
  left: 0;
@@ -13518,7 +13518,7 @@ else {
13518
13518
  0% { transform: translateX(-100%); }
13519
13519
  100% { transform: translateX(100%); }
13520
13520
  }
13521
- `,document.head.appendChild(Q)}return document.body.appendChild(Y),Y}function s8($,Z){if(!z7||!Z1)return;if(x1=Math.min(Math.max($,0),100),$9)cancelAnimationFrame($9);$9=requestAnimationFrame(()=>{if(!Z1)return;Z1.style.opacity=x1>0?"1":"0",Z1.style.transform=`scaleX(${x1/100})`})}function KE($){if(!z7)return;if(a4=!0,x1=0,!Z1)Z1=hq($);if(U7)clearTimeout(U7);if(o1)clearInterval(o1);s8(10,$),o1=setInterval(()=>{if(!a4)return;let Z=90-x1,Y=Math.max(0.5,Z*0.1);if(x1<90)s8(x1+Y,$)},$.throttle)}function WE($){if(!z7)return;if(a4=!1,o1)clearInterval(o1),o1=null;s8(100,$),U7=setTimeout(()=>{if(Z1)Z1.style.opacity="0";setTimeout(()=>{if(x1=0,Z1)Z1.style.transform="scaleX(0)"},300)},200)}function _E(){if(!z7)return;if(a4=!1,x1=0,o1)clearInterval(o1),o1=null;if(U7)clearTimeout(U7),U7=null;if(Z1)Z1.style.opacity="0",Z1.style.transform="scaleX(0)"}function dq($){let Z={...Z9,...$};return{start:()=>KE(Z),set:(Y)=>s8(Y,Z),finish:()=>WE(Z),clear:()=>_E(),get state(){return{isLoading:a4,progress:x1,error:!1}}}}function BE($){if(!z7)return;let Z={...Z9,...$},Y=dq(Z);Z1=hq(Z);let X=!1;document.addEventListener("click",(G)=>{let W=G.target.closest("a");if(!W)return;let _=W.getAttribute("href");if(!_)return;if(_.startsWith("http")||_.startsWith("#")||_.startsWith("mailto:")||_.startsWith("tel:")||W.target==="_blank"||W.hasAttribute("download"))return;X=!0,Y.start()}),window.addEventListener("popstate",()=>{if(!X)Y.start(),X=!0}),window.addEventListener("load",()=>{if(X||Z.autoFinish)Y.finish(),X=!1});let J=window.fetch,Q=0;window.fetch=async function(...G){let K=typeof G[0]==="string"?G[0]:G[0].url,W=K.includes("/api/")||K.startsWith("/api");if(W){if(Q++,Q===1&&!X)Y.start()}try{return await J.apply(this,G)}finally{if(W){if(Q--,Q===0&&!X)Y.finish()}}}}function UE($){let Z={...Z9,...$},Y=Z.initialColor?`linear-gradient(to right, ${Z.initialColor}, ${Z.color})`:Z.color;return`
13521
+ `,document.head.appendChild(Q)}return document.body.appendChild(Y),Y}function s8($,Z){if(!z7||!Z1)return;if(x1=Math.min(Math.max($,0),100),e2)cancelAnimationFrame(e2);e2=requestAnimationFrame(()=>{if(!Z1)return;Z1.style.opacity=x1>0?"1":"0",Z1.style.transform=`scaleX(${x1/100})`})}function KE($){if(!z7)return;if(a4=!0,x1=0,!Z1)Z1=hq($);if(U7)clearTimeout(U7);if(o1)clearInterval(o1);s8(10,$),o1=setInterval(()=>{if(!a4)return;let Z=90-x1,Y=Math.max(0.5,Z*0.1);if(x1<90)s8(x1+Y,$)},$.throttle)}function WE($){if(!z7)return;if(a4=!1,o1)clearInterval(o1),o1=null;s8(100,$),U7=setTimeout(()=>{if(Z1)Z1.style.opacity="0";setTimeout(()=>{if(x1=0,Z1)Z1.style.transform="scaleX(0)"},300)},200)}function _E(){if(!z7)return;if(a4=!1,x1=0,o1)clearInterval(o1),o1=null;if(U7)clearTimeout(U7),U7=null;if(Z1)Z1.style.opacity="0",Z1.style.transform="scaleX(0)"}function dq($){let Z={...$9,...$};return{start:()=>KE(Z),set:(Y)=>s8(Y,Z),finish:()=>WE(Z),clear:()=>_E(),get state(){return{isLoading:a4,progress:x1,error:!1}}}}function BE($){if(!z7)return;let Z={...$9,...$},Y=dq(Z);Z1=hq(Z);let X=!1;document.addEventListener("click",(G)=>{let W=G.target.closest("a");if(!W)return;let _=W.getAttribute("href");if(!_)return;if(_.startsWith("http")||_.startsWith("#")||_.startsWith("mailto:")||_.startsWith("tel:")||W.target==="_blank"||W.hasAttribute("download"))return;X=!0,Y.start()}),window.addEventListener("popstate",()=>{if(!X)Y.start(),X=!0}),window.addEventListener("load",()=>{if(X||Z.autoFinish)Y.finish(),X=!1});let J=window.fetch,Q=0;window.fetch=async function(...G){let K=typeof G[0]==="string"?G[0]:G[0].url,W=K.includes("/api/")||K.startsWith("/api");if(W){if(Q++,Q===1&&!X)Y.start()}try{return await J.apply(this,G)}finally{if(W){if(Q--,Q===0&&!X)Y.finish()}}}}function UE($){let Z={...$9,...$},Y=Z.initialColor?`linear-gradient(to right, ${Z.initialColor}, ${Z.color})`:Z.color;return`
13522
13522
  <div id="stx-loading-indicator" style="
13523
13523
  position: fixed;
13524
13524
  top: 0;
@@ -13612,7 +13612,7 @@ else {
13612
13612
  window.addEventListener('load', function() { window.stxLoading.finish(); });
13613
13613
  })();
13614
13614
  </script>
13615
- `}var z7,Z9,Z1=null,x1=0,a4=!1,$9=null,U7=null,o1=null;var uq=D(()=>{z7=typeof window<"u"&&typeof document<"u",Z9={color:"#6366f1",initialColor:"",height:"3px",duration:2000,throttle:200,autoFinish:!0,zIndex:999999}});class mq{instances=new Map;componentsByFile=new Map;stateSnapshots=new Map;config;constructor($={}){this.config={preserveState:$.preserveState??!0,maxStateAge:$.maxStateAge??30000,errorRecovery:$.errorRecovery??!0,verbose:$.verbose??!1,serializeState:$.serializeState??this.defaultSerializeState.bind(this),deserializeState:$.deserializeState??this.defaultDeserializeState.bind(this)}}register($){if(this.instances.set($.id,$),!this.componentsByFile.has($.name))this.componentsByFile.set($.name,new Set);if(this.componentsByFile.get($.name).add($.id),this.config.verbose)console.log(`[HMR] Registered component: ${$.name} (${$.id})`)}unregister($){let Z=this.instances.get($);if(!Z)return;if(this.componentsByFile.get(Z.name)?.delete($),this.componentsByFile.get(Z.name)?.size===0)this.componentsByFile.delete(Z.name);if(this.stateSnapshots.delete($),Z.cleanup?.(),this.instances.delete($),this.config.verbose)console.log(`[HMR] Unregistered component: ${Z.name} (${$})`)}getInstancesByFile($){let Z=this.componentsByFile.get($)||new Set;return Array.from(Z).map((Y)=>this.instances.get(Y)).filter(Boolean)}getInstance($){return this.instances.get($)}captureState($){let Z=this.instances.get($);if(!Z||!this.config.preserveState)return;let Y=this.config.serializeState(Z);if(this.stateSnapshots.set($,Y),this.config.verbose)console.log(`[HMR] Captured state for: ${Z.name}`)}restoreState($){let Z=this.instances.get($),Y=this.stateSnapshots.get($);if(!Z||!Y||!this.config.preserveState)return!1;if(Date.now()-Y.timestamp>this.config.maxStateAge){if(this.stateSnapshots.delete($),this.config.verbose)console.log(`[HMR] State expired for: ${Z.name}`);return!1}try{if(this.config.deserializeState(Y,Z),this.config.verbose)console.log(`[HMR] Restored state for: ${Z.name}`);return!0}catch(X){return console.error(`[HMR] Failed to restore state for ${Z.name}:`,X),!1}}defaultSerializeState($){let Z={},Y={};if($.element)$.element.querySelectorAll("[data-stx-ref]").forEach((J)=>{let Q=J.getAttribute("data-stx-ref"),G=J.getAttribute("data-stx-value");if(Q&&G)try{Z[Q]=JSON.parse(G)}catch{Z[Q]=G}});return{refs:Z,reactiveObjects:Y,custom:$.state?.custom||{},timestamp:Date.now()}}defaultDeserializeState($,Z){if(Z.element)Object.entries($.refs).forEach(([Y,X])=>{let J=Z.element.querySelector(`[data-stx-ref="${Y}"]`);if(J)J.setAttribute("data-stx-value",JSON.stringify(X)),J.dispatchEvent(new CustomEvent("stx:state-restored",{detail:{name:Y,value:X},bubbles:!0}))});Z.state={...$,timestamp:Date.now()}}getAllInstances(){return Array.from(this.instances.values())}clear(){for(let $ of this.instances.values())$.cleanup?.();this.instances.clear(),this.componentsByFile.clear(),this.stateSnapshots.clear()}}class Y9{registry;config;pendingUpdates=new Map;updateQueue=Promise.resolve();constructor($={}){this.config={preserveState:$.preserveState??!0,maxStateAge:$.maxStateAge??30000,errorRecovery:$.errorRecovery??!0,verbose:$.verbose??!1,serializeState:$.serializeState??(()=>({refs:{},reactiveObjects:{},custom:{},timestamp:Date.now()})),deserializeState:$.deserializeState??(()=>{})},this.registry=new mq(this.config)}register($){this.registry.register($)}unregister($){this.registry.unregister($)}async handleUpdate($){return this.updateQueue=this.updateQueue.then(()=>this.processUpdate($)),this.updateQueue}async processUpdate($){let Z=this.registry.getInstancesByFile($.file);if(Z.length===0){if(this.config.verbose)console.log(`[HMR] No instances found for: ${$.file}`);return}if(this.config.verbose)console.log(`[HMR] Updating ${Z.length} instance(s) of: ${$.file}`);for(let Y of Z)await this.updateInstance(Y,$);if(typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hmr-update",{detail:{file:$.file,count:Z.length}}))}async updateInstance($,Z){this.registry.captureState($.id);let Y=!1,X=$.element?.innerHTML||"";try{if($.element?.dispatchEvent(new CustomEvent("stx:before-hmr-update",{bubbles:!0})),$.cleanup?.(),Z.type==="style")await this.updateStyles($,Z);else await this.updateComponent($,Z);let J=this.registry.restoreState($.id);if(!J&&$.setup)await $.setup();$.element?.dispatchEvent(new CustomEvent("stx:after-hmr-update",{detail:{stateRestored:J},bubbles:!0}))}catch(J){if(Y=!0,console.error(`[HMR] Error updating component ${$.name}:`,J),this.config.errorRecovery){if($.element&&X)$.element.innerHTML=X,console.log(`[HMR] Recovered previous state for: ${$.name}`);$.element?.dispatchEvent(new CustomEvent("stx:hmr-error",{detail:{error:J},bubbles:!0}))}}if(!Y&&this.config.verbose)console.log(`[HMR] Successfully updated: ${$.name}`)}async updateComponent($,Z){if(!$.element)return;let{html:Y,script:X}=this.parseComponentCode(Z.code);if(Y)$.element.innerHTML=Y;if(X)await this.executeScript(X,$);if($.render)$.element.innerHTML=$.render();this.reinitializeInteractivity($)}async updateStyles($,Z){if(!$.element)return;let Y=Z.code.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i);if(!Y)return;let X=Y[1],J=$.id,Q=document.querySelector(`style[data-stx-component="${J}"]`);if(!Q)Q=document.createElement("style"),Q.setAttribute("data-stx-component",J),document.head.appendChild(Q);if(Q.textContent=X,this.config.verbose)console.log(`[HMR] Updated styles for: ${$.name}`)}parseComponentCode($){let Z=$,Y="",X="",J=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(J)Y=J[1],Z=Z.replace(J[0],"");let Q=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i);if(Q)X=Q[1],Z=Z.replace(Q[0],"");return{html:Z.trim(),script:Y.trim(),style:X.trim()}}async executeScript($,Z){try{let Y={element:Z.element,props:Z.props,...typeof window<"u"?window.stx:{}},X=`
13615
+ `}var z7,$9,Z1=null,x1=0,a4=!1,e2=null,U7=null,o1=null;var uq=D(()=>{z7=typeof window<"u"&&typeof document<"u",$9={color:"#6366f1",initialColor:"",height:"3px",duration:2000,throttle:200,autoFinish:!0,zIndex:999999}});class mq{instances=new Map;componentsByFile=new Map;stateSnapshots=new Map;config;constructor($={}){this.config={preserveState:$.preserveState??!0,maxStateAge:$.maxStateAge??30000,errorRecovery:$.errorRecovery??!0,verbose:$.verbose??!1,serializeState:$.serializeState??this.defaultSerializeState.bind(this),deserializeState:$.deserializeState??this.defaultDeserializeState.bind(this)}}register($){if(this.instances.set($.id,$),!this.componentsByFile.has($.name))this.componentsByFile.set($.name,new Set);if(this.componentsByFile.get($.name).add($.id),this.config.verbose)console.log(`[HMR] Registered component: ${$.name} (${$.id})`)}unregister($){let Z=this.instances.get($);if(!Z)return;if(this.componentsByFile.get(Z.name)?.delete($),this.componentsByFile.get(Z.name)?.size===0)this.componentsByFile.delete(Z.name);if(this.stateSnapshots.delete($),Z.cleanup?.(),this.instances.delete($),this.config.verbose)console.log(`[HMR] Unregistered component: ${Z.name} (${$})`)}getInstancesByFile($){let Z=this.componentsByFile.get($)||new Set;return Array.from(Z).map((Y)=>this.instances.get(Y)).filter(Boolean)}getInstance($){return this.instances.get($)}captureState($){let Z=this.instances.get($);if(!Z||!this.config.preserveState)return;let Y=this.config.serializeState(Z);if(this.stateSnapshots.set($,Y),this.config.verbose)console.log(`[HMR] Captured state for: ${Z.name}`)}restoreState($){let Z=this.instances.get($),Y=this.stateSnapshots.get($);if(!Z||!Y||!this.config.preserveState)return!1;if(Date.now()-Y.timestamp>this.config.maxStateAge){if(this.stateSnapshots.delete($),this.config.verbose)console.log(`[HMR] State expired for: ${Z.name}`);return!1}try{if(this.config.deserializeState(Y,Z),this.config.verbose)console.log(`[HMR] Restored state for: ${Z.name}`);return!0}catch(X){return console.error(`[HMR] Failed to restore state for ${Z.name}:`,X),!1}}defaultSerializeState($){let Z={},Y={};if($.element)$.element.querySelectorAll("[data-stx-ref]").forEach((J)=>{let Q=J.getAttribute("data-stx-ref"),G=J.getAttribute("data-stx-value");if(Q&&G)try{Z[Q]=JSON.parse(G)}catch{Z[Q]=G}});return{refs:Z,reactiveObjects:Y,custom:$.state?.custom||{},timestamp:Date.now()}}defaultDeserializeState($,Z){if(Z.element)Object.entries($.refs).forEach(([Y,X])=>{let J=Z.element.querySelector(`[data-stx-ref="${Y}"]`);if(J)J.setAttribute("data-stx-value",JSON.stringify(X)),J.dispatchEvent(new CustomEvent("stx:state-restored",{detail:{name:Y,value:X},bubbles:!0}))});Z.state={...$,timestamp:Date.now()}}getAllInstances(){return Array.from(this.instances.values())}clear(){for(let $ of this.instances.values())$.cleanup?.();this.instances.clear(),this.componentsByFile.clear(),this.stateSnapshots.clear()}}class Z9{registry;config;pendingUpdates=new Map;updateQueue=Promise.resolve();constructor($={}){this.config={preserveState:$.preserveState??!0,maxStateAge:$.maxStateAge??30000,errorRecovery:$.errorRecovery??!0,verbose:$.verbose??!1,serializeState:$.serializeState??(()=>({refs:{},reactiveObjects:{},custom:{},timestamp:Date.now()})),deserializeState:$.deserializeState??(()=>{})},this.registry=new mq(this.config)}register($){this.registry.register($)}unregister($){this.registry.unregister($)}async handleUpdate($){return this.updateQueue=this.updateQueue.then(()=>this.processUpdate($)),this.updateQueue}async processUpdate($){let Z=this.registry.getInstancesByFile($.file);if(Z.length===0){if(this.config.verbose)console.log(`[HMR] No instances found for: ${$.file}`);return}if(this.config.verbose)console.log(`[HMR] Updating ${Z.length} instance(s) of: ${$.file}`);for(let Y of Z)await this.updateInstance(Y,$);if(typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hmr-update",{detail:{file:$.file,count:Z.length}}))}async updateInstance($,Z){this.registry.captureState($.id);let Y=!1,X=$.element?.innerHTML||"";try{if($.element?.dispatchEvent(new CustomEvent("stx:before-hmr-update",{bubbles:!0})),$.cleanup?.(),Z.type==="style")await this.updateStyles($,Z);else await this.updateComponent($,Z);let J=this.registry.restoreState($.id);if(!J&&$.setup)await $.setup();$.element?.dispatchEvent(new CustomEvent("stx:after-hmr-update",{detail:{stateRestored:J},bubbles:!0}))}catch(J){if(Y=!0,console.error(`[HMR] Error updating component ${$.name}:`,J),this.config.errorRecovery){if($.element&&X)$.element.innerHTML=X,console.log(`[HMR] Recovered previous state for: ${$.name}`);$.element?.dispatchEvent(new CustomEvent("stx:hmr-error",{detail:{error:J},bubbles:!0}))}}if(!Y&&this.config.verbose)console.log(`[HMR] Successfully updated: ${$.name}`)}async updateComponent($,Z){if(!$.element)return;let{html:Y,script:X}=this.parseComponentCode(Z.code);if(Y)$.element.innerHTML=Y;if(X)await this.executeScript(X,$);if($.render)$.element.innerHTML=$.render();this.reinitializeInteractivity($)}async updateStyles($,Z){if(!$.element)return;let Y=Z.code.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i);if(!Y)return;let X=Y[1],J=$.id,Q=document.querySelector(`style[data-stx-component="${J}"]`);if(!Q)Q=document.createElement("style"),Q.setAttribute("data-stx-component",J),document.head.appendChild(Q);if(Q.textContent=X,this.config.verbose)console.log(`[HMR] Updated styles for: ${$.name}`)}parseComponentCode($){let Z=$,Y="",X="",J=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(J)Y=J[1],Z=Z.replace(J[0],"");let Q=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i);if(Q)X=Q[1],Z=Z.replace(Q[0],"");return{html:Z.trim(),script:Y.trim(),style:X.trim()}}async executeScript($,Z){try{let Y={element:Z.element,props:Z.props,...typeof window<"u"?window.stx:{}},X=`
13616
13616
  return (async function() {
13617
13617
  ${$}
13618
13618
  })()
@@ -13883,7 +13883,7 @@ else {
13883
13883
  observer.observe(document.body, { childList: true, subtree: true });
13884
13884
  })();
13885
13885
  </script>
13886
- `}function jE($){if(!q7)q7=new Y9($);return q7}function HE(){if(q7)q7.getRegistry().clear(),q7=null}var q7=null;var pq=()=>{};function cq($){let Z={refs:$.refs||{},reactive:$.reactive||{},props:$.props||{},routeParams:$.routeParams||{},stores:$.stores||{},meta:$.meta||{},timestamp:Date.now()};return Z.checksum=lq(Z),JSON.stringify(Z).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/'/g,"\\u0027")}function lq($){let Z=JSON.stringify({refs:Object.keys($.refs||{}),reactive:Object.keys($.reactive||{}),props:Object.keys($.props||{})}),Y=0;for(let X=0;X<Z.length;X++){let J=Z.charCodeAt(X);Y=(Y<<5)-Y+J,Y=Y&Y}return Math.abs(Y).toString(36)}function iq($){return`<script id="__STX_STATE__" type="application/json">${cq($)}</script>`}function OE($){if($.length===0)return"";return`data-stx-events='${JSON.stringify($)}'`}function nq(){if(typeof window>"u")return null;let $=document.getElementById("__STX_STATE__");if(!$)return null;try{let Z=JSON.parse($.textContent||"{}");if(Z.checksum){if(lq(Z)!==Z.checksum)console.warn("[Hydration] State checksum mismatch - state may be corrupted")}return Z}catch(Z){return console.error("[Hydration] Failed to parse state:",Z),null}}class J9{state=null;options;root=null;isHydrated=!1;pendingComponents=new Map;hydratedComponents=new Set;constructor($={}){this.options={root:$.root||"#app",strict:$.strict??!1,onHydrating:$.onHydrating||(()=>{}),onHydrated:$.onHydrated||(()=>{}),onError:$.onError||console.error,performance:$.performance??!1,timeout:$.timeout??1e4}}async hydrate(){if(typeof window>"u")return;if(this.isHydrated)return;let $=this.options.performance?performance.now():0;try{this.root=typeof this.options.root==="string"?document.querySelector(this.options.root)||document.body:this.options.root,this.state=nq(),this.options.onHydrating(),this.root.classList.add("stx-hydrating");let Z=new Promise((Y,X)=>{setTimeout(()=>X(Error("Hydration timeout")),this.options.timeout)});if(await Promise.race([this.runHydration(),Z]),this.isHydrated=!0,this.root.classList.remove("stx-hydrating"),this.root.classList.add("stx-hydrated"),this.options.performance){let Y=performance.now()-$;console.log(`[Hydration] Completed in ${Y.toFixed(2)}ms`)}this.options.onHydrated(),window.dispatchEvent(new CustomEvent("stx:hydrated"))}catch(Z){this.root?.classList.remove("stx-hydrating"),this.root?.classList.add("stx-hydration-error"),this.options.onError(Z),window.dispatchEvent(new CustomEvent("stx:hydration-error",{detail:{error:Z}}))}}async runHydration(){if(!this.root)return;this.restoreGlobalState(),await this.hydrateComponents(),this.bindEventHandlers(),this.initializeReactiveBindings(),this.setupRouterIntegration()}restoreGlobalState(){if(!this.state)return;let $=window.stx;if(!$)return;if(this.state.routeParams&&$.setRouteParams)$.setRouteParams(this.state.routeParams);if(this.state.stores&&$.registerStore)Object.entries(this.state.stores).forEach(([Z,Y])=>{$.registerStore(Z,Y)});window.dispatchEvent(new CustomEvent("stx:state-restored",{detail:this.state}))}async hydrateComponents(){if(!this.root)return;let $=this.root.querySelectorAll("[data-stx-component]");for(let Z of Array.from($)){let Y=Z.getAttribute("data-stx-component"),X=Z.getAttribute("data-stx-name")||Y,J=Z.getAttribute("data-stx-hydrate")||"eager",Q=Z.getAttribute("data-stx-props");if(!Y)continue;let G={id:Y,name:X||Y,strategy:J,props:Q?JSON.parse(Q):{},events:[]};switch(this.pendingComponents.set(Y,G),G.strategy){case"eager":await this.hydrateComponent(Z,G);break;case"lazy":case"visible":this.setupVisibleHydration(Z,G);break;case"idle":this.setupIdleHydration(Z,G);break;case"interaction":this.setupInteractionHydration(Z,G);break}}}async hydrateComponent($,Z){if(this.hydratedComponents.has(Z.id))return;try{let Y=this.state?.refs[Z.id]||this.state?.reactive[Z.id]||{};this.restoreComponentState($,Y),this.bindComponentEvents($),this.initializeComponentReactivity($,Z),this.hydratedComponents.add(Z.id),$.classList.add("stx-hydrated"),$.setAttribute("data-hydrated","true"),$.dispatchEvent(new CustomEvent("stx:component-hydrated",{detail:{id:Z.id,name:Z.name},bubbles:!0}))}catch(Y){if(console.error(`[Hydration] Failed to hydrate component ${Z.id}:`,Y),$.classList.add("stx-hydration-error"),this.options.strict)throw Y}}restoreComponentState($,Z){if(!Z||typeof Z!=="object")return;$.querySelectorAll("[data-stx-bind]").forEach((X)=>{let J=X.getAttribute("data-stx-bind");if(!J||!Z[J])return;let Q=Z[J];if(X instanceof HTMLInputElement)if(X.type==="checkbox"||X.type==="radio")X.checked=Boolean(Q);else X.value=String(Q);else if(X instanceof HTMLSelectElement)X.value=String(Q);else if(X instanceof HTMLTextAreaElement)X.value=String(Q);else X.textContent=String(Q)})}setupVisibleHydration($,Z){if(!("IntersectionObserver"in window)){this.hydrateComponent($,Z);return}let Y=new IntersectionObserver((X)=>{X.forEach((J)=>{if(J.isIntersecting)Y.disconnect(),this.hydrateComponent($,Z)})},{rootMargin:"100px",threshold:0});Y.observe($)}setupIdleHydration($,Z){let Y=()=>this.hydrateComponent($,Z);if("requestIdleCallback"in window)window.requestIdleCallback(Y,{timeout:2000});else setTimeout(Y,200)}setupInteractionHydration($,Z){let Y=["mouseenter","touchstart","focusin"],X=()=>{Y.forEach((J)=>$.removeEventListener(J,X)),this.hydrateComponent($,Z)};Y.forEach((J)=>{$.addEventListener(J,X,{once:!0,passive:!0})})}bindEventHandlers(){if(!this.root)return;this.root.querySelectorAll("[data-stx-events]").forEach((Z)=>this.bindElementEvents(Z)),this.bindDirectiveEvents()}bindElementEvents($){let Z=$.getAttribute("data-stx-events");if(!Z)return;try{JSON.parse(Z).forEach((X)=>{this.bindSingleEvent($,X)})}catch(Y){console.error("[Hydration] Failed to parse events:",Y)}}bindDirectiveEvents(){if(!this.root)return;["click","submit","input","change","focus","blur","keydown","keyup","keypress","mouseenter","mouseleave","touchstart","touchend","scroll","resize"].forEach((Z)=>{let Y=`data-stx-on-${Z}`;this.root.querySelectorAll(`[${Y}]`).forEach((J)=>{let Q=J.getAttribute(Y);if(!Q)return;this.bindSingleEvent(J,{type:Z,handler:Q,modifiers:this.parseModifiers(J,Z)})})})}parseModifiers($,Z){let Y=[],X=$.getAttribute(`data-stx-${Z}-modifiers`);if(X)Y.push(...X.split(",").map((J)=>J.trim()));return Y}bindSingleEvent($,Z){let Y=this.resolveHandler(Z.handler);if(!Y){console.warn(`[Hydration] Handler not found: ${Z.handler}`);return}let X=(Q)=>{if(Z.modifiers?.includes("prevent")||Z.preventDefault)Q.preventDefault();if(Z.modifiers?.includes("stop")||Z.stopPropagation)Q.stopPropagation();try{Y.call($,Q)}catch(G){console.error("[Hydration] Event handler error:",G)}},J={};if(Z.modifiers?.includes("once"))J.once=!0;if(Z.modifiers?.includes("passive"))J.passive=!0;if(Z.modifiers?.includes("capture"))J.capture=!0;$.addEventListener(Z.type,X,J)}resolveHandler($){let Z=window.stx;if(Z&&Z[$])return Z[$];if(window[$])return window[$];try{if($.match(/^\w+\+\+$/)||$.match(/^\w+--$/)){let J=$.replace(/[+-]+$/,"");return()=>{if(Z&&Z[J]){if(typeof Z[J].value<"u")if($.includes("++"))Z[J].value++;else Z[J].value--}}}let Y=$.match(/^(\w+)\s*=\s*(.+)$/);if(Y){let[,J,Q]=Y;return()=>{if(Z&&Z[J]){let G=Function(`return ${Q}`)();if(typeof Z[J].value<"u")Z[J].value=G}}}let X=$.match(/^(\w+)\((.*)\)$/);if(X){let[,J,Q]=X;return(G)=>{let K=Z?.[J]||window[J];if(K){let W=Q?Function("$event",`return [${Q}]`)(G):[];K(...W)}}}return(J)=>{Function("$event","stx",$)(J,Z)}}catch{return null}}bindComponentEvents($){$.querySelectorAll("[data-stx-events]").forEach((Y)=>{this.bindElementEvents(Y)})}initializeComponentReactivity($,Z){if(!window.stx)return;$.querySelectorAll("[data-stx-reactive]").forEach((J)=>{let Q=J.getAttribute("data-stx-reactive");if(!Q)return;this.setupReactiveBinding(J,Q)})}initializeReactiveBindings(){if(!this.root)return;this.getTextNodesWithExpressions(this.root).forEach(({node:Y,expressions:X})=>{X.forEach((J)=>{this.setupTextNodeBinding(Y,J)})}),this.root.querySelectorAll("[data-stx-bind-attrs]").forEach((Y)=>{let X=Y.getAttribute("data-stx-bind-attrs");if(!X)return;try{let J=JSON.parse(X);Object.entries(J).forEach(([Q,G])=>{this.setupAttributeBinding(Y,Q,G)})}catch{}})}getTextNodesWithExpressions($){let Z=[],Y=document.createTreeWalker($,NodeFilter.SHOW_TEXT),X;while(X=Y.nextNode()){let Q=(X.textContent||"").match(/\{\{\s*([^}]+)\s*\}\}/g);if(Q)Z.push({node:X,expressions:Q.map((G)=>G.replace(/\{\{\s*|\s*\}\}/g,""))})}return Z}setupTextNodeBinding($,Z){let Y=window.stx;if(!Y)return;let X=$.textContent||"",J=()=>{try{let G=Function("stx",`with(stx) { return ${Z} }`)(Y);$.textContent=X.replace(new RegExp(`\\{\\{\\s*${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\}\\}`),String(G))}catch{}};J();let Q=Z.match(/^(\w+)(\.value)?$/);if(Q&&Y[Q[1]]?.subscribe)Y[Q[1]].subscribe(J)}setupAttributeBinding($,Z,Y){let X=window.stx;if(!X)return;let J=()=>{try{let G=Function("stx",`with(stx) { return ${Y} }`)(X);if(typeof G==="boolean")if(G)$.setAttribute(Z,"");else $.removeAttribute(Z);else $.setAttribute(Z,String(G))}catch{}};J();let Q=Y.match(/^(\w+)(\.value)?$/);if(Q&&X[Q[1]]?.subscribe)X[Q[1]].subscribe(J)}setupReactiveBinding($,Z){let Y=window.stx;if(!Y)return;let X=()=>{try{let Q=Function("stx",`with(stx) { return ${Z} }`)(Y);$.textContent=String(Q)}catch{}};X();let J=Z.match(/^(\w+)(\.value)?$/);if(J&&Y[J[1]]?.subscribe)Y[J[1]].subscribe(X)}setupRouterIntegration(){window.addEventListener("stx:navigate",($)=>{let{url:Z}=$.detail||{};if(Z){if(window.stx?.setRouteParams){let X=new URL(Z,window.location.origin)}}}),window.addEventListener("stx:load",()=>{this.hydrateComponents(),this.bindEventHandlers()})}get hydrated(){return this.isHydrated}getState(){return this.state}async hydrateById($){let Z=this.pendingComponents.get($),Y=document.querySelector(`[data-stx-component="${$}"]`);if(Z&&Y)await this.hydrateComponent(Y,Z)}}function LE($){return`
13886
+ `}function jE($){if(!q7)q7=new Z9($);return q7}function HE(){if(q7)q7.getRegistry().clear(),q7=null}var q7=null;var pq=()=>{};function cq($){let Z={refs:$.refs||{},reactive:$.reactive||{},props:$.props||{},routeParams:$.routeParams||{},stores:$.stores||{},meta:$.meta||{},timestamp:Date.now()};return Z.checksum=lq(Z),JSON.stringify(Z).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/'/g,"\\u0027")}function lq($){let Z=JSON.stringify({refs:Object.keys($.refs||{}),reactive:Object.keys($.reactive||{}),props:Object.keys($.props||{})}),Y=0;for(let X=0;X<Z.length;X++){let J=Z.charCodeAt(X);Y=(Y<<5)-Y+J,Y=Y&Y}return Math.abs(Y).toString(36)}function iq($){return`<script id="__STX_STATE__" type="application/json">${cq($)}</script>`}function OE($){if($.length===0)return"";return`data-stx-events='${JSON.stringify($)}'`}function nq(){if(typeof window>"u")return null;let $=document.getElementById("__STX_STATE__");if(!$)return null;try{let Z=JSON.parse($.textContent||"{}");if(Z.checksum){if(lq(Z)!==Z.checksum)console.warn("[Hydration] State checksum mismatch - state may be corrupted")}return Z}catch(Z){return console.error("[Hydration] Failed to parse state:",Z),null}}class X9{state=null;options;root=null;isHydrated=!1;pendingComponents=new Map;hydratedComponents=new Set;constructor($={}){this.options={root:$.root||"#app",strict:$.strict??!1,onHydrating:$.onHydrating||(()=>{}),onHydrated:$.onHydrated||(()=>{}),onError:$.onError||console.error,performance:$.performance??!1,timeout:$.timeout??1e4}}async hydrate(){if(typeof window>"u")return;if(this.isHydrated)return;let $=this.options.performance?performance.now():0;try{this.root=typeof this.options.root==="string"?document.querySelector(this.options.root)||document.body:this.options.root,this.state=nq(),this.options.onHydrating(),this.root.classList.add("stx-hydrating");let Z=new Promise((Y,X)=>{setTimeout(()=>X(Error("Hydration timeout")),this.options.timeout)});if(await Promise.race([this.runHydration(),Z]),this.isHydrated=!0,this.root.classList.remove("stx-hydrating"),this.root.classList.add("stx-hydrated"),this.options.performance){let Y=performance.now()-$;console.log(`[Hydration] Completed in ${Y.toFixed(2)}ms`)}this.options.onHydrated(),window.dispatchEvent(new CustomEvent("stx:hydrated"))}catch(Z){this.root?.classList.remove("stx-hydrating"),this.root?.classList.add("stx-hydration-error"),this.options.onError(Z),window.dispatchEvent(new CustomEvent("stx:hydration-error",{detail:{error:Z}}))}}async runHydration(){if(!this.root)return;this.restoreGlobalState(),await this.hydrateComponents(),this.bindEventHandlers(),this.initializeReactiveBindings(),this.setupRouterIntegration()}restoreGlobalState(){if(!this.state)return;let $=window.stx;if(!$)return;if(this.state.routeParams&&$.setRouteParams)$.setRouteParams(this.state.routeParams);if(this.state.stores&&$.registerStore)Object.entries(this.state.stores).forEach(([Z,Y])=>{$.registerStore(Z,Y)});window.dispatchEvent(new CustomEvent("stx:state-restored",{detail:this.state}))}async hydrateComponents(){if(!this.root)return;let $=this.root.querySelectorAll("[data-stx-component]");for(let Z of Array.from($)){let Y=Z.getAttribute("data-stx-component"),X=Z.getAttribute("data-stx-name")||Y,J=Z.getAttribute("data-stx-hydrate")||"eager",Q=Z.getAttribute("data-stx-props");if(!Y)continue;let G={id:Y,name:X||Y,strategy:J,props:Q?JSON.parse(Q):{},events:[]};switch(this.pendingComponents.set(Y,G),G.strategy){case"eager":await this.hydrateComponent(Z,G);break;case"lazy":case"visible":this.setupVisibleHydration(Z,G);break;case"idle":this.setupIdleHydration(Z,G);break;case"interaction":this.setupInteractionHydration(Z,G);break}}}async hydrateComponent($,Z){if(this.hydratedComponents.has(Z.id))return;try{let Y=this.state?.refs[Z.id]||this.state?.reactive[Z.id]||{};this.restoreComponentState($,Y),this.bindComponentEvents($),this.initializeComponentReactivity($,Z),this.hydratedComponents.add(Z.id),$.classList.add("stx-hydrated"),$.setAttribute("data-hydrated","true"),$.dispatchEvent(new CustomEvent("stx:component-hydrated",{detail:{id:Z.id,name:Z.name},bubbles:!0}))}catch(Y){if(console.error(`[Hydration] Failed to hydrate component ${Z.id}:`,Y),$.classList.add("stx-hydration-error"),this.options.strict)throw Y}}restoreComponentState($,Z){if(!Z||typeof Z!=="object")return;$.querySelectorAll("[data-stx-bind]").forEach((X)=>{let J=X.getAttribute("data-stx-bind");if(!J||!Z[J])return;let Q=Z[J];if(X instanceof HTMLInputElement)if(X.type==="checkbox"||X.type==="radio")X.checked=Boolean(Q);else X.value=String(Q);else if(X instanceof HTMLSelectElement)X.value=String(Q);else if(X instanceof HTMLTextAreaElement)X.value=String(Q);else X.textContent=String(Q)})}setupVisibleHydration($,Z){if(!("IntersectionObserver"in window)){this.hydrateComponent($,Z);return}let Y=new IntersectionObserver((X)=>{X.forEach((J)=>{if(J.isIntersecting)Y.disconnect(),this.hydrateComponent($,Z)})},{rootMargin:"100px",threshold:0});Y.observe($)}setupIdleHydration($,Z){let Y=()=>this.hydrateComponent($,Z);if("requestIdleCallback"in window)window.requestIdleCallback(Y,{timeout:2000});else setTimeout(Y,200)}setupInteractionHydration($,Z){let Y=["mouseenter","touchstart","focusin"],X=()=>{Y.forEach((J)=>$.removeEventListener(J,X)),this.hydrateComponent($,Z)};Y.forEach((J)=>{$.addEventListener(J,X,{once:!0,passive:!0})})}bindEventHandlers(){if(!this.root)return;this.root.querySelectorAll("[data-stx-events]").forEach((Z)=>this.bindElementEvents(Z)),this.bindDirectiveEvents()}bindElementEvents($){let Z=$.getAttribute("data-stx-events");if(!Z)return;try{JSON.parse(Z).forEach((X)=>{this.bindSingleEvent($,X)})}catch(Y){console.error("[Hydration] Failed to parse events:",Y)}}bindDirectiveEvents(){if(!this.root)return;["click","submit","input","change","focus","blur","keydown","keyup","keypress","mouseenter","mouseleave","touchstart","touchend","scroll","resize"].forEach((Z)=>{let Y=`data-stx-on-${Z}`;this.root.querySelectorAll(`[${Y}]`).forEach((J)=>{let Q=J.getAttribute(Y);if(!Q)return;this.bindSingleEvent(J,{type:Z,handler:Q,modifiers:this.parseModifiers(J,Z)})})})}parseModifiers($,Z){let Y=[],X=$.getAttribute(`data-stx-${Z}-modifiers`);if(X)Y.push(...X.split(",").map((J)=>J.trim()));return Y}bindSingleEvent($,Z){let Y=this.resolveHandler(Z.handler);if(!Y){console.warn(`[Hydration] Handler not found: ${Z.handler}`);return}let X=(Q)=>{if(Z.modifiers?.includes("prevent")||Z.preventDefault)Q.preventDefault();if(Z.modifiers?.includes("stop")||Z.stopPropagation)Q.stopPropagation();try{Y.call($,Q)}catch(G){console.error("[Hydration] Event handler error:",G)}},J={};if(Z.modifiers?.includes("once"))J.once=!0;if(Z.modifiers?.includes("passive"))J.passive=!0;if(Z.modifiers?.includes("capture"))J.capture=!0;$.addEventListener(Z.type,X,J)}resolveHandler($){let Z=window.stx;if(Z&&Z[$])return Z[$];if(window[$])return window[$];try{if($.match(/^\w+\+\+$/)||$.match(/^\w+--$/)){let J=$.replace(/[+-]+$/,"");return()=>{if(Z&&Z[J]){if(typeof Z[J].value<"u")if($.includes("++"))Z[J].value++;else Z[J].value--}}}let Y=$.match(/^(\w+)\s*=\s*(.+)$/);if(Y){let[,J,Q]=Y;return()=>{if(Z&&Z[J]){let G=Function(`return ${Q}`)();if(typeof Z[J].value<"u")Z[J].value=G}}}let X=$.match(/^(\w+)\((.*)\)$/);if(X){let[,J,Q]=X;return(G)=>{let K=Z?.[J]||window[J];if(K){let W=Q?Function("$event",`return [${Q}]`)(G):[];K(...W)}}}return(J)=>{Function("$event","stx",$)(J,Z)}}catch{return null}}bindComponentEvents($){$.querySelectorAll("[data-stx-events]").forEach((Y)=>{this.bindElementEvents(Y)})}initializeComponentReactivity($,Z){if(!window.stx)return;$.querySelectorAll("[data-stx-reactive]").forEach((J)=>{let Q=J.getAttribute("data-stx-reactive");if(!Q)return;this.setupReactiveBinding(J,Q)})}initializeReactiveBindings(){if(!this.root)return;this.getTextNodesWithExpressions(this.root).forEach(({node:Y,expressions:X})=>{X.forEach((J)=>{this.setupTextNodeBinding(Y,J)})}),this.root.querySelectorAll("[data-stx-bind-attrs]").forEach((Y)=>{let X=Y.getAttribute("data-stx-bind-attrs");if(!X)return;try{let J=JSON.parse(X);Object.entries(J).forEach(([Q,G])=>{this.setupAttributeBinding(Y,Q,G)})}catch{}})}getTextNodesWithExpressions($){let Z=[],Y=document.createTreeWalker($,NodeFilter.SHOW_TEXT),X;while(X=Y.nextNode()){let Q=(X.textContent||"").match(/\{\{\s*([^}]+)\s*\}\}/g);if(Q)Z.push({node:X,expressions:Q.map((G)=>G.replace(/\{\{\s*|\s*\}\}/g,""))})}return Z}setupTextNodeBinding($,Z){let Y=window.stx;if(!Y)return;let X=$.textContent||"",J=()=>{try{let G=Function("stx",`with(stx) { return ${Z} }`)(Y);$.textContent=X.replace(new RegExp(`\\{\\{\\s*${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\}\\}`),String(G))}catch{}};J();let Q=Z.match(/^(\w+)(\.value)?$/);if(Q&&Y[Q[1]]?.subscribe)Y[Q[1]].subscribe(J)}setupAttributeBinding($,Z,Y){let X=window.stx;if(!X)return;let J=()=>{try{let G=Function("stx",`with(stx) { return ${Y} }`)(X);if(typeof G==="boolean")if(G)$.setAttribute(Z,"");else $.removeAttribute(Z);else $.setAttribute(Z,String(G))}catch{}};J();let Q=Y.match(/^(\w+)(\.value)?$/);if(Q&&X[Q[1]]?.subscribe)X[Q[1]].subscribe(J)}setupReactiveBinding($,Z){let Y=window.stx;if(!Y)return;let X=()=>{try{let Q=Function("stx",`with(stx) { return ${Z} }`)(Y);$.textContent=String(Q)}catch{}};X();let J=Z.match(/^(\w+)(\.value)?$/);if(J&&Y[J[1]]?.subscribe)Y[J[1]].subscribe(X)}setupRouterIntegration(){window.addEventListener("stx:navigate",($)=>{let{url:Z}=$.detail||{};if(Z){if(window.stx?.setRouteParams){let X=new URL(Z,window.location.origin)}}}),window.addEventListener("stx:load",()=>{this.hydrateComponents(),this.bindEventHandlers()})}get hydrated(){return this.isHydrated}getState(){return this.state}async hydrateById($){let Z=this.pendingComponents.get($),Y=document.querySelector(`[data-stx-component="${$}"]`);if(Z&&Y)await this.hydrateComponent(Y,Z)}}function LE($){return`
13887
13887
  ${$?iq($):""}
13888
13888
  <script data-stx-hydration-runtime>
13889
13889
  (function() {
@@ -13981,7 +13981,7 @@ else {
13981
13981
  }
13982
13982
  })();
13983
13983
  </script>
13984
- `}function sq($){if(!X9)X9=new J9($);return X9}async function FE($){await sq($).hydrate()}function VE(){return`
13984
+ `}function sq($){if(!Y9)Y9=new X9($);return Y9}async function FE($){await sq($).hydrate()}function VE(){return`
13985
13985
  <style data-stx-hydration-styles>
13986
13986
  /* Pre-hydration state */
13987
13987
  [data-stx-component]:not(.stx-hydrated) {
@@ -14014,7 +14014,7 @@ else {
14014
14014
  }
14015
14015
  }
14016
14016
  </style>
14017
- `}var X9=null;var rq=()=>{};import oq from"path";class aq{store=new Map;async get($){let Z=this.store.get($);if(!Z||Z.expires<=Date.now()){if(Z)this.store.delete($);return null}return{...Z.data}}async set($,Z,Y){this.store.set($,{data:{...Z},expires:Date.now()+Y*1000})}async delete($){this.store.delete($)}}async function NE($,Z={},Y={}){let X=Y.viewsDir||"./views",J=Y.layoutsDir||"./layouts",Q=!$.includes("<")&&!$.includes("@"),G,K;if(Q){if(K=oq.resolve(X,$),!K.endsWith(".stx"))K+=".stx";if(!await Bun.file(K).exists())return new Response(`Template not found: ${$}`,{status:500});G=await Bun.file(K).text()}else G=$,K="inline-template.stx";let W={...Z,props:Z,__filename:K,__dirname:oq.dirname(K)};if(Y.ctx)W.csrf_token=Y.ctx.csrfToken,W.csrf_field=`<input type="hidden" name="_token" value="${Y.ctx.csrfToken}">`,W.old=Y.ctx.old,W.errors=Y.ctx.errors,W.session=Y.ctx.session,W.user=Y.ctx.user(),W.isAuthenticated=Y.ctx.isAuthenticated();let _=G.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(_){let j=_[1];G=G.replace(/<script\s+server\b[^>]*>[\s\S]*?<\/script>/gi,""),await R0(j,W,K)}let B={layoutsDir:J,...Y.stxOptions},z=await Z0(G,W,K,B,new Set),q=new Headers({"Content-Type":"text/html; charset=utf-8"});if(Y.ctx)Y.ctx.responseHeaders.forEach((j,H)=>{q.set(H,j)});return new Response(z,{headers:q})}var tq=D(()=>{X1();_1();q0()});function AE($,Z){t4.stores.set($,Z)}function Q9($){return t4.stores.get($)}function $j($){return t4.stores.has($)}function Zj(){return Array.from(t4.stores.keys())}function eq($){if($==="memory")return{getItem:(Z)=>j7.get(Z)??null,setItem:(Z,Y)=>j7.set(Z,Y),removeItem:(Z)=>j7.delete(Z)};if(typeof window>"u")return{getItem:(Z)=>j7.get(Z)??null,setItem:(Z,Y)=>j7.set(Z,Y),removeItem:(Z)=>j7.delete(Z)};return $==="local"?window.localStorage:window.sessionStorage}function wE($,Z){let Y={};for(let X of Z){let J=X.split("."),Q=$,G=Y,K=!0;for(let W=0;W<J.length-1;W++){let _=J[W];if(Q&&typeof Q==="object"&&_ in Q){if(Q=Q[_],!(_ in G))G[_]={};G=G[_]}else{K=!1;break}}if(K&&Q&&typeof Q==="object"){let W=J[J.length-1];if(W in Q)G[W]=Q[W]}}return Y}function G9($,Z={}){let{name:Y,persist:X,devtools:J=!1,middleware:Q=[],equals:G=(O,F)=>O===F}=Z,K=$,W=new Set,_=null;if(X){let O=eq(X.storage||"local"),F=X.key||`stx-store:${Y||"unnamed"}`,L=X.deserialize||JSON.parse;try{let V=O.getItem(F);if(V){let A=L(V);if(X.paths&&typeof A==="object"&&A!==null)K={...$,...A};else K=A}}catch{}}let B=(O)=>{if(!X)return;let F=eq(X.storage||"local"),L=X.key||`stx-store:${Y||"unnamed"}`,V=X.serialize||JSON.stringify,A=X.paths&&typeof O==="object"&&O!==null?wE(O,X.paths):O;if(X.debounce){if(_)clearTimeout(_);_=setTimeout(()=>{F.setItem(L,V(A))},X.debounce)}else F.setItem(L,V(A))},U=(O,F)=>{for(let L of W)try{L(O,F)}catch(V){console.error("[stx-store] Subscriber error:",V)}},z=J?(O,F)=>{if(typeof window<"u"&&window.__STX_DEVTOOLS__)window.__STX_DEVTOOLS__.onStoreChange(Y||"unnamed",O,F)}:()=>{},q=(O)=>{let F=K;if(!G(O,F))K=O,B(O),U(O,F),z("set",O)},j=q,H={get:()=>K,set:(O)=>{if(typeof O==="function")j(O(K));else j(O)},subscribe:(O)=>{return W.add(O),()=>{W.delete(O)}},update:(O)=>{if(typeof K!=="object"||K===null)throw Error("update() can only be used with object stores");let F=typeof O==="function"?O(K):O;H.set({...K,...F})},reset:()=>{H.set($),z("reset",$)},name:Y,destroy:()=>{if(W.clear(),_)clearTimeout(_);if(Y)t4.stores.delete(Y)}};for(let O of Q.reverse())j=O(q,()=>K,H)(j);if(Y)AE(Y,H);return H}function Yj($){let Z=typeof $==="string"?Q9($):$;if(!Z)throw Error(`Store "${$}" not found`);return Z.get()}function Xj($,Z,Y){if(typeof Z==="function"){if(typeof window<"u"&&window.stx?.defineStore)return window.stx.defineStore($,Z,Y);return Z()}let X=Z,{state:J,getters:Q={},actions:G={},persist:K,devtools:W=!0}=X,_=typeof J==="function"?J():J,B=K===!0?{storage:"local",key:`stx-store:${$}`}:K||void 0,U=G9(_,{name:$,persist:B,devtools:W}),z=new Proxy({},{get(q,j){let H=String(j);if(H==="$state")return U.get();if(H==="$subscribe")return U.subscribe;if(H==="$reset")return U.reset;if(H==="$patch")return(F)=>{if(typeof F==="function"){let V={...U.get()};F(V),U.set(V)}else U.update(F)};if(H==="_store")return U;if(H==="$id")return $;if(H in Q)return Q[H](U.get());if(H in G)return(...F)=>{return G[H].apply(z,F)};let O=U.get();if(O&&typeof O==="object"&&H in O)return O[H];return},set(q,j,H){let O=String(j);if(O.startsWith("$")||O==="_store")return!1;let F=U.get();if(F&&typeof F==="object")return U.set({...F,[O]:H}),!0;return!1},has(q,j){let H=String(j),O=U.get();return H.startsWith("$")||H==="_store"||H in Q||H in G||O&&typeof O==="object"&&H in O},ownKeys(){let q=U.get();return[...q&&typeof q==="object"?Object.keys(q):[],...Object.keys(Q),...Object.keys(G),"$state","$subscribe","$reset","$patch","$id"]},getOwnPropertyDescriptor(q,j){return{enumerable:!0,configurable:!0,get:()=>this.get(q,j,z)}}});return RE.set($,z),z}var t4,j7,RE;var Jj=D(()=>{t4={stores:new Map,subscriptions:new Map};j7=new Map;RE=new Map});function H0($,Z={}){let Y=[];for(let[J,Q]of Object.entries(Z)){if(Q===void 0||Q===null)continue;if(Array.isArray(Q))Y.push(`${J}=${encodeURIComponent(Q.join(","))}`);else if(typeof Q==="boolean"){if(Q)Y.push(`${J}=true`)}else Y.push(`${J}=${encodeURIComponent(String(Q))}`)}if(Y.length===0)return $;let X=$.includes("?")?"&":"?";return`${$}${X}${Y.join("&")}`}function K9($){let Z=$.indexOf("?");if(Z===-1)return{src:$,params:{}};let Y=$.slice(0,Z),X=$.slice(Z+1),J={};for(let Q of X.split("&")){let[G,K]=Q.split("="),W=K?decodeURIComponent(K):"";if(W==="true")J[G]=!0;else if(W==="false")J[G]=!1;else if(/^-?\d+$/.test(W))J[G]=Number.parseInt(W,10);else if(/^-?\d+\.\d+$/.test(W))J[G]=Number.parseFloat(W);else if(W.includes(","))J[G]=W.split(",");else J[G]=W}return{src:Y,params:J}}function r8(...$){let Z={};for(let Y of $)if(Y)Object.assign(Z,Y);return Z}function W9($,Z,Y,X){let J={w:Z};if(Y)J.h=Y;if(X)J.fit=X;return H0($,J)}function _9($,Z,Y,X="center"){return H0($,{w:Z,h:Y,fit:"crop",crop:X})}function B9($,Z,Y="center"){return H0($,{w:Z,h:Z,fit:"crop",crop:Y})}function U9($,Z,Y){return H0($,{w:Z,h:Y,fit:"max"})}function z9($,Z,Y){return H0($,{w:Z,h:Y,fit:"crop"})}function q9($,Z){return H0($,{blur:Math.min(2000,Math.max(0,Z))})}function j9($,Z){return H0($,{sharp:Math.min(100,Math.max(0,Z))})}function H9($){return H0($,{sat:-100})}function O9($,Z=100){return H0($,{sepia:Math.min(100,Math.max(0,Z))})}function L9($){return H0($,{invert:!0})}function F9($,Z){return H0($,{bri:Math.min(100,Math.max(-100,Z))})}function V9($,Z){return H0($,{con:Math.min(100,Math.max(-100,Z))})}function N9($,Z){return H0($,{sat:Math.min(100,Math.max(-100,Z))})}function A9($,Z){return H0($,{rot:(Z%360+360)%360})}function w9($){return H0($,{flip:"h"})}function R9($){return H0($,{flip:"v"})}function M9($,Z,Y){let X={fm:Z};if(Y!==void 0)X.q=Y;return H0($,X)}function T9($,Z){return H0($,{q:Math.min(100,Math.max(1,Z))})}function E9($,Z=["format","compress"]){return H0($,{auto:Z})}function I9($,Z,Y={}){return H0($,{mark:Z,markx:Y.x,marky:Y.y,markalpha:Y.alpha,markscale:Y.scale,markalign:Y.align})}function D9($,Z,Y){return H0($,r8(o8[Z],Y))}function k9($,Z,Y){return Z.map((X)=>H0($,{...Y,w:X}))}function S9($,Z,Y=[1,2,3],X){return Y.map((J)=>H0($,{...X,w:Math.round(Z*J),dpr:J}))}function b9($){let Z=[];if($.w!==void 0&&($.w<1||$.w>16383))Z.push("Width must be between 1 and 16383");if($.h!==void 0&&($.h<1||$.h>16383))Z.push("Height must be between 1 and 16383");if($.q!==void 0&&($.q<1||$.q>100))Z.push("Quality must be between 1 and 100");if($.blur!==void 0&&($.blur<0||$.blur>2000))Z.push("Blur must be between 0 and 2000");if($.rot!==void 0&&($.rot<0||$.rot>359))Z.push("Rotation must be between 0 and 359");if($.dpr!==void 0&&($.dpr<1||$.dpr>5))Z.push("DPR must be between 1 and 5");return{valid:Z.length===0,errors:Z}}function C9($){let Z={...$};if(Z.w!==void 0)Z.w=Math.min(16383,Math.max(1,Z.w));if(Z.h!==void 0)Z.h=Math.min(16383,Math.max(1,Z.h));if(Z.q!==void 0)Z.q=Math.min(100,Math.max(1,Z.q));if(Z.blur!==void 0)Z.blur=Math.min(2000,Math.max(0,Z.blur));if(Z.rot!==void 0)Z.rot=(Z.rot%360+360)%360;if(Z.dpr!==void 0)Z.dpr=Math.min(5,Math.max(1,Z.dpr));return Z}var o8;var Qj=D(()=>{o8={web:{fm:"webp",q:80,auto:["format","compress"]},highQuality:{q:95},thumb:{w:150,h:150,fit:"crop",crop:"center"},avatar:{w:200,h:200,fit:"crop",crop:"faces"},social:{w:1200,h:630,fit:"crop"},preview:{w:400,q:70},placeholder:{w:20,blur:200,q:20}}});var Gj=D(()=>{yY();xY();c6();FY();Qj()});function y9($){let{endpoint:Z,accept:Y,maxSize:X,maxFiles:J=1,fieldName:Q="file",preview:G=!1,dropzone:K=!0,multiple:W=!1,autoUpload:_=!0,showProgress:B=!0,disabled:U=!1,placeholder:z="Drop files here or click to select",label:q}=$,j=$.class||"",H=$.style||"",O=$.id||`stx-upload-${Math.random().toString(36).slice(2,8)}`,F=Array.isArray(Y)?Y.join(","):Y,L=`
14017
+ `}var Y9=null;var rq=()=>{};import oq from"path";class aq{store=new Map;async get($){let Z=this.store.get($);if(!Z||Z.expires<=Date.now()){if(Z)this.store.delete($);return null}return{...Z.data}}async set($,Z,Y){this.store.set($,{data:{...Z},expires:Date.now()+Y*1000})}async delete($){this.store.delete($)}}async function NE($,Z={},Y={}){let X=Y.viewsDir||"./views",J=Y.layoutsDir||"./layouts",Q=!$.includes("<")&&!$.includes("@"),G,K;if(Q){if(K=oq.resolve(X,$),!K.endsWith(".stx"))K+=".stx";if(!await Bun.file(K).exists())return new Response(`Template not found: ${$}`,{status:500});G=await Bun.file(K).text()}else G=$,K="inline-template.stx";let W={...Z,props:Z,__filename:K,__dirname:oq.dirname(K)};if(Y.ctx)W.csrf_token=Y.ctx.csrfToken,W.csrf_field=`<input type="hidden" name="_token" value="${Y.ctx.csrfToken}">`,W.old=Y.ctx.old,W.errors=Y.ctx.errors,W.session=Y.ctx.session,W.user=Y.ctx.user(),W.isAuthenticated=Y.ctx.isAuthenticated();let _=G.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(_){let j=_[1];G=G.replace(/<script\s+server\b[^>]*>[\s\S]*?<\/script>/gi,""),await R0(j,W,K)}let B={layoutsDir:J,...Y.stxOptions},z=await Z0(G,W,K,B,new Set),q=new Headers({"Content-Type":"text/html; charset=utf-8"});if(Y.ctx)Y.ctx.responseHeaders.forEach((j,H)=>{q.set(H,j)});return new Response(z,{headers:q})}var tq=D(()=>{X1();_1();q0()});function AE($,Z){t4.stores.set($,Z)}function J9($){return t4.stores.get($)}function $j($){return t4.stores.has($)}function Zj(){return Array.from(t4.stores.keys())}function eq($){if($==="memory")return{getItem:(Z)=>j7.get(Z)??null,setItem:(Z,Y)=>j7.set(Z,Y),removeItem:(Z)=>j7.delete(Z)};if(typeof window>"u")return{getItem:(Z)=>j7.get(Z)??null,setItem:(Z,Y)=>j7.set(Z,Y),removeItem:(Z)=>j7.delete(Z)};return $==="local"?window.localStorage:window.sessionStorage}function wE($,Z){let Y={};for(let X of Z){let J=X.split("."),Q=$,G=Y,K=!0;for(let W=0;W<J.length-1;W++){let _=J[W];if(Q&&typeof Q==="object"&&_ in Q){if(Q=Q[_],!(_ in G))G[_]={};G=G[_]}else{K=!1;break}}if(K&&Q&&typeof Q==="object"){let W=J[J.length-1];if(W in Q)G[W]=Q[W]}}return Y}function Q9($,Z={}){let{name:Y,persist:X,devtools:J=!1,middleware:Q=[],equals:G=(O,F)=>O===F}=Z,K=$,W=new Set,_=null;if(X){let O=eq(X.storage||"local"),F=X.key||`stx-store:${Y||"unnamed"}`,L=X.deserialize||JSON.parse;try{let V=O.getItem(F);if(V){let A=L(V);if(X.paths&&typeof A==="object"&&A!==null)K={...$,...A};else K=A}}catch{}}let B=(O)=>{if(!X)return;let F=eq(X.storage||"local"),L=X.key||`stx-store:${Y||"unnamed"}`,V=X.serialize||JSON.stringify,A=X.paths&&typeof O==="object"&&O!==null?wE(O,X.paths):O;if(X.debounce){if(_)clearTimeout(_);_=setTimeout(()=>{F.setItem(L,V(A))},X.debounce)}else F.setItem(L,V(A))},U=(O,F)=>{for(let L of W)try{L(O,F)}catch(V){console.error("[stx-store] Subscriber error:",V)}},z=J?(O,F)=>{if(typeof window<"u"&&window.__STX_DEVTOOLS__)window.__STX_DEVTOOLS__.onStoreChange(Y||"unnamed",O,F)}:()=>{},q=(O)=>{let F=K;if(!G(O,F))K=O,B(O),U(O,F),z("set",O)},j=q,H={get:()=>K,set:(O)=>{if(typeof O==="function")j(O(K));else j(O)},subscribe:(O)=>{return W.add(O),()=>{W.delete(O)}},update:(O)=>{if(typeof K!=="object"||K===null)throw Error("update() can only be used with object stores");let F=typeof O==="function"?O(K):O;H.set({...K,...F})},reset:()=>{H.set($),z("reset",$)},name:Y,destroy:()=>{if(W.clear(),_)clearTimeout(_);if(Y)t4.stores.delete(Y)}};for(let O of Q.reverse())j=O(q,()=>K,H)(j);if(Y)AE(Y,H);return H}function Yj($){let Z=typeof $==="string"?J9($):$;if(!Z)throw Error(`Store "${$}" not found`);return Z.get()}function Xj($,Z,Y){if(typeof Z==="function"){if(typeof window<"u"&&window.stx?.defineStore)return window.stx.defineStore($,Z,Y);return Z()}let X=Z,{state:J,getters:Q={},actions:G={},persist:K,devtools:W=!0}=X,_=typeof J==="function"?J():J,B=K===!0?{storage:"local",key:`stx-store:${$}`}:K||void 0,U=Q9(_,{name:$,persist:B,devtools:W}),z=new Proxy({},{get(q,j){let H=String(j);if(H==="$state")return U.get();if(H==="$subscribe")return U.subscribe;if(H==="$reset")return U.reset;if(H==="$patch")return(F)=>{if(typeof F==="function"){let V={...U.get()};F(V),U.set(V)}else U.update(F)};if(H==="_store")return U;if(H==="$id")return $;if(H in Q)return Q[H](U.get());if(H in G)return(...F)=>{return G[H].apply(z,F)};let O=U.get();if(O&&typeof O==="object"&&H in O)return O[H];return},set(q,j,H){let O=String(j);if(O.startsWith("$")||O==="_store")return!1;let F=U.get();if(F&&typeof F==="object")return U.set({...F,[O]:H}),!0;return!1},has(q,j){let H=String(j),O=U.get();return H.startsWith("$")||H==="_store"||H in Q||H in G||O&&typeof O==="object"&&H in O},ownKeys(){let q=U.get();return[...q&&typeof q==="object"?Object.keys(q):[],...Object.keys(Q),...Object.keys(G),"$state","$subscribe","$reset","$patch","$id"]},getOwnPropertyDescriptor(q,j){return{enumerable:!0,configurable:!0,get:()=>this.get(q,j,z)}}});return RE.set($,z),z}var t4,j7,RE;var Jj=D(()=>{t4={stores:new Map,subscriptions:new Map};j7=new Map;RE=new Map});function H0($,Z={}){let Y=[];for(let[J,Q]of Object.entries(Z)){if(Q===void 0||Q===null)continue;if(Array.isArray(Q))Y.push(`${J}=${encodeURIComponent(Q.join(","))}`);else if(typeof Q==="boolean"){if(Q)Y.push(`${J}=true`)}else Y.push(`${J}=${encodeURIComponent(String(Q))}`)}if(Y.length===0)return $;let X=$.includes("?")?"&":"?";return`${$}${X}${Y.join("&")}`}function G9($){let Z=$.indexOf("?");if(Z===-1)return{src:$,params:{}};let Y=$.slice(0,Z),X=$.slice(Z+1),J={};for(let Q of X.split("&")){let[G,K]=Q.split("="),W=K?decodeURIComponent(K):"";if(W==="true")J[G]=!0;else if(W==="false")J[G]=!1;else if(/^-?\d+$/.test(W))J[G]=Number.parseInt(W,10);else if(/^-?\d+\.\d+$/.test(W))J[G]=Number.parseFloat(W);else if(W.includes(","))J[G]=W.split(",");else J[G]=W}return{src:Y,params:J}}function r8(...$){let Z={};for(let Y of $)if(Y)Object.assign(Z,Y);return Z}function K9($,Z,Y,X){let J={w:Z};if(Y)J.h=Y;if(X)J.fit=X;return H0($,J)}function W9($,Z,Y,X="center"){return H0($,{w:Z,h:Y,fit:"crop",crop:X})}function _9($,Z,Y="center"){return H0($,{w:Z,h:Z,fit:"crop",crop:Y})}function B9($,Z,Y){return H0($,{w:Z,h:Y,fit:"max"})}function U9($,Z,Y){return H0($,{w:Z,h:Y,fit:"crop"})}function z9($,Z){return H0($,{blur:Math.min(2000,Math.max(0,Z))})}function q9($,Z){return H0($,{sharp:Math.min(100,Math.max(0,Z))})}function j9($){return H0($,{sat:-100})}function H9($,Z=100){return H0($,{sepia:Math.min(100,Math.max(0,Z))})}function O9($){return H0($,{invert:!0})}function L9($,Z){return H0($,{bri:Math.min(100,Math.max(-100,Z))})}function F9($,Z){return H0($,{con:Math.min(100,Math.max(-100,Z))})}function V9($,Z){return H0($,{sat:Math.min(100,Math.max(-100,Z))})}function N9($,Z){return H0($,{rot:(Z%360+360)%360})}function A9($){return H0($,{flip:"h"})}function w9($){return H0($,{flip:"v"})}function R9($,Z,Y){let X={fm:Z};if(Y!==void 0)X.q=Y;return H0($,X)}function M9($,Z){return H0($,{q:Math.min(100,Math.max(1,Z))})}function T9($,Z=["format","compress"]){return H0($,{auto:Z})}function E9($,Z,Y={}){return H0($,{mark:Z,markx:Y.x,marky:Y.y,markalpha:Y.alpha,markscale:Y.scale,markalign:Y.align})}function I9($,Z,Y){return H0($,r8(o8[Z],Y))}function D9($,Z,Y){return Z.map((X)=>H0($,{...Y,w:X}))}function k9($,Z,Y=[1,2,3],X){return Y.map((J)=>H0($,{...X,w:Math.round(Z*J),dpr:J}))}function S9($){let Z=[];if($.w!==void 0&&($.w<1||$.w>16383))Z.push("Width must be between 1 and 16383");if($.h!==void 0&&($.h<1||$.h>16383))Z.push("Height must be between 1 and 16383");if($.q!==void 0&&($.q<1||$.q>100))Z.push("Quality must be between 1 and 100");if($.blur!==void 0&&($.blur<0||$.blur>2000))Z.push("Blur must be between 0 and 2000");if($.rot!==void 0&&($.rot<0||$.rot>359))Z.push("Rotation must be between 0 and 359");if($.dpr!==void 0&&($.dpr<1||$.dpr>5))Z.push("DPR must be between 1 and 5");return{valid:Z.length===0,errors:Z}}function b9($){let Z={...$};if(Z.w!==void 0)Z.w=Math.min(16383,Math.max(1,Z.w));if(Z.h!==void 0)Z.h=Math.min(16383,Math.max(1,Z.h));if(Z.q!==void 0)Z.q=Math.min(100,Math.max(1,Z.q));if(Z.blur!==void 0)Z.blur=Math.min(2000,Math.max(0,Z.blur));if(Z.rot!==void 0)Z.rot=(Z.rot%360+360)%360;if(Z.dpr!==void 0)Z.dpr=Math.min(5,Math.max(1,Z.dpr));return Z}var o8;var Qj=D(()=>{o8={web:{fm:"webp",q:80,auto:["format","compress"]},highQuality:{q:95},thumb:{w:150,h:150,fit:"crop",crop:"center"},avatar:{w:200,h:200,fit:"crop",crop:"faces"},social:{w:1200,h:630,fit:"crop"},preview:{w:400,q:70},placeholder:{w:20,blur:200,q:20}}});var Gj=D(()=>{CY();PY();c6();LY();Qj()});function C9($){let{endpoint:Z,accept:Y,maxSize:X,maxFiles:J=1,fieldName:Q="file",preview:G=!1,dropzone:K=!0,multiple:W=!1,autoUpload:_=!0,showProgress:B=!0,disabled:U=!1,placeholder:z="Drop files here or click to select",label:q}=$,j=$.class||"",H=$.style||"",O=$.id||`stx-upload-${Math.random().toString(36).slice(2,8)}`,F=Array.isArray(Y)?Y.join(","):Y,L=`
14018
14018
  <div id="${O}" class="stx-upload${K?" stx-upload-dropzone":""}${U?" stx-upload-disabled":""}${j?" "+j:""}"${H?` style="${H}"`:""}>
14019
14019
  ${q?`<label class="stx-upload-label">${Kj(q)}</label>`:""}
14020
14020
  <div class="stx-upload-area" data-stx-upload-area>
@@ -14303,7 +14303,7 @@ else {
14303
14303
  opacity: 0.5;
14304
14304
  pointer-events: none;
14305
14305
  }
14306
- `.trim();return{html:L,script:V,css:A}}function Kj($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function EE($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function IE($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1048576).toFixed(1)} MB`}var Wj=()=>{};async function a8($,Z){let{endpoint:Y,method:X="POST",headers:J={},expirationSeconds:Q=3600,oneTimeUse:G=!1,params:K={}}=Z,W=JSON.stringify({url:$,expirationSeconds:Q,oneTimeUse:G,...K}),_=await fetch(Y,{method:X,headers:{"Content-Type":"application/json",...J},body:X!=="GET"?W:void 0});if(!_.ok)throw Error(`Failed to sign URL: ${_.status} ${_.statusText}`);let B=await _.json();return{url:B.url||B.signedUrl,signature:B.signature,expires:B.expires||Date.now()+Q*1000,oneTimeUse:B.oneTimeUse||G}}async function t8($,Z){let{endpoint:Y,method:X="POST",headers:J={},expirationSeconds:Q=3600,oneTimeUse:G=!1,params:K={}}=Z,W=JSON.stringify({urls:$,expirationSeconds:Q,oneTimeUse:G,...K}),_=await fetch(Y,{method:X,headers:{"Content-Type":"application/json",...J},body:X!=="GET"?W:void 0});if(!_.ok)throw Error(`Failed to batch sign URLs: ${_.status} ${_.statusText}`);let B=await _.json(),U=new Map,z=new Map;if(Array.isArray(B.results))for(let q of B.results)if(q.error)z.set(q.url,q.error);else U.set(q.url||q.originalUrl,{url:q.signedUrl||q.url,signature:q.signature,expires:q.expires||Date.now()+Q*1000,oneTimeUse:q.oneTimeUse||G});else if(typeof B.signatures==="object"){for(let[q,j]of Object.entries(B.signatures)){let H=j;U.set(q,{url:H.signedUrl||H.url||q,signature:H.signature,expires:H.expires||Date.now()+Q*1000,oneTimeUse:G})}if(B.errors)for(let[q,j]of Object.entries(B.errors))z.set(q,j)}return{signatures:U,errors:z}}async function P9($,Z,Y=10){let X=new Map,J=new Map,Q=[];for(let K=0;K<$.length;K+=Y)Q.push($.slice(K,K+Y));let G=await Promise.all(Q.map((K)=>t8(K,Z)));for(let K of G){for(let[W,_]of K.signatures)X.set(W,_);for(let[W,_]of K.errors)J.set(W,_)}return{signatures:X,errors:J}}function e8($){return $.expires>Date.now()}function $Z($){return Math.max(0,$.expires-Date.now())}function ZZ($,Z=300000){return $Z($)<Z}async function H7($){if($.check)return await $.check();return!0}function $6($){let Z={};if($.role)Z.role=$.role;if($.permission)Z.permission=$.permission;if($.userId)Z.userId=$.userId;return Z}async function x9($,Z){let Y=`${$}:${Z.endpoint}`,X=e4.get(Y);if(X&&e8(X)&&!ZZ(X))return X;let J=await a8($,Z);return e4.set(Y,J),J}function v9(){e4.clear()}function f9(){let $=0,Z=Date.now();for(let[Y,X]of e4)if(X.expires<=Z)e4.delete(Y),$++;return $}function Z6(){return`
14306
+ `.trim();return{html:L,script:V,css:A}}function Kj($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function EE($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function IE($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1048576).toFixed(1)} MB`}var Wj=()=>{};async function a8($,Z){let{endpoint:Y,method:X="POST",headers:J={},expirationSeconds:Q=3600,oneTimeUse:G=!1,params:K={}}=Z,W=JSON.stringify({url:$,expirationSeconds:Q,oneTimeUse:G,...K}),_=await fetch(Y,{method:X,headers:{"Content-Type":"application/json",...J},body:X!=="GET"?W:void 0});if(!_.ok)throw Error(`Failed to sign URL: ${_.status} ${_.statusText}`);let B=await _.json();return{url:B.url||B.signedUrl,signature:B.signature,expires:B.expires||Date.now()+Q*1000,oneTimeUse:B.oneTimeUse||G}}async function t8($,Z){let{endpoint:Y,method:X="POST",headers:J={},expirationSeconds:Q=3600,oneTimeUse:G=!1,params:K={}}=Z,W=JSON.stringify({urls:$,expirationSeconds:Q,oneTimeUse:G,...K}),_=await fetch(Y,{method:X,headers:{"Content-Type":"application/json",...J},body:X!=="GET"?W:void 0});if(!_.ok)throw Error(`Failed to batch sign URLs: ${_.status} ${_.statusText}`);let B=await _.json(),U=new Map,z=new Map;if(Array.isArray(B.results))for(let q of B.results)if(q.error)z.set(q.url,q.error);else U.set(q.url||q.originalUrl,{url:q.signedUrl||q.url,signature:q.signature,expires:q.expires||Date.now()+Q*1000,oneTimeUse:q.oneTimeUse||G});else if(typeof B.signatures==="object"){for(let[q,j]of Object.entries(B.signatures)){let H=j;U.set(q,{url:H.signedUrl||H.url||q,signature:H.signature,expires:H.expires||Date.now()+Q*1000,oneTimeUse:G})}if(B.errors)for(let[q,j]of Object.entries(B.errors))z.set(q,j)}return{signatures:U,errors:z}}async function y9($,Z,Y=10){let X=new Map,J=new Map,Q=[];for(let K=0;K<$.length;K+=Y)Q.push($.slice(K,K+Y));let G=await Promise.all(Q.map((K)=>t8(K,Z)));for(let K of G){for(let[W,_]of K.signatures)X.set(W,_);for(let[W,_]of K.errors)J.set(W,_)}return{signatures:X,errors:J}}function e8($){return $.expires>Date.now()}function $Z($){return Math.max(0,$.expires-Date.now())}function ZZ($,Z=300000){return $Z($)<Z}async function H7($){if($.check)return await $.check();return!0}function $6($){let Z={};if($.role)Z.role=$.role;if($.permission)Z.permission=$.permission;if($.userId)Z.userId=$.userId;return Z}async function P9($,Z){let Y=`${$}:${Z.endpoint}`,X=e4.get(Y);if(X&&e8(X)&&!ZZ(X))return X;let J=await a8($,Z);return e4.set(Y,J),J}function x9(){e4.clear()}function v9(){let $=0,Z=Date.now();for(let[Y,X]of e4)if(X.expires<=Z)e4.delete(Y),$++;return $}function Z6(){return`
14307
14307
  (function() {
14308
14308
  'use strict';
14309
14309
 
@@ -14377,7 +14377,7 @@ catch (error) {
14377
14377
  }
14378
14378
  };
14379
14379
  })();
14380
- `.trim()}var e4;var g9=D(()=>{e4=new Map});async function h9($){let{src:Z,alt:Y="",signatureEndpoint:X="/api/sign",signatureConfig:J={},auth:Q,fallback:G,oneTimeUse:K=!0}=$,W=$.class,_=$.style;if(Q){if(!await H7(Q)){if(G)return{html:`<img src="${I0(G)}" alt="${I0(Y)}"${W?` class="${I0(W)}"`:""}${_?` style="${I0(_)}"`:""} />`};return{html:"<!-- Protected content: access denied -->"}}}let B={endpoint:X,oneTimeUse:K,...J,params:Q?$6(Q):J.params},U=`stx-protected-${Math.random().toString(36).slice(2,8)}`,z=[`id="${U}"`,`data-protected-src="${I0(Z)}"`,`data-signature-endpoint="${I0(X)}"`,`alt="${I0(Y)}"`];if(G)z.push(`data-fallback="${I0(G)}"`),z.push(`src="${I0(G)}"`);else z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');if(W)z.push(`class="${I0(W)}"`);if(_)z.push(`style="${I0(_)}"`);let q=`
14380
+ `.trim()}var e4;var f9=D(()=>{e4=new Map});async function g9($){let{src:Z,alt:Y="",signatureEndpoint:X="/api/sign",signatureConfig:J={},auth:Q,fallback:G,oneTimeUse:K=!0}=$,W=$.class,_=$.style;if(Q){if(!await H7(Q)){if(G)return{html:`<img src="${I0(G)}" alt="${I0(Y)}"${W?` class="${I0(W)}"`:""}${_?` style="${I0(_)}"`:""} />`};return{html:"<!-- Protected content: access denied -->"}}}let B={endpoint:X,oneTimeUse:K,...J,params:Q?$6(Q):J.params},U=`stx-protected-${Math.random().toString(36).slice(2,8)}`,z=[`id="${U}"`,`data-protected-src="${I0(Z)}"`,`data-signature-endpoint="${I0(X)}"`,`alt="${I0(Y)}"`];if(G)z.push(`data-fallback="${I0(G)}"`),z.push(`src="${I0(G)}"`);else z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');if(W)z.push(`class="${I0(W)}"`);if(_)z.push(`style="${I0(_)}"`);let q=`
14381
14381
  (function() {
14382
14382
  var el = document.getElementById('${U}');
14383
14383
  if (!el) return;
@@ -14388,7 +14388,7 @@ catch (error) {
14388
14388
  expirationSeconds: ${J.expirationSeconds||3600}
14389
14389
  });
14390
14390
  })();
14391
- `.trim();return{html:`<img ${z.join(" ")} />`,script:q}}async function d9($){let{src:Z,signatureEndpoint:Y="/api/sign",signatureConfig:X={},auth:J,fallback:Q,oneTimeUse:G=!0,poster:K,controls:W=!0,autoplay:_=!1,muted:B=!1,loop:U=!1}=$,z=$.class,q=$.style,j=$.alt;if(J){if(!await H7(J))return{html:"<!-- Protected video: access denied -->"}}let H=`stx-protected-video-${Math.random().toString(36).slice(2,8)}`,O=[`id="${H}"`,`data-protected-src="${I0(Z)}"`,`data-signature-endpoint="${I0(Y)}"`];if(K)O.push(`poster="${I0(K)}"`);if(W)O.push("controls");if(_)O.push("autoplay");if(B)O.push("muted");if(U)O.push("loop");if(z)O.push(`class="${I0(z)}"`);if(q)O.push(`style="${I0(q)}"`);if(Q)O.push(`data-fallback="${I0(Q)}"`);let F=`
14391
+ `.trim();return{html:`<img ${z.join(" ")} />`,script:q}}async function h9($){let{src:Z,signatureEndpoint:Y="/api/sign",signatureConfig:X={},auth:J,fallback:Q,oneTimeUse:G=!0,poster:K,controls:W=!0,autoplay:_=!1,muted:B=!1,loop:U=!1}=$,z=$.class,q=$.style,j=$.alt;if(J){if(!await H7(J))return{html:"<!-- Protected video: access denied -->"}}let H=`stx-protected-video-${Math.random().toString(36).slice(2,8)}`,O=[`id="${H}"`,`data-protected-src="${I0(Z)}"`,`data-signature-endpoint="${I0(Y)}"`];if(K)O.push(`poster="${I0(K)}"`);if(W)O.push("controls");if(_)O.push("autoplay");if(B)O.push("muted");if(U)O.push("loop");if(z)O.push(`class="${I0(z)}"`);if(q)O.push(`style="${I0(q)}"`);if(Q)O.push(`data-fallback="${I0(Q)}"`);let F=`
14392
14392
  (function() {
14393
14393
  var el = document.getElementById('${H}');
14394
14394
  if (!el) return;
@@ -14399,7 +14399,7 @@ catch (error) {
14399
14399
  expirationSeconds: ${X.expirationSeconds||3600}
14400
14400
  });
14401
14401
  })();
14402
- `.trim();return{html:`<video ${O.join(" ")}></video>`,script:F}}async function u9($,Z){let Y=/data-protected-src="([^"]+)"/g,X=[],J;while((J=Y.exec($))!==null)X.push(J[1]);if(X.length===0)return{html:$,script:""};let Q=Z6()+`
14402
+ `.trim();return{html:`<video ${O.join(" ")}></video>`,script:F}}async function d9($,Z){let Y=/data-protected-src="([^"]+)"/g,X=[],J;while((J=Y.exec($))!==null)X.push(J[1]);if(X.length===0)return{html:$,script:""};let Q=Z6()+`
14403
14403
 
14404
14404
  `;return Q+=`
14405
14405
  (function() {
@@ -14431,7 +14431,7 @@ else if (el.dataset.fallback) {
14431
14431
  });
14432
14432
  });
14433
14433
  })();
14434
- `.trim(),{html:$,script:Q}}function m9($,Z,Y){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),signatureEndpoint:String(Z.signatureEndpoint||"/api/sign"),auth:Z.auth,fallback:Z.fallback?String(Z.fallback):void 0,oneTimeUse:Z.oneTimeUse!==!1};let X=$.trim();if(X.startsWith("@protected(")||X.startsWith("("))X=X.replace(/^@protected\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=DE(X);return{src:_j(J[0],Y)||"",alt:_j(J[1],Y)||"",...typeof J[2]==="object"?J[2]:{}}}function DE($){let Z=[],Y="",X=!1,J="",Q=0;for(let G=0;G<$.length;G++){let K=$[G],W=G>0?$[G-1]:"";if((K==='"'||K==="'")&&W!=="\\"){if(!X)X=!0,J=K;else if(K===J)X=!1;else Y+=K;continue}if(!X){if(K==="{")Q++;if(K==="}")Q--;if(K===","&&Q===0){Z.push(Y.trim()),Y="";continue}}Y+=K}if(Y.trim())Z.push(Y.trim());return Z}function _j($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(Z[Y]!==void 0)return Z[Y];if(Y.startsWith("{"))try{return JSON.parse(Y)}catch{}return Y}function I0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var Bj=D(()=>{g9()});var Uj=D(()=>{g9();Bj()});function qj($){let{src:Z,apiKey:Y,bucket:X,allowedTypes:J,maxFileSize:Q,multiple:G=!1,customStyles:K={},callbacks:W={}}=$,_=`stx-media-manager-${Math.random().toString(36).slice(2,8)}`,B={container:`#${_}`};if(Y)B.apiKey=Y;if(X)B.bucket=X;if(J)B.allowedTypes=J;if(Q)B.maxFileSize=Q;if(G)B.multiple=G;if(Object.keys(K).length>0)B.styles=K;let U=`<div id="${_}" class="stx-media-manager"></div>`,z=Object.entries(W).filter(([,j])=>j).map(([j,H])=>{return`manager.on('${j.replace(/^on/,"").toLowerCase()}', ${H});`}).join(`
14434
+ `.trim(),{html:$,script:Q}}function u9($,Z,Y){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),signatureEndpoint:String(Z.signatureEndpoint||"/api/sign"),auth:Z.auth,fallback:Z.fallback?String(Z.fallback):void 0,oneTimeUse:Z.oneTimeUse!==!1};let X=$.trim();if(X.startsWith("@protected(")||X.startsWith("("))X=X.replace(/^@protected\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=DE(X);return{src:_j(J[0],Y)||"",alt:_j(J[1],Y)||"",...typeof J[2]==="object"?J[2]:{}}}function DE($){let Z=[],Y="",X=!1,J="",Q=0;for(let G=0;G<$.length;G++){let K=$[G],W=G>0?$[G-1]:"";if((K==='"'||K==="'")&&W!=="\\"){if(!X)X=!0,J=K;else if(K===J)X=!1;else Y+=K;continue}if(!X){if(K==="{")Q++;if(K==="}")Q--;if(K===","&&Q===0){Z.push(Y.trim()),Y="";continue}}Y+=K}if(Y.trim())Z.push(Y.trim());return Z}function _j($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(Z[Y]!==void 0)return Z[Y];if(Y.startsWith("{"))try{return JSON.parse(Y)}catch{}return Y}function I0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var Bj=D(()=>{f9()});var Uj=D(()=>{f9();Bj()});function qj($){let{src:Z,apiKey:Y,bucket:X,allowedTypes:J,maxFileSize:Q,multiple:G=!1,customStyles:K={},callbacks:W={}}=$,_=`stx-media-manager-${Math.random().toString(36).slice(2,8)}`,B={container:`#${_}`};if(Y)B.apiKey=Y;if(X)B.bucket=X;if(J)B.allowedTypes=J;if(Q)B.maxFileSize=Q;if(G)B.multiple=G;if(Object.keys(K).length>0)B.styles=K;let U=`<div id="${_}" class="stx-media-manager"></div>`,z=Object.entries(W).filter(([,j])=>j).map(([j,H])=>{return`manager.on('${j.replace(/^on/,"").toLowerCase()}', ${H});`}).join(`
14435
14435
  `),q=`
14436
14436
  (function() {
14437
14437
  // Load media manager script
@@ -14647,7 +14647,7 @@ else {
14647
14647
  border: none;
14648
14648
  color: white;
14649
14649
  }
14650
- `.trim();return{html:Q,script:G,css:K}}function zj($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function YZ(){return"loading"in HTMLImageElement.prototype}function XZ(){return"IntersectionObserver"in window}function p9($={}){let Z={...Lj,...$},Y=document.querySelectorAll(Z.selector);if(Y.length===0)return()=>{};if(Z.useNative&&YZ())return Y.forEach((J)=>{if(J.tagName==="IMG"||J.tagName==="IFRAME")a1(J,Z)}),()=>{};if(!XZ())return Y.forEach((J)=>a1(J,Z)),()=>{};let X=new IntersectionObserver((J)=>{J.forEach((Q)=>{if(Q.isIntersecting){let G=Q.target;a1(G,Z),X.unobserve(G)}})},{root:Z.root,rootMargin:Z.rootMargin,threshold:Z.threshold});return Y.forEach((J)=>X.observe(J)),()=>{X.disconnect()}}function a1($,Z={}){let{onLoad:Y,onLoaded:X,onError:J}=Z;if(Y)Y($);let Q=$.tagName==="IMG",G=$.tagName==="VIDEO",K=$.tagName==="IFRAME";if(Q)Hj($,X,J);else if(G)Oj($,X,J);else if(K)kE($,X,J);else{let W=$.querySelector("img[data-src], img[data-srcset]"),_=$.querySelector("video[data-src]");if(W)Hj(W,()=>{if(X)X($)},(U)=>{if(J)J($,U)});else if(_)Oj(_,()=>{if(X)X($)},(U)=>{if(J)J($,U)});$.querySelectorAll("source[data-srcset]").forEach((U)=>{let z=U;if(z.dataset.srcset)z.srcset=z.dataset.srcset,delete z.dataset.srcset;if(z.dataset.sizes)z.sizes=z.dataset.sizes,delete z.dataset.sizes})}}function Hj($,Z,Y){let X=()=>{$.classList.add("stx-img-loaded"),$.style.opacity="1";let Q=$.closest(".stx-img-placeholder");if(Q)Q.classList.add("stx-img-loaded");if(Z)Z($)},J=()=>{if($.classList.add("stx-img-error"),Y)Y($,Error(`Failed to load image: ${$.src}`))};if($.addEventListener("load",X,{once:!0}),$.addEventListener("error",J,{once:!0}),$.dataset.srcset)$.srcset=$.dataset.srcset,delete $.dataset.srcset;if($.dataset.src)$.src=$.dataset.src,delete $.dataset.src;if($.dataset.sizes)$.sizes=$.dataset.sizes,delete $.dataset.sizes}function Oj($,Z,Y){let X=()=>{if($.classList.add("stx-video-loaded"),Z)Z($)},J=()=>{if($.classList.add("stx-video-error"),Y)Y($,Error(`Failed to load video: ${$.src}`))};if($.addEventListener("loadeddata",X,{once:!0}),$.addEventListener("error",J,{once:!0}),$.querySelectorAll("source[data-src]").forEach((G)=>{let K=G;if(K.dataset.src)K.src=K.dataset.src,delete K.dataset.src}),$.dataset.src)$.src=$.dataset.src,delete $.dataset.src;if($.dataset.poster)$.poster=$.dataset.poster,delete $.dataset.poster;$.load()}function kE($,Z,Y){let X=()=>{if($.classList.add("stx-iframe-loaded"),Z)Z($)},J=()=>{if($.classList.add("stx-iframe-error"),Y)Y($,Error(`Failed to load iframe: ${$.src}`))};if($.addEventListener("load",X,{once:!0}),$.addEventListener("error",J,{once:!0}),$.dataset.src)$.src=$.dataset.src,delete $.dataset.src}function c9($){a1($,{})}function l9($="[data-stx-lazy]"){document.querySelectorAll($).forEach((Y)=>a1(Y,{}))}function i9($={}){let Z={...Lj,...$};return new IntersectionObserver((Y,X)=>{Y.forEach((J)=>{if(J.isIntersecting)a1(J.target,Z),X.unobserve(J.target)})},{root:Z.root,rootMargin:Z.rootMargin,threshold:Z.threshold})}function n9($,Z){$.observe(Z)}function s9($){$.disconnect()}function Y6(){return`
14650
+ `.trim();return{html:Q,script:G,css:K}}function zj($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function YZ(){return"loading"in HTMLImageElement.prototype}function XZ(){return"IntersectionObserver"in window}function m9($={}){let Z={...Lj,...$},Y=document.querySelectorAll(Z.selector);if(Y.length===0)return()=>{};if(Z.useNative&&YZ())return Y.forEach((J)=>{if(J.tagName==="IMG"||J.tagName==="IFRAME")a1(J,Z)}),()=>{};if(!XZ())return Y.forEach((J)=>a1(J,Z)),()=>{};let X=new IntersectionObserver((J)=>{J.forEach((Q)=>{if(Q.isIntersecting){let G=Q.target;a1(G,Z),X.unobserve(G)}})},{root:Z.root,rootMargin:Z.rootMargin,threshold:Z.threshold});return Y.forEach((J)=>X.observe(J)),()=>{X.disconnect()}}function a1($,Z={}){let{onLoad:Y,onLoaded:X,onError:J}=Z;if(Y)Y($);let Q=$.tagName==="IMG",G=$.tagName==="VIDEO",K=$.tagName==="IFRAME";if(Q)Hj($,X,J);else if(G)Oj($,X,J);else if(K)kE($,X,J);else{let W=$.querySelector("img[data-src], img[data-srcset]"),_=$.querySelector("video[data-src]");if(W)Hj(W,()=>{if(X)X($)},(U)=>{if(J)J($,U)});else if(_)Oj(_,()=>{if(X)X($)},(U)=>{if(J)J($,U)});$.querySelectorAll("source[data-srcset]").forEach((U)=>{let z=U;if(z.dataset.srcset)z.srcset=z.dataset.srcset,delete z.dataset.srcset;if(z.dataset.sizes)z.sizes=z.dataset.sizes,delete z.dataset.sizes})}}function Hj($,Z,Y){let X=()=>{$.classList.add("stx-img-loaded"),$.style.opacity="1";let Q=$.closest(".stx-img-placeholder");if(Q)Q.classList.add("stx-img-loaded");if(Z)Z($)},J=()=>{if($.classList.add("stx-img-error"),Y)Y($,Error(`Failed to load image: ${$.src}`))};if($.addEventListener("load",X,{once:!0}),$.addEventListener("error",J,{once:!0}),$.dataset.srcset)$.srcset=$.dataset.srcset,delete $.dataset.srcset;if($.dataset.src)$.src=$.dataset.src,delete $.dataset.src;if($.dataset.sizes)$.sizes=$.dataset.sizes,delete $.dataset.sizes}function Oj($,Z,Y){let X=()=>{if($.classList.add("stx-video-loaded"),Z)Z($)},J=()=>{if($.classList.add("stx-video-error"),Y)Y($,Error(`Failed to load video: ${$.src}`))};if($.addEventListener("loadeddata",X,{once:!0}),$.addEventListener("error",J,{once:!0}),$.querySelectorAll("source[data-src]").forEach((G)=>{let K=G;if(K.dataset.src)K.src=K.dataset.src,delete K.dataset.src}),$.dataset.src)$.src=$.dataset.src,delete $.dataset.src;if($.dataset.poster)$.poster=$.dataset.poster,delete $.dataset.poster;$.load()}function kE($,Z,Y){let X=()=>{if($.classList.add("stx-iframe-loaded"),Z)Z($)},J=()=>{if($.classList.add("stx-iframe-error"),Y)Y($,Error(`Failed to load iframe: ${$.src}`))};if($.addEventListener("load",X,{once:!0}),$.addEventListener("error",J,{once:!0}),$.dataset.src)$.src=$.dataset.src,delete $.dataset.src}function p9($){a1($,{})}function c9($="[data-stx-lazy]"){document.querySelectorAll($).forEach((Y)=>a1(Y,{}))}function l9($={}){let Z={...Lj,...$};return new IntersectionObserver((Y,X)=>{Y.forEach((J)=>{if(J.isIntersecting)a1(J.target,Z),X.unobserve(J.target)})},{root:Z.root,rootMargin:Z.rootMargin,threshold:Z.threshold})}function i9($,Z){$.observe(Z)}function n9($){$.disconnect()}function Y6(){return`
14651
14651
  (function() {
14652
14652
  'use strict';
14653
14653
 
@@ -14737,7 +14737,7 @@ else {
14737
14737
  window.STX.lazyLoad = loadElement;
14738
14738
  window.STX.initLazyLoading = init;
14739
14739
  })();
14740
- `.trim()}var Lj;var r9=D(()=>{Lj={root:null,rootMargin:"50px 0px",threshold:0,useNative:!0,selector:"[data-stx-lazy]"}});function JZ($,Z={}){let Y={...SE,...Z},X=$.closest(".stx-img-placeholder");if(!X){bE($,Y);return}if(X.style.setProperty("--stx-img-transition-duration",`${Y.duration}ms`),X.style.setProperty("--stx-img-transition-easing",Y.easing),Y.loadingClass)X.classList.add(Y.loadingClass);if($.complete&&$.naturalWidth>0)Fj($,X,Y);else $.addEventListener("load",()=>Fj($,X,Y),{once:!0}),$.addEventListener("error",()=>CE($,X,Y),{once:!0})}function bE($,Z){let Y=()=>{$.style.transition=`opacity ${Z.duration}ms ${Z.easing}`,$.style.opacity="1",$.classList.remove(Z.loadingClass),$.classList.add(Z.loadedClass)};if($.complete&&$.naturalWidth>0)Y();else $.style.opacity="0",$.classList.add(Z.loadingClass),$.addEventListener("load",Y,{once:!0})}function Fj($,Z,Y){if(Y.loadingClass)Z.classList.remove(Y.loadingClass);if(Y.loadedClass)Z.classList.add(Y.loadedClass);if($.style.opacity="1",Y.removePlaceholder)setTimeout(()=>{Z.style.backgroundImage="none"},Y.duration)}function CE($,Z,Y){if(Y.loadingClass)Z.classList.remove(Y.loadingClass);Z.classList.add("stx-img-error"),$.classList.add("stx-img-error")}function o9($,Z){let Y=X6($),X=Z.getContext("2d");if(!X)return;Z.width=Y.w,Z.height=Y.h;let J=X.createImageData(Y.w,Y.h);J.data.set(Y.rgba),X.putImageData(J,0,0)}function X6($){let Z=$[0]|$[1]<<8|$[2]<<16,Y=(Z&63)/63,X=(Z>>6&63)/31.5-1,J=(Z>>12&63)/31.5-1,Q=(Z>>18&31)/31,G=Z>>23!==0,K=$[3]|$[4]<<8,W=(K>>3&63)/63,_=(K>>9&63)/63,B=K>>15!==0,U=Math.max(3,B?G?5:7:G?5:5),z=Math.max(3,B?G?5:5:G?5:7),q=32,j=32,H=new Uint8ClampedArray(4096);for(let O=0;O<32;O++)for(let F=0;F<32;F++){let L=(O*32+F)*4,V=F/31,A=O/31,N=Y+(V-0.5)*Q*0.5+(A-0.5)*Q*0.5,w=X*(1-V*0.3),M=J*(1-A*0.3),T=N-0.6666666666666666*w,I=(3*N-T+M)/2,E=I-M;H[L]=Math.max(0,Math.min(255,Math.round(I*255))),H[L+1]=Math.max(0,Math.min(255,Math.round(E*255))),H[L+2]=Math.max(0,Math.min(255,Math.round(T*255))),H[L+3]=255}return{w:32,h:32,rgba:H}}function a9($){let Z=X6($),Y=document.createElement("canvas");Y.width=Z.w,Y.height=Z.h;let X=Y.getContext("2d");if(!X)return"";let J=X.createImageData(Z.w,Z.h);return J.data.set(Z.rgba),X.putImageData(J,0,0),Y.toDataURL("image/png")}function t9($){let Z=atob($),Y=new Uint8Array(Z.length);for(let X=0;X<Z.length;X++)Y[X]=Z.charCodeAt(X);return Y}function e9($,Z,Y=300){return new Promise((X)=>{$.style.transition=`opacity ${Y}ms ease-out`,Z.style.transition=`opacity ${Y}ms ease-out`,Z.style.opacity="0",Z.offsetWidth,$.style.opacity="0",Z.style.opacity="1",setTimeout(X,Y)})}function $Q($={}){document.querySelectorAll("[data-stx-blur-up], .stx-img-placeholder img").forEach((Y)=>{JZ(Y,$)})}function J6(){return`
14740
+ `.trim()}var Lj;var s9=D(()=>{Lj={root:null,rootMargin:"50px 0px",threshold:0,useNative:!0,selector:"[data-stx-lazy]"}});function JZ($,Z={}){let Y={...SE,...Z},X=$.closest(".stx-img-placeholder");if(!X){bE($,Y);return}if(X.style.setProperty("--stx-img-transition-duration",`${Y.duration}ms`),X.style.setProperty("--stx-img-transition-easing",Y.easing),Y.loadingClass)X.classList.add(Y.loadingClass);if($.complete&&$.naturalWidth>0)Fj($,X,Y);else $.addEventListener("load",()=>Fj($,X,Y),{once:!0}),$.addEventListener("error",()=>CE($,X,Y),{once:!0})}function bE($,Z){let Y=()=>{$.style.transition=`opacity ${Z.duration}ms ${Z.easing}`,$.style.opacity="1",$.classList.remove(Z.loadingClass),$.classList.add(Z.loadedClass)};if($.complete&&$.naturalWidth>0)Y();else $.style.opacity="0",$.classList.add(Z.loadingClass),$.addEventListener("load",Y,{once:!0})}function Fj($,Z,Y){if(Y.loadingClass)Z.classList.remove(Y.loadingClass);if(Y.loadedClass)Z.classList.add(Y.loadedClass);if($.style.opacity="1",Y.removePlaceholder)setTimeout(()=>{Z.style.backgroundImage="none"},Y.duration)}function CE($,Z,Y){if(Y.loadingClass)Z.classList.remove(Y.loadingClass);Z.classList.add("stx-img-error"),$.classList.add("stx-img-error")}function r9($,Z){let Y=X6($),X=Z.getContext("2d");if(!X)return;Z.width=Y.w,Z.height=Y.h;let J=X.createImageData(Y.w,Y.h);J.data.set(Y.rgba),X.putImageData(J,0,0)}function X6($){let Z=$[0]|$[1]<<8|$[2]<<16,Y=(Z&63)/63,X=(Z>>6&63)/31.5-1,J=(Z>>12&63)/31.5-1,Q=(Z>>18&31)/31,G=Z>>23!==0,K=$[3]|$[4]<<8,W=(K>>3&63)/63,_=(K>>9&63)/63,B=K>>15!==0,U=Math.max(3,B?G?5:7:G?5:5),z=Math.max(3,B?G?5:5:G?5:7),q=32,j=32,H=new Uint8ClampedArray(4096);for(let O=0;O<32;O++)for(let F=0;F<32;F++){let L=(O*32+F)*4,V=F/31,A=O/31,N=Y+(V-0.5)*Q*0.5+(A-0.5)*Q*0.5,w=X*(1-V*0.3),M=J*(1-A*0.3),T=N-0.6666666666666666*w,I=(3*N-T+M)/2,E=I-M;H[L]=Math.max(0,Math.min(255,Math.round(I*255))),H[L+1]=Math.max(0,Math.min(255,Math.round(E*255))),H[L+2]=Math.max(0,Math.min(255,Math.round(T*255))),H[L+3]=255}return{w:32,h:32,rgba:H}}function o9($){let Z=X6($),Y=document.createElement("canvas");Y.width=Z.w,Y.height=Z.h;let X=Y.getContext("2d");if(!X)return"";let J=X.createImageData(Z.w,Z.h);return J.data.set(Z.rgba),X.putImageData(J,0,0),Y.toDataURL("image/png")}function a9($){let Z=atob($),Y=new Uint8Array(Z.length);for(let X=0;X<Z.length;X++)Y[X]=Z.charCodeAt(X);return Y}function t9($,Z,Y=300){return new Promise((X)=>{$.style.transition=`opacity ${Y}ms ease-out`,Z.style.transition=`opacity ${Y}ms ease-out`,Z.style.opacity="0",Z.offsetWidth,$.style.opacity="0",Z.style.opacity="1",setTimeout(X,Y)})}function e9($={}){document.querySelectorAll("[data-stx-blur-up], .stx-img-placeholder img").forEach((Y)=>{JZ(Y,$)})}function J6(){return`
14741
14741
  (function() {
14742
14742
  'use strict';
14743
14743
 
@@ -14836,7 +14836,7 @@ else {
14836
14836
  .stx-img-error {
14837
14837
  opacity: 0.5;
14838
14838
  }
14839
- `.trim()}var SE;var ZQ=D(()=>{SE={duration:300,easing:"ease-out",removePlaceholder:!1,loadedClass:"stx-img-loaded",loadingClass:"stx-img-loading"}});function QZ($,Z={}){if(Z.maxSize&&$.size>Z.maxSize)return{valid:!1,error:`File size (${Vj($.size)}) exceeds maximum (${Vj(Z.maxSize)})`,code:"FILE_TOO_LARGE"};if(Z.accept&&Z.accept.length>0){if(!Z.accept.some((X)=>{if(X.endsWith("/*")){let J=X.slice(0,-1);return $.type.startsWith(J)}return $.type===X}))return{valid:!1,error:`File type "${$.type}" is not allowed`,code:"INVALID_TYPE"}}return{valid:!0}}function Vj($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1048576).toFixed(2)} MB`}async function GZ($,Z,Y){let X={...yE,...Z},J=QZ($,X);if(!J.valid)return{success:!1,error:J.error,name:$.name,size:$.size,type:$.type};if(X.chunkSize&&$.size>X.chunkSize)return xE($,X,Y);return PE($,X,Y)}async function PE($,Z,Y){return new Promise((X)=>{let J=new XMLHttpRequest,Q=Date.now(),G=0,K=Q;J.upload.addEventListener("progress",(_)=>{if(_.lengthComputable&&Y){let B=Date.now(),U=(B-K)/1000,z=_.loaded-G,q=U>0?z/U:0,j=_.total-_.loaded,H=q>0?j/q*1000:void 0;G=_.loaded,K=B,Y({file:$,loaded:_.loaded,total:_.total,percent:Math.round(_.loaded/_.total*100),speed:q,timeRemaining:H})}}),J.addEventListener("load",()=>{if(J.status>=200&&J.status<300)try{let _=JSON.parse(J.responseText);X({success:!0,url:_.url,id:_.id,name:$.name,size:$.size,type:$.type,data:_})}catch{X({success:!0,name:$.name,size:$.size,type:$.type})}else X({success:!1,error:`Upload failed with status ${J.status}`,name:$.name,size:$.size,type:$.type})}),J.addEventListener("error",()=>{X({success:!1,error:"Network error during upload",name:$.name,size:$.size,type:$.type})}),J.addEventListener("timeout",()=>{X({success:!1,error:"Upload timed out",name:$.name,size:$.size,type:$.type})});let W=new FormData;if(W.append(Z.fieldName||"file",$),Z.formData)for(let[_,B]of Object.entries(Z.formData))W.append(_,B);if(J.open(Z.method||"POST",Z.endpoint),J.timeout=Z.timeout||60000,J.withCredentials=Z.withCredentials||!1,Z.headers)for(let[_,B]of Object.entries(Z.headers))J.setRequestHeader(_,B);J.send(W)})}async function xE($,Z,Y){let X=Z.chunkSize,J=Math.ceil($.size/X),Q=0,G;for(let K=0;K<J;K++){let W=K*X,_=Math.min(W+X,$.size),B=$.slice(W,_),U=new FormData;if(U.append(Z.fieldName||"file",B,$.name),U.append("chunk",String(K)),U.append("totalChunks",String(J)),U.append("fileName",$.name),U.append("fileSize",String($.size)),U.append("fileType",$.type),G)U.append("uploadId",G);if(Z.formData)for(let[z,q]of Object.entries(Z.formData))U.append(z,q);try{let z=await fetch(Z.endpoint,{method:Z.method||"POST",headers:Z.headers,credentials:Z.withCredentials?"include":"same-origin",body:U});if(!z.ok)return{success:!1,error:`Chunk ${K+1}/${J} failed with status ${z.status}`,name:$.name,size:$.size,type:$.type};let q=await z.json();if(!G&&q.uploadId)G=q.uploadId;if(Q=_,Y)Y({file:$,loaded:Q,total:$.size,percent:Math.round(Q/$.size*100),chunk:K+1,totalChunks:J});if(K===J-1)return{success:!0,url:q.url,id:q.id||G,name:$.name,size:$.size,type:$.type,data:q}}catch(z){return{success:!1,error:`Chunk upload failed: ${z}`,name:$.name,size:$.size,type:$.type}}}return{success:!1,error:"Unknown error during chunked upload",name:$.name,size:$.size,type:$.type}}async function YQ($,Z,Y,X){let J=[];for(let Q of $){let G=await GZ(Q,Z,(K)=>{if(Y)Y(Q,K)});if(J.push(G),X)X(Q,G)}return J}function XQ($,Z=200){return new Promise((Y,X)=>{if(!$.type.startsWith("image/")){X(Error("File is not an image"));return}let J=new FileReader;J.onload=(Q)=>{let G=new Image;G.onload=()=>{let K=document.createElement("canvas"),W=G.width,_=G.height;if(W>Z||_>Z)if(W>_)_=Math.round(_*Z/W),W=Z;else W=Math.round(W*Z/_),_=Z;K.width=W,K.height=_;let B=K.getContext("2d");if(B)B.drawImage(G,0,0,W,_),Y(K.toDataURL("image/jpeg",0.7));else X(Error("Could not get canvas context"))},G.onerror=()=>X(Error("Could not load image")),G.src=Q.target?.result},J.onerror=()=>X(Error("Could not read file")),J.readAsDataURL($)})}function JQ($){return new Promise((Z,Y)=>{if(!$.type.startsWith("video/")){Y(Error("File is not a video"));return}let X=document.createElement("video"),J=document.createElement("canvas");X.preload="metadata",X.muted=!0,X.playsInline=!0,X.onloadeddata=()=>{X.currentTime=0.1},X.onseeked=()=>{J.width=X.videoWidth,J.height=X.videoHeight;let Q=J.getContext("2d");if(Q)Q.drawImage(X,0,0),Z(J.toDataURL("image/jpeg",0.7));else Y(Error("Could not get canvas context"));URL.revokeObjectURL(X.src)},X.onerror=()=>{URL.revokeObjectURL(X.src),Y(Error("Could not load video"))},X.src=URL.createObjectURL($)})}function G6(){return`
14839
+ `.trim()}var SE;var $Q=D(()=>{SE={duration:300,easing:"ease-out",removePlaceholder:!1,loadedClass:"stx-img-loaded",loadingClass:"stx-img-loading"}});function QZ($,Z={}){if(Z.maxSize&&$.size>Z.maxSize)return{valid:!1,error:`File size (${Vj($.size)}) exceeds maximum (${Vj(Z.maxSize)})`,code:"FILE_TOO_LARGE"};if(Z.accept&&Z.accept.length>0){if(!Z.accept.some((X)=>{if(X.endsWith("/*")){let J=X.slice(0,-1);return $.type.startsWith(J)}return $.type===X}))return{valid:!1,error:`File type "${$.type}" is not allowed`,code:"INVALID_TYPE"}}return{valid:!0}}function Vj($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1048576).toFixed(2)} MB`}async function GZ($,Z,Y){let X={...yE,...Z},J=QZ($,X);if(!J.valid)return{success:!1,error:J.error,name:$.name,size:$.size,type:$.type};if(X.chunkSize&&$.size>X.chunkSize)return xE($,X,Y);return PE($,X,Y)}async function PE($,Z,Y){return new Promise((X)=>{let J=new XMLHttpRequest,Q=Date.now(),G=0,K=Q;J.upload.addEventListener("progress",(_)=>{if(_.lengthComputable&&Y){let B=Date.now(),U=(B-K)/1000,z=_.loaded-G,q=U>0?z/U:0,j=_.total-_.loaded,H=q>0?j/q*1000:void 0;G=_.loaded,K=B,Y({file:$,loaded:_.loaded,total:_.total,percent:Math.round(_.loaded/_.total*100),speed:q,timeRemaining:H})}}),J.addEventListener("load",()=>{if(J.status>=200&&J.status<300)try{let _=JSON.parse(J.responseText);X({success:!0,url:_.url,id:_.id,name:$.name,size:$.size,type:$.type,data:_})}catch{X({success:!0,name:$.name,size:$.size,type:$.type})}else X({success:!1,error:`Upload failed with status ${J.status}`,name:$.name,size:$.size,type:$.type})}),J.addEventListener("error",()=>{X({success:!1,error:"Network error during upload",name:$.name,size:$.size,type:$.type})}),J.addEventListener("timeout",()=>{X({success:!1,error:"Upload timed out",name:$.name,size:$.size,type:$.type})});let W=new FormData;if(W.append(Z.fieldName||"file",$),Z.formData)for(let[_,B]of Object.entries(Z.formData))W.append(_,B);if(J.open(Z.method||"POST",Z.endpoint),J.timeout=Z.timeout||60000,J.withCredentials=Z.withCredentials||!1,Z.headers)for(let[_,B]of Object.entries(Z.headers))J.setRequestHeader(_,B);J.send(W)})}async function xE($,Z,Y){let X=Z.chunkSize,J=Math.ceil($.size/X),Q=0,G;for(let K=0;K<J;K++){let W=K*X,_=Math.min(W+X,$.size),B=$.slice(W,_),U=new FormData;if(U.append(Z.fieldName||"file",B,$.name),U.append("chunk",String(K)),U.append("totalChunks",String(J)),U.append("fileName",$.name),U.append("fileSize",String($.size)),U.append("fileType",$.type),G)U.append("uploadId",G);if(Z.formData)for(let[z,q]of Object.entries(Z.formData))U.append(z,q);try{let z=await fetch(Z.endpoint,{method:Z.method||"POST",headers:Z.headers,credentials:Z.withCredentials?"include":"same-origin",body:U});if(!z.ok)return{success:!1,error:`Chunk ${K+1}/${J} failed with status ${z.status}`,name:$.name,size:$.size,type:$.type};let q=await z.json();if(!G&&q.uploadId)G=q.uploadId;if(Q=_,Y)Y({file:$,loaded:Q,total:$.size,percent:Math.round(Q/$.size*100),chunk:K+1,totalChunks:J});if(K===J-1)return{success:!0,url:q.url,id:q.id||G,name:$.name,size:$.size,type:$.type,data:q}}catch(z){return{success:!1,error:`Chunk upload failed: ${z}`,name:$.name,size:$.size,type:$.type}}}return{success:!1,error:"Unknown error during chunked upload",name:$.name,size:$.size,type:$.type}}async function ZQ($,Z,Y,X){let J=[];for(let Q of $){let G=await GZ(Q,Z,(K)=>{if(Y)Y(Q,K)});if(J.push(G),X)X(Q,G)}return J}function YQ($,Z=200){return new Promise((Y,X)=>{if(!$.type.startsWith("image/")){X(Error("File is not an image"));return}let J=new FileReader;J.onload=(Q)=>{let G=new Image;G.onload=()=>{let K=document.createElement("canvas"),W=G.width,_=G.height;if(W>Z||_>Z)if(W>_)_=Math.round(_*Z/W),W=Z;else W=Math.round(W*Z/_),_=Z;K.width=W,K.height=_;let B=K.getContext("2d");if(B)B.drawImage(G,0,0,W,_),Y(K.toDataURL("image/jpeg",0.7));else X(Error("Could not get canvas context"))},G.onerror=()=>X(Error("Could not load image")),G.src=Q.target?.result},J.onerror=()=>X(Error("Could not read file")),J.readAsDataURL($)})}function XQ($){return new Promise((Z,Y)=>{if(!$.type.startsWith("video/")){Y(Error("File is not a video"));return}let X=document.createElement("video"),J=document.createElement("canvas");X.preload="metadata",X.muted=!0,X.playsInline=!0,X.onloadeddata=()=>{X.currentTime=0.1},X.onseeked=()=>{J.width=X.videoWidth,J.height=X.videoHeight;let Q=J.getContext("2d");if(Q)Q.drawImage(X,0,0),Z(J.toDataURL("image/jpeg",0.7));else Y(Error("Could not get canvas context"));URL.revokeObjectURL(X.src)},X.onerror=()=>{URL.revokeObjectURL(X.src),Y(Error("Could not load video"))},X.src=URL.createObjectURL($)})}function G6(){return`
14840
14840
  (function() {
14841
14841
  'use strict';
14842
14842
 
@@ -14904,18 +14904,18 @@ else {
14904
14904
  return { valid: true };
14905
14905
  };
14906
14906
  })();
14907
- `.trim()}var yE;var QQ=D(()=>{yE={method:"POST",fieldName:"file",timeout:60000,withCredentials:!1}});function GQ(){return{script:[Y6(),J6(),G6()].join(`
14907
+ `.trim()}var yE;var JQ=D(()=>{yE={method:"POST",fieldName:"file",timeout:60000,withCredentials:!1}});function QQ(){return{script:[Y6(),J6(),G6()].join(`
14908
14908
 
14909
- `),css:Q6()}}function Nj(){let{script:$,css:Z}=GQ(),Y=$.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/.*$/gm,"").replace(/\s+/g," ").replace(/\s*([{};,:])\s*/g,"$1").trim(),X=Z.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\s+/g," ").replace(/\s*([{};,:])\s*/g,"$1").trim();return{script:Y,css:X}}var Aj=D(()=>{r9();ZQ();QQ();r9();ZQ();QQ()});var wj=D(()=>{G$();n6()});var vE;var Rj=D(()=>{Gj();IY();iY();lY();Wj();Uj();Aj();wj();vE={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]},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0},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}}});import KZ from"fs";import e$ from"path";async function KQ($,Z={},Y={}){let X=await Bun.file($).text(),J=X.match(/<script\s+server\s*>([\s\S]*?)<\/script>/i),Q=J?J[1]:"",G=J?X.replace(/<script\s+server\s*>[\s\S]*?<\/script>/i,""):X;G=G.replace(/<script\s+client\s*>/gi,"<script>");let K={__filename:$,__dirname:e$.dirname($),props:Z,...Z};if(Q)await R0(Q,K,$);let W={...a0,...Y};return await Z0(G,K,$,W,new Set)}async function Mj($){let Z=performance.now(),Y={success:!0,views:[],errors:[],duration:0},{viewsDir:X,outputDir:J,componentsDir:Q=e$.join(X,"components"),layoutsDir:G=e$.join(X,"layouts"),partialsDir:K=e$.join(X,"partials"),globalProps:W={},placeholders:_={},views:B,debug:U=!1,generateManifest:z=!0}=$;if(U)console.log("Building STX views..."),console.log(` Source: ${X}`),console.log(` Output: ${J}`);KZ.mkdirSync(J,{recursive:!0});let q={componentsDir:Q,layoutsDir:G,partialsDir:K,debug:U},j;if(B&&B.length>0)j=B;else j=KZ.readdirSync(X).filter((O)=>O.endsWith(".stx")).map((O)=>({input:O}));for(let H of j){let O=e$.join(X,H.input),F=H.output||H.input.replace(/\.stx$/,".html"),L=e$.join(J,F);if(U)console.log(` Building ${H.input}...`);try{let V={...W,...H.props,..._},A=await KQ(O,V,q);await Bun.write(L,A),Y.views.push(F)}catch(V){let A=V instanceof Error?V.message:String(V);if(Y.errors.push({file:H.input,error:A}),Y.success=!1,U)console.error(` Error: ${A}`)}}if(z){let H={buildTime:new Date().toISOString(),views:Y.views,placeholders:_,errors:Y.errors.length>0?Y.errors:void 0};await Bun.write(e$.join(J,"manifest.json"),JSON.stringify(H,null,2))}if(Y.duration=performance.now()-Z,U)if(Y.success)console.log(`
14909
+ `),css:Q6()}}function Nj(){let{script:$,css:Z}=QQ(),Y=$.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/.*$/gm,"").replace(/\s+/g," ").replace(/\s*([{};,:])\s*/g,"$1").trim(),X=Z.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\s+/g," ").replace(/\s*([{};,:])\s*/g,"$1").trim();return{script:Y,css:X}}var Aj=D(()=>{s9();$Q();JQ();s9();$Q();JQ()});var wj=D(()=>{K$();n6()});var vE;var Rj=D(()=>{Gj();EY();lY();cY();Wj();Uj();Aj();wj();vE={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]},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0},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}}});import KZ from"fs";import e$ from"path";async function GQ($,Z={},Y={}){let X=await Bun.file($).text(),J=X.match(/<script\s+server\s*>([\s\S]*?)<\/script>/i),Q=J?J[1]:"",G=J?X.replace(/<script\s+server\s*>[\s\S]*?<\/script>/i,""):X;G=G.replace(/<script\s+client\s*>/gi,"<script>");let K={__filename:$,__dirname:e$.dirname($),props:Z,...Z};if(Q)await R0(Q,K,$);let W={...a0,...Y};return await Z0(G,K,$,W,new Set)}async function Mj($){let Z=performance.now(),Y={success:!0,views:[],errors:[],duration:0},{viewsDir:X,outputDir:J,componentsDir:Q=e$.join(X,"components"),layoutsDir:G=e$.join(X,"layouts"),partialsDir:K=e$.join(X,"partials"),globalProps:W={},placeholders:_={},views:B,debug:U=!1,generateManifest:z=!0}=$;if(U)console.log("Building STX views..."),console.log(` Source: ${X}`),console.log(` Output: ${J}`);KZ.mkdirSync(J,{recursive:!0});let q={componentsDir:Q,layoutsDir:G,partialsDir:K,debug:U},j;if(B&&B.length>0)j=B;else j=KZ.readdirSync(X).filter((O)=>O.endsWith(".stx")).map((O)=>({input:O}));for(let H of j){let O=e$.join(X,H.input),F=H.output||H.input.replace(/\.stx$/,".html"),L=e$.join(J,F);if(U)console.log(` Building ${H.input}...`);try{let V={...W,...H.props,..._},A=await GQ(O,V,q);await Bun.write(L,A),Y.views.push(F)}catch(V){let A=V instanceof Error?V.message:String(V);if(Y.errors.push({file:H.input,error:A}),Y.success=!1,U)console.error(` Error: ${A}`)}}if(z){let H={buildTime:new Date().toISOString(),views:Y.views,placeholders:_,errors:Y.errors.length>0?Y.errors:void 0};await Bun.write(e$.join(J,"manifest.json"),JSON.stringify(H,null,2))}if(Y.duration=performance.now()-Z,U)if(Y.success)console.log(`
14910
14910
  \u2705 Built ${Y.views.length} views in ${Y.duration.toFixed(0)}ms`);else console.log(`
14911
14911
  \u26A0\uFE0F Built ${Y.views.length} views with ${Y.errors.length} errors`);return Y}function fE($,Z){let Y=KZ.watch($.viewsDir,{recursive:!0},async(X,J)=>{if(!J)return;if(J.endsWith(".stx")||J.endsWith(".ts")||J.endsWith(".js")){if($.debug)console.log(`
14912
- File changed: ${J}, rebuilding...`);let Q=await Mj($);Z?.(Q)}});return{close:()=>Y.close()}}async function gE($,Z={},Y={}){let X={...Y,skipDefaultSeoTags:!0,skipSignalsRuntime:!0},J=await KQ($,Z,X);J=await hE(J),J=J.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),J=J.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,""),J=J.replace(/<!--\s*stx SEO Tags\s*-->/gi,""),J=J.replace(/\n\s*\n\s*\n/g,`
14912
+ File changed: ${J}, rebuilding...`);let Q=await Mj($);Z?.(Q)}});return{close:()=>Y.close()}}async function gE($,Z={},Y={}){let X={...Y,skipDefaultSeoTags:!0,skipSignalsRuntime:!0},J=await GQ($,Z,X);J=await hE(J),J=J.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),J=J.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,""),J=J.replace(/<!--\s*stx SEO Tags\s*-->/gi,""),J=J.replace(/\n\s*\n\s*\n/g,`
14913
14913
 
14914
14914
  `).trim();let Q=uE(J);return{html:J,text:Q}}async function hE($){try{let{generateCrosswindCSS:Z,extractClassNames:Y}=await Promise.resolve().then(() => (E1(),M3));if(Y($).size===0)return $;let J=await Z($);if(!J)return $;let Q=dE(J);if(Q.size===0)return $;return $.replace(/(<[a-z][a-z0-9]*)((?:\s+[a-z][a-z0-9-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s+)class\s*=\s*"([^"]*)"((?:\s+[a-z][a-z0-9-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?>)/gi,(G,K,W,_,B,U)=>{let z=_.split(/\s+/).filter(Boolean),q=[];for(let F of z){let L=Q.get(F);if(L)q.push(L)}if(q.length===0)return`${K}${W}class="${_}"${B}${U}`;let j=q.join("; "),O=`${W}${B}`.match(/style\s*=\s*"([^"]*)"/);if(O){let F=`${j}; ${O[1]}`,L=W.replace(/style\s*=\s*"[^"]*"/,`style="${F}"`),V=B.replace(/style\s*=\s*"[^"]*"/,`style="${F}"`);return`${K}${L}class="${_}"${V}${U}`}return`${K}${W}class="${_}" style="${j}"${B}${U}`})}catch{return $}}function dE($){let Z=new Map,Y=/\.([a-zA-Z0-9_-]+(?:\\:[a-zA-Z0-9_-]+)*)\s*\{([^}]+)\}/g,X=Y.exec($);while(X!==null){let J=X[1].replace(/\\/g,""),Q=X[2].split(";").map((G)=>G.trim()).filter(Boolean).join("; ");if(Q)Z.set(J,Q);X=Y.exec($)}return Z}function uE($){return $.replace(/<br\s*\/?>/gi,`
14915
14915
  `).replace(/<\/(p|div|h[1-6]|li|tr)>/gi,`
14916
14916
  `).replace(/<\/td>/gi,"\t").replace(/<[^>]*>/g,"").replace(/&nbsp;/g," ").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&copy;/g,"(c)").replace(/&middot;/g,"-").replace(/\n\s*\n\s*\n/g,`
14917
14917
 
14918
- `).trim()}var Tj=D(()=>{F$();m0();_1()});function mE($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function pE($){let Z={};for(let Y of Object.keys($))if(!Y.startsWith("__"))Z[Y]=$[Y];return Z}function cE($){let{template:Z,context:Y={},title:X="stx App"}=$,J=pE(Y),Q=mE(JSON.stringify(J));return`<!DOCTYPE html>
14918
+ `).trim()}var Tj=D(()=>{V$();m0();_1()});function mE($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function pE($){let Z={};for(let Y of Object.keys($))if(!Y.startsWith("__"))Z[Y]=$[Y];return Z}function cE($){let{template:Z,context:Y={},title:X="stx App"}=$,J=pE(Y),Q=mE(JSON.stringify(J));return`<!DOCTYPE html>
14919
14919
  <html lang="en">
14920
14920
  <head>
14921
14921
  <meta charset="UTF-8">
@@ -15000,7 +15000,7 @@ File changed: ${J}, rebuilding...`);let Q=await Mj($);Z?.(Q)}});return{close:()=
15000
15000
  return refs;
15001
15001
  };
15002
15002
  })();
15003
- `}var v1=null,WZ;var WQ=D(()=>{WZ=new Map});function iE($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function _Q($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}function dj($){if($==null||typeof $==="boolean")return[];if(!Array.isArray($))return[fj($)];return $.flat(1/0).map(fj).filter((Z)=>Z!=="")}function fj($){if($==null||typeof $==="boolean")return"";if(typeof $==="string")return $;if(typeof $==="number")return String($);return $}function Y5($,Z,Y){let{children:X,ref:J,key:Q,...G}=Z||{};return{type:$,props:Object.keys(G).length>0?G:null,children:dj(X),key:Y??Q??void 0,ref:J??void 0}}function pj($){return Object.entries($).filter(([,Z])=>Z!=null&&Z!==!1).map(([Z,Y])=>{let X=Z.replace(/[A-Z]/g,(Q)=>`-${Q.toLowerCase()}`),J=typeof Y==="number"&&!X.startsWith("--")&&X!=="opacity"&&X!=="z-index"&&X!=="flex-grow"&&X!=="flex-shrink"&&X!=="order"&&X!=="font-weight"&&X!=="line-height"?`${Y}px`:String(Y);return`${X}: ${J}`}).join("; ")}function BQ($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map(BQ).join(" ");if(typeof $==="object"&&$!==null)return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return""}function nE($){if(!$)return"";let Z=[];for(let[Y,X]of Object.entries($)){if(Y==="key"||Y==="ref"||Y==="children"||Y==="innerHTML"||Y==="dangerouslySetInnerHTML")continue;if(Y.startsWith("on")&&typeof X==="function")continue;let J=hj[Y]||Y;if(J==="class"||J==="className"){let Q=BQ(X);if(Q)Z.push(` class="${_Q(Q)}"`);continue}if(J==="style"){let Q=typeof X==="string"?X:pj(X);if(Q)Z.push(` style="${_Q(Q)}"`);continue}if(gj.has(J)){if(X)Z.push(` ${J}`);continue}if(X!=null&&X!==!1)Z.push(` ${J}="${_Q(String(X))}"`)}return Z.join("")}function $5($){if($==null||typeof $==="boolean")return"";if(typeof $==="string")return iE($);if(typeof $==="number")return String($);if(Array.isArray($))return $.map($5).join("");if($.type===Z5)return $.children.map($5).join("");if(typeof $.type==="function"){let Q=$.type({...$.props,children:$.children.length===1?$.children[0]:$.children.length>0?$.children:void 0});return $5(Q)}let Z=$.type,Y=nE($.props),X=$.props?.innerHTML??$.props?.dangerouslySetInnerHTML?.__html;if(X!=null)return`<${Z}${Y}>${X}</${Z}>`;if(lE.has(Z))return`<${Z}${Y}>`;let J=$.children.map($5).join("");return`<${Z}${Y}>${J}</${Z}>`}function cj($){return new ReadableStream({start(Z){Z.enqueue($5($)),Z.close()}})}function sE($,Z){if(!Z)return;for(let[Y,X]of Object.entries(Z)){if(Y==="key"||Y==="ref"||Y==="children"||Y==="innerHTML"||Y==="dangerouslySetInnerHTML")continue;let J=hj[Y]||Y;if(Y.startsWith("on")&&typeof X==="function"){let Q=Y.slice(2).toLowerCase();$.addEventListener(Q,X);continue}if(J==="class"||J==="className"){let Q=BQ(X);if(Q)$.setAttribute("class",Q);continue}if(J==="style"){let Q=typeof X==="string"?X:pj(X);if(Q)$.setAttribute("style",Q);continue}if(gj.has(J)){if(X)$.setAttribute(J,"");continue}if(X!=null&&X!==!1)$.setAttribute(J,String(X))}}function O7($,Z){if($==null||typeof $==="boolean")return;if(typeof $==="string"){Z.appendChild(document.createTextNode($));return}if(typeof $==="number"){Z.appendChild(document.createTextNode(String($)));return}if(Array.isArray($)){for(let J of $)O7(J,Z);return}if($.type===Z5){for(let J of $.children)O7(J,Z);return}if(typeof $.type==="function"){let J=$.type({...$.props,children:$.children.length===1?$.children[0]:$.children.length>0?$.children:void 0});O7(J,Z);return}let Y=document.createElement($.type);sE(Y,$.props);let X=$.props?.innerHTML??$.props?.dangerouslySetInnerHTML?.__html;if(X!=null)Y.innerHTML=X;else for(let J of $.children)O7(J,Y);if($.ref){if(typeof $.ref==="function")$.ref(Y)}Z.appendChild(Y)}function lj($){if($.when)return Y5(Z5,{children:$.children});return $.fallback??null}function ij($){let Z=$.each;if(!Z||Z.length===0)return $.fallback??null;let Y=Array.isArray($.children)?$.children[0]:$.children,X=Z.map((J,Q)=>Y(J,Q));return Y5(Z5,{children:X})}function nj($){return Y5(Z5,{children:$.children})}function sj($,Z,...Y){let{key:X,ref:J,...Q}=Z||{};return{type:$,props:Object.keys(Q).length>0?Q:{},children:dj(Y.length===1?Y[0]:Y),key:X??void 0,ref:J??void 0}}var Z5,lE,gj,hj,uj,mj;var rj=D(()=>{Z5=Symbol.for("stx.Fragment"),lE=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),gj=new Set(["allowfullscreen","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","inert","ismap","itemscope","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"]),hj={className:"class",htmlFor:"for",tabIndex:"tabindex",autoFocus:"autofocus",autoPlay:"autoplay",crossOrigin:"crossorigin",dateTime:"datetime",encType:"enctype",formAction:"formaction",formEncType:"formenctype",formMethod:"formmethod",formNoValidate:"formnovalidate",formTarget:"formtarget",frameBorder:"frameborder",hrefLang:"hreflang",httpEquiv:"http-equiv",inputMode:"inputmode",maxLength:"maxlength",mediaGroup:"mediagroup",minLength:"minlength",noModule:"nomodule",noValidate:"novalidate",playsInline:"playsinline",readOnly:"readonly",rowSpan:"rowspan",colSpan:"colspan",srcDoc:"srcdoc",srcLang:"srclang",srcSet:"srcset",useMap:"usemap"};uj=Y5,mj=Y5});function UQ($,Z){let Y=new Set,X=new Map,J=new Map,Q={globalProperties:{},performance:!1,compilerOptions:{}},G={config:Q,_components:X,_directives:J,_installedPlugins:Y,use(K,...W){if(Y.has(K))return G;if(Y.add(K),typeof K==="function")K(G,...W);else if(typeof K.install==="function")K.install(G,...W);return G},provide(K,W){return _Z(K,W),G},component(K,W){if(!W)return X.get(K);return X.set(K,W),G},directive(K,W){if(!W)return J.get(K);return J.set(K,W),G},mount(K){if(typeof document<"u"){let W=globalThis.__stx_globals||(globalThis.__stx_globals={});Object.assign(W,Q.globalProperties),document.querySelectorAll("[v-cloak]").forEach((_)=>{_.removeAttribute("v-cloak")})}return G},unmount(){X.clear(),J.clear(),Y.clear()}};return G}function oj($){return class extends HTMLElement{_component;_shadow;constructor(){super();this._shadow=this.attachShadow({mode:"open"}),this._component=$}connectedCallback(){if(this._component?.render){let Z=this._component.render();if(typeof Z==="string")this._shadow.innerHTML=Z}else if(this._component?.template)this._shadow.innerHTML=this._component.template;else if(typeof this._component==="string")this._shadow.innerHTML=this._component}disconnectedCallback(){this._shadow.innerHTML=""}}}var aj=D(()=>{WQ()});import{dirname as rE,resolve as tj}from"path";function oE($){let Z=$,Y=$.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>/i);if(Y&&Y.index!==void 0){let B=Y.index+Y[0].length,U=1,z=B;while(U>0&&z<$.length){let q=$.indexOf("<template",z),j=$.indexOf("</template>",z);if(j===-1)break;if(q!==-1&&q<j){let H=$[q+9];if(H===">"||H===" "||H===`
15003
+ `}var v1=null,WZ;var KQ=D(()=>{WZ=new Map});function iE($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function WQ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}function dj($){if($==null||typeof $==="boolean")return[];if(!Array.isArray($))return[fj($)];return $.flat(1/0).map(fj).filter((Z)=>Z!=="")}function fj($){if($==null||typeof $==="boolean")return"";if(typeof $==="string")return $;if(typeof $==="number")return String($);return $}function Y5($,Z,Y){let{children:X,ref:J,key:Q,...G}=Z||{};return{type:$,props:Object.keys(G).length>0?G:null,children:dj(X),key:Y??Q??void 0,ref:J??void 0}}function pj($){return Object.entries($).filter(([,Z])=>Z!=null&&Z!==!1).map(([Z,Y])=>{let X=Z.replace(/[A-Z]/g,(Q)=>`-${Q.toLowerCase()}`),J=typeof Y==="number"&&!X.startsWith("--")&&X!=="opacity"&&X!=="z-index"&&X!=="flex-grow"&&X!=="flex-shrink"&&X!=="order"&&X!=="font-weight"&&X!=="line-height"?`${Y}px`:String(Y);return`${X}: ${J}`}).join("; ")}function _Q($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map(_Q).join(" ");if(typeof $==="object"&&$!==null)return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return""}function nE($){if(!$)return"";let Z=[];for(let[Y,X]of Object.entries($)){if(Y==="key"||Y==="ref"||Y==="children"||Y==="innerHTML"||Y==="dangerouslySetInnerHTML")continue;if(Y.startsWith("on")&&typeof X==="function")continue;let J=hj[Y]||Y;if(J==="class"||J==="className"){let Q=_Q(X);if(Q)Z.push(` class="${WQ(Q)}"`);continue}if(J==="style"){let Q=typeof X==="string"?X:pj(X);if(Q)Z.push(` style="${WQ(Q)}"`);continue}if(gj.has(J)){if(X)Z.push(` ${J}`);continue}if(X!=null&&X!==!1)Z.push(` ${J}="${WQ(String(X))}"`)}return Z.join("")}function $5($){if($==null||typeof $==="boolean")return"";if(typeof $==="string")return iE($);if(typeof $==="number")return String($);if(Array.isArray($))return $.map($5).join("");if($.type===Z5)return $.children.map($5).join("");if(typeof $.type==="function"){let Q=$.type({...$.props,children:$.children.length===1?$.children[0]:$.children.length>0?$.children:void 0});return $5(Q)}let Z=$.type,Y=nE($.props),X=$.props?.innerHTML??$.props?.dangerouslySetInnerHTML?.__html;if(X!=null)return`<${Z}${Y}>${X}</${Z}>`;if(lE.has(Z))return`<${Z}${Y}>`;let J=$.children.map($5).join("");return`<${Z}${Y}>${J}</${Z}>`}function cj($){return new ReadableStream({start(Z){Z.enqueue($5($)),Z.close()}})}function sE($,Z){if(!Z)return;for(let[Y,X]of Object.entries(Z)){if(Y==="key"||Y==="ref"||Y==="children"||Y==="innerHTML"||Y==="dangerouslySetInnerHTML")continue;let J=hj[Y]||Y;if(Y.startsWith("on")&&typeof X==="function"){let Q=Y.slice(2).toLowerCase();$.addEventListener(Q,X);continue}if(J==="class"||J==="className"){let Q=_Q(X);if(Q)$.setAttribute("class",Q);continue}if(J==="style"){let Q=typeof X==="string"?X:pj(X);if(Q)$.setAttribute("style",Q);continue}if(gj.has(J)){if(X)$.setAttribute(J,"");continue}if(X!=null&&X!==!1)$.setAttribute(J,String(X))}}function O7($,Z){if($==null||typeof $==="boolean")return;if(typeof $==="string"){Z.appendChild(document.createTextNode($));return}if(typeof $==="number"){Z.appendChild(document.createTextNode(String($)));return}if(Array.isArray($)){for(let J of $)O7(J,Z);return}if($.type===Z5){for(let J of $.children)O7(J,Z);return}if(typeof $.type==="function"){let J=$.type({...$.props,children:$.children.length===1?$.children[0]:$.children.length>0?$.children:void 0});O7(J,Z);return}let Y=document.createElement($.type);sE(Y,$.props);let X=$.props?.innerHTML??$.props?.dangerouslySetInnerHTML?.__html;if(X!=null)Y.innerHTML=X;else for(let J of $.children)O7(J,Y);if($.ref){if(typeof $.ref==="function")$.ref(Y)}Z.appendChild(Y)}function lj($){if($.when)return Y5(Z5,{children:$.children});return $.fallback??null}function ij($){let Z=$.each;if(!Z||Z.length===0)return $.fallback??null;let Y=Array.isArray($.children)?$.children[0]:$.children,X=Z.map((J,Q)=>Y(J,Q));return Y5(Z5,{children:X})}function nj($){return Y5(Z5,{children:$.children})}function sj($,Z,...Y){let{key:X,ref:J,...Q}=Z||{};return{type:$,props:Object.keys(Q).length>0?Q:{},children:dj(Y.length===1?Y[0]:Y),key:X??void 0,ref:J??void 0}}var Z5,lE,gj,hj,uj,mj;var rj=D(()=>{Z5=Symbol.for("stx.Fragment"),lE=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),gj=new Set(["allowfullscreen","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","inert","ismap","itemscope","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"]),hj={className:"class",htmlFor:"for",tabIndex:"tabindex",autoFocus:"autofocus",autoPlay:"autoplay",crossOrigin:"crossorigin",dateTime:"datetime",encType:"enctype",formAction:"formaction",formEncType:"formenctype",formMethod:"formmethod",formNoValidate:"formnovalidate",formTarget:"formtarget",frameBorder:"frameborder",hrefLang:"hreflang",httpEquiv:"http-equiv",inputMode:"inputmode",maxLength:"maxlength",mediaGroup:"mediagroup",minLength:"minlength",noModule:"nomodule",noValidate:"novalidate",playsInline:"playsinline",readOnly:"readonly",rowSpan:"rowspan",colSpan:"colspan",srcDoc:"srcdoc",srcLang:"srclang",srcSet:"srcset",useMap:"usemap"};uj=Y5,mj=Y5});function BQ($,Z){let Y=new Set,X=new Map,J=new Map,Q={globalProperties:{},performance:!1,compilerOptions:{}},G={config:Q,_components:X,_directives:J,_installedPlugins:Y,use(K,...W){if(Y.has(K))return G;if(Y.add(K),typeof K==="function")K(G,...W);else if(typeof K.install==="function")K.install(G,...W);return G},provide(K,W){return _Z(K,W),G},component(K,W){if(!W)return X.get(K);return X.set(K,W),G},directive(K,W){if(!W)return J.get(K);return J.set(K,W),G},mount(K){if(typeof document<"u"){let W=globalThis.__stx_globals||(globalThis.__stx_globals={});Object.assign(W,Q.globalProperties),document.querySelectorAll("[v-cloak]").forEach((_)=>{_.removeAttribute("v-cloak")})}return G},unmount(){X.clear(),J.clear(),Y.clear()}};return G}function oj($){return class extends HTMLElement{_component;_shadow;constructor(){super();this._shadow=this.attachShadow({mode:"open"}),this._component=$}connectedCallback(){if(this._component?.render){let Z=this._component.render();if(typeof Z==="string")this._shadow.innerHTML=Z}else if(this._component?.template)this._shadow.innerHTML=this._component.template;else if(typeof this._component==="string")this._shadow.innerHTML=this._component}disconnectedCallback(){this._shadow.innerHTML=""}}}var aj=D(()=>{KQ()});import{dirname as rE,resolve as tj}from"path";function oE($){let Z=$,Y=$.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>/i);if(Y&&Y.index!==void 0){let B=Y.index+Y[0].length,U=1,z=B;while(U>0&&z<$.length){let q=$.indexOf("<template",z),j=$.indexOf("</template>",z);if(j===-1)break;if(q!==-1&&q<j){let H=$[q+9];if(H===">"||H===" "||H===`
15004
15004
  `||H==="\t")U++;z=q+9}else{if(U--,U===0){Z=$.slice(B,j).trim();break}z=j+11}}}let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,J=[],Q=[],G=[],K=(B)=>/\b(?:state|derived|effect|batch)\s*\(/.test(B),W;while((W=X.exec($))!==null){let B=W[1],U=W[2],z=W[0],q=B.includes("server");if(K(U))G.push(z);else if(q)Q.push(U);else J.push(z)}let _=Z;{let B=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,U,z=[];while((U=B.exec(_))!==null){let q=U.index+U[0].length,j=1,H=q;while(H<_.length&&j>0){let O=_.indexOf("<script",H),F=_.indexOf("</script>",H);if(F===-1)break;if(O!==-1&&O<F)j++,H=O+7;else{if(j--,j===0){z.push({start:U.index,end:F+9});break}H=F+9}}}for(let q=z.length-1;q>=0;q--)_=_.substring(0,z[q].start)+_.substring(z[q].end)}for(let B of J)_=_.replace(B,"");return{templateContent:_,serverScripts:Q,clientScripts:J,signalsScripts:G}}function aE($,Z){return`<!DOCTYPE html>
15005
15005
  <html lang="en">
15006
15006
  <head>
@@ -15016,7 +15016,7 @@ ${Q.join(`
15016
15016
  `)}`}else{if(Y.processClientScripts!==!1&&Q.length>0){let B=K.__stx_event_bindings||[],z=(await Promise.all(Q.map(async(j)=>{let H=j.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!H)return j;return await f$(H[1],{eventBindings:B,templateContent:_})}))).join(`
15017
15017
  `);if(_.match(/(<\/body>)/i))_=_.replace(/(<\/body>)/i,`${z}
15018
15018
  $1`);else _+=`
15019
- ${z}`}_=await c$(_)}if(Y.wrapInDocument){if(!_.trim().toLowerCase().startsWith("<!doctype")&&!_.trim().toLowerCase().startsWith("<html"))_=aE(_,Y.title)}if(Y.injectCSS)try{let{injectCrosswindCSS:B}=await Promise.resolve().then(() => (E1(),M3));_=await B(_)}catch{}return _}var ej=D(()=>{m0();F$();_1();I7()});function K6($,Z,Y={},X="/"){let J=Z.seo??{},Q=Y.title??J.title??Z.name,G=Y.description??J.description??Z.description??"",K=Y.image??J.image,W=`${Z.url.replace(/\/$/,"")}${X}`,_=J.siteName??Z.name,B=J.type??"website",U=J.locale??"en_US",z=[];if(J.favicon){let H=J.favicon.toLowerCase().split(".").pop(),O=H==="svg"?"image/svg+xml":H==="ico"?"image/x-icon":H==="png"?"image/png":H==="jpg"||H==="jpeg"?"image/jpeg":"";z.push(`<link rel="icon"${O?` type="${O}"`:""} href="${o0(J.favicon)}">`)}if(z.push(`<link rel="canonical" href="${o0(W)}">`,`<meta name="description" content="${o0(G)}">`,`<meta property="og:title" content="${o0(Q)}">`,`<meta property="og:description" content="${o0(G)}">`,`<meta property="og:type" content="${o0(B)}">`,`<meta property="og:url" content="${o0(W)}">`,`<meta property="og:site_name" content="${o0(_)}">`,`<meta property="og:locale" content="${o0(U)}">`,`<meta name="twitter:card" content="${K?"summary_large_image":"summary"}">`,`<meta name="twitter:title" content="${o0(Q)}">`,`<meta name="twitter:description" content="${o0(G)}">`),K)z.push(`<meta property="og:image" content="${o0(K)}">`),z.push(`<meta name="twitter:image" content="${o0(K)}">`);if(J.twitter)z.push(`<meta name="twitter:site" content="@${o0(J.twitter.replace(/^@/,""))}">`),z.push(`<meta name="twitter:creator" content="@${o0(J.twitter.replace(/^@/,""))}">`);let q=`<!-- SEO -->
15019
+ ${z}`}_=await c$(_)}if(Y.wrapInDocument){if(!_.trim().toLowerCase().startsWith("<!doctype")&&!_.trim().toLowerCase().startsWith("<html"))_=aE(_,Y.title)}if(Y.injectCSS)try{let{injectCrosswindCSS:B}=await Promise.resolve().then(() => (E1(),M3));_=await B(_)}catch{}return _}var ej=D(()=>{m0();V$();_1();I7()});function K6($,Z,Y={},X="/"){let J=Z.seo??{},Q=Y.title??J.title??Z.name,G=Y.description??J.description??Z.description??"",K=Y.image??J.image,W=`${Z.url.replace(/\/$/,"")}${X}`,_=J.siteName??Z.name,B=J.type??"website",U=J.locale??"en_US",z=[];if(J.favicon){let H=J.favicon.toLowerCase().split(".").pop(),O=H==="svg"?"image/svg+xml":H==="ico"?"image/x-icon":H==="png"?"image/png":H==="jpg"||H==="jpeg"?"image/jpeg":"";z.push(`<link rel="icon"${O?` type="${O}"`:""} href="${o0(J.favicon)}">`)}if(z.push(`<link rel="canonical" href="${o0(W)}">`,`<meta name="description" content="${o0(G)}">`,`<meta property="og:title" content="${o0(Q)}">`,`<meta property="og:description" content="${o0(G)}">`,`<meta property="og:type" content="${o0(B)}">`,`<meta property="og:url" content="${o0(W)}">`,`<meta property="og:site_name" content="${o0(_)}">`,`<meta property="og:locale" content="${o0(U)}">`,`<meta name="twitter:card" content="${K?"summary_large_image":"summary"}">`,`<meta name="twitter:title" content="${o0(Q)}">`,`<meta name="twitter:description" content="${o0(G)}">`),K)z.push(`<meta property="og:image" content="${o0(K)}">`),z.push(`<meta name="twitter:image" content="${o0(K)}">`);if(J.twitter)z.push(`<meta name="twitter:site" content="@${o0(J.twitter.replace(/^@/,""))}">`),z.push(`<meta name="twitter:creator" content="@${o0(J.twitter.replace(/^@/,""))}">`);let q=`<!-- SEO -->
15020
15020
  ${z.join(`
15021
15021
  `)}
15022
15022
  <!-- /SEO -->`,j=/<!--\s*stx SEO Tags\s*-->[\s\S]*?<meta\s+name="twitter:description"[^>]*>\s*/i;if(j.test($))$=$.replace(j,"");if($=$.replace(/<!--\s*SEO\s*-->[\s\S]*?<!--\s*\/SEO\s*-->\s*/g,""),$=$.replace(/<meta\s+name="title"\s+content="stx Project"[^>]*>\s*/g,"").replace(/<meta\s+name="description"\s+content="A website built with stx[^"]*"[^>]*>\s*/g,"").replace(/<meta\s+property="og:title"\s+content="stx Project"[^>]*>\s*/g,"").replace(/<meta\s+property="og:description"\s+content="A website built with stx[^"]*"[^>]*>\s*/g,"").replace(/<meta\s+property="og:type"\s+content="website"[^>]*>\s*/g,"").replace(/<meta\s+name="twitter:card"\s+content="summary_large_image"[^>]*>\s*/g,"").replace(/<meta\s+name="twitter:title"\s+content="stx Project"[^>]*>\s*/g,"").replace(/<meta\s+name="twitter:description"\s+content="A website built with stx[^"]*"[^>]*>\s*/g,""),/<head[^>]*>/i.test($))return $.replace(/<head([^>]*)>/i,`<head$1>
@@ -15037,9 +15037,9 @@ ${Q}`}var L7=null;function U6($,Z){if(Z.theme===!1)return $;let Y=typeof Z.theme
15037
15037
  ${W}`)}if(!$.includes("__stxThemeGuard")&&/<head\b[^>]*>/i.test($)){let K=`<script data-stx-theme-guard="1">${YI(X,J,Q,G)};window.__stxThemeGuard=1;</script>`;$=$.replace(/<head\b([^>]*)>/i,`<head$1>
15038
15038
  ${K}`)}if(!$.includes("__stxThemeToggle")&&/<\/body>/i.test($)){let K=`<script data-stx-theme-toggle="1">${XI(J,Q,G)};window.__stxThemeToggle=1;</script>`;$=$.replace(/<\/body>/i,`${K}
15039
15039
  </body>`)}return $}var YI=($,Z,Y,X)=>`(function(){try{var k=${JSON.stringify(Z)};var t=localStorage.getItem(k);var html=document.documentElement;var isDark=t===null?(${JSON.stringify($)}==='dark'||(${JSON.stringify($)}==='auto'&&window.matchMedia('(prefers-color-scheme: dark)').matches)):t==='dark';html.classList[isDark?'add':'remove']('dark');var tc=document.querySelector('meta[name="theme-color"]:not([media])');if(tc)tc.setAttribute('content',isDark?${JSON.stringify(X)}:${JSON.stringify(Y)})}catch(e){}})();`,XI=($,Z,Y)=>`document.addEventListener('click',function(e){var t=e.target&&e.target.closest&&e.target.closest('#theme-toggle');if(!t)return;var html=document.documentElement;var isDark=html.classList.toggle('dark');try{localStorage.setItem(${JSON.stringify($)},isDark?'dark':'light')}catch(e){}var tc=document.querySelector('meta[name="theme-color"]:not([media])');if(tc)tc.setAttribute('content',isDark?${JSON.stringify(Y)}:${JSON.stringify(Z)})});`;import{existsSync as JI,readFileSync as QI}from"fs";import{join as GI,resolve as KI}from"path";import WI from"process";function z6($,Z=WI.cwd()){let Y=$.i18n;if(!Y||!Array.isArray(Y.locales)||Y.locales.length===0)return null;let X=Y.defaultLocale??Y.locales[0],J=_I(Y,Z);return{locales:Y.locales,defaultLocale:X,labels:Y.labels??Object.fromEntries(Y.locales.map((Q)=>[Q,Q.toUpperCase()])),translations:J,pickerSelector:Y.pickerSelector??"#lang-picker"}}function _I($,Z){let Y=$.translations??{},X={},J=$.translationsDir,Q=J===!1?null:KI(Z,typeof J==="string"&&J?J:"translations"),G=$.format??"json";for(let K of $.locales){let W=Q?BI(Q,K,G):{};X[K]={...W,...Y[K]??{}}}return X}function BI($,Z,Y){let X=Y==="json"?[`${Z}.json`]:[`${Z}.${Y}`,`${Z}.${Y==="yaml"?"yml":"yaml"}`];for(let J of X){let Q=GI($,J);if(!JI(Q))continue;try{let G=QI(Q,"utf8"),K=Y==="json"?JSON.parse(G):UI(G);return $H(K)}catch{continue}}return{}}function $H($,Z="",Y={}){if(!$||typeof $!=="object")return Y;for(let[X,J]of Object.entries($)){let Q=Z?`${Z}.${X}`:X;if(J&&typeof J==="object"&&!Array.isArray(J))$H(J,Q,Y);else if(typeof J==="string")Y[Q]=J;else if(typeof J==="number"||typeof J==="boolean")Y[Q]=String(J)}return Y}function UI($){let Z={},Y=[{obj:Z,indent:-1}];for(let X of $.split(`
15040
- `)){let J=X.replace(/#.*$/,"").trimEnd();if(!J.trim())continue;let Q=J.search(/\S/);if(Q===-1)continue;while(Y.length>1&&Y[Y.length-1].indent>=Q)Y.pop();let G=Y[Y.length-1].obj,K=J.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(!K)continue;let[,,W,_]=K,B=W.trim(),U=_.trim();if(U==="")G[B]={},Y.push({obj:G[B],indent:Q});else G[B]=zI(U)}return Z}function zI($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);return $}function UZ($,Z,Y){let X=$.translations[Z]?.[Y];if(typeof X==="string")return X;let J=$.translations[$.defaultLocale]?.[Y];if(typeof J==="string")return J;return Y}function q6($,Z,Y){return $.replace(/\{t:([a-zA-Z][\w.-]*)\}/g,(X,J)=>qI(UZ(Z,Y,J)))}function y$($,Z,Y){if(Z===Y)return $;if($==="/")return`/${Z}`;if($==="/404.html")return`/${Z}/404.html`;return`/${Z}${$}`}function qQ($,Z){for(let Y of Z){if($===`/${Y}`||$===`/${Y}/`)return{locale:Y,path:"/"};if($.startsWith(`/${Y}/`))return{locale:Y,path:$.slice(Y.length+1)}}return{locale:null,path:$}}function j6($,Z,Y){let X=$.replace(/\/$/,""),J=[];for(let G of Y.locales){let K=`${X}${y$(Z,G,Y.defaultLocale)}`;J.push(`<link rel="alternate" hreflang="${zQ(G)}" href="${zQ(K)}">`)}let Q=`${X}${y$(Z,Y.defaultLocale,Y.defaultLocale)}`;return J.push(`<link rel="alternate" hreflang="x-default" href="${zQ(Q)}">`),J.join(`
15041
- `)}function H6($,Z){return`<script data-stx-lang-picker="1">window.__stxI18n=${JSON.stringify({locales:$.locales,defaultLocale:$.defaultLocale,current:Z,pickerSelector:$.pickerSelector})};(function(){var d=window.__stxI18n;function localeFromPath(p){for(var i=0;i<d.locales.length;i++){var c=d.locales[i];if(p==='/'+c||p==='/'+c+'/')return c;if(p.indexOf('/'+c+'/')===0)return c}return d.defaultLocale}function localePathFor(loc,p){var stripped=p;for(var i=0;i<d.locales.length;i++){var c=d.locales[i];if(p==='/'+c||p==='/'+c+'/'){stripped='/';break}if(p.indexOf('/'+c+'/')===0){stripped=p.slice(c.length+1);break}}if(loc===d.defaultLocale)return stripped;if(stripped==='/')return '/'+loc;return '/'+loc+stripped}function syncFromUrl(){var loc=localeFromPath(location.pathname);d.current=loc;var picker=document.querySelector(d.pickerSelector);if(picker){var btns=picker.querySelectorAll('[data-lang]');for(var i=0;i<btns.length;i++){if(btns[i].getAttribute('data-lang')===loc)btns[i].setAttribute('aria-current','true');else btns[i].removeAttribute('aria-current')}}if(document.documentElement.lang!==loc)document.documentElement.lang=loc}syncFromUrl();window.addEventListener('stx:navigate',syncFromUrl);window.addEventListener('popstate',syncFromUrl);document.addEventListener('click',function(e){var btn=e.target&&e.target.closest&&e.target.closest('['+'data-lang'+']');if(!btn)return;var picker=document.querySelector(d.pickerSelector);if(!picker||!picker.contains(btn))return;e.preventDefault();var loc=btn.getAttribute('data-lang');var dest=localePathFor(loc,location.pathname);if(window.__stxRouter&&window.__stxRouter.navigate)window.__stxRouter.navigate(dest);else location.assign(dest)});})();</script>`}function zQ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function qI($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var jQ=()=>{};var{Glob:jI}=globalThis.Bun;import{cpSync as HI,existsSync as jZ,mkdirSync as ZH,readFileSync as YH,readdirSync as OI,rmSync as LI,statSync as FI,unlinkSync as VI,writeFileSync as zZ}from"fs";import{dirname as NI,join as t1,relative as AI}from"path";import XH from"process";import wI from"bun-plugin-stx";async function OQ($){let Z=Date.now(),Y=$.pagesDir??"pages",X=$.outDir??"dist",J=$.publicDir??"public";if(!$.noClean)LI(X,{recursive:!0,force:!0});ZH(X,{recursive:!0});let Q=new jI(`${Y}/**/*.stx`),G=await Array.fromAsync(Q.scan("."));if(G.length===0)throw Error(`No .stx files found in ${Y}/`);let K=await Bun.build({entrypoints:G,outdir:X,plugins:[wI()],naming:{entry:"[name].[ext]"}});if(!K.success)throw console.error(K.logs),Error("Build failed");TI(X);let W=LQ(X).filter((q)=>q.endsWith(".html")),_=z6($,XH.cwd());for(let q of W){let j=t1(X,q),H=YH(j,"utf8"),O=qZ(q),F=_?_.locales:[$.seo?.locale?.split(/[_-]/)[0]??"en"];for(let L of F){let V=H;if(V=EI(V),_)V=q6(V,_,L);if(V=await V0(V,XH.cwd()),V=K6(V,$,$.pages?.[O],O),_)V=II(V,$,_,L,O);if(V=U6(V,$),V=DI(V),_)V=V.replace(/<\/body>/i,`${H6(_,L)}
15042
- </body>`);if($.spa!==!1)V=await B6(V,$.router);let A=_?MI(O,L,_.defaultLocale):q,N=t1(X,A);if(ZH(RI(N),{recursive:!0}),zZ(N,V),_&&L!==_.defaultLocale&&A!==q);}}if(jZ(J))HI(J,X,{recursive:!0});let B=t1(X,"404.html");if(!jZ(B)&&jZ(t1(X,"index.html"))){let q=YH(t1(X,"index.html"),"utf8").replace(/<title>[^<]*<\/title>/i,`<title>404 \u2014 ${kI($.name)}</title>`);zZ(B,q)}if($.sitemap!==!1){let q=W.filter((j)=>j!=="404.html").map((j)=>({path:qZ(j),page:$.pages?.[qZ(j)]}));zZ(t1(X,"sitemap.xml"),W6($,q))}let U=_6($);if(U!==null)zZ(t1(X,"robots.txt"),U);let z=W.map(qZ);return{outDir:X,pages:z,durationMs:Date.now()-Z}}function RI($){return NI($)}function MI($,Z,Y){let X=y$($,Z,Y);if(X==="/")return"index.html";let J=X.replace(/^\//,"");if(!J.includes("/")){if(Z!==Y&&J===Z)return`${Z}/index.html`;return`${J}.html`}return`${J}.html`.replace(/\.html\.html$/,".html")}function qZ($){if($==="index.html")return"/";return`/${$.replace(/\.html$/,"").replace(/\/index$/,"")}`}function LQ($,Z=$){let Y=[];if(!jZ($))return Y;for(let X of OI($,{withFileTypes:!0})){let J=t1($,X.name);if(X.isDirectory())Y.push(...LQ(J,Z));else Y.push(AI(Z,J))}return Y}function TI($){for(let Z of LQ($)){if(!/^chunk-.*\.js(?:\.map)?$/.test(Z))continue;let Y=t1($,Z);try{if(FI(Y).size===0)VI(Y)}catch{}}}function EI($){return $.replace(/<script[^>]*src=["']\.\/chunk-[^"']*\.js["'][^>]*><\/script>\s*/g,"")}function II($,Z,Y,X,J){if(!Y)return $;if(/<html\b[^>]*\blang=/i.test($))$=$.replace(/<html\b([^>]*)\blang="[^"]*"/i,`<html$1lang="${X}"`);else $=$.replace(/<html\b([^>]*)>/i,`<html$1 lang="${X}">`);let Q=`${Z.url.replace(/\/$/,"")}${y$(J,X,Y.defaultLocale)}`;if(/<link rel="canonical"/.test($))$=$.replace(/<link rel="canonical"[^>]*>/,`<link rel="canonical" href="${HQ(Q)}">`);let G=X.includes("_")||X.includes("-")?X:X.toLowerCase();if(/<meta property="og:locale"/.test($))$=$.replace(/<meta property="og:locale"[^>]*>/,`<meta property="og:locale" content="${HQ(G)}">`);if(/<meta property="og:url"/.test($))$=$.replace(/<meta property="og:url"[^>]*>/,`<meta property="og:url" content="${HQ(Q)}">`);let K=j6(Z.url,J,Y);if(!$.includes("hreflang="))$=$.replace(/<link rel="canonical"[^>]*>/,(W)=>`${K}
15040
+ `)){let J=X.replace(/#.*$/,"").trimEnd();if(!J.trim())continue;let Q=J.search(/\S/);if(Q===-1)continue;while(Y.length>1&&Y[Y.length-1].indent>=Q)Y.pop();let G=Y[Y.length-1].obj,K=J.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(!K)continue;let[,,W,_]=K,B=W.trim(),U=_.trim();if(U==="")G[B]={},Y.push({obj:G[B],indent:Q});else G[B]=zI(U)}return Z}function zI($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);return $}function UZ($,Z,Y){let X=$.translations[Z]?.[Y];if(typeof X==="string")return X;let J=$.translations[$.defaultLocale]?.[Y];if(typeof J==="string")return J;return Y}function q6($,Z,Y){return $.replace(/\{t:([a-zA-Z][\w.-]*)\}/g,(X,J)=>qI(UZ(Z,Y,J)))}function t1($,Z,Y){if(Z===Y)return $;if($==="/")return`/${Z}/`;if($==="/404.html")return`/${Z}/404.html`;return`/${Z}${$}`}function zQ($,Z){for(let Y of Z){if($===`/${Y}`||$===`/${Y}/`)return{locale:Y,path:"/"};if($.startsWith(`/${Y}/`))return{locale:Y,path:$.slice(Y.length+1)}}return{locale:null,path:$}}function j6($,Z,Y){let X=$.replace(/\/$/,""),J=[];for(let G of Y.locales){let K=`${X}${t1(Z,G,Y.defaultLocale)}`;J.push(`<link rel="alternate" hreflang="${UQ(G)}" href="${UQ(K)}">`)}let Q=`${X}${t1(Z,Y.defaultLocale,Y.defaultLocale)}`;return J.push(`<link rel="alternate" hreflang="x-default" href="${UQ(Q)}">`),J.join(`
15041
+ `)}function H6($,Z){return`<script data-stx-lang-picker="1">window.__stxI18n=${JSON.stringify({locales:$.locales,defaultLocale:$.defaultLocale,current:Z,pickerSelector:$.pickerSelector})};(function(){var d=window.__stxI18n;function localeFromPath(p){for(var i=0;i<d.locales.length;i++){var c=d.locales[i];if(p==='/'+c||p==='/'+c+'/')return c;if(p.indexOf('/'+c+'/')===0)return c}return d.defaultLocale}function localePathFor(loc,p){var stripped=p;for(var i=0;i<d.locales.length;i++){var c=d.locales[i];if(p==='/'+c||p==='/'+c+'/'){stripped='/';break}if(p.indexOf('/'+c+'/')===0){stripped=p.slice(c.length+1);break}}if(loc===d.defaultLocale)return stripped;if(stripped==='/')return '/'+loc+'/';return '/'+loc+stripped}function syncFromUrl(){var loc=localeFromPath(location.pathname);d.current=loc;var picker=document.querySelector(d.pickerSelector);if(picker){var btns=picker.querySelectorAll('[data-lang]');for(var i=0;i<btns.length;i++){if(btns[i].getAttribute('data-lang')===loc)btns[i].setAttribute('aria-current','true');else btns[i].removeAttribute('aria-current')}}if(document.documentElement.lang!==loc)document.documentElement.lang=loc}syncFromUrl();window.addEventListener('stx:navigate',syncFromUrl);window.addEventListener('popstate',syncFromUrl);document.addEventListener('click',function(e){var btn=e.target&&e.target.closest&&e.target.closest('['+'data-lang'+']');if(!btn)return;var picker=document.querySelector(d.pickerSelector);if(!picker||!picker.contains(btn))return;e.preventDefault();var loc=btn.getAttribute('data-lang');var dest=localePathFor(loc,location.pathname);if(window.__stxRouter&&window.__stxRouter.navigate)window.__stxRouter.navigate(dest);else location.assign(dest)});})();</script>`}function UQ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function qI($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var qQ=()=>{};var{Glob:jI}=globalThis.Bun;import{cpSync as HI,existsSync as qZ,mkdirSync as ZH,readFileSync as YH,readdirSync as OI,rmSync as LI,statSync as FI,unlinkSync as VI,writeFileSync as zZ}from"fs";import{dirname as NI,join as e1,relative as AI}from"path";import XH from"process";import wI from"bun-plugin-stx";async function OQ($){let Z=Date.now(),Y=$.pagesDir??"pages",X=$.outDir??"dist",J=$.publicDir??"public";if(!$.noClean)LI(X,{recursive:!0,force:!0});ZH(X,{recursive:!0});let Q=new jI(`${Y}/**/*.stx`),G=await Array.fromAsync(Q.scan("."));if(G.length===0)throw Error(`No .stx files found in ${Y}/`);let K=await Bun.build({entrypoints:G,outdir:X,plugins:[wI()],naming:{entry:"[name].[ext]"}});if(!K.success)throw console.error(K.logs),Error("Build failed");TI(X);let W=LQ(X).filter((q)=>q.endsWith(".html")),_=z6($,XH.cwd());for(let q of W){let j=e1(X,q),H=YH(j,"utf8"),O=jQ(q),F=_?_.locales:[$.seo?.locale?.split(/[_-]/)[0]??"en"];for(let L of F){let V=H;if(V=EI(V),_)V=q6(V,_,L);if(V=await V0(V,XH.cwd()),V=K6(V,$,$.pages?.[O],O),_)V=II(V,$,_,L,O);if(V=U6(V,$),V=DI(V),_)V=V.replace(/<\/body>/i,`${H6(_,L)}
15042
+ </body>`);if($.spa!==!1)V=await B6(V,$.router);let A=_?MI(O,L,_.defaultLocale):q,N=e1(X,A);if(ZH(RI(N),{recursive:!0}),zZ(N,V),_&&L!==_.defaultLocale&&A!==q);}}if(qZ(J))HI(J,X,{recursive:!0});let B=e1(X,"404.html");if(!qZ(B)&&qZ(e1(X,"index.html"))){let q=YH(e1(X,"index.html"),"utf8").replace(/<title>[^<]*<\/title>/i,`<title>404 \u2014 ${kI($.name)}</title>`);zZ(B,q)}if($.sitemap!==!1){let q=[],j=W.filter((O)=>O!=="404.html").map(jQ),H=_?_.locales:[null];for(let O of j){let F=$.pages?.[O];for(let L of H){let V=L&&_?t1(O,L,_.defaultLocale):O;q.push({path:V,page:F})}}zZ(e1(X,"sitemap.xml"),W6($,q))}let U=_6($);if(U!==null)zZ(e1(X,"robots.txt"),U);let z=W.map(jQ);return{outDir:X,pages:z,durationMs:Date.now()-Z}}function RI($){return NI($)}function MI($,Z,Y){let X=t1($,Z,Y);if(X==="/")return"index.html";let J=X.replace(/^\//,"").replace(/\/$/,"");if(!J.includes("/")){if(Z!==Y&&J===Z)return`${Z}/index.html`;return`${J}.html`}return`${J}.html`.replace(/\.html\.html$/,".html")}function jQ($){if($==="index.html")return"/";return`/${$.replace(/\.html$/,"").replace(/\/index$/,"")}`}function LQ($,Z=$){let Y=[];if(!qZ($))return Y;for(let X of OI($,{withFileTypes:!0})){let J=e1($,X.name);if(X.isDirectory())Y.push(...LQ(J,Z));else Y.push(AI(Z,J))}return Y}function TI($){for(let Z of LQ($)){if(!/^chunk-.*\.js(?:\.map)?$/.test(Z))continue;let Y=e1($,Z);try{if(FI(Y).size===0)VI(Y)}catch{}}}function EI($){return $.replace(/<script[^>]*src=["']\.\/chunk-[^"']*\.js["'][^>]*><\/script>\s*/g,"")}function II($,Z,Y,X,J){if(!Y)return $;if(/<html\b[^>]*\blang=/i.test($))$=$.replace(/<html\b([^>]*)\blang="[^"]*"/i,`<html$1lang="${X}"`);else $=$.replace(/<html\b([^>]*)>/i,`<html$1 lang="${X}">`);let Q=`${Z.url.replace(/\/$/,"")}${t1(J,X,Y.defaultLocale)}`;if(/<link rel="canonical"/.test($))$=$.replace(/<link rel="canonical"[^>]*>/,`<link rel="canonical" href="${HQ(Q)}">`);let G=X.includes("_")||X.includes("-")?X:X.toLowerCase();if(/<meta property="og:locale"/.test($))$=$.replace(/<meta property="og:locale"[^>]*>/,`<meta property="og:locale" content="${HQ(G)}">`);if(/<meta property="og:url"/.test($))$=$.replace(/<meta property="og:url"[^>]*>/,`<meta property="og:url" content="${HQ(Q)}">`);let K=j6(Z.url,J,Y);if(!$.includes("hreflang="))$=$.replace(/<link rel="canonical"[^>]*>/,(W)=>`${K}
15043
15043
  ${W}`);return $}function HQ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function DI($){if(/<main\b/i.test($)||/\bdata-stx-content\b/i.test($))return $;let Z=$.match(/<body\b[^>]*>/i),Y=$.search(/<\/body\s*>/i);if(!Z||Y<0)return $;let X=Z.index+Z[0].length,J=$.slice(X,Y),Q=0,G=[...J.matchAll(/<\/nav>/gi)];if(G.length>0){let z=G[G.length-1];Q=z.index+z[0].length}let K=J.length,W=J.search(/<footer\b/i);if(W!==-1)K=Math.min(K,W);let _=J.search(/<script\b[^>]*data-stx-(?:theme-toggle|reparent-progress)\b/i);if(_!==-1)K=Math.min(K,_);if(K<=Q)return $;let B=J.slice(Q,K);if(!B.trim())return $;let U=`${J.slice(0,Q)}
15044
15044
  <main>${B}</main>
15045
- ${J.slice(K)}`;return`${$.slice(0,X)}${U}${$.slice(Y)}`}function kI($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function FQ($){return $}var JH=D(()=>{E1();jQ()});var QH=D(()=>{JH();jQ()});function GH($,Z){return $.kind===Z}var KH=()=>{};var WH=D(()=>{KH()});var r$={};Q0(r$,{writeNetlifyConfig:()=>V6,writeManifest:()=>EJ,writeImageManifest:()=>CQ,wrapComponentForHMR:()=>qE,webComponentDirectiveHandler:()=>QX,watermark:()=>I9,watchViews:()=>fE,watchMultiple:()=>ww,watchEffect:()=>Rw,watch:()=>Aw,waitForStore:()=>cw,waitForLocale:()=>CV,videoDirective:()=>r7,validators:()=>H3,validateValueEnhanced:()=>MW,validateTemplate:()=>HU,validateParams:()=>b9,validateFormEnhanced:()=>wV,validateFile:()=>QZ,validateFields:()=>NV,validateField:()=>wW,validateDirective:()=>LU,validateCspDirectives:()=>XV,validateConfig:()=>EK,validateComponentScripts:()=>vR,validateComponentProps:()=>dR,validateClientScript:()=>T8,usesSignalsInScript:()=>C7,useVirtualList:()=>d2,useTitle:()=>zW,useStoreOrThrow:()=>pw,useStore:()=>Yj,useSlots:()=>yj,useSeoMeta:()=>Q4,useRouteParams:()=>yU,useRouteParamOrThrow:()=>lw,useRouteParam:()=>PU,usePageTitle:()=>zW,useMiddlewareValue:()=>iw,useMiddlewareState:()=>xU,useLoadingIndicator:()=>dq,useHead:()=>H$,useAttrs:()=>Pj,uploadFiles:()=>YQ,uploadFile:()=>GZ,updateInstance:()=>bw,untrack:()=>B8,unregisterDirective:()=>EH,unmountInstance:()=>Cw,unescapeHtml:()=>b6,transpileTypeScript:()=>X$,translate:()=>UZ,transitionDirective:()=>v6,toUsers:()=>Rz,toUser:()=>wz,thumbnail:()=>B9,thumbHashToRGBA:()=>X6,thumbHashToDataURL:()=>a9,templateCache:()=>U2,stxClientHelpers:()=>fJ,structuredDataDirective:()=>L3,stripLocalePrefix:()=>qQ,stripDocumentWrapper:()=>s$,stringToStream:()=>jM,strictCspPreset:()=>$W,streamingSuspenseDirective:()=>yq,streamToResponse:()=>aT,streamTemplateSimple:()=>nT,streamTemplate:()=>iT,stopHmrServer:()=>K7,stopBroadcasting:()=>Nz,state:()=>J8,startProductionServer:()=>tM,startInteractive:()=>hM,startBroadcasting:()=>Vz,staggerDirective:()=>YG,srcsetUrls:()=>k9,springDirective:()=>XG,splitByPipe:()=>D3,smartBatchSign:()=>P9,signUrl:()=>a8,shouldTranspileTypeScript:()=>Y$,shouldReloadOnChange:()=>g4,shouldRefreshSignature:()=>ZZ,shouldIgnoreFile:()=>h4,shouldCacheComponent:()=>vB,sharpen:()=>j9,setRouteParams:()=>ow,setMiddlewareState:()=>aw,setGlobalProvide:()=>_Z,setErrorLocale:()=>aG,setCurrentInstance:()=>Ow,setCachedVideoResult:()=>T5,setCachedImageResult:()=>w5,setCached:()=>F5,serveStxFile:()=>hz,serveMultipleStxFiles:()=>uz,serveMarkdownFile:()=>c8,serveFile:()=>mT,serveApp:()=>pz,serve:()=>Sq,serializeState:()=>cq,sepia:()=>O9,scrollAnimateDirective:()=>f6,screenReaderDirective:()=>P6,scopeHTML:()=>NK,scopeCSS:()=>VK,scanForSitemapEntries:()=>sL,scanA11yIssues:()=>jO,saturation:()=>N9,sanitizeParams:()=>C9,sanitizeFilePath:()=>qK,sanitizeExpression:()=>jK,sanitizeDirectiveParams:()=>HK,sanitizeDirectiveParam:()=>e7,sanitizeComponentProps:()=>tY,safeExecuteAsync:()=>M1,safeExecute:()=>BK,runPreProcessingMiddleware:()=>$2,runPostProcessingMiddleware:()=>Z2,runMiddleware:()=>k4,runHooks:()=>n$,rotate:()=>A9,resolveTemplatePath:()=>$4,resolveI18n:()=>z6,resize:()=>W9,resetPlaceholders:()=>vZ,resetHead:()=>BW,resetHMRHandler:()=>HE,resetErrorConfig:()=>QK,replacePlaceholders:()=>S6,renderView:()=>KQ,renderVideoComponent:()=>S5,renderToString:()=>$5,renderToStream:()=>cj,renderToDOM:()=>O7,renderThumbhashToCanvas:()=>o9,renderTemplate:()=>tE,renderString:()=>eE,renderSlot:()=>KJ,renderSSRSuspense:()=>NB,renderProtectedVideo:()=>d9,renderProtectedImg:()=>h9,renderMediaUpload:()=>y9,renderImgComponent:()=>W$,renderImageComponent:()=>AQ,renderHtmlAttrs:()=>jW,renderHead:()=>qW,renderEmail:()=>gE,renderComponentWithSlot:()=>D1,renderBodyAttrs:()=>HW,render:()=>NE,relaxedCspPreset:()=>ZW,registerValidationRule:()=>VV,registerStreamingDirectives:()=>rT,registerStore:()=>sw,registerSeoDirectives:()=>iL,registerMiddleware:()=>mw,registerFilters:()=>pQ,registerFilter:()=>gZ,registerErrorMessages:()=>eG,registerEnhancedValidationRule:()=>AV,registerDirective:()=>MQ,registerCspDirectives:()=>YV,registerComponentDirectives:()=>pR,registerAnimationDirectives:()=>bO,registerA11yDirectives:()=>LO,ref:()=>Vw,redirect:()=>wM,readMarkdownFile:()=>p1,readFileCached:()=>U_,reactive:()=>SU,quality:()=>T9,pruneSignatureCache:()=>f9,pruneCache:()=>VG,provide:()=>Ej,processVueTemplate:()=>J2,processVirtualListDirectives:()=>D8,processVirtualGridDirectives:()=>m2,processVideo:()=>G3,processValidateDirective:()=>RW,processTranslateDirective:()=>lX,processTransitionDirectives:()=>UB,processTransitionAttributes:()=>jB,processTitleDirective:()=>FW,processTemplateBindings:()=>HX,processTeleportDirectives:()=>XB,processSuspenseDirectives:()=>FB,processStructuredData:()=>$X,processStaticDirectives:()=>ZJ,processStackReplacements:()=>e3,processStackPushDirectives:()=>t3,processSlots:()=>WJ,processShell:()=>y8,processServerBindings:()=>$8,processSeoDirective:()=>ZX,processSectionDirectives:()=>oT,processScopedStyles:()=>U4,processReactiveBindings:()=>PK,processProtectedMedia:()=>u9,processPartialHydrationDirectives:()=>s2,processOnceDirective:()=>M8,processMiddleware:()=>eX,processMetaDirectives:()=>eY,processMetaDirective:()=>VW,processMarkdownFileDirectives:()=>RX,processMarkdownDirectives:()=>aZ,processLoops:()=>r3,processKeepAliveDirectives:()=>PB,processJsonDirective:()=>R8,processInfiniteListDirectives:()=>u2,processIncludes:()=>a3,processImgComponents:()=>bY,processImageComponents:()=>wQ,processImage:()=>h1,processHeadDirective:()=>LW,processForms:()=>FV,processFormInputDirectives:()=>d3,processExpressions:()=>q1,processEventDirectives:()=>NX,processErrorDirective:()=>u3,processDynamicComponents:()=>G2,processDirectives:()=>Z0,processDirectiveAttributes:()=>bH,processDeferDirectives:()=>$B,processCustomDirectives:()=>gX,processCspDirectives:()=>xX,processClientScript:()=>f$,processBasicFormDirectives:()=>p5,processAsyncDirectives:()=>IB,processAnimationDirectives:()=>lZ,processA11yDirectives:()=>pZ,preloadTranslationsBackground:()=>SV,preloadTranslations:()=>DW,preloadIslandHandlers:()=>GE,poolStrings:()=>jz,pluginManager:()=>WX,performLeave:()=>BB,performEnter:()=>_B,peek:()=>U8,partialsCache:()=>V$,parseVideoDirectiveOptions:()=>lG,parseUrl:()=>K9,parseThumbhashString:()=>t9,parseSwitchBlock:()=>S3,parseSlots:()=>GJ,parseSlotElement:()=>AU,parseScriptDeclarations:()=>aK,parseSFCComponent:()=>AK,parseProtectedArgs:()=>m9,parseImgComponent:()=>e6,parseImageUrl:()=>XY,parseImageComponent:()=>TZ,parseExpressionWithFilters:()=>rK,parseCookies:()=>VM,parseConditionalBlock:()=>EX,parseArguments:()=>IX,parseAnimationShorthand:()=>kO,optimizeTemplate:()=>Hz,optimizeImage:()=>SZ,optimizeDirectory:()=>bQ,onceStore:()=>aX,onUpdated:()=>Iw,onUnmounted:()=>kw,onServer:()=>ew,onMounted:()=>Tw,onMount:()=>W8,onHydrated:()=>$J,onErrorCaptured:()=>bj,onDestroy:()=>_8,onDeactivated:()=>dB,onClient:()=>tw,onBeforeUpdate:()=>Ew,onBeforeUnmount:()=>Dw,onBeforeMount:()=>Mw,onActivated:()=>hB,observeElement:()=>n9,notFound:()=>RM,nextTick:()=>Sj,navigateTo:()=>uw,mountInstance:()=>Sw,motionDirective:()=>h6,moderateCspPreset:()=>y3,minifyHtml:()=>qz,metaDirective:()=>O3,mergeParams:()=>r8,mergeCspDirectives:()=>$V,matchRoute:()=>P8,markdownDirectiveHandler:()=>tZ,markdownCache:()=>I3,localizePath:()=>y$,loadTranslationLazy:()=>W4,loadTranslation:()=>bW,loadStxConfig:()=>S0,loadMiddlewareFromDirectory:()=>D4,loadManifest:()=>IJ,loadElement:()=>a1,loadChannels:()=>Az,lazyLoadAll:()=>l9,lazyLoad:()=>c9,keyframeDirective:()=>ZG,jsxs:()=>uj,jsxDEV:()=>mj,jsx:()=>Y5,jsonResponse:()=>AM,islandDirective:()=>Pq,isTest:()=>gL,isSpaNavigation:()=>HJ,isSignatureValid:()=>e8,isSignal:()=>j4,isSharpAvailable:()=>g1,isServerEnvironment:()=>JM,isServer:()=>vU,isProduction:()=>YK,isNativeLazySupported:()=>YZ,isLoading:()=>DV,isLoaded:()=>kV,isJavaScriptScript:()=>EU,isIntersectionObserverSupported:()=>XZ,isImageFile:()=>M6,isICUFormat:()=>PW,isHydrated:()=>e2,isEdgeEnvironment:()=>XM,isDirectiveKind:()=>GH,isDevelopment:()=>_$,isDerived:()=>H4,isCssOnlyChange:()=>f4,isClient:()=>fU,isAsyncComponent:()=>kB,invert:()=>L9,invalidateFileCacheByDir:()=>q_,invalidateFileCache:()=>z_,interpolateScriptsInTemplate:()=>lQ,interpolateScriptExpressions:()=>dZ,inlineError:()=>$0,injectThemeBootstrap:()=>U6,injectSeoTags:()=>YX,injectSeo:()=>K6,injectRouterScript:()=>B6,injectHotReload:()=>y1,injectHeatmap:()=>sZ,injectCspMetaTag:()=>PX,injectCrosswindCSS:()=>V0,injectAnalytics:()=>FX,inject:()=>Ij,initStoreRegistry:()=>nw,initNetlify:()=>qH,initLoadingIndicator:()=>BE,initLazyLoading:()=>p9,initFile:()=>CM,initBlurUp:()=>JZ,initAllBlurUp:()=>$Q,imgDirective:()=>n7,imageDirective:()=>EQ,hydrateTemplate:()=>lJ,hydrateIslands:()=>QE,hydrateIsland:()=>o2,hydrateFragment:()=>rM,hydrateByStrategy:()=>a2,hydrateAll:()=>t2,hydrate:()=>FE,htmlResponse:()=>uT,heatmapDirective:()=>rZ,hashString:()=>i6,hashFilePath:()=>n5,hashFile:()=>v0,hashBuffer:()=>qG,hasVueTemplateSyntax:()=>Q_,hasVariables:()=>rX,hasStore:()=>$j,hasPlaceholders:()=>K5,hasNetlifyConfig:()=>N6,hasMiddleware:()=>dw,hasEventDirectives:()=>PF,hasDocumentShell:()=>B_,hasDirectives:()=>FU,hasDOMSupport:()=>sQ,handleError:()=>Cj,h:()=>sj,groupVariantsByFormat:()=>R7,grayscale:()=>H9,gitHash:()=>eM,getUnusedDirectives:()=>Wz,getTranslationSync:()=>kW,getTranslationCacheStats:()=>TV,getTranslationAsync:()=>bV,getTranslation:()=>m3,getTotalSize:()=>e1,getTimeUntilExpiry:()=>$Z,getStoreNames:()=>Zj,getStore:()=>Q9,getSourceLineInfo:()=>BJ,getScreenReaderOnlyStyle:()=>zO,getScopeAttribute:()=>JF,getRouteParams:()=>BR,getPublicEnvDefine:()=>K1,getPublicEnv:()=>xQ,getPositionInfo:()=>OU,getPlaceholderRegistry:()=>fZ,getPlaceholderCacheStats:()=>LY,getPageMeta:()=>v3,getNonce:()=>q$,getMimeType:()=>d1,getMiddlewareNames:()=>I4,getMiddleware:()=>hw,getLoadingState:()=>IV,getLoadingLocales:()=>yV,getImageMetadata:()=>R6,getHydrationRuntime:()=>sq,getHydratedStoreState:()=>rw,getHmrServer:()=>d4,getHead:()=>m5,getHMRHandler:()=>jE,getFormatExtension:()=>KY,getFileMtime:()=>c7,getFallbackVariant:()=>w7,getErrorMessage:()=>sY,getErrorLocale:()=>tG,getErrorConfig:()=>o7,getErrorCodeName:()=>_3,getDirectives:()=>TH,getDirective:()=>MH,getCurrentInstance:()=>Lw,getCspPreset:()=>eF,getCspHeaderName:()=>QW,getComponentCacheStats:()=>Hw,getCachedVideoResult:()=>M5,getCachedSignature:()=>x9,getCachedSignalsRuntime:()=>j_,getCachedRouterScript:()=>H_,getCachedPlaceholder:()=>p7,getCachedImageResult:()=>A5,getCached:()=>L5,getCacheStats:()=>FG,getBroadcastServer:()=>Fz,getBestVariant:()=>GY,getAllFilters:()=>hZ,generateWidthSrcset:()=>Q$,generateVirtualListCSS:()=>h2,generateVideoPreview:()=>JQ,generateValidationScript:()=>RV,generateUploadRuntime:()=>G6,generateTreeShakenBundle:()=>_z,generateTransitionRuntime:()=>qB,generateTransitionCSS:()=>zB,generateThumbnails:()=>I5,generateThumbhashPlaceholder:()=>BY,generateTemplatesDocs:()=>oz,generateSuspenseRuntime:()=>wB,generateSuspenseCSS:()=>AB,generateStateScript:()=>iq,generateSrcsetData:()=>JY,generateSrcset:()=>o6,generateSrcSet:()=>Q5,generateSpriteSheet:()=>J3,generateSpaShell:()=>cE,generateSourceTags:()=>QY,generateSizesFromBreakpoints:()=>ZY,generateSizesAttribute:()=>z5,generateSizes:()=>A7,generateSitemapIndex:()=>nL,generateSitemap:()=>W6,generateSimpleMediaPicker:()=>jj,generateSignatureRuntime:()=>Z6,generateSignalsRuntimeDev:()=>m$,generateSignalsRuntime:()=>O4,generateScopeId:()=>V3,generateSFCWebComponent:()=>wK,generateRouteTypes:()=>zR,generateRouteManifest:()=>UR,generateRobotsTxt:()=>FK,generateRobots:()=>_6,generateResponsiveVariants:()=>r6,generateReactiveWebComponentTS:()=>KF,generateReactiveWebComponent:()=>GF,generateReactiveRuntime:()=>_F,generateReactiveMixin:()=>WF,generatePoster:()=>E5,generatePlaceholderStyle:()=>HY,generatePlaceholderCSS:()=>m7,generatePlaceholder:()=>u7,generatePartialHydrationCSS:()=>r2,generateNonce:()=>CX,generateNetlifyToml:()=>LZ,generateMinifiedMediaRuntime:()=>Nj,generateMediaRuntime:()=>GQ,generateMediaManagerEmbed:()=>qj,generateManifest:()=>TJ,generateLoadingIndicatorHtml:()=>UE,generateLazyLoadRuntime:()=>Y6,generateLQIP:()=>zY,generateKeepAliveRuntime:()=>gB,generateKeepAliveCSS:()=>fB,generateIslandManifest:()=>YJ,generateImagePreview:()=>XQ,generateImageManifest:()=>bZ,generateHydrationScript:()=>LE,generateHydrationRuntime:()=>tT,generateHydrationCSS:()=>VE,generateHydrationBootstrap:()=>c2,generateHotReloadScript:()=>gz,generateHeatmapScript:()=>nZ,generateHMRClientScript:()=>zE,generateHLSManifest:()=>D5,generateEventBindings:()=>OE,generateDprSrcsetWithVariableQuality:()=>$Y,generateDprSrcset:()=>U5,generateDocumentShell:()=>__,generateDocs:()=>Zq,generateDirectivesDocs:()=>az,generateDirectiveRuntime:()=>SH,generateDefaultRobotsTxt:()=>rL,generateDASHManifest:()=>k5,generateCspMetaTag:()=>P3,generateCspHeader:()=>yX,generateCrosswindCSS:()=>R3,generateCompositionRuntime:()=>vj,generateComponentsDocs:()=>rz,generateComponentManifest:()=>PA,generateComponentDoc:()=>sz,generateColorPlaceholder:()=>jY,generateClientRuntime:()=>yw,generateCacheKey:()=>H5,generateBlurUpRuntime:()=>J6,generateBlurUpCSS:()=>Q6,generateBindingsRuntime:()=>xK,generateAutoWidthSrcset:()=>eZ,generateAsyncComponentRuntime:()=>bB,generateAsyncComponentCSS:()=>SB,generateAnimationRuntime:()=>SO,generateAnimationCSS:()=>DO,generateAnalyticsScript:()=>LX,formatTypeErrors:()=>JE,formatStxContent:()=>Bq,formatSize:()=>P$,formatRoutes:()=>LJ,formatMarkdownContent:()=>MM,formatLocalizedError:()=>ZK,formatICU:()=>CW,formatFilePath:()=>a7,formatError:()=>z3,formatDocsAsMarkdown:()=>tz,formatDocsAsJson:()=>$q,formatDocsAsHtml:()=>ez,format:()=>M9,foldConstants:()=>zz,flipVertical:()=>R9,flipHorizontal:()=>w9,fingerprint:()=>FJ,findMatchingEndTag:()=>z$,findMatchingDelimiter:()=>b0,findIfBlocks:()=>k3,findExpressions:()=>sK,findErrorPage:()=>OJ,findDirectiveBlocks:()=>J4,findDeadCode:()=>Bz,findDeadBranches:()=>Bz,findComponentFiles:()=>uJ,findCommonDir:()=>gJ,filterRequiredFiles:()=>F6,fileExists:()=>t,extractVariables:()=>R0,extractState:()=>nq,extractSlotContent:()=>RU,extractScriptFromTemplate:()=>sX,extractPlaceholders:()=>QO,extractParenthesizedExpression:()=>l1,extractDominantColor:()=>qY,extractDirectiveParams:()=>oK,extractDirectiveNames:()=>VU,extractContainerContent:()=>C4,extractComponentProps:()=>iz,extractComponentName:()=>l2,extractComponentDescription:()=>nz,extractClassNames:()=>w3,extractBoundProps:()=>i2,extractBalancedExpression:()=>TX,extractAndScopeStyles:()=>QF,extractAndProcessEvents:()=>uK,evaluateExpression:()=>Y1,evaluateConstant:()=>f8,evaluateAuthExpression:()=>c1,escapeHtml:()=>w0,errorRecovery:()=>q3,errorLogger:()=>u0,ensureTeleportTargets:()=>JB,ensureDocumentShell:()=>z4,enhancedValidationRules:()=>uX,eliminateDeadCode:()=>Uz,effect:()=>G8,dprUrls:()=>S9,docsCommand:()=>YM,disconnectObserver:()=>s9,devHelpers:()=>y5,detectShell:()=>jJ,detectRuntime:()=>B7,detectProjectConfig:()=>V7,detectFormat:()=>WY,detectBuildMode:()=>xR,derived:()=>Q8,deploy:()=>zH,defineStxConfig:()=>TK,defineStore:()=>Xj,defineSiteConfig:()=>FQ,definePlugin:()=>x5,definePageMeta:()=>UW,defineMiddleware:()=>gw,defineExpose:()=>kj,defineEmits:()=>Dj,defineDirective:()=>T0,defineCustomElement:()=>oj,defineConfig:()=>sM,defineClientDirective:()=>IH,defineAsyncComponent:()=>DB,defaultMediaConfig:()=>vE,defaultImageConfig:()=>hH,defaultI18nConfig:()=>p3,defaultHeatmapConfig:()=>KG,defaultFormClasses:()=>h3,defaultFilters:()=>W5,defaultCspConfig:()=>QV,defaultConfig:()=>a0,default:()=>SI,decodeThumbhash:()=>UY,cspNonceDirective:()=>JW,cspDirective:()=>XW,crossfadeTransition:()=>e9,crop:()=>_9,createVirtualList:()=>I8,createVideoDirective:()=>K3,createVercelHandler:()=>LM,createTypeChecker:()=>aJ,createTranslateFilter:()=>oV,createTextEncoderStream:()=>qM,createStxApp:()=>UQ,createStreamingResponse:()=>zM,createStreamRenderer:()=>sT,createStore:()=>G9,createStorageManager:()=>fw,createServerCookieManager:()=>vw,createScope:()=>kU,createSSRSuspense:()=>VB,createRouter:()=>n1,createRouteLocation:()=>E4,createRoute:()=>cT,createRef:()=>Vw,createReactive:()=>SU,createProvideContext:()=>xj,createProject:()=>YT,createProductionBuild:()=>nM,createPlaceholder:()=>k7,createOptimizedBuild:()=>fR,createNetlifyHandler:()=>FM,createNetlifyClient:()=>O6,createMiddlewareContext:()=>T4,createMiddleware:()=>pT,createLazyObserver:()=>i9,createKeepAliveCache:()=>xB,createKVNamespace:()=>Qq,createIslandRegistry:()=>n2,createImgDirective:()=>$3,createImagePlugin:()=>DQ,createImageDirective:()=>kZ,createHeatmapAggregator:()=>PO,createFileManifest:()=>L6,createEnvAccessor:()=>Jq,createEnhancedError:()=>_K,createEdgeHandler:()=>p4,createEdgeCache:()=>Gq,createDetailedErrorMessage:()=>U0,createDenoHandler:()=>OM,createDefaultNetlifyConfig:()=>N7,createCspHeaders:()=>JV,createCookie:()=>NM,createComputed:()=>Nw,createComponentInstance:()=>Fw,createCloudflareHandler:()=>HM,createClientCookieManager:()=>xw,createBuiltinDirectives:()=>kH,createApp:()=>UQ,createAnimationTimeline:()=>IO,cover:()=>z9,convertToCommonJS:()=>c3,contrast:()=>V9,contain:()=>U9,consoleError:()=>WK,configureErrorHandling:()=>JK,config:()=>t0,computed:()=>Nw,composeShellWithPage:()=>b4,componentDirective:()=>Sz,compileTemplate:()=>wJ,collectDeployFiles:()=>F7,clearVideoCache:()=>Y3,clearTranslationCache:()=>MV,clearSignatureCache:()=>v9,clearPlaceholderCache:()=>OY,clearOnceStore:()=>ON,clearNonce:()=>tF,clearMiddleware:()=>M4,clearImageCache:()=>DZ,clearErrorMessages:()=>$K,clearDevCaches:()=>O_,clearCustomFilters:()=>cQ,clearComponentCache:()=>M$,clearCache:()=>V5,classifyScript:()=>dU,classifyAllScripts:()=>UJ,checkTemplateFile:()=>YE,checkTemplate:()=>XE,checkCache:()=>j8,checkAuthAccess:()=>H7,checkA11y:()=>rQ,channel:()=>Ez,cancelPendingLoads:()=>PV,calculateSha1:()=>OZ,calculateOptimalWidths:()=>p6,cacheTemplate:()=>H8,buildWebComponents:()=>XX,buildViews:()=>Mj,buildUrl:()=>H0,buildStaticSite:()=>OQ,buildRuntimeAsset:()=>VJ,buildRouterAsset:()=>NJ,buildLangPickerScript:()=>H6,buildImageUrl:()=>j1,buildForProduction:()=>$z,buildAuthParams:()=>$6,buildApp:()=>yR,buildAlternateLinks:()=>j6,build:()=>iM,broadcastPrivate:()=>Mz,broadcastPresence:()=>Tz,broadcast:()=>bJ,brightness:()=>F9,blur:()=>q9,batchSignUrls:()=>t8,batch:()=>K8,autoFixA11yFile:()=>aQ,autoFixA11yDirectory:()=>OO,autoFixA11y:()=>oQ,auto:()=>E9,assetTags:()=>IR,applyTranslations:()=>q6,applyTransformations:()=>i7,applySlots:()=>MU,applyPropDefaults:()=>uR,applyPreset:()=>D9,applyHead:()=>OW,applyFilters:()=>uZ,apiCspPreset:()=>YW,animationGroupDirective:()=>g6,analyzeVideo:()=>s7,analyzeUsage:()=>kJ,analyzeTemplate:()=>hU,analyzeProject:()=>JR,analyzeDirectiveUsage:()=>kJ,analyticsDirective:()=>DF,addStore:()=>KT,addPage:()=>GT,addNonceToInlineContent:()=>ZV,addLayout:()=>WT,addComponent:()=>QT,abortNavigation:()=>Pw,a11yDirective:()=>y6,VideoProcessorCache:()=>R5,TransitionType:()=>tQ,TransitionEase:()=>$G,TransitionDirection:()=>eQ,Tokenizer:()=>X4,TemplateTypeChecker:()=>oJ,TEMPLATE_PRESETS:()=>bM,StxValidationError:()=>t7,StxSyntaxError:()=>rY,StxSecurityError:()=>oY,StxRuntimeError:()=>O1,StxFileError:()=>C5,StxError:()=>B$,Show:()=>lj,SPRING_PRESETS:()=>cZ,ProductionBuild:()=>i8,Portal:()=>nj,PROJECT_TEMPLATES:()=>ZT,PRESETS:()=>o8,MemorySessionStore:()=>aq,MIME_TYPES:()=>h7,MEDIA_DEFAULT_WIDTHS:()=>R1,MEDIA_DEFAULT_FORMATS:()=>m1,ImageProcessorCache:()=>N5,ImageProcessingError:()=>M7,HydrationRuntime:()=>J9,HotReloadServer:()=>vJ,HeatmapAggregator:()=>oZ,Fragment:()=>Z5,For:()=>ij,ErrorLogger:()=>j3,ErrorCodes:()=>o,DeployError:()=>$$,DEFAULT_WIDTHS:()=>B1,DEFAULT_TRANSITION_OPTIONS:()=>w1,DEFAULT_QUALITY:()=>z1,DEFAULT_PLACEHOLDER_OPTIONS:()=>l6,DEFAULT_FORMATS:()=>U1,DEFAULT_DPR_VALUES:()=>g7,ComponentHMRHandler:()=>Y9,COMMON_SIZES:()=>YY,BroadcastServer:()=>Dz,Broadcast:()=>Iz,BLUR_UP_CSS:()=>j5});var SI;var T$=D(()=>{AZ();CZ();q0();x$();Jj();X2();WQ();rj();aj();_X();E1();QH();bU();O$();b8();mX();x6();VX();d6();d5();y4();MX();Yz();AJ();Qz();Oz();g8();O8();bz();m0();vX();hX();AZ();lz();E7();Yq();Kq();X1();AX();d0();Uq();u6();iX();c5();Hq();Lq();o3();m6();Y2();b3();x8();S7();_1();Nq();DJ();wq();P4();kq();zJ();F3();bq();Z8();RJ();iJ();xq();fq();GX();p2();XJ();gq();uq();OX();I7();pq();rq();tq();CZ();Rj();Tj();L4();Q2();K2();ej();q0();_J();WH();SI={}});T$();export{V6 as writeNetlifyConfig,EJ as writeManifest,CQ as writeImageManifest,qE as wrapComponentForHMR,QX as webComponentDirectiveHandler,I9 as watermark,fE as watchViews,ww as watchMultiple,Rw as watchEffect,Aw as watch,cw as waitForStore,CV as waitForLocale,r7 as videoDirective,H3 as validators,MW as validateValueEnhanced,HU as validateTemplate,b9 as validateParams,wV as validateFormEnhanced,QZ as validateFile,NV as validateFields,wW as validateField,LU as validateDirective,XV as validateCspDirectives,EK as validateConfig,vR as validateComponentScripts,dR as validateComponentProps,T8 as validateClientScript,C7 as usesSignalsInScript,d2 as useVirtualList,zW as useTitle,pw as useStoreOrThrow,Yj as useStore,yj as useSlots,Q4 as useSeoMeta,yU as useRouteParams,lw as useRouteParamOrThrow,PU as useRouteParam,zW as usePageTitle,iw as useMiddlewareValue,xU as useMiddlewareState,dq as useLoadingIndicator,H$ as useHead,Pj as useAttrs,YQ as uploadFiles,GZ as uploadFile,bw as updateInstance,B8 as untrack,EH as unregisterDirective,Cw as unmountInstance,b6 as unescapeHtml,X$ as transpileTypeScript,UZ as translate,v6 as transitionDirective,Rz as toUsers,wz as toUser,B9 as thumbnail,X6 as thumbHashToRGBA,a9 as thumbHashToDataURL,U2 as templateCache,fJ as stxClientHelpers,L3 as structuredDataDirective,qQ as stripLocalePrefix,s$ as stripDocumentWrapper,jM as stringToStream,$W as strictCspPreset,yq as streamingSuspenseDirective,aT as streamToResponse,nT as streamTemplateSimple,iT as streamTemplate,K7 as stopHmrServer,Nz as stopBroadcasting,J8 as state,tM as startProductionServer,hM as startInteractive,Vz as startBroadcasting,YG as staggerDirective,k9 as srcsetUrls,XG as springDirective,D3 as splitByPipe,P9 as smartBatchSign,a8 as signUrl,Y$ as shouldTranspileTypeScript,g4 as shouldReloadOnChange,ZZ as shouldRefreshSignature,h4 as shouldIgnoreFile,vB as shouldCacheComponent,j9 as sharpen,ow as setRouteParams,aw as setMiddlewareState,_Z as setGlobalProvide,aG as setErrorLocale,Ow as setCurrentInstance,T5 as setCachedVideoResult,w5 as setCachedImageResult,F5 as setCached,hz as serveStxFile,uz as serveMultipleStxFiles,c8 as serveMarkdownFile,mT as serveFile,pz as serveApp,Sq as serve,cq as serializeState,O9 as sepia,f6 as scrollAnimateDirective,P6 as screenReaderDirective,NK as scopeHTML,VK as scopeCSS,sL as scanForSitemapEntries,jO as scanA11yIssues,N9 as saturation,C9 as sanitizeParams,qK as sanitizeFilePath,jK as sanitizeExpression,HK as sanitizeDirectiveParams,e7 as sanitizeDirectiveParam,tY as sanitizeComponentProps,M1 as safeExecuteAsync,BK as safeExecute,$2 as runPreProcessingMiddleware,Z2 as runPostProcessingMiddleware,k4 as runMiddleware,n$ as runHooks,A9 as rotate,$4 as resolveTemplatePath,z6 as resolveI18n,W9 as resize,vZ as resetPlaceholders,BW as resetHead,HE as resetHMRHandler,QK as resetErrorConfig,S6 as replacePlaceholders,KQ as renderView,S5 as renderVideoComponent,$5 as renderToString,cj as renderToStream,O7 as renderToDOM,o9 as renderThumbhashToCanvas,tE as renderTemplate,eE as renderString,KJ as renderSlot,NB as renderSSRSuspense,d9 as renderProtectedVideo,h9 as renderProtectedImg,y9 as renderMediaUpload,W$ as renderImgComponent,AQ as renderImageComponent,jW as renderHtmlAttrs,qW as renderHead,gE as renderEmail,D1 as renderComponentWithSlot,HW as renderBodyAttrs,NE as render,ZW as relaxedCspPreset,VV as registerValidationRule,rT as registerStreamingDirectives,sw as registerStore,iL as registerSeoDirectives,mw as registerMiddleware,pQ as registerFilters,gZ as registerFilter,eG as registerErrorMessages,AV as registerEnhancedValidationRule,MQ as registerDirective,YV as registerCspDirectives,pR as registerComponentDirectives,bO as registerAnimationDirectives,LO as registerA11yDirectives,Vw as ref,wM as redirect,p1 as readMarkdownFile,U_ as readFileCached,SU as reactive,T9 as quality,f9 as pruneSignatureCache,VG as pruneCache,Ej as provide,J2 as processVueTemplate,D8 as processVirtualListDirectives,m2 as processVirtualGridDirectives,G3 as processVideo,RW as processValidateDirective,lX as processTranslateDirective,UB as processTransitionDirectives,jB as processTransitionAttributes,FW as processTitleDirective,HX as processTemplateBindings,XB as processTeleportDirectives,FB as processSuspenseDirectives,$X as processStructuredData,ZJ as processStaticDirectives,e3 as processStackReplacements,t3 as processStackPushDirectives,WJ as processSlots,y8 as processShell,$8 as processServerBindings,ZX as processSeoDirective,oT as processSectionDirectives,U4 as processScopedStyles,PK as processReactiveBindings,u9 as processProtectedMedia,s2 as processPartialHydrationDirectives,M8 as processOnceDirective,eX as processMiddleware,eY as processMetaDirectives,VW as processMetaDirective,RX as processMarkdownFileDirectives,aZ as processMarkdownDirectives,r3 as processLoops,PB as processKeepAliveDirectives,R8 as processJsonDirective,u2 as processInfiniteListDirectives,a3 as processIncludes,bY as processImgComponents,wQ as processImageComponents,h1 as processImage,LW as processHeadDirective,FV as processForms,d3 as processFormInputDirectives,q1 as processExpressions,NX as processEventDirectives,u3 as processErrorDirective,G2 as processDynamicComponents,Z0 as processDirectives,bH as processDirectiveAttributes,$B as processDeferDirectives,gX as processCustomDirectives,xX as processCspDirectives,f$ as processClientScript,p5 as processBasicFormDirectives,IB as processAsyncDirectives,lZ as processAnimationDirectives,pZ as processA11yDirectives,SV as preloadTranslationsBackground,DW as preloadTranslations,GE as preloadIslandHandlers,jz as poolStrings,WX as pluginManager,BB as performLeave,_B as performEnter,U8 as peek,V$ as partialsCache,lG as parseVideoDirectiveOptions,K9 as parseUrl,t9 as parseThumbhashString,S3 as parseSwitchBlock,GJ as parseSlots,AU as parseSlotElement,aK as parseScriptDeclarations,AK as parseSFCComponent,m9 as parseProtectedArgs,e6 as parseImgComponent,XY as parseImageUrl,TZ as parseImageComponent,rK as parseExpressionWithFilters,VM as parseCookies,EX as parseConditionalBlock,IX as parseArguments,kO as parseAnimationShorthand,Hz as optimizeTemplate,SZ as optimizeImage,bQ as optimizeDirectory,aX as onceStore,Iw as onUpdated,kw as onUnmounted,ew as onServer,Tw as onMounted,W8 as onMount,$J as onHydrated,bj as onErrorCaptured,_8 as onDestroy,dB as onDeactivated,tw as onClient,Ew as onBeforeUpdate,Dw as onBeforeUnmount,Mw as onBeforeMount,hB as onActivated,n9 as observeElement,RM as notFound,Sj as nextTick,uw as navigateTo,Sw as mountInstance,h6 as motionDirective,y3 as moderateCspPreset,qz as minifyHtml,O3 as metaDirective,r8 as mergeParams,$V as mergeCspDirectives,P8 as matchRoute,tZ as markdownDirectiveHandler,I3 as markdownCache,y$ as localizePath,W4 as loadTranslationLazy,bW as loadTranslation,S0 as loadStxConfig,D4 as loadMiddlewareFromDirectory,IJ as loadManifest,a1 as loadElement,Az as loadChannels,l9 as lazyLoadAll,c9 as lazyLoad,ZG as keyframeDirective,uj as jsxs,mj as jsxDEV,Y5 as jsx,AM as jsonResponse,Pq as islandDirective,gL as isTest,HJ as isSpaNavigation,e8 as isSignatureValid,j4 as isSignal,g1 as isSharpAvailable,JM as isServerEnvironment,vU as isServer,YK as isProduction,YZ as isNativeLazySupported,DV as isLoading,kV as isLoaded,EU as isJavaScriptScript,XZ as isIntersectionObserverSupported,M6 as isImageFile,PW as isICUFormat,e2 as isHydrated,XM as isEdgeEnvironment,GH as isDirectiveKind,_$ as isDevelopment,H4 as isDerived,f4 as isCssOnlyChange,fU as isClient,kB as isAsyncComponent,L9 as invert,q_ as invalidateFileCacheByDir,z_ as invalidateFileCache,lQ as interpolateScriptsInTemplate,dZ as interpolateScriptExpressions,$0 as inlineError,U6 as injectThemeBootstrap,YX as injectSeoTags,K6 as injectSeo,B6 as injectRouterScript,y1 as injectHotReload,sZ as injectHeatmap,PX as injectCspMetaTag,V0 as injectCrosswindCSS,FX as injectAnalytics,Ij as inject,nw as initStoreRegistry,qH as initNetlify,BE as initLoadingIndicator,p9 as initLazyLoading,CM as initFile,JZ as initBlurUp,$Q as initAllBlurUp,n7 as imgDirective,EQ as imageDirective,lJ as hydrateTemplate,QE as hydrateIslands,o2 as hydrateIsland,rM as hydrateFragment,a2 as hydrateByStrategy,t2 as hydrateAll,FE as hydrate,uT as htmlResponse,rZ as heatmapDirective,i6 as hashString,n5 as hashFilePath,v0 as hashFile,qG as hashBuffer,Q_ as hasVueTemplateSyntax,rX as hasVariables,$j as hasStore,K5 as hasPlaceholders,N6 as hasNetlifyConfig,dw as hasMiddleware,PF as hasEventDirectives,B_ as hasDocumentShell,FU as hasDirectives,sQ as hasDOMSupport,Cj as handleError,sj as h,R7 as groupVariantsByFormat,H9 as grayscale,eM as gitHash,Wz as getUnusedDirectives,kW as getTranslationSync,TV as getTranslationCacheStats,bV as getTranslationAsync,m3 as getTranslation,e1 as getTotalSize,$Z as getTimeUntilExpiry,Zj as getStoreNames,Q9 as getStore,BJ as getSourceLineInfo,zO as getScreenReaderOnlyStyle,JF as getScopeAttribute,BR as getRouteParams,K1 as getPublicEnvDefine,xQ as getPublicEnv,OU as getPositionInfo,fZ as getPlaceholderRegistry,LY as getPlaceholderCacheStats,v3 as getPageMeta,q$ as getNonce,d1 as getMimeType,I4 as getMiddlewareNames,hw as getMiddleware,IV as getLoadingState,yV as getLoadingLocales,R6 as getImageMetadata,sq as getHydrationRuntime,rw as getHydratedStoreState,d4 as getHmrServer,m5 as getHead,jE as getHMRHandler,KY as getFormatExtension,c7 as getFileMtime,w7 as getFallbackVariant,sY as getErrorMessage,tG as getErrorLocale,o7 as getErrorConfig,_3 as getErrorCodeName,TH as getDirectives,MH as getDirective,Lw as getCurrentInstance,eF as getCspPreset,QW as getCspHeaderName,Hw as getComponentCacheStats,M5 as getCachedVideoResult,x9 as getCachedSignature,j_ as getCachedSignalsRuntime,H_ as getCachedRouterScript,p7 as getCachedPlaceholder,A5 as getCachedImageResult,L5 as getCached,FG as getCacheStats,Fz as getBroadcastServer,GY as getBestVariant,hZ as getAllFilters,Q$ as generateWidthSrcset,h2 as generateVirtualListCSS,JQ as generateVideoPreview,RV as generateValidationScript,G6 as generateUploadRuntime,_z as generateTreeShakenBundle,qB as generateTransitionRuntime,zB as generateTransitionCSS,I5 as generateThumbnails,BY as generateThumbhashPlaceholder,oz as generateTemplatesDocs,wB as generateSuspenseRuntime,AB as generateSuspenseCSS,iq as generateStateScript,JY as generateSrcsetData,o6 as generateSrcset,Q5 as generateSrcSet,J3 as generateSpriteSheet,cE as generateSpaShell,QY as generateSourceTags,ZY as generateSizesFromBreakpoints,z5 as generateSizesAttribute,A7 as generateSizes,nL as generateSitemapIndex,W6 as generateSitemap,jj as generateSimpleMediaPicker,Z6 as generateSignatureRuntime,m$ as generateSignalsRuntimeDev,O4 as generateSignalsRuntime,V3 as generateScopeId,wK as generateSFCWebComponent,zR as generateRouteTypes,UR as generateRouteManifest,FK as generateRobotsTxt,_6 as generateRobots,r6 as generateResponsiveVariants,KF as generateReactiveWebComponentTS,GF as generateReactiveWebComponent,_F as generateReactiveRuntime,WF as generateReactiveMixin,E5 as generatePoster,HY as generatePlaceholderStyle,m7 as generatePlaceholderCSS,u7 as generatePlaceholder,r2 as generatePartialHydrationCSS,CX as generateNonce,LZ as generateNetlifyToml,Nj as generateMinifiedMediaRuntime,GQ as generateMediaRuntime,qj as generateMediaManagerEmbed,TJ as generateManifest,UE as generateLoadingIndicatorHtml,Y6 as generateLazyLoadRuntime,zY as generateLQIP,gB as generateKeepAliveRuntime,fB as generateKeepAliveCSS,YJ as generateIslandManifest,XQ as generateImagePreview,bZ as generateImageManifest,LE as generateHydrationScript,tT as generateHydrationRuntime,VE as generateHydrationCSS,c2 as generateHydrationBootstrap,gz as generateHotReloadScript,nZ as generateHeatmapScript,zE as generateHMRClientScript,D5 as generateHLSManifest,OE as generateEventBindings,$Y as generateDprSrcsetWithVariableQuality,U5 as generateDprSrcset,__ as generateDocumentShell,Zq as generateDocs,az as generateDirectivesDocs,SH as generateDirectiveRuntime,rL as generateDefaultRobotsTxt,k5 as generateDASHManifest,P3 as generateCspMetaTag,yX as generateCspHeader,R3 as generateCrosswindCSS,vj as generateCompositionRuntime,rz as generateComponentsDocs,PA as generateComponentManifest,sz as generateComponentDoc,jY as generateColorPlaceholder,yw as generateClientRuntime,H5 as generateCacheKey,J6 as generateBlurUpRuntime,Q6 as generateBlurUpCSS,xK as generateBindingsRuntime,eZ as generateAutoWidthSrcset,bB as generateAsyncComponentRuntime,SB as generateAsyncComponentCSS,SO as generateAnimationRuntime,DO as generateAnimationCSS,LX as generateAnalyticsScript,JE as formatTypeErrors,Bq as formatStxContent,P$ as formatSize,LJ as formatRoutes,MM as formatMarkdownContent,ZK as formatLocalizedError,CW as formatICU,a7 as formatFilePath,z3 as formatError,tz as formatDocsAsMarkdown,$q as formatDocsAsJson,ez as formatDocsAsHtml,M9 as format,zz as foldConstants,R9 as flipVertical,w9 as flipHorizontal,FJ as fingerprint,z$ as findMatchingEndTag,b0 as findMatchingDelimiter,k3 as findIfBlocks,sK as findExpressions,OJ as findErrorPage,J4 as findDirectiveBlocks,Bz as findDeadCode,Bz as findDeadBranches,uJ as findComponentFiles,gJ as findCommonDir,F6 as filterRequiredFiles,t as fileExists,R0 as extractVariables,nq as extractState,RU as extractSlotContent,sX as extractScriptFromTemplate,QO as extractPlaceholders,l1 as extractParenthesizedExpression,qY as extractDominantColor,oK as extractDirectiveParams,VU as extractDirectiveNames,C4 as extractContainerContent,iz as extractComponentProps,l2 as extractComponentName,nz as extractComponentDescription,w3 as extractClassNames,i2 as extractBoundProps,TX as extractBalancedExpression,QF as extractAndScopeStyles,uK as extractAndProcessEvents,Y1 as evaluateExpression,f8 as evaluateConstant,c1 as evaluateAuthExpression,w0 as escapeHtml,q3 as errorRecovery,u0 as errorLogger,JB as ensureTeleportTargets,z4 as ensureDocumentShell,uX as enhancedValidationRules,Uz as eliminateDeadCode,G8 as effect,S9 as dprUrls,YM as docsCommand,s9 as disconnectObserver,y5 as devHelpers,jJ as detectShell,B7 as detectRuntime,V7 as detectProjectConfig,WY as detectFormat,xR as detectBuildMode,Q8 as derived,zH as deploy,TK as defineStxConfig,Xj as defineStore,FQ as defineSiteConfig,x5 as definePlugin,UW as definePageMeta,gw as defineMiddleware,kj as defineExpose,Dj as defineEmits,T0 as defineDirective,oj as defineCustomElement,sM as defineConfig,IH as defineClientDirective,DB as defineAsyncComponent,vE as defaultMediaConfig,hH as defaultImageConfig,p3 as defaultI18nConfig,KG as defaultHeatmapConfig,h3 as defaultFormClasses,W5 as defaultFilters,QV as defaultCspConfig,a0 as defaultConfig,SI as default,UY as decodeThumbhash,JW as cspNonceDirective,XW as cspDirective,e9 as crossfadeTransition,_9 as crop,I8 as createVirtualList,K3 as createVideoDirective,LM as createVercelHandler,aJ as createTypeChecker,oV as createTranslateFilter,qM as createTextEncoderStream,UQ as createStxApp,zM as createStreamingResponse,sT as createStreamRenderer,G9 as createStore,fw as createStorageManager,vw as createServerCookieManager,kU as createScope,VB as createSSRSuspense,n1 as createRouter,E4 as createRouteLocation,cT as createRoute,Vw as createRef,SU as createReactive,xj as createProvideContext,YT as createProject,nM as createProductionBuild,k7 as createPlaceholder,fR as createOptimizedBuild,FM as createNetlifyHandler,O6 as createNetlifyClient,T4 as createMiddlewareContext,pT as createMiddleware,i9 as createLazyObserver,xB as createKeepAliveCache,Qq as createKVNamespace,n2 as createIslandRegistry,$3 as createImgDirective,DQ as createImagePlugin,kZ as createImageDirective,PO as createHeatmapAggregator,L6 as createFileManifest,Jq as createEnvAccessor,_K as createEnhancedError,p4 as createEdgeHandler,Gq as createEdgeCache,U0 as createDetailedErrorMessage,OM as createDenoHandler,N7 as createDefaultNetlifyConfig,JV as createCspHeaders,NM as createCookie,Nw as createComputed,Fw as createComponentInstance,HM as createCloudflareHandler,xw as createClientCookieManager,kH as createBuiltinDirectives,UQ as createApp,IO as createAnimationTimeline,z9 as cover,c3 as convertToCommonJS,V9 as contrast,U9 as contain,WK as consoleError,JK as configureErrorHandling,t0 as config,Nw as computed,b4 as composeShellWithPage,Sz as componentDirective,wJ as compileTemplate,F7 as collectDeployFiles,Y3 as clearVideoCache,MV as clearTranslationCache,v9 as clearSignatureCache,OY as clearPlaceholderCache,ON as clearOnceStore,tF as clearNonce,M4 as clearMiddleware,DZ as clearImageCache,$K as clearErrorMessages,O_ as clearDevCaches,cQ as clearCustomFilters,M$ as clearComponentCache,V5 as clearCache,dU as classifyScript,UJ as classifyAllScripts,YE as checkTemplateFile,XE as checkTemplate,j8 as checkCache,H7 as checkAuthAccess,rQ as checkA11y,Ez as channel,PV as cancelPendingLoads,OZ as calculateSha1,p6 as calculateOptimalWidths,H8 as cacheTemplate,XX as buildWebComponents,Mj as buildViews,H0 as buildUrl,OQ as buildStaticSite,VJ as buildRuntimeAsset,NJ as buildRouterAsset,H6 as buildLangPickerScript,j1 as buildImageUrl,$z as buildForProduction,$6 as buildAuthParams,yR as buildApp,j6 as buildAlternateLinks,iM as build,Mz as broadcastPrivate,Tz as broadcastPresence,bJ as broadcast,F9 as brightness,q9 as blur,t8 as batchSignUrls,K8 as batch,aQ as autoFixA11yFile,OO as autoFixA11yDirectory,oQ as autoFixA11y,E9 as auto,IR as assetTags,q6 as applyTranslations,i7 as applyTransformations,MU as applySlots,uR as applyPropDefaults,D9 as applyPreset,OW as applyHead,uZ as applyFilters,YW as apiCspPreset,g6 as animationGroupDirective,s7 as analyzeVideo,kJ as analyzeUsage,hU as analyzeTemplate,JR as analyzeProject,kJ as analyzeDirectiveUsage,DF as analyticsDirective,KT as addStore,GT as addPage,ZV as addNonceToInlineContent,WT as addLayout,QT as addComponent,Pw as abortNavigation,y6 as a11yDirective,R5 as VideoProcessorCache,tQ as TransitionType,$G as TransitionEase,eQ as TransitionDirection,X4 as Tokenizer,oJ as TemplateTypeChecker,bM as TEMPLATE_PRESETS,t7 as StxValidationError,rY as StxSyntaxError,oY as StxSecurityError,O1 as StxRuntimeError,C5 as StxFileError,B$ as StxError,lj as Show,cZ as SPRING_PRESETS,i8 as ProductionBuild,nj as Portal,ZT as PROJECT_TEMPLATES,o8 as PRESETS,aq as MemorySessionStore,h7 as MIME_TYPES,R1 as MEDIA_DEFAULT_WIDTHS,m1 as MEDIA_DEFAULT_FORMATS,N5 as ImageProcessorCache,M7 as ImageProcessingError,J9 as HydrationRuntime,vJ as HotReloadServer,oZ as HeatmapAggregator,Z5 as Fragment,ij as For,j3 as ErrorLogger,o as ErrorCodes,$$ as DeployError,B1 as DEFAULT_WIDTHS,w1 as DEFAULT_TRANSITION_OPTIONS,z1 as DEFAULT_QUALITY,l6 as DEFAULT_PLACEHOLDER_OPTIONS,U1 as DEFAULT_FORMATS,g7 as DEFAULT_DPR_VALUES,Y9 as ComponentHMRHandler,YY as COMMON_SIZES,Dz as BroadcastServer,Iz as Broadcast,j5 as BLUR_UP_CSS};
15045
+ ${J.slice(K)}`;return`${$.slice(0,X)}${U}${$.slice(Y)}`}function kI($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function FQ($){return $}var JH=D(()=>{E1();qQ()});var QH=D(()=>{JH();qQ()});function GH($,Z){return $.kind===Z}var KH=()=>{};var WH=D(()=>{KH()});var r$={};Q0(r$,{writeNetlifyConfig:()=>V6,writeManifest:()=>T2,writeImageManifest:()=>CQ,wrapComponentForHMR:()=>qE,webComponentDirectiveHandler:()=>JX,watermark:()=>E9,watchViews:()=>fE,watchMultiple:()=>ww,watchEffect:()=>Rw,watch:()=>Aw,waitForStore:()=>cw,waitForLocale:()=>CV,videoDirective:()=>r7,validators:()=>H3,validateValueEnhanced:()=>MW,validateTemplate:()=>HU,validateParams:()=>S9,validateFormEnhanced:()=>wV,validateFile:()=>QZ,validateFields:()=>NV,validateField:()=>wW,validateDirective:()=>LU,validateCspDirectives:()=>XV,validateConfig:()=>EK,validateComponentScripts:()=>vR,validateComponentProps:()=>dR,validateClientScript:()=>T8,usesSignalsInScript:()=>C7,useVirtualList:()=>hJ,useTitle:()=>zW,useStoreOrThrow:()=>pw,useStore:()=>Yj,useSlots:()=>yj,useSeoMeta:()=>Q4,useRouteParams:()=>yU,useRouteParamOrThrow:()=>lw,useRouteParam:()=>PU,usePageTitle:()=>zW,useMiddlewareValue:()=>iw,useMiddlewareState:()=>xU,useLoadingIndicator:()=>dq,useHead:()=>O$,useAttrs:()=>Pj,uploadFiles:()=>ZQ,uploadFile:()=>GZ,updateInstance:()=>bw,untrack:()=>B8,unregisterDirective:()=>EH,unmountInstance:()=>Cw,unescapeHtml:()=>b6,transpileTypeScript:()=>J$,translate:()=>UZ,transitionDirective:()=>v6,toUsers:()=>Rz,toUser:()=>wz,thumbnail:()=>_9,thumbHashToRGBA:()=>X6,thumbHashToDataURL:()=>o9,templateCache:()=>BJ,stxClientHelpers:()=>v2,structuredDataDirective:()=>L3,stripLocalePrefix:()=>zQ,stripDocumentWrapper:()=>s$,stringToStream:()=>jM,strictCspPreset:()=>$W,streamingSuspenseDirective:()=>yq,streamToResponse:()=>aT,streamTemplateSimple:()=>nT,streamTemplate:()=>iT,stopHmrServer:()=>K7,stopBroadcasting:()=>Nz,state:()=>J8,startProductionServer:()=>tM,startInteractive:()=>hM,startBroadcasting:()=>Vz,staggerDirective:()=>YG,srcsetUrls:()=>D9,springDirective:()=>XG,splitByPipe:()=>D3,smartBatchSign:()=>y9,signUrl:()=>a8,shouldTranspileTypeScript:()=>X$,shouldReloadOnChange:()=>g4,shouldRefreshSignature:()=>ZZ,shouldIgnoreFile:()=>h4,shouldCacheComponent:()=>vB,sharpen:()=>q9,setRouteParams:()=>ow,setMiddlewareState:()=>aw,setGlobalProvide:()=>_Z,setErrorLocale:()=>aG,setCurrentInstance:()=>Ow,setCachedVideoResult:()=>T5,setCachedImageResult:()=>w5,setCached:()=>F5,serveStxFile:()=>hz,serveMultipleStxFiles:()=>uz,serveMarkdownFile:()=>c8,serveFile:()=>mT,serveApp:()=>pz,serve:()=>Sq,serializeState:()=>cq,sepia:()=>H9,scrollAnimateDirective:()=>f6,screenReaderDirective:()=>P6,scopeHTML:()=>NK,scopeCSS:()=>VK,scanForSitemapEntries:()=>sL,scanA11yIssues:()=>jO,saturation:()=>V9,sanitizeParams:()=>b9,sanitizeFilePath:()=>qK,sanitizeExpression:()=>jK,sanitizeDirectiveParams:()=>HK,sanitizeDirectiveParam:()=>e7,sanitizeComponentProps:()=>aY,safeExecuteAsync:()=>M1,safeExecute:()=>BK,runPreProcessingMiddleware:()=>eX,runPostProcessingMiddleware:()=>$J,runMiddleware:()=>k4,runHooks:()=>n$,rotate:()=>N9,resolveTemplatePath:()=>$4,resolveI18n:()=>z6,resize:()=>K9,resetPlaceholders:()=>xZ,resetHead:()=>BW,resetHMRHandler:()=>HE,resetErrorConfig:()=>QK,replacePlaceholders:()=>S6,renderView:()=>GQ,renderVideoComponent:()=>S5,renderToString:()=>$5,renderToStream:()=>cj,renderToDOM:()=>O7,renderThumbhashToCanvas:()=>r9,renderTemplate:()=>tE,renderString:()=>eE,renderSlot:()=>G2,renderSSRSuspense:()=>NB,renderProtectedVideo:()=>h9,renderProtectedImg:()=>g9,renderMediaUpload:()=>C9,renderImgComponent:()=>_$,renderImageComponent:()=>AQ,renderHtmlAttrs:()=>jW,renderHead:()=>qW,renderEmail:()=>gE,renderComponentWithSlot:()=>D1,renderBodyAttrs:()=>HW,render:()=>NE,relaxedCspPreset:()=>ZW,registerValidationRule:()=>VV,registerStreamingDirectives:()=>rT,registerStore:()=>sw,registerSeoDirectives:()=>iL,registerMiddleware:()=>mw,registerFilters:()=>pQ,registerFilter:()=>fZ,registerErrorMessages:()=>eG,registerEnhancedValidationRule:()=>AV,registerDirective:()=>MQ,registerCspDirectives:()=>YV,registerComponentDirectives:()=>pR,registerAnimationDirectives:()=>bO,registerA11yDirectives:()=>LO,ref:()=>Vw,redirect:()=>wM,readMarkdownFile:()=>p1,readFileCached:()=>U_,reactive:()=>SU,quality:()=>M9,pruneSignatureCache:()=>v9,pruneCache:()=>VG,provide:()=>Ej,processVueTemplate:()=>XJ,processVirtualListDirectives:()=>D8,processVirtualGridDirectives:()=>uJ,processVideo:()=>G3,processValidateDirective:()=>RW,processTranslateDirective:()=>cX,processTransitionDirectives:()=>UB,processTransitionAttributes:()=>jB,processTitleDirective:()=>FW,processTemplateBindings:()=>jX,processTeleportDirectives:()=>XB,processSuspenseDirectives:()=>FB,processStructuredData:()=>eY,processStaticDirectives:()=>$2,processStackReplacements:()=>e3,processStackPushDirectives:()=>t3,processSlots:()=>K2,processShell:()=>y8,processServerBindings:()=>$8,processSeoDirective:()=>$X,processSectionDirectives:()=>oT,processScopedStyles:()=>U4,processReactiveBindings:()=>PK,processProtectedMedia:()=>d9,processPartialHydrationDirectives:()=>nJ,processOnceDirective:()=>M8,processMiddleware:()=>tX,processMetaDirectives:()=>tY,processMetaDirective:()=>VW,processMarkdownFileDirectives:()=>wX,processMarkdownDirectives:()=>oZ,processLoops:()=>r3,processKeepAliveDirectives:()=>PB,processJsonDirective:()=>R8,processInfiniteListDirectives:()=>dJ,processIncludes:()=>a3,processImgComponents:()=>SY,processImageComponents:()=>wQ,processImage:()=>h1,processHeadDirective:()=>LW,processForms:()=>FV,processFormInputDirectives:()=>d3,processExpressions:()=>q1,processEventDirectives:()=>VX,processErrorDirective:()=>u3,processDynamicComponents:()=>QJ,processDirectives:()=>Z0,processDirectiveAttributes:()=>bH,processDeferDirectives:()=>$B,processCustomDirectives:()=>fX,processCspDirectives:()=>PX,processClientScript:()=>f$,processBasicFormDirectives:()=>p5,processAsyncDirectives:()=>IB,processAnimationDirectives:()=>cZ,processA11yDirectives:()=>mZ,preloadTranslationsBackground:()=>SV,preloadTranslations:()=>DW,preloadIslandHandlers:()=>GE,poolStrings:()=>jz,pluginManager:()=>KX,performLeave:()=>BB,performEnter:()=>_B,peek:()=>U8,partialsCache:()=>N$,parseVideoDirectiveOptions:()=>lG,parseUrl:()=>G9,parseThumbhashString:()=>a9,parseSwitchBlock:()=>S3,parseSlots:()=>Q2,parseSlotElement:()=>AU,parseScriptDeclarations:()=>aK,parseSFCComponent:()=>AK,parseProtectedArgs:()=>u9,parseImgComponent:()=>e6,parseImageUrl:()=>YY,parseImageComponent:()=>MZ,parseExpressionWithFilters:()=>rK,parseCookies:()=>VM,parseConditionalBlock:()=>TX,parseArguments:()=>EX,parseAnimationShorthand:()=>kO,optimizeTemplate:()=>Hz,optimizeImage:()=>kZ,optimizeDirectory:()=>bQ,onceStore:()=>oX,onUpdated:()=>Iw,onUnmounted:()=>kw,onServer:()=>ew,onMounted:()=>Tw,onMount:()=>W8,onHydrated:()=>eJ,onErrorCaptured:()=>bj,onDestroy:()=>_8,onDeactivated:()=>dB,onClient:()=>tw,onBeforeUpdate:()=>Ew,onBeforeUnmount:()=>Dw,onBeforeMount:()=>Mw,onActivated:()=>hB,observeElement:()=>i9,notFound:()=>RM,nextTick:()=>Sj,navigateTo:()=>uw,mountInstance:()=>Sw,motionDirective:()=>h6,moderateCspPreset:()=>y3,minifyHtml:()=>qz,metaDirective:()=>O3,mergeParams:()=>r8,mergeCspDirectives:()=>$V,matchRoute:()=>P8,markdownDirectiveHandler:()=>aZ,markdownCache:()=>I3,localizePath:()=>t1,loadTranslationLazy:()=>W4,loadTranslation:()=>bW,loadStxConfig:()=>S0,loadMiddlewareFromDirectory:()=>D4,loadManifest:()=>E2,loadElement:()=>a1,loadChannels:()=>Az,lazyLoadAll:()=>c9,lazyLoad:()=>p9,keyframeDirective:()=>ZG,jsxs:()=>uj,jsxDEV:()=>mj,jsx:()=>Y5,jsonResponse:()=>AM,islandDirective:()=>Pq,isTest:()=>gL,isSpaNavigation:()=>j2,isSignatureValid:()=>e8,isSignal:()=>j4,isSharpAvailable:()=>g1,isServerEnvironment:()=>JM,isServer:()=>vU,isProduction:()=>YK,isNativeLazySupported:()=>YZ,isLoading:()=>DV,isLoaded:()=>kV,isJavaScriptScript:()=>EU,isIntersectionObserverSupported:()=>XZ,isImageFile:()=>M6,isICUFormat:()=>PW,isHydrated:()=>tJ,isEdgeEnvironment:()=>XM,isDirectiveKind:()=>GH,isDevelopment:()=>B$,isDerived:()=>H4,isCssOnlyChange:()=>f4,isClient:()=>fU,isAsyncComponent:()=>kB,invert:()=>O9,invalidateFileCacheByDir:()=>q_,invalidateFileCache:()=>z_,interpolateScriptsInTemplate:()=>lQ,interpolateScriptExpressions:()=>hZ,inlineError:()=>$0,injectThemeBootstrap:()=>U6,injectSeoTags:()=>ZX,injectSeo:()=>K6,injectRouterScript:()=>B6,injectHotReload:()=>y1,injectHeatmap:()=>nZ,injectCspMetaTag:()=>yX,injectCrosswindCSS:()=>V0,injectAnalytics:()=>LX,inject:()=>Ij,initStoreRegistry:()=>nw,initNetlify:()=>qH,initLoadingIndicator:()=>BE,initLazyLoading:()=>m9,initFile:()=>CM,initBlurUp:()=>JZ,initAllBlurUp:()=>e9,imgDirective:()=>n7,imageDirective:()=>EQ,hydrateTemplate:()=>c2,hydrateIslands:()=>QE,hydrateIsland:()=>rJ,hydrateFragment:()=>rM,hydrateByStrategy:()=>oJ,hydrateAll:()=>aJ,hydrate:()=>FE,htmlResponse:()=>uT,heatmapDirective:()=>sZ,hashString:()=>i6,hashFilePath:()=>n5,hashFile:()=>v0,hashBuffer:()=>qG,hasVueTemplateSyntax:()=>Q_,hasVariables:()=>sX,hasStore:()=>$j,hasPlaceholders:()=>K5,hasNetlifyConfig:()=>N6,hasMiddleware:()=>dw,hasEventDirectives:()=>PF,hasDocumentShell:()=>B_,hasDirectives:()=>FU,hasDOMSupport:()=>sQ,handleError:()=>Cj,h:()=>sj,groupVariantsByFormat:()=>R7,grayscale:()=>j9,gitHash:()=>eM,getUnusedDirectives:()=>Wz,getTranslationSync:()=>kW,getTranslationCacheStats:()=>TV,getTranslationAsync:()=>bV,getTranslation:()=>m3,getTotalSize:()=>$$,getTimeUntilExpiry:()=>$Z,getStoreNames:()=>Zj,getStore:()=>J9,getSourceLineInfo:()=>_2,getScreenReaderOnlyStyle:()=>zO,getScopeAttribute:()=>JF,getRouteParams:()=>BR,getPublicEnvDefine:()=>K1,getPublicEnv:()=>xQ,getPositionInfo:()=>OU,getPlaceholderRegistry:()=>vZ,getPlaceholderCacheStats:()=>OY,getPageMeta:()=>v3,getNonce:()=>j$,getMimeType:()=>d1,getMiddlewareNames:()=>I4,getMiddleware:()=>hw,getLoadingState:()=>IV,getLoadingLocales:()=>yV,getImageMetadata:()=>R6,getHydrationRuntime:()=>sq,getHydratedStoreState:()=>rw,getHmrServer:()=>d4,getHead:()=>m5,getHMRHandler:()=>jE,getFormatExtension:()=>GY,getFileMtime:()=>c7,getFallbackVariant:()=>w7,getErrorMessage:()=>nY,getErrorLocale:()=>tG,getErrorConfig:()=>o7,getErrorCodeName:()=>_3,getDirectives:()=>TH,getDirective:()=>MH,getCurrentInstance:()=>Lw,getCspPreset:()=>eF,getCspHeaderName:()=>QW,getComponentCacheStats:()=>Hw,getCachedVideoResult:()=>M5,getCachedSignature:()=>P9,getCachedSignalsRuntime:()=>j_,getCachedRouterScript:()=>H_,getCachedPlaceholder:()=>p7,getCachedImageResult:()=>A5,getCached:()=>L5,getCacheStats:()=>FG,getBroadcastServer:()=>Fz,getBestVariant:()=>QY,getAllFilters:()=>gZ,generateWidthSrcset:()=>G$,generateVirtualListCSS:()=>gJ,generateVideoPreview:()=>XQ,generateValidationScript:()=>RV,generateUploadRuntime:()=>G6,generateTreeShakenBundle:()=>_z,generateTransitionRuntime:()=>qB,generateTransitionCSS:()=>zB,generateThumbnails:()=>I5,generateThumbhashPlaceholder:()=>_Y,generateTemplatesDocs:()=>oz,generateSuspenseRuntime:()=>wB,generateSuspenseCSS:()=>AB,generateStateScript:()=>iq,generateSrcsetData:()=>XY,generateSrcset:()=>o6,generateSrcSet:()=>Q5,generateSpriteSheet:()=>J3,generateSpaShell:()=>cE,generateSourceTags:()=>JY,generateSizesFromBreakpoints:()=>$Y,generateSizesAttribute:()=>z5,generateSizes:()=>A7,generateSitemapIndex:()=>nL,generateSitemap:()=>W6,generateSimpleMediaPicker:()=>jj,generateSignatureRuntime:()=>Z6,generateSignalsRuntimeDev:()=>m$,generateSignalsRuntime:()=>O4,generateScopeId:()=>V3,generateSFCWebComponent:()=>wK,generateRouteTypes:()=>zR,generateRouteManifest:()=>UR,generateRobotsTxt:()=>FK,generateRobots:()=>_6,generateResponsiveVariants:()=>r6,generateReactiveWebComponentTS:()=>KF,generateReactiveWebComponent:()=>GF,generateReactiveRuntime:()=>_F,generateReactiveMixin:()=>WF,generatePoster:()=>E5,generatePlaceholderStyle:()=>jY,generatePlaceholderCSS:()=>m7,generatePlaceholder:()=>u7,generatePartialHydrationCSS:()=>sJ,generateNonce:()=>bX,generateNetlifyToml:()=>OZ,generateMinifiedMediaRuntime:()=>Nj,generateMediaRuntime:()=>QQ,generateMediaManagerEmbed:()=>qj,generateManifest:()=>M2,generateLoadingIndicatorHtml:()=>UE,generateLazyLoadRuntime:()=>Y6,generateLQIP:()=>UY,generateKeepAliveRuntime:()=>gB,generateKeepAliveCSS:()=>fB,generateIslandManifest:()=>Z2,generateImagePreview:()=>YQ,generateImageManifest:()=>SZ,generateHydrationScript:()=>LE,generateHydrationRuntime:()=>tT,generateHydrationCSS:()=>VE,generateHydrationBootstrap:()=>pJ,generateHotReloadScript:()=>gz,generateHeatmapScript:()=>iZ,generateHMRClientScript:()=>zE,generateHLSManifest:()=>D5,generateEventBindings:()=>OE,generateDprSrcsetWithVariableQuality:()=>eZ,generateDprSrcset:()=>U5,generateDocumentShell:()=>__,generateDocs:()=>Zq,generateDirectivesDocs:()=>az,generateDirectiveRuntime:()=>SH,generateDefaultRobotsTxt:()=>rL,generateDASHManifest:()=>k5,generateCspMetaTag:()=>P3,generateCspHeader:()=>CX,generateCrosswindCSS:()=>R3,generateCompositionRuntime:()=>vj,generateComponentsDocs:()=>rz,generateComponentManifest:()=>PA,generateComponentDoc:()=>sz,generateColorPlaceholder:()=>qY,generateClientRuntime:()=>yw,generateCacheKey:()=>H5,generateBlurUpRuntime:()=>J6,generateBlurUpCSS:()=>Q6,generateBindingsRuntime:()=>xK,generateAutoWidthSrcset:()=>tZ,generateAsyncComponentRuntime:()=>bB,generateAsyncComponentCSS:()=>SB,generateAnimationRuntime:()=>SO,generateAnimationCSS:()=>DO,generateAnalyticsScript:()=>OX,formatTypeErrors:()=>JE,formatStxContent:()=>Bq,formatSize:()=>P$,formatRoutes:()=>O2,formatMarkdownContent:()=>MM,formatLocalizedError:()=>ZK,formatICU:()=>CW,formatFilePath:()=>a7,formatError:()=>z3,formatDocsAsMarkdown:()=>tz,formatDocsAsJson:()=>$q,formatDocsAsHtml:()=>ez,format:()=>R9,foldConstants:()=>zz,flipVertical:()=>w9,flipHorizontal:()=>A9,fingerprint:()=>L2,findMatchingEndTag:()=>q$,findMatchingDelimiter:()=>b0,findIfBlocks:()=>k3,findExpressions:()=>sK,findErrorPage:()=>H2,findDirectiveBlocks:()=>J4,findDeadCode:()=>Bz,findDeadBranches:()=>Bz,findComponentFiles:()=>d2,findCommonDir:()=>f2,filterRequiredFiles:()=>F6,fileExists:()=>t,extractVariables:()=>R0,extractState:()=>nq,extractSlotContent:()=>RU,extractScriptFromTemplate:()=>nX,extractPlaceholders:()=>QO,extractParenthesizedExpression:()=>l1,extractDominantColor:()=>zY,extractDirectiveParams:()=>oK,extractDirectiveNames:()=>VU,extractContainerContent:()=>C4,extractComponentProps:()=>iz,extractComponentName:()=>cJ,extractComponentDescription:()=>nz,extractClassNames:()=>w3,extractBoundProps:()=>lJ,extractBalancedExpression:()=>MX,extractAndScopeStyles:()=>QF,extractAndProcessEvents:()=>uK,evaluateExpression:()=>Y1,evaluateConstant:()=>f8,evaluateAuthExpression:()=>c1,escapeHtml:()=>w0,errorRecovery:()=>q3,errorLogger:()=>u0,ensureTeleportTargets:()=>JB,ensureDocumentShell:()=>z4,enhancedValidationRules:()=>dX,eliminateDeadCode:()=>Uz,effect:()=>G8,dprUrls:()=>k9,docsCommand:()=>YM,disconnectObserver:()=>n9,devHelpers:()=>y5,detectShell:()=>q2,detectRuntime:()=>B7,detectProjectConfig:()=>V7,detectFormat:()=>KY,detectBuildMode:()=>xR,derived:()=>Q8,deploy:()=>zH,defineStxConfig:()=>TK,defineStore:()=>Xj,defineSiteConfig:()=>FQ,definePlugin:()=>x5,definePageMeta:()=>UW,defineMiddleware:()=>gw,defineExpose:()=>kj,defineEmits:()=>Dj,defineDirective:()=>T0,defineCustomElement:()=>oj,defineConfig:()=>sM,defineClientDirective:()=>IH,defineAsyncComponent:()=>DB,defaultMediaConfig:()=>vE,defaultImageConfig:()=>hH,defaultI18nConfig:()=>p3,defaultHeatmapConfig:()=>KG,defaultFormClasses:()=>h3,defaultFilters:()=>W5,defaultCspConfig:()=>QV,defaultConfig:()=>a0,default:()=>SI,decodeThumbhash:()=>BY,cspNonceDirective:()=>JW,cspDirective:()=>XW,crossfadeTransition:()=>t9,crop:()=>W9,createVirtualList:()=>I8,createVideoDirective:()=>K3,createVercelHandler:()=>LM,createTypeChecker:()=>o2,createTranslateFilter:()=>oV,createTextEncoderStream:()=>qM,createStxApp:()=>BQ,createStreamingResponse:()=>zM,createStreamRenderer:()=>sT,createStore:()=>Q9,createStorageManager:()=>fw,createServerCookieManager:()=>vw,createScope:()=>kU,createSSRSuspense:()=>VB,createRouter:()=>n1,createRouteLocation:()=>E4,createRoute:()=>cT,createRef:()=>Vw,createReactive:()=>SU,createProvideContext:()=>xj,createProject:()=>YT,createProductionBuild:()=>nM,createPlaceholder:()=>k7,createOptimizedBuild:()=>fR,createNetlifyHandler:()=>FM,createNetlifyClient:()=>O6,createMiddlewareContext:()=>T4,createMiddleware:()=>pT,createLazyObserver:()=>l9,createKeepAliveCache:()=>xB,createKVNamespace:()=>Qq,createIslandRegistry:()=>iJ,createImgDirective:()=>$3,createImagePlugin:()=>DQ,createImageDirective:()=>DZ,createHeatmapAggregator:()=>PO,createFileManifest:()=>L6,createEnvAccessor:()=>Jq,createEnhancedError:()=>_K,createEdgeHandler:()=>p4,createEdgeCache:()=>Gq,createDetailedErrorMessage:()=>U0,createDenoHandler:()=>OM,createDefaultNetlifyConfig:()=>N7,createCspHeaders:()=>JV,createCookie:()=>NM,createComputed:()=>Nw,createComponentInstance:()=>Fw,createCloudflareHandler:()=>HM,createClientCookieManager:()=>xw,createBuiltinDirectives:()=>kH,createApp:()=>BQ,createAnimationTimeline:()=>IO,cover:()=>U9,convertToCommonJS:()=>c3,contrast:()=>F9,contain:()=>B9,consoleError:()=>WK,configureErrorHandling:()=>JK,config:()=>t0,computed:()=>Nw,composeShellWithPage:()=>b4,componentDirective:()=>Sz,compileTemplate:()=>A2,collectDeployFiles:()=>F7,clearVideoCache:()=>Y3,clearTranslationCache:()=>MV,clearSignatureCache:()=>x9,clearPlaceholderCache:()=>HY,clearOnceStore:()=>ON,clearNonce:()=>tF,clearMiddleware:()=>M4,clearImageCache:()=>IZ,clearErrorMessages:()=>$K,clearDevCaches:()=>O_,clearCustomFilters:()=>cQ,clearComponentCache:()=>T$,clearCache:()=>V5,classifyScript:()=>dU,classifyAllScripts:()=>B2,checkTemplateFile:()=>YE,checkTemplate:()=>XE,checkCache:()=>j8,checkAuthAccess:()=>H7,checkA11y:()=>rQ,channel:()=>Ez,cancelPendingLoads:()=>PV,calculateSha1:()=>HZ,calculateOptimalWidths:()=>p6,cacheTemplate:()=>H8,buildWebComponents:()=>YX,buildViews:()=>Mj,buildUrl:()=>H0,buildStaticSite:()=>OQ,buildRuntimeAsset:()=>F2,buildRouterAsset:()=>V2,buildLangPickerScript:()=>H6,buildImageUrl:()=>j1,buildForProduction:()=>$z,buildAuthParams:()=>$6,buildApp:()=>yR,buildAlternateLinks:()=>j6,build:()=>iM,broadcastPrivate:()=>Mz,broadcastPresence:()=>Tz,broadcast:()=>S2,brightness:()=>L9,blur:()=>z9,batchSignUrls:()=>t8,batch:()=>K8,autoFixA11yFile:()=>aQ,autoFixA11yDirectory:()=>OO,autoFixA11y:()=>oQ,auto:()=>T9,assetTags:()=>IR,applyTranslations:()=>q6,applyTransformations:()=>i7,applySlots:()=>MU,applyPropDefaults:()=>uR,applyPreset:()=>I9,applyHead:()=>OW,applyFilters:()=>dZ,apiCspPreset:()=>YW,animationGroupDirective:()=>g6,analyzeVideo:()=>s7,analyzeUsage:()=>D2,analyzeTemplate:()=>hU,analyzeProject:()=>JR,analyzeDirectiveUsage:()=>D2,analyticsDirective:()=>DF,addStore:()=>KT,addPage:()=>GT,addNonceToInlineContent:()=>ZV,addLayout:()=>WT,addComponent:()=>QT,abortNavigation:()=>Pw,a11yDirective:()=>y6,VideoProcessorCache:()=>R5,TransitionType:()=>tQ,TransitionEase:()=>$G,TransitionDirection:()=>eQ,Tokenizer:()=>X4,TemplateTypeChecker:()=>r2,TEMPLATE_PRESETS:()=>bM,StxValidationError:()=>t7,StxSyntaxError:()=>sY,StxSecurityError:()=>rY,StxRuntimeError:()=>O1,StxFileError:()=>C5,StxError:()=>U$,Show:()=>lj,SPRING_PRESETS:()=>pZ,ProductionBuild:()=>i8,Portal:()=>nj,PROJECT_TEMPLATES:()=>ZT,PRESETS:()=>o8,MemorySessionStore:()=>aq,MIME_TYPES:()=>h7,MEDIA_DEFAULT_WIDTHS:()=>R1,MEDIA_DEFAULT_FORMATS:()=>m1,ImageProcessorCache:()=>N5,ImageProcessingError:()=>M7,HydrationRuntime:()=>X9,HotReloadServer:()=>x2,HeatmapAggregator:()=>rZ,Fragment:()=>Z5,For:()=>ij,ErrorLogger:()=>j3,ErrorCodes:()=>o,DeployError:()=>Z$,DEFAULT_WIDTHS:()=>B1,DEFAULT_TRANSITION_OPTIONS:()=>w1,DEFAULT_QUALITY:()=>z1,DEFAULT_PLACEHOLDER_OPTIONS:()=>l6,DEFAULT_FORMATS:()=>U1,DEFAULT_DPR_VALUES:()=>g7,ComponentHMRHandler:()=>Z9,COMMON_SIZES:()=>ZY,BroadcastServer:()=>Dz,Broadcast:()=>Iz,BLUR_UP_CSS:()=>j5});var SI;var E$=D(()=>{NZ();bZ();q0();x$();Jj();YJ();KQ();rj();aj();WX();E1();QH();bU();L$();b8();uX();x6();FX();d6();d5();y4();RX();Yz();N2();Qz();Oz();g8();O8();bz();m0();xX();gX();NZ();lz();E7();Yq();Kq();X1();NX();d0();Uq();u6();lX();c5();Hq();Lq();o3();m6();ZJ();b3();x8();S7();_1();Nq();I2();wq();P4();kq();U2();F3();bq();Z8();w2();l2();xq();fq();QX();mJ();Y2();gq();uq();HX();I7();pq();rq();tq();bZ();Rj();Tj();L4();JJ();GJ();ej();q0();W2();WH();SI={}});E$();export{V6 as writeNetlifyConfig,T2 as writeManifest,CQ as writeImageManifest,qE as wrapComponentForHMR,JX as webComponentDirectiveHandler,E9 as watermark,fE as watchViews,ww as watchMultiple,Rw as watchEffect,Aw as watch,cw as waitForStore,CV as waitForLocale,r7 as videoDirective,H3 as validators,MW as validateValueEnhanced,HU as validateTemplate,S9 as validateParams,wV as validateFormEnhanced,QZ as validateFile,NV as validateFields,wW as validateField,LU as validateDirective,XV as validateCspDirectives,EK as validateConfig,vR as validateComponentScripts,dR as validateComponentProps,T8 as validateClientScript,C7 as usesSignalsInScript,hJ as useVirtualList,zW as useTitle,pw as useStoreOrThrow,Yj as useStore,yj as useSlots,Q4 as useSeoMeta,yU as useRouteParams,lw as useRouteParamOrThrow,PU as useRouteParam,zW as usePageTitle,iw as useMiddlewareValue,xU as useMiddlewareState,dq as useLoadingIndicator,O$ as useHead,Pj as useAttrs,ZQ as uploadFiles,GZ as uploadFile,bw as updateInstance,B8 as untrack,EH as unregisterDirective,Cw as unmountInstance,b6 as unescapeHtml,J$ as transpileTypeScript,UZ as translate,v6 as transitionDirective,Rz as toUsers,wz as toUser,_9 as thumbnail,X6 as thumbHashToRGBA,o9 as thumbHashToDataURL,BJ as templateCache,v2 as stxClientHelpers,L3 as structuredDataDirective,zQ as stripLocalePrefix,s$ as stripDocumentWrapper,jM as stringToStream,$W as strictCspPreset,yq as streamingSuspenseDirective,aT as streamToResponse,nT as streamTemplateSimple,iT as streamTemplate,K7 as stopHmrServer,Nz as stopBroadcasting,J8 as state,tM as startProductionServer,hM as startInteractive,Vz as startBroadcasting,YG as staggerDirective,D9 as srcsetUrls,XG as springDirective,D3 as splitByPipe,y9 as smartBatchSign,a8 as signUrl,X$ as shouldTranspileTypeScript,g4 as shouldReloadOnChange,ZZ as shouldRefreshSignature,h4 as shouldIgnoreFile,vB as shouldCacheComponent,q9 as sharpen,ow as setRouteParams,aw as setMiddlewareState,_Z as setGlobalProvide,aG as setErrorLocale,Ow as setCurrentInstance,T5 as setCachedVideoResult,w5 as setCachedImageResult,F5 as setCached,hz as serveStxFile,uz as serveMultipleStxFiles,c8 as serveMarkdownFile,mT as serveFile,pz as serveApp,Sq as serve,cq as serializeState,H9 as sepia,f6 as scrollAnimateDirective,P6 as screenReaderDirective,NK as scopeHTML,VK as scopeCSS,sL as scanForSitemapEntries,jO as scanA11yIssues,V9 as saturation,b9 as sanitizeParams,qK as sanitizeFilePath,jK as sanitizeExpression,HK as sanitizeDirectiveParams,e7 as sanitizeDirectiveParam,aY as sanitizeComponentProps,M1 as safeExecuteAsync,BK as safeExecute,eX as runPreProcessingMiddleware,$J as runPostProcessingMiddleware,k4 as runMiddleware,n$ as runHooks,N9 as rotate,$4 as resolveTemplatePath,z6 as resolveI18n,K9 as resize,xZ as resetPlaceholders,BW as resetHead,HE as resetHMRHandler,QK as resetErrorConfig,S6 as replacePlaceholders,GQ as renderView,S5 as renderVideoComponent,$5 as renderToString,cj as renderToStream,O7 as renderToDOM,r9 as renderThumbhashToCanvas,tE as renderTemplate,eE as renderString,G2 as renderSlot,NB as renderSSRSuspense,h9 as renderProtectedVideo,g9 as renderProtectedImg,C9 as renderMediaUpload,_$ as renderImgComponent,AQ as renderImageComponent,jW as renderHtmlAttrs,qW as renderHead,gE as renderEmail,D1 as renderComponentWithSlot,HW as renderBodyAttrs,NE as render,ZW as relaxedCspPreset,VV as registerValidationRule,rT as registerStreamingDirectives,sw as registerStore,iL as registerSeoDirectives,mw as registerMiddleware,pQ as registerFilters,fZ as registerFilter,eG as registerErrorMessages,AV as registerEnhancedValidationRule,MQ as registerDirective,YV as registerCspDirectives,pR as registerComponentDirectives,bO as registerAnimationDirectives,LO as registerA11yDirectives,Vw as ref,wM as redirect,p1 as readMarkdownFile,U_ as readFileCached,SU as reactive,M9 as quality,v9 as pruneSignatureCache,VG as pruneCache,Ej as provide,XJ as processVueTemplate,D8 as processVirtualListDirectives,uJ as processVirtualGridDirectives,G3 as processVideo,RW as processValidateDirective,cX as processTranslateDirective,UB as processTransitionDirectives,jB as processTransitionAttributes,FW as processTitleDirective,jX as processTemplateBindings,XB as processTeleportDirectives,FB as processSuspenseDirectives,eY as processStructuredData,$2 as processStaticDirectives,e3 as processStackReplacements,t3 as processStackPushDirectives,K2 as processSlots,y8 as processShell,$8 as processServerBindings,$X as processSeoDirective,oT as processSectionDirectives,U4 as processScopedStyles,PK as processReactiveBindings,d9 as processProtectedMedia,nJ as processPartialHydrationDirectives,M8 as processOnceDirective,tX as processMiddleware,tY as processMetaDirectives,VW as processMetaDirective,wX as processMarkdownFileDirectives,oZ as processMarkdownDirectives,r3 as processLoops,PB as processKeepAliveDirectives,R8 as processJsonDirective,dJ as processInfiniteListDirectives,a3 as processIncludes,SY as processImgComponents,wQ as processImageComponents,h1 as processImage,LW as processHeadDirective,FV as processForms,d3 as processFormInputDirectives,q1 as processExpressions,VX as processEventDirectives,u3 as processErrorDirective,QJ as processDynamicComponents,Z0 as processDirectives,bH as processDirectiveAttributes,$B as processDeferDirectives,fX as processCustomDirectives,PX as processCspDirectives,f$ as processClientScript,p5 as processBasicFormDirectives,IB as processAsyncDirectives,cZ as processAnimationDirectives,mZ as processA11yDirectives,SV as preloadTranslationsBackground,DW as preloadTranslations,GE as preloadIslandHandlers,jz as poolStrings,KX as pluginManager,BB as performLeave,_B as performEnter,U8 as peek,N$ as partialsCache,lG as parseVideoDirectiveOptions,G9 as parseUrl,a9 as parseThumbhashString,S3 as parseSwitchBlock,Q2 as parseSlots,AU as parseSlotElement,aK as parseScriptDeclarations,AK as parseSFCComponent,u9 as parseProtectedArgs,e6 as parseImgComponent,YY as parseImageUrl,MZ as parseImageComponent,rK as parseExpressionWithFilters,VM as parseCookies,TX as parseConditionalBlock,EX as parseArguments,kO as parseAnimationShorthand,Hz as optimizeTemplate,kZ as optimizeImage,bQ as optimizeDirectory,oX as onceStore,Iw as onUpdated,kw as onUnmounted,ew as onServer,Tw as onMounted,W8 as onMount,eJ as onHydrated,bj as onErrorCaptured,_8 as onDestroy,dB as onDeactivated,tw as onClient,Ew as onBeforeUpdate,Dw as onBeforeUnmount,Mw as onBeforeMount,hB as onActivated,i9 as observeElement,RM as notFound,Sj as nextTick,uw as navigateTo,Sw as mountInstance,h6 as motionDirective,y3 as moderateCspPreset,qz as minifyHtml,O3 as metaDirective,r8 as mergeParams,$V as mergeCspDirectives,P8 as matchRoute,aZ as markdownDirectiveHandler,I3 as markdownCache,t1 as localizePath,W4 as loadTranslationLazy,bW as loadTranslation,S0 as loadStxConfig,D4 as loadMiddlewareFromDirectory,E2 as loadManifest,a1 as loadElement,Az as loadChannels,c9 as lazyLoadAll,p9 as lazyLoad,ZG as keyframeDirective,uj as jsxs,mj as jsxDEV,Y5 as jsx,AM as jsonResponse,Pq as islandDirective,gL as isTest,j2 as isSpaNavigation,e8 as isSignatureValid,j4 as isSignal,g1 as isSharpAvailable,JM as isServerEnvironment,vU as isServer,YK as isProduction,YZ as isNativeLazySupported,DV as isLoading,kV as isLoaded,EU as isJavaScriptScript,XZ as isIntersectionObserverSupported,M6 as isImageFile,PW as isICUFormat,tJ as isHydrated,XM as isEdgeEnvironment,GH as isDirectiveKind,B$ as isDevelopment,H4 as isDerived,f4 as isCssOnlyChange,fU as isClient,kB as isAsyncComponent,O9 as invert,q_ as invalidateFileCacheByDir,z_ as invalidateFileCache,lQ as interpolateScriptsInTemplate,hZ as interpolateScriptExpressions,$0 as inlineError,U6 as injectThemeBootstrap,ZX as injectSeoTags,K6 as injectSeo,B6 as injectRouterScript,y1 as injectHotReload,nZ as injectHeatmap,yX as injectCspMetaTag,V0 as injectCrosswindCSS,LX as injectAnalytics,Ij as inject,nw as initStoreRegistry,qH as initNetlify,BE as initLoadingIndicator,m9 as initLazyLoading,CM as initFile,JZ as initBlurUp,e9 as initAllBlurUp,n7 as imgDirective,EQ as imageDirective,c2 as hydrateTemplate,QE as hydrateIslands,rJ as hydrateIsland,rM as hydrateFragment,oJ as hydrateByStrategy,aJ as hydrateAll,FE as hydrate,uT as htmlResponse,sZ as heatmapDirective,i6 as hashString,n5 as hashFilePath,v0 as hashFile,qG as hashBuffer,Q_ as hasVueTemplateSyntax,sX as hasVariables,$j as hasStore,K5 as hasPlaceholders,N6 as hasNetlifyConfig,dw as hasMiddleware,PF as hasEventDirectives,B_ as hasDocumentShell,FU as hasDirectives,sQ as hasDOMSupport,Cj as handleError,sj as h,R7 as groupVariantsByFormat,j9 as grayscale,eM as gitHash,Wz as getUnusedDirectives,kW as getTranslationSync,TV as getTranslationCacheStats,bV as getTranslationAsync,m3 as getTranslation,$$ as getTotalSize,$Z as getTimeUntilExpiry,Zj as getStoreNames,J9 as getStore,_2 as getSourceLineInfo,zO as getScreenReaderOnlyStyle,JF as getScopeAttribute,BR as getRouteParams,K1 as getPublicEnvDefine,xQ as getPublicEnv,OU as getPositionInfo,vZ as getPlaceholderRegistry,OY as getPlaceholderCacheStats,v3 as getPageMeta,j$ as getNonce,d1 as getMimeType,I4 as getMiddlewareNames,hw as getMiddleware,IV as getLoadingState,yV as getLoadingLocales,R6 as getImageMetadata,sq as getHydrationRuntime,rw as getHydratedStoreState,d4 as getHmrServer,m5 as getHead,jE as getHMRHandler,GY as getFormatExtension,c7 as getFileMtime,w7 as getFallbackVariant,nY as getErrorMessage,tG as getErrorLocale,o7 as getErrorConfig,_3 as getErrorCodeName,TH as getDirectives,MH as getDirective,Lw as getCurrentInstance,eF as getCspPreset,QW as getCspHeaderName,Hw as getComponentCacheStats,M5 as getCachedVideoResult,P9 as getCachedSignature,j_ as getCachedSignalsRuntime,H_ as getCachedRouterScript,p7 as getCachedPlaceholder,A5 as getCachedImageResult,L5 as getCached,FG as getCacheStats,Fz as getBroadcastServer,QY as getBestVariant,gZ as getAllFilters,G$ as generateWidthSrcset,gJ as generateVirtualListCSS,XQ as generateVideoPreview,RV as generateValidationScript,G6 as generateUploadRuntime,_z as generateTreeShakenBundle,qB as generateTransitionRuntime,zB as generateTransitionCSS,I5 as generateThumbnails,_Y as generateThumbhashPlaceholder,oz as generateTemplatesDocs,wB as generateSuspenseRuntime,AB as generateSuspenseCSS,iq as generateStateScript,XY as generateSrcsetData,o6 as generateSrcset,Q5 as generateSrcSet,J3 as generateSpriteSheet,cE as generateSpaShell,JY as generateSourceTags,$Y as generateSizesFromBreakpoints,z5 as generateSizesAttribute,A7 as generateSizes,nL as generateSitemapIndex,W6 as generateSitemap,jj as generateSimpleMediaPicker,Z6 as generateSignatureRuntime,m$ as generateSignalsRuntimeDev,O4 as generateSignalsRuntime,V3 as generateScopeId,wK as generateSFCWebComponent,zR as generateRouteTypes,UR as generateRouteManifest,FK as generateRobotsTxt,_6 as generateRobots,r6 as generateResponsiveVariants,KF as generateReactiveWebComponentTS,GF as generateReactiveWebComponent,_F as generateReactiveRuntime,WF as generateReactiveMixin,E5 as generatePoster,jY as generatePlaceholderStyle,m7 as generatePlaceholderCSS,u7 as generatePlaceholder,sJ as generatePartialHydrationCSS,bX as generateNonce,OZ as generateNetlifyToml,Nj as generateMinifiedMediaRuntime,QQ as generateMediaRuntime,qj as generateMediaManagerEmbed,M2 as generateManifest,UE as generateLoadingIndicatorHtml,Y6 as generateLazyLoadRuntime,UY as generateLQIP,gB as generateKeepAliveRuntime,fB as generateKeepAliveCSS,Z2 as generateIslandManifest,YQ as generateImagePreview,SZ as generateImageManifest,LE as generateHydrationScript,tT as generateHydrationRuntime,VE as generateHydrationCSS,pJ as generateHydrationBootstrap,gz as generateHotReloadScript,iZ as generateHeatmapScript,zE as generateHMRClientScript,D5 as generateHLSManifest,OE as generateEventBindings,eZ as generateDprSrcsetWithVariableQuality,U5 as generateDprSrcset,__ as generateDocumentShell,Zq as generateDocs,az as generateDirectivesDocs,SH as generateDirectiveRuntime,rL as generateDefaultRobotsTxt,k5 as generateDASHManifest,P3 as generateCspMetaTag,CX as generateCspHeader,R3 as generateCrosswindCSS,vj as generateCompositionRuntime,rz as generateComponentsDocs,PA as generateComponentManifest,sz as generateComponentDoc,qY as generateColorPlaceholder,yw as generateClientRuntime,H5 as generateCacheKey,J6 as generateBlurUpRuntime,Q6 as generateBlurUpCSS,xK as generateBindingsRuntime,tZ as generateAutoWidthSrcset,bB as generateAsyncComponentRuntime,SB as generateAsyncComponentCSS,SO as generateAnimationRuntime,DO as generateAnimationCSS,OX as generateAnalyticsScript,JE as formatTypeErrors,Bq as formatStxContent,P$ as formatSize,O2 as formatRoutes,MM as formatMarkdownContent,ZK as formatLocalizedError,CW as formatICU,a7 as formatFilePath,z3 as formatError,tz as formatDocsAsMarkdown,$q as formatDocsAsJson,ez as formatDocsAsHtml,R9 as format,zz as foldConstants,w9 as flipVertical,A9 as flipHorizontal,L2 as fingerprint,q$ as findMatchingEndTag,b0 as findMatchingDelimiter,k3 as findIfBlocks,sK as findExpressions,H2 as findErrorPage,J4 as findDirectiveBlocks,Bz as findDeadCode,Bz as findDeadBranches,d2 as findComponentFiles,f2 as findCommonDir,F6 as filterRequiredFiles,t as fileExists,R0 as extractVariables,nq as extractState,RU as extractSlotContent,nX as extractScriptFromTemplate,QO as extractPlaceholders,l1 as extractParenthesizedExpression,zY as extractDominantColor,oK as extractDirectiveParams,VU as extractDirectiveNames,C4 as extractContainerContent,iz as extractComponentProps,cJ as extractComponentName,nz as extractComponentDescription,w3 as extractClassNames,lJ as extractBoundProps,MX as extractBalancedExpression,QF as extractAndScopeStyles,uK as extractAndProcessEvents,Y1 as evaluateExpression,f8 as evaluateConstant,c1 as evaluateAuthExpression,w0 as escapeHtml,q3 as errorRecovery,u0 as errorLogger,JB as ensureTeleportTargets,z4 as ensureDocumentShell,dX as enhancedValidationRules,Uz as eliminateDeadCode,G8 as effect,k9 as dprUrls,YM as docsCommand,n9 as disconnectObserver,y5 as devHelpers,q2 as detectShell,B7 as detectRuntime,V7 as detectProjectConfig,KY as detectFormat,xR as detectBuildMode,Q8 as derived,zH as deploy,TK as defineStxConfig,Xj as defineStore,FQ as defineSiteConfig,x5 as definePlugin,UW as definePageMeta,gw as defineMiddleware,kj as defineExpose,Dj as defineEmits,T0 as defineDirective,oj as defineCustomElement,sM as defineConfig,IH as defineClientDirective,DB as defineAsyncComponent,vE as defaultMediaConfig,hH as defaultImageConfig,p3 as defaultI18nConfig,KG as defaultHeatmapConfig,h3 as defaultFormClasses,W5 as defaultFilters,QV as defaultCspConfig,a0 as defaultConfig,SI as default,BY as decodeThumbhash,JW as cspNonceDirective,XW as cspDirective,t9 as crossfadeTransition,W9 as crop,I8 as createVirtualList,K3 as createVideoDirective,LM as createVercelHandler,o2 as createTypeChecker,oV as createTranslateFilter,qM as createTextEncoderStream,BQ as createStxApp,zM as createStreamingResponse,sT as createStreamRenderer,Q9 as createStore,fw as createStorageManager,vw as createServerCookieManager,kU as createScope,VB as createSSRSuspense,n1 as createRouter,E4 as createRouteLocation,cT as createRoute,Vw as createRef,SU as createReactive,xj as createProvideContext,YT as createProject,nM as createProductionBuild,k7 as createPlaceholder,fR as createOptimizedBuild,FM as createNetlifyHandler,O6 as createNetlifyClient,T4 as createMiddlewareContext,pT as createMiddleware,l9 as createLazyObserver,xB as createKeepAliveCache,Qq as createKVNamespace,iJ as createIslandRegistry,$3 as createImgDirective,DQ as createImagePlugin,DZ as createImageDirective,PO as createHeatmapAggregator,L6 as createFileManifest,Jq as createEnvAccessor,_K as createEnhancedError,p4 as createEdgeHandler,Gq as createEdgeCache,U0 as createDetailedErrorMessage,OM as createDenoHandler,N7 as createDefaultNetlifyConfig,JV as createCspHeaders,NM as createCookie,Nw as createComputed,Fw as createComponentInstance,HM as createCloudflareHandler,xw as createClientCookieManager,kH as createBuiltinDirectives,BQ as createApp,IO as createAnimationTimeline,U9 as cover,c3 as convertToCommonJS,F9 as contrast,B9 as contain,WK as consoleError,JK as configureErrorHandling,t0 as config,Nw as computed,b4 as composeShellWithPage,Sz as componentDirective,A2 as compileTemplate,F7 as collectDeployFiles,Y3 as clearVideoCache,MV as clearTranslationCache,x9 as clearSignatureCache,HY as clearPlaceholderCache,ON as clearOnceStore,tF as clearNonce,M4 as clearMiddleware,IZ as clearImageCache,$K as clearErrorMessages,O_ as clearDevCaches,cQ as clearCustomFilters,T$ as clearComponentCache,V5 as clearCache,dU as classifyScript,B2 as classifyAllScripts,YE as checkTemplateFile,XE as checkTemplate,j8 as checkCache,H7 as checkAuthAccess,rQ as checkA11y,Ez as channel,PV as cancelPendingLoads,HZ as calculateSha1,p6 as calculateOptimalWidths,H8 as cacheTemplate,YX as buildWebComponents,Mj as buildViews,H0 as buildUrl,OQ as buildStaticSite,F2 as buildRuntimeAsset,V2 as buildRouterAsset,H6 as buildLangPickerScript,j1 as buildImageUrl,$z as buildForProduction,$6 as buildAuthParams,yR as buildApp,j6 as buildAlternateLinks,iM as build,Mz as broadcastPrivate,Tz as broadcastPresence,S2 as broadcast,L9 as brightness,z9 as blur,t8 as batchSignUrls,K8 as batch,aQ as autoFixA11yFile,OO as autoFixA11yDirectory,oQ as autoFixA11y,T9 as auto,IR as assetTags,q6 as applyTranslations,i7 as applyTransformations,MU as applySlots,uR as applyPropDefaults,I9 as applyPreset,OW as applyHead,dZ as applyFilters,YW as apiCspPreset,g6 as animationGroupDirective,s7 as analyzeVideo,D2 as analyzeUsage,hU as analyzeTemplate,JR as analyzeProject,D2 as analyzeDirectiveUsage,DF as analyticsDirective,KT as addStore,GT as addPage,ZV as addNonceToInlineContent,WT as addLayout,QT as addComponent,Pw as abortNavigation,y6 as a11yDirective,R5 as VideoProcessorCache,tQ as TransitionType,$G as TransitionEase,eQ as TransitionDirection,X4 as Tokenizer,r2 as TemplateTypeChecker,bM as TEMPLATE_PRESETS,t7 as StxValidationError,sY as StxSyntaxError,rY as StxSecurityError,O1 as StxRuntimeError,C5 as StxFileError,U$ as StxError,lj as Show,pZ as SPRING_PRESETS,i8 as ProductionBuild,nj as Portal,ZT as PROJECT_TEMPLATES,o8 as PRESETS,aq as MemorySessionStore,h7 as MIME_TYPES,R1 as MEDIA_DEFAULT_WIDTHS,m1 as MEDIA_DEFAULT_FORMATS,N5 as ImageProcessorCache,M7 as ImageProcessingError,X9 as HydrationRuntime,x2 as HotReloadServer,rZ as HeatmapAggregator,Z5 as Fragment,ij as For,j3 as ErrorLogger,o as ErrorCodes,Z$ as DeployError,B1 as DEFAULT_WIDTHS,w1 as DEFAULT_TRANSITION_OPTIONS,z1 as DEFAULT_QUALITY,l6 as DEFAULT_PLACEHOLDER_OPTIONS,U1 as DEFAULT_FORMATS,g7 as DEFAULT_DPR_VALUES,Z9 as ComponentHMRHandler,ZY as COMMON_SIZES,Dz as BroadcastServer,Iz as Broadcast,j5 as BLUR_UP_CSS};