@stacksjs/stx 0.2.127 → 0.2.128
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +135 -133
- package/dist/craft.js +83 -81
- package/dist/native-build.d.ts +1 -0
- package/dist/native-build.js +64 -17
- package/package.json +5 -5
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
var LR=Object.defineProperty;var VR=($)=>$;function FR($,Z){this[$]=VR.bind(null,Z)}var
|
|
3
|
+
var LR=Object.defineProperty;var VR=($)=>$;function FR($,Z){this[$]=VR.bind(null,Z)}var $0=($,Z)=>{for(var Y in Z)LR($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:FR.bind(Z,Y)})};var D=($,Z)=>()=>($&&(Z=$($=0)),Z);var Z0=import.meta.require;import d3 from"path";function HJ($,Z,Y,X){let J=$;J=J.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,W)=>{let z={"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||z} -->`});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 wR(){return`
|
|
4
4
|
.sr-only {
|
|
5
5
|
position: absolute;
|
|
6
6
|
width: 1px;
|
|
@@ -810,7 +810,7 @@ ${H}
|
|
|
810
810
|
`),X)J=J.replace(/\n/g,`<br />
|
|
811
811
|
`);for(let z=0;z<Q.length;z++)J=J.replace(`\x00CODEBLOCK${z}\x00`,Q[z]);return J=J.replace(/<p>\s*<\/p>/g,""),J.trim()}function l1($){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__
|
|
812
812
|
`});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
|
|
813
|
-
`}),$}import Jz from"process";function F1($="STX_PUBLIC_"){let Z={},Y={};for(let[X,J]of Object.entries(Jz.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 Qz($="STX_PUBLIC_"){let Z={};for(let[Y,X]of Object.entries(Jz.env))if(Y.startsWith($)&&X!==void 0)Z[Y]=X;return Z}var u4=()=>{};import Z7 from"path";function MJ($){Kz=$?.trim()||null}function H$(){return process.env[Gz]?.trim()||Kz||
|
|
813
|
+
`}),$}import Jz from"process";function F1($="STX_PUBLIC_"){let Z={},Y={};for(let[X,J]of Object.entries(Jz.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 Qz($="STX_PUBLIC_"){let Z={};for(let[Y,X]of Object.entries(Jz.env))if(Y.startsWith($)&&X!==void 0)Z[Y]=X;return Z}var u4=()=>{};import Z7 from"path";function MJ($){Kz=$?.trim()||null}function H$(){return process.env[Gz]?.trim()||Kz||k6}function l0($=process.cwd(),...Z){let Y=H$();return Z7.isAbsolute(Y)?Z7.join(Y,...Z):Z7.join($,Y,...Z)}function O$($){if(!$||Z7.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==k6&&!Z.startsWith(`${k6}/`))return $;let Y=Z.slice(k6.length+1);return Y?Z7.join(H$(),Y):H$()}var k6=".stx",Gz="STX_DIR",Kz=null;var J4=()=>{};var Y7={};$0(Y7,{queueClientBundleBuild:()=>_z,hasUserImports:()=>cR,bundleClientScript:()=>iR});import c0 from"path";import A1 from"fs";function cR($){let Z=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Y;while((Y=Z.exec($))!==null){let J=Y[1];if(!Wz.some((G)=>G.test(J)))return console.log("[stx:bundler] detected user import:",J),!0}let X=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Y=X.exec($))!==null){let J=Y[1];if(/\.css(?:\?.*)?$/.test(J))continue;if(!Wz.some((G)=>G.test(J)))return console.log("[stx:bundler] detected side-effect import:",J),!0}return!1}function pR($,Z,Y,X){let J=(Q,G)=>{let K=Q===Y?Z:c0.dirname(Q),W=c0.resolve(K,G),U=[W,`${W}.ts`,`${W}.tsx`,`${W}.js`,`${W}.mjs`,`${W}.jsx`,c0.join(W,"index.ts"),c0.join(W,"index.tsx"),c0.join(W,"index.js"),c0.join(W,"index.mjs")];for(let z of U)try{if(A1.existsSync(z)&&A1.statSync(z,{throwIfNoEntry:!1})?.isFile())return z}catch{}return W};return{name:"stx-client-bundle",setup(Q){Q.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^\//},(G)=>{if(A1.existsSync(G.path))return{path:G.path};return{path:G.path,external:!0}}),Q.onResolve({filter:/^\.\.?\//},(G)=>{let K=J(G.importer,G.path);return X.add(K),{path:K}}),Q.onResolve({filter:/^[@~]\//},(G)=>{let K=c0.resolve($,G.path.slice(2)),W=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,c0.join(K,"index.ts"),c0.join(K,"index.tsx"),c0.join(K,"index.js"),c0.join(K,"index.mjs")];for(let U of W)if(A1.existsSync(U)&&A1.statSync(U,{throwIfNoEntry:!1})?.isFile())return console.log(`[stx:bundler] resolved ${G.path[0]}/ import:`,G.path,"\u2192",U),X.add(U),{path:U};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}}),Q.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(G)=>{let K=c0.extname(G.path).toLowerCase(),W=K===".json"?"json":K===".tsx"?"tsx":K===".jsx"?"jsx":K===".ts"||K===".mts"||K===".cts"?"ts":"js";return X.add(G.path),{contents:A1.readFileSync(G.path,"utf8"),loader:W}})}}}function _z($){let Z=globalThis,X=(Z[Uz]??Promise.resolve()).then($,$);return Z[Uz]=X.then(()=>{return},()=>{return}),X}async function iR($,Z,Y={}){let X=Y.projectRoot||process.cwd(),J=Y.minify??!1,Q=Y.cacheDir||l0(X,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(`${lR}\x00${$}\x00${Z}`);let K=G.digest("hex").slice(0,12),W=c0.join(Q,`${K}.js`),U=c0.join(Q,`${K}.deps.json`),z=Bun.file(W);if(await z.exists()){let q=Bun.file(U),j=!0;if(await q.exists())try{let H=JSON.parse(await q.text());if(H.metadataVersion!==zz||!Array.isArray(H.files))j=!1;for(let O of Array.isArray(H.files)?H.files:[])try{if(A1.statSync(O.path).mtimeMs!==O.mtimeMs){j=!1;break}}catch{j=!1;break}}catch{j=!1}if(j)return console.log("[stx:bundler] cache hit:",K),await z.text();console.log("[stx:bundler] cache invalidated by dep change:",K)}let _=TJ.get(K);if(_)return await _;let B=_z(()=>nR($,Z,{projectRoot:X,minify:J,cacheDir:Q,hash:K,cachePath:W,depsPath:U}));TJ.set(K,B);try{return await B}finally{TJ.delete(K)}}async function nR($,Z,Y){let{projectRoot:X,minify:J,cacheDir:Q,hash:G,cachePath:K,depsPath:W}=Y,U=l0(X,"bundle-tmp"),z=c0.join(U,`${G}.ts`),_=c0.join(U,"out",G);A1.mkdirSync(U,{recursive:!0}),A1.mkdirSync(_,{recursive:!0});let B=c0.dirname(Z),q=[],j=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,H=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,O;while((O=j.exec($))!==null){if(O[1])continue;if(O[2])O[2].split(",").forEach((F)=>{let A=F.split(":")[0].trim();if(A)q.push(A)});else if(O[3])q.push(O[3])}while((O=H.exec($))!==null){if(O[1])continue;q.push(O[2])}let V=q.length>0?`
|
|
814
814
|
export { ${q.join(", ")} }`:"";await Bun.write(z,$+V),console.log("[stx:bundler] bundling:",G,"from:",c0.basename(Z));let L=new Set;try{let F=await Bun.build({entrypoints:[z],outdir:_,target:"browser",format:"esm",minify:J,plugins:[pR(X,B,z,L)],define:{"process.env.NODE_ENV":J?'"production"':'"development"',...F1()},root:X});if(!F.success){let k=F.logs.filter((x)=>x.level==="error").map((x)=>x.message).join(", ");return console.warn("[stx:bundler] build failed:",k),$}let A="";for(let k of F.outputs){A=await k.text();break}let w=[];for(let k of A.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let x of k[1].split(",")){let y=x.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(y){w.push([y[2],y[1]]);continue}let b=x.trim();if(/^[A-Za-z_$][\w$]*$/.test(b))w.push([b,b])}let N=A.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];A=A.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let R=`__stxBundle_${G}`,E=w.map(([k,x])=>`${JSON.stringify(k)}: ${x}`).join(", "),M=w.map(([k])=>`var ${k} = undefined;`).join(`
|
|
815
815
|
`),I=w.map(([k])=>`${k} = ${R}[${JSON.stringify(k)}];`).join(`
|
|
816
816
|
`);if(A=`${N.join(`
|
|
@@ -822,13 +822,13 @@ return { ${E} };
|
|
|
822
822
|
})();
|
|
823
823
|
${I}`.trim(),console.log("[stx:bundler] bundled:",G,"output:",A.length,"bytes"),q.length>0&&w.length===0)return console.warn(`[stx:bundler] dropped every binding for ${c0.basename(Z)} (${G}); serving the unbundled source and not caching this result`),$;A1.mkdirSync(Q,{recursive:!0}),await Bun.write(K,A);let S=Array.from(L).map((k)=>{try{return{path:k,mtimeMs:A1.statSync(k).mtimeMs}}catch{return null}}).filter((k)=>k!==null);return await Bun.write(W,JSON.stringify({metadataVersion:zz,files:S})),A}catch(F){let A=F instanceof Error?F.message:String(F),w=F?.errors,N=Array.isArray(w)&&w.length>0?`
|
|
824
824
|
${w.map((R)=>`- ${R?.message??R}`).join(`
|
|
825
|
-
`)}`:"";return console.warn(`[stx:bundler] error: ${A}${N}`),$}finally{try{A1.rmSync(z,{force:!0}),A1.rmSync(_,{recursive:!0,force:!0})}catch{}}}var lR=5,zz=1,Wz,TJ,Uz;var X7=D(()=>{u4();J4();Wz=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];TJ=new Map,Uz=Symbol.for("stx.client-bundle-build-queue")});var Lz={}
|
|
825
|
+
`)}`:"";return console.warn(`[stx:bundler] error: ${A}${N}`),$}finally{try{A1.rmSync(z,{force:!0}),A1.rmSync(_,{recursive:!0,force:!0})}catch{}}}var lR=5,zz=1,Wz,TJ,Uz;var X7=D(()=>{u4();J4();Wz=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];TJ=new Map,Uz=Symbol.for("stx.client-bundle-build-queue")});var Lz={};$0(Lz,{renderVendorStyleTags:()=>G7,processClientScript:()=>l4,injectBrowserCoreAutoImports:()=>C6,generateServerDataBridge:()=>K7,generateBrowserAutoImportDestructuring:()=>Oz,generateAutoImportDestructuring:()=>s3,extractBridgeData:()=>m4,extractAndStripCssImports:()=>Q7});import S6 from"path";import J7 from"fs";function aR($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let Y=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Y)return null;return{pkg:Y[1],subpath:Y[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function sR($,Z){let Y=Z;while(!0){let X=S6.join(Y,"node_modules",$,"package.json");if(J7.existsSync(X))return S6.dirname(X);let J=S6.dirname(Y);if(J===Y)return null;Y=J}}function oR($,Z){if(!$||typeof $!=="object")return null;let Y=(J)=>{if(typeof J==="string")return J;if(J&&typeof J==="object"){if(typeof J.import==="string")return J.import;if(typeof J.default==="string")return J.default;if(typeof J.import==="object")return Y(J.import);if(typeof J.default==="object")return Y(J.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return Y($[Z]);let X=null;for(let J of Object.keys($)){let Q=J.indexOf("*");if(Q===-1)continue;let G=J.slice(0,Q),K=J.slice(Q+1);if(!Z.startsWith(G)||!Z.endsWith(K))continue;if(Z.length<G.length+K.length)continue;if(!X||G.length>X.prefix.length)X={pattern:J,prefix:G,suffix:K}}if(X){let J=Z.slice(X.prefix.length,Z.length-X.suffix.length),Q=Y($[X.pattern]);if(Q)return Q.replace("*",J)}return null}function tR($,Z){let Y=aR($);if(!Y||!Y.subpath)return null;let X=sR(Y.pkg,Z);if(!X)return null;let J;try{J=JSON.parse(J7.readFileSync(S6.join(X,"package.json"),"utf8"))}catch{return null}let Q=`.${Y.subpath}`,G=oR(J.exports,Q);if(!G)return null;let K=S6.resolve(X,G);return J7.existsSync(K)?K:null}function Q7($,Z){let Y=Z.filePath?S6.dirname(Z.filePath):Z.projectRoot||process.cwd(),X=Z.projectRoot||process.cwd(),J=new Set,Q=[];return{code:$.replace(rR,(K,W)=>{let U;try{if(W.startsWith("./")||W.startsWith("../")||W.startsWith("/")){if(U=W.startsWith("/")?W:S6.resolve(Y,W),!J7.existsSync(U))throw Error(`file not found: ${U}`)}else{let z=null;try{z=Bun.resolveSync(W,X)}catch{z=tR(W,X)}if(!z)throw Error(`could not resolve ${W} (Bun.resolveSync + exports fallback both failed)`);U=z}}catch(z){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(W)} (from ${Z.filePath||"<unknown>"}): ${z?.message||z}`),""}if(J.has(U))return"";J.add(U);try{let z=J7.readFileSync(U,"utf8");Q.push({source:W,resolvedPath:U,contents:z})}catch(z){console.warn(`[stx:vendor-css] could not read ${U}: ${z?.message||z}`)}return""}),styles:Q}}function eR($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function G7($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${eR(Z.source)}" data-stx-layer="vendor">
|
|
826
826
|
@layer vendor {
|
|
827
827
|
${Z.contents}
|
|
828
828
|
}
|
|
829
829
|
</style>`}).join(`
|
|
830
830
|
`)}
|
|
831
|
-
`}function
|
|
831
|
+
`}function C6($){let Z=new Set;for(let J of $.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let Q of J[1].split(",")){let G=Q.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(G)Z.add(G)}let Y=new Set;for(let J of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Y.add(J[1]);for(let J of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let Q of J[1].split(",")){let G=Q.trim().split(/[:=]/).pop()?.trim();if(G)Y.add(G)}let X=jz.filter((J)=>{if(Z.has(J)||Y.has(J))return!1;return new RegExp(`\\b${J}\\b`).test($)});if(X.length===0)return{code:$,imports:X};return{code:`import { ${X.join(", ")} } from '@stacksjs/browser'
|
|
832
832
|
${$}`,imports:X}}function YM($){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(!ZM.has(X[1]))Z.add(X[1]);return Array.from(Z)}function Hz($){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|@stacksjs\/stx|stx)['"]\s*;?\s*$/gm,G;while((G=Q.exec($))!==null){let W=G[1],U=G[2];if(G[0].includes("import type"))continue;W.split(",").map((_)=>_.trim().split(/\s+as\s+/)[0]).filter((_)=>_.length>0).forEach((_)=>{if(J.add(_),U==="stx"||U==="@stacksjs/stx")Z.add(_);else Y.add(_)}),X=X.replace(G[0],"// [auto-import processed]")}for(let W of $M){if(J.has(W))continue;if(new RegExp(`\\b${W}\\s*\\(`,"g").test(X))Z.add(W)}for(let W of jz){if(J.has(W))continue;if(new RegExp(`\\b${W}\\b`,"g").test(X))Y.add(W)}let K=YM(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 s3($,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
|
|
833
833
|
${Y.join(`
|
|
834
834
|
`)}
|
|
@@ -891,7 +891,7 @@ else {
|
|
|
891
891
|
// STX: auto-generated event bindings
|
|
892
892
|
${$.map((Y,X)=>KM(Y,X)).join(`
|
|
893
893
|
`)}`}function qz($){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 U=0;while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]==="`"&&U===0){G++;break}if(X[G]==="$"&&X[G+1]==="{"){U++,G+=2;continue}if(X[G]==="}"&&U>0){U--,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]!==`
|
|
894
|
-
`)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),U=W.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(U){let B=U[1];if(!B.startsWith("_")&&!Y.has(B))Z.push(B),Y.add(B);G+=U[0].length;continue}let z=W.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(z){z[1].split(",").forEach((B)=>{let q=B.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+=z[0].length;continue}let _=W.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(_){let B=_[1];if(!B.startsWith("_")&&!Y.has(B))Z.push(B),Y.add(B);G+=_[0].length;continue}}G++}return Z}function zM($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(B){let q;while((q=Y.exec(B))!==null){let j=q[0];if(!UM.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 U=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=U.exec($))!==null)X(Q[1]);let z=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=z.exec($))!==null)X(Q[1]);let _=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=_.exec($))!==null)X(Q[1]);return Z}async function l4($,Z={}){let Y=$,X="",J=!1,Q=[],G=Q7(Y,{filePath:Z.filePath,projectRoot:Z.projectRoot});Y=G.code;let K=G7(G.styles),W=
|
|
894
|
+
`)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),U=W.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(U){let B=U[1];if(!B.startsWith("_")&&!Y.has(B))Z.push(B),Y.add(B);G+=U[0].length;continue}let z=W.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(z){z[1].split(",").forEach((B)=>{let q=B.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+=z[0].length;continue}let _=W.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(_){let B=_[1];if(!B.startsWith("_")&&!Y.has(B))Z.push(B),Y.add(B);G+=_[0].length;continue}}G++}return Z}function zM($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(B){let q;while((q=Y.exec(B))!==null){let j=q[0];if(!UM.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 U=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=U.exec($))!==null)X(Q[1]);let z=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=z.exec($))!==null)X(Q[1]);let _=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=_.exec($))!==null)X(Q[1]);return Z}async function l4($,Z={}){let Y=$,X="",J=!1,Q=[],G=Q7(Y,{filePath:Z.filePath,projectRoot:Z.projectRoot});Y=G.code;let K=G7(G.styles),W=C6(Y);Y=W.code,Q=W.imports;let{hasUserImports:U,bundleClientScript:z}=await Promise.resolve().then(() => (X7(),Y7));if(U(Y))console.log("[stx:bundler] user imports detected, bundling..."),Y=await z(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),J=!0;if(Z.autoImports!==!1){let L=Hz(Y);Y=L.code,X=s3(L.stxImports,L.browserImports.filter((F)=>!Q.includes(F)))}if(X=`${K7(Y,Z.serverData)}${X}`,Y=l1(Y),!J&&c4(Z.attrs||""))Y=p4(Y);let _=WM(Z.eventBindings||[]),B=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(B)){let L=B.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${L?` ${L}`:""}`;return`${K}<script ${F}>
|
|
895
895
|
${X}${Y}
|
|
896
896
|
${_}
|
|
897
897
|
</script>`}let j=/\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|onMounted|onBeforeUnmount|onUnmounted|batch|untrack|peek)\s*(?:<[^>]*>)?\s*\(/.test($),H=/function __stx_setup_/.test(Y),O=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function V(L){let F=L.length>0?`
|
|
@@ -905,7 +905,7 @@ ${_}${F}
|
|
|
905
905
|
'use strict';
|
|
906
906
|
${X}${Y}
|
|
907
907
|
${_}
|
|
908
|
-
})()</script>`}var rR,$M,jz,ZM,QM,UM;var
|
|
908
|
+
})()</script>`}var rR,$M,jz,ZM,QM,UM;var b6=D(()=>{N0();rR=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;$M=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useFetch","useQuery","useMutation","useOptimistic","useId","useReactiveProp","useLocalStorage","useSessionStorage","useCookie","useWebSocket","useHead","useSeoMeta","definePageMeta","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","ref","reactive","computed","watch","watchEffect","watchMultiple","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","defineProps","withDefaults","defineEmits","defineExpose","defineSlots","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","registerStoresClient","useStore","action","createSelector","h","Fragment"],jz=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"];ZM=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"]);QM={left:0,middle:1,right:2};UM=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 jM($){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 HM($,Z){let Y=/[$A-Z_a-z][$\w]*/g,X;while((X=Y.exec($))!==null){let J=X[0],Q=$[X.index-1];if(BM.has(J))throw Error(`Potentially unsafe expression (matched /\\b${J}\\b/; identifier ${J}): ${Z}`);if(Q==="."&&wz.has(J))throw Error(`Potentially unsafe expression (matched /.${J}/; property ${J}): ${Z}`)}}function OM($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let X=Y[2];if(!wz.has(X))continue;let J=$.slice(0,Y.index).match(/\S(?=\s*$)/)?.[0],Q=$.slice(Y.index+Y[0].length).match(/^\s*(\S)/)?.[1];if(!((J==="{"||J===",")&&Q===":"))throw Error(`Potentially unsafe expression (bracket key ${Y[2]}): ${$}`)}}function o3($){let Z=$.trim(),Y=jM(Z);HM(Y,Z),OM(Z);for(let X of Az)if(X.test(Y))throw Error(`Potentially unsafe expression (matched /${X.source}/): ${Z}`);if(!Fz.allowBracketNotation&&qM.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function LM($){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("__")||Az.some((J)=>J.test(Y)))continue;if(X&&typeof X==="object"&&!Array.isArray(X))Z[Y]=EJ(X);else Z[Y]=X}return Z}function EJ($,Z=0){if(Z>=Fz.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((X)=>EJ(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]=EJ(J,Z+1);else Y[X]=J}return Y}function L0($,Z){try{let Y=LM(Z),X=Object.keys(Y),J=Object.values(Y);return M0($,X)(...J)}catch{return}}function R0($){try{return o3($),!0}catch{return!1}}function p0($,Z){try{let Y=L0($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function M0($,Z){let Y=o3($),X=/^[A-Za-z_$][\w$]*$/,J=[],Q=[];for(let U=0;U<Z.length;U++){let z=Z[U];if(!X.test(z))continue;if(Nz.has(z))continue;J.push(U),Q.push(z)}let G=(U)=>Function(...Q,...U,`
|
|
909
909
|
'use strict';
|
|
910
910
|
try {
|
|
911
911
|
return ${Y};
|
|
@@ -916,7 +916,7 @@ catch (e) {
|
|
|
916
916
|
}
|
|
917
917
|
throw e;
|
|
918
918
|
}
|
|
919
|
-
`),K=G([]);if(Q.length===Z.length)return Vz(K,Q,G);return Vz((...U)=>{let z=Array(J.length);for(let _=0;_<J.length;_++)z[_]=U[J[_]];return K(...z)},Q,G,(U)=>{K=G(U)})}function Vz($,Z,Y,X){let Q=/^(\w+) is not defined$/,G=$,K=[],W=new Set(Z);return(...U)=>{for(let z=0;z<=8;z++)try{return G(...U)}catch(_){let B=_ instanceof Error?_.message:"",q=Q.exec(B);if(!(_ instanceof ReferenceError)||!q)return;let j=q[1];if(W.has(j)||Nz.has(j))return;W.add(j),K.push(j),G=Y(K),X?.(K)}return}}function t3($){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 _M,Fz,Az,BM,wz,qM,Nz;var i0=D(()=>{_M={maxSanitizeDepth:10,allowBracketNotation:!1},Fz={..._M},Az=[/\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/],BM=new Set(["eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this"]),wz=new Set(["__proto__","constructor","prototype"]),qM=/[\w)\]]\s*\[\s*['"]/;Nz=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"])});function IJ(){Rz=0,e3.clear()}function W7($,Z){let Y=Rz++,X=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return e3.set(X,{type:$,expression:Z}),X}function DJ(){let $={};for(let[Z,Y]of e3)$[Z]={type:Y.type,expression:Y.expression};return $}function VM($){let Z={},Y=/<!--__STX_(EXPR|COND|RAW)_(\d+)__-->/g,X;while((X=Y.exec($))!==null){let J=X[0],Q=X[1].toLowerCase(),G=e3.get(J);Z[J]={type:Q,expression:G?.expression||""}}return Z}function $Z($,Z){let Y=$;for(let[X,J]of Z)Y=Y.split(X).join(J);return Y}function L$($){return $.includes("<!--__STX_")}var Rz=0,e3;var U7=D(()=>{e3=new Map});function Dz($,Z,Y,X){Y.lastIndex=Z;let J=Y.exec($);if(!J||J.index!==Z)return-1;X.lastIndex=Y.lastIndex;let Q=X.exec($);if(!Q)return-1;return Q.index+Q[0].length}function i4($,Z){return Dz($,Z,Mz,Tz)}function V$($,Z){return Dz($,Z,Ez,Iz)}function z7($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function FM($,Z){if($.startsWith("<!--",Z)){let Y=z7($,Z);return Y===-1?$.length:Y}for(let[Y,X]of[[Mz,Tz],[Ez,Iz]]){Y.lastIndex=Z;let J=Y.exec($);if(!J||J.index!==Z)continue;X.lastIndex=Y.lastIndex;let Q=X.exec($);return Q?Q.index+Q[0].length:$.length}return-1}function kJ($,Z){let Y=[],X=0,J=$.length,Q=!1,G=null;while(X<J){let K=$[X];if(Q){if(G){if(K===G)G=null}else if(K==='"'||K==="'")G=K;else if(K===">")Q=!1;X++;continue}if(K!=="<"){X++;continue}let W=Z($,X);if(W>X){Y.push({start:X,end:W,token:$.slice(X,W)}),X=W;continue}let U=FM($,X);if(U>X){X=U;continue}if(/^<\/?[a-zA-Z]/.test($.slice(X,X+2)))Q=!0;X++}return Y}function Q4($,Z,Y){let X=kJ($,Z);if(X.length===0)return{output:$,tokens:[]};let J=X.map((K)=>K.token),Q="",G=0;for(let K=0;K<X.length;K++){let W=X[K];Q+=$.slice(G,W.start),Q+=Y(W.token,K),G=W.end}return Q+=$.slice(G),{output:Q,tokens:J}}function n4($){let{output:Z,tokens:Y}=Q4($,i4,(X,J)=>`\x00STX_SCRIPT_${J}\x00`);return{output:Z,scripts:Y}}function _7($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,X)=>Z[+X]??"")}var Mz,Tz,Ez,Iz;var C6=D(()=>{Mz=/<script\b[^>]*>/iy,Tz=/<\/script\s*>/ig,Ez=/<style\b[^>]*>/iy,Iz=/<\/style\s*>/ig});var j7={};e(j7,{usesSignalsInScript:()=>b6,unescapeHtml:()=>ZZ,registerFilters:()=>Cz,registerFilter:()=>SJ,processExpressions:()=>d1,interpolateScriptsInTemplate:()=>Pz,interpolateScriptExpressions:()=>q7,getAllFilters:()=>CJ,evaluateExpression:()=>G1,escapeHtml:()=>v0,defaultFilters:()=>F$,clearCustomFilters:()=>bz,applyFilters:()=>bJ});function AM($){let Z=kz.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),kz.set($,Z)}return Z.lastIndex=0,Z}function SJ($,Z){if($ in F$)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);B7[$]=Z}function Cz($){for(let[Z,Y]of Object.entries($))SJ(Z,Y)}function CJ(){return{...F$,...B7}}function bz(){for(let $ of Object.keys(B7))delete B7[$]}function v0($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function b6($){let{scripts:Z}=n4($);for(let Y of Z){let X=Y.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!X||/\bserver\b|\bsrc\s*=/.test(X[1]))continue;let J=X[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(J))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function Sz($,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 U=0;U<X.length;U++){let z=X[U];if(!Q&&z==="`"){Q=!0,G=0;continue}if(Q){if(z==="`"&&G===0){Q=!1;continue}if(z==="$"&&X[U+1]==="{"){G++,U++,J+=" ";continue}if(z==="}"&&G>0){G--;continue}if(G>0){J+=z;continue}continue}J+=z}X=J;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,W;while((W=K.exec(X))!==null){let U=W[1];if(!X.substring(0,W.index).trimEnd().endsWith(".")){if(!Y.includes(U)&&!(U in Z))return!1}}return!0}function q7($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(X,J)=>{try{let Q=G1(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=G1(J,Z);if(G===void 0)return X;return JSON.stringify(G)}catch{return X}}),Y}function Pz($,Z,Y={}){let{output:X,scripts:J}=n4($),Q=J.map((G)=>{let K=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),W=G.match(/^<script\b[^>]*>/i),U=G.search(/<\/script\s*>$/i);if(!K||!W||U===-1)return G;let z=K[1],_=K[2];if(/\bsrc\s*=/.test(z))return G;if(/\bdata-raw\b/.test(z))return G;if(/\btype\s*=\s*["']application\/json["']/.test(z))return G;if(Y.skipServer&&/\bserver\b/.test(z))return G;let B=q7(_,Z);return W[0]+B+G.slice(U)});return _7(X,Q)}function d1($,Z,Y,X){let J=$,Q=(B,q)=>{let j=V$(B,q);if(j===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(B.slice(q,j))?-1:j},G=(B,q,j,H)=>{let O=j.length,{output:V,tokens:L}=Q4(B,q,(F,A)=>H(O+A));return j.push(...L),V},K=[];J=G(J,Q,K,(B)=>`<!--__STX_STYLE_${B}__-->`);let W=[];J=G(J,i4,W,(B)=>`<!--__STX_SCRIPT_EXPR_${B}__-->`);let U=X?.forceSignals===!0||Z?.__stx_force_signals===!0||Array.isArray(Z?.__stx_client_signal_names)||b6($),z=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),_=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);J=J.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(B,q,j)=>{try{let H=G1(q,Z);return H!==void 0&&H!==null?String(H):""}catch(H){let O=H instanceof Error?H.message:String(H);return T0("Expression",`Error evaluating: {{{ ${q.trim()}}}}: ${O}`,Y,$,j,B)}}),J=J.replace(/\{!!([\s\S]*?)!!\}/g,(B,q,j)=>{try{let H=G1(q,Z);if(H===void 0&&Z.__stx_buildMode==="compile")return W7("raw",q.trim());return H!==void 0&&H!==null?String(H):""}catch(H){if(Z.__stx_buildMode==="compile")return W7("raw",q.trim());let O=H instanceof Error?H.message:String(H);return T0("Expression",`Error evaluating: {!! ${q.trim()} !!}: ${O}`,Y,$,j,B)}}),J=G(J,i4,W,(B)=>`<!--__STX_SCRIPT_EXPR_${B}__-->`),J=G(J,Q,K,(B)=>`<!--__STX_STYLE_${B}__-->`),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(B,q,j)=>{let H=q.trim();if(_.has(H))return B;let O=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],V=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,F=H.match(V)?.[1],A=F&&((F in Z)||O.includes(F)),w=Boolean(F&&z.has(F)),N=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=H.match(N),E=R&&!O.includes(R[1])&&!(R[1]in Z);if(/^__[A-Z_]+__$/.test(H))return"";try{let M=G1(q,Z);if(w)return B;if(U&&!Sz(H,Z))return B;if(M===void 0&&Z.__stx_buildMode==="compile"&&!U)return W7("expr",H);return M!==void 0&&M!==null?v0(String(M)):""}catch(M){if(w)return B;if(U&&!Sz(H,Z))return B;if(E)return B;let I=M instanceof Error?M.message:String(M);return T0("Expression",`Error evaluating: {{ ${H} }}: ${I}`,Y,$,j,B)}});for(let B=0;B<W.length;B++)J=J.replace(`<!--__STX_SCRIPT_EXPR_${B}__-->`,()=>W[B]);for(let B=0;B<K.length;B++)J=J.replace(`<!--__STX_STYLE_${B}__-->`,()=>K[B]);return J}function bJ($,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]||F$[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(CJ()).join(", ")}`);let W=[];if(J.startsWith(":")){let U=J.match(/^:([^|\s]+)/);if(U){let z=U[1].trim();try{let _=Number(z);W=[Number.isNaN(_)?z:_]}catch{W=[z]}J=J.substring(U[0].length).trim()}}else if(J.startsWith("(")){let U=1,z=1;while(U>0&&z<J.length){if(J[z]==="(")U++;if(J[z]===")")U--;z++}if(U===0){let _=J.substring(1,z-1).trim();if(_)try{if(_.startsWith("{")&&_.endsWith("}"))W=[G1(`(${_})`,Y,!0)];else{let B=[],q="",j=null,H=0,O=0,V=0,L=!1;for(let F=0;F<_.length;F++){let A=_[F];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==="{")V++;else if(A==="}")V--;if(A===","&&H===0&&O===0&&V===0){B.push(q),q="";continue}q+=A}if(q)B.push(q);W=B.map((F)=>{let A=F.trim();return G1(A,Y,!0)})}}catch{W=[_]}J=J.substring(z).trim()}}try{X=K(X,Y,...W)}catch(U){let z=U instanceof Error?U.message:String(U);throw Error(`Error applying filter '${G}': ${z}`)}if(J.startsWith("|"))J=J.substring(1).trim();else break}return X}function wM($){let Z=!1,Y="",X=0,J=0,Q=0,G=!1;for(let K=0;K<$.length;K++){let W=$[K],U=$[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==="$"&&U==="{"){let z=1;K+=2;while(K<$.length&&z>0){if($[K]==="{")z++;else if($[K]==="}")z--;if(z>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(U==="|"){K++;continue}if(U==="="){K++;continue}return K}}return-1}function G1($,Z,Y=!1){try{let X=$.trim(),J=wM(X);if(J>0){let Q=X.substring(0,J).trim(),G=X.substring(J+1).trim(),K=G1(Q,Z,!0);return bJ(K,G,Z)}if(!R0(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 M0(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=NM(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 NM($,Z){let Y=null;for(let J of Z){if(J===$)continue;let Q=RM($,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 RM($,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 ZZ($){if(!$)return"";return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}var B7,kz,F$;var $1=D(()=>{i0();N0();U7();C6();B7={},kz=new Map;F$={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 v0(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,U])=>{K=K.replace(AM(W),String(U))}),K},t:($,Z,Y={})=>{return F$.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}}});function A$($="const",Z=[],Y){let X=Z.length?YZ.filter((J)=>!Z.includes(J)):YZ;if(Y!==void 0)X=X.filter((J)=>{let Q=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${Q}(?![\\w$])`).test(Y)});return`${$} { ${X.join(", ")} } = window.stx;`}var YZ,yz;var H7=D(()=>{YZ=["batch","computed","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","navigate","nextTick","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","provide","reactive","ref","registerStoresClient","state","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","withDefaults"],yz=["onMount","onDestroy"]});class O7{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 N$($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!w$.has(Y)){if(w$.size>=MM){let X=w$.keys().next().value;if(X)w$.delete(X)}w$.set(Y,new RegExp($,Z))}return w$.get(Y)}class xz{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 U=`${Y}:${W}`,z=J.get(U);if(!z){if(J.size>=Q){let _=J.keys().next().value;if(_)J.delete(_)}z=Function(...Z,`
|
|
919
|
+
`),K=G([]);if(Q.length===Z.length)return Vz(K,Q,G);return Vz((...U)=>{let z=Array(J.length);for(let _=0;_<J.length;_++)z[_]=U[J[_]];return K(...z)},Q,G,(U)=>{K=G(U)})}function Vz($,Z,Y,X){let Q=/^(\w+) is not defined$/,G=$,K=[],W=new Set(Z);return(...U)=>{for(let z=0;z<=8;z++)try{return G(...U)}catch(_){let B=_ instanceof Error?_.message:"",q=Q.exec(B);if(!(_ instanceof ReferenceError)||!q)return;let j=q[1];if(W.has(j)||Nz.has(j))return;W.add(j),K.push(j),G=Y(K),X?.(K)}return}}function t3($){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 _M,Fz,Az,BM,wz,qM,Nz;var i0=D(()=>{_M={maxSanitizeDepth:10,allowBracketNotation:!1},Fz={..._M},Az=[/\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/],BM=new Set(["eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this"]),wz=new Set(["__proto__","constructor","prototype"]),qM=/[\w)\]]\s*\[\s*['"]/;Nz=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"])});function IJ(){Rz=0,e3.clear()}function W7($,Z){let Y=Rz++,X=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return e3.set(X,{type:$,expression:Z}),X}function DJ(){let $={};for(let[Z,Y]of e3)$[Z]={type:Y.type,expression:Y.expression};return $}function VM($){let Z={},Y=/<!--__STX_(EXPR|COND|RAW)_(\d+)__-->/g,X;while((X=Y.exec($))!==null){let J=X[0],Q=X[1].toLowerCase(),G=e3.get(J);Z[J]={type:Q,expression:G?.expression||""}}return Z}function $Z($,Z){let Y=$;for(let[X,J]of Z)Y=Y.split(X).join(J);return Y}function L$($){return $.includes("<!--__STX_")}var Rz=0,e3;var U7=D(()=>{e3=new Map});function Dz($,Z,Y,X){Y.lastIndex=Z;let J=Y.exec($);if(!J||J.index!==Z)return-1;X.lastIndex=Y.lastIndex;let Q=X.exec($);if(!Q)return-1;return Q.index+Q[0].length}function i4($,Z){return Dz($,Z,Mz,Tz)}function V$($,Z){return Dz($,Z,Ez,Iz)}function z7($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function FM($,Z){if($.startsWith("<!--",Z)){let Y=z7($,Z);return Y===-1?$.length:Y}for(let[Y,X]of[[Mz,Tz],[Ez,Iz]]){Y.lastIndex=Z;let J=Y.exec($);if(!J||J.index!==Z)continue;X.lastIndex=Y.lastIndex;let Q=X.exec($);return Q?Q.index+Q[0].length:$.length}return-1}function kJ($,Z){let Y=[],X=0,J=$.length,Q=!1,G=null;while(X<J){let K=$[X];if(Q){if(G){if(K===G)G=null}else if(K==='"'||K==="'")G=K;else if(K===">")Q=!1;X++;continue}if(K!=="<"){X++;continue}let W=Z($,X);if(W>X){Y.push({start:X,end:W,token:$.slice(X,W)}),X=W;continue}let U=FM($,X);if(U>X){X=U;continue}if(/^<\/?[a-zA-Z]/.test($.slice(X,X+2)))Q=!0;X++}return Y}function Q4($,Z,Y){let X=kJ($,Z);if(X.length===0)return{output:$,tokens:[]};let J=X.map((K)=>K.token),Q="",G=0;for(let K=0;K<X.length;K++){let W=X[K];Q+=$.slice(G,W.start),Q+=Y(W.token,K),G=W.end}return Q+=$.slice(G),{output:Q,tokens:J}}function n4($){let{output:Z,tokens:Y}=Q4($,i4,(X,J)=>`\x00STX_SCRIPT_${J}\x00`);return{output:Z,scripts:Y}}function _7($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,X)=>Z[+X]??"")}var Mz,Tz,Ez,Iz;var P6=D(()=>{Mz=/<script\b[^>]*>/iy,Tz=/<\/script\s*>/ig,Ez=/<style\b[^>]*>/iy,Iz=/<\/style\s*>/ig});var j7={};$0(j7,{usesSignalsInScript:()=>y6,unescapeHtml:()=>ZZ,registerFilters:()=>Cz,registerFilter:()=>SJ,processExpressions:()=>d1,interpolateScriptsInTemplate:()=>Pz,interpolateScriptExpressions:()=>q7,getAllFilters:()=>CJ,evaluateExpression:()=>G1,escapeHtml:()=>v0,defaultFilters:()=>F$,clearCustomFilters:()=>bz,applyFilters:()=>bJ});function AM($){let Z=kz.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),kz.set($,Z)}return Z.lastIndex=0,Z}function SJ($,Z){if($ in F$)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);B7[$]=Z}function Cz($){for(let[Z,Y]of Object.entries($))SJ(Z,Y)}function CJ(){return{...F$,...B7}}function bz(){for(let $ of Object.keys(B7))delete B7[$]}function v0($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function y6($){let{scripts:Z}=n4($);for(let Y of Z){let X=Y.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!X||/\bserver\b|\bsrc\s*=/.test(X[1]))continue;let J=X[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(J))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function Sz($,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 U=0;U<X.length;U++){let z=X[U];if(!Q&&z==="`"){Q=!0,G=0;continue}if(Q){if(z==="`"&&G===0){Q=!1;continue}if(z==="$"&&X[U+1]==="{"){G++,U++,J+=" ";continue}if(z==="}"&&G>0){G--;continue}if(G>0){J+=z;continue}continue}J+=z}X=J;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,W;while((W=K.exec(X))!==null){let U=W[1];if(!X.substring(0,W.index).trimEnd().endsWith(".")){if(!Y.includes(U)&&!(U in Z))return!1}}return!0}function q7($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(X,J)=>{try{let Q=G1(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=G1(J,Z);if(G===void 0)return X;return JSON.stringify(G)}catch{return X}}),Y}function Pz($,Z,Y={}){let{output:X,scripts:J}=n4($),Q=J.map((G)=>{let K=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),W=G.match(/^<script\b[^>]*>/i),U=G.search(/<\/script\s*>$/i);if(!K||!W||U===-1)return G;let z=K[1],_=K[2];if(/\bsrc\s*=/.test(z))return G;if(/\bdata-raw\b/.test(z))return G;if(/\btype\s*=\s*["']application\/json["']/.test(z))return G;if(Y.skipServer&&/\bserver\b/.test(z))return G;let B=q7(_,Z);return W[0]+B+G.slice(U)});return _7(X,Q)}function d1($,Z,Y,X){let J=$,Q=(B,q)=>{let j=V$(B,q);if(j===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(B.slice(q,j))?-1:j},G=(B,q,j,H)=>{let O=j.length,{output:V,tokens:L}=Q4(B,q,(F,A)=>H(O+A));return j.push(...L),V},K=[];J=G(J,Q,K,(B)=>`<!--__STX_STYLE_${B}__-->`);let W=[];J=G(J,i4,W,(B)=>`<!--__STX_SCRIPT_EXPR_${B}__-->`);let U=X?.forceSignals===!0||Z?.__stx_force_signals===!0||Array.isArray(Z?.__stx_client_signal_names)||y6($),z=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),_=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);J=J.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(B,q,j)=>{try{let H=G1(q,Z);return H!==void 0&&H!==null?String(H):""}catch(H){let O=H instanceof Error?H.message:String(H);return T0("Expression",`Error evaluating: {{{ ${q.trim()}}}}: ${O}`,Y,$,j,B)}}),J=J.replace(/\{!!([\s\S]*?)!!\}/g,(B,q,j)=>{try{let H=G1(q,Z);if(H===void 0&&Z.__stx_buildMode==="compile")return W7("raw",q.trim());return H!==void 0&&H!==null?String(H):""}catch(H){if(Z.__stx_buildMode==="compile")return W7("raw",q.trim());let O=H instanceof Error?H.message:String(H);return T0("Expression",`Error evaluating: {!! ${q.trim()} !!}: ${O}`,Y,$,j,B)}}),J=G(J,i4,W,(B)=>`<!--__STX_SCRIPT_EXPR_${B}__-->`),J=G(J,Q,K,(B)=>`<!--__STX_STYLE_${B}__-->`),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(B,q,j)=>{let H=q.trim();if(_.has(H))return B;let O=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],V=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,F=H.match(V)?.[1],A=F&&((F in Z)||O.includes(F)),w=Boolean(F&&z.has(F)),N=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=H.match(N),E=R&&!O.includes(R[1])&&!(R[1]in Z);if(/^__[A-Z_]+__$/.test(H))return"";try{let M=G1(q,Z);if(w)return B;if(U&&!Sz(H,Z))return B;if(M===void 0&&Z.__stx_buildMode==="compile"&&!U)return W7("expr",H);return M!==void 0&&M!==null?v0(String(M)):""}catch(M){if(w)return B;if(U&&!Sz(H,Z))return B;if(E)return B;let I=M instanceof Error?M.message:String(M);return T0("Expression",`Error evaluating: {{ ${H} }}: ${I}`,Y,$,j,B)}});for(let B=0;B<W.length;B++)J=J.replace(`<!--__STX_SCRIPT_EXPR_${B}__-->`,()=>W[B]);for(let B=0;B<K.length;B++)J=J.replace(`<!--__STX_STYLE_${B}__-->`,()=>K[B]);return J}function bJ($,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]||F$[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(CJ()).join(", ")}`);let W=[];if(J.startsWith(":")){let U=J.match(/^:([^|\s]+)/);if(U){let z=U[1].trim();try{let _=Number(z);W=[Number.isNaN(_)?z:_]}catch{W=[z]}J=J.substring(U[0].length).trim()}}else if(J.startsWith("(")){let U=1,z=1;while(U>0&&z<J.length){if(J[z]==="(")U++;if(J[z]===")")U--;z++}if(U===0){let _=J.substring(1,z-1).trim();if(_)try{if(_.startsWith("{")&&_.endsWith("}"))W=[G1(`(${_})`,Y,!0)];else{let B=[],q="",j=null,H=0,O=0,V=0,L=!1;for(let F=0;F<_.length;F++){let A=_[F];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==="{")V++;else if(A==="}")V--;if(A===","&&H===0&&O===0&&V===0){B.push(q),q="";continue}q+=A}if(q)B.push(q);W=B.map((F)=>{let A=F.trim();return G1(A,Y,!0)})}}catch{W=[_]}J=J.substring(z).trim()}}try{X=K(X,Y,...W)}catch(U){let z=U instanceof Error?U.message:String(U);throw Error(`Error applying filter '${G}': ${z}`)}if(J.startsWith("|"))J=J.substring(1).trim();else break}return X}function wM($){let Z=!1,Y="",X=0,J=0,Q=0,G=!1;for(let K=0;K<$.length;K++){let W=$[K],U=$[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==="$"&&U==="{"){let z=1;K+=2;while(K<$.length&&z>0){if($[K]==="{")z++;else if($[K]==="}")z--;if(z>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(U==="|"){K++;continue}if(U==="="){K++;continue}return K}}return-1}function G1($,Z,Y=!1){try{let X=$.trim(),J=wM(X);if(J>0){let Q=X.substring(0,J).trim(),G=X.substring(J+1).trim(),K=G1(Q,Z,!0);return bJ(K,G,Z)}if(!R0(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 M0(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=NM(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 NM($,Z){let Y=null;for(let J of Z){if(J===$)continue;let Q=RM($,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 RM($,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 ZZ($){if(!$)return"";return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}var B7,kz,F$;var $1=D(()=>{i0();N0();U7();P6();B7={},kz=new Map;F$={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 v0(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,U])=>{K=K.replace(AM(W),String(U))}),K},t:($,Z,Y={})=>{return F$.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}}});function A$($="const",Z=[],Y){let X=Z.length?YZ.filter((J)=>!Z.includes(J)):YZ;if(Y!==void 0)X=X.filter((J)=>{let Q=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${Q}(?![\\w$])`).test(Y)});return`${$} { ${X.join(", ")} } = window.stx;`}var YZ,yz;var H7=D(()=>{YZ=["batch","computed","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","navigate","nextTick","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","provide","reactive","ref","registerStoresClient","state","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","withDefaults"],yz=["onMount","onDestroy"]});class O7{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 N$($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!w$.has(Y)){if(w$.size>=MM){let X=w$.keys().next().value;if(X)w$.delete(X)}w$.set(Y,new RegExp($,Z))}return w$.get(Y)}class xz{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 U=`${Y}:${W}`,z=J.get(U);if(!z){if(J.size>=Q){let _=J.keys().next().value;if(_)J.delete(_)}z=Function(...Z,`
|
|
920
920
|
'use strict';
|
|
921
921
|
try {
|
|
922
922
|
return ${W};
|
|
@@ -927,7 +927,7 @@ catch (e) {
|
|
|
927
927
|
}
|
|
928
928
|
throw e;
|
|
929
929
|
}
|
|
930
|
-
`),J.set(U,z)}return z(...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 vz{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 TM(){if(!PJ)PJ=new vz;return PJ}var w$,MM=500,md,PJ=null,c1;var r4=D(()=>{w$=new Map;md=new xz;c1=new Proxy({},{get($,Z){return TM()[Z]}})});var T;var L7=D(()=>{T={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}});var GZ={};e(GZ,{resetCssCache:()=>bM,resetCrosswindCache:()=>PM,rebuildCrosswindCSS:()=>F7,loadCrosswindConfig:()=>gJ,loadCrosswind:()=>fJ,injectCrosswindCSS:()=>y0,getCachedCSS:()=>yM,generateCrosswindCSS:()=>QZ,extractClassNames:()=>JZ,buildCrosswindCSS:()=>M$});import F0 from"path";import{hasLocalConfig as EM}from"bunfig/discovery";function vJ($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function yJ($,Z){if(A4.has($))A4.delete($);else if(A4.size>=IM)A4.delete(A4.keys().next().value);A4.set($,Z)}async function DM($){if(!a4)return null;try{let Z=Bun.file(F0.join(a4,`cw-${vJ($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function kM($,Z){if(!a4)return;try{if(!fs.existsSync(a4))fs.mkdirSync(a4,{recursive:!0});await Bun.write(F0.join(a4,`cw-${vJ($)}.css`),Z)}catch{}}async function fz($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig,extractClasses:Z.extractClasses}}catch{}return null}function SM(){let $=[],Z=process.cwd();while(Z!==F0.dirname(Z))$.push(F0.join(Z,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(F0.join(Z,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(F0.join(Z,"pantry","@cwcss","crosswind","dist","index.js")),$.push(F0.join(Z,"pantry","@cwcss","crosswind","src","index.ts")),$.push(F0.join(Z,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(F0.join(Z,"pantry","@stacksjs","crosswind","dist","index.js")),Z=F0.dirname(Z);return $}function CM(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"";if(Z){let Y=[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(...Y)}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 fJ(){if(xJ)return G4;xJ=!0;try{let $=async(J)=>{for(let Q of J){if(!await Bun.file(Q).exists())continue;let G=await fz(Q);if(G){if(!process.env.STACKS_DEV_QUIET)console.log(`${T.green}[Crosswind]${T.reset} CSS engine loaded from ${F0.dirname(F0.dirname(Q))}`);return G}}return null};if(process.env.CROSSWIND_SRC){let J=F0.resolve(process.env.CROSSWIND_SRC),Q=await $([J]);if(!Q)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${J}`);return G4=Q,G4}let Z=await $(SM());if(Z)return G4=Z,G4;let Y=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let J of Y){let Q=await fz(J);if(Q){if(G4=Q,!process.env.STACKS_DEV_QUIET)console.log(`${T.green}[Crosswind]${T.reset} CSS engine loaded`);return G4}}let X=await $(CM());if(X)return G4=X,G4;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${T.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${T.reset}`),console.warn(`${T.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${T.reset}`),null}}function bM(){A4.clear()}function PM(){G4=null,xJ=!1,p1=null,V7="",A4.clear(),XZ=null}async function gJ($){try{if(!EM({name:"crosswind",cwd:$}))return null;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);if(!process.env.STACKS_DEV_QUIET)console.log(`${T.green}[Crosswind]${T.reset} Loaded config from ${X||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${T.yellow}[Crosswind]${T.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}async function M$($){if(R$)return V7;R$=!0;try{let Z=await fJ();if(!Z||!Z.build)return R$=!1,"";if(!p1)p1=await gJ($);if(!p1)return R$=!1,"";let Y=Z.defaultConfig?.theme||{},X=p1.theme||{},J={...Z.defaultConfig,...p1,theme:{...Y,...X,extend:{...Y.extend||{},...X.extend||{}}}},Q=performance.now(),G=await Z.build(J),K=performance.now()-Q;if(V7=G.css,console.log(`${T.cyan}[Crosswind]${T.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),U=F0.dirname(W);if(!fs.existsSync(U))fs.mkdirSync(U,{recursive:!0});await Bun.write(W,G.css)}return R$=!1,G.css}catch(Z){return console.error(`${T.red}[Crosswind]${T.reset} Build error:`,Z),R$=!1,V7}}async function F7($){p1=null,await M$($)}function yM(){return V7}function JZ($){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 QZ($,Z){try{let Y=await fJ();if(!Y)return"";let X=typeof Y.extractClasses==="function"?Y.extractClasses($):JZ($);if(X.size===0)return"";let J=Z?F0.resolve(Z):process.cwd();if(!a4)a4=l0(J,"cache");let Q=[...X].sort().join(" "),G=`${XZ||"default"}::${Q}`,K=A4.get(G);if(K!==void 0)return yJ(G,K),K;let W=await DM(G);if(W!==null)return yJ(G,W),W;if(!p1){let w=null;try{let{loadStxConfig:N}=await Promise.resolve().then(() => (n0(),KZ)),R=await N(J);if(R.css)if(typeof R.css==="string"){let E=F0.isAbsolute(R.css)?R.css:F0.resolve(J,R.css);if(await Bun.file(E).exists()){let M=await import(E);w=M.default||M,console.log(`${T.green}[Crosswind]${T.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(w={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let E=F0.isAbsolute(R.css.config)?R.css.config:F0.resolve(J,R.css.config);if(await Bun.file(E).exists()){let M=await import(E);w={...M.default||M,...w}}}console.log(`${T.green}[Crosswind]${T.reset} Using inline CSS config from stx.config.ts`)}}catch{}p1=w||await gJ(J);try{XZ=vJ(JSON.stringify(p1??{}))}catch{XZ="unhashable"}}let U=Y.defaultConfig||Y.config,z=p1||{},_=U.theme||{},q=(z.theme||{}).extend||{},j={..._};if(Object.keys(q).length>0)j.extend=q;let H=[...U.safelist||[],...z.safelist||[]],O={...U,...z,content:[],output:"",preflight:!0,minify:!1,theme:j,safelist:H},V=new Y.CSSGenerator(O);for(let w of H)V.generate(w);for(let w of X)V.generate(w);let L=V.toCSS(!0,!1),F=O.shortcuts||z.shortcuts||{};for(let[w,N]of Object.entries(F)){if(!X.has(w)&&!H.includes(w))continue;let R=N.split(/\s+/).filter(Boolean);for(let E of R)V.generate(E)}L=V.toCSS(!0,!1);let A=L.split(`
|
|
930
|
+
`),J.set(U,z)}return z(...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 vz{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 TM(){if(!PJ)PJ=new vz;return PJ}var w$,MM=500,ld,PJ=null,c1;var r4=D(()=>{w$=new Map;ld=new xz;c1=new Proxy({},{get($,Z){return TM()[Z]}})});var T;var L7=D(()=>{T={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}});var GZ={};$0(GZ,{resetCssCache:()=>bM,resetCrosswindCache:()=>PM,rebuildCrosswindCSS:()=>F7,loadCrosswindConfig:()=>gJ,loadCrosswind:()=>fJ,injectCrosswindCSS:()=>y0,getCachedCSS:()=>yM,generateCrosswindCSS:()=>QZ,extractClassNames:()=>JZ,buildCrosswindCSS:()=>M$});import F0 from"path";import{hasLocalConfig as EM}from"bunfig/discovery";function vJ($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function yJ($,Z){if(A4.has($))A4.delete($);else if(A4.size>=IM)A4.delete(A4.keys().next().value);A4.set($,Z)}async function DM($){if(!a4)return null;try{let Z=Bun.file(F0.join(a4,`cw-${vJ($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function kM($,Z){if(!a4)return;try{if(!fs.existsSync(a4))fs.mkdirSync(a4,{recursive:!0});await Bun.write(F0.join(a4,`cw-${vJ($)}.css`),Z)}catch{}}async function fz($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig,extractClasses:Z.extractClasses}}catch{}return null}function SM(){let $=[],Z=process.cwd();while(Z!==F0.dirname(Z))$.push(F0.join(Z,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(F0.join(Z,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(F0.join(Z,"pantry","@cwcss","crosswind","dist","index.js")),$.push(F0.join(Z,"pantry","@cwcss","crosswind","src","index.ts")),$.push(F0.join(Z,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(F0.join(Z,"pantry","@stacksjs","crosswind","dist","index.js")),Z=F0.dirname(Z);return $}function CM(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"";if(Z){let Y=[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(...Y)}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 fJ(){if(xJ)return G4;xJ=!0;try{let $=async(J)=>{for(let Q of J){if(!await Bun.file(Q).exists())continue;let G=await fz(Q);if(G){if(!process.env.STACKS_DEV_QUIET)console.log(`${T.green}[Crosswind]${T.reset} CSS engine loaded from ${F0.dirname(F0.dirname(Q))}`);return G}}return null};if(process.env.CROSSWIND_SRC){let J=F0.resolve(process.env.CROSSWIND_SRC),Q=await $([J]);if(!Q)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${J}`);return G4=Q,G4}let Z=await $(SM());if(Z)return G4=Z,G4;let Y=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let J of Y){let Q=await fz(J);if(Q){if(G4=Q,!process.env.STACKS_DEV_QUIET)console.log(`${T.green}[Crosswind]${T.reset} CSS engine loaded`);return G4}}let X=await $(CM());if(X)return G4=X,G4;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${T.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${T.reset}`),console.warn(`${T.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${T.reset}`),null}}function bM(){A4.clear()}function PM(){G4=null,xJ=!1,p1=null,V7="",A4.clear(),XZ=null}async function gJ($){try{if(!EM({name:"crosswind",cwd:$}))return null;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);if(!process.env.STACKS_DEV_QUIET)console.log(`${T.green}[Crosswind]${T.reset} Loaded config from ${X||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${T.yellow}[Crosswind]${T.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}async function M$($){if(R$)return V7;R$=!0;try{let Z=await fJ();if(!Z||!Z.build)return R$=!1,"";if(!p1)p1=await gJ($);if(!p1)return R$=!1,"";let Y=Z.defaultConfig?.theme||{},X=p1.theme||{},J={...Z.defaultConfig,...p1,theme:{...Y,...X,extend:{...Y.extend||{},...X.extend||{}}}},Q=performance.now(),G=await Z.build(J),K=performance.now()-Q;if(V7=G.css,console.log(`${T.cyan}[Crosswind]${T.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),U=F0.dirname(W);if(!fs.existsSync(U))fs.mkdirSync(U,{recursive:!0});await Bun.write(W,G.css)}return R$=!1,G.css}catch(Z){return console.error(`${T.red}[Crosswind]${T.reset} Build error:`,Z),R$=!1,V7}}async function F7($){p1=null,await M$($)}function yM(){return V7}function JZ($){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 QZ($,Z){try{let Y=await fJ();if(!Y)return"";let X=typeof Y.extractClasses==="function"?Y.extractClasses($):JZ($);if(X.size===0)return"";let J=Z?F0.resolve(Z):process.cwd();if(!a4)a4=l0(J,"cache");let Q=[...X].sort().join(" "),G=`${XZ||"default"}::${Q}`,K=A4.get(G);if(K!==void 0)return yJ(G,K),K;let W=await DM(G);if(W!==null)return yJ(G,W),W;if(!p1){let w=null;try{let{loadStxConfig:N}=await Promise.resolve().then(() => (n0(),KZ)),R=await N(J);if(R.css)if(typeof R.css==="string"){let E=F0.isAbsolute(R.css)?R.css:F0.resolve(J,R.css);if(await Bun.file(E).exists()){let M=await import(E);w=M.default||M,console.log(`${T.green}[Crosswind]${T.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(w={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let E=F0.isAbsolute(R.css.config)?R.css.config:F0.resolve(J,R.css.config);if(await Bun.file(E).exists()){let M=await import(E);w={...M.default||M,...w}}}console.log(`${T.green}[Crosswind]${T.reset} Using inline CSS config from stx.config.ts`)}}catch{}p1=w||await gJ(J);try{XZ=vJ(JSON.stringify(p1??{}))}catch{XZ="unhashable"}}let U=Y.defaultConfig||Y.config,z=p1||{},_=U.theme||{},q=(z.theme||{}).extend||{},j={..._};if(Object.keys(q).length>0)j.extend=q;let H=[...U.safelist||[],...z.safelist||[]],O={...U,...z,content:[],output:"",preflight:!0,minify:!1,theme:j,safelist:H},V=new Y.CSSGenerator(O);for(let w of H)V.generate(w);for(let w of X)V.generate(w);let L=V.toCSS(!0,!1),F=O.shortcuts||z.shortcuts||{};for(let[w,N]of Object.entries(F)){if(!X.has(w)&&!H.includes(w))continue;let R=N.split(/\s+/).filter(Boolean);for(let E of R)V.generate(E)}L=V.toCSS(!0,!1);let A=L.split(`
|
|
931
931
|
`);for(let[w,N]of Object.entries(F)){if(!X.has(w)&&!H.includes(w))continue;let R=N.split(/\s+/).filter(Boolean),E=[],M=[];for(let I of R){let S=I.startsWith("dark:"),y=`.${(S?I.slice(5):I).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let b=0;b<A.length;b++){let g=A[b].trim();if(g===`${y} {`||g.startsWith(`${y} {`)){let r=b,c="";while(r<A.length){if(c+=A[r],A[r].includes("}"))break;r++}let P=c.match(/\{([^}]+)\}/);if(P)if(S)M.push(P[1].trim());else E.push(P[1].trim());break}}}if(E.length)L+=`
|
|
932
932
|
.${w} { ${E.join(" ")} }`;if(M.length)L+=`
|
|
933
933
|
@media (prefers-color-scheme: dark) { .dark .${w} { ${M.join(" ")} } }`}return yJ(G,L),kM(G,L),L}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function y0($,Z){let Y=await QZ($,Z);if(!Y)return $;let X=`<style data-crosswind="generated">
|
|
@@ -1279,7 +1279,7 @@ else {
|
|
|
1279
1279
|
|
|
1280
1280
|
console.log('[stx] Lifecycle runtime initialized');
|
|
1281
1281
|
})();
|
|
1282
|
-
`}function hJ($){return Symbol($)}var
|
|
1282
|
+
`}function hJ($){return Symbol($)}var sd,od,td;var hz=D(()=>{sd=hJ("theme"),od=hJ("router"),td=hJ("i18n")});import*as uz from"crypto";function dz($){let Z=/\$(\w+)\./g,Y=[],X;while((X=Z.exec($))!==null)if(!Y.includes(X[1]))Y.push(X[1]);return Y}function xM(){return`stx-${uz.randomBytes(4).toString("hex")}`}function vM($){return/\$\w+\./.test($)}function mz($){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 U=[],z=!1,_=K,B=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,q=[...K.matchAll(B)];for(let O of q){let V=O[0],L=O[1],F=O[2];if(vM(F)){z=!0;let A=F.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(A){let w=A[1];if(U.push({attr:L,expr:w,fullMatch:V,originalAttr:L}),dz(w).forEach((R)=>Y.add(R)),L==="text")_=_.replace(V,"");else if(L==="class")_=_.replace(V,'class=""');else if(L==="disabled"||L==="hidden")_=_.replace(V,"");else _=_.replace(V,`${L}=""`)}}}if(!z)return Q;let j=_.match(/\bid\s*=\s*"([^"]+)"/),H;if(j)H=j[1];else H=xM(),_=` id="${H}"${_}`;for(let O of U)Z.push({elementId:H,attribute:O.attr,expression:O.expr,stores:dz(O.expr)});return`<${G}${_}${W}`}),{html:J,bindings:Z,stores:Y}}function lz($,Z){if($.length===0)return"";let Y=Array.from(Z),X=`
|
|
1283
1283
|
<script>
|
|
1284
1284
|
(function() {
|
|
1285
1285
|
'use strict';
|
|
@@ -1854,10 +1854,10 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
|
|
|
1854
1854
|
@end${K}`;X.push(`Added ${z} 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(s4())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};K1=new HZ,D$={isDevelopment(){return s4()},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(`
|
|
1855
1855
|
`)}}});import oJ from"path";function _T($){let Z={"&":"&","<":"<",">":">",'"':""","'":"'"};return $.replace(/[&<>"']/g,(Y)=>Z[Y]||Y)}function M7($,Z={}){let{allowHtml:Y=!1,maxLength:X=1e4,allowSpecialChars:J=!0,customSanitizer:Q}=Z,G=[],K=$,W=!1;if(Q){let z=Q(K);if(z!==K)K=z,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=_T(K),W=!0,G.push("HTML content was escaped");let U=[{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:z,replacement:_,name:B}of U)if(z.test(K))K=K.replace(z,_),W=!0,G.push(`Removed ${B} from parameter`);if(!J){let z=K;if(K=K.split("").filter((_)=>{let B=_.charCodeAt(0);return B>=32&&B!==127}).join(""),K!==z)W=!0,G.push("Control characters removed")}return{value:K,modified:W,warnings:G}}function L_($,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(!OZ.isValidFilePath(Y,Z))return null;return Y}function V_($){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 F_($,Z={}){return $.map((Y)=>M7(Y,Z))}function tJ($){let Z={};for(let[Y,X]of Object.entries($)){if(!OZ.isValidVariableName(Y))continue;if(typeof X==="string"){let J=M7(X);Z[Y]=J.value}else if(Array.isArray(X))Z[Y]=X.map((J)=>typeof J==="string"?M7(J).value:J);else if(typeof X==="object"&&X!==null)Z[Y]=tJ(X);else Z[Y]=X}return Z}var OZ;var A_=D(()=>{OZ={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=oJ.resolve(Z,$),Q=oJ.resolve(Z);if(!J.startsWith(Q+oJ.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 w_=D(()=>{_Z();H_();O_();A_();BZ()});var S1=D(()=>{w_()});class T7{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]!==`
|
|
1856
1856
|
`)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]===`
|
|
1857
|
-
`)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 r0($,Z,Y,X=0){let J=0,Q=X,G=null,K=0,W=!1;while(Q<$.length){let U=$[Q];if(G&&W){W=!1,Q++;continue}if(G&&U==="\\"){W=!0,Q++;continue}if(W=!1,(U==='"'||U==="'"||U==="`")&&!G){G=U,Q++;continue}if(U===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&U==="$"&&$[Q+1]==="{"){K++,Q+=2;continue}if(K>0&&U==="}"){K--,Q++;continue}if(U==="`"&&G==="`"&&K===0){G=null,Q++;continue}if(G){Q++;continue}if(U===Z)J++;else if(U===Y){if(J--,J===0)return Q}Q++}return-1}function eJ($,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 LZ($){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 N4($,Z){let Y=BT($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function BT($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let X=r0($,"(",")",Y);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,X),endPos:X+1}}function qT($,Z){let Y=$.lastIndexOf("<",Z);if(Y===-1)return!1;return Y>$.lastIndexOf(">",Z)}function t4($,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($),U=K.exec($),z=W?W.index:1/0,_=U?U.index:1/0;if(z<_)J++,Q=z+W[0].length;else if(_<1/0){if(J--,J===0)return _;Q=_+U[0].length}else break}return-1}function $9($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let X=Z+Y[0].length,J=N4($,X);if(!J)return null;let Q=J.endPos,G=t4($,"if","endif",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],U=0,z="if",_=J.expression,B=0,q=0;while(U<K.length){let j=K.indexOf("@",U);if(j===-1)break;U=j;let H=K.substring(j);if(qT(K,j)){U++;continue}if(/^@if\s*\(/.test(H)){q++,U++;continue}if(/^@endif(?![a-z])/.test(H)){q--,U+=6;continue}if(q===0){let O=H.match(/^@elseif\s*/);if(O){W.push({type:z,condition:_,content:K.substring(B,U),start:Q+B,end:Q+U});let V=U+O[0].length,L=N4(K,V);if(!L){U++;continue}z="elseif",_=L.expression,U=L.endPos,B=U;continue}else if(/^@else(?![a-z])/.test(H)){W.push({type:z,condition:_,content:K.substring(B,U),start:Q+B,end:Q+U}),z="else",_=void 0,U+=5,B=U;continue}}U++}return W.push({type:z,condition:_,content:K.slice(B),start:Q+B,end:Q+K.length}),{fullMatch:$.slice(Z,G+6),branches:W,start:Z,end:G+6}}function k$($){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=$9($,X.index);if(Q)Z.push(Q),Y.lastIndex=Q.end;X=Y.exec($)}return Z}function E7($,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,U=r0($,"(",")",W);if(U===-1){Q=J.exec($);continue}let z=$.slice(W+1,U),_=U+1,B=t4($,Z,Y,_);if(B===-1){Q=J.exec($);continue}let q=$.slice(_,B),j=B+`@${Y}`.length;X.push({fullMatch:$.slice(K,j),name:Z,params:z,content:q,start:K,end:j}),J.lastIndex=j,Q=J.exec($)}return X}function VZ($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let X=Z+Y[0].length,J=N4($,X);if(!J)return null;let Q=J.endPos,G=t4($,"switch","endswitch",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],U=0,z=null,_=0;while(U<K.length){let B=K.slice(U),q=B.match(/^@switch\s*\(/),j=B.match(/^@endswitch(?![a-z])/);if(q){if(_++,z)z.content+=q[0];U+=q[0].length;continue}if(j){if(_--,z)z.content+=j[0];U+=j[0].length;continue}if(_>0){if(z)z.content+=K[U];U++;continue}let H=B.match(/^@case\s*/),O=B.match(/^@default(?![a-z])/),V=B.match(/^@break(?![a-z])/);if(H&&B.startsWith("@case")){if(z)W.push(z);let L=U+H[0].length,F=N4(K,L);if(!F){U++;continue}z={type:"case",value:F.expression,content:""},U=F.endPos}else if(O&&B.startsWith("@default")){if(z)W.push(z);z={type:"default",content:""},U+=O[0].length}else if(V&&B.startsWith("@break"))U+=V[0].length;else{if(z)z.content+=K[U];U++}}if(z)W.push(z);return{fullMatch:$.slice(Z,G+10),expression:J.expression,cases:W,start:Z,end:G+10}}var N_=()=>{};function T_($){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==="{{{"?"}}}":"!!}":"}}",U=G+K.length,z=jT($,U,W);if(z===-1){Y=G+1;continue}let _=$.slice(U,z).trim(),B=z+W.length;Z.push({fullMatch:$.slice(G,B),expression:_,start:G,end:B,isRaw:Q}),Y=B}return Z}function jT($,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 E_($){let Z=LZ($);if(Z.length===0)return{baseExpression:"",filters:[]};let Y=Z[0],X=[];for(let J=1;J<Z.length;J++){let Q=HT(Z[J]);if(Q)X.push(Q)}return{baseExpression:Y,filters:X}}function HT($){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=r0(Z,"(",")",Y);if(Q===-1)return{name:X,args:[]};let G=Z.slice(J,Q),K=Z9(G);return{name:X,args:K}}function Z9($){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 I_($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return null;let X=r0($,"(",")",Y);if(X===-1)return null;return{params:$.slice(Y+1,X),endPos:X+1}}function D_($){let Z=[],X=new T7($).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 U=X[J];if(U.type==="IDENTIFIER"){let z=U.value;if(J++,J<X.length&&X[J].type==="OPERATOR"&&X[J].value==="="){J++;let _=J<X.length?X[J].start:$.length,B=R_(X,J,$);J=B.nextIndex,Z.push({type:"variable",name:z,value:$.slice(_,B.endPos),exported:G,start:K.start,end:B.endPos})}}else if(U.type==="PUNCTUATION"&&(U.value==="{"||U.value==="[")){let z=U.start,_=U.value==="{"?"}":"]",B=r0($,U.value,_,z);if(B!==-1){let q=$.slice(z,B+1);if(J=M_(X,B+1),J<X.length&&X[J].type==="OPERATOR"&&X[J].value==="="){J++;let j=J<X.length?X[J].start:$.length,H=R_(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 U=X[J];if(U.type==="IDENTIFIER"){let z=U.value;J++;let _=-1;while(J<X.length){if(X[J].type==="PUNCTUATION"&&X[J].value==="{"){_=X[J].start;break}J++}if(_!==-1){let B=r0($,"{","}",_);if(B!==-1)Z.push({type:"function",name:z,value:$.slice(W,B+1).replace(/^export\s+/,""),exported:G,start:W,end:B+1}),J=M_(X,B+1)}}}else J++}return Z}function R_($,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 M_($,Z){for(let Y=0;Y<$.length;Y++)if($[Y].start>=Z)return Y;return $.length}var k_=()=>{};var I7=D(()=>{N_();k_()});function OT($,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=VZ(X,G);if(!K)break;try{let W;if(R0(K.expression))W=M0(K.expression,Object.keys(Z))(...Object.values(Z));else W=L0(K.expression,Z);let U="",z=!1;for(let _ of K.cases)if(_.type==="default"){if(!z)U=_.content.trim()}else try{let B;if(_.value&&R0(_.value))B=M0(_.value,Object.keys(Z))(...Object.values(Z));else if(_.value)B=L0(_.value,Z);if(W===B){U=_.content.trim(),z=!0;break}}catch{continue}X=X.substring(0,G)+U+X.substring(K.end),J=!0}catch(W){let U=W instanceof Error?W.message:String(W),z=B0("Switch",`Error evaluating @switch expression: ${U}`,Q0.EVALUATION_ERROR);X=X.substring(0,G)+z+X.substring(K.end);break}}return X}function P6($,Z,Y){let X=$;X=OT(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=N4(X,K+7);if(!W)break;let U=W.endPos,z=t4(X,"unless","endunless",U);if(z===-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 _=X.slice(U,z),B=W.expression,q=-1;{let H=0,O=/@(?:if|unless)\s*\(/g,V=/@(?:endif|endunless)(?![a-z])/g,L=/@else(?![a-z])/g,F=[],A;while((A=O.exec(_))!==null)F.push({pos:A.index,type:"open"});while((A=V.exec(_))!==null)F.push({pos:A.index,type:"close"});while((A=L.exec(_))!==null)F.push({pos:A.index,type:"else"});F.sort((w,N)=>w.pos-N.pos);for(let w of F)if(w.type==="open")H++;else if(w.type==="close")H--;else if(w.type==="else"&&H===0){q=w.pos;break}}let j;if(q!==-1){let H=_.slice(0,q),O=_.slice(q+5);j=`@if (${B})${O}@else ${H}@endif`}else j=`@if (!(${B}))${_}@endif`;X=X.substring(0,K)+j+X.substring(z+10),Q=!0}}X=X9(X,Z,Y),X=J9(X,Z,Y),X=Y9(X,Z);let J=()=>{let Q=k$(X);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let K=Q[G];try{let W="",U=!1;for(let z of K.branches){if(U)break;if(z.type==="else")W=z.content,U=!0;else try{let _;if(z.condition&&R0(z.condition))_=M0(z.condition,Object.keys(Z))(...Object.values(Z));else if(z.condition)_=L0(z.condition,Z);if(_)W=z.content,U=!0}catch(_){W=B0(z.type==="if"?"If":"Elseif",`Error in @${z.type}(${z.condition}): ${_ instanceof Error?_.message:String(_)}`,Q0.EVALUATION_ERROR),U=!0}}X=X.substring(0,K.start)+W+X.substring(K.end)}catch(W){let U=W instanceof Error?W.message:String(W),z=B0("If",`Error processing @if block: ${U}`,Q0.EVALUATION_ERROR);X=X.substring(0,K.start)+z+X.substring(K.end)}}return!0};while(!0){let Q=X;if(!J())break;if(X===Q)break}return X}function S_($){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 Y9($,Z){let Y=$;function X(K,W,U,z){let _=1,B=z,q=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${U}(?![a-z])`,"g");while(B<K.length&&_>0){q.lastIndex=B,j.lastIndex=B;let H=q.exec(K),O=j.exec(K),V=H?H.index:1/0,L=O?O.index:1/0;if(V<L)_++,B=V+H[0].length;else if(L<1/0){if(_--,_===0)return L;B=L+O[0].length}else break}return-1}function J(K,W,U){let z=0,_=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${U}(?![a-z])`,"g"),q=/@else(?![a-z])/g,j=[],H;while((H=_.exec(K))!==null)j.push({pos:H.index,type:"open"});while((H=B.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,V)=>O.pos-V.pos);for(let O of j)if(O.type==="open")z++;else if(O.type==="close")z--;else if(O.type==="else"&&z===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 U=W.index,z,_,B=Y.slice(U+5),q=S_(B);if(q)z=q.value,_=U+5+q.consumed;else _=U+5;let j=X(Y,"auth","endauth",_);if(j===-1){console.warn(`[stx] @auth directive at position ${U} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(_,j),O=J(H,"auth","endauth"),V;if(!Z.auth)V=!1;else V=z?w4(`auth?.check && auth?.user?.[${z}]`,Z):w4("auth?.check",Z);let L;if(O!==-1){let F=H.slice(0,O),A=H.slice(O+5);L=V?F:A}else L=V?H:"";Y=Y.substring(0,U)+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 U=W.index,z,_,B=Y.slice(U+6),q=S_(B);if(q)z=q.value,_=U+6+q.consumed;else _=U+6;let j=X(Y,"guest","endguest",_);if(j===-1){console.warn(`[stx] @guest directive at position ${U} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(_,j),O=J(H,"guest","endguest"),V;if(!Z.auth)V=!0;else V=z?w4(`!auth?.check || !auth?.user?.[${z}]`,Z):w4("!auth?.check",Z);let L;if(O!==-1){let F=H.slice(0,O),A=H.slice(O+5);L=V?F:A}else L=V?H:"";Y=Y.substring(0,U)+L+Y.substring(j+9),K=!0}}function Q(K,W,U){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let z=[K];if(W)z.push(W);if(U){let _=w4(U,Z);z.push(_)}return Z.permissions.check(...z)}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}`,U=K==="can"?"elsecan":"elsecannot",z=!0;while(z){z=!1;let _=Y.match(new RegExp(`@${K}\\s*\\(`));if(!_||_.index===void 0)break;let B=_.index,q=Y.slice(B+`@${K}`.length),j=G(q);if(!j)break;let H=B+`@${K}`.length+j.paramsEnd,O=X(Y,K,W,H);if(O===-1){console.warn(`[stx] @${K} directive at position ${B} has no matching @${W} \u2014 the block was skipped.`);break}let V=Y.slice(H,O),L=[],F=0,A=new RegExp(`@${K}\\s*\\(`,"g"),w=new RegExp(`@${W}(?![a-z])`,"g"),N=new RegExp(`@${U}\\s*\\(`,"g"),R=/@else(?![a-z])/g,E=[],M;while((M=A.exec(V))!==null)E.push({pos:M.index,type:"open"});while((M=w.exec(V))!==null)E.push({pos:M.index,type:"close"});while((M=N.exec(V))!==null)E.push({pos:M.index,type:"elseDirective"});while((M=R.exec(V))!==null)E.push({pos:M.index,type:"else"});E.sort((b,g)=>b.pos-g.pos);for(let b of E){if(b.type==="open"){F++;continue}if(b.type==="close"){F--;continue}if(F===0)L.push(b)}let I=[],S=0;for(let b=0;b<L.length;b++){let g=L[b];if(I.push({content:V.slice(S,g.pos),ability:void 0}),g.type==="elseDirective"){let r=V.slice(g.pos+`@${U}`.length),c=G(r);if(c){I[I.length-1]={content:V.slice(S,g.pos)},S=g.pos+`@${U}`.length+c.paramsEnd,I.push({content:"",ability:c.ability,type:c.type,id:c.id}),I.pop();let P=L[b+1],h=P?P.pos:V.length;I.push({content:V.slice(S,h),ability:c.ability,type:c.type,id:c.id}),S=h}}else S=g.pos+5}if(S<V.length){let b=I[I.length-1];if(L.length>0&&L[L.length-1].type==="else")I.push({content:V.slice(S),isFinalElse:!0});else if(I.length===0)I.push({content:V.slice(S)})}let k=Q(j.ability,j.type,j.id),x=K==="can"?k:!k,y="";if(x)y=I[0]?.content||"";else{let b=!1;for(let g=1;g<I.length;g++){let r=I[g];if(r.isFinalElse){y=r.content,b=!0;break}if(r.ability){let c=Q(r.ability,r.type,r.id);if(K==="can"?c:!c){y=r.content,b=!0;break}}}if(!b&&I.length>0){let g=I[I.length-1];if(g.isFinalElse)y=g.content}}Y=Y.substring(0,B)+y+Y.substring(O+`@${W}`.length),z=!0}}return Y}function X9($,Z,Y){let X=$;function J(Q,G,K,W,U){let z=!0;while(z){z=!1;let _=new RegExp(`@${G}\\s*\\(`),B=Q.match(_);if(!B||B.index===void 0)break;let q=B.index,j=N4(Q,q+`@${G}`.length);if(!j)break;let H=j.endPos,O=t4(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 V=Q.slice(H,O),L=j.expression,F=-1,A=0,w=0;while(w<V.length){let N=V.indexOf("@",w);if(N===-1)break;let R=V.substring(N);if(/^@(?:if|unless|isset|empty)\s*\(/.test(R)){A++,w=N+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(R)){A--,w=N+1;continue}if(A===0&&/^@else(?![a-z])/.test(R)){F=N;break}w=N+1}try{let N=W(L.trim()),R;if(F!==-1){let E=V.slice(0,F),M=V.slice(F+5);R=N?E:M}else R=N?V:"";Q=Q.substring(0,q)+R+Q.substring(O+`@${K}`.length),z=!0}catch(N){let R=N instanceof Error?N.message:String(N),E=B0(U,`Error processing @${G} directive: ${R}`,Q0.EVALUATION_ERROR);Q=Q.substring(0,q)+E+Q.substring(O+`@${K}`.length);break}}return Q}return X=J(X,"isset","endisset",(Q)=>{let G=w4(Q,Z);return G!==void 0&&G!==null},"Isset"),X=J(X,"empty","endempty",(Q)=>{let G=w4(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 J9($,Z,Y){let X=$,J="development";function Q(G,K,W,U){let z=new RegExp(`@${K}(?![a-z])`,"g"),_=new RegExp(`@${W}(?![a-z])`,"g"),B=new RegExp(`^@${K}(?![a-z])`),q=new RegExp(`^@${W}(?![a-z])`),j=G,H=!0;while(H){H=!1,z.lastIndex=0;let O=z.exec(j);if(!O)break;let V=O.index,L=V+O[0].length;if(K==="env"){let k=j.substring(L).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!k)break;L+=k[0].length,U=J===k[2]}let F=1,A=L,w=-1;while(F>0&&A<j.length){z.lastIndex=A,_.lastIndex=A;let k=z.exec(j),x=_.exec(j),y=k?k.index:1/0,b=x?x.index:1/0;if(y<b)F++,A=y+k[0].length;else if(b<1/0){if(F--,F===0){w=b;break}A=b+x[0].length}else break}if(w===-1){console.warn(`[stx] @${K} directive at position ${V} has no matching @${W} \u2014 the block was skipped.`);break}let N=j.substring(L,w),R=-1,E=0,M=0;while(M<N.length){let k=N.indexOf("@",M);if(k===-1)break;let x=N.substring(k);if(B.test(x)){E++,M=k+1;continue}if(q.test(x)){E--,M=k+1;continue}if(E===0&&/^@else(?![a-z])/.test(x)){R=k;break}M=k+1}let I;if(R!==-1){let k=N.slice(0,R),x=N.slice(R+5);I=U?k:x}else I=U?N:"";let S=`@${W}`.length;j=j.substring(0,V)+I+j.substring(w+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 FZ=D(()=>{nJ();S1();I7();i0()});function G9($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function e4($,Z){if(!$)return Z?.nonceGenerator?.()??G9();let Y=Q9.get($);if(!Y)Y=Z?.nonceGenerator?.()??G9(),Q9.set($,Y);return Y}function LT($){Q9.delete($)}function K9($,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 wZ($,Z){return`<meta http-equiv="Content-Security-Policy" content="${K9($,Z).replace(/&/g,"&").replace(/"/g,""")}">`}function VT($){return{enabled:!0,directives:{strict:C_,moderate:AZ,relaxed:b_,api:P_}[$]||AZ,useNonce:$==="strict",addMetaTag:!0}}function FT($,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 W9($,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?e4(Y,Z):void 0,J=wZ(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
|
|
1858
|
-
${J}`)}function U9($,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 z9($,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?e4(Z,Q):void 0;return wZ(Q.directives,G)}),J=J.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return e4(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=e4(Z,Q);return J}function AT(){return[y_,x_]}function wT($){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 v_($=!1){return $?"Content-Security-Policy-Report-Only":"Content-Security-Policy"}function NT($,Z){if(!$.enabled)return{};let Y=$.useNonce?e4(Z,$):void 0,X=K9($.directives,Y);return{[v_($.reportOnly)]:X}}var Q9,C_,AZ,b_,P_,y_,x_,RT;var _9=D(()=>{Q9=new WeakMap;C_={"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},AZ={"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},b_={"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'"]},P_={"default-src":["'none'"],"frame-ancestors":["'none'"]};y_={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?e4(Y,Q):void 0;return wZ(Q.directives,G)},hasEndTag:!1,description:"Insert Content-Security-Policy meta tag"},x_={name:"cspNonce",handler:($,Z,Y,X)=>{let Q=Y.__stx_options?.csp;if(!Q?.enabled||!Q.useNonce)return"";return e4(Y,Q)},hasEndTag:!1,description:"Output the current CSP nonce value"};RT={enabled:!1,reportOnly:!1,directives:AZ,useNonce:!1,addMetaTag:!0}});import MT from"crypto";function ET($=TT){let Z=MT.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return B9=Z,Z}function IT(){if(!B9)ET();return B9}function DT($=f_){let Z=IT();return`<input type="hidden" name="${$}" value="${Z}">`}function g_($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,X)=>{return DT(X||f_)})}var TT=40,f_="_token",B9=null;var h_=()=>{};async function q9($,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 kT(J,Q,Z,Y,X);else J=await ST(J,Q,Z,Y,X)}return J}async function kT($,Z,Y,X,J){let{name:Q,handler:G}=Z,K=`@${Q}`,W=`@end${Q}`,U=$,z=N$(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${W}`,"g"),_=[],B=z.exec(U);while(B!==null){let[q,j="",H=""]=B,O=B.index||0;try{let V=j?d_(j):[],L=H.trim(),F=await G(L,V,Y,X);_.push({original:q,processed:F,startIndex:O})}catch(V){let L=V instanceof Error?V.message:String(V);if(J.debug)console.error(`Error processing custom directive @${Q}:`,V);_.push({original:q,processed:B0("CustomDirective",`Error in @${Q}${j?`(${j})`:""}: ${L}`,Q0.EVALUATION_ERROR),startIndex:O})}B=z.exec(U)}for(let q=_.length-1;q>=0;q--){let{original:j,processed:H}=_[q];U=U.replace(j,H)}return U}async function ST($,Z,Y,X,J){let{name:Q,handler:G}=Z,K=$,W=N$(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),U=[],z=W.exec(K);while(z!==null){let[q,j=""]=z,H=z.index||0;try{let O=d_(j),V=await G("",O,Y,X);U.push({original:q,processed:V,startIndex:H})}catch(O){let V=O instanceof Error?O.message:String(O);if(J.debug)console.error(`Error processing custom directive @${Q}:`,O);U.push({original:q,processed:B0("CustomDirective",`Error in @${Q}(${j}): ${V}`,Q0.EVALUATION_ERROR),startIndex:H})}z=W.exec(K)}let _=N$(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),B=_.exec(K);while(B!==null){let[q]=B,j=B.index||0;try{let H=await G("",[],Y,X);U.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);U.push({original:q,processed:B0("CustomDirective",`Error in @${Q}: ${O}`,Q0.EVALUATION_ERROR),startIndex:j})}B=_.exec(K)}for(let q=U.length-1;q>=0;q--){let{original:j,processed:H}=U[q];K=K.replace(j,H)}return K}function d_($){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 j9=D(()=>{S1();r4()});function y6($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function bT($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,Y=Z.appearance,X=Z.colorMode;if(y6(Z.storageKey,"storageKey"),!Y||typeof Y!=="object"||Array.isArray(Y))throw Error("@appearanceBootstrap appearance must be an object");if(!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap colorMode must be an object");if(y6(Y.key,"appearance.key"),y6(Y.attribute,"appearance.attribute"),y6(Y.default,"appearance.default"),y6(X.key,"colorMode.key"),y6(X.attribute,"colorMode.attribute"),y6(X.default,"colorMode.default"),!m_.test(Y.key)||!m_.test(X.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!u_.test(Y.attribute)||!u_.test(X.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Y.allowed)||Y.allowed.length===0||Y.allowed.some((J)=>typeof J!=="string"||J.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!Y.allowed.includes(Y.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!CT.has(X.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:Y.key,attribute:Y.attribute,allowed:[...new Set(Y.allowed)],default:Y.default},colorMode:{key:X.key,attribute:X.attribute,default:X.default}}}function PT($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function yT($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${PT($)};const root=document.documentElement;let stored={};try{const raw=localStorage.getItem(config.storageKey);const parsed=raw?JSON.parse(raw):{};if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed))stored=parsed}catch{}const selectedAppearance=config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default;const selectedMode=["light","dark","system"].includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default;root.setAttribute("data-"+config.appearance.attribute,selectedAppearance);root.setAttribute("data-"+config.colorMode.attribute,selectedMode);let dark=selectedMode==="dark";if(selectedMode==="system"){try{dark=matchMedia("(prefers-color-scheme: dark)").matches}catch{dark=false}}root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light"}());</script>`}function xT($,Z){let Y=1,X=null,J=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(J){J=!1;continue}if(X){if(G==="\\")J=!0;else if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="(")Y++;else if(G===")"&&--Y===0)return Q}return-1}function H9($,Z){let Y=$,X=/@appearanceBootstrap\s*\(/g,J;while((J=X.exec(Y))!==null){let Q=J.index+J[0].length-1,G=xT(Y,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let K=Y.slice(Q+1,G).trim(),W=L0(`(${K})`,Z),U=yT(bT(W));Y=Y.slice(0,J.index)+U+Y.slice(G+1),X.lastIndex=J.index+U.length}return Y}var u_,m_,CT;var O9=D(()=>{i0();u_=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,m_=/^[A-Za-z_$][\w$]*$/,CT=new Set(["light","dark","system"])});var V9={};e(V9,{useTitle:()=>p_,useSeoMeta:()=>L9,usePageTitle:()=>p_,useHead:()=>TZ,seoMetaToHeadConfig:()=>D7,resetHead:()=>l_,renderHtmlAttrs:()=>n_,renderHead:()=>i_,renderBodyAttrs:()=>r_,processTitleDirective:()=>o_,processMetaDirective:()=>t_,processHeadDirective:()=>s_,mergeHeadConfigs:()=>v6,getPageMeta:()=>MZ,getHead:()=>RZ,definePageMeta:()=>c_,applyHead:()=>a_});function RZ(){return $6}function MZ(){return NZ}function l_(){$6={},vT.length=0,NZ={}}function TZ($){$6=v6($6,$)}function v6($,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 L9($){TZ(D7($))}function D7($){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});return{title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K}}function c_($){if(NZ={...NZ,...$},$.title||$.description)L9({title:$.title,description:$.description})}function p_($){let Z=typeof $==="function"?$():$;TZ({title:Z})}function i_($=$6){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${x6(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([X,J])=>`${X}="${x6(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}="${x6(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}="${x6(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}="${x6(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(`
|
|
1859
|
-
`)}function n_($=$6){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${
|
|
1860
|
-
`,""}),headContent:Z.trim()}}function o_($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,X,J,Q)=>{let G=X?J:Z[(Q||"").trim()]??Q,K=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=
|
|
1857
|
+
`)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 r0($,Z,Y,X=0){let J=0,Q=X,G=null,K=0,W=!1;while(Q<$.length){let U=$[Q];if(G&&W){W=!1,Q++;continue}if(G&&U==="\\"){W=!0,Q++;continue}if(W=!1,(U==='"'||U==="'"||U==="`")&&!G){G=U,Q++;continue}if(U===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&U==="$"&&$[Q+1]==="{"){K++,Q+=2;continue}if(K>0&&U==="}"){K--,Q++;continue}if(U==="`"&&G==="`"&&K===0){G=null,Q++;continue}if(G){Q++;continue}if(U===Z)J++;else if(U===Y){if(J--,J===0)return Q}Q++}return-1}function eJ($,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 LZ($){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 N4($,Z){let Y=BT($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function BT($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let X=r0($,"(",")",Y);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,X),endPos:X+1}}function qT($,Z){let Y=$.lastIndexOf("<",Z);if(Y===-1)return!1;return Y>$.lastIndexOf(">",Z)}function t4($,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($),U=K.exec($),z=W?W.index:1/0,_=U?U.index:1/0;if(z<_)J++,Q=z+W[0].length;else if(_<1/0){if(J--,J===0)return _;Q=_+U[0].length}else break}return-1}function $9($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let X=Z+Y[0].length,J=N4($,X);if(!J)return null;let Q=J.endPos,G=t4($,"if","endif",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],U=0,z="if",_=J.expression,B=0,q=0;while(U<K.length){let j=K.indexOf("@",U);if(j===-1)break;U=j;let H=K.substring(j);if(qT(K,j)){U++;continue}if(/^@if\s*\(/.test(H)){q++,U++;continue}if(/^@endif(?![a-z])/.test(H)){q--,U+=6;continue}if(q===0){let O=H.match(/^@elseif\s*/);if(O){W.push({type:z,condition:_,content:K.substring(B,U),start:Q+B,end:Q+U});let V=U+O[0].length,L=N4(K,V);if(!L){U++;continue}z="elseif",_=L.expression,U=L.endPos,B=U;continue}else if(/^@else(?![a-z])/.test(H)){W.push({type:z,condition:_,content:K.substring(B,U),start:Q+B,end:Q+U}),z="else",_=void 0,U+=5,B=U;continue}}U++}return W.push({type:z,condition:_,content:K.slice(B),start:Q+B,end:Q+K.length}),{fullMatch:$.slice(Z,G+6),branches:W,start:Z,end:G+6}}function k$($){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=$9($,X.index);if(Q)Z.push(Q),Y.lastIndex=Q.end;X=Y.exec($)}return Z}function E7($,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,U=r0($,"(",")",W);if(U===-1){Q=J.exec($);continue}let z=$.slice(W+1,U),_=U+1,B=t4($,Z,Y,_);if(B===-1){Q=J.exec($);continue}let q=$.slice(_,B),j=B+`@${Y}`.length;X.push({fullMatch:$.slice(K,j),name:Z,params:z,content:q,start:K,end:j}),J.lastIndex=j,Q=J.exec($)}return X}function VZ($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let X=Z+Y[0].length,J=N4($,X);if(!J)return null;let Q=J.endPos,G=t4($,"switch","endswitch",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],U=0,z=null,_=0;while(U<K.length){let B=K.slice(U),q=B.match(/^@switch\s*\(/),j=B.match(/^@endswitch(?![a-z])/);if(q){if(_++,z)z.content+=q[0];U+=q[0].length;continue}if(j){if(_--,z)z.content+=j[0];U+=j[0].length;continue}if(_>0){if(z)z.content+=K[U];U++;continue}let H=B.match(/^@case\s*/),O=B.match(/^@default(?![a-z])/),V=B.match(/^@break(?![a-z])/);if(H&&B.startsWith("@case")){if(z)W.push(z);let L=U+H[0].length,F=N4(K,L);if(!F){U++;continue}z={type:"case",value:F.expression,content:""},U=F.endPos}else if(O&&B.startsWith("@default")){if(z)W.push(z);z={type:"default",content:""},U+=O[0].length}else if(V&&B.startsWith("@break"))U+=V[0].length;else{if(z)z.content+=K[U];U++}}if(z)W.push(z);return{fullMatch:$.slice(Z,G+10),expression:J.expression,cases:W,start:Z,end:G+10}}var N_=()=>{};function T_($){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==="{{{"?"}}}":"!!}":"}}",U=G+K.length,z=jT($,U,W);if(z===-1){Y=G+1;continue}let _=$.slice(U,z).trim(),B=z+W.length;Z.push({fullMatch:$.slice(G,B),expression:_,start:G,end:B,isRaw:Q}),Y=B}return Z}function jT($,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 E_($){let Z=LZ($);if(Z.length===0)return{baseExpression:"",filters:[]};let Y=Z[0],X=[];for(let J=1;J<Z.length;J++){let Q=HT(Z[J]);if(Q)X.push(Q)}return{baseExpression:Y,filters:X}}function HT($){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=r0(Z,"(",")",Y);if(Q===-1)return{name:X,args:[]};let G=Z.slice(J,Q),K=Z9(G);return{name:X,args:K}}function Z9($){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 I_($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return null;let X=r0($,"(",")",Y);if(X===-1)return null;return{params:$.slice(Y+1,X),endPos:X+1}}function D_($){let Z=[],X=new T7($).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 U=X[J];if(U.type==="IDENTIFIER"){let z=U.value;if(J++,J<X.length&&X[J].type==="OPERATOR"&&X[J].value==="="){J++;let _=J<X.length?X[J].start:$.length,B=R_(X,J,$);J=B.nextIndex,Z.push({type:"variable",name:z,value:$.slice(_,B.endPos),exported:G,start:K.start,end:B.endPos})}}else if(U.type==="PUNCTUATION"&&(U.value==="{"||U.value==="[")){let z=U.start,_=U.value==="{"?"}":"]",B=r0($,U.value,_,z);if(B!==-1){let q=$.slice(z,B+1);if(J=M_(X,B+1),J<X.length&&X[J].type==="OPERATOR"&&X[J].value==="="){J++;let j=J<X.length?X[J].start:$.length,H=R_(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 U=X[J];if(U.type==="IDENTIFIER"){let z=U.value;J++;let _=-1;while(J<X.length){if(X[J].type==="PUNCTUATION"&&X[J].value==="{"){_=X[J].start;break}J++}if(_!==-1){let B=r0($,"{","}",_);if(B!==-1)Z.push({type:"function",name:z,value:$.slice(W,B+1).replace(/^export\s+/,""),exported:G,start:W,end:B+1}),J=M_(X,B+1)}}}else J++}return Z}function R_($,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 M_($,Z){for(let Y=0;Y<$.length;Y++)if($[Y].start>=Z)return Y;return $.length}var k_=()=>{};var I7=D(()=>{N_();k_()});function OT($,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=VZ(X,G);if(!K)break;try{let W;if(R0(K.expression))W=M0(K.expression,Object.keys(Z))(...Object.values(Z));else W=L0(K.expression,Z);let U="",z=!1;for(let _ of K.cases)if(_.type==="default"){if(!z)U=_.content.trim()}else try{let B;if(_.value&&R0(_.value))B=M0(_.value,Object.keys(Z))(...Object.values(Z));else if(_.value)B=L0(_.value,Z);if(W===B){U=_.content.trim(),z=!0;break}}catch{continue}X=X.substring(0,G)+U+X.substring(K.end),J=!0}catch(W){let U=W instanceof Error?W.message:String(W),z=B0("Switch",`Error evaluating @switch expression: ${U}`,Q0.EVALUATION_ERROR);X=X.substring(0,G)+z+X.substring(K.end);break}}return X}function x6($,Z,Y){let X=$;X=OT(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=N4(X,K+7);if(!W)break;let U=W.endPos,z=t4(X,"unless","endunless",U);if(z===-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 _=X.slice(U,z),B=W.expression,q=-1;{let H=0,O=/@(?:if|unless)\s*\(/g,V=/@(?:endif|endunless)(?![a-z])/g,L=/@else(?![a-z])/g,F=[],A;while((A=O.exec(_))!==null)F.push({pos:A.index,type:"open"});while((A=V.exec(_))!==null)F.push({pos:A.index,type:"close"});while((A=L.exec(_))!==null)F.push({pos:A.index,type:"else"});F.sort((w,N)=>w.pos-N.pos);for(let w of F)if(w.type==="open")H++;else if(w.type==="close")H--;else if(w.type==="else"&&H===0){q=w.pos;break}}let j;if(q!==-1){let H=_.slice(0,q),O=_.slice(q+5);j=`@if (${B})${O}@else ${H}@endif`}else j=`@if (!(${B}))${_}@endif`;X=X.substring(0,K)+j+X.substring(z+10),Q=!0}}X=X9(X,Z,Y),X=J9(X,Z,Y),X=Y9(X,Z);let J=()=>{let Q=k$(X);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let K=Q[G];try{let W="",U=!1;for(let z of K.branches){if(U)break;if(z.type==="else")W=z.content,U=!0;else try{let _;if(z.condition&&R0(z.condition))_=M0(z.condition,Object.keys(Z))(...Object.values(Z));else if(z.condition)_=L0(z.condition,Z);if(_)W=z.content,U=!0}catch(_){W=B0(z.type==="if"?"If":"Elseif",`Error in @${z.type}(${z.condition}): ${_ instanceof Error?_.message:String(_)}`,Q0.EVALUATION_ERROR),U=!0}}X=X.substring(0,K.start)+W+X.substring(K.end)}catch(W){let U=W instanceof Error?W.message:String(W),z=B0("If",`Error processing @if block: ${U}`,Q0.EVALUATION_ERROR);X=X.substring(0,K.start)+z+X.substring(K.end)}}return!0};while(!0){let Q=X;if(!J())break;if(X===Q)break}return X}function S_($){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 Y9($,Z){let Y=$;function X(K,W,U,z){let _=1,B=z,q=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${U}(?![a-z])`,"g");while(B<K.length&&_>0){q.lastIndex=B,j.lastIndex=B;let H=q.exec(K),O=j.exec(K),V=H?H.index:1/0,L=O?O.index:1/0;if(V<L)_++,B=V+H[0].length;else if(L<1/0){if(_--,_===0)return L;B=L+O[0].length}else break}return-1}function J(K,W,U){let z=0,_=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${U}(?![a-z])`,"g"),q=/@else(?![a-z])/g,j=[],H;while((H=_.exec(K))!==null)j.push({pos:H.index,type:"open"});while((H=B.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,V)=>O.pos-V.pos);for(let O of j)if(O.type==="open")z++;else if(O.type==="close")z--;else if(O.type==="else"&&z===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 U=W.index,z,_,B=Y.slice(U+5),q=S_(B);if(q)z=q.value,_=U+5+q.consumed;else _=U+5;let j=X(Y,"auth","endauth",_);if(j===-1){console.warn(`[stx] @auth directive at position ${U} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(_,j),O=J(H,"auth","endauth"),V;if(!Z.auth)V=!1;else V=z?w4(`auth?.check && auth?.user?.[${z}]`,Z):w4("auth?.check",Z);let L;if(O!==-1){let F=H.slice(0,O),A=H.slice(O+5);L=V?F:A}else L=V?H:"";Y=Y.substring(0,U)+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 U=W.index,z,_,B=Y.slice(U+6),q=S_(B);if(q)z=q.value,_=U+6+q.consumed;else _=U+6;let j=X(Y,"guest","endguest",_);if(j===-1){console.warn(`[stx] @guest directive at position ${U} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(_,j),O=J(H,"guest","endguest"),V;if(!Z.auth)V=!0;else V=z?w4(`!auth?.check || !auth?.user?.[${z}]`,Z):w4("!auth?.check",Z);let L;if(O!==-1){let F=H.slice(0,O),A=H.slice(O+5);L=V?F:A}else L=V?H:"";Y=Y.substring(0,U)+L+Y.substring(j+9),K=!0}}function Q(K,W,U){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let z=[K];if(W)z.push(W);if(U){let _=w4(U,Z);z.push(_)}return Z.permissions.check(...z)}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}`,U=K==="can"?"elsecan":"elsecannot",z=!0;while(z){z=!1;let _=Y.match(new RegExp(`@${K}\\s*\\(`));if(!_||_.index===void 0)break;let B=_.index,q=Y.slice(B+`@${K}`.length),j=G(q);if(!j)break;let H=B+`@${K}`.length+j.paramsEnd,O=X(Y,K,W,H);if(O===-1){console.warn(`[stx] @${K} directive at position ${B} has no matching @${W} \u2014 the block was skipped.`);break}let V=Y.slice(H,O),L=[],F=0,A=new RegExp(`@${K}\\s*\\(`,"g"),w=new RegExp(`@${W}(?![a-z])`,"g"),N=new RegExp(`@${U}\\s*\\(`,"g"),R=/@else(?![a-z])/g,E=[],M;while((M=A.exec(V))!==null)E.push({pos:M.index,type:"open"});while((M=w.exec(V))!==null)E.push({pos:M.index,type:"close"});while((M=N.exec(V))!==null)E.push({pos:M.index,type:"elseDirective"});while((M=R.exec(V))!==null)E.push({pos:M.index,type:"else"});E.sort((b,g)=>b.pos-g.pos);for(let b of E){if(b.type==="open"){F++;continue}if(b.type==="close"){F--;continue}if(F===0)L.push(b)}let I=[],S=0;for(let b=0;b<L.length;b++){let g=L[b];if(I.push({content:V.slice(S,g.pos),ability:void 0}),g.type==="elseDirective"){let r=V.slice(g.pos+`@${U}`.length),c=G(r);if(c){I[I.length-1]={content:V.slice(S,g.pos)},S=g.pos+`@${U}`.length+c.paramsEnd,I.push({content:"",ability:c.ability,type:c.type,id:c.id}),I.pop();let P=L[b+1],h=P?P.pos:V.length;I.push({content:V.slice(S,h),ability:c.ability,type:c.type,id:c.id}),S=h}}else S=g.pos+5}if(S<V.length){let b=I[I.length-1];if(L.length>0&&L[L.length-1].type==="else")I.push({content:V.slice(S),isFinalElse:!0});else if(I.length===0)I.push({content:V.slice(S)})}let k=Q(j.ability,j.type,j.id),x=K==="can"?k:!k,y="";if(x)y=I[0]?.content||"";else{let b=!1;for(let g=1;g<I.length;g++){let r=I[g];if(r.isFinalElse){y=r.content,b=!0;break}if(r.ability){let c=Q(r.ability,r.type,r.id);if(K==="can"?c:!c){y=r.content,b=!0;break}}}if(!b&&I.length>0){let g=I[I.length-1];if(g.isFinalElse)y=g.content}}Y=Y.substring(0,B)+y+Y.substring(O+`@${W}`.length),z=!0}}return Y}function X9($,Z,Y){let X=$;function J(Q,G,K,W,U){let z=!0;while(z){z=!1;let _=new RegExp(`@${G}\\s*\\(`),B=Q.match(_);if(!B||B.index===void 0)break;let q=B.index,j=N4(Q,q+`@${G}`.length);if(!j)break;let H=j.endPos,O=t4(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 V=Q.slice(H,O),L=j.expression,F=-1,A=0,w=0;while(w<V.length){let N=V.indexOf("@",w);if(N===-1)break;let R=V.substring(N);if(/^@(?:if|unless|isset|empty)\s*\(/.test(R)){A++,w=N+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(R)){A--,w=N+1;continue}if(A===0&&/^@else(?![a-z])/.test(R)){F=N;break}w=N+1}try{let N=W(L.trim()),R;if(F!==-1){let E=V.slice(0,F),M=V.slice(F+5);R=N?E:M}else R=N?V:"";Q=Q.substring(0,q)+R+Q.substring(O+`@${K}`.length),z=!0}catch(N){let R=N instanceof Error?N.message:String(N),E=B0(U,`Error processing @${G} directive: ${R}`,Q0.EVALUATION_ERROR);Q=Q.substring(0,q)+E+Q.substring(O+`@${K}`.length);break}}return Q}return X=J(X,"isset","endisset",(Q)=>{let G=w4(Q,Z);return G!==void 0&&G!==null},"Isset"),X=J(X,"empty","endempty",(Q)=>{let G=w4(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 J9($,Z,Y){let X=$,J="development";function Q(G,K,W,U){let z=new RegExp(`@${K}(?![a-z])`,"g"),_=new RegExp(`@${W}(?![a-z])`,"g"),B=new RegExp(`^@${K}(?![a-z])`),q=new RegExp(`^@${W}(?![a-z])`),j=G,H=!0;while(H){H=!1,z.lastIndex=0;let O=z.exec(j);if(!O)break;let V=O.index,L=V+O[0].length;if(K==="env"){let k=j.substring(L).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!k)break;L+=k[0].length,U=J===k[2]}let F=1,A=L,w=-1;while(F>0&&A<j.length){z.lastIndex=A,_.lastIndex=A;let k=z.exec(j),x=_.exec(j),y=k?k.index:1/0,b=x?x.index:1/0;if(y<b)F++,A=y+k[0].length;else if(b<1/0){if(F--,F===0){w=b;break}A=b+x[0].length}else break}if(w===-1){console.warn(`[stx] @${K} directive at position ${V} has no matching @${W} \u2014 the block was skipped.`);break}let N=j.substring(L,w),R=-1,E=0,M=0;while(M<N.length){let k=N.indexOf("@",M);if(k===-1)break;let x=N.substring(k);if(B.test(x)){E++,M=k+1;continue}if(q.test(x)){E--,M=k+1;continue}if(E===0&&/^@else(?![a-z])/.test(x)){R=k;break}M=k+1}let I;if(R!==-1){let k=N.slice(0,R),x=N.slice(R+5);I=U?k:x}else I=U?N:"";let S=`@${W}`.length;j=j.substring(0,V)+I+j.substring(w+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 FZ=D(()=>{nJ();S1();I7();i0()});function G9($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function e4($,Z){if(!$)return Z?.nonceGenerator?.()??G9();let Y=Q9.get($);if(!Y)Y=Z?.nonceGenerator?.()??G9(),Q9.set($,Y);return Y}function LT($){Q9.delete($)}function K9($,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 wZ($,Z){return`<meta http-equiv="Content-Security-Policy" content="${K9($,Z).replace(/&/g,"&").replace(/"/g,""")}">`}function VT($){return{enabled:!0,directives:{strict:C_,moderate:AZ,relaxed:b_,api:P_}[$]||AZ,useNonce:$==="strict",addMetaTag:!0}}function FT($,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 W9($,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?e4(Y,Z):void 0,J=wZ(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
|
|
1858
|
+
${J}`)}function U9($,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 z9($,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?e4(Z,Q):void 0;return wZ(Q.directives,G)}),J=J.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return e4(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=e4(Z,Q);return J}function AT(){return[y_,x_]}function wT($){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 v_($=!1){return $?"Content-Security-Policy-Report-Only":"Content-Security-Policy"}function NT($,Z){if(!$.enabled)return{};let Y=$.useNonce?e4(Z,$):void 0,X=K9($.directives,Y);return{[v_($.reportOnly)]:X}}var Q9,C_,AZ,b_,P_,y_,x_,RT;var _9=D(()=>{Q9=new WeakMap;C_={"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},AZ={"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},b_={"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'"]},P_={"default-src":["'none'"],"frame-ancestors":["'none'"]};y_={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?e4(Y,Q):void 0;return wZ(Q.directives,G)},hasEndTag:!1,description:"Insert Content-Security-Policy meta tag"},x_={name:"cspNonce",handler:($,Z,Y,X)=>{let Q=Y.__stx_options?.csp;if(!Q?.enabled||!Q.useNonce)return"";return e4(Y,Q)},hasEndTag:!1,description:"Output the current CSP nonce value"};RT={enabled:!1,reportOnly:!1,directives:AZ,useNonce:!1,addMetaTag:!0}});import MT from"crypto";function ET($=TT){let Z=MT.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return B9=Z,Z}function IT(){if(!B9)ET();return B9}function DT($=f_){let Z=IT();return`<input type="hidden" name="${$}" value="${Z}">`}function g_($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,X)=>{return DT(X||f_)})}var TT=40,f_="_token",B9=null;var h_=()=>{};async function q9($,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 kT(J,Q,Z,Y,X);else J=await ST(J,Q,Z,Y,X)}return J}async function kT($,Z,Y,X,J){let{name:Q,handler:G}=Z,K=`@${Q}`,W=`@end${Q}`,U=$,z=N$(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${W}`,"g"),_=[],B=z.exec(U);while(B!==null){let[q,j="",H=""]=B,O=B.index||0;try{let V=j?d_(j):[],L=H.trim(),F=await G(L,V,Y,X);_.push({original:q,processed:F,startIndex:O})}catch(V){let L=V instanceof Error?V.message:String(V);if(J.debug)console.error(`Error processing custom directive @${Q}:`,V);_.push({original:q,processed:B0("CustomDirective",`Error in @${Q}${j?`(${j})`:""}: ${L}`,Q0.EVALUATION_ERROR),startIndex:O})}B=z.exec(U)}for(let q=_.length-1;q>=0;q--){let{original:j,processed:H}=_[q];U=U.replace(j,H)}return U}async function ST($,Z,Y,X,J){let{name:Q,handler:G}=Z,K=$,W=N$(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),U=[],z=W.exec(K);while(z!==null){let[q,j=""]=z,H=z.index||0;try{let O=d_(j),V=await G("",O,Y,X);U.push({original:q,processed:V,startIndex:H})}catch(O){let V=O instanceof Error?O.message:String(O);if(J.debug)console.error(`Error processing custom directive @${Q}:`,O);U.push({original:q,processed:B0("CustomDirective",`Error in @${Q}(${j}): ${V}`,Q0.EVALUATION_ERROR),startIndex:H})}z=W.exec(K)}let _=N$(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),B=_.exec(K);while(B!==null){let[q]=B,j=B.index||0;try{let H=await G("",[],Y,X);U.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);U.push({original:q,processed:B0("CustomDirective",`Error in @${Q}: ${O}`,Q0.EVALUATION_ERROR),startIndex:j})}B=_.exec(K)}for(let q=U.length-1;q>=0;q--){let{original:j,processed:H}=U[q];K=K.replace(j,H)}return K}function d_($){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 j9=D(()=>{S1();r4()});function v6($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function bT($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,Y=Z.appearance,X=Z.colorMode;if(v6(Z.storageKey,"storageKey"),!Y||typeof Y!=="object"||Array.isArray(Y))throw Error("@appearanceBootstrap appearance must be an object");if(!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap colorMode must be an object");if(v6(Y.key,"appearance.key"),v6(Y.attribute,"appearance.attribute"),v6(Y.default,"appearance.default"),v6(X.key,"colorMode.key"),v6(X.attribute,"colorMode.attribute"),v6(X.default,"colorMode.default"),!m_.test(Y.key)||!m_.test(X.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!u_.test(Y.attribute)||!u_.test(X.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Y.allowed)||Y.allowed.length===0||Y.allowed.some((J)=>typeof J!=="string"||J.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!Y.allowed.includes(Y.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!CT.has(X.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:Y.key,attribute:Y.attribute,allowed:[...new Set(Y.allowed)],default:Y.default},colorMode:{key:X.key,attribute:X.attribute,default:X.default}}}function PT($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function yT($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${PT($)};const root=document.documentElement;let stored={};try{const raw=localStorage.getItem(config.storageKey);const parsed=raw?JSON.parse(raw):{};if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed))stored=parsed}catch{}const selectedAppearance=config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default;const selectedMode=["light","dark","system"].includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default;root.setAttribute("data-"+config.appearance.attribute,selectedAppearance);root.setAttribute("data-"+config.colorMode.attribute,selectedMode);let dark=selectedMode==="dark";if(selectedMode==="system"){try{dark=matchMedia("(prefers-color-scheme: dark)").matches}catch{dark=false}}root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light"}());</script>`}function xT($,Z){let Y=1,X=null,J=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(J){J=!1;continue}if(X){if(G==="\\")J=!0;else if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="(")Y++;else if(G===")"&&--Y===0)return Q}return-1}function H9($,Z){let Y=$,X=/@appearanceBootstrap\s*\(/g,J;while((J=X.exec(Y))!==null){let Q=J.index+J[0].length-1,G=xT(Y,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let K=Y.slice(Q+1,G).trim(),W=L0(`(${K})`,Z),U=yT(bT(W));Y=Y.slice(0,J.index)+U+Y.slice(G+1),X.lastIndex=J.index+U.length}return Y}var u_,m_,CT;var O9=D(()=>{i0();u_=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,m_=/^[A-Za-z_$][\w$]*$/,CT=new Set(["light","dark","system"])});var V9={};$0(V9,{useTitle:()=>p_,useSeoMeta:()=>L9,usePageTitle:()=>p_,useHead:()=>TZ,seoMetaToHeadConfig:()=>D7,resetHead:()=>l_,renderHtmlAttrs:()=>n_,renderHead:()=>i_,renderBodyAttrs:()=>r_,processTitleDirective:()=>o_,processMetaDirective:()=>t_,processHeadDirective:()=>s_,mergeHeadConfigs:()=>g6,getPageMeta:()=>MZ,getHead:()=>RZ,definePageMeta:()=>c_,applyHead:()=>a_});function RZ(){return $6}function MZ(){return NZ}function l_(){$6={},vT.length=0,NZ={}}function TZ($){$6=g6($6,$)}function g6($,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 L9($){TZ(D7($))}function D7($){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});return{title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K}}function c_($){if(NZ={...NZ,...$},$.title||$.description)L9({title:$.title,description:$.description})}function p_($){let Z=typeof $==="function"?$():$;TZ({title:Z})}function i_($=$6){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${f6(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([X,J])=>`${X}="${f6(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}="${f6(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}="${f6(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}="${f6(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(`
|
|
1859
|
+
`)}function n_($=$6){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${f6(Y)}"`).join(" ")}function r_($=$6){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${f6(Y)}"`).join(" ")}function f6($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function a_($=$6){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 s_($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(X,J)=>{return Z+=J.trim()+`
|
|
1860
|
+
`,""}),headContent:Z.trim()}}function o_($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,X,J,Q)=>{let G=X?J:Z[(Q||"").trim()]??Q,K=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=g6(K,{title:G}),""})}function t_($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Y,X,J,Q,G,K)=>{let W=Q?G:K,U=Q?W:Z[(W||"").trim()]??W,_=J.includes(":")?{property:J,content:U}:{name:J,content:U},B=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=g6(B,{meta:[_]}),""})}var $6,vT,NZ;var h6=D(()=>{$6={},vT=[],NZ={}});import fT from"crypto";function Z1($){return String($??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function gT($){return{...IZ,...$.forms?.classes}}function EZ($,Z,Y,X){let J=$||Z;return Y?`${J} ${X}`:J}function hT(){return fT.randomUUID()}function dT($,Z,Y,X){let J=gT(X),Q=$;return Q=YB(Q,Z),Q=S$(Q,Z),Q=DZ(Q,Z,J),Q=kZ(Q,Z,J),Q}function S$($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=hT();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${Z1(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="${Z1(Q)}">`;return X}),Y}function DZ($,Z,Y=IZ){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(J,Q,G,K,W,U="")=>{let z=Q||G||"POST",_=K||W||"",B=Z6(U),q=z.toUpperCase(),j=["GET","POST"].includes(q)?q:"POST",H=`<form method="${Z1(j)}" action="${Z1(_)}"${B?` ${B}`:""}>`;if(H+=`
|
|
1861
1861
|
${S$("@csrf",Z)}`,!["GET","POST"].includes(q))H+=`
|
|
1862
1862
|
${S$(`@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,U="")=>{let z=Q||G||"",_=K||W||"",B=Z6(U),q=k7(z,Z),j=q!==void 0&&q!==null?q:_||"",H=B.match(/type=['"]([^'"]+)['"]/i),O=H?H[1]:"text",V=S7(z,Z),L=B.match(/class=['"]([^'"]+)['"]/i),F=EZ(L?L[1]:"",Y.input,V,Y.inputError),A=B.replace(/class=['"][^'"]+['"]/i,"");return A=A.replace(/type=['"][^'"]+['"]/i,""),`<input type="${Z1(O)}" name="${Z1(z)}" value="${Z1(j)}" class="${F}"${A?` ${A}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(J,Q,G="",K="")=>{let W=Z6(G),U=k7(Q,Z)||K.trim(),z=S7(Q,Z),_=W.match(/class=['"]([^'"]+)['"]/i),B=EZ(_?_[1]:"",Y.input,z,Y.inputError),q=W.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${Z1(Q)}" class="${B}"${q?` ${q}`:""}>${Z1(U)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(J,Q,G="",K)=>{let W=Z6(G),U=k7(Q,Z),z=S7(Q,Z),_=W.match(/class=['"]([^'"]+)['"]/i),B=EZ(_?_[1]:"",Y.input,z,Y.inputError),q=W.replace(/class=['"][^'"]+['"]/i,""),j=K;if(U!==void 0)j=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,O,V)=>{if((Array.isArray(U)?U.some((F)=>String(F)===V):String(U)===V)&&!O.includes("selected"))return O.replace(/(<option)/,"$1 selected");return H});return`<select name="${Z1(Q)}" class="${B}"${q?` ${q}`:""}>${j}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(J,Q,G="1",K="")=>{let W=Z6(K),U=k7(Q,Z),z=U!==void 0&&(Array.isArray(U)?U.some((j)=>String(j)===G):U===!0||String(U)===G),_=W.match(/class=['"]([^'"]+)['"]/i),B=_?_[1]:Y.checkInput,q=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${Z1(Q)}" value="${Z1(G)}" class="${B}"${z?" checked":""}${q?` ${q}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,Q,G,K="")=>{let W=Z6(K),U=k7(Q,Z),z=U!==void 0&&U===G,_=W.match(/class=['"]([^'"]+)['"]/i),B=_?_[1]:Y.checkInput,q=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${Z1(Q)}" value="${Z1(G)}" class="${B}"${z?" checked":""}${q?` ${q}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,Q,G="")=>{let K=Z6(G),W=K.match(/accept=['"]([^'"]+)['"]/i),U=W?W[1]:"",z=K.includes("multiple"),_=S7(Q,Z),B=K.match(/class=['"]([^'"]+)['"]/i),q=EZ(B?B[1]:"",Y.input,_,Y.inputError),j=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${Z1(Q)}"`,`class="${q}"`];if(U)H.push(`accept="${Z1(U)}"`);if(z)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=Z6(G),U=W.match(/class=['"]([^'"]+)['"]/i),z=U?U[1]:Y.label,_=W.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${Z1(Q)}" class="${z}"${_?` ${_}`:""}>${K}</label>`}),X}function kZ($,Z,Y=IZ){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,J,Q)=>{try{if(S7(J,Z))return Q.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return e_(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 e_(J,Z)}let W=K.trim();if(R0(W)){let U=L0(W,Z);return U!==void 0?String(U):W}return W}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function S7($,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 e_($,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 k7($,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 Z6($){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 uT($,Z){$B[$]=Z}function F9($){let[Z,...Y]=$.split(":"),X=Y.length>0?Y.join(":").split(","):[];return{name:Z.trim(),params:X}}function ZB($,Z,Y,X={}){let J=[],Q=Y.split("|").map((G)=>G.trim()).filter(Boolean);for(let G of Q){let K=F9(G),W=$B[K.name];if(!W){console.warn(`Unknown validation rule: ${K.name}`);continue}if(K.name==="confirmed"){let z=`${$}_confirmation`;K.params=[X[z]]}let U=W(Z,K.params||[],$);if(U)J.push(K.message||U)}return{field:$,valid:J.length===0,errors:J}}function mT($,Z){let Y={};for(let[X,J]of Object.entries(Z)){let Q=ZB(X,$[X],J,$);if(!Q.valid)Y[X]=Q.errors}return Y}function YB($,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 U=F9(W);switch(U.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"'),U.name==="integer")K.push('step="1"');break;case"min":if(U.params?.[0])K.push(`minlength="${U.params[0]}"`);break;case"max":if(U.params?.[0])K.push(`maxlength="${U.params[0]}"`);break;case"regex":if(U.params?.[0])K.push(`pattern="${U.params[0]}"`);break}}return`<!-- @validate:${X}:${J} -->${K.length>0?`<!-- attrs:${K.join(" ")} -->`:""}`})}function lT($){A9[$.name]=$}function XB($,Z,Y={}){let X=[],J=Z.split("|").map((Q)=>Q.trim());for(let Q of J){let G=F9(Q),K=A9[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 cT($,Z){let Y={},X=!0;for(let[J,Q]of Object.entries(Z)){let G=XB($[J],Q,$);if(!G.valid)X=!1,Y[J]=G.errors}return{valid:X,errors:Y}}function pT($,Z){let Y=JSON.stringify(Z);return`
|
|
1863
1863
|
<script>
|
|
@@ -1912,7 +1912,7 @@ catch { return 'Please enter a valid URL'; } },
|
|
|
1912
1912
|
});
|
|
1913
1913
|
})();
|
|
1914
1914
|
</script>`.trim()}var IZ,$B,A9;var w9=D(()=>{i0();IZ={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};$B={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}};A9={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 R9 from"path";async function iT(){if(C7!==void 0)return C7;try{C7=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{C7=null}return C7}function nT($){if($)delete w1[$];else for(let Z of Object.keys(w1))delete w1[Z]}function rT(){let $=Object.entries(w1).map(([Z,Y])=>({locale:Z,loadedAt:new Date(Y.loadedAt),keyCount:QB(Y.translations)}));return{size:Object.keys(w1).length,locales:Object.keys(w1),entries:$}}function QB($,Z=0){for(let Y of Object.values($))if(Z++,Y&&typeof Y==="object"&&!Array.isArray(Y))Z=QB(Y,Z);return Z}function aT($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}function sT($){if(w1[$])return"loaded";return R4[$]||"idle"}function oT($){return R4[$]==="loading"}function tT($){return!!w1[$]}async function GB($,Z){let{locales:Y,parallel:X=!0,priority:J={},onLocaleLoaded:Q,onComplete:G,onError:K}=$,W=X?Y:[...Y].sort((U,z)=>(J[z]||0)-(J[U]||0));if(X){let U=W.map(async(z)=>{try{await b7(z,Z),Q?.(z)}catch(_){K?.(z,_ instanceof Error?_:Error(String(_)))}});await Promise.all(U)}else for(let U of W)try{await b7(U,Z),Q?.(U)}catch(z){K?.(U,z instanceof Error?z:Error(String(z)))}G?.()}function eT($,Z){queueMicrotask(()=>{GB($,Z).catch((Y)=>{if(Z.debug)console.error("Background preload error:",Y)})})}async function b7($,Z){if({...CZ,...Z.i18n}.cache&&w1[$]){let J=w1[$],Q=Z.i18n?.cacheMaxAge??0;if(!aT(J,Q))return J.translations}if(n1[$]?.state==="loading")return n1[$].promise;R4[$]="loading";let X=M9($,Z).then((J)=>{return R4[$]="loaded",delete n1[$],J}).catch((J)=>{throw R4[$]="error",n1[$]={promise:X,state:"error",error:J instanceof Error?J:Error(String(J))},J});return n1[$]={promise:X,state:"loading"},X}function KB($){return w1[$]?.translations}async function $E($,Z){let Y=KB($);if(Y)return Y;return b7($,Z)}async function ZE($,Z){if(w1[$])return w1[$].translations;if(n1[$]){if(Z)return Promise.race([n1[$].promise,new Promise((Y,X)=>setTimeout(()=>X(Error(`Timeout waiting for locale: ${$}`)),Z))]);return n1[$].promise}throw Error(`Locale "${$}" is not loading. Call loadTranslationLazy first.`)}function YE(){return Object.entries(R4).filter(([$,Z])=>Z==="loading").map(([$])=>$)}function XE($){if($)delete n1[$],delete R4[$];else{for(let Z of Object.keys(n1))delete n1[Z];for(let Z of Object.keys(R4))delete R4[Z]}}async function M9($,Z){let Y={...CZ,...Z.i18n},X=R9.isAbsolute(Y.translationsDir)?Y.translationsDir:R9.resolve(Z.root||process.cwd(),Y.translationsDir);try{let J=await iT(),Q=J?await J($,{translationsDir:X,defaultLocale:Y.defaultLocale,sources:WE(Y.format)}):await JE($,Y,X);if(Q===void 0){if($!==Y.defaultLocale)return M9(Y.defaultLocale,Z);return{}}let G=Q;if(Y.cache)w1[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(J){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,J);if($!==Y.defaultLocale)return M9(Y.defaultLocale,Z);return{}}}async function JE($,Z,Y){let X=R9.join(Y,`${$}${QE(Z.format)}`);try{let J=await import(X);return J.default||J}catch(J){try{let Q=await Bun.file(X).text();if(Z.format==="yaml"||Z.format==="yml")return GE(Q);if(Z.format==="json")return JSON.parse(Q);throw J}catch{return}}}function QE($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function GE($){let Z={},Y=$.split(`
|
|
1915
|
-
`),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[,,U,z]=W,_=U.trim(),B=z.trim();if(B==="")K[_]={},X.push({obj:K[_],indent:G});else K[_]=KE(B)}}return Z}function KE($){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 WE($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function WB($,Z){return b7($,Z)}function UE($,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 UB($,Z={}){return zB($,Z)}function zB($,Z){let Y="",X=0;while(X<$.length)if($[X]==="{"){let J=zE($,X);if(J===-1){Y+=$[X],X++;continue}let Q=$.slice(X+1,J);Y+=_E(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 zE($,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 _E($,Z){let Y=BE($);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 qE(J,Y.slice(2).join(","),Z);case"select":return HE(J,Y.slice(2).join(","));case"selectordinal":return OE(J,Y.slice(2).join(","));case"number":return VE(J,Y[2]?.trim());case"date":return FE(J,Y[2]?.trim());case"time":return AE(J,Y[2]?.trim());default:return J!==void 0?String(J):`{${$}}`}}function BE($){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 qE($,Z,Y){let X=Number($)||0,J=T9(Z),Q=`=${X}`;if(J[Q])return N9(J[Q],X,Y);let G=jE(X);if(J[G])return N9(J[G],X,Y);if(J.other)return N9(J.other,X,Y);return String(X)}function N9($,Z,Y){let X=$.replace(/#/g,String(Z));return zB(X,Y)}function jE($){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 HE($,Z){let Y=String($||""),X=T9(Z);if(X[Y])return X[Y];return X.other||String($)}function OE($,Z){let Y=Number($)||0,X=T9(Z),J=LE(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 LE($){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 T9($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,X=Y.exec($);while(X!==null)Z[X[1]]=X[2],X=Y.exec($);return Z}function VE($,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 FE($,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 AE($,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 _B($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function SZ($,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(_B(G))return UB(G,X);if(G.includes("|")&&"count"in X){let K=Number(X.count),W=G.split("|");G=UE(W,K)}for(let[K,W]of Object.entries(X)){let U=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${U}`,"g"),String(W))}return G}async function E9($,Z,Y,X){let J=$,Q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...CZ,...X.i18n},K=await WB(G.locale,X);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,J=await JB(J,Q,async(z,_,B,q,j)=>{try{let H={};if(B)try{let V=[()=>JSON.parse(B),()=>{let L=`{"data":${B}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return p0(B,Z)}];for(let L of V)try{if(H=L(),Object.keys(H).length>0)break}catch{}}catch(V){if(X.debug)console.error("Error parsing parameters for @translate directive:",V)}return SZ(_,K,G.fallbackToKey,H)||q.trim()}catch(H){if(X.debug)console.error("Error processing @translate directive:",H);return B0("Translate",`Error in @translate('${_}'): ${H instanceof Error?H.message:String(H)}`,Q0.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 z=[...J.matchAll(W)];console.warn(`Found ${z.length} @translate matches`),z.forEach((_,B)=>console.warn(`Match ${B}: ${_[0]}, Key: ${_[1]}, Params: ${_[2]||"none"}`))}return J=await JB(J,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(z,_,B,q)=>{try{let j={};if(B)try{let H=[()=>JSON.parse(B),()=>{let O=`{"data":${B}}`,V=JSON.parse(O);return typeof V.data==="object"?V.data:{}},()=>{return p0(B,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 SZ(_,K,G.fallbackToKey,j)}catch(j){if(X.debug)console.error("Error processing @translate directive:",j);return B0("Translate",`Error in @translate('${_}'): ${j instanceof Error?j.message:String(j)}`,Q0.EVALUATION_ERROR)}}),J}async function JB($,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 wE($,Z=!0){return(Y,X={})=>{return SZ(Y,$,Z,X)}}var C7,CZ,w1,n1,R4;var I9=D(()=>{S1();i0();CZ={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},w1={},n1={},R4={}});function RE($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return NE.test(Z)}function U4($){P7.lastIndex=0;let Z;while((Z=P7.exec($))!==null){if(Z[0].startsWith("</")||RE(Z[0]))continue;let Y=Z.index,X=P7.lastIndex,J=1,Q;while((Q=P7.exec($))!==null)if(Q[0].startsWith("</")){if(J--,J===0){let G=Q.index;return{start:Y,openEnd:X,closeStart:G,end:P7.lastIndex,content:$.slice(X,G)}}}else J++;return null}return null}var P7,NE;var C$=D(()=>{P7=/<\/?template\b[^>]*>/gi,NE=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var h6={};e(h6,{streamingSuspenseDirective:()=>S9,streamToResponse:()=>wB,streamTemplateSimple:()=>LB,streamTemplate:()=>qB,renderStreamingPage:()=>jB,registerStreamingDirectives:()=>FB,processStreamDirectives:()=>HB,processSectionDirectives:()=>AB,islandDirective:()=>C9,generateHydrationRuntime:()=>NB,extractStreamBoundaries:()=>OB,createStreamRenderer:()=>VB,buildSuspenseResolveScript:()=>PZ,SUSPENSE_RESOLVER_RUNTIME:()=>k9});import bZ from"path";function ME($){let Z=[],Y=0,X;BB.lastIndex=0;while((X=BB.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 qB($,Z={},Y={}){let X={...N1,...Y,streaming:{...D9,...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]:"",U=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),z={...Z,__filename:$,__dirname:bZ.dirname($)};if(W.trim())await D0(W,z,$);let _=ME(U),B=new Set;if(!_.some((j)=>j.type==="suspense")){let j=X.streaming?.strategy||"auto",H=new RegExp(g6.source,"g");if(!(j!=="manual"&&H.test(U))){let V=await _0(U,z,$,X,B);for(let L=0;L<V.length;L+=J)Q.enqueue(V.slice(L,L+J)),await new Promise((F)=>setTimeout(F,0))}else{let V=[],L=new RegExp(g6.source,"g"),F;while((F=L.exec(U))!==null)V.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let A=0;for(let w of V){if(w.start>A){let R=U.slice(A,w.start);if(R.trim()){let E=await _0(R,z,$,X,B);Q.enqueue(E),await new Promise((M)=>setTimeout(M,0))}}let N=await _0(w.content,z,$,X,B);Q.enqueue(N),await new Promise((R)=>setTimeout(R,0)),A=w.end}if(A<U.length){let w=U.slice(A);if(w.trim()){let N=await _0(w,z,$,X,B);Q.enqueue(N)}}}}else{let j=new Map;for(let O of _)if(O.type==="shell"||O.type==="content"){let V=await _0(O.content,z,$,X,B);Q.enqueue(V)}else if(O.type==="suspense"&&O.name){let V=`stx-suspense-${O.name}`;Q.enqueue(`<div id="${V}" data-suspense="${O.name}" style="display:contents;">
|
|
1915
|
+
`),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[,,U,z]=W,_=U.trim(),B=z.trim();if(B==="")K[_]={},X.push({obj:K[_],indent:G});else K[_]=KE(B)}}return Z}function KE($){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 WE($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function WB($,Z){return b7($,Z)}function UE($,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 UB($,Z={}){return zB($,Z)}function zB($,Z){let Y="",X=0;while(X<$.length)if($[X]==="{"){let J=zE($,X);if(J===-1){Y+=$[X],X++;continue}let Q=$.slice(X+1,J);Y+=_E(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 zE($,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 _E($,Z){let Y=BE($);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 qE(J,Y.slice(2).join(","),Z);case"select":return HE(J,Y.slice(2).join(","));case"selectordinal":return OE(J,Y.slice(2).join(","));case"number":return VE(J,Y[2]?.trim());case"date":return FE(J,Y[2]?.trim());case"time":return AE(J,Y[2]?.trim());default:return J!==void 0?String(J):`{${$}}`}}function BE($){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 qE($,Z,Y){let X=Number($)||0,J=T9(Z),Q=`=${X}`;if(J[Q])return N9(J[Q],X,Y);let G=jE(X);if(J[G])return N9(J[G],X,Y);if(J.other)return N9(J.other,X,Y);return String(X)}function N9($,Z,Y){let X=$.replace(/#/g,String(Z));return zB(X,Y)}function jE($){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 HE($,Z){let Y=String($||""),X=T9(Z);if(X[Y])return X[Y];return X.other||String($)}function OE($,Z){let Y=Number($)||0,X=T9(Z),J=LE(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 LE($){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 T9($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,X=Y.exec($);while(X!==null)Z[X[1]]=X[2],X=Y.exec($);return Z}function VE($,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 FE($,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 AE($,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 _B($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function SZ($,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(_B(G))return UB(G,X);if(G.includes("|")&&"count"in X){let K=Number(X.count),W=G.split("|");G=UE(W,K)}for(let[K,W]of Object.entries(X)){let U=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${U}`,"g"),String(W))}return G}async function E9($,Z,Y,X){let J=$,Q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...CZ,...X.i18n},K=await WB(G.locale,X);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,J=await JB(J,Q,async(z,_,B,q,j)=>{try{let H={};if(B)try{let V=[()=>JSON.parse(B),()=>{let L=`{"data":${B}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return p0(B,Z)}];for(let L of V)try{if(H=L(),Object.keys(H).length>0)break}catch{}}catch(V){if(X.debug)console.error("Error parsing parameters for @translate directive:",V)}return SZ(_,K,G.fallbackToKey,H)||q.trim()}catch(H){if(X.debug)console.error("Error processing @translate directive:",H);return B0("Translate",`Error in @translate('${_}'): ${H instanceof Error?H.message:String(H)}`,Q0.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 z=[...J.matchAll(W)];console.warn(`Found ${z.length} @translate matches`),z.forEach((_,B)=>console.warn(`Match ${B}: ${_[0]}, Key: ${_[1]}, Params: ${_[2]||"none"}`))}return J=await JB(J,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(z,_,B,q)=>{try{let j={};if(B)try{let H=[()=>JSON.parse(B),()=>{let O=`{"data":${B}}`,V=JSON.parse(O);return typeof V.data==="object"?V.data:{}},()=>{return p0(B,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 SZ(_,K,G.fallbackToKey,j)}catch(j){if(X.debug)console.error("Error processing @translate directive:",j);return B0("Translate",`Error in @translate('${_}'): ${j instanceof Error?j.message:String(j)}`,Q0.EVALUATION_ERROR)}}),J}async function JB($,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 wE($,Z=!0){return(Y,X={})=>{return SZ(Y,$,Z,X)}}var C7,CZ,w1,n1,R4;var I9=D(()=>{S1();i0();CZ={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},w1={},n1={},R4={}});function RE($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return NE.test(Z)}function U4($){P7.lastIndex=0;let Z;while((Z=P7.exec($))!==null){if(Z[0].startsWith("</")||RE(Z[0]))continue;let Y=Z.index,X=P7.lastIndex,J=1,Q;while((Q=P7.exec($))!==null)if(Q[0].startsWith("</")){if(J--,J===0){let G=Q.index;return{start:Y,openEnd:X,closeStart:G,end:P7.lastIndex,content:$.slice(X,G)}}}else J++;return null}return null}var P7,NE;var C$=D(()=>{P7=/<\/?template\b[^>]*>/gi,NE=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var u6={};$0(u6,{streamingSuspenseDirective:()=>S9,streamToResponse:()=>wB,streamTemplateSimple:()=>LB,streamTemplate:()=>qB,renderStreamingPage:()=>jB,registerStreamingDirectives:()=>FB,processStreamDirectives:()=>HB,processSectionDirectives:()=>AB,islandDirective:()=>C9,generateHydrationRuntime:()=>NB,extractStreamBoundaries:()=>OB,createStreamRenderer:()=>VB,buildSuspenseResolveScript:()=>PZ,SUSPENSE_RESOLVER_RUNTIME:()=>k9});import bZ from"path";function ME($){let Z=[],Y=0,X;BB.lastIndex=0;while((X=BB.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 qB($,Z={},Y={}){let X={...N1,...Y,streaming:{...D9,...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]:"",U=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),z={...Z,__filename:$,__dirname:bZ.dirname($)};if(W.trim())await D0(W,z,$);let _=ME(U),B=new Set;if(!_.some((j)=>j.type==="suspense")){let j=X.streaming?.strategy||"auto",H=new RegExp(d6.source,"g");if(!(j!=="manual"&&H.test(U))){let V=await _0(U,z,$,X,B);for(let L=0;L<V.length;L+=J)Q.enqueue(V.slice(L,L+J)),await new Promise((F)=>setTimeout(F,0))}else{let V=[],L=new RegExp(d6.source,"g"),F;while((F=L.exec(U))!==null)V.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let A=0;for(let w of V){if(w.start>A){let R=U.slice(A,w.start);if(R.trim()){let E=await _0(R,z,$,X,B);Q.enqueue(E),await new Promise((M)=>setTimeout(M,0))}}let N=await _0(w.content,z,$,X,B);Q.enqueue(N),await new Promise((R)=>setTimeout(R,0)),A=w.end}if(A<U.length){let w=U.slice(A);if(w.trim()){let N=await _0(w,z,$,X,B);Q.enqueue(N)}}}}else{let j=new Map;for(let O of _)if(O.type==="shell"||O.type==="content"){let V=await _0(O.content,z,$,X,B);Q.enqueue(V)}else if(O.type==="suspense"&&O.name){let V=`stx-suspense-${O.name}`;Q.enqueue(`<div id="${V}" data-suspense="${O.name}" style="display:contents;">
|
|
1916
1916
|
<template data-suspense-fallback>Loading...</template>
|
|
1917
1917
|
</div>`),j.set(O.name,_0(O.content,z,$,X,B))}Q.enqueue(`
|
|
1918
1918
|
<script>
|
|
@@ -1936,7 +1936,7 @@ window.__stxSuspense.resolve('${$}', \`${X}\`);
|
|
|
1936
1936
|
</script>`}catch(Y){let X=Y instanceof Error?Y.message:String(Y);return`
|
|
1937
1937
|
<script>
|
|
1938
1938
|
window.__stxSuspense.resolve('${$}', '<div class="stx-error">Error loading content: ${v0(X)}</div>');
|
|
1939
|
-
</script>`}}function TE($,Z,Y){if(!Z||Z<=0)return $;let X,J=new Promise((Q,G)=>{X=setTimeout(()=>G(Error(`streaming boundary "${Y}" timed out after ${Z}ms`)),Z)});return Promise.race([$,J]).finally(()=>clearTimeout(X))}function jB($,Z=[],Y={}){let X=Y.timeoutMs??0;return new ReadableStream({async start(J){try{if(J.enqueue($),Z.length>0)J.enqueue(k9),await Promise.all(Z.map(async(Q)=>{let G=TE(Q.render(),X,Q.id);J.enqueue(await PZ(Q.id,G))}));J.close()}catch(Q){J.error(Q)}}})}function HB($,Z){return $.replace(EE,(Y,X,J)=>{let Q=X.trim(),G=J.split(/@fallback/i),K=G[0].trim(),W=G.length>1?G.slice(1).join("@fallback").trim():"";if(!Z.__streamTemplates)Z.__streamTemplates={};return Z.__streamTemplates[Q]=K,`<div data-suspense="${Q}">${W}</div>`})}function OB($){let Z=$?.streamBoundaries;if(!Z||typeof Z!=="object")return;let Y=Object.entries(Z).filter(([,X])=>typeof X==="function");return Y.length>0?Y.map(([X,J])=>({id:X,render:J})):void 0}async function LB($,Z={},Y={}){let X={...N1,...Y,streaming:{...D9,...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]:"",U=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),z={...Z,__filename:$,__dirname:bZ.dirname($)};if(W.trim())await D0(W,z,$);let _=new Set,B=X.streaming?.strategy||"auto",q=new RegExp(
|
|
1939
|
+
</script>`}}function TE($,Z,Y){if(!Z||Z<=0)return $;let X,J=new Promise((Q,G)=>{X=setTimeout(()=>G(Error(`streaming boundary "${Y}" timed out after ${Z}ms`)),Z)});return Promise.race([$,J]).finally(()=>clearTimeout(X))}function jB($,Z=[],Y={}){let X=Y.timeoutMs??0;return new ReadableStream({async start(J){try{if(J.enqueue($),Z.length>0)J.enqueue(k9),await Promise.all(Z.map(async(Q)=>{let G=TE(Q.render(),X,Q.id);J.enqueue(await PZ(Q.id,G))}));J.close()}catch(Q){J.error(Q)}}})}function HB($,Z){return $.replace(EE,(Y,X,J)=>{let Q=X.trim(),G=J.split(/@fallback/i),K=G[0].trim(),W=G.length>1?G.slice(1).join("@fallback").trim():"";if(!Z.__streamTemplates)Z.__streamTemplates={};return Z.__streamTemplates[Q]=K,`<div data-suspense="${Q}">${W}</div>`})}function OB($){let Z=$?.streamBoundaries;if(!Z||typeof Z!=="object")return;let Y=Object.entries(Z).filter(([,X])=>typeof X==="function");return Y.length>0?Y.map(([X,J])=>({id:X,render:J})):void 0}async function LB($,Z={},Y={}){let X={...N1,...Y,streaming:{...D9,...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]:"",U=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),z={...Z,__filename:$,__dirname:bZ.dirname($)};if(W.trim())await D0(W,z,$);let _=new Set,B=X.streaming?.strategy||"auto",q=new RegExp(d6.source,"g");if(!(B!=="manual"&&q.test(U))){let H=await _0(U,z,$,X,_);for(let O=0;O<H.length;O+=J)Q.enqueue(H.slice(O,O+J))}else{let H=[],O=new RegExp(d6.source,"g"),V;while((V=O.exec(U))!==null)H.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let L=0;for(let F of H){if(F.start>L){let w=U.slice(L,F.start);if(w.trim()){let N=await _0(w,z,$,X,_);Q.enqueue(N)}}let A=await _0(F.content,z,$,X,_);Q.enqueue(A),L=F.end}if(L<U.length){let F=U.slice(L);if(F.trim()){let A=await _0(F,z,$,X,_);Q.enqueue(A)}}}Q.close()}catch(G){Q.error(G)}}})}async function VB($,Z={}){let Y={...N1,...Z,streaming:{...D9,...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={},U;d6.lastIndex=0;while((U=d6.exec(G))!==null){let B=U[1],q=U[2];W[B]=q}let z=G.replace(d6,"");return{renderShell:async(B={})=>{let q={...B,__filename:$,__dirname:bZ.dirname($)};return await D0(Q,q,$),_0(z,q,$,Y,new Set)},renderSection:async(B,q={})=>{try{if(!W[B])return`<div class="error-message">Section "${v0(B)}" not found in template "${v0($)}"</div>`;let j={...q,__filename:$,__dirname:bZ.dirname($)};await D0(Q,j,$);let H=new Set;return await _0(W[B],j,$,Y,H)}catch(j){let H=j instanceof Error?j.message:String(j);return T0("Expression",H,$,W[B]||"",0,W[B]||"")}},getSections:()=>{return Object.keys(W)},getTemplate:()=>{return K}}}function FB($={}){let Z=[];if($.streaming?.enabled)Z.push(S9);if($.hydration?.enabled)Z.push(C9);return Z}async function AB($,Z,Y,X={}){return $}function wB($,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");if(!J.has("X-Accel-Buffering"))J.set("X-Accel-Buffering","no");return new Response(X,{...Z,headers:J})}function NB($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:X=!0}=$,J=Object.entries(Y).map(([Q,G])=>`'${Q}': ${X?`() => import('${G}')`:`require('${G}')`}`).join(`,
|
|
1940
1940
|
`);if(Z==="loader")return`
|
|
1941
1941
|
(function() {
|
|
1942
1942
|
window.__stx = window.__stx || {};
|
|
@@ -2078,7 +2078,7 @@ else {
|
|
|
2078
2078
|
else {
|
|
2079
2079
|
stx.hydrate();
|
|
2080
2080
|
}
|
|
2081
|
-
})();`}var D9,
|
|
2081
|
+
})();`}var D9,d6,BB,k9=`
|
|
2082
2082
|
<script>
|
|
2083
2083
|
(function(){
|
|
2084
2084
|
window.__stxSuspense = window.__stxSuspense || {
|
|
@@ -2098,12 +2098,12 @@ else {
|
|
|
2098
2098
|
}
|
|
2099
2099
|
};
|
|
2100
2100
|
})();
|
|
2101
|
-
</script>`,EE,S9,C9;var Y6=D(()=>{n0();$1();q1();N0();D9={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},
|
|
2101
|
+
</script>`,EE,S9,C9;var Y6=D(()=>{n0();$1();q1();N0();D9={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},d6=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,BB=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;EE=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;S9={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} -->`}},C9={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():"",U=K?$.replace(K[0],""):$;return`<div data-island="${J}" data-island-id="${G}" data-priority="${Q}">
|
|
2102
2102
|
${U}
|
|
2103
2103
|
<script type="application/json" data-island-props="${G}">
|
|
2104
2104
|
${W?`{${W}}`:"{}"}
|
|
2105
2105
|
</script>
|
|
2106
|
-
</div>`}}});var TB={}
|
|
2106
|
+
</div>`}}});var TB={};$0(TB,{warnUnbalancedTags:()=>b9,findUnbalancedTags:()=>MB});function b$($){return $.replace(/[^\n]/g," ")}function MB($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,b$).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,b$).replace(/<!--[\s\S]*?-->/g,b$).replace(/\{\{\{[\s\S]*?\}\}\}/g,b$).replace(/\{\{[\s\S]*?\}\}/g,b$).replace(/\{!![\s\S]*?!!\}/g,b$),Y=new Map,X=new Map,J=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,Q;while((Q=J.exec(Z))!==null){let K=Q[1]==="/",W=Q[2],U=Q[3]==="/";if(IE.has(W.toLowerCase()))continue;if(U)continue;if(K)X.set(W,(X.get(W)??0)+1);else{let z=Y.get(W);if(z)z.count++;else{let _=Z.slice(0,Q.index).split(`
|
|
2107
2107
|
`).length;Y.set(W,{count:1,firstLine:_})}}}let G=[];for(let K of new Set([...Y.keys(),...X.keys()])){if(DE.has(K.toLowerCase()))continue;let W=Y.get(K)?.count??0,U=X.get(K)??0;if(W!==U)G.push({tag:K,opened:W,closed:U,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function b9($,Z){let Y;try{Y=MB($)}catch{return}if(Y.length===0)return;let X=`${Z}:${$.length}`;if(RB.has(X))return;RB.add(X);let J=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:Q,opened:G,closed:K,firstOpenLine:W}of Y)if(G>K){let U=W?` (first opened at line ${W})`:"";console.warn(`[stx] ${J}: <${Q}> ${G} opened, ${K} closed \u2014 an unclosed <${Q}>${U} may swallow the content that follows it.`)}else console.warn(`[stx] ${J}: <${Q}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${Q}>.`)}var IE,DE,RB;var P9=D(()=>{IE=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),DE=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);RB=new Set});import u1 from"path";import y9 from"fs";function EB($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function IB($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class DB{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(),EB(J),IB(J)];for(let j of q)if(Q.has(j))return Q.get(j)}let G=[...new Set([`${J}.stx`,`${EB(J)}.stx`,`${IB(J)}.stx`])];if(J.startsWith("./")||J.startsWith("../")){let q=u1.resolve(u1.dirname(Z),`${J}.stx`);if(await J0(q))return q;return null}let K=[],W=Y.componentsDir||"",U=X?.__originalFilePath;if(U)K.push(u1.join(u1.dirname(U),"components"));if(W)K.push(W);let z=u1.join(u1.dirname(Z),"components");if(!K.includes(z))K.push(z);let _=process.cwd(),B=[u1.resolve(_,"src/components"),u1.resolve(_,"components"),u1.resolve(import.meta.dir,"components")];for(let q of B)if(!K.includes(q))K.push(q);for(let q of K){if(!q)continue;for(let j of G){let H=u1.join(q,j);if(await J0(H))return H}try{if(!y9.statSync(q,{throwIfNoEntry:!1})?.isDirectory())continue;let H=y9.readdirSync(q,{withFileTypes:!0});for(let O of H)if(O.isDirectory()){let V=u1.join(q,O.name);for(let L of G){let F=u1.join(V,L);if(await J0(F))return F}}}catch{}}return null}}var R1;var x9=D(()=>{N0();R1=new DB});function j1($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function P$($,Z){let Y=[];for(let[X,J]of Object.entries($.static)){if(Z.has(X))continue;let Q=$.staticNames?.[X]??X;if(typeof J==="boolean"){if(J)Y.push(j1(Q));continue}Y.push(`${j1(Q)}="${j1(J)}"`)}return Y}var yZ=()=>{};function y7($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function kE($){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 v9;var f9=D(()=>{yZ();v9={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let X=kE($),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="${y7(X.value)}"`);else W.push(`href="${y7(X.value)}"`);if(J)W.push(`class="${y7(J)}"`);if(W.push("data-stx-link"),W.push(`data-stx-active-class="${y7(Q)}"`),W.push(`data-stx-exact-active-class="${y7(G)}"`),K)W.push("data-stx-prefetch");let U=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return W.push(...P$($,U)),`<a ${W.join(" ")}>${Z}</a>`}}});function W1($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function H1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function h9($,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 kB($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let X of Z)if(X.includes(":")){let[J,Q]=X.split(":"),G=SE[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 d9($,Z,Y,X){return Z.map((J)=>`${x7($,J,void 0,Y,X)} ${J}w`).join(", ")}function CE($,Z,Y,X,J){return Z.map((Q)=>{let G=Y?Y*Q:void 0;return`${x7($,G,void 0,X,J)} ${Q}x`}).join(", ")}function x7($,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 bE($,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 SE,g9,u9;var m9=D(()=>{yZ();SE={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},g9=[320,640,768,1024,1280,1536,1920];u9={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let X=H1($,"src")||"",J=H1($,"alt")||"",Q=H1($,"width"),G=H1($,"height"),K=H1($,"sizes"),W=H1($,"srcset"),U=H1($,"densities"),z=H1($,"format"),_=H1($,"placeholder"),B=H1($,"placeholderColor")||"#e5e7eb",q=H1($,"provider"),j=H1($,"class")||H1($,"className")||"",H=H1($,"style")||"",O=H1($,"quality"),V=h9($,"lazy",!0),L=h9($,"preload",!1),F=h9($,"picture",!1)||!!z,A=Q?Number.parseInt(Q):void 0,w=G?Number.parseInt(G):void 0,N=W||"",R="";if(!N&&K)N=d9(X,g9,q,z),R=kB(K);else if(!N&&U){let y=U.split(/\s+/).map((b)=>Number.parseFloat(b.replace("x","")));N=CE(X,y,A,q,z)}else if(K)R=kB(K);let E=[];if(H)E.push(H);if(A&&w)E.push(`aspect-ratio:${A}/${w}`);if(_==="blur"||_==="color"||_==="thumbhash"){let y=bE(A||16,w||9,B);E.push(`background-image:url(${y})`),E.push("background-size:cover"),E.push("background-repeat:no-repeat")}else if(_&&_!=="empty"&&_!=="none")E.push(`background-image:url(${W1(_)})`),E.push("background-size:cover"),E.push("background-repeat:no-repeat");let M=x7(X,A,w,q,z),I=[];if(I.push(`src="${W1(M)}"`),I.push(`alt="${W1(J)}"`),Q)I.push(`width="${W1(Q)}"`);if(G)I.push(`height="${W1(G)}"`);if(V)I.push('loading="lazy"');if(I.push('decoding="async"'),j)I.push(`class="${W1(j)}"`);if(E.length>0)I.push(`style="${W1(E.join(";"))}"`);if(N)I.push(`srcset="${W1(N)}"`);if(R)I.push(`sizes="${W1(R)}"`);let S=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);I.push(...P$($,S));let k=`<img ${I.join(" ")} />`,x="";if(L){let b=z==="webp"?"image/webp":z==="avif"?"image/avif":"";x=`<link rel="preload" as="image" href="${W1(M)}"${b?` type="${b}"`:""}${N?` imagesrcset="${W1(N)}"`:""}${R?` imagesizes="${W1(R)}"`:""} />
|
|
2108
2108
|
`}if(F){let y=[];if(z==="avif"||z==="auto"){let b=x7(X,A,w,q,"avif"),g=N?d9(X,g9,q,"avif"):`${b}`;y.push(`<source type="image/avif" srcset="${W1(g)}"${R?` sizes="${W1(R)}"`:""} />`)}if(z==="webp"||z==="auto"){let b=x7(X,A,w,q,"webp"),g=N?d9(X,g9,q,"webp"):`${b}`;y.push(`<source type="image/webp" srcset="${W1(g)}"${R?` sizes="${W1(R)}"`:""} />`)}return`${x}<picture>
|
|
2109
2109
|
${y.join(`
|
|
@@ -2142,11 +2142,11 @@ ${k}
|
|
|
2142
2142
|
@media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
|
|
2143
2143
|
.stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
|
|
2144
2144
|
.stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
|
|
2145
|
-
</style>`}}});import{existsSync as xE,readFileSync as vE}from"fs";function vB($){if(xB.has($))return;xB.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function fB($){let Z=process.cwd();for(let Y of[`${Z}/node_modules/@iconify-json/${$}/icons.json`,`${Z}/pantry/@iconify-json/${$}/icons.json`,`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(xE(Y))return Y;for(let Y of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return Z0.resolve(Y)}catch{}return null}function fE($){if(
|
|
2146
|
-
`||E==="\t")V++;L=N+H.length}else{if(V--,V===0){F=R;break}L=R+O.length}}if(F===-1){J=B;continue}let A=$.slice(B,F),w=F+O.length;X.push({fullMatch:$.slice(Q,w),tagName:W,attributes:j,content:A,startIndex:Q,endIndex:w,isSelfClosing:!1}),J=w}}return X}function mB($,Z){try{let Y=Buffer.from($,"base64").toString("utf8");return JSON.parse(Y)}catch{}try{let Y=$.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(Y)}catch(Y){if(Z?.debug)console.error("Error decoding __stx_ prop:",Y);return $}}var lB=D(()=>{i0();N0();C6()});var sB={};e(sB,{processESImports:()=>rB,processComponents:()=>dZ});import hZ from"fs";import C1 from"path";function dE($,Z,Y){let X={static:{},staticNames:{},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=(K)=>{if(!K.includes("-")||K.startsWith("@")||K.startsWith(":")||K.startsWith("x-")||K.startsWith("__"))return K;if(K.startsWith("aria-")||K.startsWith("data-"))return K;return K.replace(/-([a-z0-9])/g,(W,U)=>U.toUpperCase())},G=(K,W)=>{let U=Q(K);if(X.static[U]=W,U!==K)X.staticNames[U]=K};for(let[K,W]of Object.entries($)){let U=K.startsWith("x-")&&!J.has(K)&&!K.startsWith("x-bind:")&&!K.startsWith("x-on:")?`:${K.slice(2)}`:K;if(U.startsWith("@")){X.events[U]=W;continue}if(U.startsWith("__stx_")){let z=Q(U.slice(6));X.serverDynamic[z]=mB(W,Y);continue}if(U.startsWith(":")){let z=Q(U.slice(1)),_=W===W2?z:W;if(z==="if"||z==="for"||z==="show"){X.clientReactive[z]=_;continue}try{if(!R0(_)){if(Y.debug)console.error(`Unsafe expression in :${z} binding: ${_}`);X.clientReactive[z]=_;continue}let B=Object.keys(Z),j=M0(_,B)(...Object.values(Z));if(j===void 0){let H=_.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],O=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(H.some((L)=>!O.has(L)&&!B.includes(L))){X.clientReactive[z]=_;continue}}X.serverDynamic[z]=j}catch{X.clientReactive[z]=_}continue}if(typeof W==="string"&&W.includes("{{")&&W.includes("}}")){let z=W.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(z)try{let _=z[1];if(R0(_)){let q=M0(_,Object.keys(Z))(...Object.values(Z));G(U,q!=null?String(q):"")}else{if(Y.debug)console.error(`Unsafe expression in ${U}: ${_}`);G(U,W)}}catch(_){if(Y.debug)console.error(`Error evaluating expression for ${U}:`,_);G(U,W)}else{let _=W,B=/\{\{\s*([\s\S]+?)\s*\}\}/g,q;while((q=B.exec(W))!==null)try{let j=q[1];if(!R0(j)){if(Y.debug)console.error(`Unsafe expression in ${U}: ${j}`);continue}let O=M0(j,Object.keys(Z))(...Object.values(Z));_=_.replace(q[0],String(O??""))}catch(j){if(Y.debug)console.error(`Error evaluating expression in ${U}:`,j)}G(U,_)}continue}G(U,W===W2?"true":W)}return X}function uE($){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]=W2}return Z}function pB($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function mE($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,X;while((X=Y.exec($))!==null){let J=X[1];if(R1.isBuiltin(J))Z.add(J)}return[...Z].sort()}function lE($){let Z=iB.get($);if(Z)return Z;let Y=new Map,X=[C1.join($,"src"),C1.join($,"dist"),$];function J(Q,G){if(G>6)return;let K;try{K=hZ.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let W of K){let U=C1.join(Q,W.name);if(W.isDirectory()){if(W.name==="node_modules"||W.name.startsWith("."))continue;J(U,G+1)}else if(W.isFile()&&W.name.endsWith(".stx")){let z=W.name.slice(0,-4);if(!Y.has(z))Y.set(z,U);let _=z.toLowerCase();if(!Y.has(_))Y.set(_,U);let B=z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(B))Y.set(B,U)}}}for(let Q of X)if(J(Q,0),Y.size>0)break;return iB.set($,Y),Y}function cE($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let X=C1.join(Y,"node_modules",$);try{if(hZ.statSync(X).isDirectory())return X}catch{}let J=C1.dirname(Y);if(J===Y)return null;Y=J}}async function rB($,Z,Y,X,J){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=C1.dirname(Y),K=$,W=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(W,(U,z,_)=>{let B=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,q=_,j,H=[];while((j=B.exec(_))!==null){let[O,V,L,F]=j,A=null,w=null;if(F.startsWith(".")||F.startsWith("/")){let E=C1.resolve(G,F);if(E.endsWith(".stx"))w=E;else{let M=`${E}.stx`;try{if(hZ.statSync(M).isFile())w=M}catch{try{if(hZ.statSync(E).isDirectory())A=E}catch{}}}}else A=cE(F,G);if(!A&&!w)continue;let N=!1,R=(E,M)=>{Q.set(E,M),Q.set(E.toLowerCase(),M);let I=E.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(I,M),J.add(M)};if(L&&w)R(L,w),N=!0;else if(V){let E=V.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let S=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(S)return{source:S[1],local:S[2]};return{source:I,local:I}}),M=A?lE(A):null;for(let{source:I,local:S}of E){let k=null;if(w)k=w;else if(M)k=M.get(I)??M.get(I.toLowerCase())??M.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(k)R(S,k),N=!0}}if(N)H.push({start:j.index,end:j.index+O.length})}if(H.length===0)return U;for(let O=H.length-1;O>=0;O--)q=q.slice(0,H[O].start)+q.slice(H[O].end);return`<script${z}>${q}</script>`}),K}async function pE($,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[U,z]=W,_=z.split(",").map((B)=>B.trim().replace(/^['"]|['"]$/g,"")).filter((B)=>B.length>0);for(let B of _){let q=B.split("/"),H=q[q.length-1].replace(/\.stx$/,""),O=H.includes("-")?H.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),V=null,L=[C1.resolve(C1.dirname(Y),`${B}.stx`),C1.resolve(C1.dirname(Y),B),C1.resolve(X.componentsDir||"components",`${B}.stx`),C1.resolve(X.componentsDir||"components",B),B.endsWith(".stx")?B:`${B}.stx`];for(let F of L)try{if(await Bun.file(F).exists()){V=F;break}}catch{}if(V){G.set(O,V),G.set(H,V),G.set(H.toLowerCase(),V);let F=O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(F,V),J.add(V),X.debug)console.log(`Imported component: ${O} -> ${V}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${B}`)}Q=Q.replace(U,""),K.lastIndex=0}return Q}async function iE($,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,U;while((U=W.exec(Q))!==null){let z=U.index,_=z+U[0].length-1,B=1,q=_+1;while(q<Q.length&&B>0){if(Q[q]==="(")B++;else if(Q[q]===")"){if(B--,B===0)break}q++}if(B!==0)break;let j=Q.substring(_+1,q),H=q+1,O=j.match(/^\s*['"]([^'"]+)['"]/);if(!O){W.lastIndex=0;continue}let V=O[1],L,F=j.slice(O[0].length),A=F.match(/^\s*,\s*/);if(A)L=F.slice(A[0].length).trim();let w={};if(L)try{w=p0(L,Z)}catch(S){let k=S instanceof Error?S.message:String(S);Q=Q.replace(Q.substring(z,H),`[Error parsing component props: ${k}]`);continue}let N="",R=H,M=Q.substring(H).match(/^([\s\S]*?)@endcomponent/);if(M)N=M[1].trim(),R=H+M[0].length;let I=await z4(V,w,N,G,Z,Y,X,K,J);Q=Q.substring(0,z)+I+Q.substring(R),W.lastIndex=0}return Q}async function nE($,Z,Y,X,J){if(!$)return $;let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,W=n4(Q);return Q=W.output,Q=await B(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await B(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await B(Q,/[a-z][a-z0-9]*/,!1,hE),Q=_7(Q,W.scripts),Q;async function B(q,j,H,O){if(!q)return q;let V=q,L=uB(V,j,O);for(let F=L.length-1;F>=0;F--){let A=L[F],w=H?gZ(A.tagName):A.tagName,N=uE(A.attributes),R=dE(N,Z,X),E=R1.getBuiltin(A.tagName),M=E?await g7(w,G,Z,Y,X):!1;if(E&&!M){let x={context:Z,filePath:Y,options:X,dependencies:J},y=E.render(R,A.content,x);if(Object.keys(R.clientReactive).length>0)y=nB(y,R.clientReactive);if(Object.keys(R.events).length>0){let b=Object.entries(R.events).map(([g,r])=>`${g}="${pB(r)}"`).join(" ");y=y.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${b}`)}V=V.substring(0,A.startIndex)+y+V.substring(A.endIndex);continue}if(!H&&A.tagName.includes("-")&&!await g7(w,G,Z,Y,X))continue;let I={};for(let[x,y]of Object.entries(R.static))I[x]=y;for(let[x,y]of Object.entries(R.serverDynamic))I[x]=y;let k=await z4(w,I,A.content,G,Z,Y,X,K,J);if(Object.keys(R.clientReactive).length>0)k=nB(k,R.clientReactive);if(Object.keys(R.events).length>0){let x=aB(k);if(x){let y=Object.entries(R.events).map(([g,r])=>`${g}="${pB(r)}"`).join(" "),b=Object.keys(R.events).map((g)=>g.replace(/^@/,"").split(".")[0]).join(" ");k=k.substring(0,x.insertPos)+` data-stx-parent-events="${b}" ${y}`+k.substring(x.insertPos)}}V=V.substring(0,A.startIndex)+k+V.substring(A.endIndex)}return V}}function nB($,Z){let Y=new Set(["if","for"]),X=new Set(["show"]),J=Object.entries(Z).filter(([z])=>!Y.has(z)),Q=J.filter(([z])=>!X.has(z)).map(([z])=>gZ(z)).join(" "),G=$,K=J.length>0?aB(G):null;if(K){let z=J.map(([B,q])=>`:${gZ(B)}="${q.replace(/"/g,""")}"`).join(" "),_=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,K.insertPos)+`${_} ${z}`+G.substring(K.insertPos)}let W=Z.if;if(W)G=`<template :if="${W.replace(/"/g,""")}">${G}</template>`;let U=Z.for;if(U)G=`<template :for="${U.replace(/"/g,""")}">${G}</template>`;return G}function aB($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let Y=0;while(Y<$.length){let X=$.slice(Y),J=X.match(/^\s+/);if(J){Y+=J[0].length;continue}if(X.startsWith("<!--")){let K=$.indexOf("-->",Y+4);if(K===-1)return null;Y=K+3;continue}let Q=X.match(/^<(script|style)\b[^>]*>/i);if(Q){let K=`</${Q[1].toLowerCase()}>`,W=$.toLowerCase().indexOf(K,Y+Q[0].length);if(W===-1)return null;Y=W+K.length;continue}let G=X.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:Y+1+G[1].length}}return null}async function dZ($,Z,Y,X,J){if(!cB)dB(),cB=!0;let Q=await rB($,Z,Y,X,J);Q=await pE(Q,Z,Y,X,J),Q=await iE(Q,Z,Y,X,J);let G=[];for(let K=0;K<3;K++){let W=Q4(Q,z7,(z,_)=>`\x00STX_COMPONENT_COMMENT_${G.length+_}\x00`);G.push(...W.tokens);let U=Q;if(Q=await nE(W.output,Z,Y,X,J),Q===U)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(K,W)=>G[Number(W)]??"");if(X.debug){let K=mE(Q);if(K.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${K.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}var cB=!1,W2="\x00stx-boolean-attribute",hE,iB;var U2=D(()=>{x9();K2();lB();C6();N0();i0();hE=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"]);iB=new Map});var mZ={};e(mZ,{stripTypeScript:()=>Zq,isCompleteImport:()=>Yq,hasVariables:()=>B2,extractVariables:()=>D0,extractScriptFromTemplate:()=>_2,convertToCommonJS:()=>uZ});import f$ from"path";import h7 from"process";function rE($){let Z=[],Y=0,X=$.split(`
|
|
2145
|
+
</style>`}}});import{existsSync as xE,readFileSync as vE}from"fs";function vB($){if(xB.has($))return;xB.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function fB($){let Z=process.cwd();for(let Y of[`${Z}/node_modules/@iconify-json/${$}/icons.json`,`${Z}/pantry/@iconify-json/${$}/icons.json`,`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(xE(Y))return Y;for(let Y of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return Z0.resolve(Y)}catch{}return null}function fE($){if(m6.has($))return m6.get($);let Z=fB($);if(!Z)return vB($),null;try{let Y=JSON.parse(vE(Z,"utf8"));return m6.set($,Y.icons),Y.icons}catch{return null}}async function gE($){if(m6.has($))return m6.get($);let Z=fB($);if(!Z)return vB($),null;try{let Y=await Bun.file(Z).json();return m6.set($,Y.icons),Y.icons}catch{return null}}function v$($,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 Z2($="lucide"){await gE($)}var m6,xB,$2;var Y2=D(()=>{m6=new Map,xB=new Set;$2={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let X=v$($,"name")??v$($,"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=j1(v$($,"size")||"24"),K=j1(v$($,"color")||"currentColor"),W=j1(v$($,"class")||""),U=j1(v$($,"style")||""),z=m6.get(J)??fE(J);if(!z)return`<!-- Icon: collection "${J}" not loaded -->`;let _=z[Q];if(!_)return`<!-- Icon: "${Q}" not found in ${J} -->`;let B=_.width||24,q=_.height||24,j=`0 0 ${B} ${q}`,H=_.body;if(K!=="currentColor")H=H.replace(/currentColor/g,K);let O=W?` class="${W}"`:"",V=U?` style="${U}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${j}" fill="none"${O}${V}>${H}</svg>`}}});function gB($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let X=$.static[Y];if(typeof X==="string")return X}return}function hB($,Z){let Y=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),X=$.match(Y);if(!X)return{region:null,rest:$};return{region:X[2],rest:$.replace(X[0],"")}}var X2;var J2=D(()=>{X2={name:"Suspense",aliases:["suspense"],render($,Z,Y){let X=hB(Z,"fallback"),J=X.rest,Q=hB(J,"error"),G=Q.rest,K=X.region??gB($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',W=Q.region??gB($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${K}</div><div data-stx-suspense-error hidden>${W}</div><div data-stx-suspense-content hidden>${G}</div></div>`}}});function fZ($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let X=$.static[Y];if(typeof X==="string")return X}return}var Q2;var G2=D(()=>{Q2={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let X=(fZ($,"name")||"v").replace(/["'<>]/g,""),J=(fZ($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=fZ($,"class"),G=fZ($,"id"),K=[`data-stx-transition-group="${X}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${J} ${K}>${Z}</${J}>`}}});function dB(){R1.registerBuiltin(v9),R1.registerBuiltin(u9),R1.registerBuiltin(l9),R1.registerBuiltin(i9),R1.registerBuiltin(r9),R1.registerBuiltin(s9),R1.registerBuiltin(t9),R1.registerBuiltin($2),R1.registerBuiltin(X2),R1.registerBuiltin(Q2)}var K2=D(()=>{f9();m9();c9();n9();a9();o9();e9();Y2();J2();G2();x9();f9();m9();c9();n9();a9();o9();e9();Y2();J2();G2()});function gZ($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function uB($,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 U=Q+1+W.length,z=null,_=U,B=-1,q=!1;while(U<$.length){let H=$[U];if(z){if(H==="\\"&&U+1<$.length){U+=2;continue}if(H===z)z=null;U++;continue}if(H==='"'||H==="'"){z=H,U++;continue}if(H==="/"&&U+1<$.length&&$[U+1]===">"){B=U+2,q=!0;break}if(H===">"){B=U+1;break}U++}if(B===-1){J=Q+1;continue}let j=$.slice(_,q?B-2:B-1).trim();if(q)X.push({fullMatch:$.slice(Q,B),tagName:W,attributes:j,content:"",startIndex:Q,endIndex:B,isSelfClosing:!0}),J=B;else{let H=`<${W}`,O=`</${W}>`,V=1,L=B,F=-1;while(V>0&&L<$.length){let N=$.indexOf(H,L),R=$.indexOf(O,L);if(R===-1)break;if(N!==-1&&N<R){let E=$[N+H.length];if(E===" "||E===">"||E==="/"||E===`
|
|
2146
|
+
`||E==="\t")V++;L=N+H.length}else{if(V--,V===0){F=R;break}L=R+O.length}}if(F===-1){J=B;continue}let A=$.slice(B,F),w=F+O.length;X.push({fullMatch:$.slice(Q,w),tagName:W,attributes:j,content:A,startIndex:Q,endIndex:w,isSelfClosing:!1}),J=w}}return X}function mB($,Z){try{let Y=Buffer.from($,"base64").toString("utf8");return JSON.parse(Y)}catch{}try{let Y=$.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(Y)}catch(Y){if(Z?.debug)console.error("Error decoding __stx_ prop:",Y);return $}}var lB=D(()=>{i0();N0();P6()});var sB={};$0(sB,{processESImports:()=>rB,processComponents:()=>dZ});import hZ from"fs";import C1 from"path";function dE($,Z,Y){let X={static:{},staticNames:{},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=(K)=>{if(!K.includes("-")||K.startsWith("@")||K.startsWith(":")||K.startsWith("x-")||K.startsWith("__"))return K;if(K.startsWith("aria-")||K.startsWith("data-"))return K;return K.replace(/-([a-z0-9])/g,(W,U)=>U.toUpperCase())},G=(K,W)=>{let U=Q(K);if(X.static[U]=W,U!==K)X.staticNames[U]=K};for(let[K,W]of Object.entries($)){let U=K.startsWith("x-")&&!J.has(K)&&!K.startsWith("x-bind:")&&!K.startsWith("x-on:")?`:${K.slice(2)}`:K;if(U.startsWith("@")){X.events[U]=W;continue}if(U.startsWith("__stx_")){let z=Q(U.slice(6));X.serverDynamic[z]=mB(W,Y);continue}if(U.startsWith(":")){let z=Q(U.slice(1)),_=W===W2?z:W;if(z==="if"||z==="for"||z==="show"){X.clientReactive[z]=_;continue}try{if(!R0(_)){if(Y.debug)console.error(`Unsafe expression in :${z} binding: ${_}`);X.clientReactive[z]=_;continue}let B=Object.keys(Z),j=M0(_,B)(...Object.values(Z));if(j===void 0){let H=_.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],O=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(H.some((L)=>!O.has(L)&&!B.includes(L))){X.clientReactive[z]=_;continue}}X.serverDynamic[z]=j}catch{X.clientReactive[z]=_}continue}if(typeof W==="string"&&W.includes("{{")&&W.includes("}}")){let z=W.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(z)try{let _=z[1];if(R0(_)){let q=M0(_,Object.keys(Z))(...Object.values(Z));G(U,q!=null?String(q):"")}else{if(Y.debug)console.error(`Unsafe expression in ${U}: ${_}`);G(U,W)}}catch(_){if(Y.debug)console.error(`Error evaluating expression for ${U}:`,_);G(U,W)}else{let _=W,B=/\{\{\s*([\s\S]+?)\s*\}\}/g,q;while((q=B.exec(W))!==null)try{let j=q[1];if(!R0(j)){if(Y.debug)console.error(`Unsafe expression in ${U}: ${j}`);continue}let O=M0(j,Object.keys(Z))(...Object.values(Z));_=_.replace(q[0],String(O??""))}catch(j){if(Y.debug)console.error(`Error evaluating expression in ${U}:`,j)}G(U,_)}continue}G(U,W===W2?"true":W)}return X}function uE($){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]=W2}return Z}function pB($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function mE($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,X;while((X=Y.exec($))!==null){let J=X[1];if(R1.isBuiltin(J))Z.add(J)}return[...Z].sort()}function lE($){let Z=iB.get($);if(Z)return Z;let Y=new Map,X=[C1.join($,"src"),C1.join($,"dist"),$];function J(Q,G){if(G>6)return;let K;try{K=hZ.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let W of K){let U=C1.join(Q,W.name);if(W.isDirectory()){if(W.name==="node_modules"||W.name.startsWith("."))continue;J(U,G+1)}else if(W.isFile()&&W.name.endsWith(".stx")){let z=W.name.slice(0,-4);if(!Y.has(z))Y.set(z,U);let _=z.toLowerCase();if(!Y.has(_))Y.set(_,U);let B=z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(B))Y.set(B,U)}}}for(let Q of X)if(J(Q,0),Y.size>0)break;return iB.set($,Y),Y}function cE($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let X=C1.join(Y,"node_modules",$);try{if(hZ.statSync(X).isDirectory())return X}catch{}let J=C1.dirname(Y);if(J===Y)return null;Y=J}}async function rB($,Z,Y,X,J){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=C1.dirname(Y),K=$,W=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(W,(U,z,_)=>{let B=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,q=_,j,H=[];while((j=B.exec(_))!==null){let[O,V,L,F]=j,A=null,w=null;if(F.startsWith(".")||F.startsWith("/")){let E=C1.resolve(G,F);if(E.endsWith(".stx"))w=E;else{let M=`${E}.stx`;try{if(hZ.statSync(M).isFile())w=M}catch{try{if(hZ.statSync(E).isDirectory())A=E}catch{}}}}else A=cE(F,G);if(!A&&!w)continue;let N=!1,R=(E,M)=>{Q.set(E,M),Q.set(E.toLowerCase(),M);let I=E.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(I,M),J.add(M)};if(L&&w)R(L,w),N=!0;else if(V){let E=V.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let S=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(S)return{source:S[1],local:S[2]};return{source:I,local:I}}),M=A?lE(A):null;for(let{source:I,local:S}of E){let k=null;if(w)k=w;else if(M)k=M.get(I)??M.get(I.toLowerCase())??M.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(k)R(S,k),N=!0}}if(N)H.push({start:j.index,end:j.index+O.length})}if(H.length===0)return U;for(let O=H.length-1;O>=0;O--)q=q.slice(0,H[O].start)+q.slice(H[O].end);return`<script${z}>${q}</script>`}),K}async function pE($,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[U,z]=W,_=z.split(",").map((B)=>B.trim().replace(/^['"]|['"]$/g,"")).filter((B)=>B.length>0);for(let B of _){let q=B.split("/"),H=q[q.length-1].replace(/\.stx$/,""),O=H.includes("-")?H.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),V=null,L=[C1.resolve(C1.dirname(Y),`${B}.stx`),C1.resolve(C1.dirname(Y),B),C1.resolve(X.componentsDir||"components",`${B}.stx`),C1.resolve(X.componentsDir||"components",B),B.endsWith(".stx")?B:`${B}.stx`];for(let F of L)try{if(await Bun.file(F).exists()){V=F;break}}catch{}if(V){G.set(O,V),G.set(H,V),G.set(H.toLowerCase(),V);let F=O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(F,V),J.add(V),X.debug)console.log(`Imported component: ${O} -> ${V}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${B}`)}Q=Q.replace(U,""),K.lastIndex=0}return Q}async function iE($,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,U;while((U=W.exec(Q))!==null){let z=U.index,_=z+U[0].length-1,B=1,q=_+1;while(q<Q.length&&B>0){if(Q[q]==="(")B++;else if(Q[q]===")"){if(B--,B===0)break}q++}if(B!==0)break;let j=Q.substring(_+1,q),H=q+1,O=j.match(/^\s*['"]([^'"]+)['"]/);if(!O){W.lastIndex=0;continue}let V=O[1],L,F=j.slice(O[0].length),A=F.match(/^\s*,\s*/);if(A)L=F.slice(A[0].length).trim();let w={};if(L)try{w=p0(L,Z)}catch(S){let k=S instanceof Error?S.message:String(S);Q=Q.replace(Q.substring(z,H),`[Error parsing component props: ${k}]`);continue}let N="",R=H,M=Q.substring(H).match(/^([\s\S]*?)@endcomponent/);if(M)N=M[1].trim(),R=H+M[0].length;let I=await z4(V,w,N,G,Z,Y,X,K,J);Q=Q.substring(0,z)+I+Q.substring(R),W.lastIndex=0}return Q}async function nE($,Z,Y,X,J){if(!$)return $;let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,W=n4(Q);return Q=W.output,Q=await B(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await B(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await B(Q,/[a-z][a-z0-9]*/,!1,hE),Q=_7(Q,W.scripts),Q;async function B(q,j,H,O){if(!q)return q;let V=q,L=uB(V,j,O);for(let F=L.length-1;F>=0;F--){let A=L[F],w=H?gZ(A.tagName):A.tagName,N=uE(A.attributes),R=dE(N,Z,X),E=R1.getBuiltin(A.tagName),M=E?await g7(w,G,Z,Y,X):!1;if(E&&!M){let x={context:Z,filePath:Y,options:X,dependencies:J},y=E.render(R,A.content,x);if(Object.keys(R.clientReactive).length>0)y=nB(y,R.clientReactive);if(Object.keys(R.events).length>0){let b=Object.entries(R.events).map(([g,r])=>`${g}="${pB(r)}"`).join(" ");y=y.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${b}`)}V=V.substring(0,A.startIndex)+y+V.substring(A.endIndex);continue}if(!H&&A.tagName.includes("-")&&!await g7(w,G,Z,Y,X))continue;let I={};for(let[x,y]of Object.entries(R.static))I[x]=y;for(let[x,y]of Object.entries(R.serverDynamic))I[x]=y;let k=await z4(w,I,A.content,G,Z,Y,X,K,J);if(Object.keys(R.clientReactive).length>0)k=nB(k,R.clientReactive);if(Object.keys(R.events).length>0){let x=aB(k);if(x){let y=Object.entries(R.events).map(([g,r])=>`${g}="${pB(r)}"`).join(" "),b=Object.keys(R.events).map((g)=>g.replace(/^@/,"").split(".")[0]).join(" ");k=k.substring(0,x.insertPos)+` data-stx-parent-events="${b}" ${y}`+k.substring(x.insertPos)}}V=V.substring(0,A.startIndex)+k+V.substring(A.endIndex)}return V}}function nB($,Z){let Y=new Set(["if","for"]),X=new Set(["show"]),J=Object.entries(Z).filter(([z])=>!Y.has(z)),Q=J.filter(([z])=>!X.has(z)).map(([z])=>gZ(z)).join(" "),G=$,K=J.length>0?aB(G):null;if(K){let z=J.map(([B,q])=>`:${gZ(B)}="${q.replace(/"/g,""")}"`).join(" "),_=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,K.insertPos)+`${_} ${z}`+G.substring(K.insertPos)}let W=Z.if;if(W)G=`<template :if="${W.replace(/"/g,""")}">${G}</template>`;let U=Z.for;if(U)G=`<template :for="${U.replace(/"/g,""")}">${G}</template>`;return G}function aB($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let Y=0;while(Y<$.length){let X=$.slice(Y),J=X.match(/^\s+/);if(J){Y+=J[0].length;continue}if(X.startsWith("<!--")){let K=$.indexOf("-->",Y+4);if(K===-1)return null;Y=K+3;continue}let Q=X.match(/^<(script|style)\b[^>]*>/i);if(Q){let K=`</${Q[1].toLowerCase()}>`,W=$.toLowerCase().indexOf(K,Y+Q[0].length);if(W===-1)return null;Y=W+K.length;continue}let G=X.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:Y+1+G[1].length}}return null}async function dZ($,Z,Y,X,J){if(!cB)dB(),cB=!0;let Q=await rB($,Z,Y,X,J);Q=await pE(Q,Z,Y,X,J),Q=await iE(Q,Z,Y,X,J);let G=[];for(let K=0;K<3;K++){let W=Q4(Q,z7,(z,_)=>`\x00STX_COMPONENT_COMMENT_${G.length+_}\x00`);G.push(...W.tokens);let U=Q;if(Q=await nE(W.output,Z,Y,X,J),Q===U)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(K,W)=>G[Number(W)]??"");if(X.debug){let K=mE(Q);if(K.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${K.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}var cB=!1,W2="\x00stx-boolean-attribute",hE,iB;var U2=D(()=>{x9();K2();lB();P6();N0();i0();hE=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"]);iB=new Map});var mZ={};$0(mZ,{stripTypeScript:()=>Zq,isCompleteImport:()=>Yq,hasVariables:()=>B2,extractVariables:()=>D0,extractScriptFromTemplate:()=>_2,convertToCommonJS:()=>uZ});import f$ from"path";import h7 from"process";function rE($){let Z=[],Y=0,X=$.split(`
|
|
2147
2147
|
`);for(let J of X){let Q=Y,G=null,K=!1;for(let W=0;W<J.length;W++){let U=J[W];if(K){K=!1;continue}if(U==="\\"){K=!0;continue}if(G){if(U===G)G=null;continue}if(U==="'"||U==='"'||U==="`"){G=U;continue}if(U==="/"&&W+1<J.length&&J[W+1]==="/")break;if(U==="{")Y++;else if(U==="}")Y--}if(Q===0){let W=J.match(/(?:const|let|var)\s+(\w+)\s*=/);if(W)Z.push(W[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(J)){let U=J.match(/(?:const|let|var)\s+(\w+)/);if(U)Z.push(U[1])}else{let U=J.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(U){let _=U[1].slice(1,-1).split(",").map((B)=>{let q=B.split(":");return(q.length>1?q[1]:q[0]).trim()}).filter((B)=>/^\w+$/.test(B));Z.push(..._)}}}}return[...new Set(Z)]}function Zq($){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 U=0;U<X.length;U++){let z=X[U];if(W){if(Q+=z,z===W)W=null;continue}if(z==='"'||z==="'"||z==="`"){W=z,Q+=z;continue}if(z==="<")G++;else if(z===">"&&G>0)G--;else if(z==="(")K++;else if(z===")")K--;if(z===","&&G===0&&K===0){J.push(Q),Q="";continue}Q+=z}if(Q)J.push(Q);return J.map((U)=>{let z=U.trim(),_=z.startsWith("..."),B=_?z.slice(3):z,q=-1,j=0;for(let w=0;w<B.length;w++)if(B[w]==="<")j++;else if(B[w]===">")j--;else if(B[w]===":"&&j===0){q=w;break}if(q===-1)return U;let O=B.substring(0,q).trim().replace(/\?$/,""),V=B.substring(q+1),L=-1,F=0;for(let w=0;w<V.length;w++)if(V[w]==="<")F++;else if(V[w]===">")F--;else if(V[w]==="="&&F===0){L=w;break}let A=_?"...":"";if(L!==-1)return`${A}${O} = ${V.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,U=0,z=null;while(W<Z.length&&K>0){let q=Z[W];if(z){if(q===z)z=null;W++;continue}if(q==='"'||q==="'"||q==="`"){z=q,W++;continue}if(q==="<")U++;else if(q===">"&&U>0)U--;else if(U===0){if(q==="(")K++;else if(q===")")K--}if(K>0)W++}if(K!==0)continue;let _=Z.substring(G+1,W);if(!_.includes(":"))continue;let B=Y(_);Q.push({start:G+1,end:W,replacement:B})}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:U}=Q[G];Z=Z.substring(0,K)+U+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("="),U=K.split(":")[0].trim();if(W.length>0)return`${U} = ${W.join("=").trim()}`;return U}).join(", ")}) =>`}),Z=Z.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
|
|
2148
2148
|
|
|
2149
|
-
`),Z}async function D0($,Z,Y,X={}){if(!$.trim())return;let J;try{let C=new Bun.Transpiler({loader:"ts",target:"browser",define:F1()}),d=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");d=d.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),J=C.transformSync(d)}catch{J=Zq($)}let Q={exports:{}},G=Q.exports,K=h7.cwd(),W={},U=[...J.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((C)=>C[1]).filter((C)=>!C.startsWith("node:")&&!C.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(C));for(let C of U)try{let d=f$.resolve(K,"node_modules",C),o=f$.join(d,"package.json"),a=JSON.parse(Z0("fs").readFileSync(o,"utf8")),z0=a.main||"index.js";if(a.exports){let O0=typeof a.exports==="string"?a.exports:a.exports["."];if(typeof O0==="string")z0=O0;else if(O0?.bun)z0=O0.bun;else if(O0?.import)z0=O0.import;else if(O0?.default)z0=O0.default}W[C]=await import(f$.resolve(d,z0))}catch{}let z=(C)=>{if(W[C])return W[C];return Z0(C)},_=Z.props||{},B=(C)=>{if(!C)return _;let d={};for(let[o,a]of Object.entries(C)){let z0=_[o];if(z0!==void 0)d[o]=z0;else if(typeof a==="function")d[o]=a();else d[o]=a}return d};for(let[C,d]of Object.entries(_))Object.defineProperty(B,C,{value:d,enumerable:!0,configurable:!0,writable:!0});for(let C of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(_,C))continue;try{Object.defineProperty(B,C,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let q=(C)=>{if(!C)return _;let d={..._};for(let[o,a]of Object.entries(C)){let z0=a&&typeof a==="object"&&!Array.isArray(a)?a:{type:a};if(d[o]===void 0&&z0.default!==void 0)d[o]=typeof z0.default==="function"?z0.default():z0.default}return d},j=()=>Z.slots||{},H=(C,d)=>{let o={...C};for(let[a,z0]of Object.entries(d))if(o[a]===void 0)if(typeof z0==="function")o[a]=z0();else o[a]=z0;return o},O=(C)=>{let d=()=>C;return d.set=(o)=>{},d.update=(o)=>{},d},V=(C)=>{let d,o=!1;return()=>{if(!o)try{d=C(),o=!0}catch{d=void 0}return d}},L=(C)=>{},F=(C)=>C(),A=(C)=>{},w=(C)=>{},N=(C)=>{},R=()=>{let C=Z.__stxServeContext,d=Z.__stxServeSearch??C?.search??"",o=C?.path??"";return{params:Z.params??{},query:Object.fromEntries(new URLSearchParams(d)),path:o,name:"",fullPath:o+d,hash:"",matched:[]}},E=()=>({push:(C)=>{},replace:(C)=>{},back:()=>{},forward:()=>{},go:(C)=>{}}),M=(C)=>{let d=Z.__stx_runtime_head||{};Z.__stx_runtime_head=
|
|
2149
|
+
`),Z}async function D0($,Z,Y,X={}){if(!$.trim())return;let J;try{let C=new Bun.Transpiler({loader:"ts",target:"browser",define:F1()}),d=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");d=d.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),J=C.transformSync(d)}catch{J=Zq($)}let Q={exports:{}},G=Q.exports,K=h7.cwd(),W={},U=[...J.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((C)=>C[1]).filter((C)=>!C.startsWith("node:")&&!C.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(C));for(let C of U)try{let d=f$.resolve(K,"node_modules",C),o=f$.join(d,"package.json"),a=JSON.parse(Z0("fs").readFileSync(o,"utf8")),z0=a.main||"index.js";if(a.exports){let O0=typeof a.exports==="string"?a.exports:a.exports["."];if(typeof O0==="string")z0=O0;else if(O0?.bun)z0=O0.bun;else if(O0?.import)z0=O0.import;else if(O0?.default)z0=O0.default}W[C]=await import(f$.resolve(d,z0))}catch{}let z=(C)=>{if(W[C])return W[C];return Z0(C)},_=Z.props||{},B=(C)=>{if(!C)return _;let d={};for(let[o,a]of Object.entries(C)){let z0=_[o];if(z0!==void 0)d[o]=z0;else if(typeof a==="function")d[o]=a();else d[o]=a}return d};for(let[C,d]of Object.entries(_))Object.defineProperty(B,C,{value:d,enumerable:!0,configurable:!0,writable:!0});for(let C of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(_,C))continue;try{Object.defineProperty(B,C,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let q=(C)=>{if(!C)return _;let d={..._};for(let[o,a]of Object.entries(C)){let z0=a&&typeof a==="object"&&!Array.isArray(a)?a:{type:a};if(d[o]===void 0&&z0.default!==void 0)d[o]=typeof z0.default==="function"?z0.default():z0.default}return d},j=()=>Z.slots||{},H=(C,d)=>{let o={...C};for(let[a,z0]of Object.entries(d))if(o[a]===void 0)if(typeof z0==="function")o[a]=z0();else o[a]=z0;return o},O=(C)=>{let d=()=>C;return d.set=(o)=>{},d.update=(o)=>{},d},V=(C)=>{let d,o=!1;return()=>{if(!o)try{d=C(),o=!0}catch{d=void 0}return d}},L=(C)=>{},F=(C)=>C(),A=(C)=>{},w=(C)=>{},N=(C)=>{},R=()=>{let C=Z.__stxServeContext,d=Z.__stxServeSearch??C?.search??"",o=C?.path??"";return{params:Z.params??{},query:Object.fromEntries(new URLSearchParams(d)),path:o,name:"",fullPath:o+d,hash:"",matched:[]}},E=()=>({push:(C)=>{},replace:(C)=>{},back:()=>{},forward:()=>{},go:(C)=>{}}),M=(C)=>{let d=Z.__stx_runtime_head||{};Z.__stx_runtime_head=g6(d,C||{})},I=(C)=>{M(D7(C||{}))},S=(C)=>({value:C}),k=(C)=>C,x=(C)=>({value:typeof C==="function"?C():C}),y=(C,d)=>{},b=(C)=>{},g=(C)=>{},r=(C)=>C?C():Promise.resolve(),c=(C)=>(d,...o)=>{},P=(C)=>{},h=(C,d)=>{},m=(C,d)=>d,i=()=>({value:"light"}),s=()=>O(!1),q0=(C)=>O(!1),K0=()=>O(!1),S0=()=>q0("(prefers-color-scheme: dark)"),z1=()=>q0("(prefers-color-scheme: light)"),C0=()=>q0("(prefers-reduced-motion: reduce)"),h1=()=>q0("(prefers-contrast: more)"),X0={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:{}},l=new Proxy(X0,{get(C,d){if(d in C)return C[d];return},set(C,d,o){return C[d]=o,!0}}),u={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},n=console;try{let C=uZ(J,Y),d=new Set(Object.keys(_)),o=(G0)=>/^[a-z_$][\w$]*$/i.test(G0),a=Object.keys(Z).filter((G0)=>!d.has(G0)&&G0!=="props"&&o(G0)),z0=a.map((G0)=>Z[G0]),O0=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"]),w0=[],Q1=[];for(let[G0,I0]of Object.entries(_)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(G0))continue;if(O0.has(G0))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${G0}\\b`).test(C))continue;w0.push(G0),Q1.push(I0)}let b0=rE(C).map((G0)=>`module.exports.${G0} = typeof ${G0} !== 'undefined' ? ${G0} : module.exports.${G0};`).join(`
|
|
2150
2150
|
`),B1=Z.params??{},e0=[],j0=[];for(let G0=0;G0<a.length;G0++){if(a[G0]==="params")continue;e0.push(a[G0]),j0.push(z0[G0])}let P0=await Function("module","exports","require","props","$props","defineProps","withDefaults","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params",...w0,...e0,`return (async () => {
|
|
2151
2151
|
${C}
|
|
2152
2152
|
${b0}
|
|
@@ -2161,7 +2161,7 @@ ${w}`,nextIndex:L}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}l
|
|
|
2161
2161
|
${$[W]}`,W++;else break}return K=K.trim().replace(/;$/,""),{type:J,name:Q,value:K,nextIndex:W}}function z2($,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(oE(Y)){let K=tE($,Z,Q);Q=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:J,functionCode:Q,nextIndex:G}}function tB($){let Z=$.trim();if(Z.startsWith("{"))return r0(Z,"{","}",0)===-1;if(Z.startsWith("["))return r0(Z,"[","]",0)===-1;return!Qq(Z)}function Qq($){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 oE($){let Z=$.indexOf("{");if(Z===-1)return!0;return r0($,"{","}",Z)===-1}function eB($,Z,Y){let X=Y,J=Z+1;while(J<$.length&&!Qq(X)){let Q=$[J];X+=`
|
|
2162
2162
|
${Q}`,J++}while(J<$.length){let Q=$[J].trim();if(Q.startsWith(".")||Q.startsWith("?."))X+=`
|
|
2163
2163
|
${$[J]}`,J++;else break}return{value:X,nextIndex:J}}function tE($,Z,Y){let X=Y,J=Z+1;while(J<$.length){let Q=X.indexOf("{");if(Q!==-1){if(r0(X,"{","}",Q)!==-1)break}let G=$[J];X+=`
|
|
2164
|
-
${G}`,J++}return{functionCode:X,nextIndex:J}}function $q($,Z){let Y=L0($,Z)??L0(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let X={...Z,process:Object.freeze({env:{...h7.env}})};try{return Function(...Object.keys(X),`'use strict'; return (${$});`)(...Object.values(X))}catch{try{return Function(...Object.keys(X),`'use strict'; return ${$};`)(...Object.values(X))}catch{return}}}async function eE($,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(/;$/,""),U=$q(W,Z);if(U!==void 0)Z[G]=U}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(/;$/,""),U=$q(W,Z);if(U!==void 0)Z[G]=U}catch{}}}function _2($){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 B2($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var X6=D(()=>{
|
|
2164
|
+
${G}`,J++}return{functionCode:X,nextIndex:J}}function $q($,Z){let Y=L0($,Z)??L0(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let X={...Z,process:Object.freeze({env:{...h7.env}})};try{return Function(...Object.keys(X),`'use strict'; return (${$});`)(...Object.values(X))}catch{try{return Function(...Object.keys(X),`'use strict'; return ${$};`)(...Object.values(X))}catch{return}}}async function eE($,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(/;$/,""),U=$q(W,Z);if(U!==void 0)Z[G]=U}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(/;$/,""),U=$q(W,Z);if(U!==void 0)Z[G]=U}catch{}}}function _2($){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 B2($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var X6=D(()=>{h6();u4();i0()});var Bq={};$0(Bq,{processLoops:()=>iZ});function YI($,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,U=K+1;while(U<X.length&&W>0){if(X[U]==="(")W++;else if(X[U]===")"){if(W--,W===0)break}U++}if(W!==0)continue;let z=X.substring(K+1,U),_=U+1,B=z.match(/^\s*['"]([^'"]+)['"]/);if(!B)continue;let q=B[1],j=z.slice(B[0].length),H=j.match(/^\s*,\s*/);if(!H)continue;let O=j.slice(H[0].length).trim();if(!O)continue;try{let V=p0(O,Z),L=JSON.stringify(V),F=`@component('${q}', ${L})`;Q.push({start:G,end:_,replacement:F})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:U}=Q[G];X=X.substring(0,K)+U+X.substring(W)}return X}function lZ($,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,U=K+1,z=null,_=!1;while(U<X.length&&W>0){let j=X[U];if(_){_=!1,U++;continue}if(j==="\\"&&z){_=!0,U++;continue}if(z){if(j===z)z=null;U++;continue}if(j==='"'||j==="'"||j==="`"){z=j,U++;continue}if(j==="(")W++;else if(j===")"){if(W--,W===0)break}U++}if(W!==0)break;let B=X.substring(K+1,U),q=Y(B);X=X.substring(0,G)+q+X.substring(U+1)}return X}function XI($,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);o3(Q);let U=M0(Q,G)(...K),z=JSON.stringify(U),_=Buffer.from(z,"utf8").toString("base64");return`__stx_${J}="${_}"`}catch(G){return X}}),Y}function JI($,Z){let Y=$;return Y=lZ(Y,"@break",(X)=>{try{let Q=`!!(${X.trim()})`,G;if(R0(Q)){let K=M0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(L0(Q,Z));return G?cZ:""}catch{return""}}),Y=lZ(Y,"@continue",(X)=>{try{let Q=`!!(${X.trim()})`,G;if(R0(Q)){let K=M0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(L0(Q,Z));return G?pZ:""}catch{return""}}),Y}function QI($){let Z=$;return Z=Z.replace(/@break(?!\()/g,cZ),Z=Z.replace(/@continue(?!\()/g,pZ),Z}function Gq($){let Z=$.includes(cZ),Y=Z?$.substring(0,$.indexOf(cZ)):$;return{hasBreak:Z,content:Y}}function Kq($){let Z=$.includes(pZ),Y=Z?$.substring(0,$.indexOf(pZ)):$;return{hasContinue:Z,content:Y}}function Uq($){let Z=$;return Z=lZ(Z,"@break",(Y)=>{let X=Y.trim();if(!t3(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=lZ(Z,"@continue",(Y)=>{let X=Y.trim();if(!t3(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function GI($){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((z,_)=>z.pos-_.pos);let K=[],W=0;for(let z of X)W+=z.delta,K.push({pos:z.pos,depth:W});function U(z){let _=0,B=K.length-1,q=0;while(_<=B){let j=_+B>>1;if(K[j].pos<=z)q=K[j].depth,_=j+1;else B=j-1}return q}while((Y=Z.exec($))!==null){if(U(Y.index)>0)continue;let z=Y.index,_=Y.index+Y[0].length-1,B=1,q=_+1,j=-1;while(q<$.length&&B>0){if($[q]==="(")B++;else if($[q]===")"){if(B--,B===0){j=q;break}}q++}if(j===-1)continue;let H=$.substring(_+1,j),O=H.indexOf(" as ");if(O===-1)continue;let V=H.substring(0,O).trim(),L=H.substring(O+4).trim(),F=j+1,A=1,w=F,N=/@forelse\s*\(/g,R=/@endforelse/g,E=-1;while(A>0&&w<$.length){N.lastIndex=w,R.lastIndex=w;let y=N.exec($),b=R.exec($);if(!b)break;if(y&&y.index<b.index)A++,w=y.index+y[0].length;else{if(A--,A===0){E=b.index;break}w=b.index+11}}if(E===-1)continue;let M=$.substring(F,E),I=E+11,S=-1,k=0,x=0;while(x<M.length){let y=M.indexOf("@",x);if(y===-1)break;let b=M.substring(y);if(/^@forelse\s*\(/.test(b))k++,x=y+1;else if(b.startsWith("@endforelse"))k--,x=y+11;else if(k===0&&b.startsWith("@empty")){if(M.length<=y+6||!/[a-z]/i.test(M[y+6])){S=y;break}x=y+1}else x=y+1}if(S===-1)continue;return{start:z,end:I,arrayExpr:V,itemVar:L,foreachContent:M.substring(0,S),emptyContent:M.substring(S+6)}}return null}function Wq($,Z){let Y=$;while(!0){let X=GI(Y);if(!X)break;let{start:J,end:Q,arrayExpr:G,itemVar:K,foreachContent:W,emptyContent:U}=X;try{let z;if(R0(G))z=M0(G,Object.keys(Z))(...Object.values(Z));else z=L0(G,Z);let _;if(!Array.isArray(z)||z.length===0)_=U;else _=`@foreach (${G} as ${K})${W}@endforeach`;Y=Y.substring(0,J)+_+Y.substring(Q)}catch(z){let _=z instanceof Error?z.message:String(z),B=B0("Forelse",`Error in @forelse(${G} as ${K}): ${_}`,Q0.EVALUATION_ERROR);Y=Y.substring(0,J)+B+Y.substring(Q)}}return Y}function iZ($,Z,Y,X){let J=$;J=Wq(J,Z);function Q(W){let U=/@foreach\s*\(/g,z;while((z=U.exec(W))!==null){let _=z.index,B=z.index+z[0].length-1,q=1,j=B+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(B+1,H),V=O.indexOf(" as ");if(V===-1)continue;let L=_,F=O.substring(0,V),A=O.substring(V+4),w=H+1,N=1,R=w,E=/@foreach\s*\(/g,M=/@endforeach/g;while(N>0&&R<W.length){E.lastIndex=R,M.lastIndex=R;let I=E.exec(W),S=M.exec(W);if(!S)break;if(I&&I.index<S.index)N++,R=I.index+I[0].length;else{if(N--,N===0){let k=W.substring(w,S.index),x=S.index+11;return{start:L,end:x,arrayExpr:F,itemVar:A,content:k}}R=S.index+11}}}return null}function G(W,U){let z=W;while(!0){let _=Q(z);if(!_)break;let{start:B,end:q,arrayExpr:j,itemVar:H,content:O}=_;try{let V=j.trim(),L;if(R0(V))L=M0(V,Object.keys(U))(...Object.values(U));else L=L0(V,U);let F=!1;if(!Array.isArray(L))if(L instanceof Map)L=Array.from(L),F=!0;else if(L instanceof Set)L=Array.from(L);else if(typeof L==="string")L=Array.from(L);else if(L&&typeof L==="object"&&!(L instanceof Date)&&!(L instanceof RegExp))L=Object.entries(L),F=!0;else{let S=B0("Foreach",`Error in @foreach: ${V} is not iterable`,Q0.TYPE_ERROR);z=z.substring(0,B)+S+z.substring(q);continue}let A=X?.loops?.useAltLoopVariable??ZI,w=H.trim(),N=null,R,E=!1;if(w.includes("=>")){let S=w.split("=>").map((k)=>k.trim());if(S.length===2&&S[0]&&S[1])N=S[0],R=S[1];else R=w}else if(!w.startsWith("[")&&!w.startsWith("{")&&w.includes(",")){let S=w.split(",").map((k)=>k.trim());if(S.length===2&&S[0]&&S[1])R=S[0],N=S[1],E=!0;else R=w}else R=w;let M="",I=L;for(let S=0;S<I.length;S++){let k=I[S],x={index:S,iteration:S+1,first:S===0,last:S===I.length-1,count:I.length},y={...U,loop:x,$loop:x};if(R.startsWith("[")&&R.endsWith("]")){let c=R.slice(1,-1).split(",").map((P)=>P.trim());if(Array.isArray(k))c.forEach((P,h)=>{if(P)y[P]=k[h]});else y[R]=k}else y[R]=k;if(N)if(!E&&F&&Array.isArray(k)&&k.length===2)y[N]=k[0],y[R]=k[1];else y[N]=S;let b=JI(O,y),g=Kq(b);if(g.hasContinue){M+=g.content;continue}let r=Gq(b);if(r.hasBreak){M+=r.content;break}if(b=Wq(b,y),b=G(b,y),b=x6(b,y,Y),b=QI(b),r=Gq(b),r.hasBreak){M+=r.content;break}if(g=Kq(b),g.hasContinue){M+=g.content;continue}b=d1(b,y,Y),b=XI(b,y),b=YI(b,y),M+=b}z=z.substring(0,B)+M+z.substring(q)}catch(V){let L=B0("Foreach",`Error in @foreach(${j.trim()} as ${H.trim()}): ${V instanceof Error?V.message:String(V)}`,Q0.EVALUATION_ERROR);z=z.substring(0,B)+L+z.substring(q)}}return z}J=G(J,Z),J=_q(J,Z,Y,X);let K=X?.loops?.maxWhileIterations??$I;return J=UI(J,Z,K),J}function zq($){return t3($)}function _q($,Z,Y,X){let J=$,Q=!0;while(Q){Q=!1;let G=J.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,W=K+G[0].length-1,U=r0(J,"(",")",W);if(U===-1)break;let z=J.slice(W+1,U),_=U+1,B=E7(J.slice(K),"for","endfor");if(B.length===0)break;let q=B[0].content,j=K+B[0].end;if(!zq(z)){let H=B0("For",`Unsafe expression in @for: ${z}`,Q0.UNSAFE_EXPRESSION);J=J.substring(0,K)+H+J.substring(j),Q=!0;continue}try{let H=KI(z),O=/@(?:for|foreach|if|unless)\s*\(/.test(q);if(H.length>0&&O){let N=WI({forExpr:z,content:q,iterVarNames:H,context:Z,filePath:Y,options:X});J=J.substring(0,K)+N+J.substring(j),Q=!0;continue}let V=Object.keys(Z),L=Object.values(Z),F=q.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(N,R)=>{return`\${${R}}`});F=Uq(F);let w=Function(...V,`
|
|
2165
2165
|
let result = '';
|
|
2166
2166
|
for (${z}) {
|
|
2167
2167
|
result += \`${F}\`;
|
|
@@ -2171,7 +2171,7 @@ ${G}`,J++}return{functionCode:X,nextIndex:J}}function $q($,Z){let Y=L0($,Z)??L0(
|
|
|
2171
2171
|
for (${Z}) {
|
|
2172
2172
|
__pushIter([${X.join(", ")}])
|
|
2173
2173
|
}
|
|
2174
|
-
`),z=[];U(...W,(q)=>{z.push(q)});let _=Q??"inline.stx",B="";for(let q of z){let j={...J};X.forEach((O,V)=>{j[O]=q[V]});let H=_q(Y,j,Q,G);H=
|
|
2174
|
+
`),z=[];U(...W,(q)=>{z.push(q)});let _=Q??"inline.stx",B="";for(let q of z){let j={...J};X.forEach((O,V)=>{j[O]=q[V]});let H=_q(Y,j,Q,G);H=x6(H,j,_),H=d1(H,j,_),B+=H}return B}function UI($,Z,Y){let X=$,J=!0;while(J){J=!1;let Q=X.match(/@while\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=G+Q[0].length-1,W=r0(X,"(",")",K);if(W===-1)break;let U=X.slice(K+1,W),z=E7(X.slice(G),"while","endwhile");if(z.length===0)break;let _=z[0].content,B=G+z[0].end;if(!zq(U)){let q=B0("While",`Unsafe expression in @while: ${U}`,Q0.UNSAFE_EXPRESSION);X=X.substring(0,G)+q+X.substring(B),J=!0;continue}try{let q=Object.keys(Z),j=Object.values(Z),H=_.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(L,F)=>{return`\${${F}}`});H=Uq(H);let V=Function(...q,`
|
|
2175
2175
|
let result = '';
|
|
2176
2176
|
let maxIterations = ${Y}; // Configurable safety limit
|
|
2177
2177
|
let counter = 0;
|
|
@@ -2218,9 +2218,9 @@ ${jq($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
|
|
|
2218
2218
|
} finally {
|
|
2219
2219
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
2220
2220
|
}
|
|
2221
|
-
})();`}function qI($,Z){let Y=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\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 jI(){j2.clear()}function HI($){if($.__onceStore instanceof Set)return $.__onceStore;return j2}async function rZ($,Z,Y,X,J,Q=new Set){let G=X.partialsDir||x0.join(x0.dirname(Y),"partials");if(G&&!x0.isAbsolute(G))G=x0.resolve(process.cwd(),G);let K=zI($,"@partial","@include"),W=HI(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(j,H,O)=>{let V=H.trim(),L=`${Y}:${V}`;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,V=O+H[0].length-1,L=1,F=V+1;while(F<K.length&&L>0){if(K[F]==="(")L++;else if(K[F]===")")L--;F++}if(L!==0)break;let A=K.substring(V+1,F-1),w=A.match(/^\s*['"]([^'"]+)['"]/);if(!w){j.lastIndex=F;continue}let N=w[1],R=U(N,G,Y),E="";if(R&&await Bun.file(R).exists())J.add(R),E=`@include(${A})`;K=K.substring(0,O)+E+K.substring(F),j.lastIndex=0}}for(let[j,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),V;while((V=O.exec(K))!==null){let L=V.index,F=L+V[0].length-1,A=1,w=F+1;while(w<K.length&&A>0){if(K[w]==="(")A++;else if(K[w]===")")A--;w++}if(A!==0)break;let N=K.substring(F+1,w-1),R=q2(N,0);if(R===-1){O.lastIndex=w;continue}let E=N.substring(0,R).trim(),M=N.substring(R+1).trim(),I=M.match(/^\s*['"]([^'"]+)['"]/);if(!I){O.lastIndex=w;continue}let S=I[1],k=M.substring(I[0].length),x,y=q2(k,0);if(y!==-1)x=k.substring(y+1).trim();try{let b=`Boolean(${E})`,g;if(R0(b)){let P=M0(b,Object.keys(Z));g=Boolean(P(...Object.values(Z)))}else g=Boolean(L0(b,Z));let r=H?!g:g,c="";if(r){let P=U(S,G,Y);if(P&&await Bun.file(P).exists())J.add(P);c=`@include('${S}'${x?`, ${x}`:""})`}K=K.substring(0,L)+c+K.substring(w),O.lastIndex=0}catch(b){let g=b instanceof Error?b.message:String(b),r=T0("Include",`Error evaluating ${j} condition: ${g}`,Y,$,L);K=K.substring(0,L)+r+K.substring(w),O.lastIndex=0}}}{let j=/@each\s*\(/g,H;while((H=j.exec(K))!==null){let O=H.index,V=O+H[0].length-1,L=1,F=V+1;while(F<K.length&&L>0){if(K[F]==="(")L++;else if(K[F]===")"){if(L--,L===0)break}F++}if(L!==0)break;let A=K.substring(V+1,F),w=K.substring(O,F+1),N=A.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){j.lastIndex=0,K=K.replace(w,"");continue}let[,R,E,M,I]=N;try{let S,k=E.trim();if(R0(k))S=M0(k,Object.keys(Z))(...Object.values(Z));else S=L0(k,Z);let x="";if(Array.isArray(S)&&S.length>0)for(let y of S){let b={...Z,[M]:y},g=await _(R,b,$,O);x+=g}else if(I)x=await _(I,{},$,O);K=K.substring(0,O)+x+K.substring(F+1),j.lastIndex=0}catch(S){let k=S instanceof Error?S.message:String(S);K=K.substring(0,O)+T0("Each",`Error in @each: ${k}`,Y,$,O)+K.substring(F+1),j.lastIndex=0}}}{let j=/@includeFirst\s*\(/g,H;while((H=j.exec(K))!==null){let O=H.index,V=O+H[0].length-1,L=1,F=V+1;while(F<K.length&&L>0){if(K[F]==="(")L++;else if(K[F]===")"){if(L--,L===0)break}F++}if(L!==0)break;let A=K.substring(V+1,F),w=K.substring(O,F+1),N=A.match(/^\s*(\[[^\]]+\])/);if(!N){j.lastIndex=0,K=K.replace(w,"");continue}let R=N[1],E=A.slice(N[0].length),M,I=E.match(/^\s*,\s*\{/);if(I){E=E.slice(I[0].length-1);let x=1,y=1;while(y<E.length&&x>0){if(E[y]==="{")x++;else if(E[y]==="}"){if(x--,x===0)break}y++}M=E.substring(0,y+1),E=E.slice(y+1)}let S,k=E.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(k)S=k[1];try{let x=JSON.parse(R.replace(/'/g,'"')),y={};if(M)try{y=p0(M,Z)}catch(g){let r=g instanceof Error?g.message:String(g);if(X.debug){let c=T0("Include",`Error parsing includeFirst variables: ${r}`,Y,$,O,w);K=K.replace(w,()=>c)}else K=K.replace(w,()=>S||"");continue}let b=!1;for(let g of x){let r=U(g,G,Y);if(!r)continue;if(await J0(r)){let c=await _(g,y,$,O);K=K.replace(w,()=>c),b=!0;break}}if(!b)if(S!==void 0)K=K.replace(w,()=>S);else if(X.debug){let g=T0("Include",`None of the includeFirst paths exist: ${R}`,Y,$,O,w);K=K.replace(w,()=>g)}else K=K.replace(w,"")}catch(x){let y=x instanceof Error?x.message:String(x),b=T0("Include",`Error processing @includeFirst: ${y}`,Y,$,O,w);K=K.replace(w,()=>b)}j.lastIndex=0}}function U(j,H,O){try{let V=j;if(!j.endsWith(".stx"))V=`${j}.stx`;let L=x0.resolve(H),F=x0.resolve(x0.dirname(O)),A;if(!V.startsWith("./")&&!V.startsWith("../"))A=x0.resolve(H,V);else A=x0.resolve(F,V);let w=x0.normalize(A),N=w.startsWith(L+x0.sep)||w===L,R=w.startsWith(F+x0.sep)||w===F,E=!1,M=x0.dirname(F);if(w.startsWith(M+x0.sep)){if(!x0.relative(M,w).split(x0.sep).some((x)=>x.startsWith(".")&&x!=="."&&x!==".."))E=!0}if(!N&&!R&&!E)return console.error(`Security: Path traversal attempt blocked for include path: ${j}`),console.error(` Resolved to: ${w}`),console.error(` Allowed dirs: ${L}, ${F}`),null;return w}catch(V){return console.error(`Error resolving path ${j}: ${V}`),null}}let z=x0.resolve(Y);Q.add(z);async function _(j,H={},O,V){let L=U(j,G,Y);if(!L)return T0("Include",`Could not resolve path for include: ${j}`,Y,O,V);let F=x0.resolve(L);if(Q.has(F)){let A=[...Q,F].map((w)=>x0.basename(w)).join(" -> ");return T0("Include",`Circular include detected: ${A}`,Y,O,V)}try{J.add(L);let A;if(!A)try{A=await Bun.file(L).text()}catch(c){let P=c instanceof Error?c.message:String(c);return T0("Include",`Error loading include file ${j}: ${P}`,Y,O,V)}if(A&&A.includes("@stream")){let{processStreamDirectives:c}=await Promise.resolve().then(() => (Y6(),
|
|
2221
|
+
})();`}function qI($,Z){let Y=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\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 jI(){j2.clear()}function HI($){if($.__onceStore instanceof Set)return $.__onceStore;return j2}async function rZ($,Z,Y,X,J,Q=new Set){let G=X.partialsDir||x0.join(x0.dirname(Y),"partials");if(G&&!x0.isAbsolute(G))G=x0.resolve(process.cwd(),G);let K=zI($,"@partial","@include"),W=HI(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(j,H,O)=>{let V=H.trim(),L=`${Y}:${V}`;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,V=O+H[0].length-1,L=1,F=V+1;while(F<K.length&&L>0){if(K[F]==="(")L++;else if(K[F]===")")L--;F++}if(L!==0)break;let A=K.substring(V+1,F-1),w=A.match(/^\s*['"]([^'"]+)['"]/);if(!w){j.lastIndex=F;continue}let N=w[1],R=U(N,G,Y),E="";if(R&&await Bun.file(R).exists())J.add(R),E=`@include(${A})`;K=K.substring(0,O)+E+K.substring(F),j.lastIndex=0}}for(let[j,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),V;while((V=O.exec(K))!==null){let L=V.index,F=L+V[0].length-1,A=1,w=F+1;while(w<K.length&&A>0){if(K[w]==="(")A++;else if(K[w]===")")A--;w++}if(A!==0)break;let N=K.substring(F+1,w-1),R=q2(N,0);if(R===-1){O.lastIndex=w;continue}let E=N.substring(0,R).trim(),M=N.substring(R+1).trim(),I=M.match(/^\s*['"]([^'"]+)['"]/);if(!I){O.lastIndex=w;continue}let S=I[1],k=M.substring(I[0].length),x,y=q2(k,0);if(y!==-1)x=k.substring(y+1).trim();try{let b=`Boolean(${E})`,g;if(R0(b)){let P=M0(b,Object.keys(Z));g=Boolean(P(...Object.values(Z)))}else g=Boolean(L0(b,Z));let r=H?!g:g,c="";if(r){let P=U(S,G,Y);if(P&&await Bun.file(P).exists())J.add(P);c=`@include('${S}'${x?`, ${x}`:""})`}K=K.substring(0,L)+c+K.substring(w),O.lastIndex=0}catch(b){let g=b instanceof Error?b.message:String(b),r=T0("Include",`Error evaluating ${j} condition: ${g}`,Y,$,L);K=K.substring(0,L)+r+K.substring(w),O.lastIndex=0}}}{let j=/@each\s*\(/g,H;while((H=j.exec(K))!==null){let O=H.index,V=O+H[0].length-1,L=1,F=V+1;while(F<K.length&&L>0){if(K[F]==="(")L++;else if(K[F]===")"){if(L--,L===0)break}F++}if(L!==0)break;let A=K.substring(V+1,F),w=K.substring(O,F+1),N=A.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){j.lastIndex=0,K=K.replace(w,"");continue}let[,R,E,M,I]=N;try{let S,k=E.trim();if(R0(k))S=M0(k,Object.keys(Z))(...Object.values(Z));else S=L0(k,Z);let x="";if(Array.isArray(S)&&S.length>0)for(let y of S){let b={...Z,[M]:y},g=await _(R,b,$,O);x+=g}else if(I)x=await _(I,{},$,O);K=K.substring(0,O)+x+K.substring(F+1),j.lastIndex=0}catch(S){let k=S instanceof Error?S.message:String(S);K=K.substring(0,O)+T0("Each",`Error in @each: ${k}`,Y,$,O)+K.substring(F+1),j.lastIndex=0}}}{let j=/@includeFirst\s*\(/g,H;while((H=j.exec(K))!==null){let O=H.index,V=O+H[0].length-1,L=1,F=V+1;while(F<K.length&&L>0){if(K[F]==="(")L++;else if(K[F]===")"){if(L--,L===0)break}F++}if(L!==0)break;let A=K.substring(V+1,F),w=K.substring(O,F+1),N=A.match(/^\s*(\[[^\]]+\])/);if(!N){j.lastIndex=0,K=K.replace(w,"");continue}let R=N[1],E=A.slice(N[0].length),M,I=E.match(/^\s*,\s*\{/);if(I){E=E.slice(I[0].length-1);let x=1,y=1;while(y<E.length&&x>0){if(E[y]==="{")x++;else if(E[y]==="}"){if(x--,x===0)break}y++}M=E.substring(0,y+1),E=E.slice(y+1)}let S,k=E.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(k)S=k[1];try{let x=JSON.parse(R.replace(/'/g,'"')),y={};if(M)try{y=p0(M,Z)}catch(g){let r=g instanceof Error?g.message:String(g);if(X.debug){let c=T0("Include",`Error parsing includeFirst variables: ${r}`,Y,$,O,w);K=K.replace(w,()=>c)}else K=K.replace(w,()=>S||"");continue}let b=!1;for(let g of x){let r=U(g,G,Y);if(!r)continue;if(await J0(r)){let c=await _(g,y,$,O);K=K.replace(w,()=>c),b=!0;break}}if(!b)if(S!==void 0)K=K.replace(w,()=>S);else if(X.debug){let g=T0("Include",`None of the includeFirst paths exist: ${R}`,Y,$,O,w);K=K.replace(w,()=>g)}else K=K.replace(w,"")}catch(x){let y=x instanceof Error?x.message:String(x),b=T0("Include",`Error processing @includeFirst: ${y}`,Y,$,O,w);K=K.replace(w,()=>b)}j.lastIndex=0}}function U(j,H,O){try{let V=j;if(!j.endsWith(".stx"))V=`${j}.stx`;let L=x0.resolve(H),F=x0.resolve(x0.dirname(O)),A;if(!V.startsWith("./")&&!V.startsWith("../"))A=x0.resolve(H,V);else A=x0.resolve(F,V);let w=x0.normalize(A),N=w.startsWith(L+x0.sep)||w===L,R=w.startsWith(F+x0.sep)||w===F,E=!1,M=x0.dirname(F);if(w.startsWith(M+x0.sep)){if(!x0.relative(M,w).split(x0.sep).some((x)=>x.startsWith(".")&&x!=="."&&x!==".."))E=!0}if(!N&&!R&&!E)return console.error(`Security: Path traversal attempt blocked for include path: ${j}`),console.error(` Resolved to: ${w}`),console.error(` Allowed dirs: ${L}, ${F}`),null;return w}catch(V){return console.error(`Error resolving path ${j}: ${V}`),null}}let z=x0.resolve(Y);Q.add(z);async function _(j,H={},O,V){let L=U(j,G,Y);if(!L)return T0("Include",`Could not resolve path for include: ${j}`,Y,O,V);let F=x0.resolve(L);if(Q.has(F)){let A=[...Q,F].map((w)=>x0.basename(w)).join(" -> ");return T0("Include",`Circular include detected: ${A}`,Y,O,V)}try{J.add(L);let A;if(!A)try{A=await Bun.file(L).text()}catch(c){let P=c instanceof Error?c.message:String(c);return T0("Include",`Error loading include file ${j}: ${P}`,Y,O,V)}if(A&&A.includes("@stream")){let{processStreamDirectives:c}=await Promise.resolve().then(() => (Y6(),u6));A=c(A,Z)}if(A&&(X.debug||!T$()&&!A7()))try{let{warnUnbalancedTags:c}=await Promise.resolve().then(() => (P9(),TB));c(A,L)}catch{}let w=A;try{let{processESImports:c}=await Promise.resolve().then(() => (U2(),sB));await c(A,Z,L,X,J)}catch(c){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,c instanceof Error?c.message:c)}let N=U4(w);if(N)w=N.content.trim();let E=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(E)M=`<style${E[1]}>${E[2]}</style>`;w=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),w=w.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};for(let[c,P]of Object.entries(H))I[c]=P;let S=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,k=[...A.matchAll(S)],x="",y=null;for(let c of k){let P=c[1]||"",h=c[2]||"",m=P.includes("server"),i=c4(P),s="";try{let{extractAndStripCssImports:K0,renderVendorStyleTags:S0}=await Promise.resolve().then(() => (b6(),Lz)),z1=K0(h,{filePath:L,projectRoot:process.cwd()});h=z1.code,s=S0(z1.styles)}catch(K0){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,K0 instanceof Error?K0.message:K0)}if(i&&h.trim())h=p4(h);if(!m)try{let{hasUserImports:K0,bundleClientScript:S0}=await Promise.resolve().then(() => (X7(),Y7));if(K0(h))h=await S0(h,L,{projectRoot:process.cwd()})}catch(K0){if(X.debug)console.warn(`[stx] bundler skipped for ${L}:`,K0 instanceof Error?K0.message:K0)}let q0=_I(h);if(q0&&!m){y=`stx_scope_${x0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++qq}`;let K0=l1(h),S0=BI(K0,y);x+=`${s}<script data-stx-scoped>${S0}</script>
|
|
2222
2222
|
`;continue}if(m)try{let{extractVariables:K0}=await Promise.resolve().then(() => (X6(),mZ));await K0(h,I,L)}catch(K0){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,K0)}if(!m&&!q0){let K0=P.replace(/\bclient\b/i,"").trim();y=`stx_scope_${x0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++qq}`;let S0=l1(h),z1=Oq(S0,y),C0=Hq(S0,z1);x+=`${s}<script data-stx-scoped${K0?` ${K0}`:""}>${C0}</script>
|
|
2223
|
-
`}}if(y){let c=qI(w,y);if(w=c.html,c.mergedIntoExisting)x=x.replace(`window.stx._scopes['${y}']`,`window.stx._scopes['${c.mergedIntoExisting}']`),y=c.mergedIntoExisting}if(w.includes("@include")||w.includes("@partial"))w=await rZ(w,I,L,X,J,Q);let{processLoops:b}=await Promise.resolve().then(() => (nZ(),Bq)),g=b(w,I,L);g=
|
|
2223
|
+
`}}if(y){let c=qI(w,y);if(w=c.html,c.mergedIntoExisting)x=x.replace(`window.stx._scopes['${y}']`,`window.stx._scopes['${c.mergedIntoExisting}']`),y=c.mergedIntoExisting}if(w.includes("@include")||w.includes("@partial"))w=await rZ(w,I,L,X,J,Q);let{processLoops:b}=await Promise.resolve().then(() => (nZ(),Bq)),g=b(w,I,L);g=x6(g,I,L);let r=y6(A);if(g=d1(g,I,L,{forceSignals:r}),M)g+=`
|
|
2224
2224
|
`+M;if(x)g+=`
|
|
2225
2225
|
`+x;return g}catch(A){let w=A instanceof Error?A.message:String(A);return T0("Include",`Error processing include ${j}: ${w}`,Y,O,V)}}let B=/@include\s*\(/g,q;while((q=B.exec(K))!==null){let j=q.index,H=j+q[0].length-1,O=1,V=H+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")")O--;V++}if(O!==0)break;let L=K.substring(j,V),F=K.substring(H+1,V-1),A=F.match(/^\s*['"]([^'"]+)['"]/);if(!A){B.lastIndex=V;continue}let w=A[1],N,R=F.substring(A[0].length),E=q2(R,0);if(E!==-1)N=R.substring(E+1).trim();let M={};if(N)try{M=p0(N,Z)}catch(S){let k=S instanceof Error?S.message:String(S);K=K.replace(L,T0("Include",`Error parsing include variables for ${w}: ${k}`,Y,$,j)),B.lastIndex=0;continue}let I=await _(w,M,$,j);K=K.substring(0,j)+I+K.substring(V),B.lastIndex=0}return K}function aZ($,Z){let Y=$;function X(J,Q,G,K){let W=J,U=!0;while(U){U=!1;let z=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),_=W.match(z);if(!_||_.index===void 0)break;let B=_.index,q=_[1],j=B+_[0].length,H=new RegExp(`@${Q}\\(`),O=new RegExp(`@${G}(?![a-z])`),V=1,L=j,F=-1;while(V>0&&L<W.length){let w=W.slice(L),N=w.match(H),R=w.match(O),E=N?L+N.index:1/0,M=R?L+R.index:1/0;if(E<M)V++,L=E+(N[0].length||1);else if(M<1/0){if(V--,V===0){F=M;break}L=M+G.length+1}else break}if(F===-1)break;let A=W.slice(j,F);if(!Z[q])Z[q]=[];if(K)Z[q].unshift(A);else Z[q].push(A);W=W.substring(0,B)+W.substring(F+`@${G}`.length),U=!0}return W}return Y=X(Y,"push","endpush",!1),Y=X(Y,"prepend","endprepend",!0),Y}function sZ($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
|
|
2226
2226
|
`)})}var qq=0,J6,j2;var g$=D(()=>{C$();FZ();$1();H7();r4();i0();N0();J6=new O7(500),j2=new Set});import*as H2 from"path";async function Lq($,Z,Y=""){if(H2.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 Fq($,Z,Y,"@js","@endjs")}async function Vq($,Z,Y=""){if(H2.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 Fq($,Z,Y,"@ts","@endts")}async function Fq($,Z,Y,X,J){let Q=$,G=N$(`${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:U,content:z,index:_}of K)try{let B=Object.keys(Z),q=Object.values(Z),j=z.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((w)=>w.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),V=O.length>0?`return { ${O.join(", ")} };`:"return {};",L=`
|
|
@@ -2228,7 +2228,7 @@ ${jq($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
|
|
|
2228
2228
|
${V}
|
|
2229
2229
|
`,A=Function(...B,L)(...q);if(A&&typeof A==="object")Object.assign(Z,A);Q=Q.replace(U,"")}catch(B){console.error(`Error executing ${X} code block in ${Y}:`,B);let q=B instanceof Error?B.message:String(B),j=T0(`${X} Directive`,`Error executing code: ${q}`,Y,$,_,U);console.error(j),Q=Q.replace(U,"")}return Q}var Aq=D(()=>{r4();N0()});function OI($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function wq($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,X,J,Q)=>{return OI(X,Q||"_method")})}async function O2($,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 U=T0("Middleware",`Error in middleware '${K.name}': ${W instanceof Error?W.message:String(W)}`,Y,$);Q=Q.replace(/<body[^>]*>/,`$&
|
|
2230
2230
|
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${v0(U)}</div>
|
|
2231
|
-
`)}}}return Q}async function L2($,Z,Y,X){return O2($,Z,Y,X,"before")}async function V2($,Z,Y,X){return O2($,Z,Y,X,"after")}var F2=D(()=>{$1();N0()});import{defineRoute as
|
|
2231
|
+
`)}}}return Q}async function L2($,Z,Y,X){return O2($,Z,Y,X,"before")}async function V2($,Z,Y,X){return O2($,Z,Y,X,"after")}var F2=D(()=>{$1();N0()});import{defineRoute as Zc,defineRoutes as Yc,resetRoutes as Xc,route as Jc,setAppUrl as Qc}from"stx-router";import{route as LI}from"stx-router";function Nq($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,X,J,Q)=>{try{let G=J?p0(J,{}):{};return LI(X,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var Rq=D(()=>{i0()});function A2($,Z,Y,X){let J=$;J=J.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,W,U)=>{if(!U&&W.includes(":")){let z=W.split(":"),_=W,B=z.length>1?z[1]:"";if(B&&Z[B])U=Z[B];else if(_.startsWith("og:")&&Z.openGraph&&Z.openGraph[z[1]])U=Z.openGraph[z[1]];else U="";return U?`<meta property="${U0(_)}" content="${U0(U)}">`:""}return U?`<meta name="${U0(W)}" content="${U0(U)}">`:""});let Q=/@metaTag\s*\(/g,G;while((G=Q.exec(J))!==null){let K=G.index,W=K+G[0].length-1,U=1,z=W+1;while(z<J.length&&U>0){if(J[z]==="(")U++;else if(J[z]===")"){if(U--,U===0)break}z++}if(U!==0)break;let _=J.substring(W+1,z).trim(),B=z+1,q=(()=>{try{let j=p0(_,Z);if(!j)return"";let H="<meta";if(j.name)H+=` name="${U0(String(j.name))}"`;if(j.property)H+=` property="${U0(String(j.property))}"`;if(j.httpEquiv)H+=` http-equiv="${U0(String(j.httpEquiv))}"`;if(j.content)H+=` content="${U0(String(j.content))}"`;return H+=">",H}catch(j){let H=j instanceof Error?j.message:String(j);return B0("MetaTag",H,Q0.EVALUATION_ERROR)}})();J=J.substring(0,K)+q+J.substring(B),Q.lastIndex=0}return J}function w2($,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,U=K+1;while(U<X.length&&W>0){if(X[U]==="(")W++;else if(X[U]===")"){if(W--,W===0)break}U++}if(W!==0)break;let z=X.substring(K+1,U).trim(),_=U+1,B=(()=>{try{let q=p0(z,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 B0("StructuredData",j,Q0.EVALUATION_ERROR)}})();X=X.substring(0,G)+B+X.substring(_),J.lastIndex=0}return X}function N2($,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,U=K+1,z=null,_=!1;while(U<J.length&&W>0){let V=J[U];if(_){_=!1,U++;continue}if(V==="\\"&&z){_=!0,U++;continue}if(z){if(V===z)z=null;U++;continue}if(V==='"'||V==="'"||V==="`"){z=V,U++;continue}if(V==="{")W++;else if(V==="}")W--;U++}if(W!==0)break;let B=J.substring(U).match(/^\s*\)/);if(!B)break;let q=U+B[0].length,j=J.substring(K,U),H=J.substring(G.index,q),O=((V)=>{try{let L=p0(V,Z);if(!L)return"";let F="";if(L.title)F+=`<title>${U0(L.title)}</title>
|
|
2232
2232
|
`,F+=`<meta name="title" content="${U0(L.title)}">
|
|
2233
2233
|
`;if(L.description)F+=`<meta name="description" content="${U0(L.description)}">
|
|
2234
2234
|
`;if(L.keywords){let A=Array.isArray(L.keywords)?L.keywords.join(", "):L.keywords;F+=`<meta name="keywords" content="${U0(A)}">
|
|
@@ -2274,13 +2274,13 @@ ${$.map((Q)=>{let G=Q.startsWith("http")?Q:`${Y}${Q.startsWith("/")?"":"/"}${Q}`
|
|
|
2274
2274
|
</sitemap>`}).join(`
|
|
2275
2275
|
`)}
|
|
2276
2276
|
</sitemapindex>`}async function AI($,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((B)=>{if(B.startsWith("*"))return K.includes(B.slice(1));return K.startsWith(B)||K.includes(`/${B}`)}))continue;let U=K.replace(/\\/g,"/").replace(/index\.(stx|html|htm)$/,"").replace(/\.(stx|html|htm)$/,"");if(!U.startsWith("/"))U=`/${U}`;if(U!=="/"&&U.endsWith("/"))U=U.slice(0,-1);let z=`${$}/${K}`,_;try{let B=await Bun.file(z).stat();if(B)_=new Date(B.mtime).toISOString().split("T")[0]}catch{}J.push({loc:U||"/",lastmod:_,priority:U==="/"?1:0.5})}return J.sort((K,W)=>K.loc.localeCompare(W.loc)),J}function Mq($){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(`
|
|
2277
|
-
`).trim()}function wI($){return Mq({rules:[{userAgent:"*",allow:["/"]}],sitemap:$})}function NI($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var oZ,tZ;var eZ=D(()=>{S1();i0();oZ={name:"meta",handler:($,Z,Y,X)=>{if(Z.length<1)return B0("Meta","meta directive requires at least the meta name",Q0.INVALID_DIRECTIVE_SYNTAX);let J=Z[0].replace(/['"]/g,""),Q=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${U0(J)}" content="${U0(Q)}">`},hasEndTag:!1},tZ={name:"structuredData",handler:($,Z,Y,X)=>{if($.trim()==="")return B0("StructuredData","structuredData directive requires JSON-LD content",Q0.INVALID_DIRECTIVE_SYNTAX);try{let J=JSON.parse($);if(!J["@context"])J["@context"]="https://schema.org";if(!J["@type"])return B0("StructuredData","structuredData requires @type property",Q0.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 B0("StructuredData",Q,Q0.EVALUATION_ERROR)}},hasEndTag:!0}});async function Tq($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(d7.exact[$])for(let X of d7.exact[$])await Promise.resolve(X(Z,$));if(d7.exact[Y])for(let X of d7.exact[Y])await Promise.resolve(X(Z,$));for(let{pattern:X,callback:J}of d7.patterns)if(X.test($)||X.test(Y))await Promise.resolve(J(Z,$))}var d7;var Eq=D(()=>{d7={patterns:[],exact:{}}});function Iq($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>Iq(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function $Y($,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(U){return J.some(([z,_])=>U>=z&&U<_)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,W=[];while((Q=K.exec(Y))!==null){if(G(Q.index))continue;let U=Q[0],z=Q[2];if(!z||!z.includes(":"))continue;let _=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,B,q=z,j=!1;while((B=_.exec(z))!==null){let H=B[1],O=B[2];if(O.includes("()")&&!O.includes(".get(")||O.includes("$store")||O.includes("$ref"))continue;try{let V=Object.keys(Z),L=Object.values(Z),F=O.match(/^([a-zA-Z_$][\w$]*)/);if(F&&!V.includes(F[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(F[1]))continue;let w=Function(...V,`return (${O})`)(...L);if(H==="class"){let N=Iq(w);if(N){let R=q.match(/\sclass="([^"]*)"/);if(R)q=q.replace(R[0],` class="${R[1]} ${N}"`);else q=q.replace(B[0],` class="${N}"`)}else q=q.replace(B[0],"");j=!0;continue}if(RI.has(H)){if(w)q=q.replace(B[0],` ${H}`);else q=q.replace(B[0],"");j=!0;continue}if(w===null||w===void 0||w===!1)q=q.replace(B[0],"");else{let N=String(w).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");q=q.replace(B[0],` ${H}="${N}"`)}j=!0}catch{continue}}if(j){let H=U.endsWith("/>")?" /":"",V=`<${Q[1]}${q}${H}>`;W.push({start:Q.index,end:Q.index+U.length,replacement:V})}}for(let U=W.length-1;U>=0;U--){let{start:z,end:_,replacement:B}=W[U];Y=Y.slice(0,z)+B+Y.slice(_)}return Y}var RI;var M2=D(()=>{RI=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function
|
|
2277
|
+
`).trim()}function wI($){return Mq({rules:[{userAgent:"*",allow:["/"]}],sitemap:$})}function NI($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var oZ,tZ;var eZ=D(()=>{S1();i0();oZ={name:"meta",handler:($,Z,Y,X)=>{if(Z.length<1)return B0("Meta","meta directive requires at least the meta name",Q0.INVALID_DIRECTIVE_SYNTAX);let J=Z[0].replace(/['"]/g,""),Q=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${U0(J)}" content="${U0(Q)}">`},hasEndTag:!1},tZ={name:"structuredData",handler:($,Z,Y,X)=>{if($.trim()==="")return B0("StructuredData","structuredData directive requires JSON-LD content",Q0.INVALID_DIRECTIVE_SYNTAX);try{let J=JSON.parse($);if(!J["@context"])J["@context"]="https://schema.org";if(!J["@type"])return B0("StructuredData","structuredData requires @type property",Q0.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 B0("StructuredData",Q,Q0.EVALUATION_ERROR)}},hasEndTag:!0}});async function Tq($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(d7.exact[$])for(let X of d7.exact[$])await Promise.resolve(X(Z,$));if(d7.exact[Y])for(let X of d7.exact[Y])await Promise.resolve(X(Z,$));for(let{pattern:X,callback:J}of d7.patterns)if(X.test($)||X.test(Y))await Promise.resolve(J(Z,$))}var d7;var Eq=D(()=>{d7={patterns:[],exact:{}}});function Iq($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>Iq(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function $Y($,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(U){return J.some(([z,_])=>U>=z&&U<_)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,W=[];while((Q=K.exec(Y))!==null){if(G(Q.index))continue;let U=Q[0],z=Q[2];if(!z||!z.includes(":"))continue;let _=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,B,q=z,j=!1;while((B=_.exec(z))!==null){let H=B[1],O=B[2];if(O.includes("()")&&!O.includes(".get(")||O.includes("$store")||O.includes("$ref"))continue;try{let V=Object.keys(Z),L=Object.values(Z),F=O.match(/^([a-zA-Z_$][\w$]*)/);if(F&&!V.includes(F[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(F[1]))continue;let w=Function(...V,`return (${O})`)(...L);if(H==="class"){let N=Iq(w);if(N){let R=q.match(/\sclass="([^"]*)"/);if(R)q=q.replace(R[0],` class="${R[1]} ${N}"`);else q=q.replace(B[0],` class="${N}"`)}else q=q.replace(B[0],"");j=!0;continue}if(RI.has(H)){if(w)q=q.replace(B[0],` ${H}`);else q=q.replace(B[0],"");j=!0;continue}if(w===null||w===void 0||w===!1)q=q.replace(B[0],"");else{let N=String(w).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");q=q.replace(B[0],` ${H}="${N}"`)}j=!0}catch{continue}}if(j){let H=U.endsWith("/>")?" /":"",V=`<${Q[1]}${q}${H}>`;W.push({start:Q.index,end:Q.index+U.length,replacement:V})}}for(let U=W.length-1;U>=0;U--){let{start:z,end:_,replacement:B}=W[U];Y=Y.slice(0,z)+B+Y.slice(_)}return Y}var RI;var M2=D(()=>{RI=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function l6($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let X=Y.exec($);if(!X)return null;let J=/\/\s*>$/.test(X[0])||MI.has(X[1].toLowerCase()),Q=J?X[2].replace(/\/\s*$/,""):X[2];return{full:X[0],tag:X[1],attrs:Q,selfClosing:J,start:X.index,end:X.index+X[0].length}}function EI($,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 _4($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=EI($,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 Dq($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function h$($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return X?X[1]:null}function Q6($,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 G6($,Z,Y){let X=Z.selfClosing?" /":"",J=`<${Z.tag}${Y}${X}>`;return $.slice(0,Z.start)+J+$.slice(Z.end)}function kq($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function II($){let Z=$,Y=0;while(Y<Z.length){let X=l6(Z,Y);if(!X)break;let J=h$(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((F)=>F.trim()),V=O[0],L=O[1];W=`${K} as ${L} => ${V}`}else W=`${K} as ${G}`;let U=Q6(X.attrs,"v-for"),z=Q6(U,":key").replace(/\s*v-bind:key="[^"]*"/g,""),_=_4(Z,X),B=Z.slice(_.outerStart,_.outerEnd),q=G6(B,{...X,start:0,end:X.end-X.start},z),j=`@foreach(${W})
|
|
2278
2278
|
`,H=`${j}${q}
|
|
2279
|
-
@endforeach`;Z=Z.slice(0,_.outerStart)+H+Z.slice(_.outerEnd),Y=_.outerStart+j.length}return Z}function DI($){let Z=$,Y=0;while(Y<Z.length){let X=
|
|
2279
|
+
@endforeach`;Z=Z.slice(0,_.outerStart)+H+Z.slice(_.outerEnd),Y=_.outerStart+j.length}return Z}function DI($){let Z=$,Y=0;while(Y<Z.length){let X=l6(Z,Y);if(!X)break;let J=h$(X.attrs,"v-if");if(J===null){Y=X.end;continue}let Q=[],G=_4(Z,X),K=Q6(X.attrs,"v-if"),W=G6(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 U=G.outerEnd,z=!0;while(z){let H=Z.slice(U).match(/^\s*/),O=H?H[0].length:0,V=l6(Z,U+O);if(!V){z=!1;break}let L=h$(V.attrs,"v-else-if"),F=Dq(V.attrs,"v-else");if(L!==null){let A=_4(Z,V),w=Q6(V.attrs,"v-else-if"),N=G6(Z.slice(A.outerStart,A.outerEnd),{...V,start:0,end:V.end-V.start},w);Q.push({type:"else-if",expr:L,outerStart:U,outerEnd:A.outerEnd,element:N,parsedTag:V}),U=A.outerEnd}else if(F){let A=_4(Z,V),w=Q6(V.attrs,"v-else"),N=G6(Z.slice(A.outerStart,A.outerEnd),{...V,start:0,end:V.end-V.start},w);Q.push({type:"else",outerStart:U,outerEnd:A.outerEnd,element:N,parsedTag:V}),z=!1}else z=!1}let _=[];for(let H of Q)if(H.type==="if")_.push(`@if(${H.expr})
|
|
2280
2280
|
${H.element}`);else if(H.type==="else-if")_.push(`@elseif(${H.expr})
|
|
2281
2281
|
${H.element}`);else _.push(`@else
|
|
2282
2282
|
${H.element}`);_.push("@endif");let B=_.join(`
|
|
2283
|
-
`),q=Q[0].outerStart,j=Q[Q.length-1].outerEnd;Z=Z.slice(0,q)+B+Z.slice(j),Y=q+B.length}return Z}function kI($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function SI($){let Z=$,Y=0;while(Y<Z.length){let X=
|
|
2283
|
+
`),q=Q[0].outerStart,j=Q[Q.length-1].outerEnd;Z=Z.slice(0,q)+B+Z.slice(j),Y=q+B.length}return Z}function kI($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function SI($){let Z=$,Y=0;while(Y<Z.length){let X=l6(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 z=K[1],_=K[2],B=K[3];J=J.replace(K[0],""),J+=` :${z}="${B}" @update:${z}="${B} = $event"`,K=J.match(G)}if(Q){let z=_4(Z,X),_=Z.slice(z.outerStart,z.outerEnd),B=G6(_,{...X,start:0,end:X.end-X.start},J);Z=Z.slice(0,z.outerStart)+B+Z.slice(z.outerEnd),Y=z.outerStart+B.length;continue}let W=h$(X.attrs,"v-model");if(W===null){Y=X.end;continue}if(TI.has(X.tag.toLowerCase())){let z=X.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${W}"`,_=_4(Z,X),B=Z.slice(_.outerStart,_.outerEnd),q=G6(B,{...X,start:0,end:X.end-X.start},z);Z=Z.slice(0,_.outerStart)+q+Z.slice(_.outerEnd),Y=_.outerStart+q.length}else{let z=X.attrs.replace(/\s*v-model="[^"]*"/g,"");z+=` :modelValue="${W}" @update:modelValue="${W} = $event"`;let _=_4(Z,X),B=Z.slice(_.outerStart,_.outerEnd),q=G6(B,{...X,start:0,end:X.end-X.start},z);Z=Z.slice(0,_.outerStart)+q+Z.slice(_.outerEnd),Y=_.outerStart+q.length}}return Z}function CI($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function bI($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function PI($){let Z=$,Y=0;while(Y<Z.length){let X=l6(Z,Y);if(!X)break;let J=h$(X.attrs,"v-html");if(J===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let Q=_4(Z,X),G=Q6(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 yI($){let Z=$,Y=0;while(Y<Z.length){let X=l6(Z,Y);if(!X)break;let J=h$(X.attrs,"v-text");if(J===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let Q=_4(Z,X),G=Q6(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 xI($){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 vI($){let Z=$,Y=0;while(Y<Z.length){let X=l6(Z,Y);if(!X)break;if(!Dq(X.attrs,"v-once")){Y=X.end;continue}let J=Q6(X.attrs,"v-once"),Q=_4(Z,X),G=Z.slice(Q.outerStart,Q.outerEnd),W=`@once
|
|
2284
2284
|
${G6(G,{...X,start:0,end:X.end-X.start},J)}
|
|
2285
2285
|
@endonce`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function fI($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function gI($){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 T2($){if(!kq($))return $;let Z=$;return Z=II(Z),Z=DI(Z),Z=vI(Z),Z=CI(Z),Z=bI(Z),Z=SI(Z),Z=kI(Z),Z=gI(Z),Z=PI(Z),Z=yI(Z),Z=xI(Z),Z=fI(Z),Z}var MI,TI;var E2=D(()=>{MI=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),TI=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"])});function ZY($){return $.replace(/--/g,"- -").replace(/</g,"<").replace(/>/g,">")}async function I2($,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 U=K.length-1;U>=0;U--){let z=K[U];try{let _=L0(z.expr,Z);if(!_||typeof _!=="string"){let L=`<!-- dynamic component: could not resolve "${ZY(z.expr)}" -->`;Q=Q.slice(0,z.index)+L+Q.slice(z.index+z.full.length);continue}let B=z.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(B))!==null){let L=H[1]||H[2],F=H[3];if(H[1])try{q[L]=L0(F,Z)}catch{q[L]=F}else q[L]=F}let O=X.componentsDir||"components",V=await z4(_,q,z.slotContent,O,Z,Y,X,new Set,J??new Set);Q=Q.slice(0,z.index)+V+Q.slice(z.index+z.full.length)}catch(_){let B=_ instanceof Error?_.message:String(_),q=`<!-- dynamic component error: ${ZY(B)} -->`;Q=Q.slice(0,z.index)+q+Q.slice(z.index+z.full.length)}}return Q=await hI(Q,Z,Y,X,J),Q}async function hI($,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 U=K.length-1;U>=0;U--){let z=K[U];try{let _=L0(z.expr,Z);if(!_||typeof _!=="string"){let j=`<!-- dynamic component: could not resolve "${ZY(z.expr)}" -->`;Q=Q.slice(0,z.index)+j+Q.slice(z.index+z.full.length);continue}let B=X.componentsDir||"components",q=await z4(_,{},"",B,Z,Y,X,new Set,J??new Set);Q=Q.slice(0,z.index)+q+Q.slice(z.index+z.full.length)}catch(_){let B=_ instanceof Error?_.message:String(_),q=`<!-- dynamic component error: ${ZY(B)} -->`;Q=Q.slice(0,z.index)+q+Q.slice(z.index+z.full.length)}}return Q}var D2=D(()=>{N0();i0()});function Sq($,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 Cq($,Z,Y={}){let{prefix:X="",preserveHost:J=!0,scopeKeyframes:Q=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=k2($),W=[],U=new Map;if(Q)for(let z of K){let _=z.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(_){let B=_[1],q=`${Z}_${B}`;U.set(B,q)}}for(let z of K){let _=bq(z,Z,X,J,U,G);W.push(_)}return W.join(`
|
|
2286
2286
|
|
|
@@ -2288,7 +2288,7 @@ ${G6(G,{...X,start:0,end:X.end-X.start},J)}
|
|
|
2288
2288
|
`)})}else Z.push({selector:`@${z} ${_.trim()}`,declarations:B.trim()})}G="",Q=!1}else if(J.trim()){J+=W;let U=J.match(/([^{]+)\{([^}]*)\}/);if(U)Z.push({selector:U[1].trim(),declarations:U[2].trim()});J=""}continue}}if(Q)G+=W;else J+=W}return Z}function bq($,Z,Y,X,J,Q){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let z=G.replace("@keyframes ","").trim();return`@keyframes ${J.get(z)||z} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let _=k2(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((B)=>bq(B,Z,Y,X,J,Q)).join(`
|
|
2289
2289
|
`);return`${G} {
|
|
2290
2290
|
${_}
|
|
2291
|
-
}`}return`${G} { ${K} }`}let W=dI(G,Z,Y,X),U=K;for(let[z,_]of J)U=U.replace(new RegExp(`\\b${z}\\b`,"g"),_);if(Q)U=U.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${W} { ${U} }`}function dI($,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 U=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);Q.push(U)}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}`);let W=uI(G,Z);if(W)Q.push(Y?`${Y} ${W}`:W)}return Q.join(", ")}function uI($,Z){let Y=0,X=$.length;for(let W=0;W<$.length;W++){let U=$[W];if(U==="["||U==="(")Y++;else if(U==="]"||U===")")Y--;else if(Y===0&&(U===" "||U===">"||U==="+"||U==="~")){X=W;break}}let J=$.slice(0,X),Q=$.slice(X);if(!J)return"";let G=J.length,K=0;for(let W=0;W<J.length;W++){let U=J[W];if(U==="["||U==="(")K++;else if(U==="]"||U===")")K--;else if(Y===0&&K===0&&U===":"){G=W;break}}return`${J.slice(0,G)}.${Z}${J.slice(G)}${Q}`}function u7($,Z){if(!mI.test($))return{html:$,hasScoped:!1};let Y=Sq(Z),X=`data-v-${Y}`,J=$,Q=new RegExp(`<style\\s+([^>]*${S2}[^>]*)>([\\s\\S]*?)</style>`,"gi"),G=!1;if(J=J.replace(Q,(K,W,U)=>{G=!0;let z=lI(U,X),_=W.replace(new RegExp(S2,"gi"),"").trim(),B=_?` ${_}`:"";return`<style data-stx-scoped="${Y}"${B}>${z}</style>`}),!G)return{html:$,hasScoped:!1};return J=pI(J,X),{html:J,hasScoped:!0}}function lI($,Z){return Cq($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function pI($,Z){let Y=Q4($,(J,Q)=>{let G=i4(J,Q);return G>Q?G:V$(J,Q)},(J,Q)=>cI(Q)),X=iI(Y.output,Z);return Pq.lastIndex=0,X.replace(Pq,(J,Q)=>Y.tokens[Number(Q)])}function iI($,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 S2,mI,cI=($)=>`\x00stx-scope-mask-${$}\x00`,Pq;var YY=D(()=>{
|
|
2291
|
+
}`}return`${G} { ${K} }`}let W=dI(G,Z,Y,X),U=K;for(let[z,_]of J)U=U.replace(new RegExp(`\\b${z}\\b`,"g"),_);if(Q)U=U.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${W} { ${U} }`}function dI($,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 U=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);Q.push(U)}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}`);let W=uI(G,Z);if(W)Q.push(Y?`${Y} ${W}`:W)}return Q.join(", ")}function uI($,Z){let Y=0,X=$.length;for(let W=0;W<$.length;W++){let U=$[W];if(U==="["||U==="(")Y++;else if(U==="]"||U===")")Y--;else if(Y===0&&(U===" "||U===">"||U==="+"||U==="~")){X=W;break}}let J=$.slice(0,X),Q=$.slice(X);if(!J)return"";let G=J.length,K=0;for(let W=0;W<J.length;W++){let U=J[W];if(U==="["||U==="(")K++;else if(U==="]"||U===")")K--;else if(Y===0&&K===0&&U===":"){G=W;break}}return`${J.slice(0,G)}.${Z}${J.slice(G)}${Q}`}function u7($,Z){if(!mI.test($))return{html:$,hasScoped:!1};let Y=Sq(Z),X=`data-v-${Y}`,J=$,Q=new RegExp(`<style\\s+([^>]*${S2}[^>]*)>([\\s\\S]*?)</style>`,"gi"),G=!1;if(J=J.replace(Q,(K,W,U)=>{G=!0;let z=lI(U,X),_=W.replace(new RegExp(S2,"gi"),"").trim(),B=_?` ${_}`:"";return`<style data-stx-scoped="${Y}"${B}>${z}</style>`}),!G)return{html:$,hasScoped:!1};return J=pI(J,X),{html:J,hasScoped:!0}}function lI($,Z){return Cq($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function pI($,Z){let Y=Q4($,(J,Q)=>{let G=i4(J,Q);return G>Q?G:V$(J,Q)},(J,Q)=>cI(Q)),X=iI(Y.output,Z);return Pq.lastIndex=0,X.replace(Pq,(J,Q)=>Y.tokens[Number(Q)])}function iI($,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 S2,mI,cI=($)=>`\x00stx-scope-mask-${$}\x00`,Pq;var YY=D(()=>{P6();S2=String.raw`(?<![\w-])scoped(?![\w-])`,mI=new RegExp(`<style\\s+[^>]*${S2}`,"i");Pq=/\u0000stx-scope-mask-(\d+)\u0000/g});function C2($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}<style data-stx-cloak>[x-cloak]{display:none !important}</style>
|
|
2292
2292
|
${$.slice(Z)}`}function yq($){let Z=[],Y=0;while(Y<$.length){let Q=$.slice(Y),G=Q.match(/^\s+/);if(G){Y+=G[0].length;continue}if(Q.startsWith("<!--")){let _=$.indexOf("-->",Y);if(_===-1)break;Y=_+3;continue}let K=Q.match(/^<script\b[^>]*>/i);if(K){let _=$.toLowerCase().indexOf("</script>",Y+K[0].length);if(_===-1)break;Y=_+9;continue}let W=Q.match(/^<link\b[^>]*>/i);if(W){Z.push(W[0]),Y+=W[0].length;continue}let U=Q.match(/^<meta\b[^>]*>/i);if(U){Z.push(U[0]),Y+=U[0].length;continue}let z=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(z){Z.push(z[0]),Y+=z[0].length;continue}break}if(Z.length===0)return{body:$,hoisted:Z};let X="",J=0;while(J<$.length&&J<Y){let Q=$.slice(J),G=Q.match(/^<link\b[^>]*>/i);if(G&&Z.includes(G[0])){J+=G[0].length;continue}let K=Q.match(/^<meta\b[^>]*>/i);if(K&&Z.includes(K[0])){J+=K[0].length;continue}let W=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(W&&Z.includes(W[0])){J+=W[0].length;continue}X+=$[J],J++}return X+=$.slice(Y),{body:X,hoisted:Z}}function xq($,Z={},Y={}){let{title:X="stx App",lang:J="en",meta:Q=[],link:G=[],script:K=[],headRaw:W="",bodyClass:U="",bodyAttrs:z={}}=Z,_=Y.title||X,j=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...Q].map((R)=>{return` <meta ${Object.entries(R).map(([M,I])=>`${M}="${I}"`).join(" ")}>`}).join(`
|
|
2293
2293
|
`),H=G.map((R)=>{return` <link ${Object.entries(R).map(([M,I])=>`${M}="${I}"`).join(" ")}>`}).join(`
|
|
2294
2294
|
`),O=K.map((R)=>{if(R.src)return` <script ${Object.entries(R).filter(([M])=>M!=="content").map(([M,I])=>`${M}="${I}"`).join(" ")}></script>`;if(R.content)return` <script>${R.content}</script>`;return""}).filter(Boolean).join(`
|
|
@@ -2304,7 +2304,7 @@ ${N.join(`
|
|
|
2304
2304
|
</body>
|
|
2305
2305
|
</html>`}function XY($){return/<!DOCTYPE\b/i.test($)||/<html[\s>]/i.test($)}function b2($,Z={}){let Y=$.lastIndexOf("</head>");if(Y===-1)return $;let{meta:X=[],link:J=[],script:Q=[],headRaw:G=""}=Z,K=$.slice(0,Y),W=[];for(let U of X){let z=U.name?`name="${U.name}"`:U.property?`property="${U.property}"`:U.charset!=null?"charset=":U["http-equiv"]?`http-equiv="${U["http-equiv"]}"`:"";if(z&&K.includes(z))continue;W.push(` <meta ${Object.entries(U).map(([_,B])=>`${_}="${B}"`).join(" ")}>`)}for(let U of J){if(U.href&&K.includes(`href="${U.href}"`))continue;W.push(` <link ${Object.entries(U).map(([z,_])=>`${z}="${_}"`).join(" ")}>`)}for(let U of Q)if(U.src){if(K.includes(`src="${U.src}"`))continue;W.push(` <script ${Object.entries(U).filter(([z])=>z!=="content").map(([z,_])=>`${z}="${_}"`).join(" ")}></script>`)}else if(U.content){if(K.includes(U.content))continue;W.push(` <script>${U.content}</script>`)}if(G&&!K.includes(G))W.push(` ${G}`);if(W.length===0)return $;return`${$.slice(0,Y)}${W.join(`
|
|
2306
2306
|
`)}
|
|
2307
|
-
${$.slice(Y)}`}function m7($,Z={},Y={}){if(XY($))return $;return xq($,Z,Y)}var nI="<style data-stx-cloak>[x-cloak]{display:none !important}</style>";function c7($){let Z=$,Y=new Set,X=new Set,J=()=>{if(b1)X.add(b1);return Z};return J.set=(Q)=>{if(!Object.is(Q,Z)){let G=Z;if(Z=Q,Y.forEach((K)=>K(Z,G)),l7)X.forEach((K)=>QY.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}),Object.defineProperty(J,"value",{get:()=>J(),set:(Q)=>J.set(Q),configurable:!0}),J}function p7($){let Z,Y=!0,X=new Set,J=()=>{if(!Y)if(Y=!0,l7)X.forEach((G)=>QY.add(G));else X.forEach((G)=>G())},Q=()=>{if(b1)X.add(b1);if(Y){let G=b1;b1=J,JY.push(J);try{Z=$()}finally{JY.pop(),b1=G}Y=!1}return Z};return Object.defineProperty(Q,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(Q,"value",{get:()=>Q(),configurable:!0}),Q}function i7($,Z={}){let Y,X=!1,J=()=>{if(X)return;if(Y)Y(),Y=void 0;let Q=b1;b1=J,JY.push(J);try{Y=$()}finally{JY.pop(),b1=Q}};if(Z.immediate!==!1)J();return()=>{if(X=!0,Y)Y()}}function GY($){if(l7){$();return}l7=!0;try{$()}finally{l7=!1,QY.forEach((Z)=>Z()),QY.clear()}}function KY($){rI.push($)}function WY($){aI.push($)}function n7($){return typeof $==="function"&&$._isSignal===!0}function r7($){return typeof $==="function"&&$._isDerived===!0}function UY($){if(n7($)||r7($))return $();return $}function a7($){let Z=b1;b1=null;try{return $()}finally{b1=Z}}function vq($,Z){let Y=typeof $==="function"?$:()=>$,X=c7([]),J=p7(()=>X().reduce((K,W)=>Z(K,W.action),Y())),Q=!1;return i7(()=>{if(Y(),!Q){Q=!0;return}if(a7(()=>X().length))X.set([])}),[J,(K,W)=>{let U={action:K};X.set([...X(),U]);let z=()=>{let _=X().filter((B)=>B!==U);if(_.length!==X().length)X.set(_)};if(W&&typeof W.then==="function")Promise.resolve(W).then(z,z);return z}]}var b1=null,JY,l7=!1,QY,rI,aI;var P2=D(()=>{JY=[],QY=new Set,rI=[],aI=[]});var zY={}
|
|
2307
|
+
${$.slice(Y)}`}function m7($,Z={},Y={}){if(XY($))return $;return xq($,Z,Y)}var nI="<style data-stx-cloak>[x-cloak]{display:none !important}</style>";function c7($){let Z=$,Y=new Set,X=new Set,J=()=>{if(b1)X.add(b1);return Z};return J.set=(Q)=>{if(!Object.is(Q,Z)){let G=Z;if(Z=Q,Y.forEach((K)=>K(Z,G)),l7)X.forEach((K)=>QY.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}),Object.defineProperty(J,"value",{get:()=>J(),set:(Q)=>J.set(Q),configurable:!0}),J}function p7($){let Z,Y=!0,X=new Set,J=()=>{if(!Y)if(Y=!0,l7)X.forEach((G)=>QY.add(G));else X.forEach((G)=>G())},Q=()=>{if(b1)X.add(b1);if(Y){let G=b1;b1=J,JY.push(J);try{Z=$()}finally{JY.pop(),b1=G}Y=!1}return Z};return Object.defineProperty(Q,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(Q,"value",{get:()=>Q(),configurable:!0}),Q}function i7($,Z={}){let Y,X=!1,J=()=>{if(X)return;if(Y)Y(),Y=void 0;let Q=b1;b1=J,JY.push(J);try{Y=$()}finally{JY.pop(),b1=Q}};if(Z.immediate!==!1)J();return()=>{if(X=!0,Y)Y()}}function GY($){if(l7){$();return}l7=!0;try{$()}finally{l7=!1,QY.forEach((Z)=>Z()),QY.clear()}}function KY($){rI.push($)}function WY($){aI.push($)}function n7($){return typeof $==="function"&&$._isSignal===!0}function r7($){return typeof $==="function"&&$._isDerived===!0}function UY($){if(n7($)||r7($))return $();return $}function a7($){let Z=b1;b1=null;try{return $()}finally{b1=Z}}function vq($,Z){let Y=typeof $==="function"?$:()=>$,X=c7([]),J=p7(()=>X().reduce((K,W)=>Z(K,W.action),Y())),Q=!1;return i7(()=>{if(Y(),!Q){Q=!0;return}if(a7(()=>X().length))X.set([])}),[J,(K,W)=>{let U={action:K};X.set([...X(),U]);let z=()=>{let _=X().filter((B)=>B!==U);if(_.length!==X().length)X.set(_)};if(W&&typeof W.then==="function")Promise.resolve(W).then(z,z);return z}]}var b1=null,JY,l7=!1,QY,rI,aI;var P2=D(()=>{JY=[],QY=new Set,rI=[],aI=[]});var zY={};$0(zY,{useOptimistic:()=>vq,untrack:()=>UY,state:()=>c7,peek:()=>a7,onMount:()=>KY,onDestroy:()=>WY,isSignal:()=>n7,isDerived:()=>r7,generateSignalsRuntimeDev:()=>c6,generateSignalsRuntime:()=>s7,effect:()=>i7,derived:()=>p7,default:()=>oI,batch:()=>GY});function s7(){try{let $=sI(c6()),Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return c6()}}function sI($){let Z=[],Y=0,X="console.log(";while(Y<$.length){let J=$.indexOf(X,Y);if(J===-1){Z.push($.slice(Y));break}Z.push($.slice(Y,J));let Q=1,G=J+X.length;while(G<$.length&&Q>0){let K=$[G];if(K==='"'||K==="'"||K==="`"){let W=K;G++;while(G<$.length&&$[G]!==W){if($[G]==="\\")G++;G++}G++;continue}if(K==="(")Q++;else if(K===")")Q--;G++}Z.push("0"),Y=G}return Z.join("")}function c6(){return`
|
|
2308
2308
|
// STX Signals Runtime (Development Build)
|
|
2309
2309
|
console.log('[stx] signals runtime loading');
|
|
2310
2310
|
// Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
|
|
@@ -8846,7 +8846,7 @@ catch (e) { console.warn('[stx] mount callback error:', e); }
|
|
|
8846
8846
|
}
|
|
8847
8847
|
}
|
|
8848
8848
|
})();
|
|
8849
|
-
`}var oI;var d$=D(()=>{P2();P2();oI={state:c7,derived:p7,effect:i7,batch:GY,onMount:KY,onDestroy:WY,isSignal:n7,isDerived:r7,untrack:UY,peek:a7,generateSignalsRuntime:s7,generateSignalsRuntimeDev:
|
|
8849
|
+
`}var oI;var d$=D(()=>{P2();P2();oI={state:c7,derived:p7,effect:i7,batch:GY,onMount:KY,onDestroy:WY,isSignal:n7,isDerived:r7,untrack:UY,peek:a7,generateSignalsRuntime:s7,generateSignalsRuntimeDev:c6}});var l$={};$0(l$,{templateCache:()=>y2,readFileCached:()=>fq,invalidateFileCacheByDir:()=>hq,invalidateFileCache:()=>gq,hashFilePath:()=>m$,getCachedSignalsRuntime:()=>mq,getCachedRouterScript:()=>lq,clearDevCaches:()=>cq,checkCache:()=>qY,cacheTemplate:()=>jY,__setSignalsGeneratorsForTest:()=>uq});import K6 from"fs";import u$ from"path";async function fq($){let Y;for(let X=0;X<3;X++)try{let Q=(await K6.promises.stat($)).mtime.getTime(),G=p6.get($);if(G&&G.mtime===Q)return G.content;let K=await Bun.file($).text(),U=(await K6.promises.stat($)).mtime.getTime();if(U!==Q)continue;return p6.set($,{content:K,mtime:U}),K}catch(J){Y=J;break}throw p6.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function gq($){p6.delete($)}function hq($){for(let Z of p6.keys())if(Z.startsWith($))p6.delete(Z)}function uq($){dq=$}async function mq($=!1){let Z=dq??await Promise.resolve().then(() => (d$(),zY));if($)return Z.generateSignalsRuntimeDev();if(_Y===null)_Y=Z.generateSignalsRuntime();return _Y}async function lq(){if(BY===null){let{getRouterScript:$}=await import("stx-router");BY=$()}return BY}function cq(){p6.clear(),B4(),_Y=null,tI=null,BY=null}function pq($){let Z={debug:$.debug===!0,middleware:($.middleware??[]).map((Y)=>({name:Y.name,timing:Y.timing,handler:String(Y.handler)})),customDirectives:($.customDirectives??[]).map((Y)=>({name:Y.name,hasEndTag:Y.hasEndTag===!0,handler:String(Y.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(Z)).digest("hex")}async function qY($,Z){try{if(!Z.cachePath)return null;let Y=u$.resolve(Z.cachePath),X=u$.join(Y,`${m$($)}.html`),J=u$.join(Y,`${m$($)}.meta.json`);if(!await J0(X)||!await J0(J))return null;let Q=await Bun.file(J).text(),G=JSON.parse(Q);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==pq(Z))return null;if((await K6.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let W of G.dependencies)if(await J0(W)){if((await K6.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 jY($,Z,Y,X){try{if(!X.cachePath)return;let J=u$.resolve(X.cachePath);await K6.promises.mkdir(J,{recursive:!0});let Q=u$.join(J,`${m$($)}.html`),G=u$.join(J,`${m$($)}.meta.json`),K=await K6.promises.stat($);await Bun.write(Q,Z);let W={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:X.cacheVersion,optionsSignature:pq(X),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(W,null,2)),y2.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(J){console.warn(`Failed to cache template ${$}:`,J)}}function m$($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,eI)}var y2,p6,_Y=null,tI=null,dq=null,BY=null,eI=16;var i6=D(()=>{N0();y2=new Map,p6=new Map});function iq($){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]+`
|
|
8850
8850
|
`;let J=/\{\{([\s\S]*?)\}\}/g;while((X=J.exec($))!==null)Y+=X[1]+`
|
|
8851
8851
|
`;if(!Y.trim())return $;let G=["browserQuery","BrowserQueryBuilder","configureBrowser","createBrowserModel","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"].some((B)=>{return new RegExp(`\\b${B}\\b`).test(Y)}),K=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process"]),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,U,z=!1;while((U=W.exec(Y))!==null)if(!K.has(U[1])){z=!0;break}if(!G&&!z)return $;let _=`<script type="module">
|
|
8852
8852
|
// STX: Auto-load @stacksjs/browser (auto-initializes API and loads models)
|
|
@@ -8858,16 +8858,16 @@ ${_}`);return _+`
|
|
|
8858
8858
|
`+$}async function nq($,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 data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
|
|
8859
8859
|
`+$.slice(K);if($.includes("</head>")){let W=$.indexOf("</head>");return $.slice(0,W)+`<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
|
|
8860
8860
|
`+$.slice(W)}return`<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
|
|
8861
|
-
`+$}let{getCachedSignalsRuntime:Y}=await Promise.resolve().then(() => (
|
|
8861
|
+
`+$}let{getCachedSignalsRuntime:Y}=await Promise.resolve().then(() => (i6(),l$)),J=`<script data-stx-scoped data-stx-runtime>${await Y(Z.debug)}</script>`,Q=$.indexOf("<script");if(Q!==-1)return $.slice(0,Q)+J+`
|
|
8862
8862
|
`+$.slice(Q);if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+J+`
|
|
8863
8863
|
`+$.slice(G)}if($.includes("<body")){let G=$.indexOf("<body"),K=$.indexOf(">",G);return $.slice(0,K+1)+`
|
|
8864
8864
|
`+J+$.slice(K+1)}return J+`
|
|
8865
8865
|
`+$}async function M4($,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.interceptAllLinks!==void 0)K.interceptAllLinks=Y.interceptAllLinks;if(Y.progress!==void 0)K.progress=Y.progress;if(Y.viewTransitions!==void 0)K.viewTransitions=Y.viewTransitions;if(Y.viewTransitionDuration!==void 0)K.viewTransitionDuration=Y.viewTransitionDuration;if(Y.viewTransitionEasing!==void 0)K.viewTransitionEasing=Y.viewTransitionEasing;if(Y.scrollToTop!==void 0)K.scrollToTop=Y.scrollToTop;if(Y.prefetch!==void 0)K.prefetch=Y.prefetch;if(Y.cache!==void 0)K.cache=Y.cache;if(Y.progressColor!==void 0)K.progressColor=Y.progressColor;if(Y.progressHeight!==void 0)K.progressHeight=Y.progressHeight;if(Object.keys(K).length>0)X=`<script>window.__stxRouterConfig=${JSON.stringify(K)};</script>
|
|
8866
|
-
`}let{getCachedRouterScript:J}=await Promise.resolve().then(() => (
|
|
8867
|
-
</body>`+$.slice(G+7)}var VY={}
|
|
8866
|
+
`}let{getCachedRouterScript:J}=await Promise.resolve().then(() => (i6(),l$)),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+`
|
|
8867
|
+
</body>`+$.slice(G+7)}var VY={};$0(VY,{scanScriptTags:()=>$j,rewriteStxImportSpecifiers:()=>Jj,processSignals:()=>h2,processScriptSetup:()=>Yj,preEvalLiteralReactiveIfs:()=>f2,parseLoopExpression:()=>Zj,hasSignalsSyntax:()=>LY,findMarkupIndexOutsideScripts:()=>OY,extractExports:()=>Xj,convertSignalLoopsToAttributes:()=>g2,convertSignalDirectivesToAttributes:()=>v2});function $j($,Z={}){let Y=[];for(let X of kJ($,i4)){let J=X.token.match(/^<script\b([^>]*)>/i),Q=X.token.match(/<\/script\s*>$/i);if(!J||!Q)continue;let G=J[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let K=J[0].length,W=X.token.length-Q[0].length;Y.push({fullMatch:X.token,attrs:G,body:X.token.slice(K,W),start:X.start,end:X.end})}return Y}function Zj($){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}=aq(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}=aq(J);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function aq($){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 LY($){return[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\buseId\s*\(/,/\buseReactiveProp\s*(?:<[^>]*>)?\s*\(/,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/].some((Y)=>Y.test($))}function ZD($){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 YD($){let Z=new Set,Y=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,J;while((J=Y.exec($))!==null){let Q=J[1],G;while((G=X.exec(Q))!==null)Z.add(G[1])}return Z}function XD($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function oq($,Z,Y){if(!$)return!1;let X=XD($),J=!1,Q=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,W;while((W=K.exec(X))!==null){let B=W[1];if(X.slice(0,W.index).trimEnd().endsWith("."))continue;if(sq.has(B))continue;if(Z.has(B))J=!0;else if(Y&&B in Y)Q=!0}let U=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,z;while((z=U.exec(X))!==null){let B=z[1];if(X.slice(0,z.index).trimEnd().endsWith("."))continue;if(sq.has(B)||Y&&B in Y)continue;G=!0}return(J||G)&&!Q}function HY($,Z,Y){let X=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,""")}"`,J=$.trim(),Q=J.match(eq);if(Q&&JD(Q[3],Q[1])){let[,G,K,W]=Q;return`<${G}${K}${X}>${W}</${G}>`}return`<template${X}>${J}</template>`}function JD($,Z){let Y=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),X=0,J;while((J=Y.exec($))!==null)if(J[1]){if(X--,X<0)return!1}else X++;return!0}function v2($,Z){let Y=YD($);function X(J){let Q=J,G=/@if\s*\(/g,K,W=[];while((K=G.exec(Q))!==null){let U=K.index,z=U+K[0].length,_=1,B=z;while(B<Q.length&&_>0){if(Q[B]==="(")_++;else if(Q[B]===")")_--;B++}if(_!==0)continue;let q=Q.substring(z,B-1).trim(),j=B,H=1,O=j,V=/@(if\s*\(|endif)/g;V.lastIndex=j;let L;while((L=V.exec(Q))!==null)if(L[1].startsWith("if"))H++;else if(L[1]==="endif"){if(H--,H===0){O=L.index+L[0].length;break}}if(H!==0)continue;let F=Q.substring(j,O-6).trim(),A;if(ZD(F)){let w=k$(Q.substring(U,O));if(w.length===0)continue;let N=w[0].branches.filter((M)=>M.type!=="else");if(!(N.length>0&&N.every((M)=>oq(M.condition,Y,Z))))continue;A=w[0].branches.map((M)=>{let I=X(M.content);if(M.type==="elseif")return HY(I,"@else-if",M.condition??"");if(M.type==="else")return HY(I,"@else");return HY(I,"@if",M.condition??"")}).join(`
|
|
8868
8868
|
`)}else{if(!oq(q,Y,Z))continue;A=HY(X(F),"@if",q)}W.push({start:U,end:O,replacement:A}),G.lastIndex=O}for(let U=W.length-1;U>=0;U--){let{start:z,end:_,replacement:B}=W[U];Q=Q.substring(0,z)+B+Q.substring(_)}return Q}return X($)}function QD($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let J=Number(Z);return J!==0&&!Number.isNaN(J)}let Y=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(Y)return Y[1].length>0;let X=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(X)return X[1].length>0;return}function GD($,Z,Y,X){if(x2.has(Y.toLowerCase()))return X;let J=Y.toLowerCase(),Q=$.toLowerCase(),G=$.length,K=1,W=X;while(W<G){let U=$.indexOf("<",W);if(U===-1)return-1;if(W=U,$.startsWith("<!--",W)){let q=$.indexOf("-->",W+4);if(q===-1)return-1;W=q+3;continue}let z=/^<(script|style)\b/i.exec($.slice(W,W+8));if(z){let q=$.indexOf(">",W);if(q===-1)return-1;if($[q-1]==="/"){W=q+1;continue}let j=Q.indexOf(`</${z[1].toLowerCase()}`,W);if(j===-1)return-1;let H=$.indexOf(">",j);if(H===-1)return-1;W=H+1;continue}if($[W+1]==="/"){let q=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(W,W+64));if(!q){W++;continue}if(q[1].toLowerCase()===J){if(K--,W+=q[0].length,K===0)return W;continue}W+=q[0].length;continue}let _=/^<([a-z][\w-]*)\b/i.exec($.slice(W,W+64));if(!_){W++;continue}let B=$.indexOf(">",W);if(B===-1)return-1;if(_[1].toLowerCase()===J){let q=$.slice(W,B+1);if(!(/\/\s*>$/.test(q)||x2.has(J)))K++}W=B+1}return-1}function WD($,Z){let Y=Z,X=$.length;for(;;){while(Y<X&&$[Y]!=="<")Y++;if(Y>=X)return!1;if($.startsWith("<!--",Y)){let G=$.indexOf("-->",Y+4);if(G===-1)return!1;Y=G+3;continue}break}if($[Y+1]==="/")return!1;let J=$.indexOf(">",Y);if(J===-1)return!1;let Q=$.slice(Y,J+1);return KD.test(Q)}function f2($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,X;while((X=Y.exec($))!==null)Z.push([X.index,X.index+X[0].length]);let J=(_)=>Z.some(([B,q])=>_>=B&&_<q),Q=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],K;while((K=Q.exec($))!==null){if(J(K.index))continue;let[_,B,q,j,H,O,V]=K,L=QD(H);if(L===void 0)continue;let F=K.index,A=F+_.length,R=!!V||/\/\s*>$/.test(_)||x2.has(B.toLowerCase())?A:GD($,F,B,A);if(R===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&WD($,R)){Q.lastIndex=A;continue}if(L===!0){let M=`<${B}${q}${O}${V}>`;G.push({start:F,end:A,replacement:M});continue}G.push({start:F,end:R,replacement:""}),Q.lastIndex=R}if(G.length===0)return $;G.sort((_,B)=>_.start-B.start);let W=[],U=-1;for(let _ of G){if(_.start<U)continue;W.push(_),U=_.end}let z=$;for(let _=W.length-1;_>=0;_--){let{start:B,end:q,replacement:j}=W[_];z=z.substring(0,B)+j+z.substring(q)}return z}function g2($,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,U=1,z=W;while(z<Y.length&&U>0){if(Y[z]==="(")U++;else if(Y[z]===")")U--;z++}if(U!==0)continue;let _=Y.substring(W,z-1).trim(),B=z,q=Zj(_);if(q.iterable){let N=q.iterable.trim();if(N.startsWith("[")||N.startsWith("{")||N.startsWith("'")||N.startsWith('"')||N.startsWith("`")||/^-?\d/.test(N))continue;if(Z){let R=N.split(/[.[(]/)[0].trim();if(R&&R in Z)continue}}if(q.style==="as")_=q.indexVar?`(${q.itemVar}, ${q.indexVar}) in ${q.iterable}`:`${q.itemVar} in ${q.iterable}`;let j=G==="for"?"@endfor":"@endforeach",H=1,O=B,V=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");V.lastIndex=B;let L;while((L=V.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 F=Y.substring(B,O-j.length).trim(),A=F.match(eq),w;if(A){let[,N,R,E]=A;w=`<${N}${R} @for="${_}">${E}</${N}>`}else w=`<template @for="${_}">${F}</template>`;Q.push({start:K,end:O,replacement:w})}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:U}=Q[G];Y=Y.substring(0,K)+U+Y.substring(W)}return Y}function UD($){let Z=new Set,Y=[],X=0,J=0,Q=$.length,G=(z)=>{let _=X+1;while(_<Q){let B=$[_];if(B==="\\"){_+=2;continue}if(B===z)return _+1;_++}return Q},K=()=>{let z=X+2;while(z<Q&&$[z]!==`
|
|
8869
8869
|
`)z++;return z},W=()=>{let z=X+2;while(z<Q-1){if($[z]==="*"&&$[z+1]==="/")return z+2;z++}return Q},U=(z)=>{let _=z,B=0;while(_<Q){let q=$[_];if(q==="/"&&$[_+1]==="/"){let j=_+2;while(j<Q&&$[j]!==`
|
|
8870
|
-
`)j++;_=j;continue}if(q==="/"&&$[_+1]==="*"){let j=_+2;while(j<Q-1&&!($[j]==="*"&&$[j+1]==="/"))j++;_=j+2;continue}if(q==='"'||q==="'"||q==="`"){let j=_+1;while(j<Q){if($[j]==="\\"){j+=2;continue}if($[j]===q){j++;break}j++}_=j;continue}if(q==="("||q==="["||q==="{"){B++,_++;continue}if(q===")"||q==="]"||q==="}"){B--,_++;continue}if(q===";"&&B===0)return _+1;_++}return Q};while(X<Q){let z=$[X];if(z==="/"&&$[X+1]==="/"){let _=K();Y.push($.slice(X,_)),X=_;continue}if(z==="/"&&$[X+1]==="*"){let _=W();Y.push($.slice(X,_)),X=_;continue}if(z==='"'||z==="'"||z==="`"){let _=G(z);Y.push($.slice(X,_)),X=_;continue}if(z==="{"){J++,Y.push(z),X++;continue}if(z==="}"){J--,Y.push(z),X++;continue}if(J===0){let _=X>0?$[X-1]:"";if(_===""||/\s/.test(_)||_===";"||_==="}"||_==="{"){let q=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(q){let j=q[2],H=U(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(z),X++}return Y.join("")}async function Yj($,Z,Y){let X=$j($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),J=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,Q=[];for(let O of X){let V=O.body;if(c4(O.attrs))V=p4(V);if(J.test(V))Q.push({fullMatch:O.fullMatch,attrs:O.attrs,content:V})}if(Q.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${$D++}`,{hasUserImports:K,bundleClientScript:W}=await Promise.resolve().then(() => (X7(),Y7)),U=[];for(let O=0;O<Q.length;O++){let V=Q[O].content;if(V=
|
|
8870
|
+
`)j++;_=j;continue}if(q==="/"&&$[_+1]==="*"){let j=_+2;while(j<Q-1&&!($[j]==="*"&&$[j+1]==="/"))j++;_=j+2;continue}if(q==='"'||q==="'"||q==="`"){let j=_+1;while(j<Q){if($[j]==="\\"){j+=2;continue}if($[j]===q){j++;break}j++}_=j;continue}if(q==="("||q==="["||q==="{"){B++,_++;continue}if(q===")"||q==="]"||q==="}"){B--,_++;continue}if(q===";"&&B===0)return _+1;_++}return Q};while(X<Q){let z=$[X];if(z==="/"&&$[X+1]==="/"){let _=K();Y.push($.slice(X,_)),X=_;continue}if(z==="/"&&$[X+1]==="*"){let _=W();Y.push($.slice(X,_)),X=_;continue}if(z==='"'||z==="'"||z==="`"){let _=G(z);Y.push($.slice(X,_)),X=_;continue}if(z==="{"){J++,Y.push(z),X++;continue}if(z==="}"){J--,Y.push(z),X++;continue}if(J===0){let _=X>0?$[X-1]:"";if(_===""||/\s/.test(_)||_===";"||_==="}"||_==="{"){let q=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(q){let j=q[2],H=U(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(z),X++}return Y.join("")}async function Yj($,Z,Y){let X=$j($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),J=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,Q=[];for(let O of X){let V=O.body;if(c4(O.attrs))V=p4(V);if(J.test(V))Q.push({fullMatch:O.fullMatch,attrs:O.attrs,content:V})}if(Q.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${$D++}`,{hasUserImports:K,bundleClientScript:W}=await Promise.resolve().then(() => (X7(),Y7)),U=[];for(let O=0;O<Q.length;O++){let V=Q[O].content;if(V=C6(V).code,K(V))console.log("[stx:bundler] bundling signal script imports"),V=await W(V,Z||"",{projectRoot:process.cwd()});V=V.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(F,A)=>Jj(A));let L=l1(V);U.push(`// \u2500\u2500 merged signal script #${O+1} \u2500\u2500
|
|
8871
8871
|
${L}`)}let z=U.join(`
|
|
8872
8872
|
|
|
8873
8873
|
`);z=UD(z);let _=Xj(z),B=_.split(",").map((O)=>O.trim()).filter(Boolean),q=K7(z,Y),j=`
|
|
@@ -8884,7 +8884,7 @@ if(window.stx)window.stx._latestSetup=${G};
|
|
|
8884
8884
|
`)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},q=()=>{if(J!==0)return;let j=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(j){let F=j[2];if(!X.has(F))Y.push(F),X.add(F);return}let H=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((F)=>{let A=F.trim();if(!A)return;let w=A.indexOf(":"),R=(w>=0?A.slice(w+1).trim():A).split(/[\s=]/)[0];if(R&&!X.has(R))Y.push(R),X.add(R)});return}let O=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(O){O[1].split(",").forEach((F)=>{let A=F.trim().replace(/^\.\.\./,"");if(!A)return;let w=A.split(/[\s=]/)[0];if(w&&!X.has(w))Y.push(w),X.add(w)});return}let V=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(V){let F=V[1];if(!X.has(F))Y.push(F),X.add(F);return}let L=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let F=L[1];if(!X.has(F))Y.push(F),X.add(F)}};while(Q<G){if(B())continue;if(Z[Q]==="'"||Z[Q]==='"'){z(Z[Q]),K=Z[Q-1];continue}if(Z[Q]==="`"){_(),K="`";continue}if(Z[Q]==="/"&&Z[Q+1]!=="/"&&Z[Q+1]!=="*"&&U()){W(),K="/";continue}if(Z[Q]==="{"){J++,K="{",Q++;continue}if(Z[Q]==="}"){J--,K="}",Q++;continue}if(J===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))q();if(!/\s/.test(Z[Q]))K=Z[Q];Q++}return Y.join(", ")}async function h2($,Z,Y,X){if(!LY($))return $;let J=$;if(Z.skipSignalsRuntime)return J;let{output:Q,setupCode:G}=await Yj(J,Y,X);if(J=Q,J=await nq(J,Z),J=iq(J),G){let z=OY(J,/<\/head>/i),_=z===-1?OY(J,/<body[^>]*>/i):-1;if(z!==-1)J=`${J.slice(0,z)}${G}
|
|
8885
8885
|
${J.slice(z)}`;else if(_!==-1){let B=/<body[^>]*>/i.exec(J.slice(_))[0],q=_+B.length;J=`${J.slice(0,q)}
|
|
8886
8886
|
${G}${J.slice(q)}`}else J=`${J}
|
|
8887
|
-
${G}`}let W=J.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),U=W&&/data-stx/.test(W[1]);if(!G&&!U&&W&&!/data-stx-auto/.test(W[1])){let z=/<body[^>]*>/i,_=OY(J,z);if(_!==-1){let B=J.slice(0,_),q=J.slice(_).replace(z,(j)=>j.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));J=B+q}}return J}function OY($,Z){let Y=/<(script|style)\b[\s\S]*?<\/\1>/gi,X=[],J;while((J=Y.exec($))!==null)X.push([J.index,J.index+J[0].length]);let Q=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let K=Q.exec($.slice(G));if(!K)return-1;let W=G+K.index;if(!X.some(([z,_])=>W>=z&&W<_))return W;G=W+Math.max(K[0].length,1)}return-1}function Jj($){let Z=[];for(let Y of $.split(",")){let X=Y.trim();if(!X||X.startsWith("type "))continue;let J=X.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(J&&J[1]!==J[2])Z.push(`${J[2]} = ${J[1]}`)}if(Z.length===0)return tq;return`var ${Z.join(", ")}; ${tq}`}var $D=0,rq=`(?:"[^"]*"|'[^']*'|[^>"'])*`,eq,sq,x2,KD,tq="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var o7=D(()=>{
|
|
8887
|
+
${G}`}let W=J.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),U=W&&/data-stx/.test(W[1]);if(!G&&!U&&W&&!/data-stx-auto/.test(W[1])){let z=/<body[^>]*>/i,_=OY(J,z);if(_!==-1){let B=J.slice(0,_),q=J.slice(_).replace(z,(j)=>j.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));J=B+q}}return J}function OY($,Z){let Y=/<(script|style)\b[\s\S]*?<\/\1>/gi,X=[],J;while((J=Y.exec($))!==null)X.push([J.index,J.index+J[0].length]);let Q=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let K=Q.exec($.slice(G));if(!K)return-1;let W=G+K.index;if(!X.some(([z,_])=>W>=z&&W<_))return W;G=W+Math.max(K[0].length,1)}return-1}function Jj($){let Z=[];for(let Y of $.split(",")){let X=Y.trim();if(!X||X.startsWith("type "))continue;let J=X.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(J&&J[1]!==J[2])Z.push(`${J[2]} = ${J[1]}`)}if(Z.length===0)return tq;return`var ${Z.join(", ")}; ${tq}`}var $D=0,rq=`(?:"[^"]*"|'[^']*'|[^>"'])*`,eq,sq,x2,KD,tq="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var o7=D(()=>{b6();I7();H7();N0();P6();eq=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;sq=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);x2=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);KD=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import c$ from"path";function Qj($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function Gj($,Z,Y){try{let X;if($.startsWith("/")){let J=Z;for(let Q=0;Q<5;Q++){let G=c$.join(J,$);if(await Bun.file(G).exists())return G;J=c$.dirname(J)}X=c$.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))X=c$.resolve(Z,$);else X=c$.resolve(Z,$);if(await Bun.file(X).exists())return X;return null}catch{return null}}async function Kj($,Z,Y){let X=$,J=c$.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(X))!==null){let[U,z,_,B]=G;if(Qj(_))continue;let q=await Gj(_,J,Z);if(q)try{let j=await Bun.file(q).text();if(Y.add(q),_.endsWith(".ts")||_.endsWith(".tsx")){let O=await Bun.build({entrypoints:[q],target:"browser",minify:!1,define:F1()});if(O.outputs.length>0)j=await O.outputs[0].text()}let H=`<script>
|
|
8888
8888
|
// Source: ${_}
|
|
8889
8889
|
${j}
|
|
8890
8890
|
</script>`;X=X.replace(U,H),Q.lastIndex=0}catch(j){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,W;while((W=K.exec(X))!==null){let[U,z,_,B]=W,q=z+B;if(Qj(_))continue;if(/rel=["']stylesheet["']/.test(q)||_.endsWith(".css")){let H=await Gj(_,J,Z);if(H)try{let O=await Bun.file(H).text();Y.add(H);let V=`<style>
|
|
@@ -8895,12 +8895,12 @@ ${O}
|
|
|
8895
8895
|
\u2192 ${W}`)}}if(Q.length>0&&X.enabled){let K=`[STX] DOM API violation in ${Z.split("/").pop()||Z}:
|
|
8896
8896
|
${Q.join(`
|
|
8897
8897
|
`)}
|
|
8898
|
-
Tip: prefer useRef(), navigate(), and composables for component code`;if(X.failOnViolation)throw Error(K);else console.warn(K)}}var _D;var m2=D(()=>{_D=[{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 Bj={}
|
|
8898
|
+
Tip: prefer useRef(), navigate(), and composables for component code`;if(X.failOnViolation)throw Error(K);else console.warn(K)}}var _D;var m2=D(()=>{_D=[{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 Bj={};$0(Bj,{getStoreScript:()=>BD,clearStoreCache:()=>qD});import FY from"path";async function BD($){let Z;if($)Z=FY.resolve($);else{let z=await g0();Z=FY.resolve(z.root||process.cwd(),z.storesDir||"stores")}let Y=p$.get(Z);if(Y!==void 0)return Y||null;let X=new Bun.Glob("*.ts"),J=[];try{for await(let z of X.scan({cwd:Z,absolute:!0})){let _=FY.basename(z,".ts");if(["index","types"].includes(_))continue;if(z.includes(".d.ts"))continue;J.push(z)}}catch{return p$.set(Z,""),null}if(J.length===0)return p$.set(Z,""),null;let Q=[];for(let z of J){let _=await Bun.file(z).text();Q.push({file:z,hasUseStore:/useStore\s*\(/.test(_)})}Q.sort((z,_)=>{if(z.hasUseStore===_.hasUseStore)return 0;return z.hasUseStore?1:-1});let G=Q.map((z)=>z.file),K=[],W=new Bun.Transpiler({loader:"ts",target:"browser",define:F1()});for(let z of G)try{let _=await Bun.file(z).text(),B=FY.basename(z,".ts");_=_.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^export\s+(default\s+)?/gm,""),_=W.transformSync(_),K.push(`// Store: ${B}
|
|
8899
8899
|
${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load store ${z}:`,_)}if(K.length===0)return p$.set(Z,""),null;let U=`;(function(){
|
|
8900
8900
|
${K.join(`
|
|
8901
8901
|
|
|
8902
8902
|
`)}
|
|
8903
|
-
})();`;return p$.set(Z,U),U}function qD(){p$.clear()}var p$;var qj=D(()=>{n0();u4();p$=new Map});var Hj={}
|
|
8903
|
+
})();`;return p$.set(Z,U),U}function qD(){p$.clear()}var p$;var qj=D(()=>{n0();u4();p$=new Map});var Hj={};$0(Hj,{getComposableScript:()=>LD,clearComposableCache:()=>VD});import Z8 from"path";function jj($){let Z=Z8.basename($,".ts");return Z==="index"||Z==="types"||$.endsWith(".d.ts")}async function HD($){if($)return Z8.resolve($);let Z=`<default>:${process.cwd()}`,Y=l2.get(Z);if(Y!==void 0)return Y;let X=await OD();return l2.set(Z,X),X}async function OD(){let $=await g0(),Z=$.root||process.cwd(),Y=$.composablesDir;if(Y)return Z8.resolve(Z,Y);for(let X of jD){let J=Z8.resolve(Z,X);try{let Q=new Bun.Glob("**/*.ts");for await(let G of Q.scan({cwd:J,absolute:!0}))if(!jj(G))return J}catch{}}return null}async function LD($){let Z=await HD($);if(!Z)return null;let Y=i$.get(Z);if(Y!==void 0)return Y||null;let X=[];try{let q=new Bun.Glob("**/*.ts");for await(let j of q.scan({cwd:Z,absolute:!0})){if(jj(j))continue;X.push(j)}}catch{return i$.set(Z,""),null}if(X.length===0)return i$.set(Z,""),null;X.sort();let J=new Bun.Transpiler({loader:"ts",target:"browser",define:F1()}),Q=[],G=new Set,K=new Set;for(let q of X)try{let j=await Bun.file(q).text(),H=Z8.basename(q,".ts");for(let O of j.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(O[1])K.add(O[1]);try{for(let O of J.scan(j).exports)if(O!=="default")G.add(O)}catch{}j=l1(j),j=j.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^export\s+(default\s+)?/gm,""),j=J.transformSync(j),Q.push(`// Composable: ${H}
|
|
8904
8904
|
${j.trim()}`)}catch(j){console.warn(`[stx] Failed to load composable ${q}:`,j)}if(Q.length===0||G.size===0)return i$.set(Z,""),null;let W=[...G].map((q)=>` try { __c[${JSON.stringify(q)}] = ${q}; } catch (e) {}`).join(`
|
|
8905
8905
|
`),U=JSON.stringify([...G]),z=Q.join(`
|
|
8906
8906
|
|
|
@@ -8925,7 +8925,7 @@ ${W}
|
|
|
8925
8925
|
}
|
|
8926
8926
|
window[__n] = __c[__n];
|
|
8927
8927
|
}
|
|
8928
|
-
})();`;return i$.set(Z,B),B}function VD(){i$.clear(),l2.clear()}var i$,l2,jD;var Oj=D(()=>{n0();u4();H7();i$=new Map,l2=new Map,jD=["composables","functions"]});var Fj={}
|
|
8928
|
+
})();`;return i$.set(Z,B),B}function VD(){i$.clear(),l2.clear()}var i$,l2,jD;var Oj=D(()=>{n0();u4();H7();i$=new Map,l2=new Map,jD=["composables","functions"]});var Fj={};$0(Fj,{processDeferDirectives:()=>Vj});function FD(){return`stx-defer-${++Lj}`}function AD($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function wD($,Z,Y){let{trigger:X,value:J}=AD(Z),Q=Y,G,K,W,U=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(U)G=U[1].trim(),Q=Q.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let z=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(z)K=z[1].trim(),Q=Q.replace(/@loading[\s\S]*?(?=@error|$)/,"");let _=Y.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(_)W=_[2].trim(),Q=Q.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return Q=Q.trim(),{trigger:X,triggerValue:J,content:Q,placeholder:G,loading:K,error:W}}function ND($,Z){let{trigger:Y,triggerValue:X}=Z,J;switch(Y){case"visible":J=`
|
|
8929
8929
|
const observer = new IntersectionObserver((entries) => {
|
|
8930
8930
|
if (entries[0].isIntersecting) {
|
|
8931
8931
|
observer.disconnect();
|
|
@@ -9006,7 +9006,7 @@ else {
|
|
|
9006
9006
|
${_}
|
|
9007
9007
|
</div>
|
|
9008
9008
|
${q}
|
|
9009
|
-
`})}var Lj=0;var Rj={}
|
|
9009
|
+
`})}var Lj=0;var Rj={};$0(Rj,{processTeleportDirectives:()=>wj,ensureTeleportTargets:()=>Nj});function RD(){return`stx-teleport-${++Aj}`}function MD($){let Z=$.split(",").map((J)=>J.trim()),Y=Z[0].replace(/['"]/g,""),X;for(let J=1;J<Z.length;J++){let Q=Z[J].match(/disabled:\s*(.+)/);if(Q)X=Q[1].trim()}return{target:Y,disabled:X}}function TD($,Z){return`
|
|
9010
9010
|
<script>
|
|
9011
9011
|
(function() {
|
|
9012
9012
|
const source = document.getElementById('${$}');
|
|
@@ -9074,7 +9074,7 @@ else {
|
|
|
9074
9074
|
});
|
|
9075
9075
|
})();
|
|
9076
9076
|
</script>
|
|
9077
|
-
`}var Aj=0;var Pj={}
|
|
9077
|
+
`}var Aj=0;var Pj={};$0(Pj,{processTransitionDirectives:()=>kj,processTransitionAttributes:()=>bj,performLeave:()=>Dj,performEnter:()=>Ij,generateTransitionRuntime:()=>Cj,generateTransitionCSS:()=>Sj});function Mj($,Z={}){return{enterFrom:Z.enterClass||`${$}-enter-from`,enterActive:Z.enterActiveClass||`${$}-enter-active`,enterTo:Z.enterToClass||`${$}-enter-to`,leaveFrom:Z.leaveClass||`${$}-leave-from`,leaveActive:Z.leaveActiveClass||`${$}-leave-active`,leaveTo:Z.leaveToClass||`${$}-leave-to`}}function ED($){let Z=getComputedStyle($),Y=Z.transitionDuration||"0s",X=Z.animationDuration||"0s",J=(Q)=>{let G=Q.match(/^([\d.]+)(s|ms)?$/);if(!G)return 0;let K=parseFloat(G[1]);return(G[2]||"s")==="ms"?K:K*1000};return Math.max(J(Y),J(X))}function Tj($,Z){return new Promise((Y)=>{let X=Z??ED($);if(X===0){Y();return}let J=!1,Q=()=>{if(J)return;J=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),Y()},G=(K)=>{if(K.target===$)Q()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(Q,X+50)})}function Ej($){$.offsetHeight}async function Ij($,Z={}){let Y=Z.name||"stx",X=Mj(Y,Z),J=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(X.enterFrom),$.classList.add(X.enterActive),Ej($),$.classList.remove(X.enterFrom),$.classList.add(X.enterTo),Z.onEnter)await new Promise((Q)=>{Z.onEnter($,Q)});else await Tj($,J);$.classList.remove(X.enterActive),$.classList.remove(X.enterTo),Z.onAfterEnter?.($)}async function Dj($,Z={}){let Y=Z.name||"stx",X=Mj(Y,Z),J=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(X.leaveFrom),$.classList.add(X.leaveActive),Ej($),$.classList.remove(X.leaveFrom),$.classList.add(X.leaveTo),Z.onLeave)await new Promise((Q)=>{Z.onLeave($,Q)});else await Tj($,J);$.classList.remove(X.leaveActive),$.classList.remove(X.leaveTo),Z.onAfterLeave?.($)}function kj($,Z={},Y){let X=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(X,(J,Q,G)=>{let K=ID(Q),W=K.name||"stx",U=K.duration||300,z=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
|
|
9078
9078
|
<div
|
|
9079
9079
|
class="stx-transition-wrapper"
|
|
9080
9080
|
data-transition="${W}"
|
|
@@ -9392,7 +9392,7 @@ else {
|
|
|
9392
9392
|
|
|
9393
9393
|
console.log('[stx] Transition runtime initialized');
|
|
9394
9394
|
})();
|
|
9395
|
-
`}function bj($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(Y,X,J,Q)=>{let G=J||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${X}" data-stx-transition-duration="${G}" data-stx-transition-condition="${Q}" data-stx-transition-id="${K}"`})}var xj={}
|
|
9395
|
+
`}function bj($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(Y,X,J,Q)=>{let G=J||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${X}" data-stx-transition-duration="${G}" data-stx-transition-condition="${Q}" data-stx-transition-id="${K}"`})}var xj={};$0(xj,{withErrorBoundary:()=>yj,processErrorBoundaryDirectives:()=>SD,generateErrorBoundaryRuntime:()=>xD,generateErrorBoundaryCSS:()=>yD,createErrorBoundary:()=>PD});function kD(){return`eb-${++DD}-${Date.now().toString(36)}`}function SD($,Z={},Y){let X=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(X,(J,Q,G,K)=>{let W=kD(),U=CD(Q||"");return bD(W,G.trim(),K.trim(),U)})}function CD($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,X;while((X=Y.exec($))!==null){let J=X[1],Q=X[2]||X[3]||X[4];switch(J){case"id":Z.id=Q;break;case"logErrors":Z.logErrors=Q==="true";break}}return Z}function bD($,Z,Y,X){let J=X.logErrors!==!1;return`
|
|
9396
9396
|
<div class="stx-error-boundary" data-boundary-id="${$}" data-has-error="false">
|
|
9397
9397
|
<div class="stx-error-boundary-content" data-boundary-content="${$}">
|
|
9398
9398
|
${Z}
|
|
@@ -9621,7 +9621,7 @@ else {
|
|
|
9621
9621
|
|
|
9622
9622
|
console.log('[stx] Error boundary runtime initialized');
|
|
9623
9623
|
})();
|
|
9624
|
-
`}var DD=0;var uj={}
|
|
9624
|
+
`}var DD=0;var uj={};$0(uj,{renderSSRSuspense:()=>gj,processSuspenseDirectives:()=>vj,generateSuspenseRuntime:()=>dj,generateSuspenseCSS:()=>hj,createSSRSuspense:()=>fj});function fD(){return`suspense-${++vD}-${Date.now().toString(36)}`}function vj($,Z={},Y){let X=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(X,(J,Q,G,K)=>{let W=fD(),U=gD(Q||"");return hD(W,G.trim(),K.trim(),U)})}function gD($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let J=X[1],Q=X[2]||X[3],G=X[4];switch(J){case"id":Z.id=Q;break;case"timeout":Z.timeout=G?parseInt(G,10):void 0;break}}return Z}function hD($,Z,Y,X){let J=X.timeout||30000,Q=X.id||$;return`
|
|
9625
9625
|
<div class="stx-suspense" data-suspense-id="${$}" data-custom-id="${Q}" data-status="pending">
|
|
9626
9626
|
<div class="stx-suspense-fallback" data-suspense-fallback="${$}">
|
|
9627
9627
|
${Y}
|
|
@@ -9959,7 +9959,7 @@ else {
|
|
|
9959
9959
|
|
|
9960
9960
|
console.log('[stx] Suspense runtime initialized');
|
|
9961
9961
|
})();
|
|
9962
|
-
`}var vD=0;var sj={}
|
|
9962
|
+
`}var vD=0;var sj={};$0(sj,{processAsyncDirectives:()=>pj,isAsyncComponent:()=>nj,generateAsyncComponentRuntime:()=>aj,generateAsyncComponentCSS:()=>rj,defineAsyncComponent:()=>ij});function mj(){return`async-${++dD}-${Date.now().toString(36)}`}function pj($,Z={},Y){let X=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,J=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,Q=$;return Q=Q.replace(X,(G,K,W,U)=>{let z=mj(),_=lj(K);return cj(z,_,W.trim(),U.trim())}),Q=Q.replace(J,(G,K,W)=>{let U=mj(),z=lj(K);return cj(U,z,W.trim(),'<div class="stx-async-error">Failed to load component</div>')}),Q}function lj($){let Z={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let J=X[1],Q=X[2]||X[3],G=X[4],K=X[5];switch(J){case"component":Z.component=Q||K||"";break;case"timeout":Z.timeout=G?parseInt(G,10):30000;break;case"delay":Z.delay=G?parseInt(G,10):200;break;case"suspensible":Z.suspensible=K==="true";break;case"retries":Z.retries=G?parseInt(G,10):0;break;case"loadingComponent":Z.loadingComponent=Q||K;break;case"errorComponent":Z.errorComponent=Q||K;break}}return Z}function cj($,Z,Y,X){let{component:J,timeout:Q,delay:G,suspensible:K,retries:W}=Z;return`
|
|
9963
9963
|
<div class="stx-async-component" data-async-id="${$}" data-component="${J}" data-status="pending">
|
|
9964
9964
|
<div class="stx-async-loading" data-async-loading="${$}">
|
|
9965
9965
|
${Y}
|
|
@@ -10314,7 +10314,7 @@ catch (error) {
|
|
|
10314
10314
|
|
|
10315
10315
|
console.log('[stx] Async component runtime initialized');
|
|
10316
10316
|
})();
|
|
10317
|
-
`}var dD=0;var QH={}
|
|
10317
|
+
`}var dD=0;var QH={};$0(QH,{shouldCacheComponent:()=>$H,processKeepAliveDirectives:()=>tj,onDeactivated:()=>JH,onActivated:()=>XH,generateKeepAliveRuntime:()=>YH,generateKeepAliveCSS:()=>ZH,createKeepAliveCache:()=>ej});function oj(){return`keep-alive-${++uD}-${Date.now().toString(36)}`}function tj($,Z={},Y){let X=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(X,(J,Q,G)=>{let K=oj(),W=mD(Q||"");return lD(K,G.trim(),W)})}function mD($){let Z={max:10},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let J=X[1],Q=X[2]||X[3],G=X[4];switch(J){case"max":Z.max=G?parseInt(G,10):10;break;case"include":Z.include=Q;break;case"exclude":Z.exclude=Q;break;case"id":Z.id=Q;break}}return Z}function lD($,Z,Y){let{max:X,include:J,exclude:Q}=Y,G=Y.id||$;return`
|
|
10318
10318
|
<div class="stx-keep-alive" data-keep-alive-id="${$}" data-custom-id="${G}">
|
|
10319
10319
|
<div class="stx-keep-alive-content" data-keep-alive-content="${$}">
|
|
10320
10320
|
${Z}
|
|
@@ -10662,7 +10662,7 @@ else {
|
|
|
10662
10662
|
|
|
10663
10663
|
console.log('[stx] Keep-alive runtime initialized');
|
|
10664
10664
|
})();
|
|
10665
|
-
`}function XH($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function JH($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var uD=0;var GH={}
|
|
10665
|
+
`}function XH($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function JH($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var uD=0;var GH={};$0(GH,{useVirtualList:()=>p2,processVirtualListDirectives:()=>wY,processVirtualGridDirectives:()=>n2,processInfiniteListDirectives:()=>i2,generateVirtualListCSS:()=>c2,default:()=>cD,createVirtualList:()=>AY});function AY($,Z){let{itemHeight:Y,containerHeight:X,overscan:J=3,keyProperty:Q="id",dynamicHeight:G=!1,estimatedItemHeight:K=Y,direction:W="vertical"}=Z,U=[...$],z=0,_=new Map;function B(){if(G)return q();let N=Math.max(0,Math.floor(z/Y)-J),R=Math.ceil(X/Y),E=Math.min(U.length-1,N+R+J*2);return{startIndex:N,endIndex:E}}function q(){let N=0,R=0,E=U.length-1;for(let M=0;M<U.length;M++){let I=_.get(M)||K;if(N+I>z){R=Math.max(0,M-J);break}N+=I}N=0;for(let M=0;M<U.length;M++){let I=_.get(M)||K;if(N+=I,N>z+X){E=Math.min(U.length-1,M+J);break}}return{startIndex:R,endIndex:E}}function j(){if(G){let N=0;for(let R=0;R<U.length;R++)N+=_.get(R)||K;return N}return U.length*Y}function H(N){if(G){let R=0;for(let E=0;E<N;E++)R+=_.get(E)||K;return R}return N*Y}function O(){let{startIndex:N,endIndex:R}=B();return{startIndex:N,endIndex:R,scrollTop:z,totalHeight:j(),visibleItems:U.slice(N,R+1),itemHeights:new Map(_)}}function V(N,R="auto"){let E=H(N);L(E,R)}function L(N,R="auto"){z=Math.max(0,Math.min(N,j()-X))}function F(){B()}function A(N){U=[...N],_.clear(),F()}function w(){U=[],_.clear()}return{scrollToIndex:V,scrollToOffset:L,getState:O,refresh:F,setItems:A,destroy:w}}function wY($,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(),U=Z[W];if(!U||!Array.isArray(U))return`<!-- virtualList: items "${W}" not found or not an array -->`;let z={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let L=G.trim(),F=Function(`return ${L}`)();z={...z,...F}}catch{}let _=`vlist-${Math.random().toString(36).substring(2,9)}`,B=Math.ceil(z.containerHeight/z.itemHeight),q=z.overscan||3,j=0,H=Math.min(U.length-1,B+q),O="";for(let L=j;L<=H&&L<U.length;L++){let F=U[L],A=K.replace(/\{\{\s*item\s*\}\}/g,typeof F==="object"?JSON.stringify(F):String(F)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(w,N)=>{if(typeof F==="object"&&F!==null)return String(F[N]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(L));O+=`
|
|
10666
10666
|
<div class="virtual-item ${z.itemClass||""}"
|
|
10667
10667
|
style="position: absolute; top: ${L*z.itemHeight}px; height: ${z.itemHeight}px; width: 100%;"
|
|
10668
10668
|
data-index="${L}">
|
|
@@ -11041,7 +11041,7 @@ else {
|
|
|
11041
11041
|
${Array.from($.entries()).map(([Y,X])=>` window.__stxIslands.register('${Y}', function() { return import('${X}'); });`).join(`
|
|
11042
11042
|
`)}
|
|
11043
11043
|
})();
|
|
11044
|
-
</script>`}function s2($){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 o2($,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 KH={}
|
|
11044
|
+
</script>`}function s2($){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 o2($,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 KH={};$0(KH,{processStaticDirectives:()=>GQ,processPartialHydrationDirectives:()=>e2,onHydrated:()=>QQ,isHydrated:()=>JQ,hydrateIsland:()=>ZQ,hydrateByStrategy:()=>YQ,hydrateAll:()=>XQ,generatePartialHydrationCSS:()=>$Q,generateIslandManifest:()=>KQ,default:()=>eD,createIslandRegistry:()=>t2});function t2(){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 iD($){return`
|
|
11045
11045
|
<script data-hydrate="${$}">
|
|
11046
11046
|
(function() {
|
|
11047
11047
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -11269,7 +11269,7 @@ else {
|
|
|
11269
11269
|
<script type="application/json" id="stx-island-manifest">
|
|
11270
11270
|
${JSON.stringify(Z)}
|
|
11271
11271
|
</script>
|
|
11272
|
-
`}var eD;var WQ=D(()=>{eD={processPartialHydrationDirectives:e2,processStaticDirectives:GQ,generatePartialHydrationCSS:$Q,generateIslandManifest:KQ,createIslandRegistry:t2,hydrateIsland:ZQ,hydrateByStrategy:YQ,hydrateAll:XQ,isHydrated:JQ,onHydrated:QQ}});var VH={}
|
|
11272
|
+
`}var eD;var WQ=D(()=>{eD={processPartialHydrationDirectives:e2,processStaticDirectives:GQ,generatePartialHydrationCSS:$Q,generateIslandManifest:KQ,createIslandRegistry:t2,hydrateIsland:ZQ,hydrateByStrategy:YQ,hydrateAll:XQ,isHydrated:JQ,onHydrated:QQ}});var VH={};$0(VH,{watchMultiple:()=>BH,watchEffect:()=>qH,watch:()=>_H,unref:()=>WH,toRefs:()=>UH,throttledComputed:()=>LH,stxWatchMultiple:()=>BH,stxWatchEffect:()=>qH,stxWatch:()=>_H,stxUnref:()=>WH,stxToRefs:()=>UH,stxThrottledComputed:()=>LH,stxShallowRef:()=>zH,stxRef:()=>r$,stxIsRef:()=>W6,stxDebouncedComputed:()=>OH,stxComputed:()=>X8,shallowRef:()=>zH,ref:()=>r$,processWatchDirectives:()=>HH,processComputedDirectives:()=>jH,isRef:()=>W6,default:()=>$k,debouncedComputed:()=>OH,computed:()=>X8});function r$($){let Z=$,Y=new Set,X={get value(){if(q4){let J=Y8.get(X);if(!J)J=new Set,Y8.set(X,J);J.add(q4)}return Z},set value(J){if(!Object.is(Z,J)){Z=J,Y.forEach((G)=>G(J));let Q=Y8.get(X);if(Q)Q.forEach((G)=>G())}},subscribe(J){return Y.add(J),()=>Y.delete(J)},peek(){return Z}};return X}function W6($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function WH($){return W6($)?$.value:$}function UH($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=r$($[Y]);return Z}function zH($){return r$($)}function X8($){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,U=()=>{if(G=!0,W.size>0){let B=_.value;W.forEach((q)=>q(B))}};function z(){K.clear();let B=q4;q4=U,NY.push(U);try{return Y()}finally{NY.pop(),q4=B}}let _={get value(){if(q4){let B=Y8.get(_);if(!B)B=new Set,Y8.set(_,B);B.add(q4)}if(G){let B=z();if(!J(Q,B))Q=B;G=!1}return Q},set value(B){if(X)X(B);else console.warn("Computed property is readonly")},subscribe(B){return W.add(B),()=>W.delete(B)},peek(){if(G)Q=Y(),G=!1;return Q},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return _}function _H($,Z,Y={}){let{immediate:X=!1,deep:J=!1,flush:Q="pre",once:G=!1}=Y,K,W=!0,U=!1,z=()=>{if(W6($))return J?n6($.value):$.value;return $()},_=()=>{if(!W||U)return;let j=z();if(K!==void 0&&Object.is(K,j)&&!J)return;let H=()=>{if(Z(j,K),K=J?n6(j):j,G)q()};if(Q==="sync")H();else if(Q==="post")queueMicrotask(H);else Promise.resolve().then(H)},B=null;if(W6($))B=$.subscribe(()=>_());else B=X8($).subscribe(()=>_());if(X)K=void 0,_();else K=z();let q=()=>{if(W=!1,B)B(),B=null};return q.pause=()=>{U=!0},q.resume=()=>{U=!1},q}function BH($,Z,Y={}){let{immediate:X=!1,once:J=!1}=Y,Q=$.map((_)=>W6(_)?_.value:void 0),G=!0,K=!1,W=()=>{if(!G||K)return;let _=$.map((B)=>W6(B)?B.value:void 0);if(Z(_,Q),Q=[..._],J)z()},U=$.map((_)=>{if(W6(_))return _.subscribe(()=>W());return()=>{}});if(X)W();let z=()=>{G=!1,U.forEach((_)=>_())};return z.pause=()=>{K=!0},z.resume=()=>{K=!1},z}function qH($,Z={}){let{flush:Y="pre"}=Z,X,J=!0,Q=!1,G=()=>{if(!J||Q)return;if(X)X();let W=q4;q4=G,NY.push(G);try{X=$()}finally{NY.pop(),q4=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 jH($,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 HH($,Z={},Y){let X=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(X,(J,Q,G)=>{return`
|
|
11273
11273
|
<script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
|
|
11274
11274
|
(function() {
|
|
11275
11275
|
// Watch implementation for ${Q}
|
|
@@ -11281,9 +11281,9 @@ else {
|
|
|
11281
11281
|
}
|
|
11282
11282
|
})();
|
|
11283
11283
|
</script>
|
|
11284
|
-
`})}function
|
|
11284
|
+
`})}function n6($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>n6(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((X,J)=>Y.set(n6(J),n6(X))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((X)=>Y.add(n6(X))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=n6($[Y]);return Z}function OH($,Z=100){let Y=r$($()),X=null,J=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{Y.value=$()},Z)};return X8($).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 LH($,Z=100){let Y=r$($()),X=0,J=()=>{let G=Date.now();if(G-X>=Z)X=G,Y.value=$()};return X8($).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 q4=null,NY,Y8,$k;var FH=D(()=>{NY=[],Y8=new WeakMap;$k={ref:r$,computed:X8,watch:_H,watchMultiple:BH,watchEffect:qH,isRef:W6,unref:WH,toRefs:UH,shallowRef:zH,debouncedComputed:OH,throttledComputed:LH,processComputedDirectives:jH,processWatchDirectives:HH}});var RH={};$0(RH,{v:()=>Zk,processHasErrorsDirective:()=>NH,processFormValidationDirectives:()=>Xk,processErrorsDirective:()=>wH,processErrorDirective:()=>AH,defineForm:()=>Yk,Validator:()=>a$});class a${rules=[];defaultValue="";addRule($){let Z=new a$;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 a$;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 a$;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 Yk($,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 U(L){K[L]=!0;let F=await $[L].validate(X[L],X);return J[L]=F,K[L]=!1,F.length===0}async function z(){W=!0;let L=await Promise.all(Y.map(U));return W=!1,L.every(Boolean)}function _(){for(let L of Y)X[L]=Z?.[L]??$[L].getDefaultValue(),J[L]=[],Q[L]=!1,G[L]=!1}function B(L){for(let F of Y)if(F in L)X[F]=L[F],G[F]=!0}function q(L,F){X[L]=F,G[L]=!0}function j(L,F=!0){if(Q[L]=F,F)U(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(F)=>{F?.preventDefault?.();for(let w of Y)Q[w]=!0;if(await z())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:z,validateField:U,reset:_,setValues:B,setFieldValue:q,setFieldTouched:j,getFieldState:H,handleSubmit:O}}function AH($,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 z of K)if(W&&typeof W==="object"&&z in W)W=W[z];else return"";let U=W;if(!U||!Array.isArray(U)||U.length===0)return"";return U.map((z)=>{return G.replace(/\{\{\s*message\s*\}\}/g,z)}).join(`
|
|
11285
11285
|
`)}catch{return""}})}function wH($,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 z of K)if(W&&typeof W==="object"&&z in W)W=W[z];else return"";let U=W;if(!U||!Array.isArray(U)||U.length===0)return"";return U.map((z)=>G.replace(/\{\{\s*message\s*\}\}/g,z)).join(`
|
|
11286
|
-
`)}catch{return""}})}function NH($,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 z of K)if(W&&typeof W==="object"&&z in W)W=W[z];else return"";let U=W;if(!U||!Array.isArray(U)||U.length===0)return"";return G}catch{return""}})}function Xk($,Z,Y){let X=$;return X=AH(X,Z,Y),X=wH(X,Z,Y),X=NH(X,Z,Y),X}var Zk;var MH=D(()=>{Zk=new a$});var IH={}
|
|
11286
|
+
`)}catch{return""}})}function NH($,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 z of K)if(W&&typeof W==="object"&&z in W)W=W[z];else return"";let U=W;if(!U||!Array.isArray(U)||U.length===0)return"";return G}catch{return""}})}function Xk($,Z,Y){let X=$;return X=AH(X,Z,Y),X=wH(X,Z,Y),X=NH(X,Z,Y),X}var Zk;var MH=D(()=>{Zk=new a$});var IH={};$0(IH,{processXElementDirectives:()=>Jk,hasXElementDirectives:()=>EH,generateXElementRuntime:()=>TH});function TH(){return`<script data-stx-scoped data-stx-x-element-runtime>
|
|
11287
11287
|
(function() {
|
|
11288
11288
|
'use strict';
|
|
11289
11289
|
|
|
@@ -11569,7 +11569,7 @@ else {
|
|
|
11569
11569
|
})();
|
|
11570
11570
|
</script>`}function EH($){return/\bx-data(?:\s|=)/.test($)}function Jk($){let Z=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,Y=$.match(Z)||[],X=Y.length>0?$.replace(Z,""):$;if(!EH(X))return X;let J=Y[0]?.trim()||TH(),Q=X.lastIndexOf("</body>");if(Q!==-1)return X.slice(0,Q)+J+`
|
|
11571
11571
|
`+X.slice(Q);return X+`
|
|
11572
|
-
`+J}var DH={}
|
|
11572
|
+
`+J}var DH={};$0(DH,{rewriteImagesWithSiblings:()=>RY});import T4 from"path";async function RY($,Z){let Y=Z.formats??Gk;if(!Z.publicDir)return $;let X=Uk($),J=[],Q=/<img\b[^>]*?>/gi,G=[],K;while((K=Q.exec($))!==null){let _=K[0],B=_.match(/\bsrc=["']([^"']+)["']/i);if(!B)continue;if(zk(K.index,X))continue;G.push({idx:K.index,length:_.length,src:B[1],raw:_})}if(G.length===0)return $;let W=await Promise.all(G.map(async(_)=>{let B=await Kk(_.src,Z.publicDir,Y);return{match:_,sources:B}}));for(let{match:_,sources:B}of W){if(B.length===0)continue;let j=`<picture>${B.map((H)=>`<source type="${H.mime}" srcset="${_k(H.url)}">`).join("")}${_.raw}</picture>`;J.push({start:_.idx,end:_.idx+_.length,replacement:j})}if(J.length===0)return $;let U="",z=0;for(let _ of J)U+=$.slice(z,_.start),U+=_.replacement,z=_.end;return U+=$.slice(z),U}async function Kk($,Z,Y){if(!Wk($))return[];let X=T4.extname($).toLowerCase();if(!Qk.has(X))return[];if(!$.startsWith("/"))return[];let J=T4.join(Z,$.slice(1)),Q=T4.dirname(J),G=T4.basename(J,X),K=T4.resolve(Q),W=T4.resolve(Z);if(!K.startsWith(W))return[];let U=T4.posix.dirname($),z=Y.map(async(B)=>{let q=T4.join(Q,`${G}${B.ext}`);if(!await Bun.file(q).exists())return null;return{url:T4.posix.join(U,`${G}${B.ext}`),mime:B.mime}});return(await Promise.all(z)).filter((B)=>B!==null)}function Wk($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function Uk($){let Z=[],Y=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,X;while((X=Y.exec($))!==null)Z.push([X.index,X.index+X[0].length]);return Z}function zk($,Z){for(let[Y,X]of Z)if($>=Y&&$<X)return!0;return!1}function _k($){return $.replace(/&/g,"&").replace(/"/g,""")}var Qk,Gk;var UQ=D(()=>{Qk=new Set([".jpg",".jpeg",".png",".gif"]),Gk=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var kH=()=>{};function zQ($){return $.pwa?.serviceWorker?.fileName||"sw.js"}var SH=D(()=>{kH()});var CH={};$0(CH,{injectPwaTags:()=>Bk,generateThemeColorMeta:()=>Hk,generateSwRegistrationScript:()=>qk,generatePwaTags:()=>MY,generateManifestLink:()=>jk});function MY($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,X=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",J=zQ($),Q=`
|
|
11573
11573
|
<!-- stx PWA Meta Tags -->
|
|
11574
11574
|
<link rel="manifest" href="/manifest.json">
|
|
11575
11575
|
<meta name="theme-color" content="${_Q(Y?.themeColor||"#000000")}">
|
|
@@ -11627,7 +11627,7 @@ if ('serviceWorker' in navigator) {
|
|
|
11627
11627
|
});
|
|
11628
11628
|
});
|
|
11629
11629
|
}
|
|
11630
|
-
</script>`}function jk(){return'<link rel="manifest" href="/manifest.json">'}function Hk($){return`<meta name="theme-color" content="${_Q($)}">`}function _Q($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var bH=D(()=>{SH()});var EY={}
|
|
11630
|
+
</script>`}function jk(){return'<link rel="manifest" href="/manifest.json">'}function Hk($){return`<meta name="theme-color" content="${_Q($)}">`}function _Q($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var bH=D(()=>{SH()});var EY={};$0(EY,{validateClientScript:()=>$8,processOnceDirective:()=>e7,processJsonDirective:()=>t7,processDirectives:()=>_0,injectRouterScript:()=>M4});import M1 from"path";import{deriveLayoutGroup as Ok}from"stx-router/layout-metadata";function PH($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Lk($,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(`
|
|
11631
11631
|
`,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,U=!1;while(W<Y){let z=$[W];if(z==="\\"){W+=2;continue}if(z==="[")U=!0;else if(z==="]")U=!1;else if(z==="/"&&!U){W++;break}else if(z===`
|
|
11632
11632
|
`){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]===`
|
|
11633
11633
|
`)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}function TY($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`<script\\b(?=[^>]*\\b${Y}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!X)return null;let J=X.index+X[0].length,Q=$.indexOf("</script>",J);if(Q===-1)return null;let G=$.indexOf(">",Q);if(G===-1)return null;return{start:X.index,end:G+1}}function yH($){let Z=0;while(Z<$.length){let Y=$.indexOf("<",Z);if(Y===-1)return-1;if($.startsWith("<!--",Y)){let Q=$.indexOf("-->",Y+4);Z=Q===-1?$.length:Q+3;continue}let X=$.slice(Y),J=/^<style\b[^>]*>/i.exec(X);if(J){let Q=$.toLowerCase().indexOf("</style>",Y+J[0].length);Z=Q===-1?$.length:Q+8;continue}if(/^<script\b[^>]*>/i.test(X))return Y;Z=Y+1}return-1}function Vk($){let Z=TY($,"data-stx-runtime");if(!Z)return $;let Y=yH($);if(Y===-1||Y===Z.start)return $;let X=$.slice(Z.start,Z.end),J=$.slice(0,Z.start)+$.slice(Z.end),Q=yH(J);if(Q===-1)return X+`
|
|
@@ -11639,30 +11639,30 @@ if ('serviceWorker' in navigator) {
|
|
|
11639
11639
|
`+z+G.slice(_.end)}}catch{}if(Q)try{let{getComposableScript:K}=await Promise.resolve().then(() => (Oj(),Hj)),W=X.composablesDir,U=await K(W);if(U){let z=`<script data-stx-composables>${U}</script>`,_=TY(G,"data-stx-stores")||TY(G,"data-stx-runtime");if(_)G=G.slice(0,_.end)+`
|
|
11640
11640
|
`+z+G.slice(_.end)}}catch{}if(Q&&Z.__stx_inject_css!==!1)G=await y0(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof R7)throw G;let K=G instanceof Error?G.message:String(G),W=new i1(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(K1.log(W,{filePath:Y,context:Z}),D$.logDetailedError(W,{filePath:Y,template:$.substring(0,500)}),X.debug)throw W;return jZ.createFallbackContent("Template Processing",W)}}async function Fk($,Z,Y,X,J){let Q=process.cwd(),G={...X,partialsDir:X.partialsDir&&!M1.isAbsolute(X.partialsDir)?M1.resolve(Q,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!M1.isAbsolute(X.componentsDir)?M1.resolve(Q,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!M1.isAbsolute(X.layoutsDir)?M1.resolve(Q,X.layoutsDir):X.layoutsDir},K=G,W=$;await Nk(Y,Z),wk(Z,K),W=await W4(()=>L2(W,Z,Y,K),W,(L)=>{K1.log(L,{filePath:Y,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Y}: ${L.message}`)}),W=W.replace(/\{\{--[\s\S]*?--\}\}/g,"");let U=Q4(W,z7,(L,F)=>`\x00STX_HTML_COMMENT_${F}\x00`);W=U.output;let z=U.tokens,_=(L)=>z.length===0?L:L.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(F,A)=>z[Number(A)]??""),B="\x00STX_ESCAPED_AT\x00";W=W.replace(/@@/g,B),W=W.replace(/@\{\{([\s\S]*?)\}\}/g,(L,F)=>{return`{{ ${F} }}`}),W=T2(W),W=await Kj(W,Y,J);let q={};W=aZ(W,q);let j={...Z.__sections||{}},H="",O=/@nolayout\b/.test(W);if(O)W=W.replace(/@nolayout\b\s*/g,"");let V=W.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(V)H=V[1],W=W.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!H&&!O&&K.defaultLayout){let L=/<!DOCTYPE\s/i.test(W),F=/@section\s*\(/.test(W);if(!L||F){let A="",w=M1.dirname(Y),N=K.layoutsDir?M1.dirname(K.layoutsDir):process.cwd();for(let R=0;R<20;R++){let E=M1.join(w,"_layout.stx");if(await J0(E)){A=E;break}let M=M1.dirname(w);if(M===w||M.length<N.length)break;w=M}if(A)H=A;else if(K.layoutsDir){let R=M1.isAbsolute(K.layoutsDir)?K.layoutsDir:M1.resolve(process.cwd(),K.layoutsDir),E=M1.join(R,`${K.defaultLayout}.stx`);if(await J0(E))H=E}if(H&&!F)W=`@section('content')
|
|
11641
11641
|
${W.trim()}
|
|
11642
|
-
@endsection`}}if(W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(L,F,A)=>{return j[F]=A,""}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(L,F,A)=>{if(/^(['"]).*\1$/.test(A.trim()))return L;try{let w=L0(A.trim(),Z);if(w===void 0)return L;return j[F]=String(w??""),""}catch{return L}}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(L,F,A)=>{if(A.includes("@parent"))j[F]=A.replace("@parent",
|
|
11642
|
+
@endsection`}}if(W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(L,F,A)=>{return j[F]=A,""}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(L,F,A)=>{if(/^(['"]).*\1$/.test(A.trim()))return L;try{let w=L0(A.trim(),Z);if(w===void 0)return L;return j[F]=String(w??""),""}catch{return L}}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(L,F,A)=>{if(A.includes("@parent"))j[F]=A.replace("@parent",r6);else j[F]=A.trim();return""}),Z.__sections=j,W=W.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(L,F,A)=>{return j[F]||A||""}),!("slot"in Z)||Z.slot===void 0)W=W.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""});if(W=sZ(W,q),H){let L=[],F=n4(W),A=Q4(F.output,V$,(w,N)=>`\x00STX_ORPHAN_STYLE_${N}\x00`);if(W=A.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(w,N,R)=>{let E=N==="SCRIPT"?F.scripts[Number(R)]:A.tokens[Number(R)];if(E)L.push(E);return""}),L.length>0){let w=L.join(`
|
|
11643
11643
|
`);j.content=j.content?`${j.content}
|
|
11644
|
-
${w}`:w,Z.__sections=j}}if(H)try{let L;if(M1.isAbsolute(H))L=H,J.add(H);else L=await W4(()=>J8(H,Y,G,J),null,()=>{throw new i1(`Failed to resolve layout path: ${H}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!L){let E=`Layout not found: ${H} (referenced from ${Y})`;if(K1.log(Error(E),{layoutPath:H,filePath:Y},"warning"),G.debug)throw new i1(E,Y);return W}let F=await W4(()=>Bun.file(L).text(),"",()=>{throw new i1(`Failed to read layout file: ${L}`,Y,void 0,void 0,"Layout content could not be loaded")}),A=F.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(A){if(G.debug)console.log(`Found nested layout: ${A[1]} in ${L}`);let E={},M=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(k,x,y)=>{return E[x]=y.trim(),""});for(let[k,x]of Object.entries(E))if(j[k]&&j[k].includes(
|
|
11645
|
-
${W}`,_(W)}catch(L){return K1.log(L instanceof Error?L:Error(String(L)),{layoutPath:H,filePath:Y},"error"),`[Error processing layout: ${L instanceof Error?L.message:String(L)}]`}return _(await xH(W,Z,Y,G,J))}function Ak($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Y,X,J)=>{let Q=Z[X];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return J||""})}function wk($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let Y=Z.envPrefix||"STX_PUBLIC_",X={};for(let[J,Q]of Object.entries(process.env))if(J.startsWith(Y)&&Q!==void 0)X[J]=Q;$.$env=X}async function Nk($,Z){await W4(()=>Tq($,Z),void 0,(Y)=>{K1.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function Rk($,Z,Y){let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,J;while((J=X.exec($))!==null){let Q=J[1],G=J[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:W}=await Promise.resolve().then(() => (X6(),mZ));await W(G,Z,Y,{preserveExisting:!0})}catch(W){let U=W instanceof Error?W:Error(String(W));K1.log(U,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${U.message}`)}}}async function Mk($,Z,Y){try{let{interpolateScriptsInTemplate:X}=await Promise.resolve().then(() => ($1(),j7));return X($,Z,{skipServer:!0})}catch(X){let J=X instanceof Error?X:Error(String(X));return K1.log(J,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${J.message}`),$}}async function xH($,Z,Y,X,J){let Q=$,G=X;if(await Rk(Q,Z,Y),Q=await Mk(Q,Z,Y),Q=await Lq(Q,Z,Y),Q=await Vq(Q,Z,Y),Q=await q9(Q,Z,Y,G),
|
|
11646
|
-
`;if(Q=M(Q,Z),Q=I(Q,Z),Q=Nq(Q),Q=Y9(Q,Z),Q=g_(Q),Q=wq(Q),Q=await rZ(Q,Z,Y,G,J),Q=await dZ(Q,Z,Y,G,J),Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=d2(Q),Q=
|
|
11644
|
+
${w}`:w,Z.__sections=j}}if(H)try{let L;if(M1.isAbsolute(H))L=H,J.add(H);else L=await W4(()=>J8(H,Y,G,J),null,()=>{throw new i1(`Failed to resolve layout path: ${H}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!L){let E=`Layout not found: ${H} (referenced from ${Y})`;if(K1.log(Error(E),{layoutPath:H,filePath:Y},"warning"),G.debug)throw new i1(E,Y);return W}let F=await W4(()=>Bun.file(L).text(),"",()=>{throw new i1(`Failed to read layout file: ${L}`,Y,void 0,void 0,"Layout content could not be loaded")}),A=F.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(A){if(G.debug)console.log(`Found nested layout: ${A[1]} in ${L}`);let E={},M=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(k,x,y)=>{return E[x]=y.trim(),""});for(let[k,x]of Object.entries(E))if(j[k]&&j[k].includes(r6)){let y=j[k].indexOf(r6);j[k]=j[k].slice(0,y)+x+j[k].slice(y+r6.length)}else if(!j[k])j[k]=x;let I={...Z,__sections:j},S=`@layout('${A[1]}')${M}`;return await _0(S,I,L,G,J)}let w=F.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=aZ(w,q),R={};return N=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(E,M,I)=>{return R[M]=I.trim(),`@slot('${M}')`}),N=N.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(E,M,I)=>{if(j[M]){let S=j[M];if(S.includes(r6)){let k=R[M]||"",x=S.indexOf(r6);S=S.slice(0,x)+k+S.slice(x+r6.length)}return S}return I||""}),N=Ak(N,j),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),N=sZ(N,q),Z.__originalFilePath=Y,W=await xH(N,Z,L,G,J),W=`<!-- stx-layout: ${H} -->
|
|
11645
|
+
${W}`,_(W)}catch(L){return K1.log(L instanceof Error?L:Error(String(L)),{layoutPath:H,filePath:Y},"error"),`[Error processing layout: ${L instanceof Error?L.message:String(L)}]`}return _(await xH(W,Z,Y,G,J))}function Ak($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Y,X,J)=>{let Q=Z[X];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return J||""})}function wk($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let Y=Z.envPrefix||"STX_PUBLIC_",X={};for(let[J,Q]of Object.entries(process.env))if(J.startsWith(Y)&&Q!==void 0)X[J]=Q;$.$env=X}async function Nk($,Z){await W4(()=>Tq($,Z),void 0,(Y)=>{K1.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function Rk($,Z,Y){let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,J;while((J=X.exec($))!==null){let Q=J[1],G=J[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:W}=await Promise.resolve().then(() => (X6(),mZ));await W(G,Z,Y,{preserveExisting:!0})}catch(W){let U=W instanceof Error?W:Error(String(W));K1.log(U,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${U.message}`)}}}async function Mk($,Z,Y){try{let{interpolateScriptsInTemplate:X}=await Promise.resolve().then(() => ($1(),j7));return X($,Z,{skipServer:!0})}catch(X){let J=X instanceof Error?X:Error(String(X));return K1.log(J,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${J.message}`),$}}async function xH($,Z,Y,X,J){let Q=$,G=X;if(await Rk(Q,Z,Y),Q=await Mk(Q,Z,Y),Q=await Lq(Q,Z,Y),Q=await Vq(Q,Z,Y),Q=await q9(Q,Z,Y,G),y6(Q))Q=v2(Q,Z),Q=g2(Q,Z);Q=f2(Q);let{processStreamDirectives:K}=await Promise.resolve().then(() => (Y6(),u6));Q=K(Q,Z),Q=iZ(Q,Z,Y,G),Q=await dZ(Q,Z,Y,G,J),Q=await I2(Q,Z,Y,G,J),Q=VJ(Q,Z,Y,G);let{processDeferDirectives:W}=await Promise.resolve().then(() => Fj);Q=W(Q,Z,Y);let{processTeleportDirectives:U}=await Promise.resolve().then(() => Rj);Q=U(Q,Z,Y);let{processTransitionDirectives:z,processTransitionAttributes:_}=await Promise.resolve().then(() => Pj);Q=z(Q,Z,Y),Q=_(Q);let{processErrorBoundaryDirectives:B}=await Promise.resolve().then(() => xj);Q=B(Q,Z,Y);let{processSuspenseDirectives:q}=await Promise.resolve().then(() => uj);Q=q(Q,Z,Y);let{processAsyncDirectives:j}=await Promise.resolve().then(() => sj);Q=j(Q,Z,Y);let{processKeepAliveDirectives:H}=await Promise.resolve().then(() => QH);Q=H(Q,Z,Y);let{processVirtualListDirectives:O,processVirtualGridDirectives:V,processInfiniteListDirectives:L}=await Promise.resolve().then(() => (r2(),GH));Q=O(Q,Z,Y),Q=V(Q,Z,Y),Q=L(Q,Z,Y);let{processPartialHydrationDirectives:F,processStaticDirectives:A}=await Promise.resolve().then(() => (WQ(),KH));Q=F(Q,Z,Y),Q=A(Q);let{processComputedDirectives:w,processWatchDirectives:N}=await Promise.resolve().then(() => (FH(),VH));Q=w(Q,Z,Y),Q=N(Q,Z,Y);let{processFormValidationDirectives:R}=await Promise.resolve().then(() => (MH(),RH));Q=R(Q,Z,Y);let{processHeadDirective:E,processTitleDirective:M,processMetaDirective:I,resetHead:S}=await Promise.resolve().then(() => (h6(),V9));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)S();let k=E(Q);if(Q=k.content,k.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${k.headContent}
|
|
11646
|
+
`;if(Q=M(Q,Z),Q=I(Q,Z),Q=Nq(Q),Q=Y9(Q,Z),Q=g_(Q),Q=wq(Q),Q=await rZ(Q,Z,Y,G,J),Q=await dZ(Q,Z,Y,G,J),Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=d2(Q),Q=x6(Q,Z,Y),Q=X9(Q,Z),Q=J9(Q,Z),Q=S$(Q,Z),Q=DZ(Q,Z),Q=kZ(Q,Z),Q=await qQ(Q,Z,Y,G),Q=await BQ(Q,Z,Y),Q=await E9(Q,Z,Y,G),Q=HJ(Q,Z,Y,G),Q=A2(Q,Z,Y,G),Q=w2(Q,Z,Y),Q=N2(Q,Z,Y,G),Q=z9(Q,Z,Y,G),Q=t7(Q,Z),Q=e7(Q),Q=Uj(Q),!G.skipEventDirectives)Q=pJ(Q,Z,Y);if(Q=ez(Q,Z,Y),G.debug){let X0=/\bx-data\s*=/.test(Q),l=LY($);if(X0&&l)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
11647
11647
|
Both work on the same page, but they manage separate scopes.
|
|
11648
11648
|
Prefer signals (state/derived/effect) for new components.`)}Q=$Y(Q,Z),Q=await d1(Q,Z,Y),Q=zj(Q),Q=_j(Q),Q=dJ(Q);let{processXElementDirectives:x}=await Promise.resolve().then(() => IH);Q=x(Q);let y=Z.__originalFilePath||Y,b=m4(Z);if(Q=await h2(Q,G,y,b),Q=H9(Q,Z),Q=await V2(Q,Z,Y,G),G.media?.image?.autoSiblings){let X0=G.publicDir||"public",{rewriteImagesWithSiblings:l}=await Promise.resolve().then(() => (UQ(),DH));Q=await l(Q,{publicDir:X0})}if(G.seo?.enabled)Q=R2(Q,Z,G);let g=(X0,l,u=!0)=>{if(!l)return X0;let n=l.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),C=X0.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(n&&C){if(u)X0=X0.replace(C[0],n[0]);if(l=l.replace(n[0],"").trim(),!l)return X0}if(/<\/head>/i.test(X0))return X0.replace(/<\/head>/i,`${l}
|
|
11649
11649
|
</head>`);if(/<head\b[^>]*>/i.test(X0))return X0.replace(/(<head\b[^>]*>)/i,`$1
|
|
11650
11650
|
${l}`);if(/<html\b[^>]*>/i.test(X0))return X0.replace(/(<html\b[^>]*>)/i,`$1
|
|
11651
11651
|
<head>
|
|
11652
11652
|
${l}
|
|
11653
|
-
</head>`);return X0},{renderHead:r,getHead:c}=await Promise.resolve().then(() => (
|
|
11653
|
+
</head>`);return X0},{renderHead:r,getHead:c}=await Promise.resolve().then(() => (h6(),V9)),h=Z.__stx_runtime_head??c();if(h.title||h.meta?.length||h.link?.length){let X0=r(h);if(X0)Q=g(Q,X0)}if(k.headContent)Q=g(Q,k.headContent,!h.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=W9(Q,G.csp,Z);if(G.analytics?.enabled)Q=lJ(Q,G);if(G.heatmap?.enabled)Q=wJ(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:X0}=await Promise.resolve().then(() => (bH(),CH));Q=X0(Q,G)}let m=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),i=/\bSTX\.\w+/.test(Q),s=/window\.STX\s*=/.test(Q);if(m&&i&&!s){let l=`<script data-stx-scoped>
|
|
11654
11654
|
${gz()}
|
|
11655
11655
|
</script>`;if(Q.includes("</head>")){let u=Q.indexOf("</head>"),C=Q.slice(0,u).indexOf("<script");if(C!==-1){let d=Q.slice(0,C),o=Q.slice(C);Q=d+l+`
|
|
11656
11656
|
`+o}else Q=Q.replace("</head>",`${l}
|
|
11657
11657
|
</head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
|
|
11658
11658
|
${l}`);else Q=l+`
|
|
11659
|
-
`+Q}{let{scanScriptTags:X0}=await Promise.resolve().then(() => (o7(),VY)),l=[];for(let u of X0(Q)){if(!/\bserver\b/i.test(u.attrs))continue;let n=u.start+u.fullMatch.indexOf(">")+1,C=Lk(Q,n);if(C===-1)continue;let d=C+9;while(d<Q.length&&/\s/.test(Q[d]))d++;l.push({start:u.start,end:d})}for(let u=l.length-1;u>=0;u--){let{start:n,end:C}=l[u];Q=Q.substring(0,n)+Q.substring(C)}}let q0=u7(Q,Y);if(q0.hasScoped)Q=q0.html;let K0=Z.__stx_event_bindings||[],S0=!1,z1=[],C0=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:h1}=await Promise.resolve().then(() => (o7(),VY));for(let X0 of h1(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))z1.push({match:X0.fullMatch,attrs:X0.attrs,content:X0.body});for(let{match:X0,attrs:l,content:u}of z1){S0=!0;let n=u;$8(u,Y,X.strict);let C=await l4(u,{eventBindings:K0,attrs:l,hasColonDirectives:C0,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:b});Q=Q.replace(X0,()=>C)}if(S0)Z.__stx_event_bindings=[];if(G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=U9(Q,Z.cspNonce);return Q}var
|
|
11660
|
-
`);return{line:Y.length,column:Y[Y.length-1].length+1}}function gH($,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 hH($){return/@[a-z]+/i.test($)||/\{\{/.test($)}function dH($){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 Tk,Ek,Ik;var uH=D(()=>{Tk=[{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"}],Ek=[{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')"}],Ik=[{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 LQ={}
|
|
11659
|
+
`+Q}{let{scanScriptTags:X0}=await Promise.resolve().then(() => (o7(),VY)),l=[];for(let u of X0(Q)){if(!/\bserver\b/i.test(u.attrs))continue;let n=u.start+u.fullMatch.indexOf(">")+1,C=Lk(Q,n);if(C===-1)continue;let d=C+9;while(d<Q.length&&/\s/.test(Q[d]))d++;l.push({start:u.start,end:d})}for(let u=l.length-1;u>=0;u--){let{start:n,end:C}=l[u];Q=Q.substring(0,n)+Q.substring(C)}}let q0=u7(Q,Y);if(q0.hasScoped)Q=q0.html;let K0=Z.__stx_event_bindings||[],S0=!1,z1=[],C0=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:h1}=await Promise.resolve().then(() => (o7(),VY));for(let X0 of h1(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))z1.push({match:X0.fullMatch,attrs:X0.attrs,content:X0.body});for(let{match:X0,attrs:l,content:u}of z1){S0=!0;let n=u;$8(u,Y,X.strict);let C=await l4(u,{eventBindings:K0,attrs:l,hasColonDirectives:C0,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:b});Q=Q.replace(X0,()=>C)}if(S0)Z.__stx_event_bindings=[];if(G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=U9(Q,Z.cspNonce);return Q}var r6="<!--PARENT_CONTENT_PLACEHOLDER-->";var q1=D(()=>{K4();P6();j$();hz();uJ();cJ();a3();r3();iJ();b6();$_();s$();FZ();_9();h_();j9();O9();S1();h6();$1();w9();I9();g$();Aq();nZ();IY();F2();r4();Rq();eZ();N0();Eq();M2();E2();D2();YY();o7();U2();Wj();u2();m2();i0();P9();u2();m2()});function vH($){let Z=[],Y=[];return Dk($,Z),kk($,Z,Y),Sk($,Y),Ck($,Z),{valid:Z.length===0,errors:Z,warnings:Y}}function Dk($,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 kk($,Z,Y){for(let X of Tk){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 Sk($,Z){for(let Y of Ek)if(Y.pattern.test($))Z.push({type:"syntax",message:Y.message,suggestion:Y.suggestion})}function Ck($,Z){for(let Y of Ik)if(Y.pattern.test($))Z.push({type:"expression",message:`Security warning: ${Y.message}`,suggestion:"Remove dangerous code from template expressions"})}function fH($,Z){let Y=$.slice(0,Z).split(`
|
|
11660
|
+
`);return{line:Y.length,column:Y[Y.length-1].length+1}}function gH($,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 hH($){return/@[a-z]+/i.test($)||/\{\{/.test($)}function dH($){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 Tk,Ek,Ik;var uH=D(()=>{Tk=[{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"}],Ek=[{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')"}],Ik=[{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 LQ={};$0(LQ,{renderSlot:()=>HQ,processSlots:()=>OQ,parseSlots:()=>jQ,parseSlotElement:()=>mH,extractSlotContent:()=>cH,applySlots:()=>pH});function bk($,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 yk($,Z){let Y=null;for(let X=Z;X<$.length;X++){let J=$[X];if(Y){if(J==="\\"){X++;continue}if(J===Y)Y=null;continue}if(J==='"'||J==="'"){Y=J;continue}if(J===">")return X+1}return-1}function xk($){let Z=[],Y=[],X=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,J=0;while(J<$.length){let Q=$.indexOf("<",J);if(Q===-1)break;if($.startsWith("<!--",Q)){let B=$.indexOf("-->",Q+4);J=B===-1?$.length:B+3;continue}let G=yk($,Q+1);if(G===-1)break;let K=$.slice(Q,G),W=K.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!W){J=G;continue}let U=W[1]==="/",z=W[2].toLowerCase();if(U){let B=Y.lastIndexOf(z);if(B!==-1)Y.splice(B);J=G;continue}if(z==="template"&&Y.length===0){let B=K.match(X);if(B){let q=bk($,G);if(q!==-1){let j=B[1]||B[2]||B[3];Z.push({start:Q,end:q,slotName:j,content:$.slice(G,q-11).trim(),propsBinding:B[4]||void 0}),J=q;continue}}}if(!/\/\s*>$/.test(K)&&!Pk.has(z)){if(Y.push(z),z==="script"||z==="style"){let B=$.toLowerCase().indexOf(`</${z}>`,G);if(B!==-1){J=B;continue}}}J=G}return Z}function jQ($){let Z={default:"",named:new Map},Y=$,X=xk($);for(let W of X)Z.named.set(W.slotName,{name:W.slotName,content:W.content,propsBinding:W.propsBinding});X.sort((W,U)=>U.start-W.start);for(let W of X)Y=Y.slice(0,W.start)+Y.slice(W.end);let J=[],Q=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,G;while((G=Q.exec(Y))!==null){let[W,U,z,_,B,q]=G,j=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),O=(j+H).trim(),V=`<${U}${O?" "+O:""}>${q}</${U}>`;J.push({start:G.index,end:G.index+W.length,slotName:_,element:V})}let K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((G=K.exec(Y))!==null){let[W,U,z,_,B]=G,q=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),j=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(q+j).trim(),O=`<${U}${H?" "+H:""} />`;J.push({start:G.index,end:G.index+W.length,slotName:_,element:O})}J.sort((W,U)=>U.start-W.start);for(let W of J){let U=Z.named.get(W.slotName);if(U)U.content+=W.element;else Z.named.set(W.slotName,{name:W.slotName,content:W.element});Y=Y.slice(0,W.start)+Y.slice(W.end)}return Z.default=Y.trim(),Z}function mH($){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 HQ($,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[U,z]=W.split(":").map((B)=>B.trim()),_=z||U;if(Z[U]!==void 0)G[_]=Z[U]}}else G[Q]=Z;J=vk(J,G)}return J}function vk($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,X)=>{try{let J=X.trim(),Q=lH(J,Z);return v0(String(Q??""))}catch{return`{{ ${X} }}`}})}function lH($,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(!R0($))return;return M0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function OQ($,Z,Y){let X=$;X=await fk(X,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,W,U)=>{let z=Z.named.get(K),_=U?.trim()||"",B=W||"",q={},j=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=j.exec(B))!==null){let O=H[1],V=H[2];q[O]=lH(V,Y)}return await HQ(z,q,_,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 fk($,Z,Y){let X=[],J=[];$.replace(Z,(K,...W)=>{let U=W[W.length-2];return J.push({match:K,index:U}),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:U}=J[K];G=G.slice(0,U)+Q[K]+G.slice(U+W.length)}return G}function cH($){let Z=jQ($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function pH($,Z,Y,X){return await OQ($,{default:Z,named:Y},X)}var Pk;var DY=D(()=>{$1();i0();Pk=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});import gk from"fs";import t from"path";function iH($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function nH($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function c4($){return!nH($)}function p4($){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:F1()}).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 dk($){let Z=[],Y=new Set,X=0,J=0,Q=$.length,G=(z)=>{J++;while(J<Q){if($[J]==="\\"){J+=2;continue}if($[J]===z){J++;return}J++}},K=()=>{J++;while(J<Q){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;return}if($[J]==="$"&&$[J+1]==="{"){J+=2;let z=1;while(J<Q&&z>0)if($[J]==="{")z++,J++;else if($[J]==="}")z--,J++;else if($[J]==="'"||$[J]==='"')G($[J]);else if($[J]==="`")K();else J++;continue}J++}},W=()=>{if($[J]==="/"&&$[J+1]==="/"){while(J<Q&&$[J]!==`
|
|
11661
11661
|
`)J++;return!0}if($[J]==="/"&&$[J+1]==="*"){J+=2;while(J<Q-1&&!($[J]==="*"&&$[J+1]==="/"))J++;return J+=2,!0}return!1},U=()=>{if(X!==0)return;let z=$.slice(J).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(z){let j=z[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 _=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(_){let j=_[2];if(!Y.has(j))Z.push(j),Y.add(j);return}let B=$.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[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])))U();J++}return Z}function uk($){let Z=[],Y=0,X=0,J=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(J){if(G==="\\"){Q++;continue}if(G===J)J=null;continue}if(G==='"'||G==="'"||G==="`"){J=G;continue}if(G==="("||G==="["||G==="{")Y++;else if(G===")"||G==="]"||G==="}")Y--;else if(G===","&&Y===0)Z.push($.slice(X,Q)),X=Q+1}if(X<$.length)Z.push($.slice(X));return Z}function mk($){let Z=0,Y=null;for(let X=0;X<$.length;X++){let J=$[X];if(Y){if(J==="\\"){X++;continue}if(J===Y)Y=null;continue}if(J==='"'||J==="'"||J==="`"){Y=J;continue}if(J==="("||J==="["||J==="{")Z++;else if(J===")"||J==="]"||J==="}")Z--;else if(J==="="&&Z===0){let Q=$[X-1],G=$[X+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return X}}return-1}function lk($,Z){try{let Y=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!Y)return;let X=Y.index-1;while(X>=0&&/\s/.test($[X]))X--;if($[X]!=="}")return;let J=X,Q=0,G=-1;for(;X>=0;X--){let W=$[X];if(W==="}")Q++;else if(W==="{"){if(Q--,Q===0){G=X;break}}}if(G===-1)return;let K=$.slice(G+1,J);for(let W of uk(K)){let U=W.trim();if(!U||U.startsWith("..."))continue;let z=mk(U);if(z===-1)continue;let _=U.slice(0,z).trim();if(!/^[A-Z_$][\w$]*$/i.test(_))continue;if(Z[_]!==void 0)continue;let B=U.slice(z+1).trim();if(!B)continue;try{let q=Object.keys(Z),j=Function(...q,`"use strict"; return (${B});`);Z[_]=j(...q.map((H)=>Z[H]))}catch{}}}catch{}}async function g7($,Z,Y,X,J){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(O)=>O.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""),K=(O)=>O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),W=Y.__importedComponents;if(W){for(let O of[Q,Q.toLowerCase(),G(Q),K(Q)])if(W.has(O))return!0}let U=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${K(Q)}.stx`])],z=typeof J.root==="string"?t.resolve(J.root):void 0,_=z??t.dirname(X),B=[],q=(O)=>{if(O&&!B.includes(O))B.push(O)},j=Y.__originalFilePath;if(j)q(t.join(t.dirname(j),"components"));q(Z),q(J._rootComponentsDir),q(t.join(t.dirname(X),"components")),q(J.componentsDir);let H=J._pluginComponentDirs;if(Array.isArray(H))for(let O of H)q(typeof O==="string"?O:null);if(z)q(t.resolve(z,"resources/views/components")),q(t.resolve(z,"resources/components")),q(t.resolve(z,"src/components")),q(t.resolve(z,"components"));if(Q.startsWith("./")||Q.startsWith("../"))return J0(t.resolve(t.dirname(X),`${Q}.stx`));for(let O of B){let V=t.isAbsolute(O)?O:t.resolve(_,O);for(let L of U)if(await J0(t.join(V,L)))return!0}return!1}function rH($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function aH($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function sH($){let Z=new Set,Y=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let X of $){let J;while((J=Y.exec(X))!==null)Z.add(J[1]);Y.lastIndex=0}return[...Z]}async function z4($,Z,Y,X,J,Q,G,K=new Set,W){let{extractVariables:U}=await Promise.resolve().then(() => (X6(),mZ)),z=K??new Set;if(z.has($))return`[Circular component reference: ${$}]`;let _=new Set(z);_.add($);let B=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let q=B&&B!=="load"&&rH(B)?B:"";try{let j=(u)=>u.split("-").map((n)=>n.charAt(0).toUpperCase()+n.slice(1)).join(""),H=(u)=>u.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),O=$.endsWith(".stx")?$.slice(0,-4):$,V=null,L=J.__importedComponents;if(L){let u=[O,O.toLowerCase(),j(O),H(O)];for(let n of u)if(L.has(n)){V=L.get(n);break}}let F=[];if(!V){let u=[`${O}.stx`,`${j(O)}.stx`,`${H(O)}.stx`],n=[...new Set(u)],C=J.__originalFilePath,d=[];if(C){let b0=t.join(t.dirname(C),"components");d.push(b0)}if(X)d.push(X);let o=G._rootComponentsDir;if(typeof o==="string"&&!d.includes(o))d.push(o);let a=t.join(t.dirname(Q),"components");if(!d.includes(a))d.push(a);if(G.componentsDir&&G.componentsDir!==X&&!d.includes(G.componentsDir))d.push(G.componentsDir);let z0=G._pluginComponentDirs;if(Array.isArray(z0)){for(let b0 of z0)if(typeof b0==="string"&&!d.includes(b0))d.push(b0)}let O0=typeof G.root==="string"?t.resolve(G.root):void 0,w0=O0??t.dirname(Q),Q1=[];if(O0)Q1.push(t.resolve(O0,"resources/views/components")),Q1.push(t.resolve(O0,"resources/components")),Q1.push(t.resolve(O0,"src/components")),Q1.push(t.resolve(O0,"components"));Q1.push(t.resolve(import.meta.dir,"components"));for(let b0 of Q1)if(!d.includes(b0))d.push(b0);let _1=[...new Set(d.map((b0)=>{if(!b0)return b0;return t.isAbsolute(b0)?b0:t.resolve(w0,b0)}))];if(d.length=0,d.push(..._1),O.startsWith("./")||O.startsWith("../"))V=t.resolve(t.dirname(Q),`${O}.stx`),F.push(V);else for(let b0 of d){if(!b0)continue;for(let B1 of n){let e0=t.join(b0,B1);if(F.push(e0),await J0(e0)){V=e0;break}}if(V)break;if(!V)try{let B1=await import("fs");if(!B1.statSync(b0,{throwIfNoEntry:!1})?.isDirectory())continue;let j0=8,m0=[{path:b0,depth:0}];while(m0.length>0&&!V){let P0=m0.pop();if(P0.depth>=j0)continue;let G0;try{G0=B1.readdirSync(P0.path,{withFileTypes:!0})}catch{continue}for(let I0 of G0){if(!I0.isDirectory())continue;if(I0.name==="node_modules"||I0.name.startsWith("."))continue;let q$=t.join(P0.path,I0.name);for(let OR of n){let jJ=t.join(q$,OR);if(F.push(jJ),await J0(jJ)){V=jJ;break}}if(V)break;m0.push({path:q$,depth:P0.depth+1})}}}catch{}if(V)break}}if(!V||!await J0(V)){let u=F.length>0?`
|
|
11662
11662
|
Searched paths:
|
|
11663
11663
|
${F.map((n)=>` - ${n}`).join(`
|
|
11664
11664
|
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${u}`}W.add(V);let A;if(Q8.has(V))A=Q8.get(V);else try{A=await Bun.file(V).text(),Q8.set(V,A)}catch(u){return`[Error loading component: ${u instanceof Error?u.message:String(u)}]`}let w=new Set(["__originalFilePath","__importedComponents"]),N={};for(let[u,n]of Object.entries(J))if(!u.startsWith("__")||w.has(u))N[u]=n;let{extractSlotContent:R}=await Promise.resolve().then(() => (DY(),LQ)),E=R(Y),M={};if(E.defaultSlot?.trim())M.default=E.defaultSlot;for(let[u,n]of E.namedSlots)M[u]=n.content;let I={...N,...Z,props:Z,slot:Y,$slots:M,__processedComponents:_,__sections:{},...aH(Y)&&{__stx_force_signals:!0}};lk(A,I);let S=A,k=U4(S);if(k)S=k.content.trim();let x=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,y=[...A.matchAll(x)],b=[];for(let u of y){let n=u[1]||"",C=u[2]||"",d=n.includes("server");if(c4(n)&&C.trim())C=p4(C);if(d&&C)try{await U(C,I,V)}catch(a){}if(!d){let a=C.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),z0=a.includes("{{")&&a.includes("}}"),O0=a.includes("{!!")&&a.includes("!!}");if(z0||O0)a=q7(a,I);let w0=n.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");b.push(`<script${w0}>${a}</script>`)}}let g=A.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),r=g?g[1]:"",c=g?g[2]:"",P="",h=r&&/\bscoped\b/i.test(r);if(g)P=`<style${r}>${c}</style>`;let m=S;if(m=m.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),g)m=m.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let u=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,n=[];if(m=m.replace(u,(C,d)=>{let o=d.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(o)n.push(`<style${o[1]}>${o[2]}</style>`);return""}),m=m.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),n.length>0)P=`${P}${n.join(`
|
|
11665
|
-
`)}`}if(Y&&m.includes("{{ text || slot }}"))m=m.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:i}=await Promise.resolve().then(() => (DY(),LQ)),{defaultSlot:s,namedSlots:q0}=E;m=await i(m,s,q0,I);for(let[u,n]of Object.entries(I))if(typeof n==="string"){if(n.includes("<")&&n.includes(">")||n.includes("<")||n.includes(""")){let C=ZZ(n);I[u]=C}}let K0=b.some((u)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(u)),S0=sH(b);if(S0.length>0)I.__stx_client_signal_names=S0;let z1={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:t.dirname(V),skipSignalsRuntime:!0,skipEventDirectives:K0||b.length===0,defaultLayout:void 0};I.__stxProcessingDepth=(J.__stxProcessingDepth||0)+1;let C0=await _0(m,I,V,z1,W),h1=new Set(Array.isArray(J.__stx_preserved_client_expressions)?J.__stx_preserved_client_expressions:[]);for(let u of C0.matchAll(/\{\{([\s\S]*?)\}\}/g))h1.add(u[1].trim());if(h1.size>0)J.__stx_preserved_client_expressions=[...h1];let X0=`stx_${O.replace(/[^a-zA-Z0-9]/g,"_")}_${++hk}_${Math.random().toString(36).slice(2,8)}`,l=C0;if(K0){let u="";if(Object.keys(Z).length>0)try{u=` data-stx-props="${iH(JSON.stringify(Z))}"`}catch{}let n=q?` stx-hydrate="${iH(q)}"`:"";l=`<div data-stx-scope="${X0}"${u}${n}>${C0}</div>`;let C=await Promise.all(b.map(async(d)=>{let o=d.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!o)return d;let[,a,z0]=o,O0=Q7(z0,{filePath:V,projectRoot:process.cwd()}),w0=O0.code,Q1=G7(O0.styles);w0=
|
|
11665
|
+
`)}`}if(Y&&m.includes("{{ text || slot }}"))m=m.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:i}=await Promise.resolve().then(() => (DY(),LQ)),{defaultSlot:s,namedSlots:q0}=E;m=await i(m,s,q0,I);for(let[u,n]of Object.entries(I))if(typeof n==="string"){if(n.includes("<")&&n.includes(">")||n.includes("<")||n.includes(""")){let C=ZZ(n);I[u]=C}}let K0=b.some((u)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(u)),S0=sH(b);if(S0.length>0)I.__stx_client_signal_names=S0;let z1={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:t.dirname(V),skipSignalsRuntime:!0,skipEventDirectives:K0||b.length===0,defaultLayout:void 0};I.__stxProcessingDepth=(J.__stxProcessingDepth||0)+1;let C0=await _0(m,I,V,z1,W),h1=new Set(Array.isArray(J.__stx_preserved_client_expressions)?J.__stx_preserved_client_expressions:[]);for(let u of C0.matchAll(/\{\{([\s\S]*?)\}\}/g))h1.add(u[1].trim());if(h1.size>0)J.__stx_preserved_client_expressions=[...h1];let X0=`stx_${O.replace(/[^a-zA-Z0-9]/g,"_")}_${++hk}_${Math.random().toString(36).slice(2,8)}`,l=C0;if(K0){let u="";if(Object.keys(Z).length>0)try{u=` data-stx-props="${iH(JSON.stringify(Z))}"`}catch{}let n=q?` stx-hydrate="${iH(q)}"`:"";l=`<div data-stx-scope="${X0}"${u}${n}>${C0}</div>`;let C=await Promise.all(b.map(async(d)=>{let o=d.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!o)return d;let[,a,z0]=o,O0=Q7(z0,{filePath:V,projectRoot:process.cwd()}),w0=O0.code,Q1=G7(O0.styles);w0=C6(w0).code;let{hasUserImports:_1,bundleClientScript:b0}=await Promise.resolve().then(() => (X7(),Y7));if(_1(w0))w0=await b0(w0,V,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:B1}=await Promise.resolve().then(() => (o7(),VY));w0=w0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(P0,G0)=>B1(G0));let e0=l1(w0),j0=dk(e0),m0=`
|
|
11666
11666
|
(function() {
|
|
11667
11667
|
${A$("const",[...yz,...j0],e0)}
|
|
11668
11668
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
@@ -11712,7 +11712,7 @@ ${H0.yellow}${H0.bold}Message:${H0.reset} ${Z}
|
|
|
11712
11712
|
`,K)z+=`
|
|
11713
11713
|
${H0.blue}${H0.bold}Context:${H0.reset}
|
|
11714
11714
|
${H0.dim}${K}${H0.reset}
|
|
11715
|
-
`;return z}function B4(){Q8.clear()}function pk(){return{size:Q8.size,maxSize:500}}var Q8,hk=0,H0;var N0=D(()=>{
|
|
11715
|
+
`;return z}function B4(){Q8.clear()}function pk(){return{size:Q8.size,maxSize:500}}var Q8,hk=0,H0;var N0=D(()=>{b6();$1();H7();r4();q1();u4();YY();C$();uH();X6();Q8=new O7(500);H0={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"}});async function BQ($,Z,Y=""){let X=$,J=[],Q=/@markdown(?:\([^)]*\))?/g,G;while((G=Q.exec($))!==null){let K=G.index,W=G[0].match(/@markdown\(([^)]*)\)/),U=W?W[1]:"",z=K+G[0].length,_=1,B=z,q=-1;while(_>0&&B<$.length){let O=$.indexOf("@markdown",B),V=$.indexOf("@endmarkdown",B);if(V===-1)break;if(O!==-1&&O<V&&O!==K){let L=$[O+9];if(L==="("||L===`
|
|
11716
11716
|
`||L==="\r"||L===" "||L===void 0)_++;B=O+9}else{if(_--,_===0){q=V;break}B=V+12}}if(q===-1)continue;let j=$.slice(z,q),H=$.slice(K,q+12);J.push({fullMatch:H,options:U,content:j,index:K}),Q.lastIndex=q+12}for(let{fullMatch:K,options:W,content:U,index:z}of J)try{let _={};if(W)W.split(",").forEach((j)=>{let H=j.trim();if(H)_[H]=!0});let B={gfm:_.gfm??!0,breaks:_.breaks??!1},q=$7(U.trim(),B);X=X.split(K).join(q)}catch(_){let B=_ instanceof Error?_.message:String(_),q=T0("Markdown Directive",`Error processing markdown: ${B}`,Y,$,z,K);X=X.split(K).join(q)}return X}async function AQ($,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}),$7($.trim(),J)}var IY=D(()=>{N0()});function oH($){if(kY.set($.name,$),$.client)wQ.set($.name,$.client)}function ik($){return kY.get($)}function nk(){return Array.from(kY.values())}function rk($){return wQ.delete($),kY.delete($)}function h0($){return oH($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,X,J,Q)=>{let G=sk(X,$.defaults);if($.validate){let W=$.validate(G);if(W!==!0){let U=typeof W==="string"?W:`Invalid parameters for @${$.name}`;throw Error(U)}}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 ak($,Z){let Y=typeof Z==="function"?{mounted:Z}:Z;return wQ.set($,Y),Y}function sk($,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 ok(){return[h0({name:"uppercase",description:"Convert content to uppercase",transform:($)=>$.toUpperCase()}),h0({name:"lowercase",description:"Convert content to lowercase",transform:($)=>$.toLowerCase()}),h0({name:"capitalize",description:"Capitalize first letter of content",transform:($)=>$.charAt(0).toUpperCase()+$.slice(1)}),h0({name:"trim",description:"Remove leading and trailing whitespace",transform:($)=>$.trim()}),h0({name:"truncate",description:"Truncate content to specified length",defaults:{length:100,suffix:"..."},transform:($,{length:Z,suffix:Y})=>$.length>Z?$.slice(0,Z)+Y:$}),h0({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>`}),h0({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>`}}),h0({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>`}),h0({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:()=>`
|
|
11717
11717
|
.stx-tooltip::after {
|
|
11718
11718
|
content: attr(data-tooltip);
|
|
@@ -11906,7 +11906,7 @@ ${H0.dim}${K}${H0.reset}
|
|
|
11906
11906
|
filter: blur(0);
|
|
11907
11907
|
transform: scale(1);
|
|
11908
11908
|
}
|
|
11909
|
-
`.trim();e$=new Map});import{createHash as mQ}from"crypto";import{readFile as ZS,stat as $O}from"fs/promises";async function Y1($){try{let Z=await ZS($);return mQ("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function ZO($){return mQ("sha256").update($).digest("hex").slice(0,16)}function PY($){return mQ("sha256").update($).digest("hex").slice(0,16)}function Z5($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${PY($)}-${PY(Y)}`}async function q8($){try{return(await $O($)).mtimeMs}catch{return 0}}async function X1($){try{return await $O($),!0}catch{return!1}}var z6=()=>{};import{mkdir as YS,readFile as XO,writeFile as XS,readdir as JO,rm as lQ,stat as JS}from"fs/promises";import{join as Y5,dirname as QS}from"path";async function GS($){try{await YS($,{recursive:!0})}catch{}}function QO($,Z,Y){return Y5($,Y,`${Z}.json`)}async function YO($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await q8(Z)!==$.srcMtime)return!1;return!0}async function X5($,Z,Y,X=j8){if(!X.enabled)return null;let J=Z5($,Z),Q=_6.get(J);if(Q){if(await YO(Q,$,X.maxAge))return Q.lastAccessedAt=Date.now(),Q.data;_6.delete(J)}let G=QO(X.directory,J,Y);if(await X1(G))try{let K=await XO(G,"utf-8"),W=JSON.parse(K);if(await YO(W,$,X.maxAge))return W.lastAccessedAt=Date.now(),_6.set(J,W),W.data}catch{}return null}async function J5($,Z,Y,X,J=j8){if(!J.enabled)return;let Q=Z5($,Z),G=await Y1($),K=await q8($),W={key:Q,src:$,srcHash:G,srcMtime:K,optionsHash:Z5("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};_6.set(Q,W);let U=QO(J.directory,Q,X);try{await GS(QS(U)),await XS(U,JSON.stringify(W,null,2))}catch(z){console.warn(`[stx-media] Failed to write cache: ${z}`)}}async function Q5($,Z=j8){if($==="all")_6.clear();else _6.clear();let Y=$==="all"?["image","video"]:[$];for(let X of Y){let J=Y5(Z.directory,X);try{await lQ(J,{recursive:!0,force:!0})}catch{}}}async function GO($=j8){let Z={memoryEntries:_6.size,diskEntries:{image:0,video:0},totalSizeMB:0};for(let Y of["image","video"]){let X=Y5($.directory,Y);try{let J=await JO(X);Z.diskEntries[Y]=J.length;for(let Q of J){let G=Y5(X,Q),K=await JS(G);Z.totalSizeMB+=K.size/1048576}}catch{}}return Z}async function KO($=j8){let Z=0,Y=$.maxAge*24*60*60*1000;for(let X of["image","video"]){let J=Y5($.directory,X);try{let Q=await JO(J);for(let G of Q){let K=Y5(J,G);try{let W=await XO(K,"utf-8"),U=JSON.parse(W);if(Date.now()-U.createdAt>Y)await lQ(K),_6.delete(U.key),Z++}catch{await lQ(K).catch(()=>{}),Z++}}}catch{}}return Z}var _6,j8;var yY=D(()=>{z6();_6=new Map,j8={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class G5{config;constructor($={}){this.config={...KS,...$}}async get($,Z){return X5($,Z,"image",this.config)}async set($,Z,Y){return J5($,Z,Y,"image",this.config)}async clear(){return Q5("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function cQ($){if(!xY)xY=new G5($);else if($)xY.updateConfig($);return xY}async function K5($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return cQ(X).get($,Z)}async function W5($,Z,Y,X){let J=X?{directory:`${X.outputDir}/../.cache`}:{};return cQ(J).set($,Z,Y)}async function pQ(){return cQ().clear()}var KS,xY=null;var iQ=D(()=>{yY();KS={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as WS,basename as US,extname as zS,join as _S}from"path";import{mkdir as BS}from"fs/promises";async function nQ(){try{return await import("ts-images")}catch{return null}}function WO($){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 qS($,Z){let Y=Z?WO(Z):WO("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 rQ($,Z,Y){let X=await nQ();if(!X)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let J=await K5($,Z,Y);if(J)return J;try{let Q=WS($);if(!await X1(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=qS(Y,Z.preset),K=Y.outputDir||"dist/images",W=Y.baseUrl||"/images";await BS(K,{recursive:!0});let U=await Y1(Q),z=US($,zS($)),_=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],B={src:$,processed:!0,variants:[],hash:U},q=null;if(Z.transformations&&Z.transformations.length>0)q=await H8(Q,Z.transformations,X);for(let j of _){let H=G[j]||{},O=`${z}-${U}.${j}`,V=_S(K,O);try{let L=await X.optimizeImage({input:q||Q,output:V,format:j,quality:H.quality,progressive:H.progressive});if(L){if(B.variants.push({path:V,url:`${W}/${O}`,width:L.width||0,height:L.height||0,format:j,size:L.outputSize||0}),!B.originalWidth&&L.width)B.originalWidth=L.width,B.originalHeight=L.height}}catch(L){B.errors=B.errors||[],B.errors.push(`Failed to optimize ${j}: ${L}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let j=await X.generateThumbHash(Q);B.placeholder=j.dataUrl}catch(j){B.errors=B.errors||[],B.errors.push(`Failed to generate thumbhash: ${j}`)}if(Z.useDominantColor)try{let j=await X.generatePlaceholder(Q,{strategy:"dominant-color"});B.dominantColor=j.dominantColor}catch(j){B.errors=B.errors||[],B.errors.push(`Failed to extract dominant color: ${j}`)}return await W5($,Z,B,Y),B}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function aQ($,Z,Y,X){let J=await nQ();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 H8($,Z,Y){let X=Y||await nQ();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 UO=D(()=>{z6();iQ()});import{resolve as jS,basename as HS,extname as OS,join as LS}from"path";import{mkdir as VS}from"fs/promises";async function FS(){try{return await import("ts-images")}catch{return null}}async function vY($,Z,Y){let X=await FS();if(!X)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let J=jS($);if(!await X1(J))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let Q=Z.responsiveWidths||Y.breakpoints||AS,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",W=Y.baseUrl||"/images";await VS(K,{recursive:!0});let U=await Y1(J),z=HS($,OS($)),_=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},B={src:$,byFormat:{},srcsets:{}};for(let j of G){B.byFormat[j]=[];let H=[];for(let O of Q){let V=`${z}-${O}w-${U}.${j}`,L=LS(K,V),F=`${W}/${V}`;try{let A=_[j]?.quality||80;if(await X1(L)){B.byFormat[j].push({path:L,url:F,width:O,height:0,format:j,size:0}),H.push(`${F} ${O}w`);continue}let w=await X.processImage({input:J,output:L,format:j,quality:A,resize:{width:O}});if(w)B.byFormat[j].push({path:L,url:F,width:O,height:w.height||Math.round(O*(w.height||1)/(w.width||1)),format:j,size:w.outputSize||0}),H.push(`${F} ${O}w`)}catch(A){console.warn(`[stx-media] Failed to generate ${j} at ${O}w: ${A}`)}}B.srcsets[j]=H.join(", ")}let q=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(q!=="none")try{if(q==="thumbhash"){let j=await X.generateThumbHash(J);B.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});B.placeholder={dataURL:j.dataURL,width:j.width,height:j.height,strategy:q}}}catch(j){console.warn(`[stx-media] Failed to generate placeholder: ${j}`)}return B.sizes=Z.sizes||wS(Q),B}catch(Q){return console.error(`[stx-media] Responsive generation failed: ${Q}`),null}}function wS($){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 fY($,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 AS;var zO=D(()=>{z6();AS=[320,480,640,768,1024,1280,1536,1920]});var _O={};e(_O,{setCachedImageResult:()=>W5,processImage:()=>rQ,optimizeImage:()=>aQ,getCachedImageResult:()=>K5,generateSrcset:()=>fY,generateResponsiveVariants:()=>vY,clearImageCache:()=>pQ,applyTransformations:()=>H8,ImageProcessorCache:()=>G5});var sQ=D(()=>{UO();zO();iQ()});async function NS(){try{return await Promise.resolve().then(() => (sQ(),_O))}catch($){if(!BO)console.warn("[stx-media] Image processor not available, some features disabled:",$),BO=!0;return null}}async function B6($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return ES(X,Y)}if(Y.processedResult?.processed)return ZG($,Y.processedResult,Z);if(Y.responsiveVariants)return OO($,Y.responsiveVariants,Z);let{src:J,alt:Q,width:G,height:K,sizes:W,widths:U=j4,dpr:z,formats:_=E4,quality:B=oQ,params:q={},placeholder:j="none",placeholderOptions:H={},lazy:O=!0,priority:V=!1,loading:L=V?"eager":hY,decoding:F=gY,fetchpriority:A,objectFit:w,objectPosition:N,crossorigin:R,referrerpolicy:E}=$,M=$.class,I=$.style,S=$.id,k=$.data||{},{isDev:x=!1,baseUrl:y=""}=Z;if(x&&!Z.optimize)return TS($);let b,g,r=S||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!V)try{b=await B8(J,{strategy:j,...H}),g=_8(r,b,H)}catch{}let c=z!==void 0&&G!==void 0,P;if(c)P=MS($,r,b,Z);else P=await RS($,r,b,Z);let h;if(V){let s=_.includes("webp")?"webp":_[0],q0=U6(J,U,{...q,q:B},s),K0=typeof W==="object"?t$(W):W||"100vw";h=`<link rel="preload" as="image" imagesrcset="${q0}" imagesizes="${K0}" />`}let m=[];if(!qO&&j!=="none")m.push($5),qO=!0;if(g)m.push(g);let i=O?HO(r):void 0;return{html:P,preloadLink:h,css:m.length>0?m.join(`
|
|
11909
|
+
`.trim();e$=new Map});import{createHash as mQ}from"crypto";import{readFile as ZS,stat as $O}from"fs/promises";async function Y1($){try{let Z=await ZS($);return mQ("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function ZO($){return mQ("sha256").update($).digest("hex").slice(0,16)}function PY($){return mQ("sha256").update($).digest("hex").slice(0,16)}function Z5($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${PY($)}-${PY(Y)}`}async function q8($){try{return(await $O($)).mtimeMs}catch{return 0}}async function X1($){try{return await $O($),!0}catch{return!1}}var z6=()=>{};import{mkdir as YS,readFile as XO,writeFile as XS,readdir as JO,rm as lQ,stat as JS}from"fs/promises";import{join as Y5,dirname as QS}from"path";async function GS($){try{await YS($,{recursive:!0})}catch{}}function QO($,Z,Y){return Y5($,Y,`${Z}.json`)}async function YO($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await q8(Z)!==$.srcMtime)return!1;return!0}async function X5($,Z,Y,X=j8){if(!X.enabled)return null;let J=Z5($,Z),Q=_6.get(J);if(Q){if(await YO(Q,$,X.maxAge))return Q.lastAccessedAt=Date.now(),Q.data;_6.delete(J)}let G=QO(X.directory,J,Y);if(await X1(G))try{let K=await XO(G,"utf-8"),W=JSON.parse(K);if(await YO(W,$,X.maxAge))return W.lastAccessedAt=Date.now(),_6.set(J,W),W.data}catch{}return null}async function J5($,Z,Y,X,J=j8){if(!J.enabled)return;let Q=Z5($,Z),G=await Y1($),K=await q8($),W={key:Q,src:$,srcHash:G,srcMtime:K,optionsHash:Z5("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};_6.set(Q,W);let U=QO(J.directory,Q,X);try{await GS(QS(U)),await XS(U,JSON.stringify(W,null,2))}catch(z){console.warn(`[stx-media] Failed to write cache: ${z}`)}}async function Q5($,Z=j8){if($==="all")_6.clear();else _6.clear();let Y=$==="all"?["image","video"]:[$];for(let X of Y){let J=Y5(Z.directory,X);try{await lQ(J,{recursive:!0,force:!0})}catch{}}}async function GO($=j8){let Z={memoryEntries:_6.size,diskEntries:{image:0,video:0},totalSizeMB:0};for(let Y of["image","video"]){let X=Y5($.directory,Y);try{let J=await JO(X);Z.diskEntries[Y]=J.length;for(let Q of J){let G=Y5(X,Q),K=await JS(G);Z.totalSizeMB+=K.size/1048576}}catch{}}return Z}async function KO($=j8){let Z=0,Y=$.maxAge*24*60*60*1000;for(let X of["image","video"]){let J=Y5($.directory,X);try{let Q=await JO(J);for(let G of Q){let K=Y5(J,G);try{let W=await XO(K,"utf-8"),U=JSON.parse(W);if(Date.now()-U.createdAt>Y)await lQ(K),_6.delete(U.key),Z++}catch{await lQ(K).catch(()=>{}),Z++}}}catch{}}return Z}var _6,j8;var yY=D(()=>{z6();_6=new Map,j8={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class G5{config;constructor($={}){this.config={...KS,...$}}async get($,Z){return X5($,Z,"image",this.config)}async set($,Z,Y){return J5($,Z,Y,"image",this.config)}async clear(){return Q5("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function cQ($){if(!xY)xY=new G5($);else if($)xY.updateConfig($);return xY}async function K5($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return cQ(X).get($,Z)}async function W5($,Z,Y,X){let J=X?{directory:`${X.outputDir}/../.cache`}:{};return cQ(J).set($,Z,Y)}async function pQ(){return cQ().clear()}var KS,xY=null;var iQ=D(()=>{yY();KS={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as WS,basename as US,extname as zS,join as _S}from"path";import{mkdir as BS}from"fs/promises";async function nQ(){try{return await import("ts-images")}catch{return null}}function WO($){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 qS($,Z){let Y=Z?WO(Z):WO("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 rQ($,Z,Y){let X=await nQ();if(!X)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let J=await K5($,Z,Y);if(J)return J;try{let Q=WS($);if(!await X1(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=qS(Y,Z.preset),K=Y.outputDir||"dist/images",W=Y.baseUrl||"/images";await BS(K,{recursive:!0});let U=await Y1(Q),z=US($,zS($)),_=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],B={src:$,processed:!0,variants:[],hash:U},q=null;if(Z.transformations&&Z.transformations.length>0)q=await H8(Q,Z.transformations,X);for(let j of _){let H=G[j]||{},O=`${z}-${U}.${j}`,V=_S(K,O);try{let L=await X.optimizeImage({input:q||Q,output:V,format:j,quality:H.quality,progressive:H.progressive});if(L){if(B.variants.push({path:V,url:`${W}/${O}`,width:L.width||0,height:L.height||0,format:j,size:L.outputSize||0}),!B.originalWidth&&L.width)B.originalWidth=L.width,B.originalHeight=L.height}}catch(L){B.errors=B.errors||[],B.errors.push(`Failed to optimize ${j}: ${L}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let j=await X.generateThumbHash(Q);B.placeholder=j.dataUrl}catch(j){B.errors=B.errors||[],B.errors.push(`Failed to generate thumbhash: ${j}`)}if(Z.useDominantColor)try{let j=await X.generatePlaceholder(Q,{strategy:"dominant-color"});B.dominantColor=j.dominantColor}catch(j){B.errors=B.errors||[],B.errors.push(`Failed to extract dominant color: ${j}`)}return await W5($,Z,B,Y),B}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function aQ($,Z,Y,X){let J=await nQ();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 H8($,Z,Y){let X=Y||await nQ();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 UO=D(()=>{z6();iQ()});import{resolve as jS,basename as HS,extname as OS,join as LS}from"path";import{mkdir as VS}from"fs/promises";async function FS(){try{return await import("ts-images")}catch{return null}}async function vY($,Z,Y){let X=await FS();if(!X)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let J=jS($);if(!await X1(J))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let Q=Z.responsiveWidths||Y.breakpoints||AS,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",W=Y.baseUrl||"/images";await VS(K,{recursive:!0});let U=await Y1(J),z=HS($,OS($)),_=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},B={src:$,byFormat:{},srcsets:{}};for(let j of G){B.byFormat[j]=[];let H=[];for(let O of Q){let V=`${z}-${O}w-${U}.${j}`,L=LS(K,V),F=`${W}/${V}`;try{let A=_[j]?.quality||80;if(await X1(L)){B.byFormat[j].push({path:L,url:F,width:O,height:0,format:j,size:0}),H.push(`${F} ${O}w`);continue}let w=await X.processImage({input:J,output:L,format:j,quality:A,resize:{width:O}});if(w)B.byFormat[j].push({path:L,url:F,width:O,height:w.height||Math.round(O*(w.height||1)/(w.width||1)),format:j,size:w.outputSize||0}),H.push(`${F} ${O}w`)}catch(A){console.warn(`[stx-media] Failed to generate ${j} at ${O}w: ${A}`)}}B.srcsets[j]=H.join(", ")}let q=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(q!=="none")try{if(q==="thumbhash"){let j=await X.generateThumbHash(J);B.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});B.placeholder={dataURL:j.dataURL,width:j.width,height:j.height,strategy:q}}}catch(j){console.warn(`[stx-media] Failed to generate placeholder: ${j}`)}return B.sizes=Z.sizes||wS(Q),B}catch(Q){return console.error(`[stx-media] Responsive generation failed: ${Q}`),null}}function wS($){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 fY($,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 AS;var zO=D(()=>{z6();AS=[320,480,640,768,1024,1280,1536,1920]});var _O={};$0(_O,{setCachedImageResult:()=>W5,processImage:()=>rQ,optimizeImage:()=>aQ,getCachedImageResult:()=>K5,generateSrcset:()=>fY,generateResponsiveVariants:()=>vY,clearImageCache:()=>pQ,applyTransformations:()=>H8,ImageProcessorCache:()=>G5});var sQ=D(()=>{UO();zO();iQ()});async function NS(){try{return await Promise.resolve().then(() => (sQ(),_O))}catch($){if(!BO)console.warn("[stx-media] Image processor not available, some features disabled:",$),BO=!0;return null}}async function B6($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return ES(X,Y)}if(Y.processedResult?.processed)return ZG($,Y.processedResult,Z);if(Y.responsiveVariants)return OO($,Y.responsiveVariants,Z);let{src:J,alt:Q,width:G,height:K,sizes:W,widths:U=j4,dpr:z,formats:_=E4,quality:B=oQ,params:q={},placeholder:j="none",placeholderOptions:H={},lazy:O=!0,priority:V=!1,loading:L=V?"eager":hY,decoding:F=gY,fetchpriority:A,objectFit:w,objectPosition:N,crossorigin:R,referrerpolicy:E}=$,M=$.class,I=$.style,S=$.id,k=$.data||{},{isDev:x=!1,baseUrl:y=""}=Z;if(x&&!Z.optimize)return TS($);let b,g,r=S||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!V)try{b=await B8(J,{strategy:j,...H}),g=_8(r,b,H)}catch{}let c=z!==void 0&&G!==void 0,P;if(c)P=MS($,r,b,Z);else P=await RS($,r,b,Z);let h;if(V){let s=_.includes("webp")?"webp":_[0],q0=U6(J,U,{...q,q:B},s),K0=typeof W==="object"?t$(W):W||"100vw";h=`<link rel="preload" as="image" imagesrcset="${q0}" imagesizes="${K0}" />`}let m=[];if(!qO&&j!=="none")m.push($5),qO=!0;if(g)m.push(g);let i=O?HO(r):void 0;return{html:P,preloadLink:h,css:m.length>0?m.join(`
|
|
11910
11910
|
`):void 0,script:i}}async function RS($,Z,Y,X){let{src:J,alt:Q,width:G,height:K,sizes:W,widths:U=j4,formats:z=E4,quality:_=oQ,params:B={},lazy:q=!0,priority:j=!1,loading:H=j?"eager":hY,decoding:O=gY,fetchpriority:V,objectFit:L,objectPosition:F,crossorigin:A,referrerpolicy:w}=$,N=$.class,R=$.style,E=$.data||{},M=typeof W==="object"?t$(W):W||"100vw",I=[];for(let x of z){let y=U6(J,U,{...B,q:_},x),b=U8(x);if(q&&!j)I.push(` <source type="${b}" data-srcset="${y}" data-sizes="${M}" />`);else I.push(` <source type="${b}" srcset="${y}" sizes="${M}" />`)}let S=tQ({src:r1(J,{...B,q:_}),alt:Q,width:G,height:K,loading:j?void 0:H,decoding:O,fetchpriority:j?"high":V,objectFit:L,objectPosition:F,crossorigin:A,referrerpolicy:w,className:jO(N,Y),style:eQ(R,L,F,Y),lazy:q&&!j,data:E}),k;if(Y){let x=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;k=`<div id="${Z}" class="stx-img-placeholder" style="${x}">
|
|
11911
11911
|
<picture>
|
|
11912
11912
|
${I.join(`
|
|
@@ -11970,8 +11970,8 @@ ${w.join(`
|
|
|
11970
11970
|
`):void 0,script:y}}async function OO($,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 ZG($,X,Y)}var BO=!1,oQ=80,gY="async",hY="lazy",qO=!1;var YG=D(()=>{CY();uQ()});function uY(){return h0({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}=IS($,Z,Y);if(!J)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:J,alt:Q||"",widths:G.widths||j4,formats:G.formats||E4,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,U=await B6(K,{isDev:W}),z=U.html;if(U.preloadLink)z=U.preloadLink+`
|
|
11971
11971
|
`+z;if(U.css)z+=`
|
|
11972
11972
|
<style>${U.css}</style>`;if(U.script)z+=`
|
|
11973
|
-
<script>${U.script}</script>`;return z},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function IS($,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=DS(X),Q=XG(J[0],Y)||"",G=XG(J[1],Y)||"",K={};if(J[2]){let W=XG(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 DS($){let Z=[],Y="",X=!1,J="",Q=0,G=0;for(let K=0;K<$.length;K++){let W=$[K],U=K>0?$[K-1]:"";if((W==='"'||W==="'"||W==="`")&&U!=="\\"){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 XG($,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 O8;var JG=D(()=>{G8();YG();CY();O8=uY()});class U5{config;constructor($={}){this.config={...kS,...$}}async get($,Z){return X5($,Z,"video",this.config)}async set($,Z,Y){return J5($,Z,Y,"video",this.config)}async clear(){return Q5("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function QG($){if(!mY)mY=new U5($);else if($)mY.updateConfig($);return mY}async function z5($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return QG(X).get($,Z)}async function _5($,Z,Y,X){let J=X?{directory:`${X.outputDir}/../.cache`}:{};return QG(J).set($,Z,Y)}async function lY(){return QG().clear()}var kS,mY=null;var GG=D(()=>{yY();kS={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as KG,basename as WG,extname as UG,join as cY}from"path";import{mkdir as zG}from"fs/promises";async function _G(){try{return await import("ts-videos")}catch{return null}}async function B5($,Z,Y,X){let J=await _G();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let Q=KG($);if(!await X1(Q))return null;await zG(Y,{recursive:!0});let G=await Y1(Q),K=WG($,UG($)),W=Z.format||"webp",U=Z.timestamp||0,z=`${K}-poster-${G}.${W}`,_=cY(Y,z),B=await J.extractThumbnails(Q,{timestamps:[U],width:Z.width||1280,height:Z.height,format:W,quality:Z.quality||85,outputDir:Y,outputPattern:z.replace(`.${W}`,"")});if(B&&B.length>0){let q=B[0];return{path:_,url:`${X}/${z}`,width:q.width||Z.width||1280,height:q.height||720,timestamp:U,size:q.size||0}}return null}catch(Q){return console.warn(`[stx-media] Failed to generate poster: ${Q}`),null}}async function q5($,Z,Y,X){let J=await _G();if(!J)return[];try{let Q=KG($);if(!await X1(Q))return[];await zG(Y,{recursive:!0});let G=await Y1(Q),K=WG($,UG($)),W=Z.format||"webp",_=(await new J.Input(Q).getInfo()).duration||60,B=Z.count||10,q=Z.interval||_/B,j=[];for(let O=0;O<B&&O*q<_;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,V)=>({path:O.path||cY(Y,`${K}-thumb-${G}-${V}.${W}`),url:`${X}/${K}-thumb-${G}-${V}.${W}`,width:O.width||Z.width||320,height:O.height||180,timestamp:j[V],size:O.size||0}));return[]}catch(Q){return console.warn(`[stx-media] Failed to generate thumbnails: ${Q}`),[]}}async function pY($,Z,Y,X){let J=await _G();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let Q=KG($);if(!await X1(Q))return null;await zG(Y,{recursive:!0});let G=await Y1(Q),K=WG($,UG($)),z=(await new J.Input(Q).getInfo()).duration||60,_=Z.columns||10,B=Z.interval||5,q=Z.thumbnailWidth||160,j=Z.thumbnailHeight||90,H=Z.format||"jpeg",O=Math.ceil(z/B),V=Math.ceil(O/_),L=`${K}-sprite-${G}.${H}`,F=cY(Y,L),A=[];for(let N=0;N<O;N++)A.push(N*B);let w=await J.extractThumbnails(Q,{timestamps:A,width:q,height:j,format:H,quality:Z.quality||70,outputDir:cY(Y,".temp")});if(!w||w.length===0)return null;try{let N=await import("ts-images"),R=_*q,E=V*j,M=await N.createSprite({images:w.map((I)=>I.path),columns:_,padding:0,outputPath:F,format:H,quality:Z.quality||70});return{url:`${X}/${L}`,path:F,columns:_,rows:V,thumbnailWidth:q,thumbnailHeight:j,interval:B,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 BG=D(()=>{z6()});import{resolve as VO,basename as FO,extname as AO,join as
|
|
11974
|
-
`)}async function H5($,Z,Y,X,J){let Q=await NO();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=VO($);if(!await X1(G))return null;let K=await Y1(G),W=FO($,AO($)),U=
|
|
11973
|
+
<script>${U.script}</script>`;return z},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function IS($,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=DS(X),Q=XG(J[0],Y)||"",G=XG(J[1],Y)||"",K={};if(J[2]){let W=XG(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 DS($){let Z=[],Y="",X=!1,J="",Q=0,G=0;for(let K=0;K<$.length;K++){let W=$[K],U=K>0?$[K-1]:"";if((W==='"'||W==="'"||W==="`")&&U!=="\\"){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 XG($,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 O8;var JG=D(()=>{G8();YG();CY();O8=uY()});class U5{config;constructor($={}){this.config={...kS,...$}}async get($,Z){return X5($,Z,"video",this.config)}async set($,Z,Y){return J5($,Z,Y,"video",this.config)}async clear(){return Q5("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function QG($){if(!mY)mY=new U5($);else if($)mY.updateConfig($);return mY}async function z5($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return QG(X).get($,Z)}async function _5($,Z,Y,X){let J=X?{directory:`${X.outputDir}/../.cache`}:{};return QG(J).set($,Z,Y)}async function lY(){return QG().clear()}var kS,mY=null;var GG=D(()=>{yY();kS={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as KG,basename as WG,extname as UG,join as cY}from"path";import{mkdir as zG}from"fs/promises";async function _G(){try{return await import("ts-videos")}catch{return null}}async function B5($,Z,Y,X){let J=await _G();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let Q=KG($);if(!await X1(Q))return null;await zG(Y,{recursive:!0});let G=await Y1(Q),K=WG($,UG($)),W=Z.format||"webp",U=Z.timestamp||0,z=`${K}-poster-${G}.${W}`,_=cY(Y,z),B=await J.extractThumbnails(Q,{timestamps:[U],width:Z.width||1280,height:Z.height,format:W,quality:Z.quality||85,outputDir:Y,outputPattern:z.replace(`.${W}`,"")});if(B&&B.length>0){let q=B[0];return{path:_,url:`${X}/${z}`,width:q.width||Z.width||1280,height:q.height||720,timestamp:U,size:q.size||0}}return null}catch(Q){return console.warn(`[stx-media] Failed to generate poster: ${Q}`),null}}async function q5($,Z,Y,X){let J=await _G();if(!J)return[];try{let Q=KG($);if(!await X1(Q))return[];await zG(Y,{recursive:!0});let G=await Y1(Q),K=WG($,UG($)),W=Z.format||"webp",_=(await new J.Input(Q).getInfo()).duration||60,B=Z.count||10,q=Z.interval||_/B,j=[];for(let O=0;O<B&&O*q<_;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,V)=>({path:O.path||cY(Y,`${K}-thumb-${G}-${V}.${W}`),url:`${X}/${K}-thumb-${G}-${V}.${W}`,width:O.width||Z.width||320,height:O.height||180,timestamp:j[V],size:O.size||0}));return[]}catch(Q){return console.warn(`[stx-media] Failed to generate thumbnails: ${Q}`),[]}}async function pY($,Z,Y,X){let J=await _G();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let Q=KG($);if(!await X1(Q))return null;await zG(Y,{recursive:!0});let G=await Y1(Q),K=WG($,UG($)),z=(await new J.Input(Q).getInfo()).duration||60,_=Z.columns||10,B=Z.interval||5,q=Z.thumbnailWidth||160,j=Z.thumbnailHeight||90,H=Z.format||"jpeg",O=Math.ceil(z/B),V=Math.ceil(O/_),L=`${K}-sprite-${G}.${H}`,F=cY(Y,L),A=[];for(let N=0;N<O;N++)A.push(N*B);let w=await J.extractThumbnails(Q,{timestamps:A,width:q,height:j,format:H,quality:Z.quality||70,outputDir:cY(Y,".temp")});if(!w||w.length===0)return null;try{let N=await import("ts-images"),R=_*q,E=V*j,M=await N.createSprite({images:w.map((I)=>I.path),columns:_,padding:0,outputPath:F,format:H,quality:Z.quality||70});return{url:`${X}/${L}`,path:F,columns:_,rows:V,thumbnailWidth:q,thumbnailHeight:j,interval:B,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 BG=D(()=>{z6()});import{resolve as VO,basename as FO,extname as AO,join as a6}from"path";import{mkdir as iY,writeFile as wO}from"fs/promises";async function NO(){try{return await import("ts-videos")}catch{return null}}async function j5($,Z,Y,X,J){let Q=await NO();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=VO($);if(!await X1(G))return null;let K=await Y1(G),W=FO($,AO($)),U=a6(Y,`${W}-${K}-hls`);await iY(U,{recursive:!0});let z=Z.length>0?Z:RO,_=J?.segmentDuration||6,j=(await new Q.Input(G).getInfo()).duration||0,H=[],O=0;for(let F of z){let A=a6(U,F.label);await iY(A,{recursive:!0});let w=`${F.label}.m3u8`,N=a6(A,w);try{let R=await Q.generateHLS(G,{outputDir:A,segmentDuration:_,width:F.width,height:F.height,videoBitrate:F.bitrate,audioBitrate:F.audioBitrate,playlistName:F.label});if(R)H.push({quality:F,url:`${X}/${W}-${K}-hls/${F.label}/${w}`,path:N}),O+=R.segmentCount||Math.ceil(j/_)}catch(R){console.warn(`[stx-media] Failed to generate HLS for ${F.label}: ${R}`)}}if(H.length===0)return null;let V=a6(U,"master.m3u8"),L=SS(H,X,W,K);return await wO(V,L),{manifestUrl:`${X}/${W}-${K}-hls/master.m3u8`,manifestPath:V,playlists:H,segmentCount:O,duration:j}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function SS($,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(`
|
|
11974
|
+
`)}async function H5($,Z,Y,X,J){let Q=await NO();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=VO($);if(!await X1(G))return null;let K=await Y1(G),W=FO($,AO($)),U=a6(Y,`${W}-${K}-dash`);await iY(U,{recursive:!0});let z=Z.length>0?Z:RO,_=J?.segmentDuration||4,B=J?.minBufferTime||2,H=(await new Q.Input(G).getInfo()).duration||0,O=[],V=[];for(let w of z){let N=a6(U,w.label);await iY(N,{recursive:!0});try{if(await Q.generateDASH(G,{outputDir:N,segmentDuration:_,width:w.width,height:w.height,videoBitrate:w.bitrate,audioBitrate:w.audioBitrate})){if(O.push({bandwidth:w.bitrate,width:w.width,height:w.height||Math.round(w.width*9/16),url:`${X}/${W}-${K}-dash/${w.label}/video`}),w.audioBitrate)V.push({bandwidth:w.audioBitrate,url:`${X}/${W}-${K}-dash/${w.label}/audio`})}}catch(R){console.warn(`[stx-media] Failed to generate DASH for ${w.label}: ${R}`)}}if(O.length===0)return null;let L=a6(U,"manifest.mpd"),F=CS(O,V,H,_,B);await wO(L,F);let A=[{type:"video",representations:O}];if(V.length>0)A.push({type:"audio",representations:V});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 CS($,Z,Y,X,J){let Q=LO(Y),G=LO(J),K=`<?xml version="1.0" encoding="UTF-8"?>
|
|
11975
11975
|
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
|
|
11976
11976
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
11977
11977
|
xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
|
|
@@ -11997,7 +11997,7 @@ ${w.join(`
|
|
|
11997
11997
|
</Representation>
|
|
11998
11998
|
`}K+=` </AdaptationSet>
|
|
11999
11999
|
`}return K+=` </Period>
|
|
12000
|
-
</MPD>`,K}function LO($){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 RO;var qG=D(()=>{z6();RO=[{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 MO,basename as bS,extname as PS,join as yS}from"path";import{mkdir as xS}from"fs/promises";async function TO(){try{return await import("ts-videos")}catch{return null}}function vS($){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 fS($){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 L8($){let Z=await TO();if(!Z)return null;try{let Y=MO($),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 nY($,Z,Y,X){let J=await TO();if(!J)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let Q=await z5($,Z,Y);if(Q)return Q;try{let G=MO($);if(!await X1(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",W=Y.baseUrl||"/videos";await xS(K,{recursive:!0});let U=await Y1(G),z=bS($,PS($)),_={src:$,processed:!0,hash:U};X?.({percentage:5,stage:"analyzing"}),_.metadata=await L8(G)||void 0;let B={};if(Z.quality)B.bitrate=vS(Z.quality);if(Z.platform)Object.assign(B,fS(Z.platform));if(Z.transcode)Object.assign(B,Z.transcode);if(Object.keys(B).length>0||Z.process){X?.({percentage:10,stage:"transcoding"});let q=`${z}-${U}.mp4`,j=yS(K,q);try{let H=await gS(G,j,B,J,(O)=>X?.({percentage:10+O*0.5,stage:"transcoding"}));if(H)_.transcoded={path:j,url:`${W}/${q}`,duration:H.duration,size:H.size,video:{codec:B.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:B.audioCodec||"aac",bitrate:B.audioBitrate||128000,sampleRate:B.sampleRate||48000,channels:B.channels||2}:void 0}}catch(H){_.errors=_.errors||[],_.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 B5(G,q,K,W);if(j)_.poster=j}if(Y.thumbnails?.enabled){X?.({percentage:70,stage:"generating-thumbnails"});let q=await q5(G,Y.thumbnails,K,W);if(q.length>0)_.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 j5(G,q.qualities||Y.streaming?.defaultQualities||[],K,W);if(j)_.streaming={..._.streaming,hls:j}}if(q.format==="dash"){let j=await H5(G,q.qualities||Y.streaming?.defaultQualities||[],K,W);if(j)_.streaming={..._.streaming,dash:j}}}if(Z.spriteSheet)X?.({percentage:90,stage:"generating-sprite-sheet"});return X?.({percentage:100,stage:"complete"}),await _5($,Z,_,Y),_}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function gS($,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 EO=D(()=>{z6();GG();BG();qG()});var IO={}
|
|
12000
|
+
</MPD>`,K}function LO($){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 RO;var qG=D(()=>{z6();RO=[{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 MO,basename as bS,extname as PS,join as yS}from"path";import{mkdir as xS}from"fs/promises";async function TO(){try{return await import("ts-videos")}catch{return null}}function vS($){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 fS($){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 L8($){let Z=await TO();if(!Z)return null;try{let Y=MO($),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 nY($,Z,Y,X){let J=await TO();if(!J)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let Q=await z5($,Z,Y);if(Q)return Q;try{let G=MO($);if(!await X1(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",W=Y.baseUrl||"/videos";await xS(K,{recursive:!0});let U=await Y1(G),z=bS($,PS($)),_={src:$,processed:!0,hash:U};X?.({percentage:5,stage:"analyzing"}),_.metadata=await L8(G)||void 0;let B={};if(Z.quality)B.bitrate=vS(Z.quality);if(Z.platform)Object.assign(B,fS(Z.platform));if(Z.transcode)Object.assign(B,Z.transcode);if(Object.keys(B).length>0||Z.process){X?.({percentage:10,stage:"transcoding"});let q=`${z}-${U}.mp4`,j=yS(K,q);try{let H=await gS(G,j,B,J,(O)=>X?.({percentage:10+O*0.5,stage:"transcoding"}));if(H)_.transcoded={path:j,url:`${W}/${q}`,duration:H.duration,size:H.size,video:{codec:B.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:B.audioCodec||"aac",bitrate:B.audioBitrate||128000,sampleRate:B.sampleRate||48000,channels:B.channels||2}:void 0}}catch(H){_.errors=_.errors||[],_.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 B5(G,q,K,W);if(j)_.poster=j}if(Y.thumbnails?.enabled){X?.({percentage:70,stage:"generating-thumbnails"});let q=await q5(G,Y.thumbnails,K,W);if(q.length>0)_.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 j5(G,q.qualities||Y.streaming?.defaultQualities||[],K,W);if(j)_.streaming={..._.streaming,hls:j}}if(q.format==="dash"){let j=await H5(G,q.qualities||Y.streaming?.defaultQualities||[],K,W);if(j)_.streaming={..._.streaming,dash:j}}}if(Z.spriteSheet)X?.({percentage:90,stage:"generating-sprite-sheet"});return X?.({percentage:100,stage:"complete"}),await _5($,Z,_,Y),_}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function gS($,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 EO=D(()=>{z6();GG();BG();qG()});var IO={};$0(IO,{setCachedVideoResult:()=>_5,processVideo:()=>nY,getCachedVideoResult:()=>z5,generateThumbnails:()=>q5,generateSpriteSheet:()=>pY,generatePoster:()=>B5,generateHLSManifest:()=>j5,generateDASHManifest:()=>H5,clearVideoCache:()=>lY,analyzeVideo:()=>L8,VideoProcessorCache:()=>U5});var jG=D(()=>{EO();BG();qG();GG()});async function kO(){try{return await Promise.resolve().then(() => (jG(),IO))}catch($){if(!DO)console.warn("[stx-media] Video processor not available, some features disabled:",$),DO=!0;return null}}async function O5($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return cS(X,Y)}if(Y.processedResult?.processed)return yO($,Y.processedResult,Z);let J;if(X.generatePoster&&X.src&&!$.poster)J=await pS(X,Y);let{src:Q,sources:G=[],poster:K,posterPlaceholder:W,controls:U=SO,autoplay:z=!1,muted:_=!1,loop:B=!1,preload:q=CO,playsinline:j=!0,lazy:H=!0,player:O="native",type:V,width:L,height:F,crossorigin:A,disablePictureInPicture:w=!1,disableRemotePlayback:N=!1}=$,R=J||K,E=$.class,M=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(O==="ts-video")return uS($,Z);if(V&&V!=="video")return dS(Q||"",V,$);let S=G.length>0?G:Q?[{src:Q,type:bO(Q)}]:[],k=[`id="${I}"`];if(U)k.push("controls");if(z)k.push("autoplay");if(_)k.push("muted");if(B)k.push("loop");if(j)k.push("playsinline");if(w)k.push("disablepictureinpicture");if(N)k.push("disableremoteplayback");if(A)k.push(`crossorigin="${A}"`);if(H){if(k.push(`data-preload="${q}"`),k.push('preload="none"'),R)k.push(`data-poster="${s0(R)}"`);k.push("data-stx-lazy")}else if(k.push(`preload="${q}"`),R)k.push(`poster="${s0(R)}"`);if(L)k.push(`width="${L}"`);if(F)k.push(`height="${F}"`);if(E)k.push(`class="${s0(E)}"`);if(M)k.push(`style="${s0(M)}"`);let x=S.map((g)=>{return` <source ${H?`data-src="${s0(g.src)}"`:`src="${s0(g.src)}"`} type="${g.type}"${g.media?` media="${g.media}"`:""} />`}).join(`
|
|
12001
12001
|
`),y=`<video ${k.join(" ")}>
|
|
12002
12002
|
${x}
|
|
12003
12003
|
Your browser does not support the video tag.
|
|
@@ -13650,7 +13650,7 @@ ${z}
|
|
|
13650
13650
|
customElements.define('${Z}', ${G});
|
|
13651
13651
|
`}async function FG($,Z,Y,X){if(Z.length<1)return B0("WebComponent","@webcomponent directive requires at least the tag name parameter",Q0.INVALID_DIRECTIVE_SYNTAX);let J=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[q6.join(q6.dirname(X),G,`${J}.stx`),q6.join(process.cwd(),G,`${J}.stx`),q6.join(q6.dirname(X),`${J}.stx`)],W=null;for(let _ of K)if(await J0(_)){W=await Bun.file(_).text();break}if(!W)return B0("WebComponent",`Component file not found: ${J}.stx`,Q0.FILE_NOT_FOUND);let U=dO(W,J);return`<script type="module">
|
|
13652
13652
|
${uO(U)}
|
|
13653
|
-
</script>`}var VG;var AG=D(()=>{S1();N0();VG={strategy:"attribute",attributeName:"data-v",preserveOriginal:!0}});var mO={};e(mO,{timingPlugin:()=>VC,pluginManager:()=>NG,definePlugin:()=>V5,debugPlugin:()=>LC,createVariablesPlugin:()=>FC,createFilterPlugin:()=>OC,createDirectivePlugin:()=>HC,PluginManager:()=>wG});function V5($){return $}class wG{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 HC($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function OC($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function FC($){return V5({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var NG,LC,VC;var RG=D(()=>{NG=new wG;LC=V5({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)}}),VC=V5({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 KZ={};e(KZ,{validateConfig:()=>pO,loadStxConfig:()=>g0,defineStxConfig:()=>cO,defaultConfig:()=>N1,config:()=>T1});import MG from"fs";import O1 from"path";import{loadConfigWithResult as AC}from"bunfig";function wC($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let X=O1.join(process.cwd(),"resources","views"),J=O1.join(process.cwd(),"resources","layouts");if(MG.existsSync(X)&&MG.existsSync(J))return{root:"resources",pagesDir:"views"};let Q=O1.join(process.cwd(),"resources","views","pages");if(MG.existsSync(Q))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function NC($){if(MJ($.stateDir),$.stateDir=H$(),$.cachePath=O$($.cachePath),$.build)$.build.cacheDir=O$($.build.cacheDir);if($.media?.cache)$.media.cache.directory=O$($.media.cache.directory);if($.story)$.story.outDir=O$($.story.outDir)}async function g0($){if(!$){if(F5)return F5;if(sY)return sY}let Z=$?O1.resolve($):process.cwd(),Y=lO.get(Z);if(Y)return Y;let X=(async()=>{let Q=(await AC({name:"stx",alias:"ui",cwd:Z,defaultConfig:N1,verbose:!1})).config;NC(Q);let G=wC(Q.root,Q.pagesDir);if(Q.root=G.root,Q.pagesDir=G.pagesDir,Q.root&&Q.root!=="."){let K=Q.root;if(Q.partialsDir&&!O1.isAbsolute(Q.partialsDir))Q.partialsDir=O1.join(K,Q.partialsDir);if(Q.componentsDir&&!O1.isAbsolute(Q.componentsDir))Q.componentsDir=O1.join(K,Q.componentsDir);if(Q.layoutsDir&&!O1.isAbsolute(Q.layoutsDir))Q.layoutsDir=O1.join(K,Q.layoutsDir)}if(Q.plugins&&Q.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (RG(),mO)),W=[],U=[];for(let z of Q.plugins){let _=typeof z==="string"?z:z[0],B=typeof z==="string"?{}:z[1]||{};try{let q,j;try{q=await import(_),j=O1.dirname(Z0.resolve(_))}catch{let O=O1.resolve(process.cwd(),_);q=await import(O),j=O1.dirname(O)}let H=q.default||q;if(K.register(H,Q),H.components){let O=O1.resolve(j,H.components);W.push(O)}if(H.pages){let O=O1.resolve(j,H.pages),V=B.path||"/";U.push({dir:O,prefix:V})}if(H.setup){let O={addDirective:(V)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(V)},addRoute:(V,L)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[V]=L},addMiddleware:(V)=>{Q.middleware=Q.middleware||[],Q.middleware.push(V)},pluginDir:j,config:Q};await H.setup(B,O)}console.log(`[stx] Plugin loaded: ${H.name||_}`)}catch(q){console.warn(`[stx] Failed to load plugin ${_}:`,q.message)}}Q._pluginComponentDirs=W,Q._pluginPageDirs=U}return Q})();if(lO.set(Z,X),!$)sY=X,X.then((J)=>{F5=J}).catch(()=>{});return X}function cO($){return $}function pO($){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 N1,F5=null,lO,sY=null,T1;var n0=D(()=>{j$();r3();FJ();a3();IY();JG();OG();fO();eZ();J4();AG();N1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:I6,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:AQ,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:FG,hasEndTag:!1,description:"Include a web component in the template"},m3,l3,oZ,tZ,c3,i3,n3,p3,$z,NJ,O8,V8,...vO],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}};lO=new Map;T1=new Proxy(N1,{get($,Z){if(F5&&Z in F5)return F5[Z];if(!sY)g0().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});import RC from"fs";import TG from"path";import{createHighlighter as MC}from"ts-syntax-highlighter";async function I4($,Z={}){try{if(!await J0($))throw Error(`Markdown file not found: ${$}`);let X=(await RC.promises.stat($)).mtime.getTime();if(Z.cache&&tY.has($)){let _=tY.get($);if(_.updatedAt>=X)return{content:_.content,data:_.data}}let J=await Bun.file($).text(),{data:Q,content:G}=Xz(J),K=Z.markdown||T1.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},U=$7(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)U=await TC(U,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let z={content:U,data:Q||{}};if(Z.cache)tY.set($,{...z,updatedAt:X});return z}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let X=Y instanceof Error?Y.message:String(Y);return{content:T0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}async function TC($,Z,Y){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!oY)try{oY=await MC({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let J=async(K,W,U,z)=>{let _=z.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),B=U||(Y?"text":"");if(!B)return K;try{if(!oY.getSupportedLanguages().includes(B))return K;return(await oY.highlight(_,B,{theme:Z})).html}catch(q){console.error(`Error highlighting code block with language ${U}:`,q)}return K},Q=$,G=$.matchAll(X);for(let K of G){let[W,U,z,_]=K,B=await J(W,U,z,_);Q=Q.replace(W,B)}return Q}async function qQ($,Z,Y="",X={}){return await EC($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,W,U)=>{try{let z=K;if(!TG.isAbsolute(K))z=TG.resolve(TG.dirname(Y),K);let _={};if(W)try{try{_=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 F of L){let A=F.indexOf(":");if(A>0){let w=F.substring(0,A).trim(),N=F.substring(A+1).trim(),R=N.startsWith('"')&&N.endsWith('"'),E=N.startsWith("'")&&N.endsWith("'");if(R||E)N=N.substring(1,N.length-1);_[w]=N}}}}catch(V){if(X.debug)console.error("Error parsing context in @markdown-file directive:",V)}let{content:B,data:q}=await I4(z,X),j={...Z,...q,..._},H=B,O=/\{\{([^}]+)\}\}/g;return H=H.replace(O,(V,L)=>{let F=L.trim();return j[F]!==void 0?String(j[F]):V}),H}catch(z){let _=z instanceof Error?z.message:String(z);return T0("Markdown File",`Error including markdown file: ${_}`,Y,$,U,G)}})}async function EC($,Z,Y){let X=[],J;while((J=Z.exec($))!==null){let K=J[0],W=J.index,U=J;X.push(Y(...U).then((z)=>({match:K,replacement:z,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 tY,oY=null;var s$=D(()=>{n0();N0();tY=new Map});function eY(){return`
|
|
13653
|
+
</script>`}var VG;var AG=D(()=>{S1();N0();VG={strategy:"attribute",attributeName:"data-v",preserveOriginal:!0}});var mO={};$0(mO,{timingPlugin:()=>VC,pluginManager:()=>NG,definePlugin:()=>V5,debugPlugin:()=>LC,createVariablesPlugin:()=>FC,createFilterPlugin:()=>OC,createDirectivePlugin:()=>HC,PluginManager:()=>wG});function V5($){return $}class wG{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 HC($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function OC($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function FC($){return V5({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var NG,LC,VC;var RG=D(()=>{NG=new wG;LC=V5({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)}}),VC=V5({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 KZ={};$0(KZ,{validateConfig:()=>pO,loadStxConfig:()=>g0,defineStxConfig:()=>cO,defaultConfig:()=>N1,config:()=>T1});import MG from"fs";import O1 from"path";import{loadConfigWithResult as AC}from"bunfig";function wC($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let X=O1.join(process.cwd(),"resources","views"),J=O1.join(process.cwd(),"resources","layouts");if(MG.existsSync(X)&&MG.existsSync(J))return{root:"resources",pagesDir:"views"};let Q=O1.join(process.cwd(),"resources","views","pages");if(MG.existsSync(Q))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function NC($){if(MJ($.stateDir),$.stateDir=H$(),$.cachePath=O$($.cachePath),$.build)$.build.cacheDir=O$($.build.cacheDir);if($.media?.cache)$.media.cache.directory=O$($.media.cache.directory);if($.story)$.story.outDir=O$($.story.outDir)}async function g0($){if(!$){if(F5)return F5;if(sY)return sY}let Z=$?O1.resolve($):process.cwd(),Y=lO.get(Z);if(Y)return Y;let X=(async()=>{let Q=(await AC({name:"stx",alias:"ui",cwd:Z,defaultConfig:N1,verbose:!1})).config;NC(Q);let G=wC(Q.root,Q.pagesDir);if(Q.root=G.root,Q.pagesDir=G.pagesDir,Q.root&&Q.root!=="."){let K=Q.root;if(Q.partialsDir&&!O1.isAbsolute(Q.partialsDir))Q.partialsDir=O1.join(K,Q.partialsDir);if(Q.componentsDir&&!O1.isAbsolute(Q.componentsDir))Q.componentsDir=O1.join(K,Q.componentsDir);if(Q.layoutsDir&&!O1.isAbsolute(Q.layoutsDir))Q.layoutsDir=O1.join(K,Q.layoutsDir)}if(Q.plugins&&Q.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (RG(),mO)),W=[],U=[];for(let z of Q.plugins){let _=typeof z==="string"?z:z[0],B=typeof z==="string"?{}:z[1]||{};try{let q,j;try{q=await import(_),j=O1.dirname(Z0.resolve(_))}catch{let O=O1.resolve(process.cwd(),_);q=await import(O),j=O1.dirname(O)}let H=q.default||q;if(K.register(H,Q),H.components){let O=O1.resolve(j,H.components);W.push(O)}if(H.pages){let O=O1.resolve(j,H.pages),V=B.path||"/";U.push({dir:O,prefix:V})}if(H.setup){let O={addDirective:(V)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(V)},addRoute:(V,L)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[V]=L},addMiddleware:(V)=>{Q.middleware=Q.middleware||[],Q.middleware.push(V)},pluginDir:j,config:Q};await H.setup(B,O)}console.log(`[stx] Plugin loaded: ${H.name||_}`)}catch(q){console.warn(`[stx] Failed to load plugin ${_}:`,q.message)}}Q._pluginComponentDirs=W,Q._pluginPageDirs=U}return Q})();if(lO.set(Z,X),!$)sY=X,X.then((J)=>{F5=J}).catch(()=>{});return X}function cO($){return $}function pO($){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 N1,F5=null,lO,sY=null,T1;var n0=D(()=>{j$();r3();FJ();a3();IY();JG();OG();fO();eZ();J4();AG();N1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:k6,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:AQ,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:FG,hasEndTag:!1,description:"Include a web component in the template"},m3,l3,oZ,tZ,c3,i3,n3,p3,$z,NJ,O8,V8,...vO],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}};lO=new Map;T1=new Proxy(N1,{get($,Z){if(F5&&Z in F5)return F5[Z];if(!sY)g0().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});import RC from"fs";import TG from"path";import{createHighlighter as MC}from"ts-syntax-highlighter";async function I4($,Z={}){try{if(!await J0($))throw Error(`Markdown file not found: ${$}`);let X=(await RC.promises.stat($)).mtime.getTime();if(Z.cache&&tY.has($)){let _=tY.get($);if(_.updatedAt>=X)return{content:_.content,data:_.data}}let J=await Bun.file($).text(),{data:Q,content:G}=Xz(J),K=Z.markdown||T1.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},U=$7(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)U=await TC(U,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let z={content:U,data:Q||{}};if(Z.cache)tY.set($,{...z,updatedAt:X});return z}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let X=Y instanceof Error?Y.message:String(Y);return{content:T0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}async function TC($,Z,Y){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!oY)try{oY=await MC({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let J=async(K,W,U,z)=>{let _=z.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),B=U||(Y?"text":"");if(!B)return K;try{if(!oY.getSupportedLanguages().includes(B))return K;return(await oY.highlight(_,B,{theme:Z})).html}catch(q){console.error(`Error highlighting code block with language ${U}:`,q)}return K},Q=$,G=$.matchAll(X);for(let K of G){let[W,U,z,_]=K,B=await J(W,U,z,_);Q=Q.replace(W,B)}return Q}async function qQ($,Z,Y="",X={}){return await EC($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,W,U)=>{try{let z=K;if(!TG.isAbsolute(K))z=TG.resolve(TG.dirname(Y),K);let _={};if(W)try{try{_=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 F of L){let A=F.indexOf(":");if(A>0){let w=F.substring(0,A).trim(),N=F.substring(A+1).trim(),R=N.startsWith('"')&&N.endsWith('"'),E=N.startsWith("'")&&N.endsWith("'");if(R||E)N=N.substring(1,N.length-1);_[w]=N}}}}catch(V){if(X.debug)console.error("Error parsing context in @markdown-file directive:",V)}let{content:B,data:q}=await I4(z,X),j={...Z,...q,..._},H=B,O=/\{\{([^}]+)\}\}/g;return H=H.replace(O,(V,L)=>{let F=L.trim();return j[F]!==void 0?String(j[F]):V}),H}catch(z){let _=z instanceof Error?z.message:String(z);return T0("Markdown File",`Error including markdown file: ${_}`,Y,$,U,G)}})}async function EC($,Z,Y){let X=[],J;while((J=Z.exec($))!==null){let K=J[0],W=J.index,U=J;X.push(Y(...U).then((z)=>({match:K,replacement:z,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 tY,oY=null;var s$=D(()=>{n0();N0();tY=new Map});function eY(){return`
|
|
13654
13654
|
/* Theme selector for code blocks */
|
|
13655
13655
|
.theme-selector {
|
|
13656
13656
|
margin: 1rem 0;
|
|
@@ -14098,7 +14098,7 @@ else {
|
|
|
14098
14098
|
</script>
|
|
14099
14099
|
`}function H4($,Z,Y={}){let X=tO(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 A8($){let Z=$.toLowerCase();return Z.endsWith(".css")||Z.endsWith(".scss")||Z.endsWith(".sass")||Z.endsWith(".less")}function w8($){let Z=$.toLowerCase();return[".stx",".html",".htm",".md",".js",".ts",".jsx",".tsx",".json"].some((X)=>Z.endsWith(X))}function N8($){return[/^\./,/node_modules/,/\.stx\/output/,/\.stx\/cache/,/~$/,/\.swp$/,/\.swo$/].some((Y)=>Y.test($))}function R8($){if(!N5)N5=new kG($);return N5}function R5(){if(N5)N5.stop(),N5=null}var N5=null;function M8($){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"},U;if(G.rawBody)W["Content-Type"]=G.contentType||"application/octet-stream",U=G.rawBody;else if(G.body)W["Content-Type"]="application/json",U=JSON.stringify(G.body);let z=await fetch(K,{method:J,headers:W,body:U});if(!z.ok){let B=Error(`Netlify API error: ${z.status} ${z.statusText}`);B.status=z.status;try{let q=await z.json();B.message=q.message||B.message,B.code=q.code,B.details=q}catch{}throw B}let _=await z.text();if(!_)return{};return JSON.parse(_)}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 z=K.shift();if(z)await this.uploadFile(J,z.path,z.content)}},U=Array.from({length:Math.min(5,Q.length)},()=>W());await Promise.all(U)},async getDeploy(J){return X("GET",`/deploys/${J}`)},async waitForDeploy(J,Q={}){let{timeout:G=300000,pollInterval:K=2000,onProgress:W}=Q,U=Date.now();while(!0){let z=await this.getDeploy(J);if(W)W(z);if(z.state==="ready")return z;if(z.state==="error"){let _=Error(`Deploy failed: ${z.error_message||"Unknown error"}`);throw _.status=500,_.details=z,_}if(Date.now()-U>G){let _=Error(`Deploy timed out after ${G}ms`);throw _.status=408,_.details=z,_}await new Promise((_)=>setTimeout(_,K))}},async lockDeploy(J){return X("POST",`/deploys/${J}/lock`)},async unlockDeploy(J){return X("POST",`/deploys/${J}/unlock`)}}}async function QX($){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 M5($,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((_)=>{if(_.includes("*"))return new RegExp(`^${_.replace(/\*/g,".*")}$`).test(Q);return Q.includes(_)}))continue;let K=`${$}/${Q}`,U=await Bun.file(K).arrayBuffer(),z=await QX(U);X.push({path:Q,content:new Uint8Array(U),sha1:z})}return X}function T8($){let Z={};for(let Y of $)Z[`/${Y.path}`]=Y.sha1;return Z}function E8($,Z){let Y=new Set(Z.map((X)=>X.startsWith("/")?X.slice(1):X));return $.filter((X)=>Y.has(X.path))}function O6($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;if($<1073741824)return`${($/1048576).toFixed(1)} MB`;return`${($/1073741824).toFixed(1)} GB`}function D4($){return $.reduce((Z,Y)=>Z+Y.content.byteLength,0)}import k4 from"fs";import O4 from"path";function GX($){let Z=[];if(Z.push("[build]"),Z.push(` command = "${o0($.build.command)}"`),Z.push(` publish = "${o0($.build.publish)}"`),$.build.functions)Z.push(` functions = "${o0($.build.functions)}"`);if($.build.edge_functions)Z.push(` edge_functions = "${o0($.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} = "${o0(X)}"`)}if($.functions){if(Z.push(""),Z.push("[functions]"),$.functions.directory)Z.push(` directory = "${o0($.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 = "${o0(Y.function)}"`),Z.push(` path = "${o0(Y.path)}"`)}if($.redirects&&$.redirects.length>0){Z.push("");for(let Y of $.redirects){if(Z.push("[[redirects]]"),Z.push(` from = "${o0(Y.from)}"`),Z.push(` to = "${o0(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} = "${o0(J)}"`)}}}if($.headers&&$.headers.length>0){Z.push("");for(let Y of $.headers){Z.push("[[headers]]"),Z.push(` for = "${o0(Y.for)}"`),Z.push(" [headers.values]");for(let[X,J]of Object.entries(Y.values))Z.push(` ${X} = "${o0(J)}"`)}}if($.plugins&&$.plugins.length>0){Z.push("");for(let Y of $.plugins)if(Z.push("[[plugins]]"),Z.push(` package = "${o0(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} = "${o0(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 = "${o0(X.command)}"`);if(X.publish)Z.push(` publish = "${o0(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} = "${o0(Q)}"`)}}return Z.join(`
|
|
14100
14100
|
`)+`
|
|
14101
|
-
`}function o0($){return $.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}async function T5($){let Z={framework:"stx",buildCommand:"bun run build",outputDir:"dist"},Y=O4.join($,"package.json");if(await Bun.file(Y).exists())try{let U=JSON.parse(await Bun.file(Y).text());if(U.scripts?.build)Z.buildCommand="bun run build";let z={...U.dependencies,...U.devDependencies};if(z["@stacksjs/stx"]||z.stx)Z.framework="stx"}catch{}let X=O4.join($,"stx.config.ts"),J=O4.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 U of Q){let z=O4.join($,U);if(k4.existsSync(z)&&k4.statSync(z).isDirectory()){Z.outputDir=U;break}}let G=["functions","netlify/functions","api"];for(let U of G){let z=O4.join($,U);if(k4.existsSync(z)&&k4.statSync(z).isDirectory()){Z.functionsDir=U;break}}let K=O4.join($,"netlify","edge-functions");if(k4.existsSync(K))Z.edgeFunctionsDir="netlify/edge-functions";let W=O4.join($,Z.outputDir||"dist");if(k4.existsSync(W)){let U=k4.existsSync(O4.join(W,"index.html")),z=k4.readdirSync(W).filter((_)=>_.endsWith(".html"));Z.isSPA=U&&z.length===1}return Z}function E5($={}){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 I8($,Z){let Y=await T5($),X=Z||E5(Y),J=GX(X),Q=O4.join($,"netlify.toml");return await Bun.write(Q,J),Q}function D8($){return k4.existsSync(O4.join($,"netlify.toml"))}var SG=()=>{};var ZL={}
|
|
14101
|
+
`}function o0($){return $.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}async function T5($){let Z={framework:"stx",buildCommand:"bun run build",outputDir:"dist"},Y=O4.join($,"package.json");if(await Bun.file(Y).exists())try{let U=JSON.parse(await Bun.file(Y).text());if(U.scripts?.build)Z.buildCommand="bun run build";let z={...U.dependencies,...U.devDependencies};if(z["@stacksjs/stx"]||z.stx)Z.framework="stx"}catch{}let X=O4.join($,"stx.config.ts"),J=O4.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 U of Q){let z=O4.join($,U);if(k4.existsSync(z)&&k4.statSync(z).isDirectory()){Z.outputDir=U;break}}let G=["functions","netlify/functions","api"];for(let U of G){let z=O4.join($,U);if(k4.existsSync(z)&&k4.statSync(z).isDirectory()){Z.functionsDir=U;break}}let K=O4.join($,"netlify","edge-functions");if(k4.existsSync(K))Z.edgeFunctionsDir="netlify/edge-functions";let W=O4.join($,Z.outputDir||"dist");if(k4.existsSync(W)){let U=k4.existsSync(O4.join(W,"index.html")),z=k4.readdirSync(W).filter((_)=>_.endsWith(".html"));Z.isSPA=U&&z.length===1}return Z}function E5($={}){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 I8($,Z){let Y=await T5($),X=Z||E5(Y),J=GX(X),Q=O4.join($,"netlify.toml");return await Bun.write(Q,J),Q}function D8($){return k4.existsSync(O4.join($,"netlify.toml"))}var SG=()=>{};var ZL={};$0(ZL,{writeNetlifyConfig:()=>I8,initNetlify:()=>$L,hasNetlifyConfig:()=>D8,getTotalSize:()=>D4,generateNetlifyToml:()=>GX,formatSize:()=>O6,filterRequiredFiles:()=>E8,detectProjectConfig:()=>T5,deploy:()=>eO,createNetlifyClient:()=>M8,createFileManifest:()=>T8,createDefaultNetlifyConfig:()=>E5,collectDeployFiles:()=>M5,calculateSha1:()=>QX,DeployError:()=>S4});import CG from"fs";import bG from"path";async function eO($={}){let Z=Date.now(),Y=[],X=$.cwd||process.cwd(),J=(L)=>{Y.push(L)},Q=(L)=>{if($.onProgress)$.onProgress(L)},G=bG.resolve(X,$.directory||"dist"),K=$.token||process.env.NETLIFY_AUTH_TOKEN,W=$.siteId||process.env.NETLIFY_SITE_ID;if(!K)throw new S4(`No Netlify auth token found.
|
|
14102
14102
|
|
|
14103
14103
|
To deploy to Netlify:
|
|
14104
14104
|
1. Create account at https://app.netlify.com
|
|
@@ -14123,7 +14123,7 @@ Check your site ID or create a new site at https://app.netlify.com`,"SITE_NOT_FO
|
|
|
14123
14123
|
`),J&&!J.endsWith(`
|
|
14124
14124
|
`))J+=`
|
|
14125
14125
|
`}J+=`NETLIFY_SITE_ID=${$.siteId}
|
|
14126
|
-
`,await Bun.write(X,J)}return{configPath:Y,siteId:$.siteId}}function vC($){let Z=process.platform,Y=Z==="darwin"?"open":Z==="win32"?"start":"xdg-open";Bun.spawn([Y,$],{stdio:["ignore","ignore","ignore"]})}var S4;var KX=D(()=>{SG();SG();S4=class S4 extends Error{code;constructor($,Z){super($);this.name="DeployError",this.code=Z}}});var GL={};e(GL,{resizeAndConvert:()=>QL,processImage:()=>o1,isSharpAvailable:()=>D5,isImageFile:()=>k5,isImageBackendAvailable:()=>s1,groupVariantsByFormat:()=>o6,getTotalSize:()=>k8,getMimeType:()=>v1,getImageMetadata:()=>r6,getFallbackVariant:()=>s6,generateSrcSet:()=>L6,generateSizes:()=>a6,formatSize:()=>S8,ImageProcessingError:()=>t6,DEFAULT_WIDTHS:()=>P1,DEFAULT_QUALITY:()=>x1,DEFAULT_FORMATS:()=>y1});import yG from"fs";import I5 from"path";import XL from"os";import xG from"crypto";import{generatePlaceholder as fC,processImage as gC}from"ts-images";async function WX(){if(YL)return PG;YL=!0;try{let $=await import("sharp");return PG=$.default||$,PG}catch{return null}}async function D5(){return await WX()!==null}async function s1(){return!0}async function o1($,Z={}){let{widths:Y=P1,formats:X=y1,quality:J=x1,fit:Q="cover",placeholder:G="none",outputDir:K=".stx/images",baseUrl:W="/images"}=Z,U,z;if(typeof $==="string"){if(z=$,!await Bun.file($).exists())throw new t6(`Image not found: ${$}`,"NOT_FOUND");U=await Bun.file($).arrayBuffer().then((A)=>Buffer.from(A))}else z="buffer-input",U=$;let _=xG.createHash("sha256").update(U).digest("hex").slice(0,12),B=await r6(U),{width:q,height:j}=B,H=q/j;await yG.promises.mkdir(K,{recursive:!0});let O=[],V=I5.basename(z,I5.extname(z)),L=Y.filter((A)=>A<=q);if(!L.includes(q)&&q<=Math.max(...Y))L.push(q);L.sort((A,w)=>A-w);for(let A of L){let w=Math.round(A/H);for(let N of X){let R=`${V}-${A}w-${_}.${N}`,E=I5.join(K,R),M=`${W}/${R}`,I=await QL(U,{width:A,height:w,format:N,quality:J,fit:Q});await Bun.write(E,I),O.push({path:E,url:M,width:A,height:w,format:N,size:I.length})}}let F;if(G!=="none")F=await uC(U,G);return{src:z,variants:O,placeholder:F,width:q,height:j,aspectRatio:H,hash:_}}async function r6($){let Z=typeof $==="string"?Buffer.from(await Bun.file($).arrayBuffer()):$,Y=await WX();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 dC(Z)}function dC($){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 t6("Unable to parse image dimensions","PARSE_ERROR")}async function QL($,Z){let Y=await WX();if(Y){let J=Y($).resize(Z.width,Z.height,{fit:Z.fit});switch(Z.format){case"webp":J=J.webp({quality:Z.quality});break;case"avif":J=J.avif({quality:Z.quality});break;case"jpeg":J=J.jpeg({quality:Z.quality});break;case"png":J=J.png({quality:Z.quality});break}return J.toBuffer()}let X=I5.join(XL.tmpdir(),`stx-img-${xG.randomBytes(8).toString("hex")}.${Z.format}`);try{return await gC({input:$,output:X,format:Z.format,quality:Z.quality,resize:{width:Z.width,height:Z.height,fit:Z.fit}}),Buffer.from(await Bun.file(X).arrayBuffer())}finally{await yG.promises.unlink(X).catch(()=>{})}}async function uC($,Z){let Y=await WX();if(Z==="blur"&&Y){let G=(await Y($).resize(20).blur(10).toBuffer()).toString("base64"),K=await r6($);return`data:${JL[K.format]||"image/jpeg"};base64,${G}`}if(Z==="dominant-color"&&Y){let{dominant:Q}=await Y($).resize(1,1).toBuffer().then(async(G)=>{let K=await Y(G).metadata();return{dominant:{r:128,g:128,b:128}}}).catch(()=>({dominant:{r:128,g:128,b:128}}));return`rgb(${Q.r}, ${Q.g}, ${Q.b})`}let X=await r6($),J=I5.join(XL.tmpdir(),`stx-ph-${xG.randomBytes(8).toString("hex")}.${X.format==="unknown"?"bin":X.format}`);try{await Bun.write(J,$);let Q=Z==="blur"?"blur":Z==="thumbhash"?"thumbhash":"dominant-color",K=await fC(J,{strategy:Q,width:Q==="thumbhash"?void 0:32});if(Z==="dominant-color"&&K.dominantColor)return K.dominantColor;if(K.dataURL)return K.dataURL;return"rgb(128, 128, 128)"}catch{return"rgb(128, 128, 128)"}finally{await yG.promises.unlink(J).catch(()=>{})}}function L6($,Z){return(Z?$.filter((X)=>X.format===Z):$).sort((X,J)=>X.width-J.width).map((X)=>`${X.url} ${X.width}w`).join(", ")}function a6($){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 s6($){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 o6($){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 k5($){let Z=I5.extname($).toLowerCase();return hC.includes(Z)}function v1($){return JL[$]||"application/octet-stream"}function k8($){return $.reduce((Z,Y)=>Z+Y.size,0)}function S8($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1048576).toFixed(2)} MB`}var P1,y1,x1=80,hC,JL,PG=null,YL=!1,t6;var e6=D(()=>{P1=[320,640,768,1024,1280,1536,1920],y1=["webp","jpeg"],hC=[".jpg",".jpeg",".png",".webp",".avif",".gif",".svg"],JL={webp:"image/webp",avif:"image/avif",jpeg:"image/jpeg",png:"image/png"};t6=class t6 extends Error{code;constructor($,Z){super($);this.name="ImageProcessingError",this.code=Z}}});var _L={};e(_L,{handleImageRequest:()=>b8,createImageHandler:()=>UX});import KL from"fs";import C8 from"path";import mC from"crypto";async function b8($,Z){let Y=Z.routePath??"/_stx/img",X=new URL($.url);if(X.pathname!==Y)return null;let J=iC(X,Z);if(!J.ok)return new Response(J.error,{status:J.status,headers:{"Content-Type":"text/plain"}});let{srcFsPath:Q,srcUrl:G,width:K,height:W,format:U,quality:z,fit:_}=J,B;try{B=KL.statSync(Q)}catch{return new Response(`Source image not found: ${G}`,{status:404,headers:{"Content-Type":"text/plain"}})}if(!B.isFile())return new Response("Not a file",{status:404,headers:{"Content-Type":"text/plain"}});let q=Z.cacheDir??".stx/cache/img";await KL.promises.mkdir(q,{recursive:!0});let j=`${Q}:${B.mtimeMs}:${B.size}`,H=`${K}x${W}:${U}:${z}:${_}`,O=mC.createHash("sha256").update(`${j}|${H}`).digest("hex").slice(0,16),V=C8.join(q,`${O}.${U}`),F={"Content-Type":v1(U),"Cache-Control":"public, max-age=31536000, immutable",ETag:`"${O}"`,"X-Stx-Image-Cache":"HIT"};if($.headers.get("if-none-match")===`"${O}"`)return new Response(null,{status:304,headers:F});let A=Bun.file(V);if(await A.exists())return new Response(A,{headers:F});try{let w=Buffer.from(await Bun.file(Q).arrayBuffer()),{resizeAndConvert:N}=await nC(),R=await N(w,{width:K,height:W,format:U,quality:z,fit:_});return await Bun.write(V,R),F["X-Stx-Image-Cache"]="MISS",new Response(new Uint8Array(R),{headers:F})}catch(w){let N=w.message;return new Response(`Image processing failed: ${N}`,{status:500,headers:{"Content-Type":"text/plain"}})}}function UX($){return async(Z)=>{return await b8(Z,$)??new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain"}})}}function iC($,Z){let Y=$.searchParams.get("src");if(!Y)return{ok:!1,error:"Missing required param: src",status:400};if(!Y.startsWith("/"))return{ok:!1,error:"src must be an absolute URL path (start with /)",status:400};if(Y.startsWith("//"))return{ok:!1,error:"src must be a local path",status:400};let X=C8.extname(Y).toLowerCase();if(!lC.has(X))return{ok:!1,error:`Unsupported source extension: ${X}`,status:400};let J=C8.resolve(Z.publicDir),Q=C8.resolve(J,Y.slice(1));if(!Q.startsWith(`${J}${C8.sep}`)&&Q!==J)return{ok:!1,error:"src is outside publicDir",status:400};let G=Z.maxWidth??zL,K=Z.maxHeight??zL,W=$.searchParams.get("w"),U=$.searchParams.get("h"),z=W?Number.parseInt(W,10):0,_=U?Number.parseInt(U,10):0;if(W&&(!Number.isFinite(z)||z<=0))return{ok:!1,error:"Invalid w (must be positive integer)",status:400};if(U&&(!Number.isFinite(_)||_<=0))return{ok:!1,error:"Invalid h (must be positive integer)",status:400};if(!W&&!U)return{ok:!1,error:"At least one of w or h is required",status:400};let B=Math.min(z||G,G),q=Math.min(_||K,K),j=$.searchParams.get("f")||"webp";if(!WL.has(j))return{ok:!1,error:`Invalid f (must be one of: ${[...WL].join(", ")})`,status:400};let H=j,O=$.searchParams.get("q"),V=O?Number.parseInt(O,10):Z.defaultQuality??cC;if(!Number.isFinite(V)||V<1||V>100)return{ok:!1,error:"Invalid q (must be 1-100)",status:400};let L=$.searchParams.get("fit")||Z.defaultFit||pC;if(!UL.has(L))return{ok:!1,error:`Invalid fit (must be one of: ${[...UL].join(", ")})`,status:400};return{ok:!0,srcFsPath:Q,srcUrl:Y,width:B,height:q,format:H,quality:V,fit:L}}async function nC(){return await Promise.resolve().then(() => (e6(),GL))}var WL,UL,lC,zL=4096,cC=80,pC="cover";var vG=D(()=>{e6();WL=new Set(["webp","avif","jpeg","png"]),UL=new Set(["cover","contain","fill","inside","outside"]),lC=new Set([".jpg",".jpeg",".png",".webp",".avif",".gif"])});function fG($,Z={}){let{src:Y,alt:X,width:J,height:Q,sizes:G="100vw",loading:K="lazy",priority:W=!1,quality:U=x1,placeholder:z="none",formats:_=y1,widths:B=P1,decoding:q="async",fetchpriority:j,objectFit:H,objectPosition:O}=$,V=$.class,L=$.style,{processedImage:F,variants:A,optimize:w=!0,isDev:N=!1}=Z;if(A&&A.length>0)return rC($,A,F);if(N||!w)return aC($);return sC($)}function rC($,Z,Y){let{src:X,alt:J,width:Q,height:G,sizes:K="100vw",loading:W="lazy",priority:U=!1,decoding:z="async",fetchpriority:_,objectFit:B,objectPosition:q,placeholder:j="none"}=$,H=$.class,O=$.style,V=o6(Z),L=s6(Z),F=typeof K==="object"?a6(K):K,A=Y?Y.aspectRatio:Q&&G?Number(Q)/Number(G):void 0,w=[];if(A)w.push(`aspect-ratio: ${A}`);if(B)w.push(`object-fit: ${B}`);if(q)w.push(`object-position: ${q}`);if(O)w.push(O);let N=w.length>0?` style="${w.join("; ")}"`:"",R=H?` class="${H}"`:"",E=U?"":` loading="${W}"`,M=` decoding="${z}"`,I=_?` fetchpriority="${_}"`:U?' fetchpriority="high"':"",S=["avif","webp","jpeg","png"],k=[];for(let h of S){let m=V.get(h);if(m&&m.length>0){let i=L6(m),s=v1(h);k.push(` <source type="${s}" srcset="${i}" sizes="${F}" />`)}}let x="",y="",b;if(j!=="none"&&Y?.placeholder){let h=`img-${Math.random().toString(36).slice(2,8)}`;if(x=`<div class="stx-image-wrapper" id="${h}">`,y="</div>",j==="blur")b=`
|
|
14126
|
+
`,await Bun.write(X,J)}return{configPath:Y,siteId:$.siteId}}function vC($){let Z=process.platform,Y=Z==="darwin"?"open":Z==="win32"?"start":"xdg-open";Bun.spawn([Y,$],{stdio:["ignore","ignore","ignore"]})}var S4;var KX=D(()=>{SG();SG();S4=class S4 extends Error{code;constructor($,Z){super($);this.name="DeployError",this.code=Z}}});var GL={};$0(GL,{resizeAndConvert:()=>QL,processImage:()=>o1,isSharpAvailable:()=>D5,isImageFile:()=>k5,isImageBackendAvailable:()=>s1,groupVariantsByFormat:()=>e6,getTotalSize:()=>k8,getMimeType:()=>v1,getImageMetadata:()=>s6,getFallbackVariant:()=>t6,generateSrcSet:()=>L6,generateSizes:()=>o6,formatSize:()=>S8,ImageProcessingError:()=>$$,DEFAULT_WIDTHS:()=>P1,DEFAULT_QUALITY:()=>x1,DEFAULT_FORMATS:()=>y1});import yG from"fs";import I5 from"path";import XL from"os";import xG from"crypto";import{generatePlaceholder as fC,processImage as gC}from"ts-images";async function WX(){if(YL)return PG;YL=!0;try{let $=await import("sharp");return PG=$.default||$,PG}catch{return null}}async function D5(){return await WX()!==null}async function s1(){return!0}async function o1($,Z={}){let{widths:Y=P1,formats:X=y1,quality:J=x1,fit:Q="cover",placeholder:G="none",outputDir:K=".stx/images",baseUrl:W="/images"}=Z,U,z;if(typeof $==="string"){if(z=$,!await Bun.file($).exists())throw new $$(`Image not found: ${$}`,"NOT_FOUND");U=await Bun.file($).arrayBuffer().then((A)=>Buffer.from(A))}else z="buffer-input",U=$;let _=xG.createHash("sha256").update(U).digest("hex").slice(0,12),B=await s6(U),{width:q,height:j}=B,H=q/j;await yG.promises.mkdir(K,{recursive:!0});let O=[],V=I5.basename(z,I5.extname(z)),L=Y.filter((A)=>A<=q);if(!L.includes(q)&&q<=Math.max(...Y))L.push(q);L.sort((A,w)=>A-w);for(let A of L){let w=Math.round(A/H);for(let N of X){let R=`${V}-${A}w-${_}.${N}`,E=I5.join(K,R),M=`${W}/${R}`,I=await QL(U,{width:A,height:w,format:N,quality:J,fit:Q});await Bun.write(E,I),O.push({path:E,url:M,width:A,height:w,format:N,size:I.length})}}let F;if(G!=="none")F=await uC(U,G);return{src:z,variants:O,placeholder:F,width:q,height:j,aspectRatio:H,hash:_}}async function s6($){let Z=typeof $==="string"?Buffer.from(await Bun.file($).arrayBuffer()):$,Y=await WX();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 dC(Z)}function dC($){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 $$("Unable to parse image dimensions","PARSE_ERROR")}async function QL($,Z){let Y=await WX();if(Y){let J=Y($).resize(Z.width,Z.height,{fit:Z.fit});switch(Z.format){case"webp":J=J.webp({quality:Z.quality});break;case"avif":J=J.avif({quality:Z.quality});break;case"jpeg":J=J.jpeg({quality:Z.quality});break;case"png":J=J.png({quality:Z.quality});break}return J.toBuffer()}let X=I5.join(XL.tmpdir(),`stx-img-${xG.randomBytes(8).toString("hex")}.${Z.format}`);try{return await gC({input:$,output:X,format:Z.format,quality:Z.quality,resize:{width:Z.width,height:Z.height,fit:Z.fit}}),Buffer.from(await Bun.file(X).arrayBuffer())}finally{await yG.promises.unlink(X).catch(()=>{})}}async function uC($,Z){let Y=await WX();if(Z==="blur"&&Y){let G=(await Y($).resize(20).blur(10).toBuffer()).toString("base64"),K=await s6($);return`data:${JL[K.format]||"image/jpeg"};base64,${G}`}if(Z==="dominant-color"&&Y){let{dominant:Q}=await Y($).resize(1,1).toBuffer().then(async(G)=>{let K=await Y(G).metadata();return{dominant:{r:128,g:128,b:128}}}).catch(()=>({dominant:{r:128,g:128,b:128}}));return`rgb(${Q.r}, ${Q.g}, ${Q.b})`}let X=await s6($),J=I5.join(XL.tmpdir(),`stx-ph-${xG.randomBytes(8).toString("hex")}.${X.format==="unknown"?"bin":X.format}`);try{await Bun.write(J,$);let Q=Z==="blur"?"blur":Z==="thumbhash"?"thumbhash":"dominant-color",K=await fC(J,{strategy:Q,width:Q==="thumbhash"?void 0:32});if(Z==="dominant-color"&&K.dominantColor)return K.dominantColor;if(K.dataURL)return K.dataURL;return"rgb(128, 128, 128)"}catch{return"rgb(128, 128, 128)"}finally{await yG.promises.unlink(J).catch(()=>{})}}function L6($,Z){return(Z?$.filter((X)=>X.format===Z):$).sort((X,J)=>X.width-J.width).map((X)=>`${X.url} ${X.width}w`).join(", ")}function o6($){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 t6($){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 e6($){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 k5($){let Z=I5.extname($).toLowerCase();return hC.includes(Z)}function v1($){return JL[$]||"application/octet-stream"}function k8($){return $.reduce((Z,Y)=>Z+Y.size,0)}function S8($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1048576).toFixed(2)} MB`}var P1,y1,x1=80,hC,JL,PG=null,YL=!1,$$;var Z$=D(()=>{P1=[320,640,768,1024,1280,1536,1920],y1=["webp","jpeg"],hC=[".jpg",".jpeg",".png",".webp",".avif",".gif",".svg"],JL={webp:"image/webp",avif:"image/avif",jpeg:"image/jpeg",png:"image/png"};$$=class $$ extends Error{code;constructor($,Z){super($);this.name="ImageProcessingError",this.code=Z}}});var _L={};$0(_L,{handleImageRequest:()=>b8,createImageHandler:()=>UX});import KL from"fs";import C8 from"path";import mC from"crypto";async function b8($,Z){let Y=Z.routePath??"/_stx/img",X=new URL($.url);if(X.pathname!==Y)return null;let J=iC(X,Z);if(!J.ok)return new Response(J.error,{status:J.status,headers:{"Content-Type":"text/plain"}});let{srcFsPath:Q,srcUrl:G,width:K,height:W,format:U,quality:z,fit:_}=J,B;try{B=KL.statSync(Q)}catch{return new Response(`Source image not found: ${G}`,{status:404,headers:{"Content-Type":"text/plain"}})}if(!B.isFile())return new Response("Not a file",{status:404,headers:{"Content-Type":"text/plain"}});let q=Z.cacheDir??".stx/cache/img";await KL.promises.mkdir(q,{recursive:!0});let j=`${Q}:${B.mtimeMs}:${B.size}`,H=`${K}x${W}:${U}:${z}:${_}`,O=mC.createHash("sha256").update(`${j}|${H}`).digest("hex").slice(0,16),V=C8.join(q,`${O}.${U}`),F={"Content-Type":v1(U),"Cache-Control":"public, max-age=31536000, immutable",ETag:`"${O}"`,"X-Stx-Image-Cache":"HIT"};if($.headers.get("if-none-match")===`"${O}"`)return new Response(null,{status:304,headers:F});let A=Bun.file(V);if(await A.exists())return new Response(A,{headers:F});try{let w=Buffer.from(await Bun.file(Q).arrayBuffer()),{resizeAndConvert:N}=await nC(),R=await N(w,{width:K,height:W,format:U,quality:z,fit:_});return await Bun.write(V,R),F["X-Stx-Image-Cache"]="MISS",new Response(new Uint8Array(R),{headers:F})}catch(w){let N=w.message;return new Response(`Image processing failed: ${N}`,{status:500,headers:{"Content-Type":"text/plain"}})}}function UX($){return async(Z)=>{return await b8(Z,$)??new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain"}})}}function iC($,Z){let Y=$.searchParams.get("src");if(!Y)return{ok:!1,error:"Missing required param: src",status:400};if(!Y.startsWith("/"))return{ok:!1,error:"src must be an absolute URL path (start with /)",status:400};if(Y.startsWith("//"))return{ok:!1,error:"src must be a local path",status:400};let X=C8.extname(Y).toLowerCase();if(!lC.has(X))return{ok:!1,error:`Unsupported source extension: ${X}`,status:400};let J=C8.resolve(Z.publicDir),Q=C8.resolve(J,Y.slice(1));if(!Q.startsWith(`${J}${C8.sep}`)&&Q!==J)return{ok:!1,error:"src is outside publicDir",status:400};let G=Z.maxWidth??zL,K=Z.maxHeight??zL,W=$.searchParams.get("w"),U=$.searchParams.get("h"),z=W?Number.parseInt(W,10):0,_=U?Number.parseInt(U,10):0;if(W&&(!Number.isFinite(z)||z<=0))return{ok:!1,error:"Invalid w (must be positive integer)",status:400};if(U&&(!Number.isFinite(_)||_<=0))return{ok:!1,error:"Invalid h (must be positive integer)",status:400};if(!W&&!U)return{ok:!1,error:"At least one of w or h is required",status:400};let B=Math.min(z||G,G),q=Math.min(_||K,K),j=$.searchParams.get("f")||"webp";if(!WL.has(j))return{ok:!1,error:`Invalid f (must be one of: ${[...WL].join(", ")})`,status:400};let H=j,O=$.searchParams.get("q"),V=O?Number.parseInt(O,10):Z.defaultQuality??cC;if(!Number.isFinite(V)||V<1||V>100)return{ok:!1,error:"Invalid q (must be 1-100)",status:400};let L=$.searchParams.get("fit")||Z.defaultFit||pC;if(!UL.has(L))return{ok:!1,error:`Invalid fit (must be one of: ${[...UL].join(", ")})`,status:400};return{ok:!0,srcFsPath:Q,srcUrl:Y,width:B,height:q,format:H,quality:V,fit:L}}async function nC(){return await Promise.resolve().then(() => (Z$(),GL))}var WL,UL,lC,zL=4096,cC=80,pC="cover";var vG=D(()=>{Z$();WL=new Set(["webp","avif","jpeg","png"]),UL=new Set(["cover","contain","fill","inside","outside"]),lC=new Set([".jpg",".jpeg",".png",".webp",".avif",".gif"])});function fG($,Z={}){let{src:Y,alt:X,width:J,height:Q,sizes:G="100vw",loading:K="lazy",priority:W=!1,quality:U=x1,placeholder:z="none",formats:_=y1,widths:B=P1,decoding:q="async",fetchpriority:j,objectFit:H,objectPosition:O}=$,V=$.class,L=$.style,{processedImage:F,variants:A,optimize:w=!0,isDev:N=!1}=Z;if(A&&A.length>0)return rC($,A,F);if(N||!w)return aC($);return sC($)}function rC($,Z,Y){let{src:X,alt:J,width:Q,height:G,sizes:K="100vw",loading:W="lazy",priority:U=!1,decoding:z="async",fetchpriority:_,objectFit:B,objectPosition:q,placeholder:j="none"}=$,H=$.class,O=$.style,V=e6(Z),L=t6(Z),F=typeof K==="object"?o6(K):K,A=Y?Y.aspectRatio:Q&&G?Number(Q)/Number(G):void 0,w=[];if(A)w.push(`aspect-ratio: ${A}`);if(B)w.push(`object-fit: ${B}`);if(q)w.push(`object-position: ${q}`);if(O)w.push(O);let N=w.length>0?` style="${w.join("; ")}"`:"",R=H?` class="${H}"`:"",E=U?"":` loading="${W}"`,M=` decoding="${z}"`,I=_?` fetchpriority="${_}"`:U?' fetchpriority="high"':"",S=["avif","webp","jpeg","png"],k=[];for(let h of S){let m=V.get(h);if(m&&m.length>0){let i=L6(m),s=v1(h);k.push(` <source type="${s}" srcset="${i}" sizes="${F}" />`)}}let x="",y="",b;if(j!=="none"&&Y?.placeholder){let h=`img-${Math.random().toString(36).slice(2,8)}`;if(x=`<div class="stx-image-wrapper" id="${h}">`,y="</div>",j==="blur")b=`
|
|
14127
14127
|
#${h} {
|
|
14128
14128
|
position: relative;
|
|
14129
14129
|
background-image: url('${Y.placeholder}');
|
|
@@ -14147,14 +14147,14 @@ ${k.join(`
|
|
|
14147
14147
|
src="${L?.url||X}"
|
|
14148
14148
|
alt="${hG(J)}"${g}${r}${R}${N}${E}${M}${I}
|
|
14149
14149
|
/>
|
|
14150
|
-
</picture>${y}`,P;if(U&&L){let h=V.get("webp"),m=h?.[Math.floor(h.length/2)]||L,i=v1(m.format);P=`<link rel="preload" as="image" href="${m.url}" type="${i}" />`}return{html:c,preloadLink:P,placeholderCss:b}}function aC($){let{src:Z,alt:Y,width:X,height:J,loading:Q="lazy",decoding:G="async",priority:K=!1,fetchpriority:W,objectFit:U,objectPosition:z}=$,_=$.class,B=$.style,q=[];if(U)q.push(`object-fit: ${U}`);if(z)q.push(`object-position: ${z}`);if(B)q.push(B);let j=q.length>0?` style="${q.join("; ")}"`:"",H=_?` class="${_}"`:"",O=X?` width="${X}"`:"",V=J?` height="${J}"`:"",L=K?"":` loading="${Q}"`,F=` decoding="${G}"`,A=W?` fetchpriority="${W}"`:K?' fetchpriority="high"':"";return{html:`<img src="${Z}" alt="${hG(Y)}"${O}${V}${H}${j}${L}${F}${A} />`}}function sC($){let{src:Z,alt:Y,width:X,height:J,sizes:Q="100vw",loading:G="lazy",priority:K=!1,quality:W=x1,formats:U=y1,widths:z=P1,decoding:_="async",fetchpriority:B,objectFit:q,objectPosition:j}=$,H=$.class,O=$.style,V=[];if(q)V.push(`object-fit: ${q}`);if(j)V.push(`object-position: ${j}`);if(O)V.push(O);let L=V.length>0?` style="${V.join("; ")}"`:"",F=H?` class="${H}"`:"",A=X?` width="${X}"`:"",w=J?` height="${J}"`:"",N=K?"":` loading="${G}"`,R=` decoding="${_}"`,E=B?` fetchpriority="${B}"`:K?' fetchpriority="high"':"",M=typeof Q==="object"?
|
|
14150
|
+
</picture>${y}`,P;if(U&&L){let h=V.get("webp"),m=h?.[Math.floor(h.length/2)]||L,i=v1(m.format);P=`<link rel="preload" as="image" href="${m.url}" type="${i}" />`}return{html:c,preloadLink:P,placeholderCss:b}}function aC($){let{src:Z,alt:Y,width:X,height:J,loading:Q="lazy",decoding:G="async",priority:K=!1,fetchpriority:W,objectFit:U,objectPosition:z}=$,_=$.class,B=$.style,q=[];if(U)q.push(`object-fit: ${U}`);if(z)q.push(`object-position: ${z}`);if(B)q.push(B);let j=q.length>0?` style="${q.join("; ")}"`:"",H=_?` class="${_}"`:"",O=X?` width="${X}"`:"",V=J?` height="${J}"`:"",L=K?"":` loading="${Q}"`,F=` decoding="${G}"`,A=W?` fetchpriority="${W}"`:K?' fetchpriority="high"':"";return{html:`<img src="${Z}" alt="${hG(Y)}"${O}${V}${H}${j}${L}${F}${A} />`}}function sC($){let{src:Z,alt:Y,width:X,height:J,sizes:Q="100vw",loading:G="lazy",priority:K=!1,quality:W=x1,formats:U=y1,widths:z=P1,decoding:_="async",fetchpriority:B,objectFit:q,objectPosition:j}=$,H=$.class,O=$.style,V=[];if(q)V.push(`object-fit: ${q}`);if(j)V.push(`object-position: ${j}`);if(O)V.push(O);let L=V.length>0?` style="${V.join("; ")}"`:"",F=H?` class="${H}"`:"",A=X?` width="${X}"`:"",w=J?` height="${J}"`:"",N=K?"":` loading="${G}"`,R=` decoding="${_}"`,E=B?` fetchpriority="${B}"`:K?' fetchpriority="high"':"",M=typeof Q==="object"?o6(Q):Q,I=`
|
|
14151
14151
|
data-stx-image
|
|
14152
14152
|
data-src="${Z}"
|
|
14153
14153
|
data-sizes="${M}"
|
|
14154
14154
|
data-quality="${W}"
|
|
14155
14155
|
data-formats="${U.join(",")}"
|
|
14156
14156
|
data-widths="${z.join(",")}"
|
|
14157
|
-
`.replace(/\s+/g," ").trim();return{html:`<img src="${Z}" alt="${hG(Y)}"${A}${w}${F}${L}${N}${R}${E} ${I} />`}}function zX($){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,U]=Q,z=K??W??U??!0;switch(G){case"src":X.src=String(z);break;case"alt":X.alt=String(z);break;case"width":X.width=Number(z)||z;break;case"height":X.height=Number(z)||z;break;case"sizes":X.sizes=String(z);break;case"loading":X.loading=z;break;case"priority":X.priority=z===!0||z==="true";break;case"quality":X.quality=Number(z);break;case"placeholder":X.placeholder=z;break;case"class":X.class=String(z);break;case"style":X.style=String(z);break;case"decoding":X.decoding=z;break;case"fetchpriority":X.fetchpriority=z;break;case"objectFit":X.objectFit=z;break;case"objectPosition":X.objectPosition=String(z);break}}if(!X.src||!X.alt)return null;return X}async function gG($,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:U}=K[W],z=zX(U);if(z){let _=await Z(z);if(Q=Q.replace(U,_.html),_.preloadLink)X.push(_.preloadLink);if(_.placeholderCss)J.push(_.placeholderCss)}}return{html:Q,preloadLinks:X,styles:J}}function hG($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var BL=D(()=>{
|
|
14157
|
+
`.replace(/\s+/g," ").trim();return{html:`<img src="${Z}" alt="${hG(Y)}"${A}${w}${F}${L}${N}${R}${E} ${I} />`}}function zX($){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,U]=Q,z=K??W??U??!0;switch(G){case"src":X.src=String(z);break;case"alt":X.alt=String(z);break;case"width":X.width=Number(z)||z;break;case"height":X.height=Number(z)||z;break;case"sizes":X.sizes=String(z);break;case"loading":X.loading=z;break;case"priority":X.priority=z===!0||z==="true";break;case"quality":X.quality=Number(z);break;case"placeholder":X.placeholder=z;break;case"class":X.class=String(z);break;case"style":X.style=String(z);break;case"decoding":X.decoding=z;break;case"fetchpriority":X.fetchpriority=z;break;case"objectFit":X.objectFit=z;break;case"objectPosition":X.objectPosition=String(z);break}}if(!X.src||!X.alt)return null;return X}async function gG($,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:U}=K[W],z=zX(U);if(z){let _=await Z(z);if(Q=Q.replace(U,_.html),_.preloadLink)X.push(_.preloadLink);if(_.placeholderCss)J.push(_.placeholderCss)}}return{html:Q,preloadLinks:X,styles:J}}function hG($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var BL=D(()=>{Z$()});function BX(){_X.clear()}async function oC($,Z){let Y=`${$}:${JSON.stringify(Z)}`;if(_X.has(Y))return _X.get(Y);try{let X=await o1($,Z);return _X.set(Y,X),X}catch{return null}}function qX(){return h0({name:"image",hasEndTag:!1,description:"Render an optimized image with responsive variants",transform:async($,Z,Y)=>{let{src:X,alt:J,options:Q}=tC($,Z,Y);if(!X)return console.warn("@image directive: missing src argument"),"<!-- @image: missing src -->";let G={widths:Q.widths||(Q.width?[Q.width]:P1),formats:Q.formats||y1,quality:Q.quality||x1,placeholder:(Q.placeholder==="color"?"dominant-color":Q.placeholder)||"none"};if(!await s1())return qL(X,J||"",Q);let W=await oC(X,G);if(!W)return qL(X,J||"",Q);return $b(W,J||"",Q)}})}function tC($,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=eC(J),G=Q[0]||"",K=Q[1]||"",W={};if(G&&!G.startsWith("/")&&!G.startsWith(".")&&!G.startsWith("http")){let U=Y[G];if(typeof U==="string")G=U}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 eC($){let Z=[],Y="",X=!1,J="",Q=0,G=0;for(let K=0;K<$.length;K++){let W=$[K],U=K>0?$[K-1]:"";if((W==='"'||W==="'")&&U!=="\\"){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 qL($,Z,Y){let X=[`src="${C4($)}"`];if(Z)X.push(`alt="${C4(Z)}"`);if(Y.width)X.push(`width="${Y.width}"`);if(Y.height)X.push(`height="${Y.height}"`);if(Y.class)X.push(`class="${C4(Y.class)}"`);if(Y.style)X.push(`style="${C4(Y.style)}"`);if(Y.lazy!==!1)X.push('loading="lazy"');return X.push('decoding="async"'),`<img ${X.join(" ")} />`}function $b($,Z,Y){let{variants:X,placeholder:J,width:Q,height:G,aspectRatio:K}=$,W=new Map;for(let O of X){let V=W.get(O.format)||[];V.push(O),W.set(O.format,V)}let U=["avif","webp","jpeg","png"],z=[];for(let O of U){let V=W.get(O);if(V&&V.length>0){let L=L6(V),F=v1(O),A=Y.sizes||"100vw";z.push(` <source type="${F}" srcset="${C4(L)}" sizes="${C4(A)}" />`)}}let _=W.get("jpeg")||[],B=_.length>0?_[Math.floor(_.length/2)]:X[Math.floor(X.length/2)],q=[`src="${B?.url||$.src}"`,`alt="${C4(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="${C4(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>
|
|
14158
14158
|
`;if(H+=z.join(`
|
|
14159
14159
|
`)+`
|
|
14160
14160
|
`,H+=` <img ${q.join(" ")} />
|
|
@@ -14163,7 +14163,7 @@ ${H}
|
|
|
14163
14163
|
</div>`}else if(Y.placeholder==="color"){let V=J.replace(/[^a-zA-Z0-9#(),.\s%-]/g,"");H=`<div id="${O}" class="stx-image-placeholder" style="background-color: ${V};">
|
|
14164
14164
|
${H}
|
|
14165
14165
|
</div>`}}if(Y.priority&&B){let O=v1(B.format);H=`<link rel="preload" as="image" href="${C4(B.url)}" type="${O}" />
|
|
14166
|
-
`+H}return H}function C4($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var _X,dG;var jL=D(()=>{G8();e6();_X=new Map;dG=qX()});import S5 from"fs";import jX from"path";function uG($={}){let{inputDirs:Z=["public","src/assets","assets"],outputDir:Y="dist/images",baseUrl:X="/images",formats:J=y1,widths:Q=P1,quality:G=x1,placeholder:K="none",concurrency:W=4,cache:U=!0,cacheDir:z=".stx/image-cache",referencedOnly:_=!1,verbose:B=!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 s1()){console.warn("[stx-images] no image backend available, optimization disabled");return}if(U)await S5.promises.mkdir(z,{recursive:!0});if(B){let O=await D5();console.log("[stx-images] Plugin initialized"),console.log(` Backend: ${O?"sharp (native fast path) + ts-images":"ts-images (pure TS)"}`),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=Zb(j);for(let V of O)q.imageReferences.add(V)}if(j.includes("<Image")||j.includes("@image"))return await Xb(j,{formats:J,widths:Q,quality:G,placeholder:K,outputDir:Y,baseUrl:X,processedImages:q.processedImages});return j},async buildEnd(j){if(!await s1())return;await S5.promises.mkdir(Y,{recursive:!0});let O=[];for(let F of Z){if(!S5.existsSync(F))continue;let A=await HL(F);O.push(...A)}let V=_?O.filter((F)=>Yb(F,q.imageReferences)):O;if(q.stats.totalImages=V.length,B)console.log(`[stx-images] Processing ${V.length} images...`);let L=OL(V,W);for(let F of L)await Promise.all(F.map(async(A)=>{try{let w=await o1(A,{formats:J,widths:Q,quality:G,placeholder:K,outputDir:Y,baseUrl:X});q.processedImages.set(A,w),q.stats.optimizedImages++,q.stats.variants+=w.variants.length;let N=S5.statSync(A).size,R=k8(w.variants);if(q.stats.savedBytes+=Math.max(0,N-R/w.variants.length),B)console.log(` \u2713 ${jX.basename(A)} \u2192 ${w.variants.length} variants`)}catch(w){console.error(`[stx-images] Error processing ${A}:`,w)}}));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: ~${S8(q.stats.savedBytes)}`)}}}function Zb($){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 Yb($,Z){let Y=jX.basename($);for(let X of Z)if(X.endsWith(Y)||X.includes(Y))return!0;return!1}async function Xb($,Z){return $}async function HL($){let Z=[];async function Y(X){let J=await S5.promises.readdir(X,{withFileTypes:!0});for(let Q of J){let G=jX.join(X,Q.name);if(Q.isDirectory())await Y(G);else if(Q.isFile()&&k5(G))Z.push(G)}}return await Y($),Z}function OL($,Z){let Y=[];for(let X=0;X<$.length;X+=Z)Y.push($.slice(X,X+Z));return Y}async function HX($,Z,Y={}){if(!await s1())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");return o1($,{...Y,outputDir:Z})}async function mG($,Z,Y={}){let{formats:X=y1,widths:J=P1,quality:Q=x1,placeholder:G="none",concurrency:K=4,verbose:W=!1}=Y;if(!await s1())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");await S5.promises.mkdir(Z,{recursive:!0});let z=await HL($),_=[],B={totalImages:z.length,optimizedImages:0,savedBytes:0,variants:0},q=OL(z,K);for(let j of q){let H=await Promise.all(j.map(async(O)=>{try{let V=await o1(O,{formats:X,widths:J,quality:Q,placeholder:G,outputDir:Z,baseUrl:"/"});if(B.optimizedImages++,B.variants+=V.variants.length,W)console.log(` \u2713 ${jX.basename(O)}`);return V}catch(V){return console.error(`Error processing ${O}:`,V),null}}));_.push(...H.filter((O)=>O!==null))}return{processed:_,stats:B}}function OX($){let Z={};for(let Y of $)Z[Y.src]={variants:Y.variants,placeholder:Y.placeholder};return Z}async function lG($,Z){let Y=OX($);await Bun.write(Z,JSON.stringify(Y,null,2))}var LL=D(()=>{e6()});var FL={};e(FL,{writeImageManifest:()=>lG,rewriteImagesWithSiblings:()=>RY,renderImageComponent:()=>fG,processImageComponents:()=>gG,processImage:()=>o1,parseImageComponent:()=>zX,optimizeImage:()=>HX,optimizeDirectory:()=>mG,isSharpAvailable:()=>D5,isImageFile:()=>k5,isImageBackendAvailable:()=>s1,imageDirective:()=>dG,handleImageRequest:()=>b8,groupVariantsByFormat:()=>o6,getTotalSize:()=>k8,getMimeType:()=>v1,getImageMetadata:()=>r6,getFallbackVariant:()=>s6,generateSrcSet:()=>L6,generateSizes:()=>a6,generateImageManifest:()=>OX,formatSize:()=>S8,defaultImageConfig:()=>VL,createImagePlugin:()=>uG,createImageHandler:()=>UX,createImageDirective:()=>qX,clearImageCache:()=>BX,ImageProcessingError:()=>t6,DEFAULT_WIDTHS:()=>P1,DEFAULT_QUALITY:()=>x1,DEFAULT_FORMATS:()=>y1});var VL;var LX=D(()=>{e6();UQ();vG();BL();jL();LL();VL={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 VX($,Z,Y=new WeakSet){if(Object.is($,Z))return!0;if(typeof $!=="object"||typeof Z!=="object"||$===null||Z===null)return!1;if(Y.has($))return!0;if(Y.add($),$ instanceof Date&&Z instanceof Date)return $.getTime()===Z.getTime();if($ instanceof RegExp&&Z instanceof RegExp)return $.source===Z.source&&$.flags===Z.flags;if(Array.isArray($)){if(!Array.isArray(Z)||$.length!==Z.length)return!1;for(let Q=0;Q<$.length;Q++)if(!VX($[Q],Z[Q],Y))return!1;return!0}if(Array.isArray(Z))return!1;if($ instanceof Map){if(!(Z instanceof Map)||$.size!==Z.size)return!1;for(let[Q,G]of $)if(!Z.has(Q)||!VX(G,Z.get(Q),Y))return!1;return!0}if(Z instanceof Map)return!1;if($ instanceof Set){if(!(Z instanceof Set)||$.size!==Z.size)return!1;for(let Q of $)if(!Z.has(Q))return!1;return!0}if(Z instanceof Set)return!1;let X=Object.keys($),J=Object.keys(Z);if(X.length!==J.length)return!1;for(let Q of X){if(!Object.prototype.hasOwnProperty.call(Z,Q))return!1;if(!VX($[Q],Z[Q],Y))return!1}return!0}function Jb($){d0=$}function Qb(){return d0}function Gb(){return{isMounted:!1,isUnmounted:!1,hooks:{beforeMount:[],mounted:[],beforeUpdate:[],updated:[],beforeUnmount:[],unmounted:[]},effects:[],scope:wL()}}function wL(){return{refs:new Map,effects:new Set,cleanups:[]}}function Kb($){let Z=new Set,Y=new Set,X=$,J=Symbol("ref"),Q={get value(){if(t0)Y.add(t0);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(d0)d0.scope.refs.set(J,Q);return Q}function NL($){let Z=AL.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 U=Reflect.get(G,K,W);if(t0)J(K,t0);if(U!==null&&typeof U==="object"&&!Array.isArray(U)){let z=Object.getPrototypeOf(U);if(z===Object.prototype||z===null)return NL(U)}return U},set(G,K,W,U){let z=Reflect.get(G,K,U),_=Reflect.set(G,K,W,U);if(!Object.is(W,z))X(K);return _},deleteProperty(G,K){let W=Reflect.deleteProperty(G,K);return X(K),W}});return AL.set($,Q),Q}function Wb($){let Z,Y=!0,X=new Set,J=new Set,Q=()=>{Y=!0,G()},G=()=>{if(Y){let W=Z,U=t0;if(t0=Q,Z=$(),t0=U,Y=!1,!Object.is(Z,W)){for(let z of X)z(Z,W);for(let z of J)z()}}},K=t0;return t0=Q,Z=$(),Y=!1,t0=K,{get value(){if(t0)J.add(t0);return G(),Z},set value(W){console.warn("[stx] Computed properties are readonly")},subscribe(W){return X.add(W),()=>{X.delete(W)}}}}function Ub($,Z,Y={}){let{immediate:X=!1,deep:J=!1,flush:Q="post"}=Y,G,K,W=!1,U=()=>{if(W)return;let j=q();if((J?!VX(j,G):!Object.is(j,G))||X)if(Z(j,G),J&&j!==null&&typeof j==="object")try{G=structuredClone(j)}catch{G=j}else G=j},z=(j)=>{if(Q==="sync")j();else if(Q==="pre")Promise.resolve().then(j);else requestAnimationFrame(()=>{requestAnimationFrame(j)})},_=!1,B=()=>{if(W||_)return;_=!0,z(()=>{_=!1,U()})},q=()=>{if(typeof $==="function"){let j=t0;t0=B;try{return $()}finally{t0=j}}return $.value};if(typeof $!=="function"){let j=$.subscribe(()=>{z(U)});K=()=>{W=!0,j()}}else K=()=>{W=!0};if(G=q(),X)z(U);if(d0)d0.scope.cleanups.push(()=>K?.());return()=>K?.()}function zb($,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 _b($){let Z,Y=!1,X=()=>{if(Y)return;if(Z)Z();let J=t0;t0=X,Z=$(),t0=J};if(X(),d0)d0.scope.cleanups.push(()=>{if(Y=!0,Z)Z()});return()=>{if(Y=!0,Z)Z()}}function Bb($){if(d0)d0.hooks.beforeMount.push($);else console.warn("[stx] onBeforeMount called outside of component setup")}function qb($){if(d0)d0.hooks.mounted.push($);else console.warn("[stx] onMounted called outside of component setup")}function jb($){if(d0)d0.hooks.beforeUpdate.push($);else console.warn("[stx] onBeforeUpdate called outside of component setup")}function Hb($){if(d0)d0.hooks.updated.push($);else console.warn("[stx] onUpdated called outside of component setup")}function Ob($){if(d0)d0.hooks.beforeUnmount.push($);else console.warn("[stx] onBeforeUnmount called outside of component setup")}function Lb($){if(d0)d0.hooks.unmounted.push($);else console.warn("[stx] onUnmounted called outside of component setup")}async function $$($,Z){let Y=$.hooks[Z];for(let X of Y)await X()}async function Vb($){await $$($,"beforeMount"),$.isMounted=!0,await $$($,"mounted")}async function Fb($){if(!$.isMounted||$.isUnmounted)return;await $$($,"beforeUpdate"),await $$($,"updated")}async function Ab($){if($.isUnmounted)return;await $$($,"beforeUnmount");for(let Z of $.scope.cleanups)Z();$.isUnmounted=!0,await $$($,"unmounted")}function wb(){return`
|
|
14166
|
+
`+H}return H}function C4($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var _X,dG;var jL=D(()=>{G8();Z$();_X=new Map;dG=qX()});import S5 from"fs";import jX from"path";function uG($={}){let{inputDirs:Z=["public","src/assets","assets"],outputDir:Y="dist/images",baseUrl:X="/images",formats:J=y1,widths:Q=P1,quality:G=x1,placeholder:K="none",concurrency:W=4,cache:U=!0,cacheDir:z=".stx/image-cache",referencedOnly:_=!1,verbose:B=!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 s1()){console.warn("[stx-images] no image backend available, optimization disabled");return}if(U)await S5.promises.mkdir(z,{recursive:!0});if(B){let O=await D5();console.log("[stx-images] Plugin initialized"),console.log(` Backend: ${O?"sharp (native fast path) + ts-images":"ts-images (pure TS)"}`),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=Zb(j);for(let V of O)q.imageReferences.add(V)}if(j.includes("<Image")||j.includes("@image"))return await Xb(j,{formats:J,widths:Q,quality:G,placeholder:K,outputDir:Y,baseUrl:X,processedImages:q.processedImages});return j},async buildEnd(j){if(!await s1())return;await S5.promises.mkdir(Y,{recursive:!0});let O=[];for(let F of Z){if(!S5.existsSync(F))continue;let A=await HL(F);O.push(...A)}let V=_?O.filter((F)=>Yb(F,q.imageReferences)):O;if(q.stats.totalImages=V.length,B)console.log(`[stx-images] Processing ${V.length} images...`);let L=OL(V,W);for(let F of L)await Promise.all(F.map(async(A)=>{try{let w=await o1(A,{formats:J,widths:Q,quality:G,placeholder:K,outputDir:Y,baseUrl:X});q.processedImages.set(A,w),q.stats.optimizedImages++,q.stats.variants+=w.variants.length;let N=S5.statSync(A).size,R=k8(w.variants);if(q.stats.savedBytes+=Math.max(0,N-R/w.variants.length),B)console.log(` \u2713 ${jX.basename(A)} \u2192 ${w.variants.length} variants`)}catch(w){console.error(`[stx-images] Error processing ${A}:`,w)}}));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: ~${S8(q.stats.savedBytes)}`)}}}function Zb($){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 Yb($,Z){let Y=jX.basename($);for(let X of Z)if(X.endsWith(Y)||X.includes(Y))return!0;return!1}async function Xb($,Z){return $}async function HL($){let Z=[];async function Y(X){let J=await S5.promises.readdir(X,{withFileTypes:!0});for(let Q of J){let G=jX.join(X,Q.name);if(Q.isDirectory())await Y(G);else if(Q.isFile()&&k5(G))Z.push(G)}}return await Y($),Z}function OL($,Z){let Y=[];for(let X=0;X<$.length;X+=Z)Y.push($.slice(X,X+Z));return Y}async function HX($,Z,Y={}){if(!await s1())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");return o1($,{...Y,outputDir:Z})}async function mG($,Z,Y={}){let{formats:X=y1,widths:J=P1,quality:Q=x1,placeholder:G="none",concurrency:K=4,verbose:W=!1}=Y;if(!await s1())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");await S5.promises.mkdir(Z,{recursive:!0});let z=await HL($),_=[],B={totalImages:z.length,optimizedImages:0,savedBytes:0,variants:0},q=OL(z,K);for(let j of q){let H=await Promise.all(j.map(async(O)=>{try{let V=await o1(O,{formats:X,widths:J,quality:Q,placeholder:G,outputDir:Z,baseUrl:"/"});if(B.optimizedImages++,B.variants+=V.variants.length,W)console.log(` \u2713 ${jX.basename(O)}`);return V}catch(V){return console.error(`Error processing ${O}:`,V),null}}));_.push(...H.filter((O)=>O!==null))}return{processed:_,stats:B}}function OX($){let Z={};for(let Y of $)Z[Y.src]={variants:Y.variants,placeholder:Y.placeholder};return Z}async function lG($,Z){let Y=OX($);await Bun.write(Z,JSON.stringify(Y,null,2))}var LL=D(()=>{Z$()});var FL={};$0(FL,{writeImageManifest:()=>lG,rewriteImagesWithSiblings:()=>RY,renderImageComponent:()=>fG,processImageComponents:()=>gG,processImage:()=>o1,parseImageComponent:()=>zX,optimizeImage:()=>HX,optimizeDirectory:()=>mG,isSharpAvailable:()=>D5,isImageFile:()=>k5,isImageBackendAvailable:()=>s1,imageDirective:()=>dG,handleImageRequest:()=>b8,groupVariantsByFormat:()=>e6,getTotalSize:()=>k8,getMimeType:()=>v1,getImageMetadata:()=>s6,getFallbackVariant:()=>t6,generateSrcSet:()=>L6,generateSizes:()=>o6,generateImageManifest:()=>OX,formatSize:()=>S8,defaultImageConfig:()=>VL,createImagePlugin:()=>uG,createImageHandler:()=>UX,createImageDirective:()=>qX,clearImageCache:()=>BX,ImageProcessingError:()=>$$,DEFAULT_WIDTHS:()=>P1,DEFAULT_QUALITY:()=>x1,DEFAULT_FORMATS:()=>y1});var VL;var LX=D(()=>{Z$();UQ();vG();BL();jL();LL();VL={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 VX($,Z,Y=new WeakSet){if(Object.is($,Z))return!0;if(typeof $!=="object"||typeof Z!=="object"||$===null||Z===null)return!1;if(Y.has($))return!0;if(Y.add($),$ instanceof Date&&Z instanceof Date)return $.getTime()===Z.getTime();if($ instanceof RegExp&&Z instanceof RegExp)return $.source===Z.source&&$.flags===Z.flags;if(Array.isArray($)){if(!Array.isArray(Z)||$.length!==Z.length)return!1;for(let Q=0;Q<$.length;Q++)if(!VX($[Q],Z[Q],Y))return!1;return!0}if(Array.isArray(Z))return!1;if($ instanceof Map){if(!(Z instanceof Map)||$.size!==Z.size)return!1;for(let[Q,G]of $)if(!Z.has(Q)||!VX(G,Z.get(Q),Y))return!1;return!0}if(Z instanceof Map)return!1;if($ instanceof Set){if(!(Z instanceof Set)||$.size!==Z.size)return!1;for(let Q of $)if(!Z.has(Q))return!1;return!0}if(Z instanceof Set)return!1;let X=Object.keys($),J=Object.keys(Z);if(X.length!==J.length)return!1;for(let Q of X){if(!Object.prototype.hasOwnProperty.call(Z,Q))return!1;if(!VX($[Q],Z[Q],Y))return!1}return!0}function Jb($){d0=$}function Qb(){return d0}function Gb(){return{isMounted:!1,isUnmounted:!1,hooks:{beforeMount:[],mounted:[],beforeUpdate:[],updated:[],beforeUnmount:[],unmounted:[]},effects:[],scope:wL()}}function wL(){return{refs:new Map,effects:new Set,cleanups:[]}}function Kb($){let Z=new Set,Y=new Set,X=$,J=Symbol("ref"),Q={get value(){if(t0)Y.add(t0);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(d0)d0.scope.refs.set(J,Q);return Q}function NL($){let Z=AL.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 U=Reflect.get(G,K,W);if(t0)J(K,t0);if(U!==null&&typeof U==="object"&&!Array.isArray(U)){let z=Object.getPrototypeOf(U);if(z===Object.prototype||z===null)return NL(U)}return U},set(G,K,W,U){let z=Reflect.get(G,K,U),_=Reflect.set(G,K,W,U);if(!Object.is(W,z))X(K);return _},deleteProperty(G,K){let W=Reflect.deleteProperty(G,K);return X(K),W}});return AL.set($,Q),Q}function Wb($){let Z,Y=!0,X=new Set,J=new Set,Q=()=>{Y=!0,G()},G=()=>{if(Y){let W=Z,U=t0;if(t0=Q,Z=$(),t0=U,Y=!1,!Object.is(Z,W)){for(let z of X)z(Z,W);for(let z of J)z()}}},K=t0;return t0=Q,Z=$(),Y=!1,t0=K,{get value(){if(t0)J.add(t0);return G(),Z},set value(W){console.warn("[stx] Computed properties are readonly")},subscribe(W){return X.add(W),()=>{X.delete(W)}}}}function Ub($,Z,Y={}){let{immediate:X=!1,deep:J=!1,flush:Q="post"}=Y,G,K,W=!1,U=()=>{if(W)return;let j=q();if((J?!VX(j,G):!Object.is(j,G))||X)if(Z(j,G),J&&j!==null&&typeof j==="object")try{G=structuredClone(j)}catch{G=j}else G=j},z=(j)=>{if(Q==="sync")j();else if(Q==="pre")Promise.resolve().then(j);else requestAnimationFrame(()=>{requestAnimationFrame(j)})},_=!1,B=()=>{if(W||_)return;_=!0,z(()=>{_=!1,U()})},q=()=>{if(typeof $==="function"){let j=t0;t0=B;try{return $()}finally{t0=j}}return $.value};if(typeof $!=="function"){let j=$.subscribe(()=>{z(U)});K=()=>{W=!0,j()}}else K=()=>{W=!0};if(G=q(),X)z(U);if(d0)d0.scope.cleanups.push(()=>K?.());return()=>K?.()}function zb($,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 _b($){let Z,Y=!1,X=()=>{if(Y)return;if(Z)Z();let J=t0;t0=X,Z=$(),t0=J};if(X(),d0)d0.scope.cleanups.push(()=>{if(Y=!0,Z)Z()});return()=>{if(Y=!0,Z)Z()}}function Bb($){if(d0)d0.hooks.beforeMount.push($);else console.warn("[stx] onBeforeMount called outside of component setup")}function qb($){if(d0)d0.hooks.mounted.push($);else console.warn("[stx] onMounted called outside of component setup")}function jb($){if(d0)d0.hooks.beforeUpdate.push($);else console.warn("[stx] onBeforeUpdate called outside of component setup")}function Hb($){if(d0)d0.hooks.updated.push($);else console.warn("[stx] onUpdated called outside of component setup")}function Ob($){if(d0)d0.hooks.beforeUnmount.push($);else console.warn("[stx] onBeforeUnmount called outside of component setup")}function Lb($){if(d0)d0.hooks.unmounted.push($);else console.warn("[stx] onUnmounted called outside of component setup")}async function Y$($,Z){let Y=$.hooks[Z];for(let X of Y)await X()}async function Vb($){await Y$($,"beforeMount"),$.isMounted=!0,await Y$($,"mounted")}async function Fb($){if(!$.isMounted||$.isUnmounted)return;await Y$($,"beforeUpdate"),await Y$($,"updated")}async function Ab($){if($.isUnmounted)return;await Y$($,"beforeUnmount");for(let Z of $.scope.cleanups)Z();$.isUnmounted=!0,await Y$($,"unmounted")}function wb(){return`
|
|
14167
14167
|
<script data-stx-client-runtime>
|
|
14168
14168
|
(function() {
|
|
14169
14169
|
'use strict';
|
|
@@ -14343,7 +14343,7 @@ ${H}
|
|
|
14343
14343
|
</script>`}var d0=null,t0=null,AL;var RL=D(()=>{AL=new WeakMap});import{abortNavigation as Nb,clearMiddleware as P8,createClientCookieManager as Rb,createMiddlewareContext as y8,createRouteLocation as x8,createServerCookieManager as Mb,createStorageManager as Tb,defineMiddleware as Eb,getMiddleware as Ib,getMiddlewareNames as v8,hasMiddleware as Db,loadMiddlewareFromDirectory as f8,navigateTo as kb,registerMiddleware as Sb,runMiddleware as g8}from"stx-router";var FX=()=>{};function C5($,Z){if(typeof window>"u")return Z;return window[$]??Z}function AX($,Z){if(typeof window>"u")return;window[$]=Z}function ML($){let Y=C5("__STX_STORES__",{})[$];if(!Y)throw Error(`Store "${$}" not found. Make sure it's defined with defineStore().`);return Y}function Cb($){return ML($)}function bb($,Z=5000){return new Promise((Y,X)=>{let J=Date.now(),Q=()=>{let G=ML($);if(G)Y(G);else if(Date.now()-J>Z)X(Error(`Timeout waiting for store "${$}"`));else requestAnimationFrame(Q)};Q()})}function TL(){return C5("__STX_ROUTE_PARAMS__",{})}function EL($){return TL()[$]}function Pb($){let Z=EL($);if(Z===void 0)throw Error(`Route parameter "${$}" not found`);return Z}function IL(){return C5("__STX_MIDDLEWARE_STATE__",{})}function yb($){return IL()[$]}function xb(){if(typeof window>"u")return;if(!C5("__STX_STORES__",null))AX("__STX_STORES__",{})}function vb($,Z){let Y=C5("__STX_STORES__",{});Y[$]=Z,AX("__STX_STORES__",Y)}function fb(){return C5("__STX_STORE_STATE__",null)}function gb($){AX("__STX_ROUTE_PARAMS__",$)}function hb($){AX("__STX_MIDDLEWARE_STATE__",$)}function DL(){return typeof window>"u"}function kL(){return typeof window<"u"}function db($){if(kL())$()}function ub($){if(DL())$()}async function CL($){try{let Z=await Bun.file($).text(),Y=mb(Z),X=lb(Z,$),J=cb(Z,Y),Q=pb(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 mb($){let Z=$.split(`
|
|
14344
14344
|
`),Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=(Y?Y[1]:"").split(`
|
|
14345
14345
|
`).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,U=G+K+W,z=($.match(/<[A-Z][^>]*>/g)||[]).length,_=($.match(/@(?:layout|extends)\(/g)||[]).length,B=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++,B=Math.max(B,q);else if(/@end(?:if|unless|foreach|for|while|section)\b/.test(O))q--;let j=B>=4?3:0,H=Math.min(10,Math.ceil(Q.total*0.5+U*0.1+z*0.3+(J>10?J*0.05:0)+j));return{lines:Z.length,characters:$.length,directives:Q,expressions:U,components:z,layouts:_,scriptLines:J,complexity:H}}function lb($,Z){let Y=[],X=SL($,"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=SL($,"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 z=K.filter((_)=>!_.includes("alt="));if(z.length>0)Y.push({type:"warning",category:"accessibility",message:`Found ${z.length} image(s) without alt attributes`,suggestion:"Add alt attributes to all images for screen reader accessibility"})}let W=$.split(`
|
|
14346
|
-
`).filter((z)=>z.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 U=($.match(/style\s*=\s*["'][^"']*["']/g)||[]).length;if(U>3)Y.push({type:"info",category:"maintainability",message:`Found ${U} inline style attributes`,suggestion:"Consider moving styles to CSS classes for better maintainability"});return Y}function cb($,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 pb($,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 SL($,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 cG($=["**/*.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 CL(Q);Y.push(G)}catch(G){console.warn(`Failed to analyze ${Q}:`,G)}let J=ib(Y);return{results:Y,summary:J}}function ib($){let Z=$.length,Y=$.reduce((U,z)=>U+z.metrics.lines,0),X=Z>0?$.reduce((U,z)=>U+z.metrics.complexity,0)/Z:0,J=$.reduce((U,z)=>U+z.issues.length,0),Q={};$.forEach((U)=>{U.issues.forEach((z)=>{Q[z.category]=(Q[z.category]||0)+1})});let G=Z>0?$.reduce((U,z)=>U+z.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 bL($,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(nb.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 pG($){let Z=[],Y=[],X=[],J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Q;while((Q=J.exec($))!==null){let G=bL(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 nb;var iG=D(()=>{nb=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/});import nG from"path";import{extractLayoutMetadata as m8}from"stx-router/layout-metadata";function sb(){if(h8!==null)return h8;try{let{getRouterScript:$}=Z0("stx-router");h8=`<script>${$()}</script>`}catch{h8=""}return h8}async function rG($,Z){if(Z===!1)return null;if(Z&&typeof Z==="string"){let X=nG.resolve($,Z);if(await Bun.file(X).exists())return X;return null}let Y=nG.join($,"app.stx");if(await Bun.file(Y).exists())return Y;return null}async function wX($,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=pG(Y),G=[...Q.client.map((A)=>A.fullTag),...Q.signals.map((A)=>A.fullTag)],K=[],W=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,U;while((U=W.exec(Y))!==null)K.push(U[0]);let z=X;for(let A of Q.server)z=z.replace(A.fullTag,"");for(let A of Q.client)z=z.replace(A.fullTag,"");z=z.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let _="<!--__STX_PAGE_SLOT__-->";if(z=z.replace(/<slot\s*\/>/gi,_).replace(/<slot\s*>\s*<\/slot>/gi,_),!z.includes(_))return console.warn(`[stx] Shell ${$} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:B,extractVariables:q,defaultConfig:j,loadStxConfig:H}=await Promise.resolve().then(() => (V6(),
|
|
14346
|
+
`).filter((z)=>z.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 U=($.match(/style\s*=\s*["'][^"']*["']/g)||[]).length;if(U>3)Y.push({type:"info",category:"maintainability",message:`Found ${U} inline style attributes`,suggestion:"Consider moving styles to CSS classes for better maintainability"});return Y}function cb($,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 pb($,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 SL($,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 cG($=["**/*.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 CL(Q);Y.push(G)}catch(G){console.warn(`Failed to analyze ${Q}:`,G)}let J=ib(Y);return{results:Y,summary:J}}function ib($){let Z=$.length,Y=$.reduce((U,z)=>U+z.metrics.lines,0),X=Z>0?$.reduce((U,z)=>U+z.metrics.complexity,0)/Z:0,J=$.reduce((U,z)=>U+z.issues.length,0),Q={};$.forEach((U)=>{U.issues.forEach((z)=>{Q[z.category]=(Q[z.category]||0)+1})});let G=Z>0?$.reduce((U,z)=>U+z.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 bL($,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(nb.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 pG($){let Z=[],Y=[],X=[],J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Q;while((Q=J.exec($))!==null){let G=bL(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 nb;var iG=D(()=>{nb=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/});import nG from"path";import{extractLayoutMetadata as m8}from"stx-router/layout-metadata";function sb(){if(h8!==null)return h8;try{let{getRouterScript:$}=Z0("stx-router");h8=`<script>${$()}</script>`}catch{h8=""}return h8}async function rG($,Z){if(Z===!1)return null;if(Z&&typeof Z==="string"){let X=nG.resolve($,Z);if(await Bun.file(X).exists())return X;return null}let Y=nG.join($,"app.stx");if(await Bun.file(Y).exists())return Y;return null}async function wX($,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=pG(Y),G=[...Q.client.map((A)=>A.fullTag),...Q.signals.map((A)=>A.fullTag)],K=[],W=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,U;while((U=W.exec(Y))!==null)K.push(U[0]);let z=X;for(let A of Q.server)z=z.replace(A.fullTag,"");for(let A of Q.client)z=z.replace(A.fullTag,"");z=z.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let _="<!--__STX_PAGE_SLOT__-->";if(z=z.replace(/<slot\s*\/>/gi,_).replace(/<slot\s*>\s*<\/slot>/gi,_),!z.includes(_))return console.warn(`[stx] Shell ${$} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:B,extractVariables:q,defaultConfig:j,loadStxConfig:H}=await Promise.resolve().then(() => (V6(),X$)),O=await H(),V={__filename:$,__dirname:nG.dirname($)};for(let A of G){let w=A.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(w&&!A.includes("client")&&!A.includes('type="module"'))await q(w[1],V,$)}let L=await B(z,V,$,{...j,...O,...Z},new Set),F=L.indexOf(_);if(F===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:L.substring(0,F),afterSlot:L.substring(F+_.length),filePath:$,shellScripts:G,shellStyles:K}}catch(Y){return console.error(`[stx] Error processing shell ${$}:`,Y),null}}function d8($,Z,Y){let X,J="",Q=Z.match(ab);if(Q){Z=Z.replace(Q[0],"");try{let z=Buffer.from(Q[1],"base64").toString("utf8"),_=z.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(_)X=_[1].trim();J=z.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let G=Y||X||"stx App",K=sb(),W="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
|
|
14347
14347
|
<html lang="en">
|
|
14348
14348
|
<head>
|
|
14349
14349
|
<meta charset="UTF-8">
|
|
@@ -14370,7 +14370,7 @@ ${K}
|
|
|
14370
14370
|
`));if(J.length>0)L.push(J.join(`
|
|
14371
14371
|
`));if(H.length>0)L.push(H.join(`
|
|
14372
14372
|
`));return L.push(j),L.join(`
|
|
14373
|
-
`)}var rb="stx-page-head:",ab,h8=null;var b5=D(()=>{iG();ab=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/});import{matchRoute as ob,Router as tb}from"stx-router";import{findErrorPage as sG,formatRoutes as oG,generateRouteManifest as $P,generateRouteTypes as ZP,matchRoute as NX}from"stx-router";function P4($,Z={}){return new tb($,Z).routes}function eb($,Z){let Y=ob($,Z);return Y?Y.params:null}var l8=()=>{};import{createHash as YP}from"crypto";function XP($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}function QP($){return Bun.hash($).toString(16)}function PL($,Z={}){if(!$.includes('type="stx/island"'))return{html:$,chunks:[]};let Y=new Map,X=$.replace(JP,(Q,G,K,W)=>{let U=W.trim();if(!U)return Q;if(/\bdata-stx-src=/.test(K))return Q;if(Z.minify)U=XP(U);let z=QP(U);if(!Y.has(z))Y.set(z,U);let _=Z.integrity?` data-stx-integrity="sha384-${YP("sha384").update(U).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${G}" data-stx-src="/_stx/islands/${z}.js"${_}${K}></script>`}),J=Array.from(Y,([Q,G])=>({hash:Q,code:G}));return{html:X,chunks:J}}function yL($){if(!$.includes("data-stx-src="))return $;let Z=new Map,Y=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,X;while((X=Y.exec($))!==null)Z.set(X[1],X[2]);let J=new Set,Q=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,G;while((G=Q.exec($))!==null)if(GP.has(Z.get(G[1])||""))J.add(G[2]);let K=$.lastIndexOf("</head>");if(J.size===0||K===-1)return $;let W=Array.from(J).filter((U)=>!$.includes(`rel="prefetch" href="${U}"`)).map((U)=>`<link rel="prefetch" href="${U}" as="script">`).join("");if(!W)return $;return $.slice(0,K)+W+$.slice(K)}var JP,GP;var xL=D(()=>{JP=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;GP=new Set(["visible","idle"])});var cL={}
|
|
14373
|
+
`)}var rb="stx-page-head:",ab,h8=null;var b5=D(()=>{iG();ab=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/});import{matchRoute as ob,Router as tb}from"stx-router";import{findErrorPage as sG,formatRoutes as oG,generateRouteManifest as $P,generateRouteTypes as ZP,matchRoute as NX}from"stx-router";function P4($,Z={}){return new tb($,Z).routes}function eb($,Z){let Y=ob($,Z);return Y?Y.params:null}var l8=()=>{};import{createHash as YP}from"crypto";function XP($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}function QP($){return Bun.hash($).toString(16)}function PL($,Z={}){if(!$.includes('type="stx/island"'))return{html:$,chunks:[]};let Y=new Map,X=$.replace(JP,(Q,G,K,W)=>{let U=W.trim();if(!U)return Q;if(/\bdata-stx-src=/.test(K))return Q;if(Z.minify)U=XP(U);let z=QP(U);if(!Y.has(z))Y.set(z,U);let _=Z.integrity?` data-stx-integrity="sha384-${YP("sha384").update(U).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${G}" data-stx-src="/_stx/islands/${z}.js"${_}${K}></script>`}),J=Array.from(Y,([Q,G])=>({hash:Q,code:G}));return{html:X,chunks:J}}function yL($){if(!$.includes("data-stx-src="))return $;let Z=new Map,Y=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,X;while((X=Y.exec($))!==null)Z.set(X[1],X[2]);let J=new Set,Q=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,G;while((G=Q.exec($))!==null)if(GP.has(Z.get(G[1])||""))J.add(G[2]);let K=$.lastIndexOf("</head>");if(J.size===0||K===-1)return $;let W=Array.from(J).filter((U)=>!$.includes(`rel="prefetch" href="${U}"`)).map((U)=>`<link rel="prefetch" href="${U}" as="script">`).join("");if(!W)return $;return $.slice(0,K)+W+$.slice(K)}var JP,GP;var xL=D(()=>{JP=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;GP=new Set(["visible","idle"])});var cL={};$0(cL,{generateStaticSite:()=>hL,defineStaticPaths:()=>mL,default:()=>VP,createMarkdownLoader:()=>lL,createISRHandler:()=>uL});import a0 from"fs";import A0 from"path";class vL{cacheDir;cache=new Map;loaded=!1;constructor($){this.cacheDir=$}async load(){if(this.loaded)return;let $=A0.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 a0.promises.mkdir(this.cacheDir,{recursive:!0});let $=A0.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=a0.statSync($),X=`${$}:${Y.mtimeMs}`;for(let Q of Z)if(a0.existsSync(Q)){let G=a0.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){let Y=this.cache.get($);if(!Y)return null;let X=this.getHash(Z,Y.dependencies??[]);if(Y.hash!==X)return this.cache.delete($),null;return Y.html}set($,Z,Y,X){let J=this.getHash(Z,Y);this.cache.set($,{hash:J,html:X,generatedAt:Date.now(),dependencies:Y})}}class fL{cacheDir;constructor($){this.cacheDir=$}getFilePath($){let Z=$.replace(/[^a-zA-Z0-9]/g,"_")+".json";return A0.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 a0.promises.mkdir(A0.dirname(Y),{recursive:!0}),await Bun.write(Y,JSON.stringify(Z))}async invalidate($){let Z=this.getFilePath($);if(await Bun.file(Z).exists())await a0.promises.unlink(Z)}async invalidatePattern($){let Z=A0.join(this.cacheDir,"isr");if(!a0.existsSync(Z))return;let Y=await a0.promises.readdir(Z);for(let X of Y){let J=X.replace(/_/g,"/").replace(".json","");if($.test(J))await a0.promises.unlink(A0.join(Z,X))}}async needsRevalidation($){let Z=await this.get($);if(!Z)return!0;return Date.now()>Z.revalidateAfter}}async function KP($){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(`
|
|
14374
14374
|
return (async function getStaticPaths() {
|
|
14375
14375
|
${J[1]}
|
|
14376
14376
|
})()
|
|
@@ -14455,8 +14455,8 @@ Build complete!
|
|
|
14455
14455
|
<p>Redirecting to <a href="${$}">${$}</a>...</p>
|
|
14456
14456
|
<script>window.location.replace('${$}')</script>
|
|
14457
14457
|
</body>
|
|
14458
|
-
</html>`}function LP($,Z){if($==="/"||$==="")return A0.join(Z.outputDir,"index.html");let Y=$.replace(/^\/|\/$/g,"");if(Z.trailingSlash)return A0.join(Z.outputDir,Y,"index.html");return A0.join(Z.outputDir,`${Y}.html`)}var VP;var pL=D(()=>{l8();q1();xL();n0();J4();K4();FX();VP={generateStaticSite:hL,createISRHandler:uL,defineStaticPaths:mL,createMarkdownLoader:lL}});import{createHash as FP}from"crypto";import{getRouterScript as AP}from"stx-router";function tG($){return FP("sha256").update($).digest("hex").slice(0,8)}function eG($=!1){let Z=$?
|
|
14459
|
-
[stx build] Done in ${N}ms \u2014 ${V.length} pages compiled`),{pageCount:V.length,assets:A,outputDir:X,duration:N}}var MP;var WK=D(()=>{l8();ZK();XK();RX();b5();K4();n0();MP=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"])});var oL={}
|
|
14458
|
+
</html>`}function LP($,Z){if($==="/"||$==="")return A0.join(Z.outputDir,"index.html");let Y=$.replace(/^\/|\/$/g,"");if(Z.trailingSlash)return A0.join(Z.outputDir,Y,"index.html");return A0.join(Z.outputDir,`${Y}.html`)}var VP;var pL=D(()=>{l8();q1();xL();n0();J4();K4();FX();VP={generateStaticSite:hL,createISRHandler:uL,defineStaticPaths:mL,createMarkdownLoader:lL}});import{createHash as FP}from"crypto";import{getRouterScript as AP}from"stx-router";function tG($){return FP("sha256").update($).digest("hex").slice(0,8)}function eG($=!1){let Z=$?c6():s7(),Y=tG(Z);return{content:Z,filename:`runtime.${Y}.js`,hash:Y}}function $K(){let $=AP(),Z=tG($);return{content:$,filename:`router.${Z}.js`,hash:Z}}function wP($){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 ZK=D(()=>{d$()});import iL from"path";import{createHash as NP}from"crypto";function RP($={}){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 YK($,Z,Y={}){let X=iL.resolve($),J=await Bun.file(X).text(),Q=NP("sha256").update(J).digest("hex").slice(0,16);IJ();let G={};try{G=await g0()}catch{}let K=[],W=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,U;while((U=W.exec(J))!==null){let O=U[1];if(/\bserver\b/.test(O))K.push(U[2])}let{context:z}=RP({__filename:X,__dirname:iL.dirname(X)}),_=new Set,B={...N1,...G,...Y,buildMode:"compile",strict:!1},q=await _0(J,z,X,B,_),j=b4(q),H=DJ();return{route:Z,sourceFile:$,html:q,fragment:j,placeholders:H,hasServerScripts:K.length>0,serverScriptContent:K,dependencies:Array.from(_),contentHash:Q,streamTemplates:z.__streamTemplates}}var XK=D(()=>{q1();n0();U7();b5()});import JK from"fs";import nL from"path";function QK($,Z,Y){return{version:1,buildTime:new Date().toISOString(),routes:$,assets:Z,outputDir:Y}}function GK($,Z){let Y=nL.join(Z,"manifest.json");JK.writeFileSync(Y,JSON.stringify($,null,2))}function KK($){let Z=nL.join($,"manifest.json");if(!JK.existsSync(Z))return null;try{let Y=JK.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 RX=()=>{};var aL={};$0(aL,{buildForProduction:()=>rL});import L4 from"fs";import U1 from"path";function TP($,Z){let Y=0,X=0;if(!L4.existsSync($))return{copied:Y,bytes:X};function J(Q,G){let K=L4.readdirSync(Q,{withFileTypes:!0});for(let W of K){if(MP.has(W.name))continue;let U=U1.join(Q,W.name),z=U1.join(G,W.name);if(W.isDirectory())L4.mkdirSync(z,{recursive:!0}),J(U,z);else if(W.isFile()){if(L4.existsSync(z))continue;L4.copyFileSync(U,z),Y++,X+=L4.statSync(z).size}}}return J($,Z),{copied:Y,bytes:X}}async function rL($={}){let Z=Date.now(),Y=U1.resolve($.root||process.cwd()),X=U1.resolve(Y,$.outputDir||".output");console.log("[stx build] Starting production build...");let J={};try{J=await g0()}catch{}let Q=$.componentsDir??J.componentsDir??"components",G=$.partialsDir??J.partialsDir??"partials",K=$.layoutsDir??J.layoutsDir??"layouts",W=$.publicDir??J.publicDir??"public",U=J.app?.head||{},z=J.router?.container||"main";if(L4.existsSync(X))L4.rmSync(X,{recursive:!0});let _=[U1.join(X,"public","__stx"),U1.join(X,"public","assets"),U1.join(X,"server","pages"),U1.join(X,"server","fragments")];for(let R of _)L4.mkdirSync(R,{recursive:!0});console.log("[stx build] Discovering routes...");let B=P4(Y),q=["components","layouts","partials"],j=B.filter((R)=>{return!q.some((E)=>R.pattern.startsWith(`/${E}/`)||R.pattern===`/${E}`)});console.log(`[stx build] Found ${j.length} page routes (${B.length-j.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let H=eG($.debug),O=$K();await Bun.write(U1.join(X,"public","__stx",H.filename),H.content),await Bun.write(U1.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 V=[],L=[];for(let R of j)try{let E=await YK(R.filePath,R.pattern,{componentsDir:Q,partialsDir:G,layoutsDir:K,debug:$.debug});if(V.push(E),E.html=E.html.replace(/runtime\.__STX_HASH__\.js/g,H.filename).replace(/router\.__STX_HASH__\.js/g,O.filename),E.html=m7(E.html,U,{bodyScripts:[`<script src="/__stx/${O.filename}"></script>`]}),!/<body[^>]*\bdata-stx=/.test(E.html)){let x=E.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(x&&x[1]){let y=x[1];E.html=E.html.replace(" "+y,""),E.html=E.html.replace(/<body([^>]*)>/,`<body$1 ${y}>`)}}E.html=E.html.replace(/<style data-crosswind="generated">[\s\S]*?<\/style>\s*/g,""),E.html=await y0(E.html),E.fragment=u8(E.html,z);let I=R.pattern==="/"?"index":R.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),S=U1.join("server","pages",`${I}.compiled.json`),k=U1.join("server","fragments",`${I}.html`);await Bun.write(U1.join(X,S),JSON.stringify(E,null,2)),await Bun.write(U1.join(X,k),E.fragment),L.push({pattern:R.pattern,compiledPath:S,fragmentPath:k,isDynamic:E.hasServerScripts,hasParams:R.pattern.includes(":")||R.pattern.includes("[")}),console.log(`[stx build] \u2713 ${R.pattern}`)}catch(E){console.error(`[stx build] \u2717 ${R.pattern}:`,E instanceof Error?E.message:E)}let F=U1.resolve(Y,W);if(L4.existsSync(F)){let{copied:R,bytes:E}=TP(F,U1.join(X,"public"));if(R>0)console.log(`[stx build] Copied ${R} public asset${R===1?"":"s"} (${(E/1024).toFixed(1)}KB) from ${W}/`)}let A={runtime:H.filename,router:O.filename},w=QK(L,A,X);GK(w,X);let N=Date.now()-Z;return console.log(`
|
|
14459
|
+
[stx build] Done in ${N}ms \u2014 ${V.length} pages compiled`),{pageCount:V.length,assets:A,outputDir:X,duration:N}}var MP;var WK=D(()=>{l8();ZK();XK();RX();b5();K4();n0();MP=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"])});var oL={};$0(oL,{buildApp:()=>sL});import EP from"path";async function sL($={}){let Z=performance.now(),Y=$.root||process.cwd(),X=await g0(),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(() => (pL(),cL));Q=await W({pagesDir:EP.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(() => (WK(),aL));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 UK=D(()=>{n0()});import MX from"path";async function DP($){let Z=performance.now(),Y=await g0($),X=$||Y.root||process.cwd(),J=[Y.build?.pagesDir||Y.pagesDir||"pages",Y.componentsDir||"components",Y.layoutsDir||"layouts",Y.partialsDir||"partials"].map((K)=>MX.resolve(X,K)),Q=[],G=0;for(let K of J){let W=await eL(K);for(let U of W){G++;let z=await Bun.file(U).text();if(tL.test(z))Q.push(MX.relative(X,U))}}return{mode:Q.length>0?"ssr":"ssg",serverScriptFiles:Q,totalFilesScanned:G,scanDurationMs:Math.round(performance.now()-Z)}}async function kP($){let Z=await g0($),Y=$||Z.root||process.cwd(),X=MX.resolve(Y,Z.componentsDir||"components"),J=[],Q=await eL(X);for(let G of Q){let K=await Bun.file(G).text(),W=tL.test(K),U=IP.test(K)||/<script\b(?![^>]*\bserver\b)[^>]*>/i.test(K)&&!W;if(W&&U){let z=MX.relative(Y,G);J.push({file:z,message:`Component "${z}" has both <script server> and <script client>. `+"Components should be server OR client \u2014 compose them via props/slots."})}}return J}async function eL($){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 tL,IP;var $V=D(()=>{n0();tL=/<script\b[^>]*\bserver\b/i,IP=/<script\b[^>]*\bclient\b/i});function zK($){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(`
|
|
14460
14460
|
`,X.index-1);if(YV.includes(G)){let U=Z.get(G);if(U)U.count++,U.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 XV($,Z=[]){let Y=zK($),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 YV.filter((J)=>!X.has(J))}function JV($){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${CP(Q)} } from './${Q}'`);let J=$.filter((Q)=>!Q.startsWith("end")).map((Q)=>` '${Q}': true`).join(`,
|
|
14461
14461
|
`);return`// Tree-shaken directive bundle
|
|
14462
14462
|
// Only includes: ${$.join(", ")}
|
|
@@ -14470,7 +14470,7 @@ ${J}
|
|
|
14470
14470
|
export function isDirectiveActive(name: string): boolean {
|
|
14471
14471
|
return name in activeDirectives
|
|
14472
14472
|
}
|
|
14473
|
-
`}function QV($,Z={}){let Y=[],X=/@if\(([^)]+)\)[\s\S]*?@endif/g,J=$.matchAll(X);for(let U of J){let z=U[1].trim();if(TX(z,Z)===!1)Y.push({start:U.index,end:U.index+U[0].length,reason:`@if condition always false: ${z}`})}let Q=/@unless\(([^)]+)\)[\s\S]*?@endunless/g,G=$.matchAll(Q);for(let U of G){let z=U[1].trim();if(TX(z,Z)===!0)Y.push({start:U.index,end:U.index+U[0].length,reason:`@unless condition always true: ${z}`})}let K=/@env\(['"]development['"]\)[\s\S]*?@endenv/g;if(Z.__ENV__==="production"){let U=$.matchAll(K);for(let z of U)Y.push({start:z.index,end:z.index+z[0].length,reason:"Development-only code in production build"})}let W=/@debug[\s\S]*?@enddebug/g;if(Z.__ENV__==="production"){let U=$.matchAll(W);for(let z of U)Y.push({start:z.index,end:z.index+z[0].length,reason:"Debug code in production build"})}return Y}function GV($,Z={}){let Y=QV($,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 TX($,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=TX(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 KV($,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),U=Number.parseInt(K,10),z;switch(G){case"+":z=W+U;break;case"-":z=W-U;break;case"*":z=W*U;break;default:return J}return Y.push(`{{ ${Q} ${G} ${K} }} -> ${z}`),String(z)}),{content:X,folded:Y}}function WV($){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 UV($){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 U=`__STR_${Q++}__`;Z.set(U,K);let z=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),_=new RegExp(`(['"])${z}\\1`,"g");G=G.replace(_,U)}return{content:G,pool:Z,count:Z.size}}function zV($,Z={}){let Y={...ZV,...Z},X=new Blob([$]).size,J=$,Q=[],G=[],K=[],W=[],U=0;if(Y.target==="production")Y.constants={...Y.constants,__ENV__:"production"};if(Y.deadCodeElimination){let B=GV(J,Y.constants);if(J=B.content,B.removed.length>0)Q.push("Dead code elimination"),G.push(...B.removed.map((q)=>`Removed: ${q}`))}if(Y.constantFolding&&Object.keys(Y.constants).length>0){let B=KV(J,Y.constants);if(J=B.content,W=B.folded,W.length>0)Q.push("Constant folding")}if(Y.treeShake){if(K=XV(J,Y.preserveDirectives),K.length>0)Q.push("Tree shaking")}if(Y.stringPooling){let B=UV(J);if(J=B.content,U=B.count,U>0)Q.push("String pooling")}if(Y.minifyHtml){let B=WV(J);if(B.length<J.length)J=B,Q.push("HTML minification")}let z=new Blob([J]).size,_=X>0?Math.round((1-z/X)*100):0;return{content:J,originalSize:X,optimizedSize:z,reduction:_,appliedOptimizations:Q,removedDirectives:K,foldedConstants:W,pooledStrings:U,warnings:G}}async function SP($,Z={}){let Y={...ZV,...Z},X=new Map,J=[],Q=0,G=0,K=new Set;for(let[_,B]of $){let q=zV(B,Y);X.set(_,q),Q+=q.originalSize,G+=q.optimizedSize,J.push(...q.warnings.map((H)=>`${_}: ${H}`));let j=zK(B);for(let H of j)K.add(H.name)}let W;if(Y.treeShake)W=JV(Array.from(K));let U;if(Y.stringPooling)U=new Map;let z=Q>0?Math.round((1-G/Q)*100):0;return{templates:X,directiveBundle:W,stringPool:U,totalOriginalSize:Q,totalOptimizedSize:G,overallReduction:z,warnings:J}}function CP($){return $.charAt(0).toUpperCase()+$.slice(1)}var ZV,YV;var _V=D(()=>{ZV={treeShake:!0,deadCodeElimination:!0,constantFolding:!0,stringPooling:!1,minifyHtml:!0,removeDevCode:!0,constants:{},preserveDirectives:[],target:"production"},YV=["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 qK={};e(qK,{toUsers:()=>VV,toUser:()=>LV,stopBroadcasting:()=>HV,startBroadcasting:()=>jV,loadChannels:()=>OV,getBroadcastServer:()=>qV,channel:()=>wV,broadcastPrivate:()=>FV,broadcastPresence:()=>AV,broadcast:()=>BK,BroadcastServer:()=>RV,Broadcast:()=>NV});import{Broadcast as P5,BroadcastServer as bP}from"ts-broadcasting";import{channel as wV}from"ts-broadcasting";import{Broadcast as NV,BroadcastServer as RV}from"ts-broadcasting";function qV(){return f1}async function jV($){if(f1)return f1;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 f1=new bP(Q),P5.setServer(f1),await f1.start(),f1}async function HV(){for(let $ of _K)clearInterval($);if(_K.length=0,!f1)return;await f1.stop(),f1=null}async function OV($){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&&f1)f1.channels.channel(Q,G.authorize);if(G.interval&&G.data){let K=G.event??`${Q}.updated`,W=G.data,U=setInterval(async()=>{try{let z=await W();BK(Q,K,z)}catch{}},G.interval);_K.push(U)}}}),X}function c8(){if(f1)return!0;if(!BV)BV=!0,console.warn("[stx] broadcast() called before server started \u2014 messages will be sent once broadcasting is ready");return!1}function BK($,Z,Y){if(!c8())return;P5.send($,Z,Y)}function LV($,Z,Y){if(!c8())return;P5.toUser($,Z,Y)}function VV($,Z,Y){if(!c8())return;P5.toUsers($,Z,Y)}function FV($,Z,Y){if(!c8())return;P5.send(`private-${$}`,Z,Y)}function AV($,Z,Y){if(!c8())return;P5.presence($,Z,Y)}var f1=null,_K,BV=!1;var EX=D(()=>{_K=[]});function MV($,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 U="";while(J<X.length&&X[J]!==W)if(X[J]==="\\"&&J+1<X.length)U+=X[J+1],J+=2;else U+=X[J],J++;J++,G=U}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 z=X[J];J++;while(J<X.length&&X[J]!==z){if(X[J]==="\\")J++;J++}}J++}let U=X.slice(K,J);G=MV(U,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 z=X[J];J++;while(J<X.length&&X[J]!==z){if(X[J]==="\\")J++;J++}}J++}let U=X.slice(K,J);try{G=JSON.parse(U.replace(/'/g,'"'))}catch{G=U}}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 PP($,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=xP(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 yP($,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 xP($){if(Array.isArray($))return"array";if($===null)return"null";return typeof $}function vP(){return[TV]}var TV;var EV=D(()=>{S1();i0();N0();TV={name:"component",handler:async($,Z,Y,X)=>{if(Z.length<1)return B0("Component","component directive requires at least the component name",Q0.INVALID_DIRECTIVE_SYNTAX);let J=Z[0].replace(/['"]/g,""),Q={};if(Z.length>1)try{let z=Z.slice(1).join(",").trim();if(z.startsWith("{")){if(Q=p0(z,Y),Object.keys(Q).length===0)Q=MV(z,Y)}else{let _=z.trim(),B=Y[_];if(B&&typeof B==="object"&&!Array.isArray(B))Q=B}}catch(z){let _=z instanceof Error?z.message:String(z);return console.error("Component props parsing error:",_),B0("Component",`Error parsing component props: ${_}`,Q0.EVALUATION_ERROR)}let G=Y.__stx_options||{},K=G.componentsDir||"components",W=new Set;if(!Y.__processedComponents)Y.__processedComponents=new Set;let U=Y.__processedComponents;try{return await z4(J,Q,"",K,Y,X,G,U,W)}catch(z){console.error("Component rendering error:",z);let _=z instanceof Error?z.message:String(z);return B0("Component",`Error rendering component: ${_}`,Q0.COMPONENT_RENDER_ERROR)}},hasEndTag:!1}});import{mkdir as fP,readFile as gP,readdir as hP,stat as IV,writeFile as dP}from"fs/promises";import e1 from"path";function uP($){return $.replace(/\.stx$/i,"").split(/[^a-z0-9]+/i).filter(Boolean).map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function jK($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[^a-z0-9]+/gi,"-").replace(/^-+|-+$/g,"").toLowerCase()}function mP($){return/^[a-z][.0-9_a-z-]*-[.0-9_a-z-]*$/.test($)&&!$.startsWith("xml")&&!/[A-Z]/.test($)}function lP($){if($===!0)return"open";if($==="open"||$==="closed")return $;return!1}async function cP($){let Z=[];async function Y(X){let J=await hP(X,{withFileTypes:!0});J.sort((Q,G)=>Q.name.localeCompare(G.name));for(let Q of J){let G=e1.join(X,Q.name);if(Q.isDirectory()){if(!Q.name.startsWith(".")&&Q.name!=="node_modules")await Y(G)}else if(Q.isFile()&&Q.name.endsWith(".stx")&&!/\.(?:test|spec)\.stx$/i.test(Q.name))Z.push(G)}}return await Y($),Z}function pP($,Z){let Y=$.match(/<script\b(?=[^>]*(?:\bcomponent\b|\bstx:component\b))[^>]*>([\s\S]*?)<\/script>/i);if(!Y)return{};let X=Y[1].trim();if(!X)return{};try{return JSON.parse(X)}catch(J){throw Error(`${Z}: <script component> must contain JSON metadata (${J.message})`)}}function iP($,Z){let Y={},X=[...$.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)];for(let J of X){if(!/\bclient\b/i.test(J[1])||/\bcomponent\b|\bstx:component\b/i.test(J[1]))continue;let Q;try{Q=new Bun.Transpiler({loader:"ts"}).transformSync(J[2])}catch(W){throw Error(`${Z}: failed to transpile <script client> (${W.message})`)}let G=/(?:export\s+)?(?:async\s+)?function\s+([A-Za-z_$][\w$]*)\s*\(([^)]*)\)\s*\{/g,K;while(K=G.exec(Q)){let W=K[1];if(CV.has(W))throw Error(`${Z}: client method "${W}" is reserved`);let U=G.lastIndex,z=1,_="",B=!1,q=U;for(;q<Q.length&&z>0;q++){let H=Q[q];if(B){B=!1;continue}if(_){if(H==="\\")B=!0;else if(H===_)_="";continue}if(H==='"'||H==="'"||H==="`")_=H;else if(H==="{")z++;else if(H==="}")z--}if(z!==0)throw Error(`${Z}: unterminated client function "${W}"`);let j=K[0].includes("async")?"async ":"";Y[W]=`${j}${W}(${K[2]}) {${Q.slice(U,q-1)}}`,G.lastIndex=q}}return Y}function nP($){let Z=$.match(/<template\b(?![^>]*\bshadowrootmode\b)[^>]*>([\s\S]*?)<\/template>/i);return(Z?Z[1]:$).replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"").trim()}function DV($){return[...$.matchAll(/<style\b[^>]*>([\s\S]*?)<\/style>/gi)].map((Z)=>Z[1].trim()).filter(Boolean).join(`
|
|
14473
|
+
`}function QV($,Z={}){let Y=[],X=/@if\(([^)]+)\)[\s\S]*?@endif/g,J=$.matchAll(X);for(let U of J){let z=U[1].trim();if(TX(z,Z)===!1)Y.push({start:U.index,end:U.index+U[0].length,reason:`@if condition always false: ${z}`})}let Q=/@unless\(([^)]+)\)[\s\S]*?@endunless/g,G=$.matchAll(Q);for(let U of G){let z=U[1].trim();if(TX(z,Z)===!0)Y.push({start:U.index,end:U.index+U[0].length,reason:`@unless condition always true: ${z}`})}let K=/@env\(['"]development['"]\)[\s\S]*?@endenv/g;if(Z.__ENV__==="production"){let U=$.matchAll(K);for(let z of U)Y.push({start:z.index,end:z.index+z[0].length,reason:"Development-only code in production build"})}let W=/@debug[\s\S]*?@enddebug/g;if(Z.__ENV__==="production"){let U=$.matchAll(W);for(let z of U)Y.push({start:z.index,end:z.index+z[0].length,reason:"Debug code in production build"})}return Y}function GV($,Z={}){let Y=QV($,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 TX($,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=TX(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 KV($,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),U=Number.parseInt(K,10),z;switch(G){case"+":z=W+U;break;case"-":z=W-U;break;case"*":z=W*U;break;default:return J}return Y.push(`{{ ${Q} ${G} ${K} }} -> ${z}`),String(z)}),{content:X,folded:Y}}function WV($){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 UV($){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 U=`__STR_${Q++}__`;Z.set(U,K);let z=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),_=new RegExp(`(['"])${z}\\1`,"g");G=G.replace(_,U)}return{content:G,pool:Z,count:Z.size}}function zV($,Z={}){let Y={...ZV,...Z},X=new Blob([$]).size,J=$,Q=[],G=[],K=[],W=[],U=0;if(Y.target==="production")Y.constants={...Y.constants,__ENV__:"production"};if(Y.deadCodeElimination){let B=GV(J,Y.constants);if(J=B.content,B.removed.length>0)Q.push("Dead code elimination"),G.push(...B.removed.map((q)=>`Removed: ${q}`))}if(Y.constantFolding&&Object.keys(Y.constants).length>0){let B=KV(J,Y.constants);if(J=B.content,W=B.folded,W.length>0)Q.push("Constant folding")}if(Y.treeShake){if(K=XV(J,Y.preserveDirectives),K.length>0)Q.push("Tree shaking")}if(Y.stringPooling){let B=UV(J);if(J=B.content,U=B.count,U>0)Q.push("String pooling")}if(Y.minifyHtml){let B=WV(J);if(B.length<J.length)J=B,Q.push("HTML minification")}let z=new Blob([J]).size,_=X>0?Math.round((1-z/X)*100):0;return{content:J,originalSize:X,optimizedSize:z,reduction:_,appliedOptimizations:Q,removedDirectives:K,foldedConstants:W,pooledStrings:U,warnings:G}}async function SP($,Z={}){let Y={...ZV,...Z},X=new Map,J=[],Q=0,G=0,K=new Set;for(let[_,B]of $){let q=zV(B,Y);X.set(_,q),Q+=q.originalSize,G+=q.optimizedSize,J.push(...q.warnings.map((H)=>`${_}: ${H}`));let j=zK(B);for(let H of j)K.add(H.name)}let W;if(Y.treeShake)W=JV(Array.from(K));let U;if(Y.stringPooling)U=new Map;let z=Q>0?Math.round((1-G/Q)*100):0;return{templates:X,directiveBundle:W,stringPool:U,totalOriginalSize:Q,totalOptimizedSize:G,overallReduction:z,warnings:J}}function CP($){return $.charAt(0).toUpperCase()+$.slice(1)}var ZV,YV;var _V=D(()=>{ZV={treeShake:!0,deadCodeElimination:!0,constantFolding:!0,stringPooling:!1,minifyHtml:!0,removeDevCode:!0,constants:{},preserveDirectives:[],target:"production"},YV=["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 qK={};$0(qK,{toUsers:()=>VV,toUser:()=>LV,stopBroadcasting:()=>HV,startBroadcasting:()=>jV,loadChannels:()=>OV,getBroadcastServer:()=>qV,channel:()=>wV,broadcastPrivate:()=>FV,broadcastPresence:()=>AV,broadcast:()=>BK,BroadcastServer:()=>RV,Broadcast:()=>NV});import{Broadcast as P5,BroadcastServer as bP}from"ts-broadcasting";import{channel as wV}from"ts-broadcasting";import{Broadcast as NV,BroadcastServer as RV}from"ts-broadcasting";function qV(){return f1}async function jV($){if(f1)return f1;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 f1=new bP(Q),P5.setServer(f1),await f1.start(),f1}async function HV(){for(let $ of _K)clearInterval($);if(_K.length=0,!f1)return;await f1.stop(),f1=null}async function OV($){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&&f1)f1.channels.channel(Q,G.authorize);if(G.interval&&G.data){let K=G.event??`${Q}.updated`,W=G.data,U=setInterval(async()=>{try{let z=await W();BK(Q,K,z)}catch{}},G.interval);_K.push(U)}}}),X}function c8(){if(f1)return!0;if(!BV)BV=!0,console.warn("[stx] broadcast() called before server started \u2014 messages will be sent once broadcasting is ready");return!1}function BK($,Z,Y){if(!c8())return;P5.send($,Z,Y)}function LV($,Z,Y){if(!c8())return;P5.toUser($,Z,Y)}function VV($,Z,Y){if(!c8())return;P5.toUsers($,Z,Y)}function FV($,Z,Y){if(!c8())return;P5.send(`private-${$}`,Z,Y)}function AV($,Z,Y){if(!c8())return;P5.presence($,Z,Y)}var f1=null,_K,BV=!1;var EX=D(()=>{_K=[]});function MV($,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 U="";while(J<X.length&&X[J]!==W)if(X[J]==="\\"&&J+1<X.length)U+=X[J+1],J+=2;else U+=X[J],J++;J++,G=U}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 z=X[J];J++;while(J<X.length&&X[J]!==z){if(X[J]==="\\")J++;J++}}J++}let U=X.slice(K,J);G=MV(U,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 z=X[J];J++;while(J<X.length&&X[J]!==z){if(X[J]==="\\")J++;J++}}J++}let U=X.slice(K,J);try{G=JSON.parse(U.replace(/'/g,'"'))}catch{G=U}}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 PP($,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=xP(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 yP($,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 xP($){if(Array.isArray($))return"array";if($===null)return"null";return typeof $}function vP(){return[TV]}var TV;var EV=D(()=>{S1();i0();N0();TV={name:"component",handler:async($,Z,Y,X)=>{if(Z.length<1)return B0("Component","component directive requires at least the component name",Q0.INVALID_DIRECTIVE_SYNTAX);let J=Z[0].replace(/['"]/g,""),Q={};if(Z.length>1)try{let z=Z.slice(1).join(",").trim();if(z.startsWith("{")){if(Q=p0(z,Y),Object.keys(Q).length===0)Q=MV(z,Y)}else{let _=z.trim(),B=Y[_];if(B&&typeof B==="object"&&!Array.isArray(B))Q=B}}catch(z){let _=z instanceof Error?z.message:String(z);return console.error("Component props parsing error:",_),B0("Component",`Error parsing component props: ${_}`,Q0.EVALUATION_ERROR)}let G=Y.__stx_options||{},K=G.componentsDir||"components",W=new Set;if(!Y.__processedComponents)Y.__processedComponents=new Set;let U=Y.__processedComponents;try{return await z4(J,Q,"",K,Y,X,G,U,W)}catch(z){console.error("Component rendering error:",z);let _=z instanceof Error?z.message:String(z);return B0("Component",`Error rendering component: ${_}`,Q0.COMPONENT_RENDER_ERROR)}},hasEndTag:!1}});import{mkdir as fP,readFile as gP,readdir as hP,stat as IV,writeFile as dP}from"fs/promises";import e1 from"path";function uP($){return $.replace(/\.stx$/i,"").split(/[^a-z0-9]+/i).filter(Boolean).map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function jK($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[^a-z0-9]+/gi,"-").replace(/^-+|-+$/g,"").toLowerCase()}function mP($){return/^[a-z][.0-9_a-z-]*-[.0-9_a-z-]*$/.test($)&&!$.startsWith("xml")&&!/[A-Z]/.test($)}function lP($){if($===!0)return"open";if($==="open"||$==="closed")return $;return!1}async function cP($){let Z=[];async function Y(X){let J=await hP(X,{withFileTypes:!0});J.sort((Q,G)=>Q.name.localeCompare(G.name));for(let Q of J){let G=e1.join(X,Q.name);if(Q.isDirectory()){if(!Q.name.startsWith(".")&&Q.name!=="node_modules")await Y(G)}else if(Q.isFile()&&Q.name.endsWith(".stx")&&!/\.(?:test|spec)\.stx$/i.test(Q.name))Z.push(G)}}return await Y($),Z}function pP($,Z){let Y=$.match(/<script\b(?=[^>]*(?:\bcomponent\b|\bstx:component\b))[^>]*>([\s\S]*?)<\/script>/i);if(!Y)return{};let X=Y[1].trim();if(!X)return{};try{return JSON.parse(X)}catch(J){throw Error(`${Z}: <script component> must contain JSON metadata (${J.message})`)}}function iP($,Z){let Y={},X=[...$.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)];for(let J of X){if(!/\bclient\b/i.test(J[1])||/\bcomponent\b|\bstx:component\b/i.test(J[1]))continue;let Q;try{Q=new Bun.Transpiler({loader:"ts"}).transformSync(J[2])}catch(W){throw Error(`${Z}: failed to transpile <script client> (${W.message})`)}let G=/(?:export\s+)?(?:async\s+)?function\s+([A-Za-z_$][\w$]*)\s*\(([^)]*)\)\s*\{/g,K;while(K=G.exec(Q)){let W=K[1];if(CV.has(W))throw Error(`${Z}: client method "${W}" is reserved`);let U=G.lastIndex,z=1,_="",B=!1,q=U;for(;q<Q.length&&z>0;q++){let H=Q[q];if(B){B=!1;continue}if(_){if(H==="\\")B=!0;else if(H===_)_="";continue}if(H==='"'||H==="'"||H==="`")_=H;else if(H==="{")z++;else if(H==="}")z--}if(z!==0)throw Error(`${Z}: unterminated client function "${W}"`);let j=K[0].includes("async")?"async ":"";Y[W]=`${j}${W}(${K[2]}) {${Q.slice(U,q-1)}}`,G.lastIndex=q}}return Y}function nP($){let Z=$.match(/<template\b(?![^>]*\bshadowrootmode\b)[^>]*>([\s\S]*?)<\/template>/i);return(Z?Z[1]:$).replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"").trim()}function DV($){return[...$.matchAll(/<style\b[^>]*>([\s\S]*?)<\/style>/gi)].map((Z)=>Z[1].trim()).filter(Boolean).join(`
|
|
14474
14474
|
|
|
14475
14475
|
`)}function rP($){let Z=new Set;return{template:$.replace(/\s@([a-z][\w:-]*)(\.[\w.-]+)?\s*=\s*(["'])([A-Za-z_$][\w$]*)\3/gi,(X,J,Q,G,K)=>{let W=J.toLowerCase();Z.add(W);let U=(Q||"").split(".").filter(Boolean).join(" ");return` data-stx-on-${W}="${K}"${U?` data-stx-mod-${W}="${U}"`:""}`}),eventTypes:[...Z].sort()}}function aP($){let Z=[];return{template:$.replace(/\s:([a-z][\w:-]*)\s*=\s*(["'])([\w$.]+)\2/gi,(X,J,Q,G)=>{let K=Z.length;return Z.push({id:K,name:J,expression:G}),` data-stx-bind-${K}=""`}),bindings:Z}}function sP($){let Z=new Set;for(let Y of $.matchAll(/<slot\b([^>]*)>/gi))Z.add(Y[1].match(/\bname\s*=\s*["']([^"']+)["']/i)?.[1]||"");return[...Z].map((Y)=>({name:Y}))}function oP($){return[...new Set([...$.matchAll(/(--[a-z0-9_-]+)\s*:/gi)].map((Z)=>Z[1]))].sort().map((Z)=>({name:Z}))}function tP($,Z){if(!Z||!new Set(["string","number","boolean","object","array"]).has(Z.type))throw Error(`Property "${$}" must declare one of: string, number, boolean, object, array`);return{...Z,reflect:Z.reflect??Z.attribute!==!1}}async function eP($,Z,Y){let X=e1.isAbsolute(Z.file)?Z.file:e1.resolve($,Z.file),J=await gP(X,"utf8"),Q=pP(J,X),G=e1.basename(X,".stx"),K=Z.name||Q.name||uP(G),W=`${jK(Y.prefix||"stx")}-${jK(G)}`,U=Z.tag||Q.tag||W;if(!K||!/^[A-Za-z_$][\w$]*$/.test(K))throw Error(`${X}: invalid component class name "${K}"`);if(!mP(U))throw Error(`${X}: invalid custom-element tag "${U}"; tags must be lowercase and contain a hyphen`);let z=Z.properties||Q.properties||Q.props||{},_=Object.fromEntries(Object.entries(z).map(([V,L])=>[V,tP(V,L)])),B=rP(nP(J)),q=aP(B.template),j=Q.methods||{},H=Z.methods||{},O=iP(J,X);return{file:e1.relative($,X),sourcePath:X,name:K,tag:U,description:Z.description||Q.description||"",template:q.template,styles:DV(J),shadowMode:lP(Z.shadowDOM??Q.shadowDOM??Y.shadowDOM),progressive:Z.progressive??Q.progressive??Y.progressive??!0,properties:_,events:Z.events||Q.events||{},methods:{...j,...H,...O},eventTypes:B.eventTypes,bindings:q.bindings,slots:sP(q.template),cssProperties:oP(DV(J))}}function $y(){let $=JSON.stringify("\\{!!\\s*([\\w$.]+)\\s*!!\\}"),Z=JSON.stringify("\\{\\{\\s*([\\w$.]+)\\s*\\}\\}");return`const HTMLElementBase = globalThis.HTMLElement || class {};
|
|
14476
14476
|
|
|
@@ -14970,7 +14970,7 @@ ${O}`:""}`)}if(W.push(q),$.sourcemap==="external")W.push(`${q}.map`)}let j=await
|
|
|
14970
14970
|
<td>@${Q.name}</td>
|
|
14971
14971
|
<td>${Q.description||"-"}</td>
|
|
14972
14972
|
<td>${Q.hasEndTag?"Yes":"No"}</td>
|
|
14973
|
-
</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,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}</code></pre>`}return J+="</body></html>",J}function dV($=[],Z=[],Y=[],X){return JSON.stringify({components:$,templates:Z,directives:Y,extraContent:X||""},null,2)}async function uV($){try{let{componentsDir:Z,templatesDir:Y,webComponentsConfig:X,customDirectives:J,config:Q}=$;if(!Q.enabled)return!1;let G=Q.outputDir||"docs";if(await LK.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 xV(Z,X),console.log(`Found ${K.length} components`);let W=[];if(Q.templates!==!1&&Y)console.log("Generating template documentation..."),W=await vV(Y),console.log(`Found ${W.length} templates`);let U=[];if(Q.directives!==!1)console.log("Generating directive documentation..."),U=await fV(J),console.log(`Found ${U.length} directives`);let z=Q.format||"markdown",_=Q.extraContent,B="",q="";switch(z){case"markdown":B=gV(K,W,U,_),q="md";break;case"html":B=hV(K,W,U,_),q="html";break;case"json":B=dV(K,W,U,_),q="json";break;default:throw Error(`Unsupported documentation format: ${z}`)}let j=p8.join(G,`stx-docs.${q}`);return await Bun.write(j,B),console.log(`Documentation generated: ${j}`),!0}catch(Z){return console.error("Error generating documentation:",Z),!1}}async function FK($){let Z={enabled:!0,outputDir:$.output||"docs",format:$.format||"markdown",components:$.components!==!1,templates:$.templates!==!1,directives:$.directives!==!1,extraContent:$.extraContent},Y=$.componentsDir||T1.componentsDir,X=$.templatesDir||".";return uV({componentsDir:Y,templatesDir:X,webComponentsConfig:T1.webComponents,customDirectives:T1.customDirectives,config:Z})}var AK=D(()=>{n0();N0()});import y5 from"process";function x5(){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(y5.versions?.node)return{platform:"node",version:y5.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 Gy(){let $=x5();return["cloudflare","deno","vercel","netlify","fastly"].includes($.platform)}function Ky(){return x5().platform!=="unknown"}function lV($){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(y5.env)return y5.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(y5.env){for(let[Y,X]of Object.entries(y5.env))if(X!==void 0)Z[Y]=X}return Z}}}function cV($){let Z=x5();if(Z.platform==="cloudflare"&&$)return $;if(Z.platform==="deno"&&"Deno"in globalThis)return Wy();if(Z.platform==="node"||Z.platform==="bun")return Uy();return}function Wy(){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 U=K.key.slice(1).join("/");if(!U.startsWith("stx-meta/"))G.push({name:U})}return{keys:G,list_complete:!0}}}}function Uy(){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 pV(){let $=x5();if($.platform==="cloudflare"&&"caches"in globalThis)return zy();if($.supportsStreaming)return _y();return}function zy(){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 _y(){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 By(){return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,9)}`}function qy($,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 wK($,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 i8($){let Z=x5();return async(Y,X)=>{let J=performance.now(),Q=By(),G={runtime:Z,platform:X||{},requestId:Q,geo:qy(Y,Z),timing:{start:J,getElapsed:()=>performance.now()-J},kv:cV(X?.KV),cache:pV(),env:lV(X?.env)};try{if(Y.method==="OPTIONS"&&$.cors){let W=new Response(null,{status:204});return W=wK(W,$.cors,Y.headers.get("Origin")||void 0),W}if($.cache?.enabled&&Y.method==="GET"&&G.cache){if(mV(Y,$.cache)){let U=await G.cache.match(Y);if(U){let z=new Response(U.body,U);return z.headers.set("X-Cache","HIT"),z.headers.set("X-Request-Id",Q),$.cors?wK(z,$.cors,Y.headers.get("Origin")||void 0):z}}}let K;if($.middleware&&$.middleware.length>0)K=await jy(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(mV(Y,$.cache)&&K.status===200){let U=$.cache.ttl||60,z=K.clone();z.headers.set("Cache-Control",`public, max-age=${U}`),await G.cache.put(Y,z),K.headers.set("X-Cache","MISS")}}if($.cors)K=wK(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 mV($,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 jy($,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 Hy($,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 Oy(){let $=new TextEncoder;return new TransformStream({transform(Z,Y){Y.enqueue($.encode(Z))}})}function Ly($){let Z=new TextEncoder;return new ReadableStream({async start(Y){for await(let X of $)Y.enqueue(Z.encode(X));Y.close()}})}function Vy($){let Z=i8($);return{async fetch(Y,X,J){return Z(Y,{env:X,ctx:J,KV:X.KV})}}}function Fy($){let Z=i8($);return(Y)=>Z(Y,{})}function Ay($){let Z=i8($);return(Y)=>Z(Y,{})}function wy($){let Z=i8($);return(Y,X)=>{return Z(Y,{netlifyContext:X})}}function Ny($){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 Ry($,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 My($,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 Ty($,Z=302){return new Response(null,{status:Z,headers:{Location:$}})}function Ey($="Not Found"){return new Response($,{status:404,headers:{"Content-Type":"text/plain"}})}var iV=()=>{};var eV={};e(eV,{captureScreenshots:()=>tV,captureScreenshot:()=>RK});var{WebView:Iy}=globalThis.Bun;import{existsSync as aV,mkdirSync as sV,readdirSync as Dy,statSync as oV}from"fs";import v5 from"path";function ky($){if(/^https?:\/\//.test($)||$.startsWith("file://"))return $;return`file://${v5.resolve($)}`}function nV($,Z,Y,X){return new Promise((J)=>{let Q=!1,G,K,W=()=>{if(!Q){if(Q=!0,clearTimeout(K),G)clearTimeout(G);$.onNavigated=void 0,J()}};K=setTimeout(W,X),$.onNavigated=()=>{if(!Q)G=setTimeout(W,Y)};try{let U=$.navigate(Z);if(U&&typeof U.catch==="function")U.catch(W)}catch{W()}})}async function rV($,Z,Y){let X=`!!document.querySelector(${JSON.stringify(Z)})`,J=Date.now()+Y;while(Date.now()<J){try{if(await $.evaluate(X))return}catch{}await new Promise((Q)=>setTimeout(Q,100))}}async function Sy($){try{let Z=await $.evaluate("Math.ceil(Math.max(document.documentElement.scrollHeight, document.documentElement.offsetHeight, document.body ? document.body.scrollHeight : 0, document.body ? document.body.offsetHeight : 0))");return typeof Z==="number"&&Number.isFinite(Z)&&Z>0?Math.min(Z,NK):0}catch{return 0}}async function RK($,Z,Y={}){let X=Math.min(Y.width??1440,NK),J=Math.min(Y.height??2200,NK),Q=Y.waitMs??800,G=Y.timeoutMs??15000,K=Y.format??"png",W=ky($),U=(_)=>new Iy({width:X,height:_,headless:!0,...Y.backend?{backend:Y.backend}:{}}),z=U(J);try{if(await nV(z,W,Q,G),Y.waitSelector)await rV(z,Y.waitSelector,G);if(Y.fullPage){let B=await Sy(z);if(B>J){if(z.close(),z=U(B),await nV(z,W,Q,G),Y.waitSelector)await rV(z,Y.waitSelector,G)}}let _=await z.screenshot({encoding:"buffer",format:K});sV(v5.dirname(v5.resolve(Z)),{recursive:!0}),await Bun.write(Z,_)}finally{z.close()}if(!aV(Z))throw Error(`Screenshot was not produced for ${$}`);return{input:$,output:Z,bytes:oV(Z).size}}async function tV($,Z,Y={}){sV(Z,{recursive:!0});let X;if(!/^https?:\/\//.test($)&&aV($)&&oV($).isDirectory())X=Dy($).filter((G)=>G.endsWith(".html")).map((G)=>v5.join($,G));else X=[$];let J=Y.format??"png",Q=[];for(let G of X){let K=/^https?:\/\//.test(G)?new URL(G).pathname.replace(/\W+/g,"-").replace(/^-|-$/g,"")||"index":v5.basename(G).replace(/\.html?$/,"");Q.push(await RK(G,v5.join(Z,`${K}.${J}`),Y))}return Q}var NK=16384;var MK=()=>{};function DX($,Z={}){let Y={...ZF,...Z};if($.trim()==="")return`
|
|
14973
|
+
</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,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}</code></pre>`}return J+="</body></html>",J}function dV($=[],Z=[],Y=[],X){return JSON.stringify({components:$,templates:Z,directives:Y,extraContent:X||""},null,2)}async function uV($){try{let{componentsDir:Z,templatesDir:Y,webComponentsConfig:X,customDirectives:J,config:Q}=$;if(!Q.enabled)return!1;let G=Q.outputDir||"docs";if(await LK.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 xV(Z,X),console.log(`Found ${K.length} components`);let W=[];if(Q.templates!==!1&&Y)console.log("Generating template documentation..."),W=await vV(Y),console.log(`Found ${W.length} templates`);let U=[];if(Q.directives!==!1)console.log("Generating directive documentation..."),U=await fV(J),console.log(`Found ${U.length} directives`);let z=Q.format||"markdown",_=Q.extraContent,B="",q="";switch(z){case"markdown":B=gV(K,W,U,_),q="md";break;case"html":B=hV(K,W,U,_),q="html";break;case"json":B=dV(K,W,U,_),q="json";break;default:throw Error(`Unsupported documentation format: ${z}`)}let j=p8.join(G,`stx-docs.${q}`);return await Bun.write(j,B),console.log(`Documentation generated: ${j}`),!0}catch(Z){return console.error("Error generating documentation:",Z),!1}}async function FK($){let Z={enabled:!0,outputDir:$.output||"docs",format:$.format||"markdown",components:$.components!==!1,templates:$.templates!==!1,directives:$.directives!==!1,extraContent:$.extraContent},Y=$.componentsDir||T1.componentsDir,X=$.templatesDir||".";return uV({componentsDir:Y,templatesDir:X,webComponentsConfig:T1.webComponents,customDirectives:T1.customDirectives,config:Z})}var AK=D(()=>{n0();N0()});import y5 from"process";function x5(){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(y5.versions?.node)return{platform:"node",version:y5.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 Gy(){let $=x5();return["cloudflare","deno","vercel","netlify","fastly"].includes($.platform)}function Ky(){return x5().platform!=="unknown"}function lV($){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(y5.env)return y5.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(y5.env){for(let[Y,X]of Object.entries(y5.env))if(X!==void 0)Z[Y]=X}return Z}}}function cV($){let Z=x5();if(Z.platform==="cloudflare"&&$)return $;if(Z.platform==="deno"&&"Deno"in globalThis)return Wy();if(Z.platform==="node"||Z.platform==="bun")return Uy();return}function Wy(){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 U=K.key.slice(1).join("/");if(!U.startsWith("stx-meta/"))G.push({name:U})}return{keys:G,list_complete:!0}}}}function Uy(){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 pV(){let $=x5();if($.platform==="cloudflare"&&"caches"in globalThis)return zy();if($.supportsStreaming)return _y();return}function zy(){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 _y(){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 By(){return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,9)}`}function qy($,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 wK($,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 i8($){let Z=x5();return async(Y,X)=>{let J=performance.now(),Q=By(),G={runtime:Z,platform:X||{},requestId:Q,geo:qy(Y,Z),timing:{start:J,getElapsed:()=>performance.now()-J},kv:cV(X?.KV),cache:pV(),env:lV(X?.env)};try{if(Y.method==="OPTIONS"&&$.cors){let W=new Response(null,{status:204});return W=wK(W,$.cors,Y.headers.get("Origin")||void 0),W}if($.cache?.enabled&&Y.method==="GET"&&G.cache){if(mV(Y,$.cache)){let U=await G.cache.match(Y);if(U){let z=new Response(U.body,U);return z.headers.set("X-Cache","HIT"),z.headers.set("X-Request-Id",Q),$.cors?wK(z,$.cors,Y.headers.get("Origin")||void 0):z}}}let K;if($.middleware&&$.middleware.length>0)K=await jy(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(mV(Y,$.cache)&&K.status===200){let U=$.cache.ttl||60,z=K.clone();z.headers.set("Cache-Control",`public, max-age=${U}`),await G.cache.put(Y,z),K.headers.set("X-Cache","MISS")}}if($.cors)K=wK(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 mV($,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 jy($,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 Hy($,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 Oy(){let $=new TextEncoder;return new TransformStream({transform(Z,Y){Y.enqueue($.encode(Z))}})}function Ly($){let Z=new TextEncoder;return new ReadableStream({async start(Y){for await(let X of $)Y.enqueue(Z.encode(X));Y.close()}})}function Vy($){let Z=i8($);return{async fetch(Y,X,J){return Z(Y,{env:X,ctx:J,KV:X.KV})}}}function Fy($){let Z=i8($);return(Y)=>Z(Y,{})}function Ay($){let Z=i8($);return(Y)=>Z(Y,{})}function wy($){let Z=i8($);return(Y,X)=>{return Z(Y,{netlifyContext:X})}}function Ny($){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 Ry($,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 My($,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 Ty($,Z=302){return new Response(null,{status:Z,headers:{Location:$}})}function Ey($="Not Found"){return new Response($,{status:404,headers:{"Content-Type":"text/plain"}})}var iV=()=>{};var eV={};$0(eV,{captureScreenshots:()=>tV,captureScreenshot:()=>RK});var{WebView:Iy}=globalThis.Bun;import{existsSync as aV,mkdirSync as sV,readdirSync as Dy,statSync as oV}from"fs";import v5 from"path";function ky($){if(/^https?:\/\//.test($)||$.startsWith("file://"))return $;return`file://${v5.resolve($)}`}function nV($,Z,Y,X){return new Promise((J)=>{let Q=!1,G,K,W=()=>{if(!Q){if(Q=!0,clearTimeout(K),G)clearTimeout(G);$.onNavigated=void 0,J()}};K=setTimeout(W,X),$.onNavigated=()=>{if(!Q)G=setTimeout(W,Y)};try{let U=$.navigate(Z);if(U&&typeof U.catch==="function")U.catch(W)}catch{W()}})}async function rV($,Z,Y){let X=`!!document.querySelector(${JSON.stringify(Z)})`,J=Date.now()+Y;while(Date.now()<J){try{if(await $.evaluate(X))return}catch{}await new Promise((Q)=>setTimeout(Q,100))}}async function Sy($){try{let Z=await $.evaluate("Math.ceil(Math.max(document.documentElement.scrollHeight, document.documentElement.offsetHeight, document.body ? document.body.scrollHeight : 0, document.body ? document.body.offsetHeight : 0))");return typeof Z==="number"&&Number.isFinite(Z)&&Z>0?Math.min(Z,NK):0}catch{return 0}}async function RK($,Z,Y={}){let X=Math.min(Y.width??1440,NK),J=Math.min(Y.height??2200,NK),Q=Y.waitMs??800,G=Y.timeoutMs??15000,K=Y.format??"png",W=ky($),U=(_)=>new Iy({width:X,height:_,headless:!0,...Y.backend?{backend:Y.backend}:{}}),z=U(J);try{if(await nV(z,W,Q,G),Y.waitSelector)await rV(z,Y.waitSelector,G);if(Y.fullPage){let B=await Sy(z);if(B>J){if(z.close(),z=U(B),await nV(z,W,Q,G),Y.waitSelector)await rV(z,Y.waitSelector,G)}}let _=await z.screenshot({encoding:"buffer",format:K});sV(v5.dirname(v5.resolve(Z)),{recursive:!0}),await Bun.write(Z,_)}finally{z.close()}if(!aV(Z))throw Error(`Screenshot was not produced for ${$}`);return{input:$,output:Z,bytes:oV(Z).size}}async function tV($,Z,Y={}){sV(Z,{recursive:!0});let X;if(!/^https?:\/\//.test($)&&aV($)&&oV($).isDirectory())X=Dy($).filter((G)=>G.endsWith(".html")).map((G)=>v5.join($,G));else X=[$];let J=Y.format??"png",Q=[];for(let G of X){let K=/^https?:\/\//.test(G)?new URL(G).pathname.replace(/\W+/g,"-").replace(/^-|-$/g,"")||"index":v5.basename(G).replace(/\.html?$/,"");Q.push(await RK(G,v5.join(Z,`${K}.${J}`),Y))}return Q}var NK=16384;var MK=()=>{};function DX($,Z={}){let Y={...ZF,...Z};if($.trim()==="")return`
|
|
14974
14974
|
`;let X=$;if(Y.trimTrailingWhitespace)X=X.replace(/[ \t]+$/gm,"");if(X=by(X,Y),X=vy(X,Y),X=Py(X,Y),Y.trimTrailingWhitespace)X=X.replace(/[ \t]+$/gm,""),X=X.replace(/(\S)[ \t]+(<\/[^>]+>)/g,"$1$2");if(X=X.replace(/\r\n/g,`
|
|
14975
14975
|
`).replace(/\r/g,`
|
|
14976
14976
|
`),!X.endsWith(`
|
|
@@ -15429,15 +15429,15 @@ const features = [
|
|
|
15429
15429
|
})();
|
|
15430
15430
|
</script>
|
|
15431
15431
|
</body>
|
|
15432
|
-
</html>`}var fy;var kK=D(()=>{fy={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"}}});var KF={}
|
|
15432
|
+
</html>`}var fy;var kK=D(()=>{fy={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"}}});var KF={};$0(KF,{startInteractive:()=>GF});import n8 from"fs";import F6 from"path";import*as QF from"readline";function ly($,Z){let Y=$.split(" "),X=Y[0];if(Y.length===1)return Object.keys(J$).filter((J)=>J.startsWith(X));if(["render","cat","load","cd"].includes(X)){let J=Y.slice(1).join(" "),Q=F6.dirname(J)||".",G=F6.basename(J),K=F6.resolve(Z.cwd,Q);if(n8.existsSync(K)&&n8.statSync(K).isDirectory())try{return n8.readdirSync(K).filter((U)=>U.startsWith(G)).map((U)=>`${X} ${Q==="."?"":`${Q}/`}${U}`)}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 GF($={}){let Z={context:$.context||{},cwd:$.cwd||process.cwd(),history:[],running:!0,lastResult:null},Y=QF.createInterface({input:process.stdin,output:process.stdout,completer:(J)=>{return[ly(J,Z),J]},historySize:$.maxHistory||100});console.log(`
|
|
15433
15433
|
${f.bold}${f.blue}stx Interactive Mode${f.reset}
|
|
15434
15434
|
${f.dim}Type 'help' for available commands, 'exit' to quit${f.reset}
|
|
15435
|
-
`);let X=()=>{let J=Z.cwd.replace(process.env.HOME||"","~");Y.question(`${f.cyan}stx${f.reset} ${f.dim}${J}${f.reset} ${f.green}>${f.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(),U=K.slice(1).map((z)=>z.replace(/^"|"$/g,""));if(W&&
|
|
15436
|
-
${f.dim}(Use 'exit' to quit)${f.reset}`),X()}),X()}var f,
|
|
15435
|
+
`);let X=()=>{let J=Z.cwd.replace(process.env.HOME||"","~");Y.question(`${f.cyan}stx${f.reset} ${f.dim}${J}${f.reset} ${f.green}>${f.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(),U=K.slice(1).map((z)=>z.replace(/^"|"$/g,""));if(W&&J$[W])try{await J$[W].handler(U,Z)}catch(z){console.log(`${f.red}Error:${f.reset}`,z)}else if(W)if(G.includes("{{")||G.includes("}}"))try{let z=await d1(G,Z.context,"eval");console.log(`${f.green}\u2192${f.reset} ${z}`)}catch{console.log(`${f.red}Unknown command: ${W}${f.reset}`),console.log(`${f.dim}Type 'help' for available commands${f.reset}`)}else console.log(`${f.red}Unknown command: ${W}${f.reset}`),console.log(`${f.dim}Type 'help' for available commands${f.reset}`);if(Z.running)X();else Y.close()})};Y.on("SIGINT",()=>{console.log(`
|
|
15436
|
+
${f.dim}(Use 'exit' to quit)${f.reset}`),X()}),X()}var f,J$;var SK=D(()=>{$1();q1();f={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},J$={help:{description:"Show available commands",usage:"help [command]",handler:async($,Z)=>{if($[0]&&J$[$[0]]){let Y=J$[$[0]];console.log(`
|
|
15437
15437
|
${f.bold}${$[0]}${f.reset} - ${Y.description}`),console.log(` Usage: ${f.cyan}${Y.usage}${f.reset}
|
|
15438
15438
|
`)}else{console.log(`
|
|
15439
15439
|
${f.bold}Available Commands:${f.reset}
|
|
15440
|
-
`);for(let[Y,X]of Object.entries(
|
|
15440
|
+
`);for(let[Y,X]of Object.entries(J$))console.log(` ${f.cyan}${Y.padEnd(12)}${f.reset} ${X.description}`);console.log(`
|
|
15441
15441
|
${f.dim}Type 'help <command>' for more details${f.reset}
|
|
15442
15442
|
`)}}},render:{description:"Render a template file",usage:"render <file> [--raw]",handler:async($,Z)=>{if(!$[0]){console.log(`${f.red}Error: Please specify a file to render${f.reset}`);return}let Y=F6.resolve(Z.cwd,$[0]);if(!await Bun.file(Y).exists()){console.log(`${f.red}Error: File not found: ${Y}${f.reset}`);return}try{let X=await Bun.file(Y).text(),J=$.includes("--raw");console.log(`
|
|
15443
15443
|
${f.dim}Rendering ${Y}...${f.reset}
|
|
@@ -15450,7 +15450,7 @@ ${f.bold}Markdown:${f.reset}`),G.forEach((W)=>console.log(` ${f.blue}${W}${f.re
|
|
|
15450
15450
|
${f.bold}Other:${f.reset}`),K.forEach((W)=>console.log(` ${f.dim}${W}${f.reset}`));console.log()}},cat:{description:"Show file contents",usage:"cat <file>",handler:async($,Z)=>{if(!$[0]){console.log(`${f.red}Error: Please specify a file${f.reset}`);return}let Y=F6.resolve(Z.cwd,$[0]);if(!await Bun.file(Y).exists()){console.log(`${f.red}Error: File not found: ${Y}${f.reset}`);return}let J=(await Bun.file(Y).text()).split(`
|
|
15451
15451
|
`);console.log(),J.forEach((Q,G)=>{let K=String(G+1).padStart(3," ");console.log(`${f.dim}${K}${f.reset} ${Q}`)}),console.log()}},load:{description:"Load context from JSON file",usage:"load <file.json>",handler:async($,Z)=>{if(!$[0]){console.log(`${f.red}Error: Please specify a JSON file${f.reset}`);return}let Y=F6.resolve(Z.cwd,$[0]);if(!await Bun.file(Y).exists()){console.log(`${f.red}Error: File not found: ${Y}${f.reset}`);return}try{let X=await Bun.file(Y).text(),J=JSON.parse(X);Z.context={...Z.context,...J},console.log(`${f.green}\u2713${f.reset} Loaded ${Object.keys(J).length} variables from ${$[0]}`)}catch(X){console.log(`${f.red}Error parsing JSON:${f.reset}`,X)}}},save:{description:"Save context to JSON file",usage:"save <file.json>",handler:async($,Z)=>{if(!$[0]){console.log(`${f.red}Error: Please specify a file name${f.reset}`);return}let Y=F6.resolve(Z.cwd,$[0]);try{await Bun.write(Y,JSON.stringify(Z.context,null,2)),console.log(`${f.green}\u2713${f.reset} Context saved to ${$[0]}`)}catch(X){console.log(`${f.red}Error saving file:${f.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(`${f.dim}No history${f.reset}`);return}console.log(),X.forEach((J,Q)=>{let G=String(Z.history.length-X.length+Q+1).padStart(3," ");console.log(`${f.dim}${G}${f.reset} ${J}`)}),console.log()}},exit:{description:"Exit interactive mode",usage:"exit",handler:async($,Z)=>{Z.running=!1,console.log(`
|
|
15452
15452
|
${f.dim}Goodbye!${f.reset}
|
|
15453
|
-
`)}},quit:{description:"Exit interactive mode (alias for exit)",usage:"quit",handler:async($,Z)=>
|
|
15453
|
+
`)}},quit:{description:"Exit interactive mode (alias for exit)",usage:"quit",handler:async($,Z)=>J$.exit.handler($,Z)}}});import{createHash as cy}from"crypto";import{existsSync as r8,mkdirSync as py,readFileSync as CK,writeFileSync as iy,readdirSync as ny,statSync as ry}from"fs";import{basename as a8,dirname as y4,extname as s8,join as V4,relative as WF}from"path";import{gzipSync as ay}from"zlib";class kX{config;startTime=0;outputs=[];chunks=[];assets=[];warnings=[];errors=[];moduleGraph=new Map;assetHashes=new Map;constructor($){this.config={...UF,...$}}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=a8(Y,s8(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=s8(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=V4(this.config.outDir,K);this.ensureDir(y4(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 V4(y4($),"..",Z);return V4(y4($),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 U=this.resolveRelativePath(Z,W[1]);if(r8(U)){let z=CK(U,"utf-8");X.push(`// Source: ${W[1]}
|
|
15454
15454
|
${z}`)}else this.warnings.push(`External script not found: ${U}`)}return""}),Y=Y.replace(/<link\b([^>]*)\bstx-inline\b([^>]*)(?:\/>|>)/gi,(Q,G,K)=>{let W=(G+K).match(/href=["']([^"']+)["']/);if(W){let U=this.resolveRelativePath(Z,W[1]);if(r8(U)){let z=CK(U,"utf-8");J.push(`/* Source: ${W[1]} */
|
|
15455
15455
|
${z}`)}else this.warnings.push(`External stylesheet not found: ${U}`)}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(`
|
|
15456
15456
|
|
|
@@ -15500,7 +15500,7 @@ ${z}`)}else this.warnings.push(`External stylesheet not found: ${U}`)}return""})
|
|
|
15500
15500
|
</table>
|
|
15501
15501
|
</body>
|
|
15502
15502
|
</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(`
|
|
15503
|
-
`)}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 cy("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(!r8($))py($,{recursive:!0})}walkDir($,Z){if(!r8($))return;let Y=ny($,{withFileTypes:!0});for(let X of Y){let J=V4($,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 sy($){return new kX($).build()}function oy($){return new kX($)}function ty($){return{...UF,...$}}var UF;var zF=D(()=>{UF={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 ey($,Z={}){return(await _F($,Z)).html}async function bK($,Z={}){let{html:Y,context:X}=await _F($,Z),{extractStreamBoundaries:J}=await Promise.resolve().then(() => (Y6(),
|
|
15503
|
+
`)}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 cy("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(!r8($))py($,{recursive:!0})}walkDir($,Z){if(!r8($))return;let Y=ny($,{withFileTypes:!0});for(let X of Y){let J=V4($,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 sy($){return new kX($).build()}function oy($){return new kX($)}function ty($){return{...UF,...$}}var UF;var zF=D(()=>{UF={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 ey($,Z={}){return(await _F($,Z)).html}async function bK($,Z={}){let{html:Y,context:X}=await _F($,Z),{extractStreamBoundaries:J}=await Promise.resolve().then(() => (Y6(),u6)),Q=J(X),G=$.streamTemplates;if(G&&Object.keys(G).length>0){let{processDirectives:K}=await Promise.resolve().then(() => (q1(),EY)),{defaultConfig:W}=await Promise.resolve().then(() => (n0(),KZ)),U=X.streamBoundaries||{},z={...W,autoShell:!1},_=Object.keys(G).map((q)=>({id:q,render:async()=>{let j=typeof U[q]==="function"?await U[q]():void 0;return K(G[q],{...X,$boundary:j},$.sourceFile,z,new Set)}})),B=new Set(_.map((q)=>q.id));Q=[...(Q||[]).filter((q)=>!B.has(q.id)),..._]}return{html:Y,boundaries:Q&&Q.length>0?Q:void 0}}async function _F($,Z){let Y={__filename:$.sourceFile,__dirname:$.sourceFile.replace(/[/\\][^/\\]+$/,""),...Z};if(!$.hasServerScripts&&!L$($.html))return{html:$.html,context:Y};for(let J of $.serverScriptContent)try{await D0(J,Y,$.sourceFile)}catch(Q){console.warn(`[stx] Server script error in ${$.sourceFile}:`,Q)}if(!L$($.html))return{html:$.html,context:Y};let X=new Map;for(let[J,Q]of Object.entries($.placeholders))if(Q.expression)try{let G=G1(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?v0(String(G)):"")}catch{X.set(J,"")}return{html:$Z($.html,X),context:Y}}async function $x($,Z={}){if(!$.hasServerScripts&&!L$($.fragment))return $.fragment;let Y={__filename:$.sourceFile,__dirname:$.sourceFile.replace(/[/\\][^/\\]+$/,""),...Z};for(let J of $.serverScriptContent)try{await D0(J,Y,$.sourceFile)}catch(Q){console.warn(`[stx] Server script error in ${$.sourceFile}:`,Q)}if(!L$($.fragment))return $.fragment;let X=new Map;for(let[J,Q]of Object.entries($.placeholders))if(Q.expression)try{let G=G1(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?v0(String(G)):"")}catch{X.set(J,"")}return $Z($.fragment,X)}var PK=D(()=>{X6();$1();U7()});var jF={};$0(jF,{startProductionServer:()=>qF});import BF from"fs";import A6 from"path";var{serve:Zx}=globalThis.Bun;async function qF($={}){let Z=A6.resolve($.outputDir||".output"),Y=$.port||3000,X=KK(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,G=new Map;for(let z of X.routes)try{let _=A6.join(Z,z.compiledPath),B=JSON.parse(await Bun.file(_).text());J.set(z.pattern,B),G.set(z.pattern,m8(B.html));let q=A6.join(Z,z.fragmentPath);if(await Bun.file(q).exists())Q.set(z.pattern,await Bun.file(q).text())}catch(_){console.warn(`[stx] Failed to load route ${z.pattern}:`,_)}let K=new Map,W=[];for(let z of X.routes)if(z.hasParams){let _=[],B=z.pattern.replace(/:([^/]+)/g,(q,j)=>{return _.push(j),"([^/]+)"});W.push({regex:new RegExp(`^${B}$`),route:z,paramNames:_})}else K.set(z.pattern,z);let U=Zx({port:Y,async fetch(z){let B=new URL(z.url).pathname;if($.onRequest){let V=await $.onRequest(z);if(V)return V}if($.apiRoutes?.[B])return $.apiRoutes[B](z);if((z.method==="GET"||z.method==="HEAD")&&B!=="/"){let V=A6.resolve(Z,"public"),L;try{L=decodeURIComponent(B)}catch{L=B}if(!L.includes("\x00")){let F=A6.resolve(V,`.${L}`);if(F===V||F.startsWith(`${V}${A6.sep}`))try{if(BF.existsSync(F)&&BF.statSync(F).isFile()){let w=A6.extname(F).toLowerCase(),N=Yx[w]||"application/octet-stream",R=B.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(B);return new Response(Bun.file(F),{headers:{"Content-Type":N,"Cache-Control":R?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let q=z.headers.get("X-STX-Router")==="true",j=null,H={};if(j=K.get(B)||null,!j)for(let{regex:V,route:L,paramNames:F}of W){let A=B.match(V);if(A){j=L,F.forEach((w,N)=>{H[w]=A[N+1]});break}}if(!j){let V=K.get("/404")||null;if(V){let L=J.get(V.pattern);if(L)return new Response(L.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}if(q){let V=Q.get(j.pattern);if(V){let L=G.get(j.pattern);return new Response(V,{headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...L?{"X-STX-Layout":L.layout,"X-STX-Layout-Group":L.group}:{},"Cache-Control":"no-cache"}})}}let O=J.get(j.pattern);if(!O){let V=K.get("/500")||null;if(V){let L=J.get(V.pattern);if(L)return new Response(L.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(!O.hasServerScripts&&Object.keys(O.placeholders).length===0)return new Response(O.html,{headers:{"Content-Type":"text/html","Cache-Control":"public, max-age=60"}});try{let{html:V,boundaries:L}=await bK(O,{params:H,request:z});if(L&&L.length>0){let{renderStreamingPage:F,streamToResponse:A}=await Promise.resolve().then(() => (Y6(),u6));return A(F(V,L,{timeoutMs:30000}),{headers:{"Cache-Control":"no-cache"}})}return new Response(V,{headers:{"Content-Type":"text/html","Cache-Control":"no-cache"}})}catch(V){return console.error(`[stx] Hydration error for ${B}:`,V),new Response(O.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:()=>U.stop()}}var Yx;var yK=D(()=>{RX();PK();b5();Yx={".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 xK="f9c3713";import{existsSync as o8,mkdirSync as vK}from"fs";import{join as w6,dirname as Xx}from"path";import{execSync as HF}from"child_process";async function Qx($,Z={}){let Y={success:!0,message:"",files:[],errors:[]},X=Z.template||"default",J=w6(process.cwd(),$);if(o8(J))return Y.success=!1,Y.message=`Directory ${$} already exists`,Y;try{vK(J,{recursive:!0});let Q=Gx(X);for(let K of Q)vK(w6(J,K),{recursive:!0});let G=Kx(X,$,Z);for(let[K,W]of Object.entries(G)){let U=w6(J,K);t8(Xx(U)),await Bun.write(U,W),Y.files.push(K)}if(!Z.skipGit)try{HF("git init",{cwd:J,stdio:"ignore"}),await Bun.write(w6(J,".gitignore"),Ax()),Y.files.push(".gitignore")}catch{Y.errors.push("Failed to initialize git repository")}if(!Z.skipInstall){let K=Z.packageManager||ux();try{console.log(`
|
|
15504
15504
|
Installing dependencies with ${K}...`),HF(`${K} install`,{cwd:J,stdio:"inherit"})}catch{Y.errors.push("Failed to install dependencies")}}Y.message=`Created project: ${$}`,console.log(`
|
|
15505
15505
|
\u2705 ${Y.message}
|
|
15506
15506
|
|
|
@@ -15512,28 +15512,28 @@ Next steps:
|
|
|
15512
15512
|
const title = props.title || '${$}'
|
|
15513
15513
|
const variant = props.variant || 'default'
|
|
15514
15514
|
</script>
|
|
15515
|
-
`);if(Y.push(`<div class="${
|
|
15515
|
+
`);if(Y.push(`<div class="${Q$($)} ${Q$($)}--{{ variant }}">
|
|
15516
15516
|
<h3>{{ title }}</h3>
|
|
15517
|
-
<div class="${
|
|
15517
|
+
<div class="${Q$($)}__content">
|
|
15518
15518
|
{{ slot }}
|
|
15519
15519
|
</div>
|
|
15520
15520
|
</div>`),Z.styles!==!1)Y.push(`
|
|
15521
15521
|
<style scoped>
|
|
15522
|
-
.${
|
|
15522
|
+
.${Q$($)} {
|
|
15523
15523
|
padding: 1rem;
|
|
15524
15524
|
border-radius: 8px;
|
|
15525
15525
|
background: #f8f9fa;
|
|
15526
15526
|
}
|
|
15527
15527
|
|
|
15528
|
-
.${
|
|
15528
|
+
.${Q$($)}--primary {
|
|
15529
15529
|
border-left: 3px solid #3498db;
|
|
15530
15530
|
}
|
|
15531
15531
|
|
|
15532
|
-
.${
|
|
15532
|
+
.${Q$($)}--success {
|
|
15533
15533
|
border-left: 3px solid #2ecc71;
|
|
15534
15534
|
}
|
|
15535
15535
|
|
|
15536
|
-
.${
|
|
15536
|
+
.${Q$($)}__content {
|
|
15537
15537
|
margin-top: 0.5rem;
|
|
15538
15538
|
}
|
|
15539
15539
|
</style>`);return Y.join(`
|
|
@@ -15974,7 +15974,7 @@ describe('Example', () => {
|
|
|
15974
15974
|
</footer>
|
|
15975
15975
|
@yield('scripts')
|
|
15976
15976
|
</body>
|
|
15977
|
-
</html>`}function fx(){return"<!-- Hero section -->"}function gx(){return"<!-- Features -->"}function hx(){return"<!-- Pricing -->"}function dx(){return"<!-- Button -->"}function t8($){if(!o8($))vK($,{recursive:!0})}function ux(){if(o8("bun.lockb"))return"bun";if(o8("pnpm-lock.yaml"))return"pnpm";if(o8("yarn.lock"))return"yarn";return"bun"}function fK($){return $.replace(/[-_\s]+(.)?/g,(Z,Y)=>Y?Y.toUpperCase():"").replace(/^./,(Z)=>Z.toUpperCase())}function mx($){return $.replace(/[-_\s]+(.)?/g,(Z,Y)=>Y?Y.toUpperCase():"").replace(/^./,(Z)=>Z.toLowerCase())}function
|
|
15977
|
+
</html>`}function fx(){return"<!-- Hero section -->"}function gx(){return"<!-- Features -->"}function hx(){return"<!-- Pricing -->"}function dx(){return"<!-- Button -->"}function t8($){if(!o8($))vK($,{recursive:!0})}function ux(){if(o8("bun.lockb"))return"bun";if(o8("pnpm-lock.yaml"))return"pnpm";if(o8("yarn.lock"))return"yarn";return"bun"}function fK($){return $.replace(/[-_\s]+(.)?/g,(Z,Y)=>Y?Y.toUpperCase():"").replace(/^./,(Z)=>Z.toUpperCase())}function mx($){return $.replace(/[-_\s]+(.)?/g,(Z,Y)=>Y?Y.toUpperCase():"").replace(/^./,(Z)=>Z.toLowerCase())}function Q$($){return $.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}var Jx;var wF=D(()=>{Jx={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:lx}=globalThis.Bun;import e8 from"fs";import N6 from"path";function cx($,Z=200,Y={}){return new Response($,{status:Z,headers:{"Content-Type":"text/html; charset=utf-8",...Y}})}async function NF($={}){let{port:Z=3000,root:Y=".",stxOptions:X={},watch:J=!0,onRequest:Q,routes:G={},middleware:K=[],on404:W,onError:U}=$,z=N6.resolve(Y),_=new Map;async function B(L){let F=e8.statSync(L),A=`${L}:${F.mtimeMs}`,w=_.get(A);if(w)return w.content;for(let P of _.keys())if(P.startsWith(`${L}:`)&&P!==A)_.delete(P);let N=await Bun.file(L).text(),R=N,E=U4(N);if(E)R=E.content.trim();let M=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,I=[],S=[],k;while((k=M.exec(N))!==null){let P=k[1],h=k[2],m=k[0];if(P.includes("server"))S.push(h);else I.push(m)}let x=N.match(/<style\b[^>]*>[\s\S]*?<\/style>/gi)||[],y=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,""),b={__filename:L,__dirname:N6.dirname(L)};for(let P of S)await D0(P,b,L);let c=await _0(y,b,L,X,new Set);if(x.length>0){let P=x.join(`
|
|
15978
15978
|
`);if(c.match(/(<\/head>)/i))c=c.replace(/(<\/head>)/i,`${P}
|
|
15979
15979
|
$1`)}if(I.length>0){let{interpolateScriptsInTemplate:P}=await Promise.resolve().then(() => ($1(),j7)),h=P(I.join(`
|
|
15980
15980
|
`),b);if(c.match(/(<\/body>)/i))c=c.replace(/(<\/body>)/i,`${h}
|
|
@@ -16015,7 +16015,7 @@ ${N instanceof Error?N.stack:""}</pre>`:"<h1>Internal Server Error</h1><p>An err
|
|
|
16015
16015
|
0% { transform: translateX(-100%); }
|
|
16016
16016
|
100% { transform: translateX(100%); }
|
|
16017
16017
|
}
|
|
16018
|
-
`,document.head.appendChild(Q)}return document.body.appendChild(Y),Y}function SX($,Z){if(!g5||!E1)return;if(F4=Math.min(Math.max($,0),100),mK)cancelAnimationFrame(mK);mK=requestAnimationFrame(()=>{if(!E1)return;E1.style.opacity=F4>0?"1":"0",E1.style.transform=`scaleX(${F4/100})`})}function Yv($){if(!g5)return;if($3=!0,F4=0,!E1)E1=IF($);if(f5)clearTimeout(f5);if(x4)clearInterval(x4);SX(10,$),x4=setInterval(()=>{if(!$3)return;let Z=90-F4,Y=Math.max(0.5,Z*0.1);if(F4<90)SX(F4+Y,$)},$.throttle)}function Xv($){if(!g5)return;if($3=!1,x4)clearInterval(x4),x4=null;SX(100,$),f5=setTimeout(()=>{if(E1)E1.style.opacity="0";setTimeout(()=>{if(F4=0,E1)E1.style.transform="scaleX(0)"},300)},200)}function Jv(){if(!g5)return;if($3=!1,F4=0,x4)clearInterval(x4),x4=null;if(f5)clearTimeout(f5),f5=null;if(E1)E1.style.opacity="0",E1.style.transform="scaleX(0)"}function DF($){let Z={...lK,...$};return{start:()=>Yv(Z),set:(Y)=>SX(Y,Z),finish:()=>Xv(Z),clear:()=>Jv(),get state(){return{isLoading:$3,progress:F4,error:!1}}}}function Qv($){if(!g5)return;if(
|
|
16018
|
+
`,document.head.appendChild(Q)}return document.body.appendChild(Y),Y}function SX($,Z){if(!g5||!E1)return;if(F4=Math.min(Math.max($,0),100),mK)cancelAnimationFrame(mK);mK=requestAnimationFrame(()=>{if(!E1)return;E1.style.opacity=F4>0?"1":"0",E1.style.transform=`scaleX(${F4/100})`})}function Yv($){if(!g5)return;if($3=!0,F4=0,!E1)E1=IF($);if(f5)clearTimeout(f5);if(x4)clearInterval(x4);SX(10,$),x4=setInterval(()=>{if(!$3)return;let Z=90-F4,Y=Math.max(0.5,Z*0.1);if(F4<90)SX(F4+Y,$)},$.throttle)}function Xv($){if(!g5)return;if($3=!1,x4)clearInterval(x4),x4=null;SX(100,$),f5=setTimeout(()=>{if(E1)E1.style.opacity="0";setTimeout(()=>{if(F4=0,E1)E1.style.transform="scaleX(0)"},300)},200)}function Jv(){if(!g5)return;if($3=!1,F4=0,x4)clearInterval(x4),x4=null;if(f5)clearTimeout(f5),f5=null;if(E1)E1.style.opacity="0",E1.style.transform="scaleX(0)"}function DF($){let Z={...lK,...$};return{start:()=>Yv(Z),set:(Y)=>SX(Y,Z),finish:()=>Xv(Z),clear:()=>Jv(),get state(){return{isLoading:$3,progress:F4,error:!1}}}}function Qv($){if(!g5)return;if(G$)G$(),G$=null;let Z={...lK,...$},Y=DF(Z);E1=IF(Z);let X=!1,J=(z)=>{let B=z.target.closest("a");if(!B)return;let q=B.getAttribute("href");if(!q)return;if(q.startsWith("http")||q.startsWith("#")||q.startsWith("mailto:")||q.startsWith("tel:")||B.target==="_blank"||B.hasAttribute("download"))return;X=!0,Y.start()},Q=()=>{if(!X)Y.start(),X=!0},G=()=>{if(X||Z.autoFinish)Y.finish(),X=!1};document.addEventListener("click",J),window.addEventListener("popstate",Q),window.addEventListener("load",G);let K=window.fetch,W=0,U=async function(...z){let _=typeof z[0]==="string"?z[0]:z[0].url,B=_.includes("/api/")||_.startsWith("/api");if(B){if(W++,W===1&&!X)Y.start()}try{return await K.apply(this,z)}finally{if(B){if(W--,W===0&&!X)Y.finish()}}};window.fetch=U,G$=()=>{if(document.removeEventListener("click",J),window.removeEventListener("popstate",Q),window.removeEventListener("load",G),window.fetch===U)window.fetch=K}}function Gv(){if(G$)G$(),G$=null}function Kv($){let Z={...lK,...$},Y=Z.initialColor?`linear-gradient(to right, ${Z.initialColor}, ${Z.color})`:Z.color;return`
|
|
16019
16019
|
<div id="stx-loading-indicator" style="
|
|
16020
16020
|
position: fixed;
|
|
16021
16021
|
top: 0;
|
|
@@ -16109,7 +16109,7 @@ ${N instanceof Error?N.stack:""}</pre>`:"<h1>Internal Server Error</h1><p>An err
|
|
|
16109
16109
|
window.addEventListener('load', function() { window.stxLoading.finish(); });
|
|
16110
16110
|
})();
|
|
16111
16111
|
</script>
|
|
16112
|
-
`}var g5,lK,E1=null,F4=0,$3=!1,mK=null,f5=null,x4=null,
|
|
16112
|
+
`}var g5,lK,E1=null,F4=0,$3=!1,mK=null,f5=null,x4=null,G$=null;var kF=D(()=>{g5=typeof window<"u"&&typeof document<"u",lK={color:"#6366f1",initialColor:"",height:"3px",duration:2000,throttle:200,autoFinish:!0,zIndex:999999}});var cK=`
|
|
16113
16113
|
<script data-stx-helpers>
|
|
16114
16114
|
(function() {
|
|
16115
16115
|
'use strict'
|
|
@@ -17714,7 +17714,7 @@ else {
|
|
|
17714
17714
|
})();
|
|
17715
17715
|
`.trim()}var kv;var rW=D(()=>{kv={method:"POST",fieldName:"file",timeout:60000,withCredentials:!1}});function aW(){return{script:[Q3(),K3(),U3()].join(`
|
|
17716
17716
|
|
|
17717
|
-
`),css:W3()}}function UA(){let{script:$,css:Z}=aW(),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 zA=D(()=>{gW();cW();rW();gW();cW();rW()});var _A=D(()=>{z6();yY()});var bv;var BA=D(()=>{aF();sQ();HG();jG();oF();$A();zA();_A();bv={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 lX from"fs";import
|
|
17717
|
+
`),css:W3()}}function UA(){let{script:$,css:Z}=aW(),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 zA=D(()=>{gW();cW();rW();gW();cW();rW()});var _A=D(()=>{z6();yY()});var bv;var BA=D(()=>{aF();sQ();HG();jG();oF();$A();zA();_A();bv={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 lX from"fs";import K$ from"path";async function sW($,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:K$.dirname($),props:Z,...Z};if(Q)await D0(Q,K,$);let W={...N1,...Y};return await _0(G,K,$,W,new Set)}async function qA($){let Z=performance.now(),Y={success:!0,views:[],errors:[],duration:0},{viewsDir:X,outputDir:J,componentsDir:Q=K$.join(X,"components"),layoutsDir:G=K$.join(X,"layouts"),partialsDir:K=K$.join(X,"partials"),globalProps:W={},placeholders:U={},views:z,debug:_=!1,generateManifest:B=!0}=$;if(_)console.log("Building STX views..."),console.log(` Source: ${X}`),console.log(` Output: ${J}`);lX.mkdirSync(J,{recursive:!0});let q={componentsDir:Q,layoutsDir:G,partialsDir:K,debug:_},j;if(z&&z.length>0)j=z;else j=lX.readdirSync(X).filter((O)=>O.endsWith(".stx")).map((O)=>({input:O}));for(let H of j){let O=K$.join(X,H.input),V=H.output||H.input.replace(/\.stx$/,".html"),L=K$.join(J,V);if(_)console.log(` Building ${H.input}...`);try{let F={...W,...H.props,...U},A=await sW(O,F,q);await Bun.write(L,A),Y.views.push(V)}catch(F){let A=F instanceof Error?F.message:String(F);if(Y.errors.push({file:H.input,error:A}),Y.success=!1,_)console.error(` Error: ${A}`)}}if(B){let H={buildTime:new Date().toISOString(),views:Y.views,placeholders:U,errors:Y.errors.length>0?Y.errors:void 0};await Bun.write(K$.join(J,"manifest.json"),JSON.stringify(H,null,2))}if(Y.duration=performance.now()-Z,_)if(Y.success)console.log(`
|
|
17718
17718
|
\u2705 Built ${Y.views.length} views in ${Y.duration.toFixed(0)}ms`);else console.log(`
|
|
17719
17719
|
\u26A0\uFE0F Built ${Y.views.length} views with ${Y.errors.length} errors`);return Y}function Pv($,Z){let Y=lX.watch($.viewsDir,{recursive:!0},async(X,J)=>{if(!J)return;if(J.endsWith(".stx")||J.endsWith(".ts")||J.endsWith(".js")){if($.debug)console.log(`
|
|
17720
17720
|
File changed: ${J}, rebuilding...`);let Q=await qA($);Z?.(Q)}});return{close:()=>Y.close()}}async function yv($,Z={},Y={}){let X={...Y,skipDefaultSeoTags:!0,skipSignalsRuntime:!0},J=await sW($,Z,X);J=await xv(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,`
|
|
@@ -17808,7 +17808,7 @@ File changed: ${J}, rebuilding...`);let Q=await qA($);Z?.(Q)}});return{close:()=
|
|
|
17808
17808
|
return refs;
|
|
17809
17809
|
};
|
|
17810
17810
|
})();
|
|
17811
|
-
`}var $4=null,cX;var oW=D(()=>{cX=new Map});function mv($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function tW($){return $.replace(/&/g,"&").replace(/"/g,""")}function SA($){if($==null||typeof $==="boolean")return[];if(!Array.isArray($))return[IA($)];return $.flat(1/0).map(IA).filter((Z)=>Z!=="")}function IA($){if($==null||typeof $==="boolean")return"";if(typeof $==="string")return $;if(typeof $==="number")return String($);return $}function
|
|
17811
|
+
`}var $4=null,cX;var oW=D(()=>{cX=new Map});function mv($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function tW($){return $.replace(/&/g,"&").replace(/"/g,""")}function SA($){if($==null||typeof $==="boolean")return[];if(!Array.isArray($))return[IA($)];return $.flat(1/0).map(IA).filter((Z)=>Z!=="")}function IA($){if($==null||typeof $==="boolean")return"";if(typeof $==="string")return $;if(typeof $==="number")return String($);return $}function z$($,Z,Y){let{children:X,ref:J,key:Q,...G}=Z||{};return{type:$,props:Object.keys(G).length>0?G:null,children:SA(X),key:Y??Q??void 0,ref:J??void 0}}function PA($){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 eW($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map(eW).join(" ");if(typeof $==="object"&&$!==null)return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return""}function lv($){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=kA[Y]||Y;if(J==="class"||J==="className"){let Q=eW(X);if(Q)Z.push(` class="${tW(Q)}"`);continue}if(J==="style"){let Q=typeof X==="string"?X:PA(X);if(Q)Z.push(` style="${tW(Q)}"`);continue}if(DA.has(J)){if(X)Z.push(` ${J}`);continue}if(X!=null&&X!==!1)Z.push(` ${J}="${tW(String(X))}"`)}return Z.join("")}function W$($){if($==null||typeof $==="boolean")return"";if(typeof $==="string")return mv($);if(typeof $==="number")return String($);if(Array.isArray($))return $.map(W$).join("");if($.type===U$)return $.children.map(W$).join("");if(typeof $.type==="function"){let Q=$.type({...$.props,children:$.children.length===1?$.children[0]:$.children.length>0?$.children:void 0});return W$(Q)}let Z=$.type,Y=lv($.props),X=$.props?.innerHTML??$.props?.dangerouslySetInnerHTML?.__html;if(X!=null)return`<${Z}${Y}>${X}</${Z}>`;if(uv.has(Z))return`<${Z}${Y}>`;let J=$.children.map(W$).join("");return`<${Z}${Y}>${J}</${Z}>`}function yA($){return new ReadableStream({start(Z){Z.enqueue(W$($)),Z.close()}})}function cv($,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=kA[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=eW(X);if(Q)$.setAttribute("class",Q);continue}if(J==="style"){let Q=typeof X==="string"?X:PA(X);if(Q)$.setAttribute("style",Q);continue}if(DA.has(J)){if(X)$.setAttribute(J,"");continue}if(X!=null&&X!==!1)$.setAttribute(J,String(X))}}function m5($,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 $)m5(J,Z);return}if($.type===U$){for(let J of $.children)m5(J,Z);return}if(typeof $.type==="function"){let J=$.type({...$.props,children:$.children.length===1?$.children[0]:$.children.length>0?$.children:void 0});m5(J,Z);return}let Y=document.createElement($.type);cv(Y,$.props);let X=$.props?.innerHTML??$.props?.dangerouslySetInnerHTML?.__html;if(X!=null)Y.innerHTML=X;else for(let J of $.children)m5(J,Y);if($.ref){if(typeof $.ref==="function")$.ref(Y)}Z.appendChild(Y)}function xA($){if($.when)return z$(U$,{children:$.children});return $.fallback??null}function vA($){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 z$(U$,{children:X})}function fA($){return z$(U$,{children:$.children})}function gA($,Z,...Y){let{key:X,ref:J,...Q}=Z||{};return{type:$,props:Object.keys(Q).length>0?Q:{},children:SA(Y.length===1?Y[0]:Y),key:X??void 0,ref:J??void 0}}var U$,uv,DA,kA,CA,bA;var hA=D(()=>{U$=Symbol.for("stx.Fragment"),uv=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),DA=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"]),kA={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"};CA=z$,bA=z$});function $U($,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 pX(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((U)=>{U.removeAttribute("v-cloak")})}return G},unmount(){X.clear(),J.clear(),Y.clear()}};return G}function dA($){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 uA=D(()=>{oW()});import{dirname as pv,resolve as mA}from"path";function iv($){let Z=$,Y=U4($);if(Y)Z=Y.content.trim();let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,J=[],Q=[],G=[],K=(z)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(z),W;while((W=X.exec($))!==null){let z=W[1],_=W[2],B=W[0],q=z.includes("server");if(K(_))G.push(B);else if(q)Q.push(_);else J.push(B)}let U=Z;{let z=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,_,B=[];while((_=z.exec(U))!==null){let q=_.index+_[0].length,j=1,H=q;while(H<U.length&&j>0){let O=U.indexOf("<script",H),V=U.indexOf("</script>",H);if(V===-1)break;if(O!==-1&&O<V)j++,H=O+7;else{if(j--,j===0){B.push({start:_.index,end:V+9});break}H=V+9}}}for(let q=B.length-1;q>=0;q--)U=U.substring(0,B[q].start)+U.substring(B[q].end)}for(let z of J)U=U.replace(z,"");return{templateContent:U,serverScripts:Q,clientScripts:J,signalsScripts:G}}function nv($,Z){return`<!DOCTYPE html>
|
|
17812
17812
|
<html lang="en">
|
|
17813
17813
|
<head>
|
|
17814
17814
|
<meta charset="UTF-8">
|
|
@@ -17823,7 +17823,7 @@ ${Q.join(`
|
|
|
17823
17823
|
`)}`}else{if(Y.processClientScripts!==!1&&Q.length>0){let z=K.__stx_event_bindings||[],_=m4(K),q=(await Promise.all(Q.map(async(H)=>{let O=H.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!O)return H;return await l4(O[1],{eventBindings:z,templateContent:U,serverData:_,filePath:Z})}))).join(`
|
|
17824
17824
|
`);if(U.match(/(<\/body>)/i))U=U.replace(/(<\/body>)/i,`${q}
|
|
17825
17825
|
$1`);else U+=`
|
|
17826
|
-
${q}`}U=await M4(U)}if(Y.wrapInDocument){if(!U.trim().toLowerCase().startsWith("<!doctype")&&!U.trim().toLowerCase().startsWith("<html"))U=nv(U,Y.title)}if(Y.injectCSS)try{let{injectCrosswindCSS:z}=await Promise.resolve().then(() => (K4(),GZ));U=await z(U)}catch{}return U}var YU=D(()=>{n0();X6();q1();
|
|
17826
|
+
${q}`}U=await M4(U)}if(Y.wrapInDocument){if(!U.trim().toLowerCase().startsWith("<!doctype")&&!U.trim().toLowerCase().startsWith("<html"))U=nv(U,Y.title)}if(Y.injectCSS)try{let{injectCrosswindCSS:z}=await Promise.resolve().then(() => (K4(),GZ));U=await z(U)}catch{}return U}var YU=D(()=>{n0();X6();q1();b6();C$()});import l5 from"fs";import R6 from"path";function lA($){try{return l5.statSync($).mtimeMs}catch{return null}}function iX($,Z){let Y=Math.max(0,Math.round((Z-$)/1000));if(Y<60)return`${Y}s ago`;if(Y<3600)return`${Math.round(Y/60)}m ago`;return`${Math.round(Y/3600)}h ago`}function av($,Z){try{return globalThis.Bun?.resolveSync($,Z)??null}catch{return null}}function XU($,Z="stx"){let Y=R6.resolve($);for(let X=0;X<10;X++){let J=R6.join(Y,"pantry","@stacksjs",Z);if(l5.existsSync(J))return J;let Q=R6.dirname(Y);if(Q===Y)break;Y=Q}return null}async function nX($={}){let Z=$.cwd?R6.resolve($.cwd):process.cwd(),Y=$.resolve??av,X=Date.now(),J=[],Q=Y("@stacksjs/stx",Z);J.push(Q?{name:"@stacksjs/stx resolves to",status:"ok",detail:Q}:{name:"@stacksjs/stx resolves to",status:"info",detail:"not resolvable from here (running inside the stx repo, or not installed)"});let G=Y("bun-plugin-stx",Z);if(G)J.push({name:"bun-plugin-stx resolves to",status:"ok",detail:G});let K=XU(Z,"stx");if(!K)J.push({name:"pantry",status:"info",detail:"no pantry/@stacksjs/stx found \u2014 standard install (nothing to rebuild)"});else{let W=R6.join(K,"src/signals.ts"),U=[R6.join(K,"dist/index.js"),R6.join(K,"dist/signals.js")].find((j)=>l5.existsSync(j))||null,z=lA(W),_=U?lA(U):null;if(z==null)J.push({name:"pantry dist freshness",status:"info",detail:`found pantry at ${K} but no src/signals.ts to compare`});else if(_==null)J.push({name:"pantry dist freshness",status:"error",detail:"pantry has src but no built dist \u2014 the dev server will resolve nothing (or a stale copy elsewhere)",fix:`cd ${K} && bun build.ts`});else if(_<z){let j=Math.round((z-_)/1000);J.push({name:"pantry dist freshness",status:"error",detail:`dist (${iX(_,X)}) is OLDER than src/signals.ts (${iX(z,X)}) by ${j}s \u2014 your edit isn't built`,fix:`cd ${K} && bun build.ts`})}else J.push({name:"pantry dist freshness",status:"ok",detail:`dist rebuilt after src (src ${iX(z,X)}, dist ${iX(_,X)})`});let B=R6.join(Z,"node_modules/@stacksjs/stx"),q=null;try{q=l5.lstatSync(B)}catch{q=null}if(!q)J.push({name:"node_modules \u2192 pantry",status:"info",detail:"node_modules/@stacksjs/stx not present (not installed here)"});else if(q.isSymbolicLink()){let j=null;try{j=l5.realpathSync(B)}catch{}let H=(()=>{try{return l5.realpathSync(K)}catch{return K}})();J.push(j===H?{name:"node_modules \u2192 pantry",status:"ok",detail:"symlinked to pantry"}:{name:"node_modules \u2192 pantry",status:"warn",detail:`symlinked to ${j||"(dangling)"}, not pantry`})}else J.push({name:"node_modules \u2192 pantry",status:"warn",detail:"is a real directory, NOT symlinked to pantry \u2014 edits to pantry src/dist won't be resolved",fix:"rm -rf node_modules/@stacksjs/stx && ln -s ../../pantry/@stacksjs/stx node_modules/@stacksjs/stx"})}if(J.push({name:"dev runtime cache",status:"info",detail:"cleared automatically on source edits by the dev watcher (clearDevCaches, #1745 item C)"}),$.generateRuntime)try{let U=$.generateRuntime().length;J.push(U>1000?{name:"signals runtime",status:"ok",detail:`generated ${U.toLocaleString()} chars`}:{name:"signals runtime",status:"warn",detail:`generated only ${U} chars \u2014 suspiciously short`})}catch(W){J.push({name:"signals runtime",status:"error",detail:`failed to generate: ${W.message}`})}return{checks:J,ok:!J.some((W)=>W.status==="error")}}function rX($){let Z={ok:"\u2713",warn:"\u26A0",error:"\u2717",info:"\xB7"},Y=["stx runtime resolution:"];for(let X of $.checks)if(Y.push(` ${Z[X.status]} ${X.name}: ${X.detail}`),X.fix)Y.push(` \u2192 ${X.fix}`);return Y.push(""),Y.push($.ok?"\u2713 All framework-runtime layers are aligned.":"\u2717 A runtime layer is stale \u2014 see the fixes above."),Y.join(`
|
|
17827
17827
|
`)}var JU=()=>{};function _3($,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}`,U=J.siteName??Z.name,z=J.type??"website",_=J.locale??"en_US",B=[];if(J.favicon){let F=J.favicon.toLowerCase().split(".").pop(),A=F==="svg"?"image/svg+xml":F==="ico"?"image/x-icon":F==="png"?"image/png":F==="jpg"||F==="jpeg"?"image/jpeg":"";B.push(`<link rel="icon"${A?` type="${A}"`:""} href="${L1(J.favicon)}">`)}if(B.push(`<title>${sv(Q)}</title>`,`<link rel="canonical" href="${L1(W)}">`,`<meta name="description" content="${L1(G)}">`,`<meta property="og:title" content="${L1(Q)}">`,`<meta property="og:description" content="${L1(G)}">`,`<meta property="og:type" content="${L1(z)}">`,`<meta property="og:url" content="${L1(W)}">`,`<meta property="og:site_name" content="${L1(U)}">`,`<meta property="og:locale" content="${L1(_)}">`,`<meta name="twitter:card" content="${K?"summary_large_image":"summary"}">`,`<meta name="twitter:title" content="${L1(Q)}">`,`<meta name="twitter:description" content="${L1(G)}">`),K)B.push(`<meta property="og:image" content="${L1(K)}">`),B.push(`<meta name="twitter:image" content="${L1(K)}">`);if(J.twitter)B.push(`<meta name="twitter:site" content="@${L1(J.twitter.replace(/^@/,""))}">`),B.push(`<meta name="twitter:creator" content="@${L1(J.twitter.replace(/^@/,""))}">`);let q=/<!--\s*stx SEO Tags\s*-->[\s\S]*?<meta\s+name="twitter:description"[^>]*>\s*/i;if(q.test($))$=$.replace(q,"");$=$.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+name="twitter:title"\s+content="stx Project"[^>]*>\s*/g,"").replace(/<meta\s+name="twitter:description"\s+content="A website built with stx[^"]*"[^>]*>\s*/g,"");let j=$.search(/<\/head>/i),H=j===-1?$:$.slice(0,j),O=(F)=>{if(/^<title[\s>]/i.test(F))return/<title[\s>]/i.test(H);if(/rel="canonical"/i.test(F))return/<link[^>]+rel=["']canonical["']/i.test(H);let N=/(?:property|name)="([^"]+)"/i.exec(F)?.[1];if(!N)return!1;return new RegExp(`<meta[^>]+(?:property|name)=["']${N.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}["']`,"i").test(H)},V=B.filter((F)=>!O(F));if(V.length===0)return $;let L=`<!-- SEO -->
|
|
17828
17828
|
${V.join(`
|
|
17829
17829
|
`)}
|
|
@@ -17854,7 +17854,7 @@ ${Q}`}var c5=null;function j3($,Z){if(Z.theme===!1)return $;let Y=typeof Z.theme
|
|
|
17854
17854
|
${J.slice(K)}`;return`${$.slice(0,X)}${_}${$.slice(Y)}`}function If($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function BU($){return $}var rA=D(()=>{K4();WU()});var aA=D(()=>{rA();WU()});function Sf($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Cf($){let Z=[],Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,X;while((X=Y.exec($))!==null)Z.push([X.index,X.index+X[0].length]);return Z}function bf($,Z){for(let[Y,X]of $)if(Z>=Y&&Z<X)return!0;return!1}function A3($,Z){let Y=1,X=0;for(let J=0;J<Z&&J<$.length;J++)if($[J]===`
|
|
17855
17855
|
`)Y++,X=J+1;return{line:Y,column:Z-X+1}}function Pf($,Z,Y){let X=Z.toLowerCase(),J=$.length,Q=1,G=Y;while(G<J){let K=$.indexOf("<",G);if(K===-1)return-1;if(G=K,$.startsWith("<!--",G)){let z=$.indexOf("-->",G+4);if(z===-1)return-1;G=z+3;continue}if($[G+1]==="/"){let z=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(G,G+64));if(!z){G++;continue}if(z[1].toLowerCase()===X){if(Q--,G+=z[0].length,Q===0)return G;continue}G+=z[0].length;continue}let W=/^<([a-z][\w-]*)\b/i.exec($.slice(G,G+64));if(!W){G++;continue}let U=$.indexOf(">",G);if(U===-1)return-1;if(W[1].toLowerCase()===X&&$[U-1]!=="/")Q++;G=U+1}return-1}function yf($,Z,Y){let X=/@([a-z][\w:-]*)((?:\.[a-z][\w-]*)*)\s*=\s*"([^"]*)"/gi,J;while((J=X.exec($))!==null){if(bf(Z,J.index))continue;let Q=J[1].toLowerCase().split(":")[0];if(Df.has(Q))continue;let G=J[3].trim();if(/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(G)){let K=$.indexOf(J[3],J.index),{line:W,column:U}=A3($,K<0?J.index:K);Y.push({ruleId:"stx/no-bare-function-ref-in-event",message:`Event handler @${J[1]}="${G}" is a bare reference and will not fire. Call it: @${J[1]}="${G}()".`,line:W,column:U,severity:"error"})}}}function xf($,Z,Y){if(Z!=="view")return;let X=/<script\b([^>]*)>/gi,J;while((J=X.exec($))!==null)if(/(?:^|\s)client(?=[\s/=]|$)/i.test(J[1])){let{line:Q,column:G}=A3($,J.index);Y.push({ruleId:"stx/no-view-level-script-client",message:"<script client> at the top level of a view is silently dropped \u2014 only components get client scopes. Move it into a component, or use <script> (server).",line:Q,column:G,severity:"error"})}}function sA($){let Z=$.split("/"),Y=[];for(let X of Z){if(X===""||X===".")continue;if(X==="..")Y.pop();else Y.push(X)}return Y.join("/")}function vf($,Z,Y){let X=Z.replace(/\\/g,"/"),J=X.indexOf("resources/stores/");if(J===-1)return;let Q=X.slice(0,J+16),G=X.slice(0,X.lastIndexOf("/")),K=/\b(import|export)\s+(type\s+)?([^'"]*?)\s*from\s*['"]([^'"]+)['"]/g,W;while((W=K.exec($))!==null){if(W[2])continue;let U=W[1],z=W[4],_;if(z.startsWith("."))_=!sA(`${G}/${z}`).startsWith(sA(Q));else _=!0;if(_){let{line:B,column:q}=A3($,W.index),j=U==="export"?"Value re-export":"Value import";Y.push({ruleId:"stx/store-value-imports-must-be-local",message:`${j} from "${z}" is outside resources/stores/ and will be stripped from the store bundle. Use \`${U} type\`, or move the value into the stores dir.`,line:B,column:q,severity:"error"})}}}function ff($){let Z=$.trim(),Y=(G)=>{let K=G.match(/[A-Za-z_$][\w$]*/g);return K?K:[]},X=/\bas\s+(.+)$/.exec(Z);if(X){let G=X[1].trim(),K=/^([A-Za-z_$][\w$]*)\s*=>\s*([A-Za-z_$][\w$]*)/.exec(G);if(K)return[K[1],K[2]];let W=/^\(([^)]*)\)/.exec(G);if(W)return Y(W[1]);let U=/^([A-Za-z_$][\w$]*)/.exec(G);return U?[U[1]]:[]}let J=/^\(([^)]*)\)\s+(?:in|of)\s+/.exec(Z);if(J)return Y(J[1]);let Q=/^([A-Za-z_$][\w$]*)\s+(?:in|of)\s+/.exec(Z);return Q?[Q[1]]:[]}function gf($,Z){let Y=/(?::for|x-for|@for)\s*=\s*"([^"]*)"/gi,X;while((X=Y.exec($))!==null){let J=ff(X[1]);if(J.length===0)continue;let Q=$.lastIndexOf("<",X.index);if(Q===-1)continue;let G=/^<([a-z][\w-]*)/i.exec($.slice(Q,Q+64));if(!G)continue;let K=$.indexOf(">",X.index);if(K===-1)continue;let U=$[K-1]==="/"||kf.has(G[1].toLowerCase())?K+1:Pf($,G[1],K+1),z=U===-1?K+1:U,_=$.indexOf(X[1],X.index),B=$.slice(Q,z);if(_>=0&&_+X[1].length<=z){let q=_-Q;B=B.slice(0,q)+" ".repeat(X[1].length)+B.slice(q+X[1].length)}for(let q of J){let j=new RegExp(`(?<![.\\w$])${Sf(q)}\\s*\\(`,"g"),H;while((H=j.exec(B))!==null){let O=Q+H.index,{line:V,column:L}=A3($,O);Z.push({ruleId:"stx/no-signal-call-in-for-iteration-var",message:`"${q}" is a :for iteration variable, not a signal \u2014 calling it as "${q}()" leaves it as a function and silently breaks comparisons. Use "${q}" directly.`,line:V,column:L,severity:"error"})}}}}function hf($,Z){let Y=/<!--([\s\S]*?)-->/g,X;while((X=Y.exec($))!==null){let Q=X[1].indexOf("`");if(Q!==-1){let G=X.index+4+Q,{line:K,column:W}=A3($,G);Z.push({ruleId:"stx/no-backticks-in-html-comments",message:"Backtick inside an HTML comment leaks into the merged setup function and flips the JS parser into template-literal mode. Remove it or rephrase the comment.",line:K,column:W,severity:"error"})}}}function F3($,Z){return $?.[Z]!==!1}function oA($,Z={}){let Y=[],X=Cf($),J=(Z.filePath??"").replace(/\\/g,"/"),Q=Z.fileKind??(/\/components?\//i.test(J)?"component":/\/layouts?\//i.test(J)?"layout":"view");if(F3(Z.rules,"stx/no-bare-function-ref-in-event"))yf($,X,Y);if(F3(Z.rules,"stx/no-view-level-script-client"))xf($,Q,Y);if(J&&F3(Z.rules,"stx/store-value-imports-must-be-local"))vf($,J,Y);if(F3(Z.rules,"stx/no-signal-call-in-for-iteration-var"))gf($,Y);if(F3(Z.rules,"stx/no-backticks-in-html-comments"))hf($,Y);Y.sort((K,W)=>K.line-W.line||K.column-W.column);let G=new Set;return Y.filter((K)=>{let W=`${K.ruleId}:${K.line}:${K.column}`;if(G.has(W))return!1;return G.add(W),!0})}var Df,kf;var tA=D(()=>{Df=new Set(["if","else","elseif","else-if","for","foreach","show","model","html","text","bind","key","ref","once","memo","slot","teleport","cloak","pre","effect","init"]),kf=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function eA($,Z){return $.kind===Z}var $w=()=>{};var Zw=D(()=>{$w()});function Yw($){if($===String)return"string";if($===Number)return"number";if($===Boolean)return"boolean";if($===Array)return"array";if($===Object)return"object";if($===Function)return"function";if($===Date)return"date";if($===Symbol)return"symbol";if(typeof $==="function"&&$.name)return $.name;return"unknown"}function df($,Z){if($===null||$===void 0)return!0;if(Z===String)return typeof $==="string";if(Z===Number)return typeof $==="number"&&!Number.isNaN($);if(Z===Boolean)return typeof $==="boolean";if(Z===Array)return Array.isArray($);if(Z===Object)return typeof $==="object"&&!Array.isArray($);if(Z===Function)return typeof $==="function";if(Z===Date)return $ instanceof Date;if(Z===Symbol)return typeof $==="symbol";if(typeof Z==="function")return $ instanceof Z;return!0}function Xw($,Z,Y,X){let J=X?`[${X}]`:"";if(Y.required&&(Z===void 0||Z===null))return{prop:$,message:`${J} Missing required prop: "${$}"`,value:Z,expected:Y.type?Yw(Y.type):void 0};if(Z===void 0||Z===null)return null;if(Y.type){let Q=Array.isArray(Y.type)?Y.type:[Y.type];if(!Q.some((K)=>df(Z,K))){let K=Q.map((W)=>Yw(W)).join(" | ");return{prop:$,message:`${J} Invalid prop type for "${$}": expected ${K}, got ${typeof Z}`,value:Z,expected:K}}}if(Y.validator){if(!Y.validator(Z))return{prop:$,message:`${J} Custom validation failed for prop "${$}"`,value:Z}}return null}function Jw($){let Z=globalThis.__STX_CURRENT_PROPS__||{};if(!$)return Z;let Y={...Z};for(let[X,J]of Object.entries($)){let Q=typeof J==="function"||Array.isArray(J)?{type:J}:J||{};if(Y[X]===void 0&&Q.default!==void 0)Y[X]=typeof Q.default==="function"?Q.default():Q.default}return Y}function Qw($,Z={}){let{componentName:Y,throwOnError:X=!1,logWarnings:J=!0}=Z,Q=globalThis.__STX_CURRENT_PROPS__||{},G={...Q},K={valid:!0,errors:[],warnings:[]};for(let[W,U]of Object.entries($)){let z=typeof U==="function"||Array.isArray(U)?{type:U}:U||{};if(G[W]===void 0&&z.default!==void 0)G[W]=typeof z.default==="function"?z.default():z.default;let _=Xw(W,G[W],z,Y);if(_){if(K.valid=!1,K.errors.push(_),J)console.warn(_.message)}}for(let W of Object.keys(Q))if(!(W in $)){let U=`${Y?`[${Y}]`:""} Unknown prop: "${W}"`;if(K.warnings.push(U),J)console.warn(U)}if(X&&!K.valid){let W=K.errors.map((U)=>U.message).join(`
|
|
17856
17856
|
`);throw Error(`Prop validation failed:
|
|
17857
|
-
${W}`)}return{props:G,validation:K}}function Gw($,Z){let Y={...$};for(let[X,J]of Object.entries(Z))if(Y[X]===void 0)Y[X]=typeof J==="function"?J():J;return Y}function Kw($){return $}function Ww($){return{type:$,required:!0}}function Uw($,Z){return{type:Z,default:$}}function zw($,Z={}){return{...Z,validator:$}}function _w($,Z={}){return{...Z,validator:(Y)=>$.includes(Y)}}function Bw($,Z={}){return{...Z,type:Array,validator:(Y)=>{if(!Array.isArray(Y))return!1;return!0}}}function qw($,Z={}){return{...Z,type:Object}}function jw($,Z,Y){if(!Z)return $;let X={};for(let[J,Q]of Object.entries(Z)){let G=typeof Q==="function"||Array.isArray(Q)?{type:Q}:Q||{},K=$[J];if(K===void 0&&G.default!==void 0)K=typeof G.default==="function"?G.default():G.default;{let W=Xw(J,K,G,Y);if(W)console.warn(W.message)}X[J]=K}for(let[J,Q]of Object.entries($))if(!(J in X))X[J]=Q;return X}var Z$={};e(Z$,{writeNetlifyConfig:()=>I8,writeManifest:()=>GK,writeImageManifest:()=>lG,wrapComponentForHMR:()=>Uv,withDefaults:()=>Gw,webComponentDirectiveHandler:()=>FG,watermark:()=>OW,watchViews:()=>Pv,watchMultiple:()=>zb,watchEffect:()=>_b,watch:()=>Ub,waitForStore:()=>bb,waitForLocale:()=>ZE,videoDirective:()=>V8,validators:()=>OZ,validated:()=>zw,validateValueEnhanced:()=>XB,validateTemplate:()=>vH,validateParams:()=>AW,validateFormEnhanced:()=>cT,validateFile:()=>uX,validateFields:()=>mT,validateField:()=>ZB,validateDirective:()=>gH,validateCspDirectives:()=>wT,validateConfig:()=>pO,validateComponentScripts:()=>kP,validateComponentProps:()=>PP,validateClientScript:()=>$8,usesSignalsInScript:()=>b6,userComponentFileExists:()=>g7,useVirtualList:()=>p2,useTitle:()=>p_,useStoreOrThrow:()=>Cb,useStore:()=>cF,useSlots:()=>NA,useSeoMeta:()=>L9,useRouteParams:()=>TL,useRouteParamOrThrow:()=>Pb,useRouteParam:()=>EL,usePageTitle:()=>p_,useOptimistic:()=>vq,useMiddlewareValue:()=>yb,useMiddlewareState:()=>IL,useLoadingIndicator:()=>DF,useHead:()=>TZ,useAttrs:()=>MA,uploadFiles:()=>pW,uploadFile:()=>mX,updateInstance:()=>Fb,untrack:()=>UY,unregisterDirective:()=>rk,unmountInstance:()=>Ab,unescapeHtml:()=>ZZ,transpileTypeScript:()=>p4,translate:()=>aX,transitionDirective:()=>c3,toUsers:()=>VV,toUser:()=>LV,thumbnail:()=>eK,thumbHashToRGBA:()=>G3,thumbHashToDataURL:()=>dW,templateCache:()=>y2,stxClientHelpers:()=>cK,structuredDataDirective:()=>tZ,stripLocalePrefix:()=>KU,stripDocumentWrapper:()=>b4,stringToStream:()=>Ly,strictCspPreset:()=>C_,streamingSuspenseDirective:()=>S9,streamToResponse:()=>wB,streamTemplateSimple:()=>LB,streamTemplate:()=>qB,stopHmrServer:()=>R5,stopBroadcasting:()=>HV,stateDirName:()=>H$,stateDir:()=>l0,state:()=>c7,startProductionServer:()=>qF,startInteractive:()=>GF,startBroadcasting:()=>jV,staggerDirective:()=>sU,srcsetUrls:()=>VW,springDirective:()=>oU,splitByPipe:()=>LZ,smartBatchSign:()=>RW,slotContentHasExpressions:()=>aH,signUrl:()=>PX,shouldTranspileTypeScript:()=>c4,shouldReloadOnChange:()=>w8,shouldRefreshSignature:()=>fX,shouldIgnoreFile:()=>N8,shouldCacheComponent:()=>$H,sharpen:()=>XW,shape:()=>qw,setStateDir:()=>MJ,setRouteParams:()=>gb,setMiddlewareState:()=>hb,setGlobalProvide:()=>pX,setErrorLocale:()=>Y_,setCurrentInstance:()=>Jb,setCachedVideoResult:()=>_5,setCachedImageResult:()=>W5,setCached:()=>J5,serveStxFile:()=>w3,serveMultipleStxFiles:()=>N3,serveMarkdownFile:()=>JX,serveFile:()=>px,serveApp:()=>R3,serve:()=>NF,serializeState:()=>bF,sepia:()=>QW,seoMetaToHeadConfig:()=>D7,scrollAnimateDirective:()=>p3,screenReaderDirective:()=>l3,scopeHTML:()=>hO,scopeCSS:()=>gO,scanForSitemapEntries:()=>AI,scanA11yIssues:()=>OJ,saturation:()=>UW,sanitizeParams:()=>wW,sanitizeFilePath:()=>L_,sanitizeExpression:()=>V_,sanitizeDirectiveParams:()=>F_,sanitizeDirectiveParam:()=>M7,sanitizeComponentProps:()=>tJ,safeExecuteAsync:()=>W4,safeExecute:()=>j_,runPreProcessingMiddleware:()=>L2,runPostProcessingMiddleware:()=>V2,runMiddleware:()=>g8,runHooks:()=>$$,runDoctor:()=>nX,rotate:()=>zW,rewriteImagesWithSiblings:()=>RY,resolveTemplatePath:()=>J8,resolveI18n:()=>H3,resize:()=>oK,resetPlaceholders:()=>IJ,resetHead:()=>l_,resetHMRHandler:()=>_v,resetErrorConfig:()=>U_,required:()=>Ww,replacePlaceholders:()=>$Z,renderView:()=>sW,renderVideoComponent:()=>O5,renderVendorStyleTags:()=>G7,renderToString:()=>G$,renderToStream:()=>yA,renderToDOM:()=>m5,renderThumbhashToCanvas:()=>hW,renderTemplateString:()=>z3,renderTemplate:()=>ZU,renderString:()=>rv,renderStreamingPage:()=>jB,renderSlot:()=>HQ,renderSSRSuspense:()=>gj,renderProtectedVideo:()=>kW,renderProtectedImg:()=>DW,renderMediaUpload:()=>NW,renderImgComponent:()=>B6,renderImageComponent:()=>fG,renderHtmlAttrs:()=>n_,renderHead:()=>i_,renderEmail:()=>yv,renderComponentWithSlot:()=>z4,renderBodyAttrs:()=>r_,render:()=>Ov,relaxedCspPreset:()=>b_,registerValidationRule:()=>uT,registerStreamingDirectives:()=>FB,registerStoresClient:()=>iF,registerStore:()=>vb,registerSeoDirectives:()=>VI,registerMiddleware:()=>Sb,registerFilters:()=>Cz,registerFilter:()=>SJ,registerErrorMessages:()=>J_,registerEnhancedValidationRule:()=>lT,registerDirective:()=>oH,registerCspDirectives:()=>AT,registerComponentDirectives:()=>vP,registerAnimationDirectives:()=>hR,registerA11yDirectives:()=>TR,ref:()=>Kb,redirect:()=>Ty,rebaseOntoStateDir:()=>O$,readMarkdownFile:()=>I4,readFileCached:()=>fq,reactive:()=>NL,quality:()=>jW,pruneSignatureCache:()=>EW,pruneCache:()=>KO,provide:()=>HA,prop:()=>Kw,processVueTemplate:()=>T2,processVirtualListDirectives:()=>wY,processVirtualGridDirectives:()=>n2,processVideo:()=>nY,processValidateDirective:()=>YB,processTranslateDirective:()=>E9,processTransitionDirectives:()=>kj,processTransitionAttributes:()=>bj,processTitleDirective:()=>o_,processTemplateBindings:()=>dJ,processTeleportDirectives:()=>wj,processSuspenseDirectives:()=>vj,processStructuredData:()=>w2,processStreamDirectives:()=>HB,processStaticDirectives:()=>GQ,processStackReplacements:()=>sZ,processStackPushDirectives:()=>aZ,processSlots:()=>OQ,processShell:()=>wX,processServerBindings:()=>$Y,processSeoDirective:()=>N2,processSectionDirectives:()=>AB,processScopedStyles:()=>u7,processReactiveBindings:()=>mz,processProtectedMedia:()=>SW,processPartialHydrationDirectives:()=>e2,processOnceDirective:()=>e7,processMiddleware:()=>O2,processMetaDirectives:()=>A2,processMetaDirective:()=>t_,processMarkdownFileDirectives:()=>qQ,processMarkdownDirectives:()=>BQ,processLoops:()=>iZ,processKeepAliveDirectives:()=>tj,processJsonDirective:()=>t7,processInfiniteListDirectives:()=>i2,processIncludes:()=>rZ,processImgComponents:()=>$G,processImageComponents:()=>gG,processImage:()=>o1,processHeadDirective:()=>s_,processForms:()=>dT,processFormInputDirectives:()=>DZ,processExpressions:()=>d1,processEventDirectives:()=>pJ,processErrorDirective:()=>kZ,processDynamicComponents:()=>I2,processDirectives:()=>_0,processDirectiveAttributes:()=>ek,processDeferDirectives:()=>Vj,processCustomDirectives:()=>q9,processCspDirectives:()=>z9,processComponentProps:()=>jw,processClientScript:()=>l4,processBasicFormDirectives:()=>S$,processAsyncDirectives:()=>pj,processAppearanceBootstrapDirective:()=>H9,processAnimationDirectives:()=>VJ,processA11yDirectives:()=>HJ,preloadTranslationsBackground:()=>eT,preloadTranslations:()=>GB,preloadIslandHandlers:()=>Zv,preloadIconCollection:()=>Z2,poolStrings:()=>UV,pluginManager:()=>NG,performLeave:()=>Dj,performEnter:()=>Ij,peek:()=>a7,partialsCache:()=>J6,parseVideoDirectiveOptions:()=>PO,parseUrl:()=>sK,parseThumbhashString:()=>uW,parseSwitchBlock:()=>VZ,parseSlots:()=>jQ,parseSlotElement:()=>mH,parseScriptDeclarations:()=>D_,parseSFCComponent:()=>dO,parseProtectedArgs:()=>CW,parseImgComponent:()=>dY,parseImageUrl:()=>EQ,parseImageComponent:()=>zX,parseExpressionWithFilters:()=>E_,parseCookies:()=>Ny,parseConditionalBlock:()=>$9,parseArguments:()=>Z9,parseAnimationShorthand:()=>fR,optional:()=>Uw,optimizeTemplate:()=>zV,optimizeImage:()=>HX,optimizeDirectory:()=>mG,oneOf:()=>_w,onceStore:()=>j2,onUpdated:()=>Hb,onUnmounted:()=>Lb,onServer:()=>ub,onMounted:()=>qb,onMount:()=>KY,onHydrated:()=>QQ,onErrorCaptured:()=>AA,onDestroy:()=>WY,onDeactivated:()=>JH,onClient:()=>db,onBeforeUpdate:()=>jb,onBeforeUnmount:()=>Ob,onBeforeMount:()=>Bb,onActivated:()=>XH,observeElement:()=>vW,notFound:()=>Ey,nextTick:()=>FA,navigateTo:()=>kb,mountInstance:()=>Vb,motionDirective:()=>n3,moderateCspPreset:()=>AZ,minifyHtml:()=>WV,metaDirective:()=>oZ,mergeParams:()=>CX,mergeHeadConfigs:()=>v6,mergeCspDirectives:()=>FT,matchRoute:()=>NX,markdownDirectiveHandler:()=>AQ,markdownCache:()=>tY,localizePath:()=>f4,loadTranslationLazy:()=>b7,loadTranslation:()=>WB,loadStxConfig:()=>g0,loadMiddlewareFromDirectory:()=>f8,loadManifest:()=>KK,loadElement:()=>v4,loadChannels:()=>OV,lintStxStrict:()=>oA,lazyLoadAll:()=>yW,lazyLoad:()=>PW,keyframeDirective:()=>aU,jsxs:()=>CA,jsxDEV:()=>bA,jsx:()=>W$,jsonResponse:()=>My,islandDirective:()=>C9,isTest:()=>A7,isSpaNavigation:()=>aG,isSignatureValid:()=>xX,isSignal:()=>n7,isSharpAvailable:()=>D5,isServerEnvironment:()=>Ky,isServer:()=>DL,isProduction:()=>T$,isNativeLazySupported:()=>gX,isLoading:()=>oT,isLoaded:()=>tT,isJavaScriptScript:()=>nH,isIntersectionObserverSupported:()=>hX,isImageFile:()=>k5,isImageBackendAvailable:()=>s1,isICUFormat:()=>_B,isHydrated:()=>JQ,isHydrateTrigger:()=>rH,isEdgeEnvironment:()=>Gy,isDirectiveKind:()=>eA,isDevelopment:()=>s4,isDerived:()=>r7,isCssOnlyChange:()=>A8,isClient:()=>kL,isAsyncComponent:()=>nj,invert:()=>GW,invalidateFileCacheByDir:()=>hq,invalidateFileCache:()=>gq,interpolateScriptsInTemplate:()=>Pz,interpolateScriptExpressions:()=>q7,inlineError:()=>B0,injectThemeBootstrap:()=>j3,injectSeoTags:()=>R2,injectSeo:()=>_3,injectRouterScript:()=>M4,injectHotReload:()=>H4,injectHeatmap:()=>wJ,injectCspMetaTag:()=>W9,injectCrosswindCSS:()=>y0,injectConfigHeadTags:()=>b2,injectCloakStyle:()=>C2,injectBrowserCoreAutoImports:()=>k6,injectAnalytics:()=>lJ,inject:()=>OA,initStoreRegistry:()=>xb,initNetlify:()=>$L,initLoadingIndicator:()=>Qv,initLazyLoading:()=>bW,initFile:()=>DK,initBlurUp:()=>dX,initAllBlurUp:()=>lW,imgDirective:()=>O8,imageDirective:()=>dG,hydrateTemplateStream:()=>bK,hydrateTemplate:()=>ey,hydrateIslands:()=>$v,hydrateIsland:()=>ZQ,hydrateFragment:()=>$x,hydrateByStrategy:()=>YQ,hydrateAll:()=>XQ,hydrate:()=>jv,htmlResponse:()=>cx,hoistLeadingHeadTags:()=>yq,heatmapDirective:()=>NJ,hashString:()=>PY,hashFilePath:()=>m$,hashFile:()=>Y1,hashBuffer:()=>ZO,hasVueTemplateSyntax:()=>kq,hasVariables:()=>B2,hasStore:()=>mF,hasPlaceholders:()=>L$,hasNetlifyConfig:()=>D8,hasMiddleware:()=>Db,hasEventDirectives:()=>rM,hasDocumentShell:()=>XY,hasDirectives:()=>hH,hasDOMSupport:()=>mU,handleImageRequest:()=>b8,handleError:()=>wA,h:()=>gA,groupVariantsByFormat:()=>o6,grayscale:()=>JW,gitHash:()=>xK,getUnusedDirectives:()=>XV,getTranslationSync:()=>KB,getTranslationCacheStats:()=>rT,getTranslationAsync:()=>$E,getTranslation:()=>SZ,getTotalSize:()=>D4,getTimeUntilExpiry:()=>vX,getStoreNames:()=>lF,getStore:()=>rK,getSourceLineInfo:()=>FQ,getScreenReaderOnlyStyle:()=>wR,getScopeAttribute:()=>UC,getRouteParams:()=>eb,getPublicEnvDefine:()=>F1,getPublicEnv:()=>Qz,getPositionInfo:()=>fH,getPlaceholderRegistry:()=>DJ,getPlaceholderCacheStats:()=>dQ,getPageMeta:()=>MZ,getNonce:()=>e4,getMimeType:()=>v1,getMiddlewareNames:()=>v8,getMiddleware:()=>Ib,getLoadingState:()=>sT,getLoadingLocales:()=>YE,getImageMetadata:()=>r6,getHydrationRuntime:()=>vF,getHydratedStoreState:()=>fb,getHmrServer:()=>R8,getHead:()=>RZ,getHMRHandler:()=>zv,getFormatExtension:()=>SQ,getFileMtime:()=>q8,getFallbackVariant:()=>s6,getErrorMessage:()=>rJ,getErrorLocale:()=>X_,getErrorConfig:()=>w7,getErrorCodeName:()=>zZ,getDirectives:()=>nk,getDirective:()=>ik,getCurrentInstance:()=>Qb,getCspPreset:()=>VT,getCspHeaderName:()=>v_,getComponentCacheStats:()=>pk,getCachedVideoResult:()=>z5,getCachedSignature:()=>MW,getCachedSignalsRuntime:()=>mq,getCachedRouterScript:()=>lq,getCachedPlaceholder:()=>B8,getCachedImageResult:()=>K5,getCached:()=>X5,getCacheStats:()=>GO,getBroadcastServer:()=>qV,getBestVariant:()=>kQ,getAllFilters:()=>CJ,generateWidthSrcset:()=>U6,generateVirtualListCSS:()=>c2,generateVideoPreview:()=>nW,generateValidationScript:()=>pT,generateUploadRuntime:()=>U3,generateTreeShakenBundle:()=>JV,generateTransitionRuntime:()=>Cj,generateTransitionCSS:()=>Sj,generateThumbnails:()=>q5,generateThumbhashPlaceholder:()=>PQ,generateTemplatesDocs:()=>vV,generateSuspenseRuntime:()=>dj,generateSuspenseCSS:()=>hj,generateStateScript:()=>yF,generateSrcsetData:()=>IQ,generateSrcset:()=>fY,generateSrcSet:()=>L6,generateSpriteSheet:()=>pY,generateSpaShell:()=>dv,generateSourceTags:()=>DQ,generateSizesFromBreakpoints:()=>MQ,generateSizesAttribute:()=>t$,generateSizes:()=>a6,generateSitemapIndex:()=>FI,generateSitemap:()=>B3,generateSimpleMediaPicker:()=>XA,generateSignatureRuntime:()=>J3,generateSignalsRuntimeDev:()=>m6,generateSignalsRuntime:()=>s7,generateServerDataBridge:()=>K7,generateScopeId:()=>aY,generateSFCWebComponent:()=>uO,generateRouteTypes:()=>ZP,generateRouteManifest:()=>$P,generateRobotsTxt:()=>Mq,generateRobots:()=>q3,generateResponsiveVariants:()=>vY,generateReactiveWebComponentTS:()=>BC,generateReactiveWebComponent:()=>_C,generateReactiveRuntime:()=>jC,generateReactiveMixin:()=>qC,generatePoster:()=>B5,generatePlaceholderStyle:()=>gQ,generatePlaceholderCSS:()=>_8,generatePlaceholder:()=>z8,generatePartialHydrationCSS:()=>$Q,generateNonce:()=>G9,generateNetlifyToml:()=>GX,generateMinifiedMediaRuntime:()=>UA,generateMediaRuntime:()=>aW,generateMediaManagerEmbed:()=>YA,generateManifest:()=>QK,generateLoadingIndicatorHtml:()=>Kv,generateLazyLoadRuntime:()=>Q3,generateLQIP:()=>xQ,generateKeepAliveRuntime:()=>YH,generateKeepAliveCSS:()=>ZH,generateIslandManifest:()=>KQ,generateImagePreview:()=>iW,generateImageManifest:()=>OX,generateHydrationScript:()=>qv,generateHydrationRuntime:()=>NB,generateHydrationCSS:()=>Hv,generateHydrationBootstrap:()=>a2,generateHotReloadScript:()=>tO,generateHeatmapScript:()=>AJ,generateHMRClientScript:()=>Wv,generateHLSManifest:()=>j5,generateEventBindings:()=>Bv,generateDprSrcsetWithVariableQuality:()=>RQ,generateDprSrcset:()=>o$,generateDocumentShell:()=>xq,generateDocs:()=>uV,generateDirectivesDocs:()=>fV,generateDirectiveRuntime:()=>tk,generateDefaultRobotsTxt:()=>wI,generateDASHManifest:()=>H5,generateCspMetaTag:()=>wZ,generateCspHeader:()=>K9,generateCrosswindCSS:()=>QZ,generateCompositionRuntime:()=>EA,generateComponentsDocs:()=>xV,generateComponentManifest:()=>pD,generateComponentDoc:()=>yV,generateColorPlaceholder:()=>fQ,generateClientRuntime:()=>wb,generateCacheKey:()=>Z5,generateBrowserAutoImportDestructuring:()=>Oz,generateBlurUpRuntime:()=>K3,generateBlurUpCSS:()=>W3,generateBindingsRuntime:()=>lz,generateAutoWidthSrcset:()=>NQ,generateAutoImportDestructuring:()=>s3,generateAsyncComponentRuntime:()=>aj,generateAsyncComponentCSS:()=>rj,generateAnimationRuntime:()=>gR,generateAnimationCSS:()=>vR,generateAnalyticsScript:()=>mJ,formatTypeErrors:()=>ex,formatStxContent:()=>DX,formatSize:()=>O6,formatRoutes:()=>oG,formatMarkdownContent:()=>TK,formatLocalizedError:()=>G_,formatICU:()=>UB,formatFilePath:()=>N7,formatError:()=>qZ,formatDoctorReport:()=>rX,formatDocsAsMarkdown:()=>gV,formatDocsAsJson:()=>dV,formatDocsAsHtml:()=>hV,format:()=>qW,foldConstants:()=>KV,flipVertical:()=>BW,flipHorizontal:()=>_W,fingerprint:()=>tG,findPantryPackage:()=>XU,findMatchingEndTag:()=>t4,findMatchingDelimiter:()=>r0,findIfBlocks:()=>k$,findExpressions:()=>T_,findErrorPage:()=>sG,findDirectiveBlocks:()=>E7,findDeadCode:()=>QV,findDeadBranches:()=>QV,findComponentFiles:()=>VK,findCommonDir:()=>qU,filterRequiredFiles:()=>E8,fileExists:()=>J0,extractVariables:()=>D0,extractStreamBoundaries:()=>OB,extractState:()=>xF,extractSlotContent:()=>cH,extractScriptFromTemplate:()=>_2,extractPlaceholders:()=>VM,extractParenthesizedExpression:()=>N4,extractLayoutMetadata:()=>m8,extractDominantColor:()=>vQ,extractDirectiveParams:()=>I_,extractDirectiveNames:()=>dH,extractContainerContent:()=>u8,extractComponentProps:()=>bV,extractComponentName:()=>s2,extractComponentDescription:()=>PV,extractClassNames:()=>JZ,extractBridgeData:()=>m4,extractBoundProps:()=>o2,extractBalancedExpression:()=>eJ,extractAndStripCssImports:()=>Q7,extractAndScopeStyles:()=>zC,extractAndProcessEvents:()=>az,evaluateExpression:()=>G1,evaluateConstant:()=>TX,evaluateAuthExpression:()=>w4,escapeHtml:()=>v0,errorRecovery:()=>jZ,errorLogger:()=>K1,ensureTeleportTargets:()=>Nj,ensureDocumentShell:()=>m7,enhancedValidationRules:()=>A9,eliminateDeadCode:()=>GV,effect:()=>i7,dprUrls:()=>FW,docsCommand:()=>FK,disconnectObserver:()=>fW,devHelpers:()=>D$,detectShell:()=>rG,detectRuntime:()=>x5,detectProjectConfig:()=>T5,detectFormat:()=>CQ,detectBuildMode:()=>DP,derived:()=>p7,deploy:()=>eO,defineStxConfig:()=>cO,defineStore:()=>pF,defineSlots:()=>RA,defineSiteConfig:()=>BU,definePropsWithValidation:()=>Qw,defineProps:()=>Jw,definePlugin:()=>V5,definePageMeta:()=>c_,defineMiddleware:()=>Eb,defineExpose:()=>VA,defineEmits:()=>LA,defineDirective:()=>h0,defineCustomElement:()=>dA,defineConfig:()=>ty,defineClientDirective:()=>ak,defineAsyncComponent:()=>ij,defaultMediaConfig:()=>bv,defaultImageConfig:()=>VL,defaultI18nConfig:()=>CZ,defaultHeatmapConfig:()=>Zz,defaultFormClasses:()=>IZ,defaultFilters:()=>F$,defaultCspConfig:()=>RT,defaultConfig:()=>N1,default:()=>uf,decodeThumbhash:()=>yQ,cspNonceDirective:()=>x_,cspDirective:()=>y_,crossfadeTransition:()=>mW,crop:()=>tK,createVirtualList:()=>AY,createVideoDirective:()=>rY,createVercelHandler:()=>Ay,createTypeChecker:()=>hK,createTranslateFilter:()=>wE,createTextEncoderStream:()=>Oy,createStxApp:()=>$U,createStreamingResponse:()=>Hy,createStreamRenderer:()=>VB,createStore:()=>aK,createStorageManager:()=>Tb,createServerCookieManager:()=>Mb,createScope:()=>wL,createSSRSuspense:()=>fj,createRouter:()=>P4,createRouteLocation:()=>x8,createRoute:()=>nx,createRef:()=>Kb,createReactive:()=>NL,createProvideContext:()=>TA,createProject:()=>Qx,createProductionBuild:()=>oy,createPlaceholder:()=>W7,createOptimizedBuild:()=>SP,createNetlifyHandler:()=>wy,createNetlifyClient:()=>M8,createMiddlewareContext:()=>y8,createMiddleware:()=>ix,createLazyObserver:()=>xW,createKeepAliveCache:()=>ej,createKVNamespace:()=>cV,createIslandRegistry:()=>t2,createImgDirective:()=>uY,createImagePlugin:()=>uG,createImageHandler:()=>UX,createImageDirective:()=>qX,createHeatmapAggregator:()=>mR,createFileManifest:()=>T8,createEnvAccessor:()=>lV,createEnhancedError:()=>q_,createEdgeHandler:()=>i8,createEdgeCache:()=>pV,createDetailedErrorMessage:()=>T0,createDenoHandler:()=>Fy,createDefaultNetlifyConfig:()=>E5,createCspHeaders:()=>NT,createCookie:()=>Ry,createComputed:()=>Wb,createComponentInstance:()=>Gb,createCloudflareHandler:()=>Vy,createClientCookieManager:()=>Rb,createBuiltinDirectives:()=>ok,createApp:()=>$U,createAnimationTimeline:()=>xR,cover:()=>ZW,convertToCommonJS:()=>uZ,contrast:()=>WW,contain:()=>$W,consoleError:()=>B_,configureErrorHandling:()=>W_,config:()=>T1,computed:()=>Wb,composeShellWithPage:()=>d8,componentDirective:()=>TV,componentClientSignalNames:()=>sH,compileTemplate:()=>YK,collectDeployFiles:()=>M5,clearVideoCache:()=>lY,clearTranslationCache:()=>nT,clearSignatureCache:()=>TW,clearPlaceholderCache:()=>hQ,clearOnceStore:()=>jI,clearNonce:()=>LT,clearMiddleware:()=>P8,clearImageCache:()=>BX,clearErrorMessages:()=>Q_,clearDevCaches:()=>cq,clearCustomFilters:()=>bz,clearComponentCache:()=>B4,clearCache:()=>Q5,cleanupLoadingIndicator:()=>Gv,classifyScript:()=>bL,classifyAllScripts:()=>pG,checkTemplateFile:()=>ox,checkTemplate:()=>tx,checkCache:()=>qY,checkAuthAccess:()=>u5,checkA11y:()=>u3,channel:()=>wV,captureScreenshots:()=>tV,captureScreenshot:()=>RK,cancelPendingLoads:()=>XE,calculateSha1:()=>QX,calculateOptimalWidths:()=>SY,cacheTemplate:()=>jY,buildWebComponents:()=>LG,buildViews:()=>qA,buildUrl:()=>k0,buildSuspenseResolveScript:()=>PZ,buildStaticSite:()=>zU,buildRuntimeAsset:()=>eG,buildRouterAsset:()=>$K,buildLangPickerScript:()=>V3,buildImageUrl:()=>r1,buildForProduction:()=>rL,buildComponentLibrary:()=>HK,buildAuthParams:()=>X3,buildApp:()=>sL,buildAlternateLinks:()=>L3,build:()=>sy,broadcastPrivate:()=>FV,broadcastPresence:()=>AV,broadcast:()=>BK,brightness:()=>KW,blur:()=>YW,batchSignUrls:()=>yX,batch:()=>GY,autoFixA11yFile:()=>pU,autoFixA11yDirectory:()=>MR,autoFixA11y:()=>cU,auto:()=>HW,assetTags:()=>wP,arrayOf:()=>Bw,applyTranslations:()=>O3,applyTransformations:()=>H8,applySlots:()=>pH,applyPropDefaults:()=>yP,applyPreset:()=>LW,applyHead:()=>a_,applyFilters:()=>bJ,apiCspPreset:()=>P_,animationGroupDirective:()=>i3,analyzeVideo:()=>L8,analyzeUsage:()=>zK,analyzeTemplate:()=>CL,analyzeProject:()=>cG,analyzeDirectiveUsage:()=>zK,analyticsDirective:()=>mM,addStore:()=>zx,addPage:()=>Ux,addNonceToInlineContent:()=>U9,addLayout:()=>_x,addComponent:()=>Wx,abortNavigation:()=>Nb,a11yDirective:()=>m3,__setSignalsGeneratorsForTest:()=>uq,VideoProcessorCache:()=>U5,TransitionType:()=>iU,TransitionEase:()=>rU,TransitionDirection:()=>nU,Tokenizer:()=>T7,TemplateTypeChecker:()=>gK,TEMPLATE_PRESETS:()=>fy,StxValidationError:()=>R7,StxSyntaxError:()=>aJ,StxSecurityError:()=>sJ,StxRuntimeError:()=>i1,StxFileError:()=>I$,StxError:()=>o4,Show:()=>xA,SUSPENSE_RESOLVER_RUNTIME:()=>k9,STATE_DIR_ENV_VAR:()=>Gz,SPRING_PRESETS:()=>LJ,ProductionBuild:()=>kX,Portal:()=>fA,PROJECT_TEMPLATES:()=>Jx,PRESETS:()=>bX,MemorySessionStore:()=>hF,MIME_TYPES:()=>W8,MEDIA_DEFAULT_WIDTHS:()=>j4,MEDIA_DEFAULT_FORMATS:()=>E4,ImageProcessorCache:()=>G5,ImageProcessingError:()=>t6,HydrationRuntime:()=>nK,HotReloadServer:()=>kG,HeatmapAggregator:()=>RJ,Fragment:()=>K$,For:()=>vA,ErrorLogger:()=>HZ,ErrorCodes:()=>Q0,DeployError:()=>S4,DEFAULT_WIDTHS:()=>P1,DEFAULT_TRANSITION_OPTIONS:()=>X4,DEFAULT_STATE_DIR:()=>I6,DEFAULT_QUALITY:()=>x1,DEFAULT_PLACEHOLDER_OPTIONS:()=>bY,DEFAULT_FORMATS:()=>y1,DEFAULT_DPR_VALUES:()=>K8,ComponentHMRHandler:()=>pK,COMMON_SIZES:()=>TQ,CLOAK_STYLE:()=>nI,BroadcastServer:()=>RV,Broadcast:()=>NV,BLUR_UP_CSS:()=>$5});var uf;var V6=D(()=>{KX();LX();N0();K2();u4();nF();M2();oW();hA();uA();RG();K4();JU();aA();tA();RL();f6();FX();w9();j$();cJ();r3();O9();s$();b5();nJ();UK();ZK();$V();_V();EX();c6();EV();OK();n0();_9();j9();KX();jU();G8();AK();iV();MK();S1();iJ();$1();EK();a3();I9();g$();kK();SK();nZ();IY();F2();I7();RX();U7();q1();zF();WK();yK();l8();wF();iG();eZ();RF();J4();YY();XK();PK();Y6();TF();AG();r2();WQ();EF();kF();uJ();S6();CF();fF();dF();LX();BA();jA();d$();E2();D2();YU();N0();DY();Zw();uf={}});import M3 from"path";var p5;var eX=D(()=>{V6();S1();$1();r4();q1();C$();p5={name:"bun-plugin-stx",async setup($){let Y={...await g0(),...$.config?.stx},X=new Set,J=Y.webComponents?.enabled?`./${M3.relative(M3.dirname($.config?.outdir||"dist"),Y.webComponents.outputDir||"dist/web-components")}`:"/web-components",Q=[];if(Y.webComponents?.enabled)try{let G=await LG(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 qY(G,Y);if(H){if(Y.debug)console.log(`Using cached version of ${G}`);return{contents:H,loader:"html"}}}let W=await W4(()=>Bun.file(G).text(),"",(H)=>{throw new I$(`Failed to read stx file: ${G}`,G,void 0,void 0,`File read error: ${H.message}`)});if(!W)throw new I$(`stx file is empty: ${G}`,G);let{scriptContent:U,templateContent:z,allScripts:_}=c1.time("script-extraction",()=>{let H=W,O=U4(W);if(O)H=O.content.trim();let V=W.match(/<script\b[^>]*>[\s\S]*?<\/script>/gi)||[],L="",F=[];for(let w of V){let N=w.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i)?.[1]||"",R=w.match(/<script\b([^>]*)>/i),E=R?R[1]:"";if(/\bserver\b/i.test(E))L=N;else F.push(w)}let A=H.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"");return{scriptContent:L,templateContent:A,allScripts:F}}),B={__filename:G,__dirname:M3.dirname(G),__stx:{webComponentsPath:J,builtComponents:Q}};await W4(()=>D0(U,B,G),void 0,(H)=>{let O=new i1(`Script execution failed in ${G}: ${H.message}`,G,void 0,void 0,U.substring(0,100));if(K1.log(O,{filePath:G,scriptContent:U}),Y.debug)throw O});let j=await c1.timeAsync("directive-processing",async()=>{return await _0(z,B,G,Y,K)});if(_.length>0){let{interpolateScriptsInTemplate:H}=await Promise.resolve().then(() => ($1(),j7)),O=H(_.join(`
|
|
17857
|
+
${W}`)}return{props:G,validation:K}}function Gw($,Z){let Y={...$};for(let[X,J]of Object.entries(Z))if(Y[X]===void 0)Y[X]=typeof J==="function"?J():J;return Y}function Kw($){return $}function Ww($){return{type:$,required:!0}}function Uw($,Z){return{type:Z,default:$}}function zw($,Z={}){return{...Z,validator:$}}function _w($,Z={}){return{...Z,validator:(Y)=>$.includes(Y)}}function Bw($,Z={}){return{...Z,type:Array,validator:(Y)=>{if(!Array.isArray(Y))return!1;return!0}}}function qw($,Z={}){return{...Z,type:Object}}function jw($,Z,Y){if(!Z)return $;let X={};for(let[J,Q]of Object.entries(Z)){let G=typeof Q==="function"||Array.isArray(Q)?{type:Q}:Q||{},K=$[J];if(K===void 0&&G.default!==void 0)K=typeof G.default==="function"?G.default():G.default;{let W=Xw(J,K,G,Y);if(W)console.warn(W.message)}X[J]=K}for(let[J,Q]of Object.entries($))if(!(J in X))X[J]=Q;return X}var X$={};$0(X$,{writeNetlifyConfig:()=>I8,writeManifest:()=>GK,writeImageManifest:()=>lG,wrapComponentForHMR:()=>Uv,withDefaults:()=>Gw,webComponentDirectiveHandler:()=>FG,watermark:()=>OW,watchViews:()=>Pv,watchMultiple:()=>zb,watchEffect:()=>_b,watch:()=>Ub,waitForStore:()=>bb,waitForLocale:()=>ZE,videoDirective:()=>V8,validators:()=>OZ,validated:()=>zw,validateValueEnhanced:()=>XB,validateTemplate:()=>vH,validateParams:()=>AW,validateFormEnhanced:()=>cT,validateFile:()=>uX,validateFields:()=>mT,validateField:()=>ZB,validateDirective:()=>gH,validateCspDirectives:()=>wT,validateConfig:()=>pO,validateComponentScripts:()=>kP,validateComponentProps:()=>PP,validateClientScript:()=>$8,usesSignalsInScript:()=>y6,userComponentFileExists:()=>g7,useVirtualList:()=>p2,useTitle:()=>p_,useStoreOrThrow:()=>Cb,useStore:()=>cF,useSlots:()=>NA,useSeoMeta:()=>L9,useRouteParams:()=>TL,useRouteParamOrThrow:()=>Pb,useRouteParam:()=>EL,usePageTitle:()=>p_,useOptimistic:()=>vq,useMiddlewareValue:()=>yb,useMiddlewareState:()=>IL,useLoadingIndicator:()=>DF,useHead:()=>TZ,useAttrs:()=>MA,uploadFiles:()=>pW,uploadFile:()=>mX,updateInstance:()=>Fb,untrack:()=>UY,unregisterDirective:()=>rk,unmountInstance:()=>Ab,unescapeHtml:()=>ZZ,transpileTypeScript:()=>p4,translate:()=>aX,transitionDirective:()=>c3,toUsers:()=>VV,toUser:()=>LV,thumbnail:()=>eK,thumbHashToRGBA:()=>G3,thumbHashToDataURL:()=>dW,templateCache:()=>y2,stxClientHelpers:()=>cK,structuredDataDirective:()=>tZ,stripLocalePrefix:()=>KU,stripDocumentWrapper:()=>b4,stringToStream:()=>Ly,strictCspPreset:()=>C_,streamingSuspenseDirective:()=>S9,streamToResponse:()=>wB,streamTemplateSimple:()=>LB,streamTemplate:()=>qB,stopHmrServer:()=>R5,stopBroadcasting:()=>HV,stateDirName:()=>H$,stateDir:()=>l0,state:()=>c7,startProductionServer:()=>qF,startInteractive:()=>GF,startBroadcasting:()=>jV,staggerDirective:()=>sU,srcsetUrls:()=>VW,springDirective:()=>oU,splitByPipe:()=>LZ,smartBatchSign:()=>RW,slotContentHasExpressions:()=>aH,signUrl:()=>PX,shouldTranspileTypeScript:()=>c4,shouldReloadOnChange:()=>w8,shouldRefreshSignature:()=>fX,shouldIgnoreFile:()=>N8,shouldCacheComponent:()=>$H,sharpen:()=>XW,shape:()=>qw,setStateDir:()=>MJ,setRouteParams:()=>gb,setMiddlewareState:()=>hb,setGlobalProvide:()=>pX,setErrorLocale:()=>Y_,setCurrentInstance:()=>Jb,setCachedVideoResult:()=>_5,setCachedImageResult:()=>W5,setCached:()=>J5,serveStxFile:()=>w3,serveMultipleStxFiles:()=>N3,serveMarkdownFile:()=>JX,serveFile:()=>px,serveApp:()=>R3,serve:()=>NF,serializeState:()=>bF,sepia:()=>QW,seoMetaToHeadConfig:()=>D7,scrollAnimateDirective:()=>p3,screenReaderDirective:()=>l3,scopeHTML:()=>hO,scopeCSS:()=>gO,scanForSitemapEntries:()=>AI,scanA11yIssues:()=>OJ,saturation:()=>UW,sanitizeParams:()=>wW,sanitizeFilePath:()=>L_,sanitizeExpression:()=>V_,sanitizeDirectiveParams:()=>F_,sanitizeDirectiveParam:()=>M7,sanitizeComponentProps:()=>tJ,safeExecuteAsync:()=>W4,safeExecute:()=>j_,runPreProcessingMiddleware:()=>L2,runPostProcessingMiddleware:()=>V2,runMiddleware:()=>g8,runHooks:()=>Y$,runDoctor:()=>nX,rotate:()=>zW,rewriteImagesWithSiblings:()=>RY,resolveTemplatePath:()=>J8,resolveI18n:()=>H3,resize:()=>oK,resetPlaceholders:()=>IJ,resetHead:()=>l_,resetHMRHandler:()=>_v,resetErrorConfig:()=>U_,required:()=>Ww,replacePlaceholders:()=>$Z,renderView:()=>sW,renderVideoComponent:()=>O5,renderVendorStyleTags:()=>G7,renderToString:()=>W$,renderToStream:()=>yA,renderToDOM:()=>m5,renderThumbhashToCanvas:()=>hW,renderTemplateString:()=>z3,renderTemplate:()=>ZU,renderString:()=>rv,renderStreamingPage:()=>jB,renderSlot:()=>HQ,renderSSRSuspense:()=>gj,renderProtectedVideo:()=>kW,renderProtectedImg:()=>DW,renderMediaUpload:()=>NW,renderImgComponent:()=>B6,renderImageComponent:()=>fG,renderHtmlAttrs:()=>n_,renderHead:()=>i_,renderEmail:()=>yv,renderComponentWithSlot:()=>z4,renderBodyAttrs:()=>r_,render:()=>Ov,relaxedCspPreset:()=>b_,registerValidationRule:()=>uT,registerStreamingDirectives:()=>FB,registerStoresClient:()=>iF,registerStore:()=>vb,registerSeoDirectives:()=>VI,registerMiddleware:()=>Sb,registerFilters:()=>Cz,registerFilter:()=>SJ,registerErrorMessages:()=>J_,registerEnhancedValidationRule:()=>lT,registerDirective:()=>oH,registerCspDirectives:()=>AT,registerComponentDirectives:()=>vP,registerAnimationDirectives:()=>hR,registerA11yDirectives:()=>TR,ref:()=>Kb,redirect:()=>Ty,rebaseOntoStateDir:()=>O$,readMarkdownFile:()=>I4,readFileCached:()=>fq,reactive:()=>NL,quality:()=>jW,pruneSignatureCache:()=>EW,pruneCache:()=>KO,provide:()=>HA,prop:()=>Kw,processVueTemplate:()=>T2,processVirtualListDirectives:()=>wY,processVirtualGridDirectives:()=>n2,processVideo:()=>nY,processValidateDirective:()=>YB,processTranslateDirective:()=>E9,processTransitionDirectives:()=>kj,processTransitionAttributes:()=>bj,processTitleDirective:()=>o_,processTemplateBindings:()=>dJ,processTeleportDirectives:()=>wj,processSuspenseDirectives:()=>vj,processStructuredData:()=>w2,processStreamDirectives:()=>HB,processStaticDirectives:()=>GQ,processStackReplacements:()=>sZ,processStackPushDirectives:()=>aZ,processSlots:()=>OQ,processShell:()=>wX,processServerBindings:()=>$Y,processSeoDirective:()=>N2,processSectionDirectives:()=>AB,processScopedStyles:()=>u7,processReactiveBindings:()=>mz,processProtectedMedia:()=>SW,processPartialHydrationDirectives:()=>e2,processOnceDirective:()=>e7,processMiddleware:()=>O2,processMetaDirectives:()=>A2,processMetaDirective:()=>t_,processMarkdownFileDirectives:()=>qQ,processMarkdownDirectives:()=>BQ,processLoops:()=>iZ,processKeepAliveDirectives:()=>tj,processJsonDirective:()=>t7,processInfiniteListDirectives:()=>i2,processIncludes:()=>rZ,processImgComponents:()=>$G,processImageComponents:()=>gG,processImage:()=>o1,processHeadDirective:()=>s_,processForms:()=>dT,processFormInputDirectives:()=>DZ,processExpressions:()=>d1,processEventDirectives:()=>pJ,processErrorDirective:()=>kZ,processDynamicComponents:()=>I2,processDirectives:()=>_0,processDirectiveAttributes:()=>ek,processDeferDirectives:()=>Vj,processCustomDirectives:()=>q9,processCspDirectives:()=>z9,processComponentProps:()=>jw,processClientScript:()=>l4,processBasicFormDirectives:()=>S$,processAsyncDirectives:()=>pj,processAppearanceBootstrapDirective:()=>H9,processAnimationDirectives:()=>VJ,processA11yDirectives:()=>HJ,preloadTranslationsBackground:()=>eT,preloadTranslations:()=>GB,preloadIslandHandlers:()=>Zv,preloadIconCollection:()=>Z2,poolStrings:()=>UV,pluginManager:()=>NG,performLeave:()=>Dj,performEnter:()=>Ij,peek:()=>a7,partialsCache:()=>J6,parseVideoDirectiveOptions:()=>PO,parseUrl:()=>sK,parseThumbhashString:()=>uW,parseSwitchBlock:()=>VZ,parseSlots:()=>jQ,parseSlotElement:()=>mH,parseScriptDeclarations:()=>D_,parseSFCComponent:()=>dO,parseProtectedArgs:()=>CW,parseImgComponent:()=>dY,parseImageUrl:()=>EQ,parseImageComponent:()=>zX,parseExpressionWithFilters:()=>E_,parseCookies:()=>Ny,parseConditionalBlock:()=>$9,parseArguments:()=>Z9,parseAnimationShorthand:()=>fR,optional:()=>Uw,optimizeTemplate:()=>zV,optimizeImage:()=>HX,optimizeDirectory:()=>mG,oneOf:()=>_w,onceStore:()=>j2,onUpdated:()=>Hb,onUnmounted:()=>Lb,onServer:()=>ub,onMounted:()=>qb,onMount:()=>KY,onHydrated:()=>QQ,onErrorCaptured:()=>AA,onDestroy:()=>WY,onDeactivated:()=>JH,onClient:()=>db,onBeforeUpdate:()=>jb,onBeforeUnmount:()=>Ob,onBeforeMount:()=>Bb,onActivated:()=>XH,observeElement:()=>vW,notFound:()=>Ey,nextTick:()=>FA,navigateTo:()=>kb,mountInstance:()=>Vb,motionDirective:()=>n3,moderateCspPreset:()=>AZ,minifyHtml:()=>WV,metaDirective:()=>oZ,mergeParams:()=>CX,mergeHeadConfigs:()=>g6,mergeCspDirectives:()=>FT,matchRoute:()=>NX,markdownDirectiveHandler:()=>AQ,markdownCache:()=>tY,localizePath:()=>f4,loadTranslationLazy:()=>b7,loadTranslation:()=>WB,loadStxConfig:()=>g0,loadMiddlewareFromDirectory:()=>f8,loadManifest:()=>KK,loadElement:()=>v4,loadChannels:()=>OV,lintStxStrict:()=>oA,lazyLoadAll:()=>yW,lazyLoad:()=>PW,keyframeDirective:()=>aU,jsxs:()=>CA,jsxDEV:()=>bA,jsx:()=>z$,jsonResponse:()=>My,islandDirective:()=>C9,isTest:()=>A7,isSpaNavigation:()=>aG,isSignatureValid:()=>xX,isSignal:()=>n7,isSharpAvailable:()=>D5,isServerEnvironment:()=>Ky,isServer:()=>DL,isProduction:()=>T$,isNativeLazySupported:()=>gX,isLoading:()=>oT,isLoaded:()=>tT,isJavaScriptScript:()=>nH,isIntersectionObserverSupported:()=>hX,isImageFile:()=>k5,isImageBackendAvailable:()=>s1,isICUFormat:()=>_B,isHydrated:()=>JQ,isHydrateTrigger:()=>rH,isEdgeEnvironment:()=>Gy,isDirectiveKind:()=>eA,isDevelopment:()=>s4,isDerived:()=>r7,isCssOnlyChange:()=>A8,isClient:()=>kL,isAsyncComponent:()=>nj,invert:()=>GW,invalidateFileCacheByDir:()=>hq,invalidateFileCache:()=>gq,interpolateScriptsInTemplate:()=>Pz,interpolateScriptExpressions:()=>q7,inlineError:()=>B0,injectThemeBootstrap:()=>j3,injectSeoTags:()=>R2,injectSeo:()=>_3,injectRouterScript:()=>M4,injectHotReload:()=>H4,injectHeatmap:()=>wJ,injectCspMetaTag:()=>W9,injectCrosswindCSS:()=>y0,injectConfigHeadTags:()=>b2,injectCloakStyle:()=>C2,injectBrowserCoreAutoImports:()=>C6,injectAnalytics:()=>lJ,inject:()=>OA,initStoreRegistry:()=>xb,initNetlify:()=>$L,initLoadingIndicator:()=>Qv,initLazyLoading:()=>bW,initFile:()=>DK,initBlurUp:()=>dX,initAllBlurUp:()=>lW,imgDirective:()=>O8,imageDirective:()=>dG,hydrateTemplateStream:()=>bK,hydrateTemplate:()=>ey,hydrateIslands:()=>$v,hydrateIsland:()=>ZQ,hydrateFragment:()=>$x,hydrateByStrategy:()=>YQ,hydrateAll:()=>XQ,hydrate:()=>jv,htmlResponse:()=>cx,hoistLeadingHeadTags:()=>yq,heatmapDirective:()=>NJ,hashString:()=>PY,hashFilePath:()=>m$,hashFile:()=>Y1,hashBuffer:()=>ZO,hasVueTemplateSyntax:()=>kq,hasVariables:()=>B2,hasStore:()=>mF,hasPlaceholders:()=>L$,hasNetlifyConfig:()=>D8,hasMiddleware:()=>Db,hasEventDirectives:()=>rM,hasDocumentShell:()=>XY,hasDirectives:()=>hH,hasDOMSupport:()=>mU,handleImageRequest:()=>b8,handleError:()=>wA,h:()=>gA,groupVariantsByFormat:()=>e6,grayscale:()=>JW,gitHash:()=>xK,getUnusedDirectives:()=>XV,getTranslationSync:()=>KB,getTranslationCacheStats:()=>rT,getTranslationAsync:()=>$E,getTranslation:()=>SZ,getTotalSize:()=>D4,getTimeUntilExpiry:()=>vX,getStoreNames:()=>lF,getStore:()=>rK,getSourceLineInfo:()=>FQ,getScreenReaderOnlyStyle:()=>wR,getScopeAttribute:()=>UC,getRouteParams:()=>eb,getPublicEnvDefine:()=>F1,getPublicEnv:()=>Qz,getPositionInfo:()=>fH,getPlaceholderRegistry:()=>DJ,getPlaceholderCacheStats:()=>dQ,getPageMeta:()=>MZ,getNonce:()=>e4,getMimeType:()=>v1,getMiddlewareNames:()=>v8,getMiddleware:()=>Ib,getLoadingState:()=>sT,getLoadingLocales:()=>YE,getImageMetadata:()=>s6,getHydrationRuntime:()=>vF,getHydratedStoreState:()=>fb,getHmrServer:()=>R8,getHead:()=>RZ,getHMRHandler:()=>zv,getFormatExtension:()=>SQ,getFileMtime:()=>q8,getFallbackVariant:()=>t6,getErrorMessage:()=>rJ,getErrorLocale:()=>X_,getErrorConfig:()=>w7,getErrorCodeName:()=>zZ,getDirectives:()=>nk,getDirective:()=>ik,getCurrentInstance:()=>Qb,getCspPreset:()=>VT,getCspHeaderName:()=>v_,getComponentCacheStats:()=>pk,getCachedVideoResult:()=>z5,getCachedSignature:()=>MW,getCachedSignalsRuntime:()=>mq,getCachedRouterScript:()=>lq,getCachedPlaceholder:()=>B8,getCachedImageResult:()=>K5,getCached:()=>X5,getCacheStats:()=>GO,getBroadcastServer:()=>qV,getBestVariant:()=>kQ,getAllFilters:()=>CJ,generateWidthSrcset:()=>U6,generateVirtualListCSS:()=>c2,generateVideoPreview:()=>nW,generateValidationScript:()=>pT,generateUploadRuntime:()=>U3,generateTreeShakenBundle:()=>JV,generateTransitionRuntime:()=>Cj,generateTransitionCSS:()=>Sj,generateThumbnails:()=>q5,generateThumbhashPlaceholder:()=>PQ,generateTemplatesDocs:()=>vV,generateSuspenseRuntime:()=>dj,generateSuspenseCSS:()=>hj,generateStateScript:()=>yF,generateSrcsetData:()=>IQ,generateSrcset:()=>fY,generateSrcSet:()=>L6,generateSpriteSheet:()=>pY,generateSpaShell:()=>dv,generateSourceTags:()=>DQ,generateSizesFromBreakpoints:()=>MQ,generateSizesAttribute:()=>t$,generateSizes:()=>o6,generateSitemapIndex:()=>FI,generateSitemap:()=>B3,generateSimpleMediaPicker:()=>XA,generateSignatureRuntime:()=>J3,generateSignalsRuntimeDev:()=>c6,generateSignalsRuntime:()=>s7,generateServerDataBridge:()=>K7,generateScopeId:()=>aY,generateSFCWebComponent:()=>uO,generateRouteTypes:()=>ZP,generateRouteManifest:()=>$P,generateRobotsTxt:()=>Mq,generateRobots:()=>q3,generateResponsiveVariants:()=>vY,generateReactiveWebComponentTS:()=>BC,generateReactiveWebComponent:()=>_C,generateReactiveRuntime:()=>jC,generateReactiveMixin:()=>qC,generatePoster:()=>B5,generatePlaceholderStyle:()=>gQ,generatePlaceholderCSS:()=>_8,generatePlaceholder:()=>z8,generatePartialHydrationCSS:()=>$Q,generateNonce:()=>G9,generateNetlifyToml:()=>GX,generateMinifiedMediaRuntime:()=>UA,generateMediaRuntime:()=>aW,generateMediaManagerEmbed:()=>YA,generateManifest:()=>QK,generateLoadingIndicatorHtml:()=>Kv,generateLazyLoadRuntime:()=>Q3,generateLQIP:()=>xQ,generateKeepAliveRuntime:()=>YH,generateKeepAliveCSS:()=>ZH,generateIslandManifest:()=>KQ,generateImagePreview:()=>iW,generateImageManifest:()=>OX,generateHydrationScript:()=>qv,generateHydrationRuntime:()=>NB,generateHydrationCSS:()=>Hv,generateHydrationBootstrap:()=>a2,generateHotReloadScript:()=>tO,generateHeatmapScript:()=>AJ,generateHMRClientScript:()=>Wv,generateHLSManifest:()=>j5,generateEventBindings:()=>Bv,generateDprSrcsetWithVariableQuality:()=>RQ,generateDprSrcset:()=>o$,generateDocumentShell:()=>xq,generateDocs:()=>uV,generateDirectivesDocs:()=>fV,generateDirectiveRuntime:()=>tk,generateDefaultRobotsTxt:()=>wI,generateDASHManifest:()=>H5,generateCspMetaTag:()=>wZ,generateCspHeader:()=>K9,generateCrosswindCSS:()=>QZ,generateCompositionRuntime:()=>EA,generateComponentsDocs:()=>xV,generateComponentManifest:()=>pD,generateComponentDoc:()=>yV,generateColorPlaceholder:()=>fQ,generateClientRuntime:()=>wb,generateCacheKey:()=>Z5,generateBrowserAutoImportDestructuring:()=>Oz,generateBlurUpRuntime:()=>K3,generateBlurUpCSS:()=>W3,generateBindingsRuntime:()=>lz,generateAutoWidthSrcset:()=>NQ,generateAutoImportDestructuring:()=>s3,generateAsyncComponentRuntime:()=>aj,generateAsyncComponentCSS:()=>rj,generateAnimationRuntime:()=>gR,generateAnimationCSS:()=>vR,generateAnalyticsScript:()=>mJ,formatTypeErrors:()=>ex,formatStxContent:()=>DX,formatSize:()=>O6,formatRoutes:()=>oG,formatMarkdownContent:()=>TK,formatLocalizedError:()=>G_,formatICU:()=>UB,formatFilePath:()=>N7,formatError:()=>qZ,formatDoctorReport:()=>rX,formatDocsAsMarkdown:()=>gV,formatDocsAsJson:()=>dV,formatDocsAsHtml:()=>hV,format:()=>qW,foldConstants:()=>KV,flipVertical:()=>BW,flipHorizontal:()=>_W,fingerprint:()=>tG,findPantryPackage:()=>XU,findMatchingEndTag:()=>t4,findMatchingDelimiter:()=>r0,findIfBlocks:()=>k$,findExpressions:()=>T_,findErrorPage:()=>sG,findDirectiveBlocks:()=>E7,findDeadCode:()=>QV,findDeadBranches:()=>QV,findComponentFiles:()=>VK,findCommonDir:()=>qU,filterRequiredFiles:()=>E8,fileExists:()=>J0,extractVariables:()=>D0,extractStreamBoundaries:()=>OB,extractState:()=>xF,extractSlotContent:()=>cH,extractScriptFromTemplate:()=>_2,extractPlaceholders:()=>VM,extractParenthesizedExpression:()=>N4,extractLayoutMetadata:()=>m8,extractDominantColor:()=>vQ,extractDirectiveParams:()=>I_,extractDirectiveNames:()=>dH,extractContainerContent:()=>u8,extractComponentProps:()=>bV,extractComponentName:()=>s2,extractComponentDescription:()=>PV,extractClassNames:()=>JZ,extractBridgeData:()=>m4,extractBoundProps:()=>o2,extractBalancedExpression:()=>eJ,extractAndStripCssImports:()=>Q7,extractAndScopeStyles:()=>zC,extractAndProcessEvents:()=>az,evaluateExpression:()=>G1,evaluateConstant:()=>TX,evaluateAuthExpression:()=>w4,escapeHtml:()=>v0,errorRecovery:()=>jZ,errorLogger:()=>K1,ensureTeleportTargets:()=>Nj,ensureDocumentShell:()=>m7,enhancedValidationRules:()=>A9,eliminateDeadCode:()=>GV,effect:()=>i7,dprUrls:()=>FW,docsCommand:()=>FK,disconnectObserver:()=>fW,devHelpers:()=>D$,detectShell:()=>rG,detectRuntime:()=>x5,detectProjectConfig:()=>T5,detectFormat:()=>CQ,detectBuildMode:()=>DP,derived:()=>p7,deploy:()=>eO,defineStxConfig:()=>cO,defineStore:()=>pF,defineSlots:()=>RA,defineSiteConfig:()=>BU,definePropsWithValidation:()=>Qw,defineProps:()=>Jw,definePlugin:()=>V5,definePageMeta:()=>c_,defineMiddleware:()=>Eb,defineExpose:()=>VA,defineEmits:()=>LA,defineDirective:()=>h0,defineCustomElement:()=>dA,defineConfig:()=>ty,defineClientDirective:()=>ak,defineAsyncComponent:()=>ij,defaultMediaConfig:()=>bv,defaultImageConfig:()=>VL,defaultI18nConfig:()=>CZ,defaultHeatmapConfig:()=>Zz,defaultFormClasses:()=>IZ,defaultFilters:()=>F$,defaultCspConfig:()=>RT,defaultConfig:()=>N1,default:()=>uf,decodeThumbhash:()=>yQ,cspNonceDirective:()=>x_,cspDirective:()=>y_,crossfadeTransition:()=>mW,crop:()=>tK,createVirtualList:()=>AY,createVideoDirective:()=>rY,createVercelHandler:()=>Ay,createTypeChecker:()=>hK,createTranslateFilter:()=>wE,createTextEncoderStream:()=>Oy,createStxApp:()=>$U,createStreamingResponse:()=>Hy,createStreamRenderer:()=>VB,createStore:()=>aK,createStorageManager:()=>Tb,createServerCookieManager:()=>Mb,createScope:()=>wL,createSSRSuspense:()=>fj,createRouter:()=>P4,createRouteLocation:()=>x8,createRoute:()=>nx,createRef:()=>Kb,createReactive:()=>NL,createProvideContext:()=>TA,createProject:()=>Qx,createProductionBuild:()=>oy,createPlaceholder:()=>W7,createOptimizedBuild:()=>SP,createNetlifyHandler:()=>wy,createNetlifyClient:()=>M8,createMiddlewareContext:()=>y8,createMiddleware:()=>ix,createLazyObserver:()=>xW,createKeepAliveCache:()=>ej,createKVNamespace:()=>cV,createIslandRegistry:()=>t2,createImgDirective:()=>uY,createImagePlugin:()=>uG,createImageHandler:()=>UX,createImageDirective:()=>qX,createHeatmapAggregator:()=>mR,createFileManifest:()=>T8,createEnvAccessor:()=>lV,createEnhancedError:()=>q_,createEdgeHandler:()=>i8,createEdgeCache:()=>pV,createDetailedErrorMessage:()=>T0,createDenoHandler:()=>Fy,createDefaultNetlifyConfig:()=>E5,createCspHeaders:()=>NT,createCookie:()=>Ry,createComputed:()=>Wb,createComponentInstance:()=>Gb,createCloudflareHandler:()=>Vy,createClientCookieManager:()=>Rb,createBuiltinDirectives:()=>ok,createApp:()=>$U,createAnimationTimeline:()=>xR,cover:()=>ZW,convertToCommonJS:()=>uZ,contrast:()=>WW,contain:()=>$W,consoleError:()=>B_,configureErrorHandling:()=>W_,config:()=>T1,computed:()=>Wb,composeShellWithPage:()=>d8,componentDirective:()=>TV,componentClientSignalNames:()=>sH,compileTemplate:()=>YK,collectDeployFiles:()=>M5,clearVideoCache:()=>lY,clearTranslationCache:()=>nT,clearSignatureCache:()=>TW,clearPlaceholderCache:()=>hQ,clearOnceStore:()=>jI,clearNonce:()=>LT,clearMiddleware:()=>P8,clearImageCache:()=>BX,clearErrorMessages:()=>Q_,clearDevCaches:()=>cq,clearCustomFilters:()=>bz,clearComponentCache:()=>B4,clearCache:()=>Q5,cleanupLoadingIndicator:()=>Gv,classifyScript:()=>bL,classifyAllScripts:()=>pG,checkTemplateFile:()=>ox,checkTemplate:()=>tx,checkCache:()=>qY,checkAuthAccess:()=>u5,checkA11y:()=>u3,channel:()=>wV,captureScreenshots:()=>tV,captureScreenshot:()=>RK,cancelPendingLoads:()=>XE,calculateSha1:()=>QX,calculateOptimalWidths:()=>SY,cacheTemplate:()=>jY,buildWebComponents:()=>LG,buildViews:()=>qA,buildUrl:()=>k0,buildSuspenseResolveScript:()=>PZ,buildStaticSite:()=>zU,buildRuntimeAsset:()=>eG,buildRouterAsset:()=>$K,buildLangPickerScript:()=>V3,buildImageUrl:()=>r1,buildForProduction:()=>rL,buildComponentLibrary:()=>HK,buildAuthParams:()=>X3,buildApp:()=>sL,buildAlternateLinks:()=>L3,build:()=>sy,broadcastPrivate:()=>FV,broadcastPresence:()=>AV,broadcast:()=>BK,brightness:()=>KW,blur:()=>YW,batchSignUrls:()=>yX,batch:()=>GY,autoFixA11yFile:()=>pU,autoFixA11yDirectory:()=>MR,autoFixA11y:()=>cU,auto:()=>HW,assetTags:()=>wP,arrayOf:()=>Bw,applyTranslations:()=>O3,applyTransformations:()=>H8,applySlots:()=>pH,applyPropDefaults:()=>yP,applyPreset:()=>LW,applyHead:()=>a_,applyFilters:()=>bJ,apiCspPreset:()=>P_,animationGroupDirective:()=>i3,analyzeVideo:()=>L8,analyzeUsage:()=>zK,analyzeTemplate:()=>CL,analyzeProject:()=>cG,analyzeDirectiveUsage:()=>zK,analyticsDirective:()=>mM,addStore:()=>zx,addPage:()=>Ux,addNonceToInlineContent:()=>U9,addLayout:()=>_x,addComponent:()=>Wx,abortNavigation:()=>Nb,a11yDirective:()=>m3,__setSignalsGeneratorsForTest:()=>uq,VideoProcessorCache:()=>U5,TransitionType:()=>iU,TransitionEase:()=>rU,TransitionDirection:()=>nU,Tokenizer:()=>T7,TemplateTypeChecker:()=>gK,TEMPLATE_PRESETS:()=>fy,StxValidationError:()=>R7,StxSyntaxError:()=>aJ,StxSecurityError:()=>sJ,StxRuntimeError:()=>i1,StxFileError:()=>I$,StxError:()=>o4,Show:()=>xA,SUSPENSE_RESOLVER_RUNTIME:()=>k9,STATE_DIR_ENV_VAR:()=>Gz,SPRING_PRESETS:()=>LJ,ProductionBuild:()=>kX,Portal:()=>fA,PROJECT_TEMPLATES:()=>Jx,PRESETS:()=>bX,MemorySessionStore:()=>hF,MIME_TYPES:()=>W8,MEDIA_DEFAULT_WIDTHS:()=>j4,MEDIA_DEFAULT_FORMATS:()=>E4,ImageProcessorCache:()=>G5,ImageProcessingError:()=>$$,HydrationRuntime:()=>nK,HotReloadServer:()=>kG,HeatmapAggregator:()=>RJ,Fragment:()=>U$,For:()=>vA,ErrorLogger:()=>HZ,ErrorCodes:()=>Q0,DeployError:()=>S4,DEFAULT_WIDTHS:()=>P1,DEFAULT_TRANSITION_OPTIONS:()=>X4,DEFAULT_STATE_DIR:()=>k6,DEFAULT_QUALITY:()=>x1,DEFAULT_PLACEHOLDER_OPTIONS:()=>bY,DEFAULT_FORMATS:()=>y1,DEFAULT_DPR_VALUES:()=>K8,ComponentHMRHandler:()=>pK,COMMON_SIZES:()=>TQ,CLOAK_STYLE:()=>nI,BroadcastServer:()=>RV,Broadcast:()=>NV,BLUR_UP_CSS:()=>$5});var uf;var V6=D(()=>{KX();LX();N0();K2();u4();nF();M2();oW();hA();uA();RG();K4();JU();aA();tA();RL();h6();FX();w9();j$();cJ();r3();O9();s$();b5();nJ();UK();ZK();$V();_V();EX();i6();EV();OK();n0();_9();j9();KX();jU();G8();AK();iV();MK();S1();iJ();$1();EK();a3();I9();g$();kK();SK();nZ();IY();F2();I7();RX();U7();q1();zF();WK();yK();l8();wF();iG();eZ();RF();J4();YY();XK();PK();Y6();TF();AG();r2();WQ();EF();kF();uJ();b6();CF();fF();dF();LX();BA();jA();d$();E2();D2();YU();N0();DY();Zw();uf={}});import M3 from"path";var p5;var eX=D(()=>{V6();S1();$1();r4();q1();C$();p5={name:"bun-plugin-stx",async setup($){let Y={...await g0(),...$.config?.stx},X=new Set,J=Y.webComponents?.enabled?`./${M3.relative(M3.dirname($.config?.outdir||"dist"),Y.webComponents.outputDir||"dist/web-components")}`:"/web-components",Q=[];if(Y.webComponents?.enabled)try{let G=await LG(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 qY(G,Y);if(H){if(Y.debug)console.log(`Using cached version of ${G}`);return{contents:H,loader:"html"}}}let W=await W4(()=>Bun.file(G).text(),"",(H)=>{throw new I$(`Failed to read stx file: ${G}`,G,void 0,void 0,`File read error: ${H.message}`)});if(!W)throw new I$(`stx file is empty: ${G}`,G);let{scriptContent:U,templateContent:z,allScripts:_}=c1.time("script-extraction",()=>{let H=W,O=U4(W);if(O)H=O.content.trim();let V=W.match(/<script\b[^>]*>[\s\S]*?<\/script>/gi)||[],L="",F=[];for(let w of V){let N=w.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i)?.[1]||"",R=w.match(/<script\b([^>]*)>/i),E=R?R[1]:"";if(/\bserver\b/i.test(E))L=N;else F.push(w)}let A=H.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"");return{scriptContent:L,templateContent:A,allScripts:F}}),B={__filename:G,__dirname:M3.dirname(G),__stx:{webComponentsPath:J,builtComponents:Q}};await W4(()=>D0(U,B,G),void 0,(H)=>{let O=new i1(`Script execution failed in ${G}: ${H.message}`,G,void 0,void 0,U.substring(0,100));if(K1.log(O,{filePath:G,scriptContent:U}),Y.debug)throw O});let j=await c1.timeAsync("directive-processing",async()=>{return await _0(z,B,G,Y,K)});if(_.length>0){let{interpolateScriptsInTemplate:H}=await Promise.resolve().then(() => ($1(),j7)),O=H(_.join(`
|
|
17858
17858
|
`),B),V=j.search(/<\/body>/i);if(V!==-1)j=j.slice(0,V)+O+`
|
|
17859
17859
|
`+j.slice(V);else j+=`
|
|
17860
17860
|
${O}`}if(j=await M4(j),K.forEach((H)=>X.add(H)),Y.cache&&Y.cachePath){if(await jY(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 i1(`Plugin processing failed: ${String(K)}`,G);if(K1.log(W,{filePath:G,buildConfig:$.config}),D$.logDetailedError(W,{filePath:G,plugin:"bun-plugin-stx"}),Y.debug)console.error("stx Plugin Error:",W);let U=W,z=U.line||null,_=U.context||null;return{contents:Y.debug||s4()?`<!DOCTYPE html>
|
|
@@ -17917,7 +17917,7 @@ ${O}`}if(j=await M4(j),K.forEach((H)=>X.add(H)),Y.cache&&Y.cachePath){if(await j
|
|
|
17917
17917
|
<h1>Something went wrong</h1>
|
|
17918
17918
|
<p>An internal error occurred. Please try again later.</p>
|
|
17919
17919
|
</body>
|
|
17920
|
-
</html>`,loader:"html"}}})}}});var{serve:mf}=globalThis.Bun;import Z4 from"fs";import I1 from"path";async function w3($,Z={}){let Y=Z.port||3000,X=Z.watch!==!1,J=Z.hotReload!==!1&&X,Q=null,G=Z.hmrPort||Y+1,K=I1.resolve($);if(!Z4.existsSync(K))return console.error(`${T.red}Error: File not found: ${T.bright}${K}${T.reset}`),!1;if(K.endsWith(".md"))return JX(K,Z);else if(!K.endsWith(".stx"))return console.error(`${T.red}Error: Unsupported file type: ${T.bright}${K}${T.reset}. Only .stx and .md files are supported.`),!1;let W=l0(process.cwd(),"output");Z4.mkdirSync(W,{recursive:!0}),console.log(`${T.blue}Building ${T.bright}${$}${T.reset}...`);let U=null,z=async()=>{try{let L={name:"public-assets",setup(N){N.onResolve({filter:/^\/(images|fonts|assets|public)\//},(R)=>{return{path:R.path,external:!0}})}},F=await Bun.build({entrypoints:[K],outdir:W,plugins:[L,p5],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...Z.stxOptions});if(!F.success)return console.error(`${T.red}Build failed:${T.reset}`,F.logs),!1;let A=F.outputs.find((N)=>N.path.endsWith(".html"));if(!A)return console.error(`${T.red}No HTML output found${T.reset}`),!1;return U=await Bun.file(A.path).text(),!0}catch(L){return console.error(`${T.red}Error building stx file:${T.reset}`,L),!1}};if(!await z())return!1;let B=I1.dirname(K);await M$(B);let q=Y;try{if(q=await j6(Y),q!==Y)console.log(`${T.yellow}Port ${Y} is busy, using port ${q} instead${T.reset}`)}catch{return console.error(`${T.red}Could not find an available port${T.reset}`),!1}if(J){let L=Z.hmrPort||q+1;Q=R8({wsPort:L,verbose:!1}),G=Q.start(L)}let j={},H=null;try{let{loadStxConfig:L}=await Promise.resolve().then(() => (V6(),
|
|
17920
|
+
</html>`,loader:"html"}}})}}});var{serve:mf}=globalThis.Bun;import Z4 from"fs";import I1 from"path";async function w3($,Z={}){let Y=Z.port||3000,X=Z.watch!==!1,J=Z.hotReload!==!1&&X,Q=null,G=Z.hmrPort||Y+1,K=I1.resolve($);if(!Z4.existsSync(K))return console.error(`${T.red}Error: File not found: ${T.bright}${K}${T.reset}`),!1;if(K.endsWith(".md"))return JX(K,Z);else if(!K.endsWith(".stx"))return console.error(`${T.red}Error: Unsupported file type: ${T.bright}${K}${T.reset}. Only .stx and .md files are supported.`),!1;let W=l0(process.cwd(),"output");Z4.mkdirSync(W,{recursive:!0}),console.log(`${T.blue}Building ${T.bright}${$}${T.reset}...`);let U=null,z=async()=>{try{let L={name:"public-assets",setup(N){N.onResolve({filter:/^\/(images|fonts|assets|public)\//},(R)=>{return{path:R.path,external:!0}})}},F=await Bun.build({entrypoints:[K],outdir:W,plugins:[L,p5],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...Z.stxOptions});if(!F.success)return console.error(`${T.red}Build failed:${T.reset}`,F.logs),!1;let A=F.outputs.find((N)=>N.path.endsWith(".html"));if(!A)return console.error(`${T.red}No HTML output found${T.reset}`),!1;return U=await Bun.file(A.path).text(),!0}catch(L){return console.error(`${T.red}Error building stx file:${T.reset}`,L),!1}};if(!await z())return!1;let B=I1.dirname(K);await M$(B);let q=Y;try{if(q=await j6(Y),q!==Y)console.log(`${T.yellow}Port ${Y} is busy, using port ${q} instead${T.reset}`)}catch{return console.error(`${T.red}Could not find an available port${T.reset}`),!1}if(J){let L=Z.hmrPort||q+1;Q=R8({wsPort:L,verbose:!1}),G=Q.start(L)}let j={},H=null;try{let{loadStxConfig:L}=await Promise.resolve().then(() => (V6(),X$)),F=await L();if(F?.apiRouter)H=F?.apiRouter,console.log(`${T.blue}Using custom router for API handling${T.reset}`);if(F?.apiRoutes){j=F.apiRoutes;let A=Object.keys(j).length;if(A>0)console.log(`${T.blue}Loaded ${T.bright}${A} API route${A>1?"s":""}${T.reset}`)}if(F?.broadcasting?.enabled)try{let{startBroadcasting:A,loadChannels:w}=await Promise.resolve().then(() => (EX(),qK)),N=F.broadcasting;await A(N);let R=N.port??6001;console.log(`${T.magenta}Broadcasting on ${T.cyan}ws://localhost:${R}/ws${T.reset}`);let E=I1.join(process.cwd(),"channels.ts");if(Z4.existsSync(E))try{let M=await w(E);console.log(`${T.blue}Loaded ${T.bright}${M} broadcast channel${M!==1?"s":""}${T.blue} from channels.ts${T.reset}`)}catch(M){console.warn(`${T.yellow}Failed to load channels.ts: ${M.message}${T.reset}`)}}catch(A){console.warn(`${T.yellow}Broadcasting failed to start: ${A.message}${T.reset}`)}}catch{}if(console.log(`${T.blue}Starting server on ${T.cyan}http://localhost:${q}/${T.reset}...`),J)console.log(`${T.magenta}Hot reload enabled on ws://localhost:${G}${T.reset}`);let O=mf({port:q,async fetch(L){let F=new URL(L.url);if(H)try{let E=await H.handleRequest(L);if(E.status!==404)return E}catch{}if(j[F.pathname])try{return await j[F.pathname](L)}catch(E){return new Response(JSON.stringify({error:E.message}),{status:500,headers:{"Content-Type":"application/json"}})}if(F.pathname==="/")return(async()=>{let M=await y0(U||"");if(J)M=H4(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 if(M.includes("<html"))M=M.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 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;if(Z.titlebarHidden)if(M.includes("<head>"))M=M.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else if(M.includes("<html"))M=M.replace(/(<html[^>]*>)/,"$1<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>");else M=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${M}`;return M})().then((M)=>new Response(M,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}}));let A=I1.join(W,F.pathname);if(Z4.existsSync(A)&&Z4.statSync(A).isFile()){let E=Bun.file(A),M=I1.extname(A).toLowerCase(),I="text/plain";if(M===".ts"||M===".tsx"){let S=new Bun.Transpiler({loader:M===".tsx"?"tsx":"ts"}),k=await E.text(),x=S.transformSync(k);return new Response(x,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(M){case".html":I="text/html";break;case".css":I="text/css";break;case".js":I="text/javascript";break;case".json":I="application/json";break;case".png":I="image/png";break;case".jpg":case".jpeg":I="image/jpeg";break;case".gif":I="image/gif";break;case".woff":I="font/woff";break;case".woff2":I="font/woff2";break;case".ttf":I="font/ttf";break;case".otf":I="font/otf";break;case".eot":I="application/vnd.ms-fontobject";break}return new Response(E,{headers:{"Content-Type":I}})}let w=I1.dirname(K),N=I1.join(w,F.pathname);if(Z4.existsSync(N)&&Z4.statSync(N).isFile()){let E=Bun.file(N),M=I1.extname(N).toLowerCase(),I="text/plain";if(M===".ts"||M===".tsx"){let S=new Bun.Transpiler({loader:M===".tsx"?"tsx":"ts"}),k=await E.text(),x=S.transformSync(k);return new Response(x,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(M){case".html":I="text/html";break;case".css":I="text/css";break;case".js":I="text/javascript";break;case".json":I="application/json";break;case".png":I="image/png";break;case".jpg":case".jpeg":I="image/jpeg";break;case".gif":I="image/gif";break;case".svg":I="image/svg+xml";break;case".ico":I="image/x-icon";break;case".woff":I="font/woff";break;case".woff2":I="font/woff2";break;case".ttf":I="font/ttf";break;case".otf":I="font/otf";break;case".eot":I="application/vnd.ms-fontobject";break}return new Response(E,{headers:{"Content-Type":I}})}let R=I1.join(process.cwd(),"public",F.pathname);if(Z4.existsSync(R)&&Z4.statSync(R).isFile()){let E=Bun.file(R),M=I1.extname(R).toLowerCase(),I="application/octet-stream";if(M===".ts"||M===".tsx"){let S=new Bun.Transpiler({loader:M===".tsx"?"tsx":"ts"}),k=await E.text(),x=S.transformSync(k);return new Response(x,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(M){case".html":I="text/html";break;case".css":I="text/css";break;case".js":I="text/javascript";break;case".json":I="application/json";break;case".png":I="image/png";break;case".jpg":case".jpeg":I="image/jpeg";break;case".gif":I="image/gif";break;case".svg":I="image/svg+xml";break;case".ico":I="image/x-icon";break;case".woff":I="font/woff";break;case".woff2":I="font/woff2";break;case".ttf":I="font/ttf";break;case".otf":I="font/otf";break;case".eot":I="application/vnd.ms-fontobject";break}return new Response(E,{headers:{"Content-Type":I}})}return new Response("Not Found",{status:404})},error(L){return new Response(`<pre>${L}
|
|
17921
17921
|
${L.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});console.clear(),console.log(`
|
|
17922
17922
|
${T.blue}stx${T.reset} ${T.green}${process.env.stx_VERSION||"v0.0.10"}${T.reset} ${T.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${T.reset}`),console.log(`
|
|
17923
17923
|
${T.bright}\u2192 ${T.cyan}http://localhost:${q}/${T.reset}`),console.log(`
|
|
@@ -18092,12 +18092,12 @@ ${j.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});console.clear(),con
|
|
|
18092
18092
|
${T.blue}stx${T.reset} ${T.green}${process.env.stx_VERSION||"v0.0.10"}${T.reset} ${T.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${T.reset}`),console.log(`
|
|
18093
18093
|
${T.bright}\u2192 ${T.cyan}http://localhost:${z}/${T.reset}`),console.log(`
|
|
18094
18094
|
${T.yellow}Routes:${T.reset}`);let B=new Set(K.map((j)=>j.routeTemplate)),q=Object.entries(G).filter(([j])=>!B.has(j)).sort(([j],[H])=>j.localeCompare(H)).map(([j,H])=>({route:j==="/"?"/":j,filePath:V1.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:V1.relative(process.cwd(),j.filePath),fileType:"stx"})}if(q.sort((j,H)=>j.route.localeCompare(H.route)),q.forEach((j,H)=>{let V=H===q.length-1?"\u2514\u2500 ":"\u251C\u2500 ",L=j.fileType==="md"?`${T.magenta}(markdown)${T.reset}`:"";console.log(` ${T.green}${V}${j.route}${T.reset} \u2192 ${T.bright}${j.filePath}${T.reset} ${L}`)}),console.log(`
|
|
18095
|
-
Press ${T.cyan}h${T.reset} + ${T.cyan}Enter${T.reset} to show shortcuts`),H6(_.url.toString(),()=>{if(X)M6.watch(Q,{recursive:!0}).close();_.stop()}),X){console.log(`${T.blue}Watching for changes...${T.reset}`);let j=M6.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(`${T.yellow}File ${T.bright}${O}${T.yellow} changed, rebuilding...${T.reset}`),J6.clear(),B4(),await W()});process.on("SIGINT",()=>{j.close(),_.stop(),process.exit(0)})}return!0}var Ow=D(()=>{s$();n0();g$();J4();eX();N0();F8()});var{serve:cf}=globalThis.Bun;import D1 from"fs";import E0 from"path";function HU($){let Z=Bun.file($),Y=E0.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 R3($=".",Z={}){let Y=Z.port||3000,X=Z.watch!==!1,J=Z.hotReload!==!1&&X,Q=null,G=Z.hmrPort||Y+1,K=E0.resolve($),{loadStxConfig:W}=await Promise.resolve().then(() => (V6(),Z$)),U=await W(K),z=U.root&&U.root!=="."?E0.join(K,U.root):K,_=U.pagesDir||"pages",B=E0.join(z,_);if(!D1.existsSync(B))return console.error(`${T.red}Error: No '${_}' directory found in ${T.bright}${z}${T.reset}`),console.log(`${T.dim}Create a ${_}/ directory with .stx files to define your routes.${T.reset}`),console.log(`${T.dim}Example: ${_}/index.stx for the homepage.${T.reset}`),!1;let q=P4(z);if(q.length===0)return console.error(`${T.red}Error: No page files found in ${T.bright}${B}${T.reset}`),!1;console.log(`${T.blue}Found ${T.bright}${q.length}${T.blue} routes${T.reset}`);let j=U?._pluginPageDirs||[],H=[];for(let{dir:P,prefix:h}of j)if(D1.existsSync(P)){let m=P4(E0.dirname(P),{pagesDir:E0.basename(P)});for(let i of m){let s=h==="/"?i.pattern:`${h}${i.pattern==="/"?"":i.pattern}`;H.push({route:{...i,pattern:s},prefix:h})}if(m.length>0)console.log(`${T.blue}Plugin pages: ${T.bright}${m.length}${T.blue} routes at ${T.cyan}${h}${T.reset}`)}let O=new Map,V=null,L=null;if(Z.stxOptions?.shell!==!1){if(L=await rG(K,Z.stxOptions?.shell),L){if(V=await wX(L,Z.stxOptions||{}),V)console.log(`${T.blue}Using app shell: ${T.bright}${E0.relative(K,L)}${T.reset} ${T.dim}(deprecated: use layouts/default.stx instead)${T.reset}`)}}P8(),await f8(K);let F=v8();if(F.length>0)console.log(`${T.blue}Loaded ${T.bright}${F.length}${T.blue} middleware: ${T.dim}${F.join(", ")}${T.reset}`);let A={},w=null;try{let{loadStxConfig:P}=await Promise.resolve().then(() => (V6(),Z$)),h=await P(K);if(h?.apiRouter)w=h?.apiRouter,console.log(`${T.blue}Using custom router for API handling${T.reset}`);if(h?.apiRoutes){A=h.apiRoutes;let m=Object.keys(A).length;if(m>0)console.log(`${T.blue}Loaded ${T.bright}${m} API route${m>1?"s":""}${T.reset}`)}if(h?.broadcasting?.enabled)try{let{startBroadcasting:m,loadChannels:i}=await Promise.resolve().then(() => (EX(),qK)),s=h.broadcasting;await m(s);let q0=s.port??6001;console.log(`${T.magenta}Broadcasting on ${T.cyan}ws://localhost:${q0}/ws${T.reset}`);let K0=E0.join(process.cwd(),"channels.ts");if(D1.existsSync(K0))try{let S0=await i(K0);console.log(`${T.blue}Loaded ${T.bright}${S0} broadcast channel${S0!==1?"s":""}${T.blue} from channels.ts${T.reset}`)}catch(S0){console.warn(`${T.yellow}Failed to load channels.ts: ${S0.message}${T.reset}`)}}catch(m){console.warn(`${T.yellow}Broadcasting failed to start: ${m.message}${T.reset}`)}}catch{}let N=l0(K,"output");D1.mkdirSync(N,{recursive:!0});let R=new Map,E=new Set,M=async(P)=>{let h=sG(B,P);if(!h)return null;try{let m=await Bun.build({entrypoints:[h],outdir:N,plugins:[p5],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...Z.stxOptions});if(!m.success)return null;let i=m.outputs.find((s)=>s.path.endsWith(".html"));if(!i)return null;return await Bun.file(i.path).text()}catch{return null}},I=async(P,h)=>{try{let{processDirectives:m,extractVariables:i,defaultConfig:s,loadStxConfig:q0,injectRouterScript:K0}=await Promise.resolve().then(() => (V6(),Z$)),{checkCache:S0,cacheTemplate:z1,readFileCached:C0,templateCache:h1}=await Promise.resolve().then(() => (c6(),l$)),X0=await q0(K),l=(j0)=>{if(!j0)return j0;if(E0.isAbsolute(j0))return j0;return E0.resolve(K,j0)},u={...s,...X0,...Z.stxOptions,autoShell:!0};if(Z.debugDirectives)u.debug=!0;u.partialsDir=l(u.partialsDir),u.componentsDir=l(u.componentsDir),u.layoutsDir=l(u.layoutsDir),u.storesDir=l(u.storesDir||"stores"),u.cachePath=l(u.cachePath)??l0(K,"cache");let n=!h&&!Z.profile,C=u.cache!==!1;if(C&&n){let j0=h1.get(P.filePath);if(j0)try{if((await D1.promises.stat(P.filePath)).mtime.getTime()<=j0.mtime){let G0=!0;for(let I0 of j0.dependencies){if(!D1.existsSync(I0)){G0=!1;break}if((await D1.promises.stat(I0)).mtime.getTime()>j0.mtime){G0=!1;break}}if(G0){let I0=j0.output;if(V)I0=b4(I0,{preserveHead:!0});return{route:P,content:I0}}}}catch{}let m0=await S0(P.filePath,u);if(m0){let P0=m0;if(V)P0=b4(P0,{preserveHead:!0});return{route:P,content:P0}}}let d=C?await C0(P.filePath):await Bun.file(P.filePath).text(),{classifyAllScripts:o}=await Promise.resolve().then(() => (V6(),Z$)),a=o(d),z0=a.server.map((j0)=>j0.content),O0=d;for(let j0 of a.server)O0=O0.replace(j0.fullTag,"");let w0={__filename:P.filePath,__dirname:E0.dirname(P.filePath),params:h??{},__stx_runtime_head:{}};for(let j0 of z0)try{await i(j0,w0,P.filePath)}catch(m0){if(Z.stxOptions?.debug)console.error("[stx] variable extraction error",P.filePath,m0?.message||m0)}let Q1=new Set,_1;if(Z.profile){let j0=performance.now();_1=await m(O0,w0,P.filePath,u,Q1);let m0=performance.now()-j0,P0=E0.relative(K,P.filePath)||P.filePath;console.log(`[stx:profile] ${P0} \u2192 ${m0.toFixed(2)}ms`)}else _1=await m(O0,w0,P.filePath,u,Q1);if(!V)_1=await K0(_1);{let{interpolateScriptExpressions:j0}=await Promise.resolve().then(() => ($1(),j7));_1=_1.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/g,(m0,P0,G0)=>{if(!/function\s+__stx_setup_/.test(G0))return m0;return`<script${P0}>${j0(G0,w0)}</script>`})}if(V)_1=b4(_1,{preserveHead:!0});if(C&&n)await z1(P.filePath,_1,Q1,u);let{extractStreamBoundaries:b0}=await Promise.resolve().then(() => (Y6(),h6)),B1=b0(w0),e0=w0.__streamTemplates;if(e0&&typeof e0==="object"&&Object.keys(e0).length>0){let j0=w0.streamBoundaries||{},m0={...u,autoShell:!1},P0=Object.keys(e0).map((I0)=>({id:I0,render:async()=>{let q$=typeof j0[I0]==="function"?await j0[I0]():void 0;return m(e0[I0],{...w0,$boundary:q$},P.filePath,m0,new Set)}})),G0=new Set(P0.map((I0)=>I0.id));B1=[...(B1||[]).filter((I0)=>!G0.has(I0.id)),...P0]}if(B1&&B1.length>0)E.add(P.pattern);else B1=void 0;return{route:P,content:_1,boundaries:B1}}catch(m){return console.error(`${T.red}Error building ${T.bright}${P.pattern}${T.reset}:`,m),null}},S=8,k=async()=>{R.clear(),O.clear();for(let P=0;P<q.length;P+=S){let h=q.slice(P,P+S),m=await Promise.all(h.map((i)=>I(i)));for(let i of m)if(i)R.set(i.route.pattern,i)}for(let P=0;P<H.length;P+=S){let h=H.slice(P,P+S),m=await Promise.all(h.map(({route:i})=>I(i)));for(let i of m)if(i)O.set(i.route.pattern,i)}return R.size>0};if(console.log(`${T.blue}Building pages...${T.reset}`),!await k())return console.error(`${T.red}No pages were successfully built${T.reset}`),!1;await M$(K);let y=Y;try{if(y=await j6(Y),y!==Y)console.log(`${T.yellow}Port ${Y} is busy, using port ${y} instead${T.reset}`)}catch{return console.error(`${T.red}Could not find an available port${T.reset}`),!1}if(J){let P=Z.hmrPort||y+1;Q=R8({wsPort:P,verbose:!1}),G=Q.start(P)}let b=(P,h)=>{let i=`<script data-stx-route-params>(function(){var p=${JSON.stringify(h).replace(/</g,"\\u003C").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")};window.__stx_rp=p;if(window.stx){window.stx._rp=p;if(window.stx.setRouteParams)window.stx.setRouteParams(p)}})()</script>`;if(P.includes("</head>"))return P.replace("</head>",`${i}</head>`);if(P.includes("<body"))return P.replace(/<body([^>]*)>/,`<body$1>${i}`);return i+P};console.log(`${T.blue}Starting server...${T.reset}`);let g=cf({port:y,async fetch(P){let h=new URL(P.url),m=U?.publicDir||"public",i=E0.join(K,m,h.pathname),s=E0.join(K,h.pathname),q0=E0.join(N,h.pathname),[K0,S0,z1]=await Promise.all([D1.promises.stat(i).catch(()=>null),D1.promises.stat(s).catch(()=>null),D1.promises.stat(q0).catch(()=>null)]);if(K0?.isFile())return HU(i);if(S0?.isFile())return HU(s);if(z1?.isFile())return HU(q0);if(h.pathname.startsWith("/_stx/component/")){let l=decodeURIComponent(h.pathname.slice(16));if(l)try{let u=`<${l} />`,n={...buildConfig,autoShell:!1},C=await processDirectives(u,{},E0.join(K,"components",`${l}.stx`),n,new Set);return new Response(C,{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(h.pathname==="/_stx/img"){let{handleImageRequest:l}=await Promise.resolve().then(() => (vG(),_L)),u=await l(P,{publicDir:E0.join(K,m),cacheDir:l0(K,"cache","img")});if(u)return u}if(w)try{let l=await w.handleRequest(P);if(l.status!==404)return l}catch{}if(A[h.pathname])try{return await A[h.pathname](P)}catch(l){return new Response(JSON.stringify({error:l.message}),{status:500,headers:{"Content-Type":"application/json"}})}let C0=NX(h.pathname,q);if(C0){let l=R.get(C0.route.pattern),u=E.has(C0.route.pattern);if(C0.route.isDynamic&&Object.keys(C0.params).length>0||u){let n=await I(C0.route,C0.params);if(n)l=n}if(l){let n=MZ();if(n.validate){if(!await n.validate({params:C0.params})){let o=await M(404);if(o){let a=o;if(a=await y0(a,K),J)a=H4(a,G);return new Response(a,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}}if(n.middleware){let d=x8(h.pathname,C0.params,n,h.search),o=y8(d,null,P),a=await g8(n.middleware,o);if(a.redirect){let z0=a.redirect.path,O0=a.redirect.options.redirectCode||302,w0=new Headers(a.responseHeaders);return w0.set("Location",z0),new Response(null,{status:O0,headers:w0})}if(a.abort){let{statusCode:z0,message:O0}=a.abort.error;return new Response(`<!DOCTYPE html><html><head><title>Error ${z0}</title></head><body><h1>Error ${z0}</h1><p>${O0}</p></body></html>`,{status:z0,headers:{"Content-Type":"text/html"}})}if(Object.keys(a.state).length>0){let z0=`<script>(function(){var s=typeof stx!=='undefined'?stx:{};s._ms=${JSON.stringify(a.state)};if(s.setMiddlewareState)s.setMiddlewareState(s._ms);})()</script>`;l.content=l.content.replace("</head>",`${z0}</head>`)}}let C=l.content;if(V&&aG(P)){let d=m8(C),o=C.match(/<title[^>]*>([\s\S]*?)<\/title>/i),a=o?o[1].trim():"";if(Object.keys(C0.params).length>0)C=b(C,C0.params);C=await y0(C,K);let z0=U?.router?.container||"main";return C=u8(C,z0),new Response(C,{headers:{"Content-Type":"text/html","X-STX-Fragment":"true","X-STX-Layout":d.layout,"X-STX-Layout-Group":d.group,...a&&{"X-STX-Title":encodeURIComponent(a)},"Cache-Control":"no-store, no-cache, must-revalidate"}})}if(V)C=d8(V,C);if(Object.keys(C0.params).length>0)C=b(C,C0.params);if(C=await y0(C,K),J)C=H4(C,G);if(Z.native)if(C.includes("<head>"))C=C.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 C="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+C;if(Z.titlebarHidden)if(C.includes("<head>"))C=C.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else C=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${C}`;if(l.boundaries&&l.boundaries.length>0){let{renderStreamingPage:d,streamToResponse:o}=await Promise.resolve().then(() => (Y6(),h6));return o(d(C,l.boundaries,{timeoutMs:30000}),{headers:{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}return new Response(C,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}if(H.length>0){let l=H.map((n)=>n.route),u=NX(h.pathname,l);if(u){let n=O.get(u.route.pattern);if(n){let C=n.content;if(V)C=d8(V,C);if(Object.keys(u.params).length>0)C=b(C,u.params);if(C=await y0(C,K),J)C=H4(C,G);return new Response(C,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}for(let{prefix:n}of j)if(n!=="/"&&h.pathname.startsWith(n)){let C=O.get(n)||O.get(n+"/");if(C){let d=C.content;if(V)d=d8(V,d);if(d=await y0(d,K),J)d=H4(d,G);return new Response(d,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}}let h1=R.get("/");if(h1){let l=h1.content;if(l=await y0(l,K),J)l=H4(l,G);if(Z.native)if(l.includes("<head>"))l=l.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 l="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+l;return new Response(l,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}let X0=await M(404);if(X0){let l=X0;if(l=await y0(l,K),J)l=H4(l,G);return new Response(l,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})},async error(P){let h=await M(500);if(h)return new Response(h,{status:500,headers:{"Content-Type":"text/html"}});return new Response(`<pre>${P}
|
|
18095
|
+
Press ${T.cyan}h${T.reset} + ${T.cyan}Enter${T.reset} to show shortcuts`),H6(_.url.toString(),()=>{if(X)M6.watch(Q,{recursive:!0}).close();_.stop()}),X){console.log(`${T.blue}Watching for changes...${T.reset}`);let j=M6.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(`${T.yellow}File ${T.bright}${O}${T.yellow} changed, rebuilding...${T.reset}`),J6.clear(),B4(),await W()});process.on("SIGINT",()=>{j.close(),_.stop(),process.exit(0)})}return!0}var Ow=D(()=>{s$();n0();g$();J4();eX();N0();F8()});var{serve:cf}=globalThis.Bun;import D1 from"fs";import E0 from"path";function HU($){let Z=Bun.file($),Y=E0.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 R3($=".",Z={}){let Y=Z.port||3000,X=Z.watch!==!1,J=Z.hotReload!==!1&&X,Q=null,G=Z.hmrPort||Y+1,K=E0.resolve($),{loadStxConfig:W}=await Promise.resolve().then(() => (V6(),X$)),U=await W(K),z=U.root&&U.root!=="."?E0.join(K,U.root):K,_=U.pagesDir||"pages",B=E0.join(z,_);if(!D1.existsSync(B))return console.error(`${T.red}Error: No '${_}' directory found in ${T.bright}${z}${T.reset}`),console.log(`${T.dim}Create a ${_}/ directory with .stx files to define your routes.${T.reset}`),console.log(`${T.dim}Example: ${_}/index.stx for the homepage.${T.reset}`),!1;let q=P4(z);if(q.length===0)return console.error(`${T.red}Error: No page files found in ${T.bright}${B}${T.reset}`),!1;console.log(`${T.blue}Found ${T.bright}${q.length}${T.blue} routes${T.reset}`);let j=U?._pluginPageDirs||[],H=[];for(let{dir:P,prefix:h}of j)if(D1.existsSync(P)){let m=P4(E0.dirname(P),{pagesDir:E0.basename(P)});for(let i of m){let s=h==="/"?i.pattern:`${h}${i.pattern==="/"?"":i.pattern}`;H.push({route:{...i,pattern:s},prefix:h})}if(m.length>0)console.log(`${T.blue}Plugin pages: ${T.bright}${m.length}${T.blue} routes at ${T.cyan}${h}${T.reset}`)}let O=new Map,V=null,L=null;if(Z.stxOptions?.shell!==!1){if(L=await rG(K,Z.stxOptions?.shell),L){if(V=await wX(L,Z.stxOptions||{}),V)console.log(`${T.blue}Using app shell: ${T.bright}${E0.relative(K,L)}${T.reset} ${T.dim}(deprecated: use layouts/default.stx instead)${T.reset}`)}}P8(),await f8(K);let F=v8();if(F.length>0)console.log(`${T.blue}Loaded ${T.bright}${F.length}${T.blue} middleware: ${T.dim}${F.join(", ")}${T.reset}`);let A={},w=null;try{let{loadStxConfig:P}=await Promise.resolve().then(() => (V6(),X$)),h=await P(K);if(h?.apiRouter)w=h?.apiRouter,console.log(`${T.blue}Using custom router for API handling${T.reset}`);if(h?.apiRoutes){A=h.apiRoutes;let m=Object.keys(A).length;if(m>0)console.log(`${T.blue}Loaded ${T.bright}${m} API route${m>1?"s":""}${T.reset}`)}if(h?.broadcasting?.enabled)try{let{startBroadcasting:m,loadChannels:i}=await Promise.resolve().then(() => (EX(),qK)),s=h.broadcasting;await m(s);let q0=s.port??6001;console.log(`${T.magenta}Broadcasting on ${T.cyan}ws://localhost:${q0}/ws${T.reset}`);let K0=E0.join(process.cwd(),"channels.ts");if(D1.existsSync(K0))try{let S0=await i(K0);console.log(`${T.blue}Loaded ${T.bright}${S0} broadcast channel${S0!==1?"s":""}${T.blue} from channels.ts${T.reset}`)}catch(S0){console.warn(`${T.yellow}Failed to load channels.ts: ${S0.message}${T.reset}`)}}catch(m){console.warn(`${T.yellow}Broadcasting failed to start: ${m.message}${T.reset}`)}}catch{}let N=l0(K,"output");D1.mkdirSync(N,{recursive:!0});let R=new Map,E=new Set,M=async(P)=>{let h=sG(B,P);if(!h)return null;try{let m=await Bun.build({entrypoints:[h],outdir:N,plugins:[p5],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...Z.stxOptions});if(!m.success)return null;let i=m.outputs.find((s)=>s.path.endsWith(".html"));if(!i)return null;return await Bun.file(i.path).text()}catch{return null}},I=async(P,h)=>{try{let{processDirectives:m,extractVariables:i,defaultConfig:s,loadStxConfig:q0,injectRouterScript:K0}=await Promise.resolve().then(() => (V6(),X$)),{checkCache:S0,cacheTemplate:z1,readFileCached:C0,templateCache:h1}=await Promise.resolve().then(() => (i6(),l$)),X0=await q0(K),l=(j0)=>{if(!j0)return j0;if(E0.isAbsolute(j0))return j0;return E0.resolve(K,j0)},u={...s,...X0,...Z.stxOptions,autoShell:!0};if(Z.debugDirectives)u.debug=!0;u.partialsDir=l(u.partialsDir),u.componentsDir=l(u.componentsDir),u.layoutsDir=l(u.layoutsDir),u.storesDir=l(u.storesDir||"stores"),u.cachePath=l(u.cachePath)??l0(K,"cache");let n=!h&&!Z.profile,C=u.cache!==!1;if(C&&n){let j0=h1.get(P.filePath);if(j0)try{if((await D1.promises.stat(P.filePath)).mtime.getTime()<=j0.mtime){let G0=!0;for(let I0 of j0.dependencies){if(!D1.existsSync(I0)){G0=!1;break}if((await D1.promises.stat(I0)).mtime.getTime()>j0.mtime){G0=!1;break}}if(G0){let I0=j0.output;if(V)I0=b4(I0,{preserveHead:!0});return{route:P,content:I0}}}}catch{}let m0=await S0(P.filePath,u);if(m0){let P0=m0;if(V)P0=b4(P0,{preserveHead:!0});return{route:P,content:P0}}}let d=C?await C0(P.filePath):await Bun.file(P.filePath).text(),{classifyAllScripts:o}=await Promise.resolve().then(() => (V6(),X$)),a=o(d),z0=a.server.map((j0)=>j0.content),O0=d;for(let j0 of a.server)O0=O0.replace(j0.fullTag,"");let w0={__filename:P.filePath,__dirname:E0.dirname(P.filePath),params:h??{},__stx_runtime_head:{}};for(let j0 of z0)try{await i(j0,w0,P.filePath)}catch(m0){if(Z.stxOptions?.debug)console.error("[stx] variable extraction error",P.filePath,m0?.message||m0)}let Q1=new Set,_1;if(Z.profile){let j0=performance.now();_1=await m(O0,w0,P.filePath,u,Q1);let m0=performance.now()-j0,P0=E0.relative(K,P.filePath)||P.filePath;console.log(`[stx:profile] ${P0} \u2192 ${m0.toFixed(2)}ms`)}else _1=await m(O0,w0,P.filePath,u,Q1);if(!V)_1=await K0(_1);{let{interpolateScriptExpressions:j0}=await Promise.resolve().then(() => ($1(),j7));_1=_1.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/g,(m0,P0,G0)=>{if(!/function\s+__stx_setup_/.test(G0))return m0;return`<script${P0}>${j0(G0,w0)}</script>`})}if(V)_1=b4(_1,{preserveHead:!0});if(C&&n)await z1(P.filePath,_1,Q1,u);let{extractStreamBoundaries:b0}=await Promise.resolve().then(() => (Y6(),u6)),B1=b0(w0),e0=w0.__streamTemplates;if(e0&&typeof e0==="object"&&Object.keys(e0).length>0){let j0=w0.streamBoundaries||{},m0={...u,autoShell:!1},P0=Object.keys(e0).map((I0)=>({id:I0,render:async()=>{let q$=typeof j0[I0]==="function"?await j0[I0]():void 0;return m(e0[I0],{...w0,$boundary:q$},P.filePath,m0,new Set)}})),G0=new Set(P0.map((I0)=>I0.id));B1=[...(B1||[]).filter((I0)=>!G0.has(I0.id)),...P0]}if(B1&&B1.length>0)E.add(P.pattern);else B1=void 0;return{route:P,content:_1,boundaries:B1}}catch(m){return console.error(`${T.red}Error building ${T.bright}${P.pattern}${T.reset}:`,m),null}},S=8,k=async()=>{R.clear(),O.clear();for(let P=0;P<q.length;P+=S){let h=q.slice(P,P+S),m=await Promise.all(h.map((i)=>I(i)));for(let i of m)if(i)R.set(i.route.pattern,i)}for(let P=0;P<H.length;P+=S){let h=H.slice(P,P+S),m=await Promise.all(h.map(({route:i})=>I(i)));for(let i of m)if(i)O.set(i.route.pattern,i)}return R.size>0};if(console.log(`${T.blue}Building pages...${T.reset}`),!await k())return console.error(`${T.red}No pages were successfully built${T.reset}`),!1;await M$(K);let y=Y;try{if(y=await j6(Y),y!==Y)console.log(`${T.yellow}Port ${Y} is busy, using port ${y} instead${T.reset}`)}catch{return console.error(`${T.red}Could not find an available port${T.reset}`),!1}if(J){let P=Z.hmrPort||y+1;Q=R8({wsPort:P,verbose:!1}),G=Q.start(P)}let b=(P,h)=>{let i=`<script data-stx-route-params>(function(){var p=${JSON.stringify(h).replace(/</g,"\\u003C").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")};window.__stx_rp=p;if(window.stx){window.stx._rp=p;if(window.stx.setRouteParams)window.stx.setRouteParams(p)}})()</script>`;if(P.includes("</head>"))return P.replace("</head>",`${i}</head>`);if(P.includes("<body"))return P.replace(/<body([^>]*)>/,`<body$1>${i}`);return i+P};console.log(`${T.blue}Starting server...${T.reset}`);let g=cf({port:y,async fetch(P){let h=new URL(P.url),m=U?.publicDir||"public",i=E0.join(K,m,h.pathname),s=E0.join(K,h.pathname),q0=E0.join(N,h.pathname),[K0,S0,z1]=await Promise.all([D1.promises.stat(i).catch(()=>null),D1.promises.stat(s).catch(()=>null),D1.promises.stat(q0).catch(()=>null)]);if(K0?.isFile())return HU(i);if(S0?.isFile())return HU(s);if(z1?.isFile())return HU(q0);if(h.pathname.startsWith("/_stx/component/")){let l=decodeURIComponent(h.pathname.slice(16));if(l)try{let u=`<${l} />`,n={...buildConfig,autoShell:!1},C=await processDirectives(u,{},E0.join(K,"components",`${l}.stx`),n,new Set);return new Response(C,{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(h.pathname==="/_stx/img"){let{handleImageRequest:l}=await Promise.resolve().then(() => (vG(),_L)),u=await l(P,{publicDir:E0.join(K,m),cacheDir:l0(K,"cache","img")});if(u)return u}if(w)try{let l=await w.handleRequest(P);if(l.status!==404)return l}catch{}if(A[h.pathname])try{return await A[h.pathname](P)}catch(l){return new Response(JSON.stringify({error:l.message}),{status:500,headers:{"Content-Type":"application/json"}})}let C0=NX(h.pathname,q);if(C0){let l=R.get(C0.route.pattern),u=E.has(C0.route.pattern);if(C0.route.isDynamic&&Object.keys(C0.params).length>0||u){let n=await I(C0.route,C0.params);if(n)l=n}if(l){let n=MZ();if(n.validate){if(!await n.validate({params:C0.params})){let o=await M(404);if(o){let a=o;if(a=await y0(a,K),J)a=H4(a,G);return new Response(a,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}}if(n.middleware){let d=x8(h.pathname,C0.params,n,h.search),o=y8(d,null,P),a=await g8(n.middleware,o);if(a.redirect){let z0=a.redirect.path,O0=a.redirect.options.redirectCode||302,w0=new Headers(a.responseHeaders);return w0.set("Location",z0),new Response(null,{status:O0,headers:w0})}if(a.abort){let{statusCode:z0,message:O0}=a.abort.error;return new Response(`<!DOCTYPE html><html><head><title>Error ${z0}</title></head><body><h1>Error ${z0}</h1><p>${O0}</p></body></html>`,{status:z0,headers:{"Content-Type":"text/html"}})}if(Object.keys(a.state).length>0){let z0=`<script>(function(){var s=typeof stx!=='undefined'?stx:{};s._ms=${JSON.stringify(a.state)};if(s.setMiddlewareState)s.setMiddlewareState(s._ms);})()</script>`;l.content=l.content.replace("</head>",`${z0}</head>`)}}let C=l.content;if(V&&aG(P)){let d=m8(C),o=C.match(/<title[^>]*>([\s\S]*?)<\/title>/i),a=o?o[1].trim():"";if(Object.keys(C0.params).length>0)C=b(C,C0.params);C=await y0(C,K);let z0=U?.router?.container||"main";return C=u8(C,z0),new Response(C,{headers:{"Content-Type":"text/html","X-STX-Fragment":"true","X-STX-Layout":d.layout,"X-STX-Layout-Group":d.group,...a&&{"X-STX-Title":encodeURIComponent(a)},"Cache-Control":"no-store, no-cache, must-revalidate"}})}if(V)C=d8(V,C);if(Object.keys(C0.params).length>0)C=b(C,C0.params);if(C=await y0(C,K),J)C=H4(C,G);if(Z.native)if(C.includes("<head>"))C=C.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 C="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+C;if(Z.titlebarHidden)if(C.includes("<head>"))C=C.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else C=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${C}`;if(l.boundaries&&l.boundaries.length>0){let{renderStreamingPage:d,streamToResponse:o}=await Promise.resolve().then(() => (Y6(),u6));return o(d(C,l.boundaries,{timeoutMs:30000}),{headers:{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}return new Response(C,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}if(H.length>0){let l=H.map((n)=>n.route),u=NX(h.pathname,l);if(u){let n=O.get(u.route.pattern);if(n){let C=n.content;if(V)C=d8(V,C);if(Object.keys(u.params).length>0)C=b(C,u.params);if(C=await y0(C,K),J)C=H4(C,G);return new Response(C,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}for(let{prefix:n}of j)if(n!=="/"&&h.pathname.startsWith(n)){let C=O.get(n)||O.get(n+"/");if(C){let d=C.content;if(V)d=d8(V,d);if(d=await y0(d,K),J)d=H4(d,G);return new Response(d,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}}let h1=R.get("/");if(h1){let l=h1.content;if(l=await y0(l,K),J)l=H4(l,G);if(Z.native)if(l.includes("<head>"))l=l.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 l="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+l;return new Response(l,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}let X0=await M(404);if(X0){let l=X0;if(l=await y0(l,K),J)l=H4(l,G);return new Response(l,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})},async error(P){let h=await M(500);if(h)return new Response(h,{status:500,headers:{"Content-Type":"text/html"}});return new Response(`<pre>${P}
|
|
18096
18096
|
${P.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});if(console.clear(),console.log(`
|
|
18097
18097
|
${T.blue}stx${T.reset} ${T.green}${process.env.stx_VERSION||"v0.0.10"}${T.reset} ${T.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${T.reset}`),console.log(`
|
|
18098
18098
|
${T.bright}\u2192 ${T.cyan}http://localhost:${y}/${T.reset}`),J)console.log(`${T.dim} HMR: ws://localhost:${G}${T.reset}`);console.log(`
|
|
18099
18099
|
${T.yellow}Routes:${T.reset}`);let c=[...oG(q,K)];for(let{route:P}of H)c.push(`${P.pattern}`);if(c.forEach((P,h)=>{let i=h===c.length-1?"\u2514\u2500 ":"\u251C\u2500 ";console.log(` ${T.green}${i}${T.reset}${P}`)}),console.log(`
|
|
18100
|
-
Press ${T.cyan}h${T.reset} + ${T.cyan}Enter${T.reset} to show shortcuts`),H6(g.url.toString(),()=>{if(Q)R5();g.stop()}),Z.native){let P,h=E0.join(B,"index.stx");if(D1.existsSync(h)){let i=await Bun.file(h).text();P=XX(i)}let m=U?.app?.window??{};await A5(y,{title:U?.app?.head?.title||E0.basename(K)||"stx App",width:m.width,height:m.height,darkMode:m.darkMode,hotReload:m.hotReload,titlebarHidden:m.titlebarHidden??Z.titlebarHidden===!0,nativeSidebar:!!P,sidebarConfig:P})}if(X){console.log(`${T.blue}Watching for changes...${T.reset}`);let P=(i)=>{return i.startsWith("public/")||i.startsWith("public\\")},h=(i)=>{let s=i.toLowerCase();return s.endsWith(".stx")||s.endsWith(".html")||s.endsWith(".md")},m=D1.watch(K,{recursive:!0},async(i,s)=>{if(!s||N8(s))return;if(w8(s))if(P(s)){if(console.log(`${T.cyan}${s} changed${T.reset}`),J&&Q)Q.reload(s)}else if(h(s)){console.log(`${T.yellow}${s} changed, rebuilding...${T.reset}`),J6.clear(),B4();try{let{invalidateFileCache:q0,templateCache:K0}=await Promise.resolve().then(() => (
|
|
18100
|
+
Press ${T.cyan}h${T.reset} + ${T.cyan}Enter${T.reset} to show shortcuts`),H6(g.url.toString(),()=>{if(Q)R5();g.stop()}),Z.native){let P,h=E0.join(B,"index.stx");if(D1.existsSync(h)){let i=await Bun.file(h).text();P=XX(i)}let m=U?.app?.window??{};await A5(y,{title:U?.app?.head?.title||E0.basename(K)||"stx App",width:m.width,height:m.height,darkMode:m.darkMode,hotReload:m.hotReload,titlebarHidden:m.titlebarHidden??Z.titlebarHidden===!0,nativeSidebar:!!P,sidebarConfig:P})}if(X){console.log(`${T.blue}Watching for changes...${T.reset}`);let P=(i)=>{return i.startsWith("public/")||i.startsWith("public\\")},h=(i)=>{let s=i.toLowerCase();return s.endsWith(".stx")||s.endsWith(".html")||s.endsWith(".md")},m=D1.watch(K,{recursive:!0},async(i,s)=>{if(!s||N8(s))return;if(w8(s))if(P(s)){if(console.log(`${T.cyan}${s} changed${T.reset}`),J&&Q)Q.reload(s)}else if(h(s)){console.log(`${T.yellow}${s} changed, rebuilding...${T.reset}`),J6.clear(),B4();try{let{invalidateFileCache:q0,templateCache:K0}=await Promise.resolve().then(() => (i6(),l$));q0(E0.resolve(K,s)),K0.delete(E0.resolve(K,s))}catch{}if(L&&s){if(E0.resolve(K,s)===L||E0.basename(L)===s){let K0=await wX(L,Z.stxOptions||{});if(K0)V=K0}}if(await k(),await F7(K),J&&Q)Q.reload(s)}else{console.log(`${T.yellow}${s} changed, rebuilding...${T.reset}`),J6.clear(),B4();try{let{invalidateFileCache:q0,templateCache:K0}=await Promise.resolve().then(() => (i6(),l$));q0(E0.resolve(K,s)),K0.delete(E0.resolve(K,s))}catch{}if(await k(),J&&Q)Q.reload(s)}else if(A8(s)){if(console.log(`${T.cyan}CSS ${s} changed${T.reset}`),J&&Q)Q.updateCss(s)}});process.on("SIGINT",()=>{if(m.close(),Q)R5();g.stop(),process.exit(0)})}return!0}var Lw=D(()=>{b5();g$();J4();eX();l8();FX();h6();N0();F8()});var jU=D(()=>{DG();Hw();Ow();Lw()});var ww={};$0(ww,{runPwaAudit:()=>pf,formatAuditResult:()=>nf,calculateAuditResult:()=>Aw,auditConfig:()=>Vw,auditBuildOutput:()=>Fw});import _$ from"fs";import $J from"path";function Vw($){let Z=[],Y=$.pwa;if(Z.push({id:"pwa-enabled",name:"PWA Enabled",category:"required",passed:Y?.enabled===!0,message:Y?.enabled?"PWA is enabled":"PWA is not enabled in config"}),!Y?.enabled)return Z;Z.push({id:"manifest-name",name:"App Name",category:"required",passed:Boolean(Y.manifest?.name),message:Y.manifest?.name?`App name: "${Y.manifest.name}"`:"Missing required manifest name"}),Z.push({id:"manifest-short-name",name:"Short Name",category:"recommended",passed:Boolean(Y.manifest?.shortName),message:Y.manifest?.shortName?`Short name: "${Y.manifest.shortName}"`:"Short name not set (will use full name)"}),Z.push({id:"manifest-description",name:"App Description",category:"recommended",passed:Boolean(Y.manifest?.description),message:Y.manifest?.description?"Description is set":"App description not provided"}),Z.push({id:"manifest-theme-color",name:"Theme Color",category:"required",passed:Boolean(Y.manifest?.themeColor),message:Y.manifest?.themeColor?`Theme color: ${Y.manifest.themeColor}`:"Theme color not set"}),Z.push({id:"manifest-background-color",name:"Background Color",category:"required",passed:Boolean(Y.manifest?.backgroundColor),message:Y.manifest?.backgroundColor?`Background color: ${Y.manifest.backgroundColor}`:"Background color not set"}),Z.push({id:"manifest-display",name:"Display Mode",category:"required",passed:["standalone","fullscreen","minimal-ui"].includes(Y.manifest?.display||""),message:Y.manifest?.display?`Display mode: ${Y.manifest.display}`:"Display mode should be standalone, fullscreen, or minimal-ui"}),Z.push({id:"manifest-start-url",name:"Start URL",category:"required",passed:Boolean(Y.manifest?.startUrl),message:Y.manifest?.startUrl?`Start URL: ${Y.manifest.startUrl}`:"Start URL not set"}),Z.push({id:"icons-source",name:"Icon Source",category:"required",passed:Boolean(Y.icons?.src),message:Y.icons?.src?`Icon source: ${Y.icons.src}`:"No icon source configured"});let X=Y.icons?.sizes||[];Z.push({id:"icons-192",name:"192x192 Icon",category:"required",passed:X.includes(192),message:X.includes(192)?"192x192 icon will be generated":"Missing 192x192 icon (required for Android)"}),Z.push({id:"icons-512",name:"512x512 Icon",category:"required",passed:X.includes(512),message:X.includes(512)?"512x512 icon will be generated":"Missing 512x512 icon (required for splash screen)"}),Z.push({id:"icons-maskable",name:"Maskable Icon",category:"recommended",passed:Y.icons?.purpose?.includes("maskable")||!1,message:Y.icons?.purpose?.includes("maskable")?"Maskable icon purpose is set":"Consider adding maskable icon purpose for adaptive icons"}),Z.push({id:"sw-configured",name:"Service Worker",category:"required",passed:Boolean(Y.serviceWorker),message:Y.serviceWorker?"Service worker is configured":"Service worker configuration missing"}),Z.push({id:"sw-cache-version",name:"Cache Version",category:"recommended",passed:Boolean(Y.serviceWorker?.cacheVersion),message:Y.serviceWorker?.cacheVersion?`Cache version: ${Y.serviceWorker.cacheVersion}`:"Set cache version for proper cache busting"}),Z.push({id:"offline-enabled",name:"Offline Support",category:"required",passed:Y.offline?.enabled===!0,message:Y.offline?.enabled?"Offline support is enabled":"Offline support is disabled"});let J=Y.routes||[];return Z.push({id:"caching-strategies",name:"Caching Strategies",category:"recommended",passed:J.length>0,message:J.length>0?`${J.length} route caching strategies configured`:"No custom caching strategies defined"}),Z.push({id:"push-config",name:"Push Notifications",category:"optional",passed:!Y.push?.enabled||Boolean(Y.push?.vapidPublicKey),message:Y.push?.enabled?Y.push?.vapidPublicKey?"Push notifications configured with VAPID key":"Push enabled but missing VAPID key":"Push notifications not enabled"}),Z.push({id:"share-target",name:"Share Target",category:"optional",passed:!0,message:Y.shareTarget?.enabled?`Share target enabled at ${Y.shareTarget.action}`:"Share target not enabled"}),Z.push({id:"auto-inject",name:"Auto-injection",category:"recommended",passed:Y.autoInject!==!1,message:Y.autoInject!==!1?"PWA tags will be auto-injected":"Auto-injection disabled - manual tag insertion required"}),Z}function Fw($){let Z=[],Y=$J.join($,"manifest.json"),X=_$.existsSync(Y);if(Z.push({id:"build-manifest",name:"Manifest File",category:"required",passed:X,message:X?"manifest.json exists":"manifest.json not found in build output"}),X)try{let z=JSON.parse(_$.readFileSync(Y,"utf-8"));Z.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!0,message:"Manifest is valid JSON"}),Z.push({id:"build-manifest-icons",name:"Manifest Icons",category:"required",passed:Array.isArray(z.icons)&&z.icons.length>0,message:z.icons?.length?`${z.icons.length} icons defined in manifest`:"No icons defined in manifest"})}catch{Z.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!1,message:"Manifest is not valid JSON"})}let J=$J.join($,"sw.js"),Q=_$.existsSync(J);Z.push({id:"build-sw",name:"Service Worker File",category:"required",passed:Q,message:Q?"Service worker (sw.js) exists":"Service worker not found in build output"});let G=$J.join($,"offline.html"),K=_$.existsSync(G);Z.push({id:"build-offline",name:"Offline Page",category:"recommended",passed:K,message:K?"Offline page exists":"No offline.html found"});let W=$J.join($,"pwa-icons");if(_$.existsSync(W)){let z=_$.readdirSync(W).filter((_)=>_.endsWith(".png")||_.endsWith(".webp"));Z.push({id:"build-icons",name:"Generated Icons",category:"required",passed:z.length>0,message:z.length>0?`${z.length} icon files generated`:"No icon files found"})}else Z.push({id:"build-icons",name:"Generated Icons",category:"required",passed:!1,message:"Icons directory not found"});return Z}function Aw($){let Z=$.filter((W)=>W.category==="required"),Y=$.filter((W)=>W.category==="recommended"),X=Z.filter((W)=>W.passed).length,J=Y.filter((W)=>W.passed).length,Q=Z.length>0?X/Z.length*70:70,G=Y.length>0?J/Y.length*30:30;return{score:Math.round(Q+G),passed:$.filter((W)=>W.passed).length,failed:$.filter((W)=>!W.passed&&W.category==="required").length,warnings:$.filter((W)=>!W.passed&&W.category!=="required").length,checks:$}}function pf($,Z){let Y=Vw($),X=Z&&_$.existsSync(Z)?Fw(Z):[];return Aw([...Y,...X])}function nf($){let Z=[];Z.push(`
|
|
18101
18101
|
=== PWA Audit Report ===
|
|
18102
18102
|
`);let Y=$.score>=90?"32":$.score>=70?"33":"31";Z.push(`Score: \x1B[${Y}m${$.score}/100\x1B[0m`),Z.push(`Passed: ${$.passed} | Failed: ${$.failed} | Warnings: ${$.warnings}
|
|
18103
18103
|
`);let X=["required","recommended","optional"];for(let J of X){let Q=$.checks.filter((G)=>G.category===J);if(Q.length===0)continue;Z.push(`
|
|
@@ -18599,7 +18599,7 @@ ${J.toUpperCase()}:`);for(let G of Q){let K=G.passed?"\x1B[32m\u2713\x1B[0m":"\x
|
|
|
18599
18599
|
render();
|
|
18600
18600
|
</script>
|
|
18601
18601
|
</body>
|
|
18602
|
-
</html>`}function _g($){let Z={name:"root",size:$.totalSize,gzipSize:$.totalGzipSize,children:[]};for(let Y of $.chunks){let X={name:Y.name,size:Y.size,gzipSize:Y.gzipSize,children:[]};for(let J of Y.modules)Bg(X,J);Z.children.push(X)}return Z}function Bg($,Z){let Y=Z.path.split("/"),X=$;for(let Q=0;Q<Y.length-1;Q++){let G=Y[Q],K=X.children?.find((W)=>W.name===G);if(!K){if(K={name:G,size:0,gzipSize:0,children:[]},!X.children)X.children=[];X.children.push(K)}X=K}let J=Y[Y.length-1];if(!X.children)X.children=[];X.children.push({name:J,path:Z.path,size:Z.size,gzipSize:Z.gzipSize,type:Z.type}),qg($,Z.size,Z.gzipSize)}function qg($,Z,Y){}function Tw($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function JJ($){let Z=process.platform,Y=Z==="darwin"?"open":Z==="win32"?"start":"xdg-open";Bun.spawn([Y,$],{stdio:["ignore","ignore","ignore"]})}var zg;var LU=D(()=>{D3();zg={default:{js:"#f7df1e",css:"#264de4",html:"#e34c26",image:"#4caf50",font:"#9c27b0",other:"#607d8b",vendor:"#ff5722"},pastel:{js:"#fff3b0",css:"#b0d4ff",html:"#ffb0b0",image:"#b0ffb0",font:"#e0b0ff",other:"#d0d0d0",vendor:"#ffcfb0"},monochrome:{js:"#333333",css:"#555555",html:"#777777",image:"#999999",font:"#bbbbbb",other:"#dddddd",vendor:"#444444"}}});var Iw={}
|
|
18602
|
+
</html>`}function _g($){let Z={name:"root",size:$.totalSize,gzipSize:$.totalGzipSize,children:[]};for(let Y of $.chunks){let X={name:Y.name,size:Y.size,gzipSize:Y.gzipSize,children:[]};for(let J of Y.modules)Bg(X,J);Z.children.push(X)}return Z}function Bg($,Z){let Y=Z.path.split("/"),X=$;for(let Q=0;Q<Y.length-1;Q++){let G=Y[Q],K=X.children?.find((W)=>W.name===G);if(!K){if(K={name:G,size:0,gzipSize:0,children:[]},!X.children)X.children=[];X.children.push(K)}X=K}let J=Y[Y.length-1];if(!X.children)X.children=[];X.children.push({name:J,path:Z.path,size:Z.size,gzipSize:Z.gzipSize,type:Z.type}),qg($,Z.size,Z.gzipSize)}function qg($,Z,Y){}function Tw($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function JJ($){let Z=process.platform,Y=Z==="darwin"?"open":Z==="win32"?"start":"xdg-open";Bun.spawn([Y,$],{stdio:["ignore","ignore","ignore"]})}var zg;var LU=D(()=>{D3();zg={default:{js:"#f7df1e",css:"#264de4",html:"#e34c26",image:"#4caf50",font:"#9c27b0",other:"#607d8b",vendor:"#ff5722"},pastel:{js:"#fff3b0",css:"#b0d4ff",html:"#ffb0b0",image:"#b0ffb0",font:"#e0b0ff",other:"#d0d0d0",vendor:"#ffcfb0"},monochrome:{js:"#333333",css:"#555555",html:"#777777",image:"#999999",font:"#bbbbbb",other:"#dddddd",vendor:"#444444"}}});var Iw={};$0(Iw,{percentage:()=>I3,parseSize:()=>ZJ,openInBrowser:()=>JJ,getModuleRecommendation:()=>Mw,getBundleSummary:()=>Hg,generateTreemap:()=>XJ,generateReport:()=>YJ,formatBytes:()=>W0,collectBundleStats:()=>E3,analyzeBundle:()=>k3,analyze:()=>jg});import Ew from"fs";import VU from"path";async function jg($={}){let{directory:Z="dist",output:Y,format:X="html",open:J=!0,gzip:Q=!0,threshold:G,recommendations:K=!0,topModules:W=20,parseImports:U=!0}=$,_=await E3(Z,{parseImports:U,detectDuplicates:!0,topModulesCount:W}),B=G?typeof G==="string"?ZJ(G):G:void 0,q=B?_.totalSize>B:!1,j,H;if(X==="html"){let O={title:`Bundle Analysis - ${VU.basename(VU.resolve(Z))}`,gzip:Q};if(j=XJ(_,O),H=Y||VU.join(Z,"bundle-report.html"),await Ew.promises.writeFile(H,j),J)JJ(H)}else if(j=YJ(_,{format:X,threshold:B,recommendations:K,topModules:W,showGzip:Q}),Y)H=Y,await Ew.promises.writeFile(H,j);return{stats:_,report:j,outputPath:H,exceedsThreshold:q}}async function Hg($){let Z=await E3($,{parseImports:!1,detectDuplicates:!1,topModulesCount:0});return{totalSize:Z.totalSize,totalSizeFormatted:W0(Z.totalSize),gzipSize:Z.totalGzipSize,gzipSizeFormatted:W0(Z.totalGzipSize),moduleCount:Z.moduleCount,chunkCount:Z.chunks.length}}var Dw=D(()=>{D3();OU();LU();D3();OU();LU()});function Og($={}){let{debug:Z=!1,timeout:Y=30000}=$;return`
|
|
18603
18603
|
<script>
|
|
18604
18604
|
(function() {
|
|
18605
18605
|
'use strict';
|
|
@@ -20985,14 +20985,16 @@ ${Y}`);return Y+$}var Sw=()=>{};function bw($,Z={}){let{classPrefix:Y="craft"}=Z
|
|
|
20985
20985
|
</details>`}},divider:{nativeType:"craft-divider",fallbackTag:"hr",fallbackClasses:"craft-divider",nativeProps:["orientation","variant"]},table:{nativeType:"craft-table",fallbackTag:"table",fallbackClasses:"craft-table",nativeProps:["columns","rows","sortable","selectable"]},list:{nativeType:"craft-list",fallbackTag:"ul",fallbackClasses:"craft-list",nativeProps:["items","selectable"]},tree:{nativeType:"craft-tree",fallbackTag:"div",fallbackClasses:"craft-tree",nativeProps:["nodes","expandable","selectable"]},alert:{nativeType:"craft-alert",fallbackTag:"div",fallbackClasses:"craft-alert",nativeProps:["variant","title","dismissible"],render:($,Z)=>{let Y=$.variant||"info",X=$.title||"";return`<div class="craft-alert craft-alert-${Y}" role="alert">
|
|
20986
20986
|
${X?`<div class="craft-alert-title">${X}</div>`:""}
|
|
20987
20987
|
<div class="craft-alert-content">${Z}</div>
|
|
20988
|
-
</div>`}},toast:{nativeType:"craft-toast",fallbackTag:"div",fallbackClasses:"craft-toast",nativeProps:["variant","duration","position"]},tooltip:{nativeType:"craft-tooltip",fallbackTag:"span",fallbackClasses:"craft-tooltip",nativeProps:["content","position"],render:($,Z)=>{let Y=$.content||"",X=$.position||"top";return`<span class="craft-tooltip" data-tooltip="${Y}" data-position="${X}">${Z}</span>`}},menu:{nativeType:"craft-menu",fallbackTag:"nav",fallbackClasses:"craft-menu",nativeProps:["items","orientation"]},breadcrumb:{nativeType:"craft-breadcrumb",fallbackTag:"nav",fallbackClasses:"craft-breadcrumb",nativeProps:["items","separator"]},sidebar:{nativeType:"craft-sidebar",fallbackTag:"aside",fallbackClasses:"craft-sidebar craft-sidebar-tahoe",nativeProps:["id","variant","material","backgroundEffect","allowsVibrancy","materialOpacity","materialDarkOpacity","minWidth","maxWidth","canCollapse","searchPlaceholder","selectedItem","sections","spaces","selectedSpace"],render:Vg},"sidebar-space":{nativeType:"craft-sidebar-space",fallbackTag:"section",fallbackClasses:"craft-sidebar-space",nativeProps:["id","label","icon","tint"],render:Fg},"sidebar-section":{nativeType:"craft-sidebar-section",fallbackTag:"section",fallbackClasses:"craft-sidebar-section",nativeProps:["id","title","header"],render:Ag},"sidebar-item":{nativeType:"craft-sidebar-item",fallbackTag:"button",fallbackClasses:"craft-sidebar-item",nativeProps:["id","label","icon","badge","tintColor"],render:wg},pagination:{nativeType:"craft-pagination",fallbackTag:"nav",fallbackClasses:"craft-pagination",nativeProps:["total","page","pageSize"]},"code-editor":{nativeType:"craft-code-editor",fallbackTag:"textarea",fallbackClasses:"craft-code-editor",nativeProps:["value","language","theme","readonly","lineNumbers"]},"file-browser":{nativeType:"craft-file-browser",fallbackTag:"div",fallbackClasses:"craft-file-browser",nativeProps:["path","showHidden","selectable"]},"color-picker":{nativeType:"craft-color-picker",fallbackTag:"input",fallbackClasses:"craft-color-picker",nativeProps:["value","format"],render:($,Z)=>{return`<input type="color" class="craft-color-picker" value="${$.value||"#000000"}">`}},"date-picker":{nativeType:"craft-date-picker",fallbackTag:"input",fallbackClasses:"craft-date-picker",nativeProps:["value","min","max","format"],render:($,Z)=>{let Y=$.value||"",X=$.min||"",J=$.max||"";return`<input type="date" class="craft-date-picker" value="${Y}" min="${X}" max="${J}">`}},"time-picker":{nativeType:"craft-time-picker",fallbackTag:"input",fallbackClasses:"craft-time-picker",nativeProps:["value","min","max","step"],render:($,Z)=>{return`<input type="time" class="craft-time-picker" value="${$.value||""}">`}}}});var lw={}
|
|
20989
|
-
</head>`)}let G=$.name||Sg($.input,".stx"),K=$.version||"1.0.0",W=$.craftPath||await
|
|
20988
|
+
</div>`}},toast:{nativeType:"craft-toast",fallbackTag:"div",fallbackClasses:"craft-toast",nativeProps:["variant","duration","position"]},tooltip:{nativeType:"craft-tooltip",fallbackTag:"span",fallbackClasses:"craft-tooltip",nativeProps:["content","position"],render:($,Z)=>{let Y=$.content||"",X=$.position||"top";return`<span class="craft-tooltip" data-tooltip="${Y}" data-position="${X}">${Z}</span>`}},menu:{nativeType:"craft-menu",fallbackTag:"nav",fallbackClasses:"craft-menu",nativeProps:["items","orientation"]},breadcrumb:{nativeType:"craft-breadcrumb",fallbackTag:"nav",fallbackClasses:"craft-breadcrumb",nativeProps:["items","separator"]},sidebar:{nativeType:"craft-sidebar",fallbackTag:"aside",fallbackClasses:"craft-sidebar craft-sidebar-tahoe",nativeProps:["id","variant","material","backgroundEffect","allowsVibrancy","materialOpacity","materialDarkOpacity","minWidth","maxWidth","canCollapse","searchPlaceholder","selectedItem","sections","spaces","selectedSpace"],render:Vg},"sidebar-space":{nativeType:"craft-sidebar-space",fallbackTag:"section",fallbackClasses:"craft-sidebar-space",nativeProps:["id","label","icon","tint"],render:Fg},"sidebar-section":{nativeType:"craft-sidebar-section",fallbackTag:"section",fallbackClasses:"craft-sidebar-section",nativeProps:["id","title","header"],render:Ag},"sidebar-item":{nativeType:"craft-sidebar-item",fallbackTag:"button",fallbackClasses:"craft-sidebar-item",nativeProps:["id","label","icon","badge","tintColor"],render:wg},pagination:{nativeType:"craft-pagination",fallbackTag:"nav",fallbackClasses:"craft-pagination",nativeProps:["total","page","pageSize"]},"code-editor":{nativeType:"craft-code-editor",fallbackTag:"textarea",fallbackClasses:"craft-code-editor",nativeProps:["value","language","theme","readonly","lineNumbers"]},"file-browser":{nativeType:"craft-file-browser",fallbackTag:"div",fallbackClasses:"craft-file-browser",nativeProps:["path","showHidden","selectable"]},"color-picker":{nativeType:"craft-color-picker",fallbackTag:"input",fallbackClasses:"craft-color-picker",nativeProps:["value","format"],render:($,Z)=>{return`<input type="color" class="craft-color-picker" value="${$.value||"#000000"}">`}},"date-picker":{nativeType:"craft-date-picker",fallbackTag:"input",fallbackClasses:"craft-date-picker",nativeProps:["value","min","max","format"],render:($,Z)=>{let Y=$.value||"",X=$.min||"",J=$.max||"";return`<input type="date" class="craft-date-picker" value="${Y}" min="${X}" max="${J}">`}},"time-picker":{nativeType:"craft-time-picker",fallbackTag:"input",fallbackClasses:"craft-time-picker",nativeProps:["value","min","max","step"],render:($,Z)=>{return`<input type="time" class="craft-time-picker" value="${$.value||""}">`}}}});var lw={};$0(lw,{getAvailableTargets:()=>uw,getAvailableFormats:()=>mw,default:()=>ng,buildNative:()=>dw});import{existsSync as gw,mkdirSync as m1,copyFileSync as T6,chmodSync as E6}from"fs";import{join as e,basename as Sg}from"path";import{spawn as KJ,execSync as Cg}from"child_process";import{tmpdir as hw,homedir as FU,platform as bg}from"os";async function dw($){let Z=Date.now();try{if(!await Bun.file($.input).exists())return{success:!1,target:$.target||S3(),format:$.format||"app",error:`Input file not found: ${$.input}`};let Y=$.target||S3(),X=$.format||ug(Y),J=$.output||e(process.cwd(),"dist","native");if(!gw(J))m1(J,{recursive:!0});let Q=await ZU($.input,{context:$.context,options:{isDev:!1}});if(Q=kw(Q,{debug:$.verbose}),Q=bw(Q),!Q.includes("craft-component-styles")){if(Q.includes("</head>"))Q=Q.replace("</head>",`${Cw}
|
|
20989
|
+
</head>`)}let G=$.name||Sg($.input,".stx"),K=$.version||"1.0.0",W=$.craftPath||await dg();if(!W)return{success:!1,target:Y,format:X,error:"Craft binary not found. Please install Craft or specify craftPath."};if($.verbose)console.log(`\uD83D\uDCE6 Building native app for ${Y}...`),console.log(` Input: ${$.input}`),console.log(` Output: ${J}`),console.log(` Craft: ${W}`);let U;switch(Y){case"macos":U=await Pg(Q,G,K,J,X,$,W);break;case"windows":U=await vg(Q,G,K,J,X,$,W);break;case"linux":U=await fg(Q,G,K,J,X,$,W);break;case"ios":U=await gg(Q,G,K,J,$,W);break;case"android":U=await hg(Q,G,K,J,$,W);break;default:U={success:!1,target:Y,format:X,error:`Unsupported target: ${Y}`}}return U.duration=Date.now()-Z,U}catch(Y){return{success:!1,target:$.target||S3(),format:$.format||"app",error:Y.message,duration:Date.now()-Z}}}async function Pg($,Z,Y,X,J,Q,G){let K=Q.bundleId||`com.stx.${Z.toLowerCase().replace(/[^a-z0-9]/g,"")}`,W=e(X,`${Z}.app`),U=e(W,"Contents"),z=e(U,"MacOS"),_=e(U,"Resources");m1(z,{recursive:!0}),m1(_,{recursive:!0});let B=e(_,"index.html");await Bun.write(B,$);let q="";if(Q.sidebar?.enabled&&Q.sidebar?.config)q=e(_,"sidebar-config.json"),await Bun.write(q,JSON.stringify(Q.sidebar.config));let j=Q.sidebar?.enabled?`--native-sidebar --sidebar-width ${Q.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",H=Q.menubarOnly??Q.systemTray;if((Q.bundleStyle||(await yg(G)?"executable":"launcher"))==="executable"){let F=e(z,Z);T6(G,F),E6(F,493);let A={html:"index.html",title:Q.window?.title||Z,width:Q.window?.width||1200,height:Q.window?.height||800,devTools:Boolean(Q.devTools)};if(H)A.menubarOnly=!0;else if(Q.systemTray)A.systemTray=!0;if(Q.window?.frameless)A.frameless=!0;if(Q.window?.transparent)A.transparent=!0;if(Q.window?.alwaysOnTop)A.alwaysOnTop=!0;if(Q.window?.resizable===!1)A.resizable=!1;await Bun.write(e(_,"craft.json"),`${JSON.stringify(A,null,2)}
|
|
20990
|
+
`)}else{let F=e(z,"craft");T6(G,F),E6(F,493);let A=Q.sidebar?.enabled?`--native-sidebar --sidebar-width ${Q.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",N=`#!/bin/bash
|
|
20990
20991
|
set -euo pipefail
|
|
20991
20992
|
DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
|
|
20992
20993
|
RESOURCES="$DIR/../Resources"
|
|
20993
20994
|
exec "$DIR/craft" --html-file "$RESOURCES/index.html" \\
|
|
20994
|
-
${[`--title "${Q.window?.title||Z}"`,`--width ${Q.window?.width||1200}`,`--height ${Q.window?.height||800}`,
|
|
20995
|
-
`,
|
|
20995
|
+
${[`--title "${Q.window?.title||Z}"`,`--width ${Q.window?.width||1200}`,`--height ${Q.window?.height||800}`,H?"--menubar-only":Q.systemTray?"--system-tray":"",Q.devTools?"":"--no-devtools",Q.window?.frameless?"--frameless":"",Q.window?.transparent?"--transparent":"",Q.window?.alwaysOnTop?"--always-on-top":"",Q.window?.resizable===!1?"--no-resize":"",A].filter(Boolean).join(" \\\n ")}
|
|
20996
|
+
`,R=e(z,Z);await Bun.write(R,N),E6(R,493)}let V=Boolean(Q.icon&&await Bun.file(Q.icon).exists());if(V)T6(Q.icon,e(_,"AppIcon.icns"));let L={CFBundleExecutable:Z,CFBundleIdentifier:K,CFBundleName:Z,CFBundleDisplayName:Z,CFBundleShortVersionString:Y,CFBundleVersion:Y,CFBundlePackageType:"APPL",CFBundleSignature:"????",LSMinimumSystemVersion:Q.minimumSystemVersion||"13.0",NSHighResolutionCapable:!0,NSSupportsAutomaticGraphicsSwitching:!0,LSUIElement:Q.menubarOnly??Boolean(Q.systemTray),...V?{CFBundleIconFile:"AppIcon"}:{},...Q.category?{LSApplicationCategoryType:Q.category}:{},...Q.copyright?{NSHumanReadableCopyright:Q.copyright}:{},...Q.infoPlist||{}};if(await Bun.write(e(U,"Info.plist"),xg(L)),J==="dmg"){let F=e(X,`${Z}-${Y}.dmg`),A=await mg(W,F,Z);if(!A.success)return{success:!1,target:"macos",format:"dmg",error:A.error};return{success:!0,target:"macos",format:"dmg",outputPath:F}}return{success:!0,target:"macos",format:"app",outputPath:W}}async function yg($){try{let Z=Bun.spawn([$,"--version"],{stdout:"pipe",stderr:"pipe"}),[Y,X]=await Promise.all([new Response(Z.stdout).text(),new Response(Z.stderr).text()]);await Z.exited;let Q=`${Y}
|
|
20997
|
+
${X}`.match(/(\d+)\.(\d+)\.(\d+)/);if(!Q)return!1;let[G,K,W]=Q.slice(1).map(Number);if(G>0||K>0)return!0;return W>=57}catch{return!1}}function fw($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function xg($){return`<?xml version="1.0" encoding="UTF-8"?>
|
|
20996
20998
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
20997
20999
|
<plist version="1.0">
|
|
20998
21000
|
<dict>
|
|
@@ -21001,7 +21003,7 @@ ${Object.entries($).map(([Y,X])=>{let J=typeof X==="boolean"?`<${X}/>`:typeof X=
|
|
|
21001
21003
|
`)}
|
|
21002
21004
|
</dict>
|
|
21003
21005
|
</plist>
|
|
21004
|
-
`}async function
|
|
21006
|
+
`}async function vg($,Z,Y,X,J,Q,G){let K=e(X,Z);m1(K,{recursive:!0});let W=e(K,"index.html");await Bun.write(W,$),T6(G,e(K,"craft.exe"));let U=`@echo off
|
|
21005
21007
|
set DIR=%~dp0
|
|
21006
21008
|
"%DIR%craft.exe" --html-file "%DIR%index.html" ^
|
|
21007
21009
|
--title "${Q.window?.title||Z}" ^
|
|
@@ -21009,7 +21011,7 @@ set DIR=%~dp0
|
|
|
21009
21011
|
--height ${Q.window?.height||800} ^
|
|
21010
21012
|
${Q.systemTray?"--system-tray":""} ^
|
|
21011
21013
|
${Q.devTools?"":"--no-devtools"}
|
|
21012
|
-
`;if(await Bun.write(
|
|
21014
|
+
`;if(await Bun.write(e(K,`${Z}.bat`),U),J==="zip"){let z=e(X,`${Z}-${Y}-windows.zip`),_=await lg(K,z);if(!_.success)return{success:!1,target:"windows",format:"zip",error:_.error};return{success:!0,target:"windows",format:"zip",outputPath:z}}return{success:!0,target:"windows",format:"app",outputPath:K}}async function fg($,Z,Y,X,J,Q,G){let K=e(X,Z);m1(K,{recursive:!0});let W=e(K,"index.html");await Bun.write(W,$);let U=e(K,"craft");T6(G,U),E6(U,493);let z=`#!/bin/bash
|
|
21013
21015
|
set -euo pipefail
|
|
21014
21016
|
DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
|
|
21015
21017
|
exec "$DIR/craft" --html-file "$DIR/index.html" \\
|
|
@@ -21018,15 +21020,15 @@ exec "$DIR/craft" --html-file "$DIR/index.html" \\
|
|
|
21018
21020
|
--height ${Q.window?.height||800} \\
|
|
21019
21021
|
${Q.systemTray?"--system-tray":""} \\
|
|
21020
21022
|
${Q.devTools?"":"--no-devtools"}
|
|
21021
|
-
`,_
|
|
21023
|
+
`,_=e(K,Z.toLowerCase());await Bun.write(_,z),E6(_,493);let B=`[Desktop Entry]
|
|
21022
21024
|
Type=Application
|
|
21023
21025
|
Name=${Z}
|
|
21024
21026
|
Exec=${_}
|
|
21025
21027
|
Terminal=false
|
|
21026
21028
|
Categories=Utility;
|
|
21027
|
-
`;if(await Bun.write(
|
|
21028
|
-
`)[0];if(Y&&await Bun.file(Y).exists())return Y}catch{}return null}function S3(){switch(bg()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function
|
|
21029
|
-
exec /usr/share/${Y.toLowerCase()}/${Y.toLowerCase()} "$@"`;Z0("fs").writeFileSync(
|
|
21029
|
+
`;if(await Bun.write(e(K,`${Z.toLowerCase()}.desktop`),B),J==="deb"){let q=e(X,`${Z.toLowerCase()}_${Y}_amd64.deb`),j=await cg(K,q,Z,Y,Q);if(!j.success)return{success:!1,target:"linux",format:"deb",error:j.error};return{success:!0,target:"linux",format:"deb",outputPath:q}}if(J==="appimage"){let q=e(X,`${Z}-${Y}-x86_64.AppImage`),j=await pg(K,q,Z,Q);if(!j.success)return{success:!1,target:"linux",format:"appimage",error:j.error};return{success:!0,target:"linux",format:"appimage",outputPath:q}}return{success:!0,target:"linux",format:"app",outputPath:K}}async function gg($,Z,Y,X,J,Q){return{success:!1,target:"ios",format:"ipa",error:`iOS build requires Xcode and additional setup. Use 'stx init:ios ${Z}' to create an iOS project.`}}async function hg($,Z,Y,X,J,Q){return{success:!1,target:"android",format:"apk",error:`Android build requires Android SDK and additional setup. Use 'stx init:android ${Z}' to create an Android project.`}}async function dg(){if(process.env.CRAFT_BIN&&await Bun.file(process.env.CRAFT_BIN).exists())return process.env.CRAFT_BIN;let $=[e(process.cwd(),"../../craft/packages/zig/zig-out/bin/craft"),e(process.cwd(),"../craft/packages/zig/zig-out/bin/craft"),e(FU(),"Code/Tools/craft/packages/zig/zig-out/bin/craft"),e(FU(),"Code/craft/packages/zig/zig-out/bin/craft"),"/usr/local/bin/craft","/usr/bin/craft",e(FU(),".local/bin/craft"),e(process.env.LOCALAPPDATA||"","craft","craft.exe"),e(process.env.PROGRAMFILES||"","craft","craft.exe")];for(let Z of $)if(await Bun.file(Z).exists())return Z;try{let Y=Cg("which craft 2>/dev/null || where craft 2>nul",{encoding:"utf-8"}).trim().split(`
|
|
21030
|
+
`)[0];if(Y&&await Bun.file(Y).exists())return Y}catch{}return null}function S3(){switch(bg()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function ug($){switch($){case"macos":return"app";case"windows":return"zip";case"linux":return"appimage";case"ios":return"ipa";case"android":return"apk";default:return"app"}}async function mg($,Z,Y){return new Promise((X)=>{let J=KJ("hdiutil",["create","-volname",Y,"-srcfolder",$,"-ov","-format","UDZO",Z]);J.on("close",(Q)=>{if(Q===0)X({success:!0});else X({success:!1,error:`hdiutil exited with code ${Q}`})}),J.on("error",(Q)=>{X({success:!1,error:Q.message})})})}async function lg($,Z){return new Promise((Y)=>{let X=KJ("zip",["-r",Z,"."],{cwd:$});X.on("close",(J)=>{if(J===0)Y({success:!0});else Y({success:!1,error:`zip exited with code ${J}`})}),X.on("error",(J)=>{Y({success:!1,error:J.message})})})}async function cg($,Z,Y,X,J){return new Promise((Q)=>{try{let G=e(hw(),`stx-deb-${Date.now()}`),K=e(G,"DEBIAN"),W=e(G,"usr","bin"),U=e(G,"usr","share","applications"),z=e(G,"usr","share",Y.toLowerCase());m1(K,{recursive:!0}),m1(W,{recursive:!0}),m1(U,{recursive:!0}),m1(z,{recursive:!0});let _=Z0("fs").readdirSync($);for(let H of _)T6(e($,H),e(z,H));let B=`#!/bin/bash
|
|
21031
|
+
exec /usr/share/${Y.toLowerCase()}/${Y.toLowerCase()} "$@"`;Z0("fs").writeFileSync(e(W,Y.toLowerCase()),B),E6(e(W,Y.toLowerCase()),493);let q=`Package: ${Y.toLowerCase()}
|
|
21030
21032
|
Version: ${X}
|
|
21031
21033
|
Section: utils
|
|
21032
21034
|
Priority: optional
|
|
@@ -21034,19 +21036,19 @@ Architecture: amd64
|
|
|
21034
21036
|
Depends: libgtk-3-0, libwebkit2gtk-4.0-37
|
|
21035
21037
|
Maintainer: ${J.author||"Unknown"}
|
|
21036
21038
|
Description: ${J.description||Y}
|
|
21037
|
-
`;Z0("fs").writeFileSync(
|
|
21039
|
+
`;Z0("fs").writeFileSync(e(K,"control"),q);let j=KJ("dpkg-deb",["--build",G,Z]);j.on("close",(H)=>{if(Z0("fs").rmSync(G,{recursive:!0,force:!0}),H===0)Q({success:!0});else Q({success:!1,error:`dpkg-deb exited with code ${H}`})}),j.on("error",(H)=>{Z0("fs").rmSync(G,{recursive:!0,force:!0}),Q({success:!1,error:H.message})})}catch(G){Q({success:!1,error:G.message})}})}async function pg($,Z,Y,X){return new Promise((J)=>{try{let Q=e(hw(),`stx-appimage-${Date.now()}`),G=e(Q,`${Y}.AppDir`),K=e(G,"usr"),W=e(K,"bin"),U=e(K,"share");m1(W,{recursive:!0}),m1(U,{recursive:!0});let z=e(U,Y.toLowerCase());m1(z,{recursive:!0});let _=Z0("fs").readdirSync($);for(let O of _)T6(e($,O),e(z,O));let B=`#!/bin/bash
|
|
21038
21040
|
SELF=$(readlink -f "$0")
|
|
21039
21041
|
HERE=\${SELF%/*}
|
|
21040
21042
|
export PATH="\${HERE}/usr/bin:\${PATH}"
|
|
21041
21043
|
exec "\${HERE}/usr/share/${Y.toLowerCase()}/${Y.toLowerCase()}" "$@"
|
|
21042
|
-
`;Z0("fs").writeFileSync(
|
|
21044
|
+
`;Z0("fs").writeFileSync(e(G,"AppRun"),B),E6(e(G,"AppRun"),493);let q=`[Desktop Entry]
|
|
21043
21045
|
Type=Application
|
|
21044
21046
|
Name=${Y}
|
|
21045
21047
|
Exec=${Y.toLowerCase()}
|
|
21046
21048
|
Terminal=false
|
|
21047
21049
|
Categories=Utility;
|
|
21048
21050
|
Icon=${Y.toLowerCase()}
|
|
21049
|
-
`;Z0("fs").writeFileSync($0(G,`${Y.toLowerCase()}.desktop`),q);let j=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);if(Z0("fs").writeFileSync($0(G,`${Y.toLowerCase()}.png`),j),X.icon&&gw(X.icon))z$(X.icon,$0(G,`${Y.toLowerCase()}.png`));let H=KJ("appimagetool",[G,Z],{env:{...process.env,ARCH:"x86_64"}});H.on("close",(O)=>{if(Z0("fs").rmSync(Q,{recursive:!0,force:!0}),O===0)_$(Z,493),J({success:!0});else J({success:!1,error:`appimagetool exited with code ${O}. Install from https://appimage.github.io/appimagetool/`})}),H.on("error",(O)=>{Z0("fs").rmSync(Q,{recursive:!0,force:!0}),J({success:!1,error:`appimagetool not found: ${O.message}`})})}catch(Q){J({success:!1,error:Q.message})}})}function uw(){return[S3()]}function mw($){switch($){case"macos":return["app","dmg","pkg"];case"windows":return["app","zip","msi"];case"linux":return["app","deb","rpm","appimage"];case"ios":return["ipa"];case"android":return["apk"];default:return["app"]}}var pg,ig;var cw=D(()=>{Sw();vw();YU();pg={buildNative:dw,getAvailableTargets:uw,getAvailableFormats:mw,detectPlatform:S3},ig=pg});function C3($,Z){return`${ng[Z]}${$}\x1B[0m`}function iw($,Z){return`${rg[Z]}${$}\x1B[0m`}function b3(){console.log(""),console.log(J1(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),console.log(J1(" \u2551")+Y4(" \uD83D\uDCD6 STX Story ")+J1("\u2551")),console.log(J1(" \u2551")+UJ(" Component Showcase & Testing ")+J1("\u2551")),console.log(J1(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),console.log("")}function wU($,Z){if(console.log(Y4(" Server running at:")),console.log(""),console.log(` ${UJ("\u279C")} ${Y4("Local:")} ${J1($)}`),Z)console.log(` ${UJ("\u279C")} ${Y4("Network:")} ${J1(Z)}`);console.log("")}function P3($){let Z=$>0?"\u2713":"\u25CB",Y=$>0?WJ:AU;console.log(` ${Y(Z)} Found ${Y4(String($))} story ${$===1?"file":"files"}`)}function nw($,Z){if(console.log(""),console.log(` ${pw("\u2717")} ${Y4(pw("Error:"))} ${$}`),Z)console.log(` ${UJ(Z)}`);console.log("")}function r5($){console.log(` ${AU("\u26A0")} ${AU("Warning:")} ${$}`)}function rw($){console.log(` ${ag("\u2139")} ${$}`)}function aw($,Z,Y){console.log(""),console.log(J1(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),console.log(J1(" \u2551")+Y4(" Build Complete ")+J1("\u2551")),console.log(J1(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),console.log(""),console.log(` ${WJ("\u2713")} Stories: ${Y4(String($))}`),console.log(` ${WJ("\u2713")} Output: ${Y4(Z)}`),console.log(` ${WJ("\u2713")} Time: ${Y4(`${Y}ms`)}`),console.log("")}function NU(){console.log(""),console.log(Y4(" Keyboard Shortcuts:")),console.log(""),console.log(` ${J1("h")} Show this help`),console.log(` ${J1("o")} Open in browser`),console.log(` ${J1("r")} Restart server`),console.log(` ${J1("c")} Clear console`),console.log(` ${J1("q")} Quit`),console.log("")}var ng,rg,pw=($)=>C3($,"red"),WJ=($)=>C3($,"green"),AU=($)=>C3($,"yellow"),ag=($)=>C3($,"blue"),J1=($)=>C3($,"cyan"),Y4=($)=>iw($,"bold"),UJ=($)=>iw($,"dim");var zJ=D(()=>{ng={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",brightRed:"\x1B[91m",brightGreen:"\x1B[92m",brightYellow:"\x1B[93m",brightBlue:"\x1B[94m",brightMagenta:"\x1B[95m",brightCyan:"\x1B[96m",brightWhite:"\x1B[97m"},rg={bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",inverse:"\x1B[7m",strikethrough:"\x1B[9m"}});import sw from"fs";import RU from"path";function ow($,Z){let Y=[RU.join($.root,"stx.config.ts"),RU.join($.root,"stx.config.js"),RU.join($.root,"stx.config.mjs")],X=Z.debounceMs??300,J=null,Q=[];for(let G of Y)try{if(!sw.existsSync(G))continue;let K=sw.watch(G,(W)=>{if(W==="change"){if(J)clearTimeout(J);J=setTimeout(async()=>{rw("Config file changed, restarting...");try{await Z.onChange()}catch(U){r5(`Failed to restart: ${U}`)}},X)}});Q.push(K)}catch{}return{stop(){if(J)clearTimeout(J);for(let G of Q)G.close()}}}var tw=D(()=>{zJ()});function YN($){let Z={...sg,...$};return{enabled:Z.enabled??!0,outDir:Z.outDir??".stx/dist/story",storyMatch:Z.storyMatch??["**/*.story.stx"],storyIgnored:Z.storyIgnored??["**/node_modules/**","**/dist/**","**/.stx/**"],tree:{...ZN,...Z.tree},theme:{title:"STX Components",defaultColorScheme:"auto",darkClass:"dark",...Z.theme},responsivePresets:Z.responsivePresets??ew,backgroundPresets:Z.backgroundPresets??$N,autoApplyContrastColor:Z.autoApplyContrastColor??!1,setupFile:Z.setupFile,port:Z.port??6006}}var ew,$N,ZN,sg;var XN=D(()=>{ew=[{label:"Mobile (Small)",width:320,height:568},{label:"Mobile (Medium)",width:375,height:667},{label:"Mobile (Large)",width:414,height:896},{label:"Tablet",width:768,height:1024},{label:"Laptop",width:1024},{label:"Desktop",width:1280},{label:"Desktop (Large)",width:1920}],$N=[{label:"Transparent",color:"transparent",contrastColor:"#333"},{label:"White",color:"#ffffff",contrastColor:"#333"},{label:"Light Gray",color:"#f5f5f5",contrastColor:"#333"},{label:"Dark Gray",color:"#333333",contrastColor:"#fff"},{label:"Black",color:"#000000",contrastColor:"#fff"}],ZN={file:"title",order:"asc",groups:[]},sg={enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],tree:ZN,theme:{title:"STX Components",defaultColorScheme:"auto",darkClass:"dark"},responsivePresets:ew,backgroundPresets:$N,autoApplyContrastColor:!1,port:6006}});var JN={};e(JN,{updateContextTree:()=>o5,updateContextStoryFiles:()=>s5,createContext:()=>a5});import og from"path";async function a5($){let Z=$.root??process.cwd(),Y;try{let G=await import(og.join(Z,"stx.config.ts"));Y=(G.default||G).story}catch{}let X={...Y,...$.config},J=YN(X);return{root:Z,config:J,storyFiles:[],tree:void 0,mode:$.mode}}function s5($,Z){$.storyFiles=Z}function o5($,Z){$.tree=Z}var y3=D(()=>{XN()});import MU from"fs";import QN from"path";class TU{storage;storagePath;currentSession=null;dirty=!1;viewStartTimes=new Map;constructor($){this.storagePath=QN.join($,tg),this.storage=this.loadStorage(),this.startSession()}loadStorage(){try{let $=MU.readFileSync(this.storagePath,"utf-8");return JSON.parse($)}catch{return{version:eg,events:[],sessions:[]}}}async save(){if(!this.dirty)return;let $=QN.dirname(this.storagePath);if(await MU.promises.mkdir($,{recursive:!0}),this.storage.events.length>GN)this.storage.events=this.storage.events.slice(-GN);await MU.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}startSession(){this.endSession(),this.currentSession={id:$h(),startTime:Date.now(),componentViews:[]},this.storage.sessions.push(this.currentSession),this.dirty=!0}endSession(){if(this.currentSession)this.currentSession.endTime=Date.now(),this.currentSession=null}track($){this.storage.events.push({...$,timestamp:Date.now()}),this.dirty=!0}trackView($,Z){if(this.endViewTiming($),this.viewStartTimes.set($,Date.now()),this.track({type:"view",componentId:$,variantId:Z}),this.currentSession&&!this.currentSession.componentViews.includes($))this.currentSession.componentViews.push($)}endViewTiming($){let Z=this.viewStartTimes.get($);if(Z){let Y=Date.now()-Z;this.track({type:"view",componentId:$,metadata:{duration:Y,endView:!0}}),this.viewStartTimes.delete($)}}trackPropChange($,Z,Y){this.track({type:"prop_change",componentId:$,propName:Z,metadata:{value:Y}})}trackVariantSwitch($,Z){this.track({type:"variant_switch",componentId:$,variantId:Z})}trackSearch($,Z){this.track({type:"search",query:$,metadata:{resultCount:Z}})}getComponentAnalytics($,Z){let Y=this.storage.events.filter((B)=>B.componentId===$),X=Y.filter((B)=>B.type==="view"&&!B.metadata?.endView),J=Y.filter((B)=>B.type==="prop_change"),Q=Y.filter((B)=>B.type==="variant_switch"),G={};for(let B of J)if(B.propName)G[B.propName]=(G[B.propName]||0)+1;let K={};for(let B of Q)if(B.variantId)K[B.variantId]=(K[B.variantId]||0)+1;let W=new Set(this.storage.sessions.filter((B)=>B.componentViews.includes($)).map((B)=>B.id)),U=Y.filter((B)=>B.metadata?.duration).map((B)=>B.metadata.duration),z=U.length>0?U.reduce((B,q)=>B+q,0)/U.length:0,_=Object.entries(G).sort((B,q)=>q[1]-B[1]).slice(0,5).map(([B])=>B);return{componentId:$,componentName:Z,viewCount:X.length,uniqueViews:W.size,lastViewed:X[X.length-1]?.timestamp,propChanges:G,topChangedProps:_,variantViews:K,avgTimeSpent:z}}getMostViewedComponents($=10){let Z=new Map;for(let Y of this.storage.events)if(Y.type==="view"&&Y.componentId&&!Y.metadata?.endView)Z.set(Y.componentId,(Z.get(Y.componentId)||0)+1);return Array.from(Z.entries()).map(([Y,X])=>({componentId:Y,viewCount:X})).sort((Y,X)=>X.viewCount-Y.viewCount).slice(0,$)}getMostChangedProps($=10){let Z=new Map;for(let Y of this.storage.events)if(Y.type==="prop_change"&&Y.propName)Z.set(Y.propName,(Z.get(Y.propName)||0)+1);return Array.from(Z.entries()).map(([Y,X])=>({propName:Y,changeCount:X})).sort((Y,X)=>X.changeCount-Y.changeCount).slice(0,$)}getSearchAnalytics(){let $=this.storage.events.filter((J)=>J.type==="search"),Z=new Map,Y=0;for(let J of $){if(J.query)Z.set(J.query,(Z.get(J.query)||0)+1);if(J.metadata?.resultCount!==void 0)Y+=J.metadata.resultCount}let X=Array.from(Z.entries()).map(([J,Q])=>({query:J,count:Q})).sort((J,Q)=>Q.count-J.count).slice(0,10);return{totalSearches:$.length,topQueries:X,avgResultCount:$.length>0?Y/$.length:0}}clear(){this.storage.events=[],this.storage.sessions=[],this.dirty=!0,this.startSession()}exportAnalytics(){return JSON.stringify({exportedAt:Date.now(),...this.storage},null,2)}}function $h(){return`session-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}var tg=".stx/story/analytics.json",eg=1,GN=1e4;var KN=()=>{};import EU from"fs";import WN from"path";class IU{storage;storagePath;dirty=!1;constructor($){this.storagePath=WN.join($,Zh),this.storage=this.loadStorage()}loadStorage(){try{let $=EU.readFileSync(this.storagePath,"utf-8");return JSON.parse($)}catch{return{version:Yh,bookmarks:[]}}}async save(){if(!this.dirty)return;let $=WN.dirname(this.storagePath);await EU.promises.mkdir($,{recursive:!0}),await EU.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}addBookmark($,Z,Y,X={}){let J={id:Xh(),name:X.name||`${$}/${Z}`,storyId:$,variantId:Z,props:Y,created:Date.now(),notes:X.notes,color:X.color};return this.storage.bookmarks.push(J),this.dirty=!0,J}getAllBookmarks(){return[...this.storage.bookmarks]}getBookmarksForStory($){return this.storage.bookmarks.filter((Z)=>Z.storyId===$)}getBookmark($){return this.storage.bookmarks.find((Z)=>Z.id===$)}isBookmarked($,Z){return this.storage.bookmarks.some((Y)=>Y.storyId===$&&Y.variantId===Z)}updateBookmark($,Z){let Y=this.getBookmark($);if(!Y)return;return Object.assign(Y,Z),this.dirty=!0,Y}deleteBookmark($){let Z=this.storage.bookmarks.findIndex((Y)=>Y.id===$);if(Z===-1)return!1;return this.storage.bookmarks.splice(Z,1),this.dirty=!0,!0}toggleBookmark($,Z,Y){let X=this.storage.bookmarks.find((Q)=>Q.storyId===$&&Q.variantId===Z);if(X)return this.deleteBookmark(X.id),{added:!1};return{added:!0,bookmark:this.addBookmark($,Z,Y)}}exportBookmarks(){return JSON.stringify(this.storage,null,2)}importBookmarks($,Z=!0){let Y=JSON.parse($),X=0;for(let J of Y.bookmarks){if(Z){let Q=this.storage.bookmarks.find((G)=>G.id===J.id);if(Q)Object.assign(Q,J);else this.storage.bookmarks.push(J)}else this.storage.bookmarks.push(J);X++}if(X>0)this.dirty=!0;return X}}function Xh(){return`bm-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}var Zh=".stx/story/bookmarks.json",Yh=1;var UN=()=>{};import DU from"fs";import x3 from"path";async function v3($){let{root:Z,config:Y}=$,X=[],J=await Jh(Z,Y.storyMatch,Y.storyIgnored);for(let Q of J){let G=x3.resolve(Z,Q),K=kU(Q,G);X.push(K)}return X}async function Jh($,Z,Y){let X=[];async function J(Q,G){let K=await DU.promises.readdir(Q,{withFileTypes:!0});for(let W of K){let U=x3.join(Q,W.name),z=x3.relative(G,U);if(zN(z,Y))continue;if(W.isDirectory())await J(U,G);else if(W.isFile()){if(_N(z,Z))X.push(z)}}}return await J($,$),X}function zN($,Z){for(let Y of Z)if(BN($,Y))return!0;return!1}function _N($,Z){for(let Y of Z)if(BN($,Y))return!0;return!1}function BN($,Z){let Y=$.replace(/\\/g,"/"),J=Z.replace(/\\/g,"/").replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"{{GLOBSTAR}}").replace(/\*/g,"[^/]*").replace(/\?/g,".").replace(/\{\{GLOBSTAR\}\}/g,".*");return J=`^${J}$`,new RegExp(J).test(Y)}function kU($,Z){let Y=x3.basename($,".story.stx");return{id:$.toLowerCase().replace(/\.story\.stx$/,"").replace(/[/\\]/g,"-").replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""),path:Z,relativePath:$,fileName:Y,treeFile:{title:Y,path:$}}}function qN($,Z){let{root:Y,config:X}=$,J=[],Q=DU.watch(Y,{recursive:!0},async(G,K)=>{if(!K)return;let W=K.replace(/\\/g,"/");if(!_N(W,X.storyMatch))return;if(zN(W,X.storyIgnored))return;let U=x3.resolve(Y,W);try{await DU.promises.access(U);let z=kU(W,U);Z(G==="rename"?"add":"change",z)}catch{let z=kU(W,U);Z("unlink",z)}});return J.push(Q),()=>{for(let G of J)G.close()}}var SU=()=>{};function Qh($,Z){let Y=Z.treeFile||{title:Z.fileName,path:Z.relativePath};if($.tree.file==="title")return Y.title.split("/");if($.tree.file==="path")return[...Z.relativePath.split("/").slice(0,-1),Y.title];if(typeof $.tree.file==="function")return $.tree.file(Y);return[Y.title]}function f3($,Z){for(let G of Z)G.treePath=Qh($,G);let Y=($.tree.groups||[]).map((G)=>({groupConfig:{id:G.id||G.title,title:G.title,include:G.include},treeObject:{}})),X={treeObject:{}};Y.push(X);for(let G=0;G<Z.length;G++){let K=Z[G],W=Gh(K,Y,X);Kh(K.treePath,G,W.treeObject)}let J=$.tree.order==="asc"?(G,K)=>G.localeCompare(K):$.tree.order,Q=[];for(let G of Y)if(G===X)Q.push(...CU(G.treeObject,J));else if(G.groupConfig&&Object.keys(G.treeObject).length>0)Q.push({group:!0,id:G.groupConfig.id,title:G.groupConfig.title,children:CU(G.treeObject,J)});return Q}function Gh($,Z,Y){let X=$.treeFile||{title:$.fileName,path:$.relativePath};for(let J of Z)if(J.groupConfig?.include&&J.groupConfig.include(X))return J;return Y}function Kh($,Z,Y){let X=Y;for(let J=0;J<$.length;J++){let Q=$[J];if(J===$.length-1)if(X[Q]!==void 0){let K=1;while(X[`${Q}-${K}`]!==void 0)K++;X[`${Q}-${K}`]=Z}else X[Q]=Z;else{if(X[Q]===void 0)X[Q]={};else if(typeof X[Q]==="number"){let K=X[Q];X[Q]={"":K}}X=X[Q]}}}function CU($,Z){let Y=[];for(let[X,J]of Object.entries($))if(typeof J==="number")Y.push({title:X,index:J});else Y.push({title:X,children:CU(J,Z)});return Y.sort((X,J)=>Z(X.title,J.title)),Y}function jN(){return{open($){_J.add($),$.send(JSON.stringify({type:"connected",timestamp:Date.now()}))},close($){_J.delete($)},message($,Z){}}}function bU($){let Z=JSON.stringify({...$,timestamp:$.timestamp||Date.now()});for(let Y of _J)try{Y.send(Z)}catch{_J.delete(Y)}}function HN($,Z){bU({type:"story-update",data:{storyId:$,...Z}})}function ON($,Z){bU({type:"story-add",data:{storyId:$,...Z}})}function LN($){bU({type:"story-remove",data:{storyId:$}})}function VN($){return`
|
|
21051
|
+
`;Z0("fs").writeFileSync(e(G,`${Y.toLowerCase()}.desktop`),q);let j=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);if(Z0("fs").writeFileSync(e(G,`${Y.toLowerCase()}.png`),j),X.icon&&gw(X.icon))T6(X.icon,e(G,`${Y.toLowerCase()}.png`));let H=KJ("appimagetool",[G,Z],{env:{...process.env,ARCH:"x86_64"}});H.on("close",(O)=>{if(Z0("fs").rmSync(Q,{recursive:!0,force:!0}),O===0)E6(Z,493),J({success:!0});else J({success:!1,error:`appimagetool exited with code ${O}. Install from https://appimage.github.io/appimagetool/`})}),H.on("error",(O)=>{Z0("fs").rmSync(Q,{recursive:!0,force:!0}),J({success:!1,error:`appimagetool not found: ${O.message}`})})}catch(Q){J({success:!1,error:Q.message})}})}function uw(){return[S3()]}function mw($){switch($){case"macos":return["app","dmg","pkg"];case"windows":return["app","zip","msi"];case"linux":return["app","deb","rpm","appimage"];case"ios":return["ipa"];case"android":return["apk"];default:return["app"]}}var ig,ng;var cw=D(()=>{Sw();vw();YU();ig={buildNative:dw,getAvailableTargets:uw,getAvailableFormats:mw,detectPlatform:S3},ng=ig});function C3($,Z){return`${rg[Z]}${$}\x1B[0m`}function iw($,Z){return`${ag[Z]}${$}\x1B[0m`}function b3(){console.log(""),console.log(J1(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),console.log(J1(" \u2551")+Y4(" \uD83D\uDCD6 STX Story ")+J1("\u2551")),console.log(J1(" \u2551")+UJ(" Component Showcase & Testing ")+J1("\u2551")),console.log(J1(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),console.log("")}function wU($,Z){if(console.log(Y4(" Server running at:")),console.log(""),console.log(` ${UJ("\u279C")} ${Y4("Local:")} ${J1($)}`),Z)console.log(` ${UJ("\u279C")} ${Y4("Network:")} ${J1(Z)}`);console.log("")}function P3($){let Z=$>0?"\u2713":"\u25CB",Y=$>0?WJ:AU;console.log(` ${Y(Z)} Found ${Y4(String($))} story ${$===1?"file":"files"}`)}function nw($,Z){if(console.log(""),console.log(` ${pw("\u2717")} ${Y4(pw("Error:"))} ${$}`),Z)console.log(` ${UJ(Z)}`);console.log("")}function r5($){console.log(` ${AU("\u26A0")} ${AU("Warning:")} ${$}`)}function rw($){console.log(` ${sg("\u2139")} ${$}`)}function aw($,Z,Y){console.log(""),console.log(J1(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),console.log(J1(" \u2551")+Y4(" Build Complete ")+J1("\u2551")),console.log(J1(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),console.log(""),console.log(` ${WJ("\u2713")} Stories: ${Y4(String($))}`),console.log(` ${WJ("\u2713")} Output: ${Y4(Z)}`),console.log(` ${WJ("\u2713")} Time: ${Y4(`${Y}ms`)}`),console.log("")}function NU(){console.log(""),console.log(Y4(" Keyboard Shortcuts:")),console.log(""),console.log(` ${J1("h")} Show this help`),console.log(` ${J1("o")} Open in browser`),console.log(` ${J1("r")} Restart server`),console.log(` ${J1("c")} Clear console`),console.log(` ${J1("q")} Quit`),console.log("")}var rg,ag,pw=($)=>C3($,"red"),WJ=($)=>C3($,"green"),AU=($)=>C3($,"yellow"),sg=($)=>C3($,"blue"),J1=($)=>C3($,"cyan"),Y4=($)=>iw($,"bold"),UJ=($)=>iw($,"dim");var zJ=D(()=>{rg={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",brightRed:"\x1B[91m",brightGreen:"\x1B[92m",brightYellow:"\x1B[93m",brightBlue:"\x1B[94m",brightMagenta:"\x1B[95m",brightCyan:"\x1B[96m",brightWhite:"\x1B[97m"},ag={bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",inverse:"\x1B[7m",strikethrough:"\x1B[9m"}});import sw from"fs";import RU from"path";function ow($,Z){let Y=[RU.join($.root,"stx.config.ts"),RU.join($.root,"stx.config.js"),RU.join($.root,"stx.config.mjs")],X=Z.debounceMs??300,J=null,Q=[];for(let G of Y)try{if(!sw.existsSync(G))continue;let K=sw.watch(G,(W)=>{if(W==="change"){if(J)clearTimeout(J);J=setTimeout(async()=>{rw("Config file changed, restarting...");try{await Z.onChange()}catch(U){r5(`Failed to restart: ${U}`)}},X)}});Q.push(K)}catch{}return{stop(){if(J)clearTimeout(J);for(let G of Q)G.close()}}}var tw=D(()=>{zJ()});function YN($){let Z={...og,...$};return{enabled:Z.enabled??!0,outDir:Z.outDir??".stx/dist/story",storyMatch:Z.storyMatch??["**/*.story.stx"],storyIgnored:Z.storyIgnored??["**/node_modules/**","**/dist/**","**/.stx/**"],tree:{...ZN,...Z.tree},theme:{title:"STX Components",defaultColorScheme:"auto",darkClass:"dark",...Z.theme},responsivePresets:Z.responsivePresets??ew,backgroundPresets:Z.backgroundPresets??$N,autoApplyContrastColor:Z.autoApplyContrastColor??!1,setupFile:Z.setupFile,port:Z.port??6006}}var ew,$N,ZN,og;var XN=D(()=>{ew=[{label:"Mobile (Small)",width:320,height:568},{label:"Mobile (Medium)",width:375,height:667},{label:"Mobile (Large)",width:414,height:896},{label:"Tablet",width:768,height:1024},{label:"Laptop",width:1024},{label:"Desktop",width:1280},{label:"Desktop (Large)",width:1920}],$N=[{label:"Transparent",color:"transparent",contrastColor:"#333"},{label:"White",color:"#ffffff",contrastColor:"#333"},{label:"Light Gray",color:"#f5f5f5",contrastColor:"#333"},{label:"Dark Gray",color:"#333333",contrastColor:"#fff"},{label:"Black",color:"#000000",contrastColor:"#fff"}],ZN={file:"title",order:"asc",groups:[]},og={enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],tree:ZN,theme:{title:"STX Components",defaultColorScheme:"auto",darkClass:"dark"},responsivePresets:ew,backgroundPresets:$N,autoApplyContrastColor:!1,port:6006}});var JN={};$0(JN,{updateContextTree:()=>o5,updateContextStoryFiles:()=>s5,createContext:()=>a5});import tg from"path";async function a5($){let Z=$.root??process.cwd(),Y;try{let G=await import(tg.join(Z,"stx.config.ts"));Y=(G.default||G).story}catch{}let X={...Y,...$.config},J=YN(X);return{root:Z,config:J,storyFiles:[],tree:void 0,mode:$.mode}}function s5($,Z){$.storyFiles=Z}function o5($,Z){$.tree=Z}var y3=D(()=>{XN()});import MU from"fs";import QN from"path";class TU{storage;storagePath;currentSession=null;dirty=!1;viewStartTimes=new Map;constructor($){this.storagePath=QN.join($,eg),this.storage=this.loadStorage(),this.startSession()}loadStorage(){try{let $=MU.readFileSync(this.storagePath,"utf-8");return JSON.parse($)}catch{return{version:$h,events:[],sessions:[]}}}async save(){if(!this.dirty)return;let $=QN.dirname(this.storagePath);if(await MU.promises.mkdir($,{recursive:!0}),this.storage.events.length>GN)this.storage.events=this.storage.events.slice(-GN);await MU.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}startSession(){this.endSession(),this.currentSession={id:Zh(),startTime:Date.now(),componentViews:[]},this.storage.sessions.push(this.currentSession),this.dirty=!0}endSession(){if(this.currentSession)this.currentSession.endTime=Date.now(),this.currentSession=null}track($){this.storage.events.push({...$,timestamp:Date.now()}),this.dirty=!0}trackView($,Z){if(this.endViewTiming($),this.viewStartTimes.set($,Date.now()),this.track({type:"view",componentId:$,variantId:Z}),this.currentSession&&!this.currentSession.componentViews.includes($))this.currentSession.componentViews.push($)}endViewTiming($){let Z=this.viewStartTimes.get($);if(Z){let Y=Date.now()-Z;this.track({type:"view",componentId:$,metadata:{duration:Y,endView:!0}}),this.viewStartTimes.delete($)}}trackPropChange($,Z,Y){this.track({type:"prop_change",componentId:$,propName:Z,metadata:{value:Y}})}trackVariantSwitch($,Z){this.track({type:"variant_switch",componentId:$,variantId:Z})}trackSearch($,Z){this.track({type:"search",query:$,metadata:{resultCount:Z}})}getComponentAnalytics($,Z){let Y=this.storage.events.filter((B)=>B.componentId===$),X=Y.filter((B)=>B.type==="view"&&!B.metadata?.endView),J=Y.filter((B)=>B.type==="prop_change"),Q=Y.filter((B)=>B.type==="variant_switch"),G={};for(let B of J)if(B.propName)G[B.propName]=(G[B.propName]||0)+1;let K={};for(let B of Q)if(B.variantId)K[B.variantId]=(K[B.variantId]||0)+1;let W=new Set(this.storage.sessions.filter((B)=>B.componentViews.includes($)).map((B)=>B.id)),U=Y.filter((B)=>B.metadata?.duration).map((B)=>B.metadata.duration),z=U.length>0?U.reduce((B,q)=>B+q,0)/U.length:0,_=Object.entries(G).sort((B,q)=>q[1]-B[1]).slice(0,5).map(([B])=>B);return{componentId:$,componentName:Z,viewCount:X.length,uniqueViews:W.size,lastViewed:X[X.length-1]?.timestamp,propChanges:G,topChangedProps:_,variantViews:K,avgTimeSpent:z}}getMostViewedComponents($=10){let Z=new Map;for(let Y of this.storage.events)if(Y.type==="view"&&Y.componentId&&!Y.metadata?.endView)Z.set(Y.componentId,(Z.get(Y.componentId)||0)+1);return Array.from(Z.entries()).map(([Y,X])=>({componentId:Y,viewCount:X})).sort((Y,X)=>X.viewCount-Y.viewCount).slice(0,$)}getMostChangedProps($=10){let Z=new Map;for(let Y of this.storage.events)if(Y.type==="prop_change"&&Y.propName)Z.set(Y.propName,(Z.get(Y.propName)||0)+1);return Array.from(Z.entries()).map(([Y,X])=>({propName:Y,changeCount:X})).sort((Y,X)=>X.changeCount-Y.changeCount).slice(0,$)}getSearchAnalytics(){let $=this.storage.events.filter((J)=>J.type==="search"),Z=new Map,Y=0;for(let J of $){if(J.query)Z.set(J.query,(Z.get(J.query)||0)+1);if(J.metadata?.resultCount!==void 0)Y+=J.metadata.resultCount}let X=Array.from(Z.entries()).map(([J,Q])=>({query:J,count:Q})).sort((J,Q)=>Q.count-J.count).slice(0,10);return{totalSearches:$.length,topQueries:X,avgResultCount:$.length>0?Y/$.length:0}}clear(){this.storage.events=[],this.storage.sessions=[],this.dirty=!0,this.startSession()}exportAnalytics(){return JSON.stringify({exportedAt:Date.now(),...this.storage},null,2)}}function Zh(){return`session-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}var eg=".stx/story/analytics.json",$h=1,GN=1e4;var KN=()=>{};import EU from"fs";import WN from"path";class IU{storage;storagePath;dirty=!1;constructor($){this.storagePath=WN.join($,Yh),this.storage=this.loadStorage()}loadStorage(){try{let $=EU.readFileSync(this.storagePath,"utf-8");return JSON.parse($)}catch{return{version:Xh,bookmarks:[]}}}async save(){if(!this.dirty)return;let $=WN.dirname(this.storagePath);await EU.promises.mkdir($,{recursive:!0}),await EU.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}addBookmark($,Z,Y,X={}){let J={id:Jh(),name:X.name||`${$}/${Z}`,storyId:$,variantId:Z,props:Y,created:Date.now(),notes:X.notes,color:X.color};return this.storage.bookmarks.push(J),this.dirty=!0,J}getAllBookmarks(){return[...this.storage.bookmarks]}getBookmarksForStory($){return this.storage.bookmarks.filter((Z)=>Z.storyId===$)}getBookmark($){return this.storage.bookmarks.find((Z)=>Z.id===$)}isBookmarked($,Z){return this.storage.bookmarks.some((Y)=>Y.storyId===$&&Y.variantId===Z)}updateBookmark($,Z){let Y=this.getBookmark($);if(!Y)return;return Object.assign(Y,Z),this.dirty=!0,Y}deleteBookmark($){let Z=this.storage.bookmarks.findIndex((Y)=>Y.id===$);if(Z===-1)return!1;return this.storage.bookmarks.splice(Z,1),this.dirty=!0,!0}toggleBookmark($,Z,Y){let X=this.storage.bookmarks.find((Q)=>Q.storyId===$&&Q.variantId===Z);if(X)return this.deleteBookmark(X.id),{added:!1};return{added:!0,bookmark:this.addBookmark($,Z,Y)}}exportBookmarks(){return JSON.stringify(this.storage,null,2)}importBookmarks($,Z=!0){let Y=JSON.parse($),X=0;for(let J of Y.bookmarks){if(Z){let Q=this.storage.bookmarks.find((G)=>G.id===J.id);if(Q)Object.assign(Q,J);else this.storage.bookmarks.push(J)}else this.storage.bookmarks.push(J);X++}if(X>0)this.dirty=!0;return X}}function Jh(){return`bm-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}var Yh=".stx/story/bookmarks.json",Xh=1;var UN=()=>{};import DU from"fs";import x3 from"path";async function v3($){let{root:Z,config:Y}=$,X=[],J=await Qh(Z,Y.storyMatch,Y.storyIgnored);for(let Q of J){let G=x3.resolve(Z,Q),K=kU(Q,G);X.push(K)}return X}async function Qh($,Z,Y){let X=[];async function J(Q,G){let K=await DU.promises.readdir(Q,{withFileTypes:!0});for(let W of K){let U=x3.join(Q,W.name),z=x3.relative(G,U);if(zN(z,Y))continue;if(W.isDirectory())await J(U,G);else if(W.isFile()){if(_N(z,Z))X.push(z)}}}return await J($,$),X}function zN($,Z){for(let Y of Z)if(BN($,Y))return!0;return!1}function _N($,Z){for(let Y of Z)if(BN($,Y))return!0;return!1}function BN($,Z){let Y=$.replace(/\\/g,"/"),J=Z.replace(/\\/g,"/").replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"{{GLOBSTAR}}").replace(/\*/g,"[^/]*").replace(/\?/g,".").replace(/\{\{GLOBSTAR\}\}/g,".*");return J=`^${J}$`,new RegExp(J).test(Y)}function kU($,Z){let Y=x3.basename($,".story.stx");return{id:$.toLowerCase().replace(/\.story\.stx$/,"").replace(/[/\\]/g,"-").replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""),path:Z,relativePath:$,fileName:Y,treeFile:{title:Y,path:$}}}function qN($,Z){let{root:Y,config:X}=$,J=[],Q=DU.watch(Y,{recursive:!0},async(G,K)=>{if(!K)return;let W=K.replace(/\\/g,"/");if(!_N(W,X.storyMatch))return;if(zN(W,X.storyIgnored))return;let U=x3.resolve(Y,W);try{await DU.promises.access(U);let z=kU(W,U);Z(G==="rename"?"add":"change",z)}catch{let z=kU(W,U);Z("unlink",z)}});return J.push(Q),()=>{for(let G of J)G.close()}}var SU=()=>{};function Gh($,Z){let Y=Z.treeFile||{title:Z.fileName,path:Z.relativePath};if($.tree.file==="title")return Y.title.split("/");if($.tree.file==="path")return[...Z.relativePath.split("/").slice(0,-1),Y.title];if(typeof $.tree.file==="function")return $.tree.file(Y);return[Y.title]}function f3($,Z){for(let G of Z)G.treePath=Gh($,G);let Y=($.tree.groups||[]).map((G)=>({groupConfig:{id:G.id||G.title,title:G.title,include:G.include},treeObject:{}})),X={treeObject:{}};Y.push(X);for(let G=0;G<Z.length;G++){let K=Z[G],W=Kh(K,Y,X);Wh(K.treePath,G,W.treeObject)}let J=$.tree.order==="asc"?(G,K)=>G.localeCompare(K):$.tree.order,Q=[];for(let G of Y)if(G===X)Q.push(...CU(G.treeObject,J));else if(G.groupConfig&&Object.keys(G.treeObject).length>0)Q.push({group:!0,id:G.groupConfig.id,title:G.groupConfig.title,children:CU(G.treeObject,J)});return Q}function Kh($,Z,Y){let X=$.treeFile||{title:$.fileName,path:$.relativePath};for(let J of Z)if(J.groupConfig?.include&&J.groupConfig.include(X))return J;return Y}function Wh($,Z,Y){let X=Y;for(let J=0;J<$.length;J++){let Q=$[J];if(J===$.length-1)if(X[Q]!==void 0){let K=1;while(X[`${Q}-${K}`]!==void 0)K++;X[`${Q}-${K}`]=Z}else X[Q]=Z;else{if(X[Q]===void 0)X[Q]={};else if(typeof X[Q]==="number"){let K=X[Q];X[Q]={"":K}}X=X[Q]}}}function CU($,Z){let Y=[];for(let[X,J]of Object.entries($))if(typeof J==="number")Y.push({title:X,index:J});else Y.push({title:X,children:CU(J,Z)});return Y.sort((X,J)=>Z(X.title,J.title)),Y}function jN(){return{open($){_J.add($),$.send(JSON.stringify({type:"connected",timestamp:Date.now()}))},close($){_J.delete($)},message($,Z){}}}function bU($){let Z=JSON.stringify({...$,timestamp:$.timestamp||Date.now()});for(let Y of _J)try{Y.send(Z)}catch{_J.delete(Y)}}function HN($,Z){bU({type:"story-update",data:{storyId:$,...Z}})}function ON($,Z){bU({type:"story-add",data:{storyId:$,...Z}})}function LN($){bU({type:"story-remove",data:{storyId:$}})}function VN($){return`
|
|
21050
21052
|
<script>
|
|
21051
21053
|
(function() {
|
|
21052
21054
|
const ws = new WebSocket('${$}');
|
|
@@ -21270,7 +21272,7 @@ else {
|
|
|
21270
21272
|
}
|
|
21271
21273
|
})();
|
|
21272
21274
|
</script>
|
|
21273
|
-
`}function
|
|
21275
|
+
`}function Uh($){let Z=[];if($.modifiers)for(let X of $.modifiers)switch(X){case"meta":Z.push("\u2318");break;case"ctrl":Z.push("Ctrl");break;case"alt":Z.push("Alt");break;case"shift":Z.push("\u21E7");break}let Y=$.key;switch(Y){case"ArrowUp":Y="\u2191";break;case"ArrowDown":Y="\u2193";break;case"ArrowLeft":Y="\u2190";break;case"ArrowRight":Y="\u2192";break;case"Enter":Y="\u21B5";break;case"Escape":Y="Esc";break;default:Y=Y.toUpperCase()}return Z.push(Y),Z.join(" + ")}function NN($=wN){let Z=new Map;for(let X of $){let J=Z.get(X.category)||[];J.push(X),Z.set(X.category,J)}return`
|
|
21274
21276
|
<div class="shortcuts-modal" id="shortcuts-modal" style="display: none;">
|
|
21275
21277
|
<div class="shortcuts-backdrop" onclick="closeShortcutsModal()"></div>
|
|
21276
21278
|
<div class="shortcuts-content">
|
|
@@ -21286,7 +21288,7 @@ else {
|
|
|
21286
21288
|
${J.map((Q)=>`
|
|
21287
21289
|
<div class="shortcut-item">
|
|
21288
21290
|
<span class="shortcut-desc">${Q.description}</span>
|
|
21289
|
-
<kbd class="shortcut-key">${
|
|
21291
|
+
<kbd class="shortcut-key">${Uh(Q)}</kbd>
|
|
21290
21292
|
</div>
|
|
21291
21293
|
`).join("")}
|
|
21292
21294
|
</div>
|
|
@@ -21603,9 +21605,9 @@ window.__stxPerformance = {
|
|
|
21603
21605
|
|
|
21604
21606
|
window.clearPerformanceMetrics = () => window.__stxPerformance.clear();
|
|
21605
21607
|
</script>
|
|
21606
|
-
`}var
|
|
21608
|
+
`}var N60;var kN=D(()=>{N60=new EN});import PU from"fs";import SN from"path";class xU{storage;storagePath;dirty=!1;constructor($){this.storagePath=SN.join($,zh),this.storage=this.loadStorage()}loadStorage(){try{let $=PU.readFileSync(this.storagePath,"utf-8"),Z=JSON.parse($);if(Z.version!==yU)return this.migrateStorage(Z);return Z}catch{return{version:yU,presets:[],recentIds:[]}}}migrateStorage($){return{version:yU,presets:$.presets||[],recentIds:$.recentIds||[]}}async save(){if(!this.dirty)return;let $=SN.dirname(this.storagePath);await PU.promises.mkdir($,{recursive:!0}),await PU.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}createPreset($,Z,Y={}){let X={id:Bh(),name:$,description:Y.description,props:Z,componentId:Y.componentId,created:Date.now(),usageCount:0,tags:Y.tags};return this.storage.presets.push(X),this.dirty=!0,X}getPreset($){return this.storage.presets.find((Z)=>Z.id===$)}getAllPresets(){return[...this.storage.presets]}getPresetsForComponent($){return this.storage.presets.filter((Z)=>!Z.componentId||Z.componentId===$)}getRecentPresets(){return this.storage.recentIds.map(($)=>this.getPreset($)).filter(($)=>$!==void 0)}usePreset($){let Z=this.getPreset($);if(!Z)return;return Z.lastUsed=Date.now(),Z.usageCount++,this.storage.recentIds=[$,...this.storage.recentIds.filter((Y)=>Y!==$)].slice(0,_h),this.dirty=!0,Z}updatePreset($,Z){let Y=this.getPreset($);if(!Y)return;return Object.assign(Y,Z),this.dirty=!0,Y}deletePreset($){let Z=this.storage.presets.findIndex((Y)=>Y.id===$);if(Z===-1)return!1;return this.storage.presets.splice(Z,1),this.storage.recentIds=this.storage.recentIds.filter((Y)=>Y!==$),this.dirty=!0,!0}searchPresets($){let Z=$.toLowerCase();return this.storage.presets.filter((Y)=>{if(Y.name.toLowerCase().includes(Z))return!0;if(Y.description?.toLowerCase().includes(Z))return!0;if(Y.tags?.some((X)=>X.toLowerCase().includes(Z)))return!0;return!1})}getMostUsedPresets($=5){return[...this.storage.presets].sort((Z,Y)=>Y.usageCount-Z.usageCount).slice(0,$)}exportPresets($){let Z=$?this.storage.presets.filter((Y)=>$.includes(Y.id)):this.storage.presets;return JSON.stringify({presets:Z},null,2)}importPresets($,Z=!1){let Y=JSON.parse($),X=0;for(let J of Y.presets){let Q=this.storage.presets.find((G)=>G.id===J.id);if(Q&&!Z)continue;if(Q)Object.assign(Q,J);else this.storage.presets.push(J);X++}if(X>0)this.dirty=!0;return X}}function Bh(){return`preset-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}var zh=".stx/story/presets.json",yU=1,_h=10;var CN=()=>{};import vU from"fs";async function BJ($,Z,Y={}){let X=performance.now(),J=[];try{let Q=await vU.promises.stat(Z),G=bN.get(Z),K;if(G&&G.mtime===Q.mtimeMs)K=G.content;else K=await vU.promises.readFile(Z,"utf-8"),bN.set(Z,{content:K,mtime:Q.mtimeMs,analyzed:null});let{processDirectives:W}=await Promise.resolve().then(() => (q1(),EY)),U={},z=g3(K);if(z)try{await D0(z,U,Z)}catch(H){J.push(`Warning: Could not extract script variables: ${H instanceof Error?H.message:String(H)}`)}if(Y.props)Object.assign(U,Y.props);let B=await W(K,U,Z,{},new Set),q=yN(K),j=g3(K);return B=xN(B),B=vN(B,U),{html:B,css:q,js:j,errors:J,duration:performance.now()-X}}catch(Q){return J.push(Q instanceof Error?Q.message:String(Q)),{html:`<div class="stx-render-error">${fN(J[0])}</div>`,css:"",js:"",errors:J,duration:performance.now()-X}}}async function qh($){try{let Z=await vU.promises.readFile($,"utf-8"),Y=g3(Z);if(!Y)return null;let X={};if(await D0(Y,X,$),Array.isArray(X.variants))return X.variants;return null}catch{return null}}async function PN($,Z,Y,X){let J=Z.story?.variants;if(!J){let K=await qh(Z.path);if(K)J=K}if(!J&&Y==="default")return BJ($,Z.path,{props:X||{}});if(!J)return BJ($,Z.path,{props:X||{}});let Q=J.find((K)=>K.id===Y);if(!Q&&Y==="default")return BJ($,Z.path,{props:X||{}});if(!Q)return{html:'<div class="stx-render-error">Variant not found</div>',css:"",js:"",errors:[`Variant '${Y}' not found`],duration:0};let G={...Q.state,...X};if(Q.source)return jh($,Q.source,G);return BJ($,Z.path,{props:G})}async function jh($,Z,Y={}){let X=performance.now(),J=[];try{let{processDirectives:Q}=await Promise.resolve().then(() => (q1(),EY)),G={...Y},K=g3(Z);if(K)try{await D0(K,G,"inline-template.stx")}catch{}let U=await Q(Z,G,"inline-template.stx",{},new Set);return U=xN(U),U=vN(U,G),{html:U,css:yN(Z),js:g3(Z),errors:J,duration:performance.now()-X}}catch(Q){return J.push(Q instanceof Error?Q.message:String(Q)),{html:`<div class="stx-render-error">${fN(J[0])}</div>`,css:"",js:"",errors:J,duration:performance.now()-X}}}function yN($){let Z=[],Y=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,X=Y.exec($);while(X!==null)Z.push(X[1].trim()),X=Y.exec($);return Z.join(`
|
|
21607
21609
|
`)}function xN($){return $.replace(/<!--[\s\S]*?-->/g,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"").replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/^\s*\n/gm,"").trim()}function g3($){let Z=[],Y=/<script\b[^>]*>([\s\S]*?)<\/script>/gi,X=Y.exec($);while(X!==null)Z.push(X[1].trim()),X=Y.exec($);return Z.join(`
|
|
21608
|
-
`)}function vN($,Z){let Y=`<script>window.__stxProps = ${JSON.stringify(Z)};</script>`;return $+Y}function fN($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}var bN;var gN=D(()=>{N0();bN=new Map});async function hN($,Z){let Y=await v3($);s5($,Y);let X=f3($.config,Y);o5($,X),console.log(` Found ${Y.length} story files`);let J=typeof Z.host==="string"?Z.host:Z.host===!0?"0.0.0.0":"localhost",Q=new xU($.root),G=new IU($.root),K=new TU($.root),W=jN(),U=Bun.serve({port:Z.port,hostname:J,fetch:async(B,q)=>{let H=new URL(B.url).pathname;if(H==="/__hmr"){if(q.upgrade(B,{data:{isHmr:!0}}))return;return new Response("WebSocket upgrade failed",{status:400})}if(H.startsWith("/api/"))return
|
|
21610
|
+
`)}function vN($,Z){let Y=`<script>window.__stxProps = ${JSON.stringify(Z)};</script>`;return $+Y}function fN($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}var bN;var gN=D(()=>{N0();bN=new Map});async function hN($,Z){let Y=await v3($);s5($,Y);let X=f3($.config,Y);o5($,X),console.log(` Found ${Y.length} story files`);let J=typeof Z.host==="string"?Z.host:Z.host===!0?"0.0.0.0":"localhost",Q=new xU($.root),G=new IU($.root),K=new TU($.root),W=jN(),U=Bun.serve({port:Z.port,hostname:J,fetch:async(B,q)=>{let H=new URL(B.url).pathname;if(H==="/__hmr"){if(q.upgrade(B,{data:{isHmr:!0}}))return;return new Response("WebSocket upgrade failed",{status:400})}if(H.startsWith("/api/"))return Hh($,H,B,{presetsManager:Q,bookmarksManager:G,analyticsTracker:K});return Oh($,H,Z.port)},websocket:{open(B){W.open(B)},close(B){W.close(B)},message(B,q){W.message(B,q)}}}),z=`http://${J}:${Z.port}`,_=qN($,async(B,q)=>{console.log(` [${B}] ${q.relativePath}`);let j=await v3($);s5($,j);let H=f3($.config,j);if(o5($,H),B==="add")ON(q.id,{fileName:q.fileName});else if(B==="unlink")LN(q.id);else HN(q.id,{fileName:q.fileName})});if(Z.open){let B=z;try{let{exec:q}=await import("child_process"),j=process.platform;q(`${j==="darwin"?"open":j==="win32"?"start":"xdg-open"} ${B}`)}catch{}}return{server:U,url:z,close:async()=>{_(),U.stop()}}}async function Hh($,Z,Y,X){let{presetsManager:J,bookmarksManager:Q,analyticsTracker:G}=X;if(Z==="/api/stories")return Response.json({files:$.storyFiles.map((K)=>({id:K.id,fileName:K.fileName,relativePath:K.relativePath,treePath:K.treePath})),tree:$.tree});if(Z.startsWith("/api/story/")){let K=Z.slice(11),W=$.storyFiles.find((U)=>U.id===K);if(!W)return new Response("Story not found",{status:404});try{let U=await Bun.file(W.path).text();return Response.json({id:W.id,fileName:W.fileName,relativePath:W.relativePath,content:U})}catch{return new Response("Error reading story",{status:500})}}if(Z==="/api/config")return Response.json({theme:$.config.theme,responsivePresets:$.config.responsivePresets,backgroundPresets:$.config.backgroundPresets});if(Z.startsWith("/api/render/")){let K=new URL(Y.url),W=Z.slice(12).split("/"),U=W[0],z=W[1]||"default",_,B=K.searchParams.get("props");if(B)try{_=JSON.parse(B)}catch{}let q=$.storyFiles.find((j)=>j.id===U);if(!q)return new Response("Story not found",{status:404});try{let j=await PN($,q,z,_);return Response.json({html:j.html,css:j.css,js:j.js,errors:j.errors,duration:j.duration})}catch(j){return Response.json({html:"",css:"",js:"",errors:[j instanceof Error?j.message:String(j)],duration:0},{status:500})}}if(Z==="/api/presets"&&Y.method==="GET")return Response.json({presets:J.getAllPresets()});if(Z==="/api/presets"&&Y.method==="POST")try{let K=await Y.json(),W=J.createPreset(K.name,K.props,{componentId:K.componentId,description:K.description});return await J.save(),Response.json(W)}catch(K){return Response.json({error:String(K)},{status:400})}if(Z.startsWith("/api/presets/")&&!Z.includes("/use")&&Y.method==="GET"){let K=Z.slice(13),W=J.getPreset(K);if(!W)return new Response("Preset not found",{status:404});return Response.json(W)}if(Z.endsWith("/use")&&Y.method==="POST"){let K=Z.slice(13,-4),W=J.usePreset(K);if(!W)return new Response("Preset not found",{status:404});return await J.save(),Response.json(W)}if(Z.startsWith("/api/presets/")&&Y.method==="DELETE"){let K=Z.slice(13);if(!J.deletePreset(K))return new Response("Preset not found",{status:404});return await J.save(),Response.json({success:!0})}if(Z==="/api/bookmarks"&&Y.method==="GET")return Response.json({bookmarks:Q.getAllBookmarks()});if(Z==="/api/bookmarks"&&Y.method==="POST")try{let K=await Y.json(),W=Q.addBookmark(K.storyId,K.variantId,K.props,{name:K.name,notes:K.notes,color:K.color});return await Q.save(),Response.json(W)}catch(K){return Response.json({error:String(K)},{status:400})}if(Z==="/api/bookmarks/toggle"&&Y.method==="POST")try{let K=await Y.json(),W=Q.toggleBookmark(K.storyId,K.variantId,K.props);return await Q.save(),Response.json(W)}catch(K){return Response.json({error:String(K)},{status:400})}if(Z.startsWith("/api/bookmarks/")&&Z!=="/api/bookmarks/toggle"&&Y.method==="GET"){let K=Z.slice(15),W=Q.getBookmark(K);if(!W)return new Response("Bookmark not found",{status:404});return Response.json(W)}if(Z.startsWith("/api/bookmarks/")&&Y.method==="DELETE"){let K=Z.slice(15);if(!Q.deleteBookmark(K))return new Response("Bookmark not found",{status:404});return await Q.save(),Response.json({success:!0})}if(Z==="/api/analytics/track"&&Y.method==="POST")try{let K=await Y.json();if(K.type==="view"&&K.componentId)G.trackView(K.componentId,K.variantId);else if(K.type==="prop_change"&&K.componentId&&K.propName)G.trackPropChange(K.componentId,K.propName,null);else if(K.type==="variant_switch"&&K.componentId&&K.variantId)G.trackVariantSwitch(K.componentId,K.variantId);else if(K.type==="search"&&K.query)G.trackSearch(K.query,0);return await G.save(),Response.json({success:!0})}catch(K){return Response.json({error:String(K)},{status:400})}if(Z==="/api/analytics/summary"&&Y.method==="GET")return Response.json({mostViewed:G.getMostViewedComponents(10),mostChangedProps:G.getMostChangedProps(10),searchAnalytics:G.getSearchAnalytics()});if(Z.startsWith("/api/analytics/component/")&&Y.method==="GET"){let K=Z.slice(25),W=$.storyFiles.find((z)=>z.id===K),U=G.getComponentAnalytics(K,W?.fileName||K);return Response.json(U)}return new Response("Not found",{status:404})}function Oh($,Z,Y){let X=Lh($,Y);return new Response(X,{headers:{"Content-Type":"text/html; charset=utf-8"}})}function Lh($,Z){let{theme:Y}=$.config,X=Y.title||"STX Story",J=`ws://localhost:${Z}/__hmr`,Q=VN(J);return`<!DOCTYPE html>
|
|
21609
21611
|
<html lang="en" class="${Y.darkClass||"dark"}">
|
|
21610
21612
|
<head>
|
|
21611
21613
|
<meta charset="UTF-8">
|
|
@@ -22323,8 +22325,8 @@ else {
|
|
|
22323
22325
|
<style>${RN()}</style>
|
|
22324
22326
|
${NN()}
|
|
22325
22327
|
</body>
|
|
22326
|
-
</html>`}var dN=D(()=>{KN();UN();SU();y3();FN();TN();kN();CN();gN()});import
|
|
22327
|
-
`),Q.stop(),await X.close(),process.exit(0)};if(process.on("SIGINT",G),process.on("SIGTERM",G),process.stdin.isTTY)process.stdin.setRawMode(!0),process.stdin.resume(),process.stdin.on("data",async(K)=>{switch(K.toString()){case"h":NU();break;case"o":try{let{exec:U}=await import("child_process"),z=process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open";U(`${z} ${X.url}`)}catch{nw("Failed to open browser")}break;case"r":await X.close(),await J();break;case"c":console.clear(),b3(),P3(Z.storyFiles.length),wU(X.url);break;case"q":case"\x03":await G();break}});await new Promise(()=>{})}var
|
|
22328
|
+
</html>`}var dN=D(()=>{KN();UN();SU();y3();FN();TN();kN();CN();gN()});import Vh from"fs";import Fh from"path";async function uN($){let Z=$.config.setupFile;if(!Z)return;let Y=Fh.resolve($.root,Z);try{await Vh.promises.access(Y)}catch{return}let X={storyContext:$,registerComponent:(J,Q)=>{Ah.set(J,Q)},addCSS:(J)=>{wh.push(J)},addScript:(J)=>{Nh.push(J)},setState:(J,Q)=>{Rh.set(J,Q)}};try{let J=await import(Y);if(typeof J.default==="function")await J.default(X);else if(typeof J.setupStory==="function")await J.setupStory(X)}catch(J){console.warn(`Warning: Failed to load setup file: ${J}`)}}var Ah,wh,Nh,Rh;var mN=D(()=>{Ah=new Map,wh=[],Nh=[],Rh=new Map});var cN={};$0(cN,{devCommand:()=>lN,dev:()=>Mh});async function lN($={}){b3();let Z=await a5({mode:"dev"});if(!Z.config.enabled){r5("Story feature is disabled in config.");return}await uN(Z);let Y=$.port??Z.config.port,X,J=async()=>{X=await hN(Z,{port:Y,open:$.open,host:$.host}),P3(Z.storyFiles.length),wU(X.url),NU()};await J();let Q=ow(Z,{onChange:async()=>{await X.close();let K=await a5({mode:"dev"});Object.assign(Z,K),await J()}}),G=async()=>{console.log(`
|
|
22329
|
+
`),Q.stop(),await X.close(),process.exit(0)};if(process.on("SIGINT",G),process.on("SIGTERM",G),process.stdin.isTTY)process.stdin.setRawMode(!0),process.stdin.resume(),process.stdin.on("data",async(K)=>{switch(K.toString()){case"h":NU();break;case"o":try{let{exec:U}=await import("child_process"),z=process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open";U(`${z} ${X.url}`)}catch{nw("Failed to open browser")}break;case"r":await X.close(),await J();break;case"c":console.clear(),b3(),P3(Z.storyFiles.length),wU(X.url);break;case"q":case"\x03":await G();break}});await new Promise(()=>{})}var Mh;var pN=D(()=>{tw();y3();zJ();dN();mN();Mh=lN});function iN($){h3=[];for(let Z of $.storyFiles)if(h3.push({text:Z.fileName.toLowerCase(),original:Z.fileName,type:"story",storyId:Z.id}),h3.push({text:Z.relativePath.toLowerCase(),original:Z.relativePath,type:"story",storyId:Z.id}),Z.story)for(let Y of Z.story.variants)h3.push({text:Y.title.toLowerCase(),original:Y.title,type:"story",storyId:Z.id,variantId:Y.id})}function nN(){return JSON.stringify(h3)}var h3;var rN=D(()=>{h3=[]});var sN={};$0(sN,{buildCommand:()=>aN,build:()=>Eh});import I6 from"fs";import B$ from"path";async function aN($={}){let Z=Date.now();b3();let Y=await a5({mode:"build"});if(!Y.config.enabled){r5("Story feature is disabled in config.");return}let X=await v3(Y);s5(Y,X);let J=f3(Y.config,X);o5(Y,J),P3(X.length);let Q=$.outDir??Y.config.outDir,G=B$.resolve(Y.root,Q);await I6.promises.mkdir(G,{recursive:!0}),console.log(` Building to ${Q}...`);let K=Th(Y);await I6.promises.writeFile(B$.join(G,"index.html"),K);let W={files:X.map((q)=>({id:q.id,fileName:q.fileName,relativePath:q.relativePath,treePath:q.treePath})),tree:J};await I6.promises.writeFile(B$.join(G,"stories.json"),JSON.stringify(W,null,2));let U={theme:Y.config.theme,responsivePresets:Y.config.responsivePresets,backgroundPresets:Y.config.backgroundPresets};await I6.promises.writeFile(B$.join(G,"config.json"),JSON.stringify(U,null,2));let z=B$.join(G,"stories");await I6.promises.mkdir(z,{recursive:!0});for(let q of X){let j=await I6.promises.readFile(q.path,"utf-8");await I6.promises.writeFile(B$.join(z,`${q.id}.stx`),j)}iN(Y);let _=nN();await I6.promises.writeFile(B$.join(G,"search-index.json"),_);let B=Date.now()-Z;aw(X.length,Q,B)}function Th($){let{theme:Z}=$.config,Y=Z.title||"STX Story";return`<!DOCTYPE html>
|
|
22328
22330
|
<html lang="en">
|
|
22329
22331
|
<head>
|
|
22330
22332
|
<meta charset="UTF-8">
|
|
@@ -22438,14 +22440,14 @@ else {
|
|
|
22438
22440
|
}
|
|
22439
22441
|
</script>
|
|
22440
22442
|
</body>
|
|
22441
|
-
</html>`}var
|
|
22442
|
-
`)}async function
|
|
22443
|
-
`)}function GR($,Z,Y){let X=" ".repeat(Y);if(Y===0)Z.push("fn build(allocator: std.mem.Allocator) !craft.Element {");let J=`node_${Y}`;Z.push(`${X} var ${J} = try ${$.zigType}.init(allocator);`);for(let[Q,G]of Object.entries($.props))if(G.type==="literal"){let K=typeof G.value==="string"?`"${G.value}"`:String(G.value);Z.push(`${X} ${J}.set${
|
|
22443
|
+
</html>`}var Eh;var oN=D(()=>{SU();y3();zJ();rN();Eh=aN});var eN={};$0(eN,{updateSnapshots:()=>kh,runVisualTests:()=>tN,runA11yTests:()=>yh,formatTestResults:()=>Ph});import qJ from"fs";import Ih from"path";async function tN($,Z={}){let Y=Date.now(),X={total:0,passed:0,failed:0,new:0,failures:[],duration:0},J=Z.snapshotDir||l0($.root,"story","snapshots");await qJ.promises.mkdir(J,{recursive:!0});let Q=$.storyFiles;if(Z.filter&&Z.filter.length>0)Q=Q.filter((G)=>Z.filter.some((K)=>G.fileName.toLowerCase().includes(K.toLowerCase())));for(let G of Q)await Dh(G,J,Z,X);return X.duration=Date.now()-Y,X}async function Dh($,Z,Y,X){let J=$.story;if(!J)return;for(let Q of J.variants){X.total++;let G=Ih.join(Z,`${$.id}-${Q.id}.snap`),K=Sh(Q.source||""),W=await bh(G);if(Y.update||!W){let U={storyId:$.id,variantId:Q.id,component:$.fileName,timestamp:Date.now(),hash:K};if(await qJ.promises.writeFile(G,JSON.stringify(U,null,2)),!W)X.new++;X.passed++}else try{let U=await qJ.promises.readFile(G,"utf-8"),z=JSON.parse(U);if(z.hash===K)X.passed++;else X.failed++,X.failures.push({storyId:$.id,variantId:Q.id,component:$.fileName,message:"Snapshot mismatch",difference:Ch(z.hash,K)})}catch(U){X.failed++,X.failures.push({storyId:$.id,variantId:Q.id,component:$.fileName,message:`Error reading snapshot: ${U}`})}}}async function kh($,Z={}){return(await tN($,{...Z,update:!0})).total}function Sh($){let Z=0;for(let Y=0;Y<$.length;Y++){let X=$.charCodeAt(Y);Z=(Z<<5)-Z+X,Z=Z&Z}return Z.toString(16)}function Ch($,Z){if($===Z)return 0;let Y=Math.abs(Number.parseInt($,16)-Number.parseInt(Z,16));return Math.min(Y/1e6,1)}async function bh($){try{return await qJ.promises.access($),!0}catch{return!1}}function Ph($){let Z=[];if(Z.push(""),Z.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),Z.push(" STX Story Visual Regression Tests"),Z.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),Z.push(""),$.failures.length>0){Z.push(" \u274C Failures:"),Z.push("");for(let Y of $.failures){if(Z.push(` \u2022 ${Y.component} / ${Y.variantId}`),Z.push(` ${Y.message}`),Y.difference!==void 0)Z.push(` Difference: ${(Y.difference*100).toFixed(2)}%`);Z.push("")}}if(Z.push(" Summary:"),Z.push(` Total: ${$.total}`),Z.push(` Passed: ${$.passed} \u2713`),Z.push(` Failed: ${$.failed} \u2717`),$.new>0)Z.push(` New: ${$.new} \u26A1`);return Z.push(` Time: ${$.duration}ms`),Z.push(""),Z.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),Z.push(""),Z.join(`
|
|
22444
|
+
`)}async function yh($,Z={}){let Y=performance.now(),X=[],J=0,Q=0;for(let K of $.storyFiles)try{let W=await Bun.file(K.path).text(),U=await u3(W,K.path);if(U.length>0){for(let z of U)X.push({storyId:K.id,variantId:"default",component:K.component,message:`A11y: ${z.message}`,expected:"No accessibility violations",actual:`${z.type}: ${z.message} (impact: ${z.impact})`});Q++}else J++}catch(W){X.push({storyId:K.id,variantId:"default",component:K.component,message:`Failed to check a11y: ${W instanceof Error?W.message:String(W)}`,expected:"File readable for a11y check",actual:"File read error"}),Q++}let G=performance.now()-Y;return{total:$.storyFiles.length,passed:J,failed:Q,new:0,failures:X,duration:G}}var $R=D(()=>{j$();J4()});var _R={};$0(_R,{default:()=>Xd,createHotReloadServer:()=>zR,compileToNative:()=>YR,NATIVE_COMPONENTS:()=>dU});async function YR($,Z={}){let Y=performance.now(),X={target:Z.target||"universal",format:Z.format||"zig",optimize:Z.optimize??!0,treeShake:Z.treeShake??!0,hotReload:Z.hotReload??!1,debug:Z.debug??!1,sourceMaps:Z.sourceMaps??!1,bundle:Z.bundle??!0,minify:Z.minify??!1,components:Z.components||dU},J=typeof $==="string"?xh($):$,Q=fh(J.tree,X),G=ch(Q),K=X.treeShake?ih(Q,G):Q,W=new Map;if(X.target==="universal"){let q=["macos","windows","linux","ios","android"];for(let j of q){let H=fU(K,{...X,target:j});W.set(j,H)}}else{let q=fU(K,X);W.set(X.target,q)}let U=ah(K,X,W),z=sh(J,K,X),_={compilationTime:performance.now()-Y,totalComponents:gU(J.tree),nativeComponents:hU(K),webComponents:gU(J.tree)-hU(K),bundleSize:U.length,treeShakenSize:X.treeShake?nh(Q,K):U.length,warnings:[],errors:[]},B;if(X.sourceMaps)B=oh(J,K);return{code:U,platformCode:W,dependencies:G,manifest:z,sourceMaps:B,stats:_}}function xh($){let Z={type:"fragment",children:[]},Y=$.match(/<body[^>]*>([\s\S]*?)<\/body>/i),X=Y?Y[1]:$;return XR(X,Z),{id:WR(),hash:UR($),tree:Z,scripts:$d($),styles:Zd($),staticParts:new Map,dynamicParts:new Map,dependencies:[],metadata:{hasSlots:!1,hasDynamicContent:$.includes("{{"),hasEventHandlers:$.includes("onclick")||$.includes("onchange"),hasAsyncContent:!1,componentCount:0,maxDepth:0,estimatedSize:$.length}}}function XR($,Z){let Y=/<(@?[\w-]+)([^>]*)(?:\/>|>([\s\S]*?)<\/\1>)/g,X;while((X=Y.exec($))!==null){let[,J,Q,G]=X,K=J.startsWith("@craft-"),W={type:K?"component":"element",tag:K?J.slice(1):J,props:vh(Q),children:[],componentName:K?J.slice(1):void 0};if(G){let U=G.replace(/<[^>]+>/g,"").trim();if(U)W.children=W.children??[],W.children.push({type:"text",text:U});XR(G,W)}Z.children=Z.children??[],Z.children.push(W)}}function vh($){let Z={},Y=/([\w-:@]+)(?:=["']([^"']*)["'])?/g,X;while((X=Y.exec($))!==null){let[,J,Q]=X;Z[J]=Q??!0}return Z}function fh($,Z){return JR($,Z)}function JR($,Z){let Y=$.componentName?Z.components?.get($.componentName):void 0,X="craft.View";if(Y)X=Y.zigType;else if($.type==="text")X="craft.Text";else if($.tag)X=gh($.tag);let J={};if($.props)for(let[W,U]of Object.entries($.props))J[W]=hh(U);let Q=[];if($.children)for(let W of $.children)Q.push(JR(W,Z));let G=new Map;if($.props){for(let[W,U]of Object.entries($.props))if(W.startsWith("on")&&typeof U==="string")G.set(W.slice(2).toLowerCase(),U)}let K=uh($);return{type:dh($,Y),zigType:X,props:J,children:Q,events:G,styles:K,id:$.hydrationKey,key:$.props?.key}}function gh($){return{div:"craft.View",span:"craft.Text",p:"craft.Text",h1:"craft.Text",h2:"craft.Text",h3:"craft.Text",h4:"craft.Text",h5:"craft.Text",h6:"craft.Text",button:"craft.Button",input:"craft.TextInput",textarea:"craft.TextArea",select:"craft.Select",img:"craft.Image",a:"craft.Link",ul:"craft.List",ol:"craft.List",li:"craft.ListItem",form:"craft.Form",label:"craft.Label",nav:"craft.View",header:"craft.View",footer:"craft.View",main:"craft.View",section:"craft.View",article:"craft.View",aside:"craft.View"}[$.toLowerCase()]||"craft.View"}function hh($){if(typeof $==="string"){if($.startsWith("{{")&&$.endsWith("}}"))return{type:"binding",path:$.slice(2,-2).trim()};if($.includes("(")&&$.includes(")"))return{type:"callback",handler:$};return{type:"literal",value:$}}if(typeof $==="number"||typeof $==="boolean")return{type:"literal",value:$};return{type:"literal",value:String($)}}function dh($,Z){if(Z){let X=Z.name.toLowerCase();if(X.includes("button"))return"button";if(X.includes("input")||X.includes("text"))return"input";if(X.includes("image")||X.includes("avatar"))return"image";if(X.includes("list")||X.includes("table"))return"list";if(X.includes("scroll"))return"scroll";return"custom"}if($.type==="text")return"text";let Y=$.tag?.toLowerCase();if(Y==="button")return"button";if(Y==="input"||Y==="textarea")return"input";if(Y==="img")return"image";if(Y==="ul"||Y==="ol")return"list";return"view"}function uh($){let Z=$.props?.style,Y={},X={};if(Z){let J=Z.split(";").filter(Boolean);for(let Q of J){let[G,K]=Q.split(":").map((W)=>W.trim());if(!G||!K)continue;switch(G){case"display":Y.display=K;break;case"flex-direction":Y.flexDirection=K;break;case"justify-content":Y.justifyContent=mh(K);break;case"align-items":Y.alignItems=lh(K);break;case"gap":Y.gap=Number.parseInt(K,10);break;case"padding":Y.padding=Number.parseInt(K,10);break;case"margin":Y.margin=Number.parseInt(K,10);break;case"width":Y.width=K==="auto"?"auto":Number.parseInt(K,10);break;case"height":Y.height=K==="auto"?"auto":Number.parseInt(K,10);break;case"background-color":case"background":X.backgroundColor=K;break;case"border-color":X.borderColor=K;break;case"border-width":X.borderWidth=Number.parseInt(K,10);break;case"border-radius":X.borderRadius=Number.parseInt(K,10);break;case"opacity":X.opacity=Number.parseFloat(K);break}}}return{layout:Y,appearance:X}}function mh($){return{"flex-start":"start","flex-end":"end",center:"center","space-between":"between","space-around":"around"}[$]||"start"}function lh($){return{"flex-start":"start","flex-end":"end",center:"center",stretch:"stretch"}[$]||"start"}function ch($){let Z=[],Y=new Set;function X(J,Q){let G=J.id||WR();if(Y.has(G))return;Y.add(G);let K={id:G,type:"component",path:J.zigType,dependencies:Q?[Q]:[],size:QR(J),isStatic:ph(J)};Z.push(K);for(let W of J.children)X(W,G)}return X($),Z}function QR($){let Z=100;return Z+=Object.keys($.props).length*20,Z+=$.events.size*50,Z}function ph($){for(let Z of Object.values($.props))if(Z.type!=="literal")return!1;return $.events.size===0}function ih($,Z){return $}function nh($,Z){let Y=0;function X(J){Y+=QR(J);for(let Q of J.children)X(Q)}return X(Z),Y}function fU($,Z){switch(Z.format){case"zig":return ZR($,Z);case"typescript":return rh($,Z);case"json":return JSON.stringify($,null,Z.minify?0:2);default:return ZR($,Z)}}function ZR($,Z){let Y=[];return Y.push("// Auto-generated by stx compiler"),Y.push("// Target: "+Z.target),Y.push(""),Y.push('const std = @import("std");'),Y.push('const craft = @import("craft");'),Y.push(""),Y.push("pub fn render(allocator: std.mem.Allocator) !craft.Element {"),Y.push(" return try build(allocator);"),Y.push("}"),Y.push(""),GR($,Y,0),Y.join(`
|
|
22445
|
+
`)}function GR($,Z,Y){let X=" ".repeat(Y);if(Y===0)Z.push("fn build(allocator: std.mem.Allocator) !craft.Element {");let J=`node_${Y}`;Z.push(`${X} var ${J} = try ${$.zigType}.init(allocator);`);for(let[Q,G]of Object.entries($.props))if(G.type==="literal"){let K=typeof G.value==="string"?`"${G.value}"`:String(G.value);Z.push(`${X} ${J}.set${eh(Q)}(${K});`)}for(let Q=0;Q<$.children.length;Q++){let G=$.children[Q];if(G.type==="text"){let K=G.props.text?.type==="literal"?String(G.props.text.value):"";Z.push(`${X} try ${J}.addChild(try craft.Text.init(allocator, "${K}"));`)}else GR(G,Z,Y+1),Z.push(`${X} try ${J}.addChild(node_${Y+1});`)}if(Y===0)Z.push(` return ${J}.element();`),Z.push("}")}function rh($,Z){let Y=[];return Y.push("// Auto-generated by stx compiler"),Y.push("// Target: "+Z.target),Y.push(""),Y.push('import { Craft } from "@stacksjs/craft";'),Y.push(""),Y.push("export function render(): Craft.Element {"),Y.push(" return "+KR($,1)+";"),Y.push("}"),Y.join(`
|
|
22444
22446
|
`)}function KR($,Z){let Y=" ".repeat(Z),X=[];for(let[K,W]of Object.entries($.props))if(W.type==="literal"){let U=typeof W.value==="string"?`"${W.value}"`:String(W.value);X.push(`${K}: ${U}`)}let J=X.length>0?`{ ${X.join(", ")} }`:"{}",Q=$.children.map((K)=>K.type==="text"?`"${K.props.text?.type==="literal"?K.props.text.value:""}"`:KR(K,Z+1)),G=Q.length>0?`,
|
|
22445
22447
|
${Y} [${Q.join(`,
|
|
22446
|
-
${Y} `)}]`:"";return`Craft.create("${$.zigType}", ${J}${G})`}function
|
|
22447
|
-
`)}return Y.get(Z.target)||fU($,Z)}function ah($,Z,Y){let X=[];function J(Q){X.push({name:Q.zigType,hash:UR(JSON.stringify(Q.props)),props:Object.keys(Q.props),events:Array.from(Q.events.keys()),slots:[],isNative:Q.zigType.startsWith("craft.")});for(let G of Q.children)J(G)}return J(Z),{version:"1.0.0",components:X,entry:$.id,assets:[],styles:$.styles}}function sh($,Z){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}function WR(){return`id_${++oh}`}function UR($){let Z=0;for(let Y=0;Y<$.length;Y++){let X=$.charCodeAt(Y);Z=(Z<<5)-Z+X,Z=Z&Z}return Math.abs(Z).toString(36)}function th($){return $.charAt(0).toUpperCase()+$.slice(1)}function eh($){let Z=[],Y=/<script[^>]*>([\s\S]*?)<\/script>/gi,X;while((X=Y.exec($))!==null)Z.push(X[1]);return Z}function $d($){let Z=[],Y=/<style[^>]*>([\s\S]*?)<\/style>/gi,X;while((X=Y.exec($))!==null)Z.push(X[1]);return Z}function gU($){let Z=$.type==="component"?1:0;if($.children)for(let Y of $.children)Z+=gU(Y);return Z}function hU($){let Z=$.zigType.startsWith("craft.")?1:0;for(let Y of $.children)Z+=hU(Y);return Z}function zR($){return{start:async()=>{console.log("[craft-compiler] Hot reload server started")},stop:async()=>{console.log("[craft-compiler] Hot reload server stopped")},notifyChange:(Z)=>{console.log(`[craft-compiler] File changed: ${Z}`)}}}var dU,oh=0,Zd,Yd;var BR=D(()=>{dU=new Map([["craft-button",{name:"Button",zigType:"craft.Button",props:[{name:"variant",type:"string",required:!1,default:"primary"},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onclick",type:"callback",required:!1}],children:"single"}],["craft-text-input",{name:"TextInput",zigType:"craft.TextInput",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-textarea",{name:"TextArea",zigType:"craft.TextArea",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"rows",type:"number",required:!1,default:3},{name:"disabled",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-checkbox",{name:"Checkbox",zigType:"craft.Checkbox",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"label",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-select",{name:"Select",zigType:"craft.Select",props:[{name:"value",type:"string",required:!1},{name:"options",type:"array",required:!0},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-slider",{name:"Slider",zigType:"craft.Slider",props:[{name:"value",type:"number",required:!1,default:0},{name:"min",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"step",type:"number",required:!1,default:1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-toggle",{name:"Toggle",zigType:"craft.Toggle",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-modal",{name:"Modal",zigType:"craft.Modal",props:[{name:"open",type:"boolean",required:!1,default:!1},{name:"title",type:"string",required:!1},{name:"closable",type:"boolean",required:!1,default:!0},{name:"onclose",type:"callback",required:!1}],children:"multiple"}],["craft-alert",{name:"Alert",zigType:"craft.Alert",props:[{name:"variant",type:"string",required:!1,default:"info"},{name:"title",type:"string",required:!1},{name:"dismissible",type:"boolean",required:!1,default:!1}],children:"single"}],["craft-progress",{name:"ProgressBar",zigType:"craft.ProgressBar",props:[{name:"value",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"indeterminate",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-spinner",{name:"Spinner",zigType:"craft.Spinner",props:[{name:"size",type:"number",required:!1,default:24}],children:"none"}],["craft-avatar",{name:"Avatar",zigType:"craft.Avatar",props:[{name:"src",type:"string",required:!1},{name:"alt",type:"string",required:!1},{name:"size",type:"number",required:!1,default:40}],children:"none"}],["craft-badge",{name:"Badge",zigType:"craft.Badge",props:[{name:"variant",type:"string",required:!1,default:"default"}],children:"single"}],["craft-card",{name:"Card",zigType:"craft.Card",props:[{name:"padding",type:"number",required:!1,default:16}],children:"multiple"}],["craft-sidebar",{name:"Sidebar",zigType:"craft.NativeSidebar",props:[{name:"id",type:"string",required:!1},{name:"variant",type:"string",required:!1,default:"desktop"},{name:"material",type:"string",required:!1,default:"sidebar"},{name:"backgroundEffect",type:"string",required:!1,default:"shimmer"},{name:"allowsVibrancy",type:"boolean",required:!1,default:!0},{name:"materialOpacity",type:"number",required:!1,default:0.68},{name:"minWidth",type:"number",required:!1,default:240},{name:"maxWidth",type:"number",required:!1,default:340},{name:"canCollapse",type:"boolean",required:!1,default:!0},{name:"selectedItem",type:"string",required:!1},{name:"sections",type:"array",required:!1}],children:"multiple",platform:["macos"],fallback:"aside"}],["craft-sidebar-section",{name:"SidebarSection",zigType:"craft.NativeSidebarSection",props:[{name:"id",type:"string",required:!0},{name:"title",type:"string",required:!1},{name:"header",type:"string",required:!1}],children:"multiple",platform:["macos"],fallback:"section"}],["craft-sidebar-item",{name:"SidebarItem",zigType:"craft.NativeSidebarItem",props:[{name:"id",type:"string",required:!0},{name:"label",type:"string",required:!0},{name:"icon",type:"string",required:!1},{name:"badge",type:"string",required:!1},{name:"tintColor",type:"color",required:!1}],children:"none",platform:["macos"],fallback:"button"}],["craft-accordion",{name:"Accordion",zigType:"craft.Accordion",props:[{name:"title",type:"string",required:!0},{name:"open",type:"boolean",required:!1,default:!1}],children:"multiple"}],["craft-tabs",{name:"TabView",zigType:"craft.TabView",props:[{name:"activeTab",type:"number",required:!1,default:0},{name:"ontabchange",type:"callback",required:!1}],children:"multiple"}],["craft-tooltip",{name:"Tooltip",zigType:"craft.Tooltip",props:[{name:"content",type:"string",required:!0},{name:"position",type:"string",required:!1,default:"top"}],children:"single"}],["craft-date-picker",{name:"DatePicker",zigType:"craft.DatePicker",props:[{name:"value",type:"string",required:!1},{name:"min",type:"string",required:!1},{name:"max",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-time-picker",{name:"TimePicker",zigType:"craft.TimePicker",props:[{name:"value",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-color-picker",{name:"ColorPicker",zigType:"craft.ColorPicker",props:[{name:"value",type:"color",required:!1,default:"#000000"},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-data-table",{name:"DataTable",zigType:"craft.DataTable",props:[{name:"data",type:"array",required:!0},{name:"columns",type:"array",required:!0},{name:"sortable",type:"boolean",required:!1,default:!1},{name:"paginated",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-virtual-list",{name:"VirtualList",zigType:"craft.VirtualList",props:[{name:"items",type:"array",required:!0},{name:"itemHeight",type:"number",required:!1,default:48},{name:"renderItem",type:"callback",required:!0}],children:"none"}],["craft-tree-view",{name:"TreeView",zigType:"craft.TreeView",props:[{name:"data",type:"object",required:!0},{name:"expandable",type:"boolean",required:!1,default:!0}],children:"none"}]]);Zd={compileToNative:YR,createHotReloadServer:zR,NATIVE_COMPONENTS:dU},Yd=Zd});import{spawn as HR}from"child_process";import f0 from"fs";import Xd from"os";import Y0 from"path";import v from"process";import{CLI as Jd}from"@stacksjs/clapp";var E6="0.2.127";j$();jU();AK();kK();r4();EK();OK();JU();var __dirname="/home/runner/work/stx/stx/packages/stx/bin",V0=new Jd("stx");function qR($){let Z=typeof $==="string"?Number.parseInt($,10):$;if(Number.isNaN(Z))return{isValid:!1,error:"Port must be a valid number",suggestion:"Try using a number between 1024 and 65535"};if(Z<1024||Z>65535)return{isValid:!1,error:"Port must be between 1024 and 65535",suggestion:"Try using a port between 1024 and 65535"};return{isValid:!0}}function jR($){try{if(!f0.existsSync($)){let Y=Y0.dirname($),X=Y0.basename($);if(f0.existsSync(Y)){let Q=f0.readdirSync(Y).filter((K)=>K.toLowerCase().includes(X.toLowerCase().substring(0,3))||K.endsWith(".stx")||K.endsWith(".md")),G=Q.length>0?`File not found. Similar files in ${Y}: ${Q.slice(0,3).join(", ")}`:`File not found. Directory ${Y} exists but doesn't contain the specified file.`;return{isValid:!1,error:`File does not exist: ${$}`,suggestion:G}}return{isValid:!1,error:`File does not exist: ${$}`,suggestion:"Check the file path and try again"}}if(f0.statSync($).isDirectory())return{isValid:!1,error:`Expected file but got directory: ${$}`,suggestion:"Specify a .stx or .md file path"};return{isValid:!0}}catch(Z){return{isValid:!1,error:`Cannot access file: ${$}`,suggestion:"Check file permissions and path"}}}function uU($){let Z=typeof $==="string"?Number.parseInt($,10):$;if(Number.isNaN(Z))return{isValid:!1,error:"Timeout must be a valid number",suggestion:"Specify timeout in milliseconds (e.g., 5000 for 5 seconds)"};if(Z<100)return{isValid:!1,error:"Timeout too short (minimum 100ms)",suggestion:"Use a timeout of at least 100ms"};if(Z>300000)return{isValid:!1,error:"Timeout too long (maximum 5 minutes)",suggestion:"Use a timeout of less than 300000ms (5 minutes)"};return{isValid:!0}}var e5=($)=>$.includes("*")||$.includes("?")||$.includes("{")||$.includes("["),Qd=($)=>$.endsWith(".stx")||$.endsWith(".md");function t5($,Z=1){if(console.error(`\u274C ${$.error}`),$.suggestion)console.error(`\uD83D\uDCA1 suggestion: ${$.suggestion}`);v.exit(Z)}function Gd($){if(!$)return;let Z;try{Z=JSON.parse($)}catch(Y){console.error(`\u274C --info-plist is not valid JSON: ${Y.message}`),v.exit(1)}if(typeof Z!=="object"||Z===null||Array.isArray(Z))console.error(`\u274C --info-plist must be a JSON object, e.g. '{"NSFocusStatusUsageDescription":"\u2026"}'`),v.exit(1);for(let[Y,X]of Object.entries(Z))if(typeof X!=="string"&&typeof X!=="number"&&typeof X!=="boolean")console.error(`\u274C --info-plist value for "${Y}" must be a string, number or boolean`),v.exit(1);return Z}async function Kd($,Z){try{let Y=["test"],X=[];if($&&$.length>0)for(let W of $)if(e5(W))try{let U=await Array.fromAsync(new Bun.Glob(W).scan({onlyFiles:!0,absolute:!0}));if(U.length===0)console.warn(`Warning: No files found matching pattern: ${W}`);else if(X.push(...U),Z.verbose)console.log(`Found ${U.length} file(s) matching pattern: ${W}`)}catch(U){return console.error(`Error expanding glob pattern ${W}:`,U),!1}else X.push(W);if(X.length===0)return console.error("Error: No test files found matching the provided patterns."),!1;if(Y.push(...X),Z.filter)Y.push("--pattern",Z.filter);if(Z.timeout)Y.push("--timeout",Z.timeout.toString());if(Z.reporter&&Z.reporter!=="default")if(Z.reporter==="junit"){let W=Y0.join(Xd.tmpdir(),`stx-test-report-${Date.now()}.xml`);Y.push("--reporter",Z.reporter),Y.push("--reporter-outfile",W)}else console.warn(`Warning: Reporter '${Z.reporter}' is not supported. Using default reporter.`);if(Z.coverage)Y.push("--coverage");if(Z.watch)Y.push("--watch");Y.push("--preload",Y0.join(__dirname,"../../../test-utils/happy-dom.ts"));let J={...v.env,STX_TEST_MODE:"true",STX_TEST_UI:Z.ui?"true":"false",STX_TEST_VERBOSE:Z.verbose?"true":"false"},Q="bun";if(Z.verbose)console.log(`Running: ${Q} ${Y.join(" ")}`);let G=performance.now(),K=HR(Q,Y,{stdio:"inherit",shell:!1,env:J});return new Promise((W)=>{K.on("close",(U)=>{let _=((performance.now()-G)/1000).toFixed(2);if(U===0)W(!0);else W(!1)}),v.on("SIGINT",()=>{console.log(`
|
|
22448
|
-
Test run interrupted`),K.kill("SIGINT"),v.exit(1)})})}catch(Y){return console.error("Error running tests:",Y instanceof Error?Y.message:String(Y)),!1}}var
|
|
22448
|
+
${Y} `)}]`:"";return`Craft.create("${$.zigType}", ${J}${G})`}function ah($,Z,Y){if(Z.target==="universal"){let X=[];X.push("// Universal entry point"),X.push("");for(let[J,Q]of Y)X.push(`// --- ${J.toUpperCase()} ---`),X.push(`#if ${J.toUpperCase()}`),X.push(Q),X.push("#endif"),X.push("");return X.join(`
|
|
22449
|
+
`)}return Y.get(Z.target)||fU($,Z)}function sh($,Z,Y){let X=[];function J(Q){X.push({name:Q.zigType,hash:UR(JSON.stringify(Q.props)),props:Object.keys(Q.props),events:Array.from(Q.events.keys()),slots:[],isNative:Q.zigType.startsWith("craft.")});for(let G of Q.children)J(G)}return J(Z),{version:"1.0.0",components:X,entry:$.id,assets:[],styles:$.styles}}function oh($,Z){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}function WR(){return`id_${++th}`}function UR($){let Z=0;for(let Y=0;Y<$.length;Y++){let X=$.charCodeAt(Y);Z=(Z<<5)-Z+X,Z=Z&Z}return Math.abs(Z).toString(36)}function eh($){return $.charAt(0).toUpperCase()+$.slice(1)}function $d($){let Z=[],Y=/<script[^>]*>([\s\S]*?)<\/script>/gi,X;while((X=Y.exec($))!==null)Z.push(X[1]);return Z}function Zd($){let Z=[],Y=/<style[^>]*>([\s\S]*?)<\/style>/gi,X;while((X=Y.exec($))!==null)Z.push(X[1]);return Z}function gU($){let Z=$.type==="component"?1:0;if($.children)for(let Y of $.children)Z+=gU(Y);return Z}function hU($){let Z=$.zigType.startsWith("craft.")?1:0;for(let Y of $.children)Z+=hU(Y);return Z}function zR($){return{start:async()=>{console.log("[craft-compiler] Hot reload server started")},stop:async()=>{console.log("[craft-compiler] Hot reload server stopped")},notifyChange:(Z)=>{console.log(`[craft-compiler] File changed: ${Z}`)}}}var dU,th=0,Yd,Xd;var BR=D(()=>{dU=new Map([["craft-button",{name:"Button",zigType:"craft.Button",props:[{name:"variant",type:"string",required:!1,default:"primary"},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onclick",type:"callback",required:!1}],children:"single"}],["craft-text-input",{name:"TextInput",zigType:"craft.TextInput",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-textarea",{name:"TextArea",zigType:"craft.TextArea",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"rows",type:"number",required:!1,default:3},{name:"disabled",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-checkbox",{name:"Checkbox",zigType:"craft.Checkbox",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"label",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-select",{name:"Select",zigType:"craft.Select",props:[{name:"value",type:"string",required:!1},{name:"options",type:"array",required:!0},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-slider",{name:"Slider",zigType:"craft.Slider",props:[{name:"value",type:"number",required:!1,default:0},{name:"min",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"step",type:"number",required:!1,default:1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-toggle",{name:"Toggle",zigType:"craft.Toggle",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-modal",{name:"Modal",zigType:"craft.Modal",props:[{name:"open",type:"boolean",required:!1,default:!1},{name:"title",type:"string",required:!1},{name:"closable",type:"boolean",required:!1,default:!0},{name:"onclose",type:"callback",required:!1}],children:"multiple"}],["craft-alert",{name:"Alert",zigType:"craft.Alert",props:[{name:"variant",type:"string",required:!1,default:"info"},{name:"title",type:"string",required:!1},{name:"dismissible",type:"boolean",required:!1,default:!1}],children:"single"}],["craft-progress",{name:"ProgressBar",zigType:"craft.ProgressBar",props:[{name:"value",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"indeterminate",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-spinner",{name:"Spinner",zigType:"craft.Spinner",props:[{name:"size",type:"number",required:!1,default:24}],children:"none"}],["craft-avatar",{name:"Avatar",zigType:"craft.Avatar",props:[{name:"src",type:"string",required:!1},{name:"alt",type:"string",required:!1},{name:"size",type:"number",required:!1,default:40}],children:"none"}],["craft-badge",{name:"Badge",zigType:"craft.Badge",props:[{name:"variant",type:"string",required:!1,default:"default"}],children:"single"}],["craft-card",{name:"Card",zigType:"craft.Card",props:[{name:"padding",type:"number",required:!1,default:16}],children:"multiple"}],["craft-sidebar",{name:"Sidebar",zigType:"craft.NativeSidebar",props:[{name:"id",type:"string",required:!1},{name:"variant",type:"string",required:!1,default:"desktop"},{name:"material",type:"string",required:!1,default:"sidebar"},{name:"backgroundEffect",type:"string",required:!1,default:"shimmer"},{name:"allowsVibrancy",type:"boolean",required:!1,default:!0},{name:"materialOpacity",type:"number",required:!1,default:0.68},{name:"minWidth",type:"number",required:!1,default:240},{name:"maxWidth",type:"number",required:!1,default:340},{name:"canCollapse",type:"boolean",required:!1,default:!0},{name:"selectedItem",type:"string",required:!1},{name:"sections",type:"array",required:!1}],children:"multiple",platform:["macos"],fallback:"aside"}],["craft-sidebar-section",{name:"SidebarSection",zigType:"craft.NativeSidebarSection",props:[{name:"id",type:"string",required:!0},{name:"title",type:"string",required:!1},{name:"header",type:"string",required:!1}],children:"multiple",platform:["macos"],fallback:"section"}],["craft-sidebar-item",{name:"SidebarItem",zigType:"craft.NativeSidebarItem",props:[{name:"id",type:"string",required:!0},{name:"label",type:"string",required:!0},{name:"icon",type:"string",required:!1},{name:"badge",type:"string",required:!1},{name:"tintColor",type:"color",required:!1}],children:"none",platform:["macos"],fallback:"button"}],["craft-accordion",{name:"Accordion",zigType:"craft.Accordion",props:[{name:"title",type:"string",required:!0},{name:"open",type:"boolean",required:!1,default:!1}],children:"multiple"}],["craft-tabs",{name:"TabView",zigType:"craft.TabView",props:[{name:"activeTab",type:"number",required:!1,default:0},{name:"ontabchange",type:"callback",required:!1}],children:"multiple"}],["craft-tooltip",{name:"Tooltip",zigType:"craft.Tooltip",props:[{name:"content",type:"string",required:!0},{name:"position",type:"string",required:!1,default:"top"}],children:"single"}],["craft-date-picker",{name:"DatePicker",zigType:"craft.DatePicker",props:[{name:"value",type:"string",required:!1},{name:"min",type:"string",required:!1},{name:"max",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-time-picker",{name:"TimePicker",zigType:"craft.TimePicker",props:[{name:"value",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-color-picker",{name:"ColorPicker",zigType:"craft.ColorPicker",props:[{name:"value",type:"color",required:!1,default:"#000000"},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-data-table",{name:"DataTable",zigType:"craft.DataTable",props:[{name:"data",type:"array",required:!0},{name:"columns",type:"array",required:!0},{name:"sortable",type:"boolean",required:!1,default:!1},{name:"paginated",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-virtual-list",{name:"VirtualList",zigType:"craft.VirtualList",props:[{name:"items",type:"array",required:!0},{name:"itemHeight",type:"number",required:!1,default:48},{name:"renderItem",type:"callback",required:!0}],children:"none"}],["craft-tree-view",{name:"TreeView",zigType:"craft.TreeView",props:[{name:"data",type:"object",required:!0},{name:"expandable",type:"boolean",required:!1,default:!0}],children:"none"}]]);Yd={compileToNative:YR,createHotReloadServer:zR,NATIVE_COMPONENTS:dU},Xd=Yd});import{spawn as HR}from"child_process";import f0 from"fs";import Jd from"os";import Y0 from"path";import v from"process";import{CLI as Qd}from"@stacksjs/clapp";var D6="0.2.128";j$();jU();AK();kK();r4();EK();OK();JU();var __dirname="/home/runner/work/stx/stx/packages/stx/bin",V0=new Qd("stx");function qR($){let Z=typeof $==="string"?Number.parseInt($,10):$;if(Number.isNaN(Z))return{isValid:!1,error:"Port must be a valid number",suggestion:"Try using a number between 1024 and 65535"};if(Z<1024||Z>65535)return{isValid:!1,error:"Port must be between 1024 and 65535",suggestion:"Try using a port between 1024 and 65535"};return{isValid:!0}}function jR($){try{if(!f0.existsSync($)){let Y=Y0.dirname($),X=Y0.basename($);if(f0.existsSync(Y)){let Q=f0.readdirSync(Y).filter((K)=>K.toLowerCase().includes(X.toLowerCase().substring(0,3))||K.endsWith(".stx")||K.endsWith(".md")),G=Q.length>0?`File not found. Similar files in ${Y}: ${Q.slice(0,3).join(", ")}`:`File not found. Directory ${Y} exists but doesn't contain the specified file.`;return{isValid:!1,error:`File does not exist: ${$}`,suggestion:G}}return{isValid:!1,error:`File does not exist: ${$}`,suggestion:"Check the file path and try again"}}if(f0.statSync($).isDirectory())return{isValid:!1,error:`Expected file but got directory: ${$}`,suggestion:"Specify a .stx or .md file path"};return{isValid:!0}}catch(Z){return{isValid:!1,error:`Cannot access file: ${$}`,suggestion:"Check file permissions and path"}}}function uU($){let Z=typeof $==="string"?Number.parseInt($,10):$;if(Number.isNaN(Z))return{isValid:!1,error:"Timeout must be a valid number",suggestion:"Specify timeout in milliseconds (e.g., 5000 for 5 seconds)"};if(Z<100)return{isValid:!1,error:"Timeout too short (minimum 100ms)",suggestion:"Use a timeout of at least 100ms"};if(Z>300000)return{isValid:!1,error:"Timeout too long (maximum 5 minutes)",suggestion:"Use a timeout of less than 300000ms (5 minutes)"};return{isValid:!0}}var e5=($)=>$.includes("*")||$.includes("?")||$.includes("{")||$.includes("["),Gd=($)=>$.endsWith(".stx")||$.endsWith(".md");function t5($,Z=1){if(console.error(`\u274C ${$.error}`),$.suggestion)console.error(`\uD83D\uDCA1 suggestion: ${$.suggestion}`);v.exit(Z)}function Kd($){if(!$)return;let Z;try{Z=JSON.parse($)}catch(Y){console.error(`\u274C --info-plist is not valid JSON: ${Y.message}`),v.exit(1)}if(typeof Z!=="object"||Z===null||Array.isArray(Z))console.error(`\u274C --info-plist must be a JSON object, e.g. '{"NSFocusStatusUsageDescription":"\u2026"}'`),v.exit(1);for(let[Y,X]of Object.entries(Z))if(typeof X!=="string"&&typeof X!=="number"&&typeof X!=="boolean")console.error(`\u274C --info-plist value for "${Y}" must be a string, number or boolean`),v.exit(1);return Z}async function Wd($,Z){try{let Y=["test"],X=[];if($&&$.length>0)for(let W of $)if(e5(W))try{let U=await Array.fromAsync(new Bun.Glob(W).scan({onlyFiles:!0,absolute:!0}));if(U.length===0)console.warn(`Warning: No files found matching pattern: ${W}`);else if(X.push(...U),Z.verbose)console.log(`Found ${U.length} file(s) matching pattern: ${W}`)}catch(U){return console.error(`Error expanding glob pattern ${W}:`,U),!1}else X.push(W);if(X.length===0)return console.error("Error: No test files found matching the provided patterns."),!1;if(Y.push(...X),Z.filter)Y.push("--pattern",Z.filter);if(Z.timeout)Y.push("--timeout",Z.timeout.toString());if(Z.reporter&&Z.reporter!=="default")if(Z.reporter==="junit"){let W=Y0.join(Jd.tmpdir(),`stx-test-report-${Date.now()}.xml`);Y.push("--reporter",Z.reporter),Y.push("--reporter-outfile",W)}else console.warn(`Warning: Reporter '${Z.reporter}' is not supported. Using default reporter.`);if(Z.coverage)Y.push("--coverage");if(Z.watch)Y.push("--watch");Y.push("--preload",Y0.join(__dirname,"../../../test-utils/happy-dom.ts"));let J={...v.env,STX_TEST_MODE:"true",STX_TEST_UI:Z.ui?"true":"false",STX_TEST_VERBOSE:Z.verbose?"true":"false"},Q="bun";if(Z.verbose)console.log(`Running: ${Q} ${Y.join(" ")}`);let G=performance.now(),K=HR(Q,Y,{stdio:"inherit",shell:!1,env:J});return new Promise((W)=>{K.on("close",(U)=>{let _=((performance.now()-G)/1000).toFixed(2);if(U===0)W(!0);else W(!1)}),v.on("SIGINT",()=>{console.log(`
|
|
22450
|
+
Test run interrupted`),K.kill("SIGINT"),v.exit(1)})})}catch(Y){return console.error("Error running tests:",Y instanceof Error?Y.message:String(Y)),!1}}var Ud=v.argv.length>=3&&(Gd(v.argv[2])&&f0.existsSync(v.argv[2])||e5(v.argv[2]));if(Ud){let $=v.argv[2],Z={port:3000,watch:!0,cache:!0,markdown:{syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}}};for(let Y=3;Y<v.argv.length;Y++){let X=v.argv[Y];if(X==="--port"&&Y+1<v.argv.length){let J=qR(v.argv[++Y]);if(!J.isValid)t5(J);Z.port=Number.parseInt(v.argv[Y],10)}else if(X==="--no-watch")Z.watch=!1;else if(X==="--highlight-theme"&&Y+1<v.argv.length){if(!Z.markdown)Z.markdown={};if(!Z.markdown.syntaxHighlighting)Z.markdown.syntaxHighlighting={};Z.markdown.syntaxHighlighting.defaultTheme=v.argv[++Y]}else if(X==="--no-highlight"){if(!Z.markdown)Z.markdown={};if(!Z.markdown.syntaxHighlighting)Z.markdown.syntaxHighlighting={};Z.markdown.syntaxHighlighting.enabled=!1}else if(X==="--no-highlight-unknown"){if(!Z.markdown)Z.markdown={};if(!Z.markdown.syntaxHighlighting)Z.markdown.syntaxHighlighting={};Z.markdown.syntaxHighlighting.highlightUnknownLanguages=!1}else if(X==="--no-cache")Z.cache=!1;else if(X==="--native")Z.native=!0}if(e5($))try{let Y=await Array.fromAsync(new Bun.Glob($).scan({onlyFiles:!0,absolute:!0})),X=$.endsWith(".stx")?Y.filter((K)=>K.endsWith(".stx")):$.endsWith(".md")?Y.filter((K)=>K.endsWith(".md")):Y.filter((K)=>K.endsWith(".stx")||K.endsWith(".md")),J=$.split("*")[0].replace(/\/$/,"")||".",Q=Y0.resolve(J);try{let K=new Bun.Glob("**/*.stx"),U=(await Array.fromAsync(K.scan({cwd:Q,onlyFiles:!0,absolute:!0}))).filter((z)=>/\[.+\]/.test(Y0.basename(z)));for(let z of U)if(!X.includes(z))X.push(z)}catch{}if(X.length===0)console.error(`Error: No STX or Markdown files found matching pattern: ${$}`),v.exit(1);if(!await N3(X,Z))v.exit(1)}catch(Y){console.error("Failed to process files:",Y),v.exit(1)}else w3($,Z).catch((Y)=>{console.error("Failed to start dev server:",Y),v.exit(1)})}else{let $=function(X,J){let Q=[];for(let G=0;G<=J.length;G++)Q[G]=[G];for(let G=0;G<=X.length;G++)Q[0][G]=G;for(let G=1;G<=J.length;G++)for(let K=1;K<=X.length;K++)if(J.charAt(G-1)===X.charAt(K-1))Q[G][K]=Q[G-1][K-1];else Q[G][K]=Math.min(Q[G-1][K-1]+1,Q[G][K-1]+1,Q[G-1][K]+1);return Q[J.length][X.length]};V0.command("docs","Generate documentation for components, templates, and directives").option("--output <dir>","Output directory for documentation",{default:"docs"}).option("--format <format>","Documentation format (markdown, html, json)",{default:"markdown"}).option("--components-dir <dir>","Components directory",{default:"components"}).option("--templates-dir <dir>","Templates directory",{default:"."}).option("--no-components","Disable components documentation").option("--no-templates","Disable templates documentation").option("--no-directives","Disable directives documentation").option("--extra-content <content>","Extra content to include in documentation").example("stx docs --output docs --format html").action(async(X)=>{try{if(await FK(X))console.log("Documentation generated successfully."),v.exit(0);else console.error("Documentation generation failed."),v.exit(1)}catch(J){console.error("Error generating documentation:",J),v.exit(1)}}),V0.command("iconify <command>","Generate Iconify icon packages").option("--output <dir>","Output directory for generated packages",{default:"packages"}).option("--icons <icons>","Comma-separated list of specific icons to generate").example("stx iconify list").example("stx iconify generate mdi").example("stx iconify generate lucide --icons home,settings,user").action(async(X,J)=>{try{let{fetchCollections:Q,generatePackage:G}=await import("@stacksjs/iconify-generator");if(X==="list"){console.log(`
|
|
22449
22451
|
\uD83D\uDCDA Fetching available icon collections...
|
|
22450
22452
|
`);let K=await Q(),W=Object.entries(K).sort((U,z)=>z[1].total-U[1].total);console.log(`Available collections:
|
|
22451
22453
|
`);for(let[U,z]of W){let _=z;console.log(` ${U.padEnd(30)} ${_.name} (${_.total} icons)`)}console.log(`
|
|
@@ -22522,7 +22524,7 @@ Total: ${W} issues in ${K} files`),J.output){let U=`
|
|
|
22522
22524
|
`),v.exit(1);console.log(" To preview locally:"),console.log(` cd ${J.out||"dist"} && npx serve
|
|
22523
22525
|
`)}}catch(Q){console.error(`
|
|
22524
22526
|
Build failed:`,Q instanceof Error?Q.message:String(Q)),v.exit(1)}}),V0.command("start","Start the production server (serves pre-built .output/)").option("--port <number>","Server port",{default:"3000"}).option("--output <dir>","Output directory from stx build",{default:".output"}).example("stx start").example("stx start --port 8080").action(async(X)=>{try{let J=Y0.resolve(X.output);if(!f0.existsSync(Y0.join(J,"manifest.json")))console.error("\n No production build found. Run `stx build --out .output` first.\n"),v.exit(1);let{startProductionServer:Q}=await Promise.resolve().then(() => (yK(),jF));await Q({outputDir:J,port:Number.parseInt(X.port,10)||3000})}catch(J){console.error(`
|
|
22525
|
-
Failed to start production server:`,J instanceof Error?J.message:String(J)),v.exit(1)}}),V0.command("deploy [directory]","Deploy built site to Netlify").option("--site-id <id>","Netlify site ID (or set NETLIFY_SITE_ID env var)").option("--token <token>","Auth token (or set NETLIFY_AUTH_TOKEN env var)").option("--production","Deploy to production (default: draft preview)").option("--message <msg>","Deploy message/title").option("--no-build","Skip build step before deploy").option("--open","Open deployed URL in browser").option("--dry-run","Preview deployment without uploading").option("--init","Initialize Netlify configuration for this project").example("stx deploy").example("stx deploy --production").example("stx deploy dist --site-id my-site-abc123").example("stx deploy --init").example("stx deploy --dry-run").action(async(X,J)=>{try{let{deploy:Q,initNetlify:G,DeployError:K}=await Promise.resolve().then(() => (KX(),ZL));if(console.log(`\x1B[1mstx deploy\x1B[0m \x1B[2mv${
|
|
22527
|
+
Failed to start production server:`,J instanceof Error?J.message:String(J)),v.exit(1)}}),V0.command("deploy [directory]","Deploy built site to Netlify").option("--site-id <id>","Netlify site ID (or set NETLIFY_SITE_ID env var)").option("--token <token>","Auth token (or set NETLIFY_AUTH_TOKEN env var)").option("--production","Deploy to production (default: draft preview)").option("--message <msg>","Deploy message/title").option("--no-build","Skip build step before deploy").option("--open","Open deployed URL in browser").option("--dry-run","Preview deployment without uploading").option("--init","Initialize Netlify configuration for this project").example("stx deploy").example("stx deploy --production").example("stx deploy dist --site-id my-site-abc123").example("stx deploy --init").example("stx deploy --dry-run").action(async(X,J)=>{try{let{deploy:Q,initNetlify:G,DeployError:K}=await Promise.resolve().then(() => (KX(),ZL));if(console.log(`\x1B[1mstx deploy\x1B[0m \x1B[2mv${D6}\x1B[0m`),J.init){console.log(`
|
|
22526
22528
|
\uD83D\uDCDD Initializing Netlify configuration...
|
|
22527
22529
|
`);let U=await G({directory:X||v.cwd(),siteId:J.siteId});if(console.log(`\u2713 Created ${U.configPath}`),U.siteId)console.log("\u2713 Saved site ID to .env.local");console.log(`
|
|
22528
22530
|
You can now deploy with: stx deploy`);return}if(J.build!==!1){if(console.log(`
|
|
@@ -22534,7 +22536,7 @@ You can now deploy with: stx deploy`);return}if(J.build!==!1){if(console.log(`
|
|
|
22534
22536
|
`),console.log(` ${J.dryRun?"Would deploy":"Draft URL"}: ${W.url}`),W.siteUrl)console.log(` Site URL: ${W.siteUrl}`);if(!J.dryRun)console.log(`
|
|
22535
22537
|
Deploy ID: ${W.deployId}`),console.log(` Duration: ${(W.duration/1000).toFixed(1)}s`),console.log(` Files: ${W.filesUploaded}`)}}catch(Q){if(Q instanceof Error&&Q.name==="DeployError")console.error(`
|
|
22536
22538
|
\u274C ${Q.message}`),v.exit(1);console.error(`
|
|
22537
|
-
\u274C Deploy failed:`,Q instanceof Error?Q.message:String(Q)),v.exit(1)}}),V0.command("images <input>","Optimize images for production").option("-o, --output <dir>","Output directory",{default:"dist/images"}).option("-w, --widths <sizes>","Output widths (comma-separated)",{default:"320,640,768,1024,1280,1536,1920"}).option("-f, --formats <types>","Output formats (comma-separated)",{default:"webp,jpeg"}).option("-q, --quality <n>","Output quality (1-100)",{default:"80"}).option("--placeholder <type>","Placeholder type: blur, dominant-color, none",{default:"none"}).option("--dry-run","Preview without processing").option("--verbose","Show detailed output").example("stx images public/images").example("stx images public/images -o dist/images").example("stx images public/images --widths 640,1024,1920").example("stx images public/images --formats webp,avif").example("stx images public/images --quality 85").example("stx images public/images --dry-run").action(async(X,J)=>{try{let{optimizeDirectory:Q,isSharpAvailable:G,formatSize:K}=await Promise.resolve().then(() => (LX(),FL)),W=await import("fs"),U=await import("path");if(console.log(`\x1B[1mstx images\x1B[0m \x1B[2mv${
|
|
22539
|
+
\u274C Deploy failed:`,Q instanceof Error?Q.message:String(Q)),v.exit(1)}}),V0.command("images <input>","Optimize images for production").option("-o, --output <dir>","Output directory",{default:"dist/images"}).option("-w, --widths <sizes>","Output widths (comma-separated)",{default:"320,640,768,1024,1280,1536,1920"}).option("-f, --formats <types>","Output formats (comma-separated)",{default:"webp,jpeg"}).option("-q, --quality <n>","Output quality (1-100)",{default:"80"}).option("--placeholder <type>","Placeholder type: blur, dominant-color, none",{default:"none"}).option("--dry-run","Preview without processing").option("--verbose","Show detailed output").example("stx images public/images").example("stx images public/images -o dist/images").example("stx images public/images --widths 640,1024,1920").example("stx images public/images --formats webp,avif").example("stx images public/images --quality 85").example("stx images public/images --dry-run").action(async(X,J)=>{try{let{optimizeDirectory:Q,isSharpAvailable:G,formatSize:K}=await Promise.resolve().then(() => (LX(),FL)),W=await import("fs"),U=await import("path");if(console.log(`\x1B[1mstx images\x1B[0m \x1B[2mv${D6}\x1B[0m`),!await G())console.error(`
|
|
22538
22540
|
\u274C sharp is required for image optimization.`),console.log(`
|
|
22539
22541
|
Install sharp with:`),console.log(" bun add sharp"),v.exit(1);let _=J.widths.split(",").map((L)=>Number.parseInt(L.trim(),10)).filter((L)=>!Number.isNaN(L)),B=J.formats.split(",").map((L)=>L.trim().toLowerCase()),q=Number.parseInt(J.quality,10)||80,j=J.placeholder,H=U.resolve(X);if(!W.existsSync(H))console.error(`
|
|
22540
22542
|
\u274C Input directory not found: ${H}`),v.exit(1);if(!W.statSync(H).isDirectory())console.error(`
|
|
@@ -22547,13 +22549,13 @@ Would generate ~${A} image variants`);return}console.log(`
|
|
|
22547
22549
|
`);let V=await Q(H,J.output,{widths:_,formats:B,quality:q,placeholder:j,verbose:J.verbose});if(console.log(`
|
|
22548
22550
|
\u2713 Optimization complete!
|
|
22549
22551
|
`),console.log(` Images processed: ${V.stats.optimizedImages}/${V.stats.totalImages}`),console.log(` Variants created: ${V.stats.variants}`),V.stats.savedBytes>0)console.log(` Estimated savings: ~${K(V.stats.savedBytes)}`)}catch(Q){console.error(`
|
|
22550
|
-
\u274C Image optimization failed:`,Q instanceof Error?Q.message:String(Q)),v.exit(1)}}),V0.command("bundle [directory]","Analyze bundle size and composition").option("-o, --output <file>","Output file path").option("--json","Output as JSON").option("--text","Output as text summary").option("--markdown","Output as Markdown").option("--no-open","Do not open HTML report in browser").option("--no-gzip","Do not show gzip sizes").option("--threshold <size>","Fail if total size exceeds threshold (e.g., 500KB, 1MB)").option("--top <n>","Number of top modules to show",{default:"20"}).example("stx bundle").example("stx bundle dist/").example("stx bundle dist/ --json").example("stx bundle dist/ --text").example("stx bundle dist/ --threshold 500KB").example("stx bundle dist/ --no-open").action(async(X,J)=>{try{let{analyze:Q,formatBytes:G,parseSize:K}=await Promise.resolve().then(() => (Dw(),Iw)),W=await import("path");console.log(`\x1B[1mstx bundle\x1B[0m \x1B[2mv${
|
|
22552
|
+
\u274C Image optimization failed:`,Q instanceof Error?Q.message:String(Q)),v.exit(1)}}),V0.command("bundle [directory]","Analyze bundle size and composition").option("-o, --output <file>","Output file path").option("--json","Output as JSON").option("--text","Output as text summary").option("--markdown","Output as Markdown").option("--no-open","Do not open HTML report in browser").option("--no-gzip","Do not show gzip sizes").option("--threshold <size>","Fail if total size exceeds threshold (e.g., 500KB, 1MB)").option("--top <n>","Number of top modules to show",{default:"20"}).example("stx bundle").example("stx bundle dist/").example("stx bundle dist/ --json").example("stx bundle dist/ --text").example("stx bundle dist/ --threshold 500KB").example("stx bundle dist/ --no-open").action(async(X,J)=>{try{let{analyze:Q,formatBytes:G,parseSize:K}=await Promise.resolve().then(() => (Dw(),Iw)),W=await import("path");console.log(`\x1B[1mstx bundle\x1B[0m \x1B[2mv${D6}\x1B[0m`);let U=X||"dist",z=W.resolve(U);if(!(await import("fs")).existsSync(z))console.error(`
|
|
22551
22553
|
\u274C Directory not found: ${z}`),console.log("\nRun `stx build` first to generate build output."),v.exit(1);let B="html";if(J.json)B="json";else if(J.text)B="text";else if(J.markdown)B="markdown";console.log(`
|
|
22552
22554
|
\uD83D\uDCE6 Analyzing: ${z}`);let q=await Q({directory:z,output:J.output,format:B,open:J.open!==!1&&B==="html",gzip:J.gzip!==!1,threshold:J.threshold,topModules:Number.parseInt(J.top||"20",10),recommendations:!0});if(B==="html"){if(console.log(`
|
|
22553
22555
|
\u2713 Report generated: ${q.outputPath}`),J.open!==!1)console.log(" Opening in browser...")}else console.log(q.report);if(q.exceedsThreshold){let j=J.threshold;console.error(`
|
|
22554
22556
|
\u274C Bundle size (${G(q.stats.totalSize)}) exceeds threshold (${j})`),v.exit(1)}if(B==="html"){if(console.log(`
|
|
22555
22557
|
\uD83D\uDCCA Summary:`),console.log(` Total Size: ${G(q.stats.totalSize)}`),console.log(` Gzip Size: ${G(q.stats.totalGzipSize)}`),console.log(` Modules: ${q.stats.moduleCount}`),console.log(` Chunks: ${q.stats.chunks.length}`),q.stats.duplicates.length>0)console.log(` Duplicates: ${q.stats.duplicates.length}`)}}catch(Q){console.error(`
|
|
22556
|
-
\u274C Bundle analysis failed:`,Q instanceof Error?Q.message:String(Q)),v.exit(1)}}),V0.command("test [patterns...]","Run tests with Bun test runner and browser environment").option("--watch","Watch for changes and rerun tests").option("--filter <pattern>","Only run tests matching the given pattern").option("--reporter <reporter>","Test reporter to use: default or junit (junit requires Bun v1.0+)",{default:"default"}).option("--timeout <ms>","Test timeout in milliseconds",{default:5000}).option("--coverage","Enable code coverage").option("--ui","Coming soon").option("--verbose","Show verbose output including test command").example("stx test").example("stx test packages/stx/test/").example("stx test **/*.test.ts --verbose").example('stx test --filter "should process"').example("stx test --watch --verbose").example("stx test --reporter junit").action(async(X,J)=>{try{if(console.log(`\x1B[1mstx test\x1B[0m \x1B[2mv${
|
|
22558
|
+
\u274C Bundle analysis failed:`,Q instanceof Error?Q.message:String(Q)),v.exit(1)}}),V0.command("test [patterns...]","Run tests with Bun test runner and browser environment").option("--watch","Watch for changes and rerun tests").option("--filter <pattern>","Only run tests matching the given pattern").option("--reporter <reporter>","Test reporter to use: default or junit (junit requires Bun v1.0+)",{default:"default"}).option("--timeout <ms>","Test timeout in milliseconds",{default:5000}).option("--coverage","Enable code coverage").option("--ui","Coming soon").option("--verbose","Show verbose output including test command").example("stx test").example("stx test packages/stx/test/").example("stx test **/*.test.ts --verbose").example('stx test --filter "should process"').example("stx test --watch --verbose").example("stx test --reporter junit").action(async(X,J)=>{try{if(console.log(`\x1B[1mstx test\x1B[0m \x1B[2mv${D6} (${xK})\x1B[0m`),J.timeout){let K=uU(J.timeout);if(!K.isValid)t5(K)}let Q=typeof X==="string"?[X]:X||[];if(Q.length===0)Q.push("**/*.test.ts","**/*.test.js","**/*.spec.ts","**/*.spec.js");if(J.verbose)console.log("Test patterns:",Q),console.log("Options:",JSON.stringify({watch:J.watch||!1,filter:J.filter||"none",reporter:J.reporter||"default",timeout:J.timeout||5000,coverage:J.coverage||!1,ui:J.ui||!1},null,2));if(!await c1.timeAsync("test-execution",()=>Wd(Q,J))&&!J.watch)v.exit(1)}catch(Q){console.error("Error running tests:",Q),v.exit(1)}}),V0.command("init [file]","Create a new STX file").alias("new").option("--force","Overwrite existing file").option("--template <file>","Path to a template file to use as a base").example("stx init").example("stx init page.stx").example("stx new contact.stx").example("stx new components/button.stx --template examples/components/button.stx").action(async(X="index.stx",J)=>{try{if(await DK(X,{force:J.force,template:J.template}))console.log(`
|
|
22557
22559
|
\u2728 Successfully created file: ${X}`),console.log(`
|
|
22558
22560
|
To view it in the development server:`),console.log(` stx dev ${X}
|
|
22559
22561
|
`);else console.error(`
|
|
@@ -22585,9 +22587,9 @@ Press Ctrl+C to stop watching...
|
|
|
22585
22587
|
\uD83D\uDCC4 Files with issues:`),_.forEach((B)=>{let q=B.issues.filter((j)=>K[j.type]>=W).length;if(q>0)console.log(` ${Y0.relative(v.cwd(),B.file)} (${q} issues)`)});if(J.saveReport){let B={summary:z,results:_,generatedAt:new Date().toISOString(),commandOptions:J};await Bun.write(J.saveReport,JSON.stringify(B,null,2)),console.log(`
|
|
22586
22588
|
\uD83D\uDCCB Analysis report saved to: ${J.saveReport}`)}console.log(`
|
|
22587
22589
|
\u2728 Analysis complete! Use --detailed for more information.`)}catch(Q){console.error("Error analyzing templates:",Q),v.exit(1)}}),V0.command("screenshot [input]","Capture PNG screenshot(s) of page(s) via Bun WebView \u2014 a file, URL, or dist directory").option("--out <dir>","Output directory",{default:"screenshots"}).option("--width <px>","Viewport width",{default:"1440"}).option("--height <px>","Viewport height",{default:"2200"}).option("--wait <ms>","Settle time after navigation before capture",{default:"800"}).option("--timeout <ms>","Hard cap on waiting for navigation",{default:"15000"}).option("--full-page","Capture the entire scrollable page, not just the viewport").option("--wait-selector <sel>","Wait until a CSS selector exists before capturing").option("--format <fmt>","Image format: png | jpeg | webp",{default:"png"}).option("--backend <name>","WebView backend: webkit (macOS, default) | chrome").action(async(X,J)=>{let{captureScreenshots:Q}=await Promise.resolve().then(() => (MK(),eV)),G=X||"dist";try{let K=await Q(G,J.out,{width:Number.parseInt(J.width,10),height:Number.parseInt(J.height,10),waitMs:Number.parseInt(J.wait,10),timeoutMs:Number.parseInt(J.timeout,10),fullPage:Boolean(J.fullPage),waitSelector:J.waitSelector,format:J.format,backend:J.backend});for(let W of K)console.log(`\uD83D\uDCF8 ${W.output} (${(W.bytes/1024).toFixed(0)} KB)`);console.log(`
|
|
22588
|
-
\u2728 Captured ${K.length} screenshot(s) to ${J.out}/ via Bun WebView`)}catch(K){console.error(`Screenshot failed: ${K.message}`),v.exit(1)}}),V0.command("version","Show the version of the CLI").action(()=>{console.log(
|
|
22590
|
+
\u2728 Captured ${K.length} screenshot(s) to ${J.out}/ via Bun WebView`)}catch(K){console.error(`Screenshot failed: ${K.message}`),v.exit(1)}}),V0.command("version","Show the version of the CLI").action(()=>{console.log(D6)}),V0.command("interactive","Start interactive REPL mode for template development").alias("i").option("--context <file>","Load initial context from JSON file").option("--cwd <directory>","Set working directory").option("--verbose","Show verbose output").action(async(X)=>{let{startInteractive:J}=await Promise.resolve().then(() => (SK(),KF)),Q={};if(X.context){let G=Y0.resolve(X.context);if(f0.existsSync(G))try{let K=f0.readFileSync(G,"utf-8");Q=JSON.parse(K)}catch(K){console.error("Error loading context file:",K),v.exit(1)}else console.error(`Context file not found: ${G}`),v.exit(1)}await J({context:Q,cwd:X.cwd?Y0.resolve(X.cwd):v.cwd(),verbose:X.verbose})}),V0.command("build:native <input>","Build stx template into a native desktop/mobile app").option("--output <dir>","Output directory",{default:"dist/native"}).option("--target <platform>","Target platform: macos, windows, linux, ios, android").option("--format <format>","Output format: app, dmg, pkg, msi, zip, deb, rpm, appimage, ipa, apk").option("--name <name>","Application name (defaults to filename)").option("--version <version>","Application version",{default:"1.0.0"}).option("--description <desc>","Application description").option("--author <author>","Author/Maintainer name").option("--bundle-id <id>","Bundle identifier (macOS/iOS)").option("--icon <path>","Path to application icon").option("--width <width>","Window width",{default:"1200"}).option("--height <height>","Window height",{default:"800"}).option("--title <title>","Window title").option("--system-tray","Enable system tray/menubar mode").option("--menubar-only","Run without a dock icon (implied by --system-tray)").option("--category <type>","LSApplicationCategoryType (macOS)").option("--copyright <text>","NSHumanReadableCopyright (macOS)").option("--min-system-version <v>","LSMinimumSystemVersion (macOS)").option("--info-plist <json>","Extra Info.plist keys as a JSON object (macOS)").option("--dev-tools","Enable developer tools").option("--frameless","Create frameless window").option("--always-on-top","Keep window always on top").option("--craft-path <path>","Path to Craft binary").option("--verbose","Show verbose output").example("stx build:native app.stx --target macos").example("stx build:native app.stx --target macos --format dmg").example("stx build:native app.stx --target linux --format appimage").example('stx build:native app.stx --name "My App" --icon icon.png').action(async(X,J)=>{try{let{buildNative:Q,getAvailableTargets:G,getAvailableFormats:K}=await Promise.resolve().then(() => (cw(),lw)),W=Y0.resolve(X);if(!f0.existsSync(W))console.error(`\u274C Input file not found: ${X}`),v.exit(1);let U=G();if(J.target&&!["macos","windows","linux","ios","android"].includes(J.target))console.error(`\u274C Invalid target: ${J.target}`),console.error("\uD83D\uDCA1 Available targets: macos, windows, linux, ios, android"),console.error(`\uD83D\uDCA1 Targets available on this machine: ${U.join(", ")}`),v.exit(1);let z=J.target||U[0],_=K(z);if(J.format&&!_.includes(J.format))console.error(`\u274C Invalid format for ${z}: ${J.format}`),console.error(`\uD83D\uDCA1 Available formats: ${_.join(", ")}`),v.exit(1);console.log(`
|
|
22589
22591
|
\uD83D\uDD28 Building native app...`),console.log(` Input: ${X}`),console.log(` Target: ${z}`),console.log(` Format: ${J.format||"default"}`),console.log(` Output: ${J.output}
|
|
22590
|
-
`);let B=await Q({input:W,output:Y0.resolve(J.output),target:z,format:J.format,name:J.name,version:J.version,description:J.description,author:J.author,bundleId:J.bundleId,icon:J.icon?Y0.resolve(J.icon):void 0,window:{title:J.title,width:Number.parseInt(J.width,10),height:Number.parseInt(J.height,10),frameless:J.frameless,alwaysOnTop:J.alwaysOnTop},systemTray:J.systemTray,menubarOnly:J.menubarOnly,category:J.category,copyright:J.copyright,minimumSystemVersion:J.minSystemVersion,infoPlist:
|
|
22592
|
+
`);let B=await Q({input:W,output:Y0.resolve(J.output),target:z,format:J.format,name:J.name,version:J.version,description:J.description,author:J.author,bundleId:J.bundleId,icon:J.icon?Y0.resolve(J.icon):void 0,window:{title:J.title,width:Number.parseInt(J.width,10),height:Number.parseInt(J.height,10),frameless:J.frameless,alwaysOnTop:J.alwaysOnTop},systemTray:J.systemTray,menubarOnly:J.menubarOnly,category:J.category,copyright:J.copyright,minimumSystemVersion:J.minSystemVersion,infoPlist:Kd(J.infoPlist),devTools:J.devTools,craftPath:J.craftPath,verbose:J.verbose});if(B.success){if(console.log("\u2705 Build successful!"),console.log(` Output: ${B.outputPath}`),B.duration)console.log(` Duration: ${(B.duration/1000).toFixed(2)}s`);if(z==="macos"&&B.format==="app")console.log(`
|
|
22591
22593
|
\uD83D\uDCA1 To run: open "${B.outputPath}"`);else if(z==="linux"&&B.format==="appimage")console.log(`
|
|
22592
22594
|
\uD83D\uDCA1 To run: chmod +x "${B.outputPath}" && "${B.outputPath}"`)}else console.error(`\u274C Build failed: ${B.error}`),v.exit(1)}catch(Q){console.error(`\u274C Build error: ${Q.message}`),v.exit(1)}}),V0.command("story","Start component showcase and testing server").option("-p, --port <port>","Server port",{default:"6006"}).option("-o, --open","Open browser automatically",{default:!1}).option("--host <host>","Host to bind to",{default:"localhost"}).example("stx story").example("stx story --port 3000 --open").action(async(X)=>{try{let{devCommand:J}=await Promise.resolve().then(() => (pN(),cN));await J({port:X.port?Number.parseInt(X.port,10):6006,open:X.open,host:X.host})}catch(J){console.error(`\u274C Story error: ${J.message}`),v.exit(1)}}),V0.command("story:build","Build static story site").option("-o, --outDir <dir>","Output directory",{default:".stx/dist/story"}).example("stx story:build").example("stx story:build --outDir ./docs/components").action(async(X)=>{try{let{buildCommand:J}=await Promise.resolve().then(() => (oN(),sN));await J({outDir:X.outDir})}catch(J){console.error(`\u274C Story build error: ${J.message}`),v.exit(1)}}),V0.command("story:test","Run visual regression tests").option("-u, --update","Update snapshots",{default:!1}).option("-f, --filter <name>","Filter components by name").example("stx story:test").example("stx story:test --update").example("stx story:test --filter Button").action(async(X)=>{try{let{createContext:J}=await Promise.resolve().then(() => (y3(),JN)),{runVisualTests:Q,updateSnapshots:G,formatTestResults:K}=await Promise.resolve().then(() => ($R(),eN)),W=await J({mode:"build"});if(X.update){let U=await G(W,{filter:X.filter?[X.filter]:void 0});console.log(`Updated ${U} snapshots`)}else{let U=await Q(W,{filter:X.filter?[X.filter]:void 0});if(console.log(K(U)),U.failed>0)v.exit(1)}}catch(J){console.error(`\u274C Story test error: ${J.message}`),v.exit(1)}}),V0.command("compile <input>","Compile stx template to native Craft component code").option("--target <platform>","Target platform: macos, windows, linux, ios, android, universal",{default:"universal"}).option("--format <format>","Output format: zig, typescript, json",{default:"zig"}).option("--output <path>","Output directory for compiled files",{default:"./dist"}).option("--optimize","Enable optimizations",{default:!0}).option("--tree-shake","Enable tree shaking",{default:!0}).option("--hot-reload","Enable hot reload support",{default:!1}).option("--sourcemaps","Generate source maps",{default:!1}).option("--bundle","Bundle all dependencies",{default:!0}).option("--minify","Minify output",{default:!1}).option("--verbose","Show detailed output",{default:!1}).example("stx compile app.stx").example("stx compile app.stx --target macos --format zig").example("stx compile app.stx --format typescript --output ./native").example("stx compile app.stx --optimize --tree-shake --minify").action(async(X,J)=>{try{let{compileToNative:Q}=await Promise.resolve().then(() => (BR(),_R)),G=Y0.resolve(X);if(!f0.existsSync(G))console.error(`\u274C Input file not found: ${X}`),v.exit(1);let K=["macos","windows","linux","ios","android","universal"];if(!K.includes(J.target))console.error(`\u274C Invalid target: ${J.target}`),console.error(`\uD83D\uDCA1 Available targets: ${K.join(", ")}`),v.exit(1);let W=["zig","typescript","json"];if(!W.includes(J.format))console.error(`\u274C Invalid format: ${J.format}`),console.error(`\uD83D\uDCA1 Available formats: ${W.join(", ")}`),v.exit(1);console.log(`
|
|
22593
22595
|
\uD83D\uDD27 Compiling stx template to native code...`),console.log(` Input: ${X}`),console.log(` Target: ${J.target}`),console.log(` Format: ${J.format}`),console.log(` Output: ${J.output}
|
|
@@ -22596,4 +22598,4 @@ Press Ctrl+C to stop watching...
|
|
|
22596
22598
|
\u26A0\uFE0F Warnings:`);for(let O of z.stats.warnings)console.log(` - ${O.message}`)}if(z.stats.errors.length>0){console.log(`
|
|
22597
22599
|
\u274C Errors:`);for(let O of z.stats.errors)console.log(` - ${O.message}`)}}catch(Q){console.error(`\u274C Compilation error: ${Q.message}`),v.exit(1)}});let Z=["docs","iconify","dev","a11y","build","components:build","start","build:native","compile","test","init","new","format","perf","debug","doctor","status","watch","analyze","version","deploy","interactive","i","story","story:build","story:test","screenshot"],Y=v.argv.slice(2);if(Y.length>0&&!Y[0].startsWith("-")){let X=Y[0];if(X==="")console.error("\u274C No command provided"),console.error("\uD83D\uDCA1 Use --help to see available commands"),v.exit(1);if(!Z.includes(X)){let J=Z0("fs"),Q=Z0("path"),G=X;if(!Q.isAbsolute(G))G=Q.resolve(v.cwd(),G);if(J.existsSync(G)){let K=J.statSync(G);if(K.isFile()||K.isDirectory())v.argv=[v.argv[0],v.argv[1],"dev",...Y]}else{let K=Z.map((U)=>({command:U,distance:$(X,U)}));K.sort((U,z)=>U.distance-z.distance);let W=K[0];if(W.distance<=3)console.error(`\u274C Unknown command: ${X}`),console.error(`\uD83D\uDCA1 Did you mean: ${W.command}?`),console.error(`
|
|
22598
22600
|
Run 'stx --help' to see available commands.`),v.exit(1);console.error(`\u274C Unknown command or path: ${X}`),console.error(`
|
|
22599
|
-
Run 'stx --help' to see available commands.`),v.exit(1)}}}V0.help(),V0.version(
|
|
22601
|
+
Run 'stx --help' to see available commands.`),v.exit(1)}}}V0.help(),V0.version(D6),V0.parse(v.argv)}
|