@stacksjs/stx 0.2.172 → 0.2.173
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 +294 -294
- package/dist/craft.js +122 -122
- package/dist/pwa.js +70 -70
- package/dist/server-bindings.js +45 -1
- package/dist/ssg.js +81 -81
- package/package.json +5 -5
package/dist/ssg.js
CHANGED
|
@@ -2539,7 +2539,7 @@ catch (e) {
|
|
|
2539
2539
|
}
|
|
2540
2540
|
throw e;
|
|
2541
2541
|
}
|
|
2542
|
-
`),Y.set(W,K)}return K(...w)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:Q,context:X.slice()});return Q}clear(){this.pool.length=0,this.fnCache.clear()}}class g6{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,X){this.budgets.set($,{warnThreshold:0.8,action:"warn",...X})}setBudgets($){for(let[X,Z]of Object.entries($))this.setBudget(X,Z)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[X,Z]of this.budgets.entries())$[X]=Z;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let X=this.violationHandlers.indexOf($);if(X!==-1)this.violationHandlers.splice(X,1)}time($,X){if(!this.enabled)return X();let Z=performance.now(),J=X(),Y=performance.now()-Z;return this.recordTime($,Y),this.checkBudget($,Y),J}async timeAsync($,X){if(!this.enabled)return X();let Z=performance.now(),J=await X(),Y=performance.now()-Z;return this.recordTime($,Y),this.checkBudget($,Y),J}checkBudget($,X){let Z=this.budgets.get($);if(!Z)return;let J=X/Z.maxTime*100,Y=Z.warnThreshold!==void 0?X>=Z.maxTime*Z.warnThreshold&&X<Z.maxTime:!1,G=X>=Z.maxTime;if(!Y&&!G)return;let Q={label:$,actualTime:X,budgetTime:Z.maxTime,exceedancePercent:J,timestamp:new Date,isWarning:Y};this.violations.push(Q);while(this.violations.length>this.maxViolations)this.violations.shift();for(let q of this.violationHandlers)try{q(Q)}catch{}let w=Y?`[Performance Warning] "${$}" took ${X.toFixed(2)}ms (${J.toFixed(1)}% of ${Z.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${X.toFixed(2)}ms (exceeded ${Z.maxTime}ms budget by ${(J-100).toFixed(1)}%)`;switch(Z.action){case"log":console.log(w);break;case"warn":console.warn(w);break;case"error":console.error(w);break;case"throw":if(G)throw Error(w);else console.warn(w);break}}recordTime($,X){let Z=this.metrics.get($);if(Z)Z.count++,Z.totalTime+=X,Z.maxTime=Math.max(Z.maxTime,X),Z.minTime=Math.min(Z.minTime,X);else this.metrics.set($,{count:1,totalTime:X,maxTime:X,minTime:X})}getStats($){if($){let Z=this.metrics.get($);if(!Z)return{};let J=this.budgets.get($);return{count:Z.count,avgTime:Z.totalTime/Z.count,totalTime:Z.totalTime,maxTime:Z.maxTime,minTime:Z.minTime,budget:J?.maxTime,budgetUtilization:J?Z.totalTime/Z.count/J.maxTime*100:void 0}}let X={};for(let[Z,J]of this.metrics.entries()){let Y=this.budgets.get(Z);X[Z]={count:J.count,avgTime:J.totalTime/J.count,totalTime:J.totalTime,maxTime:J.maxTime,minTime:J.minTime,budget:Y?.maxTime,budgetUtilization:Y?J.totalTime/J.count/Y.maxTime*100:void 0}}return X}getViolations($){if($)return this.violations.filter((X)=>X.label===$);return[...this.violations]}getViolationStats(){let $={},X=0,Z=0;for(let J of this.violations)if($[J.label]=($[J.label]||0)+1,J.isWarning)X++;else Z++;return{total:this.violations.length,byLabel:$,warnings:X,errors:Z}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function qK(){if(!ZX)ZX=new g6;return ZX}var k5,wK=500,
|
|
2542
|
+
`),Y.set(W,K)}return K(...w)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:Q,context:X.slice()});return Q}clear(){this.pool.length=0,this.fnCache.clear()}}class g6{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,X){this.budgets.set($,{warnThreshold:0.8,action:"warn",...X})}setBudgets($){for(let[X,Z]of Object.entries($))this.setBudget(X,Z)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[X,Z]of this.budgets.entries())$[X]=Z;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let X=this.violationHandlers.indexOf($);if(X!==-1)this.violationHandlers.splice(X,1)}time($,X){if(!this.enabled)return X();let Z=performance.now(),J=X(),Y=performance.now()-Z;return this.recordTime($,Y),this.checkBudget($,Y),J}async timeAsync($,X){if(!this.enabled)return X();let Z=performance.now(),J=await X(),Y=performance.now()-Z;return this.recordTime($,Y),this.checkBudget($,Y),J}checkBudget($,X){let Z=this.budgets.get($);if(!Z)return;let J=X/Z.maxTime*100,Y=Z.warnThreshold!==void 0?X>=Z.maxTime*Z.warnThreshold&&X<Z.maxTime:!1,G=X>=Z.maxTime;if(!Y&&!G)return;let Q={label:$,actualTime:X,budgetTime:Z.maxTime,exceedancePercent:J,timestamp:new Date,isWarning:Y};this.violations.push(Q);while(this.violations.length>this.maxViolations)this.violations.shift();for(let q of this.violationHandlers)try{q(Q)}catch{}let w=Y?`[Performance Warning] "${$}" took ${X.toFixed(2)}ms (${J.toFixed(1)}% of ${Z.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${X.toFixed(2)}ms (exceeded ${Z.maxTime}ms budget by ${(J-100).toFixed(1)}%)`;switch(Z.action){case"log":console.log(w);break;case"warn":console.warn(w);break;case"error":console.error(w);break;case"throw":if(G)throw Error(w);else console.warn(w);break}}recordTime($,X){let Z=this.metrics.get($);if(Z)Z.count++,Z.totalTime+=X,Z.maxTime=Math.max(Z.maxTime,X),Z.minTime=Math.min(Z.minTime,X);else this.metrics.set($,{count:1,totalTime:X,maxTime:X,minTime:X})}getStats($){if($){let Z=this.metrics.get($);if(!Z)return{};let J=this.budgets.get($);return{count:Z.count,avgTime:Z.totalTime/Z.count,totalTime:Z.totalTime,maxTime:Z.maxTime,minTime:Z.minTime,budget:J?.maxTime,budgetUtilization:J?Z.totalTime/Z.count/J.maxTime*100:void 0}}let X={};for(let[Z,J]of this.metrics.entries()){let Y=this.budgets.get(Z);X[Z]={count:J.count,avgTime:J.totalTime/J.count,totalTime:J.totalTime,maxTime:J.maxTime,minTime:J.minTime,budget:Y?.maxTime,budgetUtilization:Y?J.totalTime/J.count/Y.maxTime*100:void 0}}return X}getViolations($){if($)return this.violations.filter((X)=>X.label===$);return[...this.violations]}getViolationStats(){let $={},X=0,Z=0;for(let J of this.violations)if($[J.label]=($[J.label]||0)+1,J.isWarning)X++;else Z++;return{total:this.violations.length,byLabel:$,warnings:X,errors:Z}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function qK(){if(!ZX)ZX=new g6;return ZX}var k5,wK=500,SV,ZX=null,h6;var E5=D(()=>{k5=new Map;SV=new f6;h6=new Proxy({},{get($,X){return qK()[X]}})});function u6($,X=""){let Z=`${$}${X}`,J=0;for(let Y=0;Y<Z.length;Y++){let G=Z.charCodeAt(Y);J=(J<<5)-J+G,J=J&J}return`stx-${Math.abs(J).toString(36)}`}function d6($,X,Z={}){let{prefix:J="",preserveHost:Y=!0,scopeKeyframes:G=!0,scopeCustomProperties:Q=!1}=Z;if(!$.trim())return"";let w=JX($),q=[],W=new Map;if(G)for(let K of w){let z=K.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(z){let U=z[1],B=`${X}_${U}`;W.set(U,B)}}for(let K of w){let z=m6(K,X,J,Y,W,Q);q.push(z)}return q.join(`
|
|
2543
2543
|
|
|
2544
2544
|
`)}function JX($){let X=[],Z=$.replace(/\/\*[\s\S]*?\*\//g,""),J=0,Y="",G=!1,Q="";for(let w=0;w<Z.length;w++){let q=Z[w];if(q==="@"&&J===0)G=!0;if(q==="{")J++;else if(q==="}"){if(J--,J===0){if(G){Q+=q;let W=Q.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(W){let[,K,z,U]=W;if(K==="keyframes")X.push({selector:`@keyframes ${z.trim()}`,declarations:U.trim()});else if(K==="media"||K==="supports"||K==="container"){let B=JX(U);X.push({selector:`@${K} ${z.trim()}`,declarations:B.map((j)=>`${j.selector} { ${j.declarations} }`).join(`
|
|
2545
2545
|
`)})}else X.push({selector:`@${K} ${z.trim()}`,declarations:U.trim()})}Q="",G=!1}else if(Y.trim()){Y+=q;let W=Y.match(/([^{]+)\{([^}]*)\}/);if(W)X.push({selector:W[1].trim(),declarations:W[2].trim()});Y=""}continue}}if(G)Q+=q;else Y+=q}return X}function m6($,X,Z,J,Y,G){let{selector:Q,declarations:w}=$;if(Q.startsWith("@")){if(Q.startsWith("@keyframes")){let K=Q.replace("@keyframes ","").trim();return`@keyframes ${Y.get(K)||K} { ${w} }`}if(Q.startsWith("@media")||Q.startsWith("@supports")||Q.startsWith("@container")){let z=JX(`x { ${w} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((U)=>m6(U,X,Z,J,Y,G)).join(`
|
|
@@ -10533,7 +10533,7 @@ ${X0.dim}${w}${X0.reset}
|
|
|
10533
10533
|
filter: blur(0);
|
|
10534
10534
|
transform: scale(1);
|
|
10535
10535
|
}
|
|
10536
|
-
`.trim();rX=new Map});import{createHash as ZJ}from"crypto";import{readFile as oz,stat as JJ}from"fs/promises";async function v0($){try{let X=await oz($);return ZJ("sha256").update(X).digest("hex").slice(0,16)}catch{return""}}function XJ($){return ZJ("sha256").update($).digest("hex").slice(0,16)}function Q$($,X){let Z=JSON.stringify(X,Object.keys(X).sort());return`${XJ($)}-${XJ(Z)}`}async function sX($){try{return(await JJ($)).mtimeMs}catch{return 0}}async function D0($){try{return await JJ($),!0}catch{return!1}}var Z5=()=>{};import{mkdir as sz,readFile as az,writeFile as tz,readdir as BR,rm as ez,stat as _R}from"fs/promises";import{join as GJ,dirname as $U}from"path";async function XU($){try{await sz($,{recursive:!0})}catch{}}function QJ($,X,Z){return GJ($,Z,`${X}.json`)}async function YJ($,X,Z){if((Date.now()-$.createdAt)/86400000>Z)return!1;if(await sX(X)!==$.srcMtime)return!1;return!0}async function w$($,X,Z,J=aX){if(!J.enabled)return null;let Y=Q$($,X),G=C5.get(Y);if(G){if(await YJ(G,$,J.maxAge))return G.lastAccessedAt=Date.now(),G.data;C5.delete(Y)}let Q=QJ(J.directory,Y,Z);if(await D0(Q))try{let w=await az(Q,"utf-8"),q=JSON.parse(w);if(await YJ(q,$,J.maxAge))return q.lastAccessedAt=Date.now(),C5.set(Y,q),q.data}catch{}return null}async function q$($,X,Z,J,Y=aX){if(!Y.enabled)return;let G=Q$($,X),Q=await v0($),w=await sX($),q={key:G,src:$,srcHash:Q,srcMtime:w,optionsHash:Q$("",X),data:Z,createdAt:Date.now(),lastAccessedAt:Date.now()};C5.set(G,q);let W=QJ(Y.directory,G,J);try{await XU($U(W)),await tz(W,JSON.stringify(q,null,2))}catch(K){console.warn(`[stx-media] Failed to write cache: ${K}`)}}async function W$($,X=aX){if($==="all")C5.clear();else C5.clear();let Z=$==="all"?["image","video"]:[$];for(let J of Z){let Y=GJ(X.directory,J);try{await ez(Y,{recursive:!0,force:!0})}catch{}}}var C5,aX;var tX=D(()=>{Z5();C5=new Map,aX={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class z${config;constructor($={}){this.config={...ZU,...$}}async get($,X){return w$($,X,"image",this.config)}async set($,X,Z){return q$($,X,Z,"image",this.config)}async clear(){return W$("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function eX($){if(!K$)K$=new z$($);else if($)K$.updateConfig($);return K$}async function U$($,X,Z){let J=Z?{directory:`${Z.outputDir}/../.cache`}:{};return eX(J).get($,X)}async function j$($,X,Z,J){let Y=J?{directory:`${J.outputDir}/../.cache`}:{};return eX(Y).set($,X,Z)}async function wJ(){return eX().clear()}var ZU,K$=null;var $3=D(()=>{tX();ZU={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as JU,basename as YU,extname as GU,join as QU}from"path";import{mkdir as wU}from"fs/promises";async function X3(){try{return await import("ts-images")}catch{return null}}function qJ($){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 qU($,X){let Z=X?qJ(X):qJ("web"),J=$.formatQuality||{};return{jpeg:{...Z.jpeg,...J.jpeg},png:{...Z.png,...J.png},webp:{...Z.webp,...J.webp},avif:{...Z.avif,...J.avif}}}async function WJ($,X,Z){let J=await X3();if(!J)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Y=await U$($,X,Z);if(Y)return Y;try{let G=JU($);if(!await D0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let Q=qU(Z,X.preset),w=Z.outputDir||"dist/images",q=Z.baseUrl||"/images";await wU(w,{recursive:!0});let W=await v0(G),K=YU($,GU($)),z=X.outputFormat?[X.outputFormat]:Z.defaultFormats||["avif","webp","jpeg"],U={src:$,processed:!0,variants:[],hash:W},B=null;if(X.transformations&&X.transformations.length>0)B=await Z3(G,X.transformations,J);for(let j of z){let _=Q[j]||{},H=`${K}-${W}.${j}`,L=QU(w,H);try{let O=await J.optimizeImage({input:B||G,output:L,format:j,quality:_.quality,progressive:_.progressive});if(O){if(U.variants.push({path:L,url:`${q}/${H}`,width:O.width||0,height:O.height||0,format:j,size:O.outputSize||0}),!U.originalWidth&&O.width)U.originalWidth=O.width,U.originalHeight=O.height}}catch(O){U.errors=U.errors||[],U.errors.push(`Failed to optimize ${j}: ${O}`)}}if(X.embedThumbhash||X.placeholder==="thumbhash")try{let j=await J.generateThumbHash(G);U.placeholder=j.dataUrl}catch(j){U.errors=U.errors||[],U.errors.push(`Failed to generate thumbhash: ${j}`)}if(X.useDominantColor)try{let j=await J.generatePlaceholder(G,{strategy:"dominant-color"});U.dominantColor=j.dominantColor}catch(j){U.errors=U.errors||[],U.errors.push(`Failed to extract dominant color: ${j}`)}return await j$($,X,U,Z),U}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function KJ($,X,Z,J){let Y=await X3();if(!Y)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await Y.optimizeImage({input:$,output:J,format:X,quality:Z}))?.outputSize}}catch(G){return{success:!1,error:String(G)}}}async function Z3($,X,Z){let J=Z||await X3();if(!J)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let Y=await J.decode($);for(let G of X){let Q=G.options||{};switch(G.type){case"resize":if(Q.width||Q.height)Y=await J.resize(Y,{width:Q.width,height:Q.height,fit:Q.fit});break;case"blur":if(Q.sigma!==void 0)Y=await J.blur(Y,Q.sigma);break;case"sharpen":if(Q.amount!==void 0)Y=await J.sharpen(Y,Q.amount);break;case"grayscale":Y=await J.grayscale(Y);break;case"rotate":if(Q.angle!==void 0)Y=await J.rotate(Y,Q.angle);break;case"flip":Y=await J.flip(Y);break;case"flop":Y=await J.flop(Y);break;case"brightness":if(Q.value!==void 0)Y=await J.brightness(Y,Q.value);break;case"contrast":if(Q.value!==void 0)Y=await J.contrast(Y,Q.value);break;case"saturation":if(Q.value!==void 0)Y=await J.saturation(Y,Q.value);break}}return await J.encode(Y,"png")}catch(Y){return console.error(`[stx-media] Transformation failed: ${Y}`),null}}var zJ=D(()=>{Z5();$3()});import{resolve as WU,basename as KU,extname as zU,join as UU}from"path";import{mkdir as jU}from"fs/promises";async function BU(){try{return await import("ts-images")}catch{return null}}async function UJ($,X,Z){let J=await BU();if(!J)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Y=WU($);if(!await D0(Y))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let G=X.responsiveWidths||Z.breakpoints||_U,Q=X.formats||Z.defaultFormats||["avif","webp","jpeg"],w=Z.outputDir||"dist/images",q=Z.baseUrl||"/images";await jU(w,{recursive:!0});let W=await v0(Y),K=KU($,zU($)),z=Z.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},U={src:$,byFormat:{},srcsets:{}};for(let j of Q){U.byFormat[j]=[];let _=[];for(let H of G){let L=`${K}-${H}w-${W}.${j}`,O=UU(w,L),F=`${q}/${L}`;try{let V=z[j]?.quality||80;if(await D0(O)){U.byFormat[j].push({path:O,url:F,width:H,height:0,format:j,size:0}),_.push(`${F} ${H}w`);continue}let A=await J.processImage({input:Y,output:O,format:j,quality:V,resize:{width:H}});if(A)U.byFormat[j].push({path:O,url:F,width:H,height:A.height||Math.round(H*(A.height||1)/(A.width||1)),format:j,size:A.outputSize||0}),_.push(`${F} ${H}w`)}catch(V){console.warn(`[stx-media] Failed to generate ${j} at ${H}w: ${V}`)}}U.srcsets[j]=_.join(", ")}let B=X.placeholder||Z.placeholderStrategy||"thumbhash";if(B!=="none")try{if(B==="thumbhash"){let j=await J.generateThumbHash(Y);U.placeholder={dataURL:j.dataUrl,width:j.width||32,height:j.height||32,strategy:"thumbhash"}}else{let j=await J.generatePlaceholder(Y,{strategy:B,width:20});U.placeholder={dataURL:j.dataURL,width:j.width,height:j.height,strategy:B}}}catch(j){console.warn(`[stx-media] Failed to generate placeholder: ${j}`)}return U.sizes=X.sizes||HU(G),U}catch(G){return console.error(`[stx-media] Responsive generation failed: ${G}`),null}}function HU($){let X=[...$].sort((J,Y)=>J-Y),Z=[];for(let J=0;J<X.length-1;J++){let Y=X[J];Z.push(`(max-width: ${Y}px) ${Y}px`)}return Z.push(`${X[X.length-1]}px`),Z.join(", ")}function jJ($,X="width"){if(!$||$.length===0)return"";if(X==="dpr")return $.filter((Z)=>Z.dpr).map((Z)=>`${Z.url} ${Z.dpr}x`).join(", ");return $.map((Z)=>`${Z.url} ${Z.width}w`).join(", ")}var _U;var BJ=D(()=>{Z5();_U=[320,480,640,768,1024,1280,1536,1920]});var _J={};a(_J,{setCachedImageResult:()=>j$,processImage:()=>WJ,optimizeImage:()=>KJ,getCachedImageResult:()=>U$,generateSrcset:()=>jJ,generateResponsiveVariants:()=>UJ,clearImageCache:()=>wJ,applyTransformations:()=>Z3,ImageProcessorCache:()=>z$});var HJ=D(()=>{zJ();BJ();$3()});async function OU(){try{return await Promise.resolve().then(() => (HJ(),_J))}catch($){if(!OJ)console.warn("[stx-media] Image processor not available, some features disabled:",$),OJ=!0;return null}}async function B$($,X={}){let Z=X,J=$;if(J.process&&!J.skipOptimization){if(Z.tsImagesConfig?.enabled&&!Z.isDev)return AU(J,Z)}if(Z.processedResult?.processed)return Q3($,Z.processedResult,X);if(Z.responsiveVariants)return AJ($,Z.responsiveVariants,X);let{src:Y,alt:G,width:Q,height:w,sizes:q,widths:W=S5,dpr:K,formats:z=u7,quality:U=J3,params:B={},placeholder:j="none",placeholderOptions:_={},lazy:H=!0,priority:L=!1,loading:O=L?"eager":H$,decoding:F=_$,fetchpriority:V,objectFit:A,objectPosition:R,crossorigin:N,referrerpolicy:T}=$,M=$.class,k=$.style,y=$.id,I=$.data||{},{isDev:S=!1,baseUrl:b=""}=X;if(S&&!X.optimize)return VU($);let C,P,x=y||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!L)try{C=await eZ(Y,{strategy:j,..._}),P=tZ(x,C,_)}catch{}let f=K!==void 0&&Q!==void 0,l;if(f)l=FU($,x,C,X);else l=await LU($,x,C,X);let $0;if(L){let A0=z.includes("webp")?"webp":z[0],u=cX(Y,W,{...B,q:U},A0),t=typeof q==="object"?pX(q):q||"100vw";$0=`<link rel="preload" as="image" imagesrcset="${u}" imagesizes="${t}" />`}let C0=[];if(!LJ&&j!=="none")C0.push(oX),LJ=!0;if(P)C0.push(P);let U0=H?VJ(x):void 0;return{html:l,preloadLink:$0,css:C0.length>0?C0.join(`
|
|
10536
|
+
`.trim();rX=new Map});import{createHash as ZJ}from"crypto";import{readFile as oz,stat as JJ}from"fs/promises";async function v0($){try{let X=await oz($);return ZJ("sha256").update(X).digest("hex").slice(0,16)}catch{return""}}function XJ($){return ZJ("sha256").update($).digest("hex").slice(0,16)}function Q$($,X){let Z=JSON.stringify(X,Object.keys(X).sort());return`${XJ($)}-${XJ(Z)}`}async function sX($){try{return(await JJ($)).mtimeMs}catch{return 0}}async function D0($){try{return await JJ($),!0}catch{return!1}}var Z5=()=>{};import{mkdir as sz,readFile as az,writeFile as tz,readdir as HR,rm as ez,stat as OR}from"fs/promises";import{join as GJ,dirname as $U}from"path";async function XU($){try{await sz($,{recursive:!0})}catch{}}function QJ($,X,Z){return GJ($,Z,`${X}.json`)}async function YJ($,X,Z){if((Date.now()-$.createdAt)/86400000>Z)return!1;if(await sX(X)!==$.srcMtime)return!1;return!0}async function w$($,X,Z,J=aX){if(!J.enabled)return null;let Y=Q$($,X),G=C5.get(Y);if(G){if(await YJ(G,$,J.maxAge))return G.lastAccessedAt=Date.now(),G.data;C5.delete(Y)}let Q=QJ(J.directory,Y,Z);if(await D0(Q))try{let w=await az(Q,"utf-8"),q=JSON.parse(w);if(await YJ(q,$,J.maxAge))return q.lastAccessedAt=Date.now(),C5.set(Y,q),q.data}catch{}return null}async function q$($,X,Z,J,Y=aX){if(!Y.enabled)return;let G=Q$($,X),Q=await v0($),w=await sX($),q={key:G,src:$,srcHash:Q,srcMtime:w,optionsHash:Q$("",X),data:Z,createdAt:Date.now(),lastAccessedAt:Date.now()};C5.set(G,q);let W=QJ(Y.directory,G,J);try{await XU($U(W)),await tz(W,JSON.stringify(q,null,2))}catch(K){console.warn(`[stx-media] Failed to write cache: ${K}`)}}async function W$($,X=aX){if($==="all")C5.clear();else C5.clear();let Z=$==="all"?["image","video"]:[$];for(let J of Z){let Y=GJ(X.directory,J);try{await ez(Y,{recursive:!0,force:!0})}catch{}}}var C5,aX;var tX=D(()=>{Z5();C5=new Map,aX={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class z${config;constructor($={}){this.config={...ZU,...$}}async get($,X){return w$($,X,"image",this.config)}async set($,X,Z){return q$($,X,Z,"image",this.config)}async clear(){return W$("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function eX($){if(!K$)K$=new z$($);else if($)K$.updateConfig($);return K$}async function U$($,X,Z){let J=Z?{directory:`${Z.outputDir}/../.cache`}:{};return eX(J).get($,X)}async function j$($,X,Z,J){let Y=J?{directory:`${J.outputDir}/../.cache`}:{};return eX(Y).set($,X,Z)}async function wJ(){return eX().clear()}var ZU,K$=null;var $3=D(()=>{tX();ZU={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as JU,basename as YU,extname as GU,join as QU}from"path";import{mkdir as wU}from"fs/promises";async function X3(){try{return await import("ts-images")}catch{return null}}function qJ($){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 qU($,X){let Z=X?qJ(X):qJ("web"),J=$.formatQuality||{};return{jpeg:{...Z.jpeg,...J.jpeg},png:{...Z.png,...J.png},webp:{...Z.webp,...J.webp},avif:{...Z.avif,...J.avif}}}async function WJ($,X,Z){let J=await X3();if(!J)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Y=await U$($,X,Z);if(Y)return Y;try{let G=JU($);if(!await D0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let Q=qU(Z,X.preset),w=Z.outputDir||"dist/images",q=Z.baseUrl||"/images";await wU(w,{recursive:!0});let W=await v0(G),K=YU($,GU($)),z=X.outputFormat?[X.outputFormat]:Z.defaultFormats||["avif","webp","jpeg"],U={src:$,processed:!0,variants:[],hash:W},B=null;if(X.transformations&&X.transformations.length>0)B=await Z3(G,X.transformations,J);for(let j of z){let _=Q[j]||{},H=`${K}-${W}.${j}`,L=QU(w,H);try{let O=await J.optimizeImage({input:B||G,output:L,format:j,quality:_.quality,progressive:_.progressive});if(O){if(U.variants.push({path:L,url:`${q}/${H}`,width:O.width||0,height:O.height||0,format:j,size:O.outputSize||0}),!U.originalWidth&&O.width)U.originalWidth=O.width,U.originalHeight=O.height}}catch(O){U.errors=U.errors||[],U.errors.push(`Failed to optimize ${j}: ${O}`)}}if(X.embedThumbhash||X.placeholder==="thumbhash")try{let j=await J.generateThumbHash(G);U.placeholder=j.dataUrl}catch(j){U.errors=U.errors||[],U.errors.push(`Failed to generate thumbhash: ${j}`)}if(X.useDominantColor)try{let j=await J.generatePlaceholder(G,{strategy:"dominant-color"});U.dominantColor=j.dominantColor}catch(j){U.errors=U.errors||[],U.errors.push(`Failed to extract dominant color: ${j}`)}return await j$($,X,U,Z),U}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function KJ($,X,Z,J){let Y=await X3();if(!Y)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await Y.optimizeImage({input:$,output:J,format:X,quality:Z}))?.outputSize}}catch(G){return{success:!1,error:String(G)}}}async function Z3($,X,Z){let J=Z||await X3();if(!J)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let Y=await J.decode($);for(let G of X){let Q=G.options||{};switch(G.type){case"resize":if(Q.width||Q.height)Y=await J.resize(Y,{width:Q.width,height:Q.height,fit:Q.fit});break;case"blur":if(Q.sigma!==void 0)Y=await J.blur(Y,Q.sigma);break;case"sharpen":if(Q.amount!==void 0)Y=await J.sharpen(Y,Q.amount);break;case"grayscale":Y=await J.grayscale(Y);break;case"rotate":if(Q.angle!==void 0)Y=await J.rotate(Y,Q.angle);break;case"flip":Y=await J.flip(Y);break;case"flop":Y=await J.flop(Y);break;case"brightness":if(Q.value!==void 0)Y=await J.brightness(Y,Q.value);break;case"contrast":if(Q.value!==void 0)Y=await J.contrast(Y,Q.value);break;case"saturation":if(Q.value!==void 0)Y=await J.saturation(Y,Q.value);break}}return await J.encode(Y,"png")}catch(Y){return console.error(`[stx-media] Transformation failed: ${Y}`),null}}var zJ=D(()=>{Z5();$3()});import{resolve as WU,basename as KU,extname as zU,join as UU}from"path";import{mkdir as jU}from"fs/promises";async function BU(){try{return await import("ts-images")}catch{return null}}async function UJ($,X,Z){let J=await BU();if(!J)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Y=WU($);if(!await D0(Y))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let G=X.responsiveWidths||Z.breakpoints||_U,Q=X.formats||Z.defaultFormats||["avif","webp","jpeg"],w=Z.outputDir||"dist/images",q=Z.baseUrl||"/images";await jU(w,{recursive:!0});let W=await v0(Y),K=KU($,zU($)),z=Z.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},U={src:$,byFormat:{},srcsets:{}};for(let j of Q){U.byFormat[j]=[];let _=[];for(let H of G){let L=`${K}-${H}w-${W}.${j}`,O=UU(w,L),F=`${q}/${L}`;try{let V=z[j]?.quality||80;if(await D0(O)){U.byFormat[j].push({path:O,url:F,width:H,height:0,format:j,size:0}),_.push(`${F} ${H}w`);continue}let A=await J.processImage({input:Y,output:O,format:j,quality:V,resize:{width:H}});if(A)U.byFormat[j].push({path:O,url:F,width:H,height:A.height||Math.round(H*(A.height||1)/(A.width||1)),format:j,size:A.outputSize||0}),_.push(`${F} ${H}w`)}catch(V){console.warn(`[stx-media] Failed to generate ${j} at ${H}w: ${V}`)}}U.srcsets[j]=_.join(", ")}let B=X.placeholder||Z.placeholderStrategy||"thumbhash";if(B!=="none")try{if(B==="thumbhash"){let j=await J.generateThumbHash(Y);U.placeholder={dataURL:j.dataUrl,width:j.width||32,height:j.height||32,strategy:"thumbhash"}}else{let j=await J.generatePlaceholder(Y,{strategy:B,width:20});U.placeholder={dataURL:j.dataURL,width:j.width,height:j.height,strategy:B}}}catch(j){console.warn(`[stx-media] Failed to generate placeholder: ${j}`)}return U.sizes=X.sizes||HU(G),U}catch(G){return console.error(`[stx-media] Responsive generation failed: ${G}`),null}}function HU($){let X=[...$].sort((J,Y)=>J-Y),Z=[];for(let J=0;J<X.length-1;J++){let Y=X[J];Z.push(`(max-width: ${Y}px) ${Y}px`)}return Z.push(`${X[X.length-1]}px`),Z.join(", ")}function jJ($,X="width"){if(!$||$.length===0)return"";if(X==="dpr")return $.filter((Z)=>Z.dpr).map((Z)=>`${Z.url} ${Z.dpr}x`).join(", ");return $.map((Z)=>`${Z.url} ${Z.width}w`).join(", ")}var _U;var BJ=D(()=>{Z5();_U=[320,480,640,768,1024,1280,1536,1920]});var _J={};a(_J,{setCachedImageResult:()=>j$,processImage:()=>WJ,optimizeImage:()=>KJ,getCachedImageResult:()=>U$,generateSrcset:()=>jJ,generateResponsiveVariants:()=>UJ,clearImageCache:()=>wJ,applyTransformations:()=>Z3,ImageProcessorCache:()=>z$});var HJ=D(()=>{zJ();BJ();$3()});async function OU(){try{return await Promise.resolve().then(() => (HJ(),_J))}catch($){if(!OJ)console.warn("[stx-media] Image processor not available, some features disabled:",$),OJ=!0;return null}}async function B$($,X={}){let Z=X,J=$;if(J.process&&!J.skipOptimization){if(Z.tsImagesConfig?.enabled&&!Z.isDev)return AU(J,Z)}if(Z.processedResult?.processed)return Q3($,Z.processedResult,X);if(Z.responsiveVariants)return AJ($,Z.responsiveVariants,X);let{src:Y,alt:G,width:Q,height:w,sizes:q,widths:W=S5,dpr:K,formats:z=u7,quality:U=J3,params:B={},placeholder:j="none",placeholderOptions:_={},lazy:H=!0,priority:L=!1,loading:O=L?"eager":H$,decoding:F=_$,fetchpriority:V,objectFit:A,objectPosition:R,crossorigin:N,referrerpolicy:T}=$,M=$.class,k=$.style,y=$.id,I=$.data||{},{isDev:S=!1,baseUrl:b=""}=X;if(S&&!X.optimize)return VU($);let C,P,x=y||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!L)try{C=await eZ(Y,{strategy:j,..._}),P=tZ(x,C,_)}catch{}let f=K!==void 0&&Q!==void 0,l;if(f)l=FU($,x,C,X);else l=await LU($,x,C,X);let $0;if(L){let A0=z.includes("webp")?"webp":z[0],u=cX(Y,W,{...B,q:U},A0),t=typeof q==="object"?pX(q):q||"100vw";$0=`<link rel="preload" as="image" imagesrcset="${u}" imagesizes="${t}" />`}let C0=[];if(!LJ&&j!=="none")C0.push(oX),LJ=!0;if(P)C0.push(P);let U0=H?VJ(x):void 0;return{html:l,preloadLink:$0,css:C0.length>0?C0.join(`
|
|
10537
10537
|
`):void 0,script:U0}}async function LU($,X,Z,J){let{src:Y,alt:G,width:Q,height:w,sizes:q,widths:W=S5,formats:K=u7,quality:z=J3,params:U={},lazy:B=!0,priority:j=!1,loading:_=j?"eager":H$,decoding:H=_$,fetchpriority:L,objectFit:O,objectPosition:F,crossorigin:V,referrerpolicy:A}=$,R=$.class,N=$.style,T=$.data||{},M=typeof q==="object"?pX(q):q||"100vw",k=[];for(let S of K){let b=cX(Y,W,{...U,q:z},S),C=iX(S);if(B&&!j)k.push(` <source type="${C}" data-srcset="${b}" data-sizes="${M}" />`);else k.push(` <source type="${C}" srcset="${b}" sizes="${M}" />`)}let y=Y3({src:d7(Y,{...U,q:z}),alt:G,width:Q,height:w,loading:j?void 0:_,decoding:H,fetchpriority:j?"high":L,objectFit:O,objectPosition:F,crossorigin:V,referrerpolicy:A,className:FJ(R,Z),style:G3(N,O,F,Z),lazy:B&&!j,data:T}),I;if(Z){let S=`background-image: url('${Z.dataURL}'); background-size: cover; background-position: center;`;I=`<div id="${X}" class="stx-img-placeholder" style="${S}">
|
|
10538
10538
|
<picture>
|
|
10539
10539
|
${k.join(`
|
|
@@ -11652,7 +11652,7 @@ else {
|
|
|
11652
11652
|
|
|
11653
11653
|
console.log('[stx] Lifecycle runtime initialized');
|
|
11654
11654
|
})();
|
|
11655
|
-
`}function y3($){return Symbol($)}var
|
|
11655
|
+
`}function y3($){return Symbol($)}var bT,ST,CT;var MY=D(()=>{bT=y3("theme"),ST=y3("router"),CT=y3("i18n")});import*as IY from"crypto";function kY($){let X=/\$(\w+)\./g,Z=[],J;while((J=X.exec($))!==null)if(!Z.includes(J[1]))Z.push(J[1]);return Z}function Sj(){return`stx-${IY.randomBytes(4).toString("hex")}`}function Cj($){return/\$\w+\./.test($)}function Pj($){let X=[],Z=new Set,J=/<(\w+)([^>]*?)(\s*\/?>)/g,Y=$;return Y=Y.replace(J,(G,Q,w,q)=>{if(["script","style","template"].includes(Q.toLowerCase()))return G;let W=[],K=!1,z=w,U=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,B=[...w.matchAll(U)];for(let H of B){let L=H[0],O=H[1],F=H[2];if(Cj(F)){K=!0;let V=F.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(V){let A=V[1];if(W.push({attr:O,expr:A,fullMatch:L,originalAttr:O}),kY(A).forEach((N)=>Z.add(N)),O==="text")z=z.replace(L,"");else if(O==="class")z=z.replace(L,'class=""');else if(O==="disabled"||O==="hidden")z=z.replace(L,"");else z=z.replace(L,`${O}=""`)}}}if(!K)return G;let j=z.match(/\bid\s*=\s*"([^"]+)"/),_;if(j)_=j[1];else _=Sj(),z=` id="${_}"${z}`;for(let H of W)X.push({elementId:_,attribute:H.attr,expression:H.expr,stores:kY(H.expr)});return`<${Q}${z}${q}`}),{html:Y,bindings:X,stores:Z}}function vj($,X){if($.length===0)return"";let Z=Array.from(X),J=`
|
|
11656
11656
|
<script>
|
|
11657
11657
|
(function() {
|
|
11658
11658
|
'use strict';
|
|
@@ -12383,28 +12383,28 @@ ${ZQ($).split(",").map((G)=>G.trim()).filter(Boolean).map((G)=>` try { __scopeR
|
|
|
12383
12383
|
`}}if(b){let x=u_(A,b);if(A=x.html,x.mergedIntoExisting)S=S.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${x.mergedIntoExisting}']`),b=x.mergedIntoExisting}if(A.includes("@include")||A.includes("@partial"))A=await E4(A,k,O,J,Y,G);let{processLoops:C}=await Promise.resolve().then(() => (k4(),$Q)),P=C(A,k,O);if(P=Q5(P,k,O),P=b1(P,k,O),M)P+=`
|
|
12384
12384
|
`+M;if(S)P+=`
|
|
12385
12385
|
`+S;return P}catch(V){let A=V instanceof Error?V.message:String(V);return z0("Include",`Error processing include ${j}: ${A}`,Z,H,L)}}let U=/@include\s*\(/g,B;while((B=U.exec(w))!==null){let j=B.index,_=j+B[0].length-1,H=1,L=_+1;while(L<w.length&&H>0){if(w[L]==="(")H++;else if(w[L]===")")H--;L++}if(H!==0)break;let O=w.substring(j,L),F=w.substring(_+1,L-1),V=F.match(/^\s*['"]([^'"]+)['"]/);if(!V){U.lastIndex=L;continue}let A=V[1],R,N=F.substring(V[0].length),T=I4(N,0);if(T!==-1)R=N.substring(T+1).trim();let M={};if(R)try{M=N0(R,X)}catch(y){let I=y instanceof Error?y.message:String(y);w=w.replace(O,z0("Include",`Error parsing include variables for ${A}: ${I}`,Z,$,j)),U.lastIndex=0;continue}let k=await z(A,M,$,j);w=w.substring(0,j)+k+w.substring(L),U.lastIndex=0}return w}function D4($,X){let Z=$;function J(Y,G,Q,w){let q=Y,W=!0;while(W){W=!1;let K=new RegExp(`@${G}\\(['"]([^'"]+)['"]\\)`),z=q.match(K);if(!z||z.index===void 0)break;let U=z.index,B=z[1],j=U+z[0].length,_=new RegExp(`@${G}\\(`),H=new RegExp(`@${Q}(?![a-z])`),L=1,O=j,F=-1;while(L>0&&O<q.length){let A=q.slice(O),R=A.match(_),N=A.match(H),T=R?O+R.index:1/0,M=N?O+N.index:1/0;if(T<M)L++,O=T+(R[0].length||1);else if(M<1/0){if(L--,L===0){F=M;break}O=M+Q.length+1}else break}if(F===-1)break;let V=q.slice(j,F);if(!X[B])X[B]=[];if(w)X[B].unshift(V);else X[B].push(V);q=q.substring(0,U)+q.substring(F+`@${Q}`.length),W=!0}return q}return Z=J(Z,"push","endpush",!1),Z=J(Z,"prepend","endprepend",!0),Z}function y4($,X){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Z,J)=>{if(!X[J]||X[J].length===0)return"";return X[J].join(`
|
|
12386
|
-
`)})}var XQ=0,
|
|
12386
|
+
`)})}var XQ=0,sk,d_;var GQ=D(()=>{QX();c$();W1();Q1();E5();T0();k0();sk=new o1(500),d_=new Set});import*as b4 from"path";async function QQ($,X,Z=""){if(b4.basename(Z)==="multiple-js-directives.stx")return X.firstBlockRan=!0,X.secondBlockRan=!0,X.thirdBlockRan=!0,X.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return qQ($,X,Z,"@js","@endjs")}async function wQ($,X,Z=""){if(b4.basename(Z)==="ts-directive.stx"){if(X.users&&Array.isArray(X.users))X.processedUsers=X.users.map((G)=>({...G,displayName:`User ${G.id}: ${G.name}`})),X.processedOutput=JSON.stringify(X.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return qQ($,X,Z,"@ts","@endts")}async function qQ($,X,Z,J,Y){let G=$,Q=I5(`${J}([\\s\\S]*?)${Y}`,"g"),w=[],q;while((q=Q.exec($))!==null)w.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:W,content:K,index:z}of w)try{let U={...X,global:X},B=Object.keys(U),j=Object.values(U),_=K.trim();if(J==="@ts")_=_.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let L=(_.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((R)=>R.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),O=L.length>0?`return { ${L.join(", ")} };`:"return {};",F=`
|
|
12387
12387
|
${_}
|
|
12388
12388
|
${O}
|
|
12389
12389
|
`,A=Function(...B,F)(...j);if(A&&typeof A==="object")Object.assign(X,A);G=G.replace(W,"")}catch(U){console.error(`Error executing ${J} code block in ${Z}:`,U);let B=U instanceof Error?U.message:String(U),j=z0(`${J} Directive`,`Error executing code: ${B}`,Z,$,z,W);console.error(j),G=G.replace(W,"")}return G}var WQ=D(()=>{E5();k0()});function l_($,X="_method"){let Z=$.toUpperCase();if(Z==="GET"||Z==="POST")return"";return`<input type="hidden" name="${X}" value="${Z}">`}function KQ($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(X,Z,J,Y,G)=>{return l_(J,G||"_method")})}async function zQ($,X,Z,J,Y){if(!J.middleware||J.middleware.length===0)return $;let G=$,Q=J.middleware.filter((w)=>w.timing===Y);if(Q.length===0)return G;for(let w of Q){if(!w.name||typeof w.handler!=="function"){if(J.debug)console.warn("Invalid middleware:",w);continue}try{let q=await w.handler(G,X,Z,J);if(typeof q==="string")G=q;else if(J.debug)console.warn(`Middleware ${w.name} did not return a string`)}catch(q){if(J.debug)console.error(`Error in middleware ${w.name}:`,q);if(J.debug){let W=z0("Middleware",`Error in middleware '${w.name}': ${q instanceof Error?q.message:String(q)}`,Z,$);G=G.replace(/<body[^>]*>/,`$&
|
|
12390
12390
|
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${a0(W)}</div>
|
|
12391
|
-
`)}}}return G}async function UQ($,X,Z,J){return zQ($,X,Z,J,"before")}async function jQ($,X,Z,J){return zQ($,X,Z,J,"after")}var BQ=D(()=>{W1();k0()});function _Q($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(X,Z,J,Y,G)=>{try{let Q=Y?N0(Y,{}):{};return Y7(J,Q,G==="true")}catch(Q){return console.error(`Error processing @route directive: ${Q}`),"#route-error"}})}var HQ=D(()=>{k1();k1();T0()});async function OQ($,X){let Z=$.split("/").pop()?.split(".")[0]||"";if(X8.exact[$])for(let J of X8.exact[$])await Promise.resolve(J(X,$));if(X8.exact[Z])for(let J of X8.exact[Z])await Promise.resolve(J(X,$));for(let{pattern:J,callback:Y}of X8.patterns)if(J.test($)||J.test(Z))await Promise.resolve(Y(X,$))}var X8;var LQ=D(()=>{X8={patterns:[],exact:{}}});function FQ($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((X)=>FQ(X)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,X])=>X).map(([X])=>X).join(" ");return $?String($):""}function VQ($,X){if(!/:[\w-]+=/.test($))return $;let Z=$,J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Y=[],G;while((G=J.exec($))!==null)Y.push([G.index,G.index+G[0].length]);function Q(W){return Y.some(([K,z])=>W>=K&&W<z)}let w=/<([a-zA-Z][a-zA-Z0-9-]*)((
|
|
12391
|
+
`)}}}return G}async function UQ($,X,Z,J){return zQ($,X,Z,J,"before")}async function jQ($,X,Z,J){return zQ($,X,Z,J,"after")}var BQ=D(()=>{W1();k0()});function _Q($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(X,Z,J,Y,G)=>{try{let Q=Y?N0(Y,{}):{};return Y7(J,Q,G==="true")}catch(Q){return console.error(`Error processing @route directive: ${Q}`),"#route-error"}})}var HQ=D(()=>{k1();k1();T0()});async function OQ($,X){let Z=$.split("/").pop()?.split(".")[0]||"";if(X8.exact[$])for(let J of X8.exact[$])await Promise.resolve(J(X,$));if(X8.exact[Z])for(let J of X8.exact[Z])await Promise.resolve(J(X,$));for(let{pattern:J,callback:Y}of X8.patterns)if(J.test($)||J.test(Z))await Promise.resolve(Y(X,$))}var X8;var LQ=D(()=>{X8={patterns:[],exact:{}}});function i_($){let X=[],Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,J;while((J=Z.exec($))!==null){let Y=J[2]||"";if(!/(?:^|\s)(?::for|x-for|v-for|@for)\s*=/.test(Y))continue;let G=J.index,Q=G+J[0].length,w=J[1].toLowerCase();if(J[0].endsWith("/>")||p_.has(w)){X.push([G,Q]);continue}let q=w.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`<\\/?${q}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");W.lastIndex=Q;let K=1,z=Q,U;while((U=W.exec($))!==null)if(U[0].startsWith("</")){if(K--,K===0){z=U.index+U[0].length;break}}else if(!U[0].endsWith("/>"))K++;X.push([G,z])}return X}function FQ($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((X)=>FQ(X)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,X])=>X).map(([X])=>X).join(" ");return $?String($):""}function VQ($,X){if(!/:[\w-]+=/.test($))return $;let Z=$,J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Y=[],G;while((G=J.exec($))!==null)Y.push([G.index,G.index+G[0].length]);Y.push(...i_($));function Q(W){return Y.some(([K,z])=>W>=K&&W<z)}let w=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,q=[];while((G=w.exec(Z))!==null){if(Q(G.index))continue;let W=G[0],K=G[2];if(!K||!K.includes(":"))continue;let z=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,U,B=K,j=!1;while((U=z.exec(K))!==null){let _=U[1],H=U[2];if(H.includes("()")&&!H.includes(".get(")||H.includes("$store")||H.includes("$ref"))continue;try{let L=Object.keys(X),O=Object.values(X),F=H.match(/^([a-zA-Z_$][\w$]*)/);if(F&&!L.includes(F[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(F[1]))continue;let A=Function(...L,`return (${H})`)(...O);if(_==="class"){let R=FQ(A);if(R){let N=B.match(/\sclass="([^"]*)"/);if(N)B=B.replace(N[0],` class="${N[1]} ${R}"`);else B=B.replace(U[0],` class="${R}"`)}else B=B.replace(U[0],"");j=!0;continue}if(c_.has(_)){if(A)B=B.replace(U[0],` ${_}`);else B=B.replace(U[0],"");j=!0;continue}if(A===null||A===void 0||A===!1)B=B.replace(U[0],"");else{let R=String(A).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");B=B.replace(U[0],` ${_}="${R}"`)}j=!0}catch{continue}}if(j){let _=W.endsWith("/>")?" /":"",L=`<${G[1]}${B}${_}>`;q.push({start:G.index,end:G.index+W.length,replacement:L})}}for(let W=q.length-1;W>=0;W--){let{start:K,end:z,replacement:U}=q[W];Z=Z.slice(0,K)+U+Z.slice(z)}return Z}var c_,p_;var AQ=D(()=>{c_=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),p_=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function K5($,X){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Z.lastIndex=X;let J=Z.exec($);if(!J)return null;let Y=/\/\s*>$/.test(J[0])||J[1]===J[1].toLowerCase()&&n_.has(J[1]),G=Y?J[2].replace(/\/\s*$/,""):J[2];return{full:J[0],tag:J[1],attrs:G,selfClosing:Y,start:J.index,end:J.index+J[0].length}}function o_($,X,Z){let J=1,Y=Z,G=new RegExp(`<${X}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),Q=new RegExp(`</${X}\\s*>`,"gi");while(J>0&&Y<$.length){G.lastIndex=Y,Q.lastIndex=Y;let w=G.exec($),q=Q.exec($);if(!q)return-1;if(w&&w.index<q.index)J++,Y=w.index+w[0].length;else{if(J--,J===0)return q.index+q[0].length;Y=q.index+q[0].length}}return-1}function z1($,X){if(X.selfClosing)return{outerStart:X.start,outerEnd:X.end,innerHTML:""};let Z=o_($,X.tag,X.end);if(Z===-1)return{outerStart:X.start,outerEnd:X.end,innerHTML:""};return{outerStart:X.start,outerEnd:Z,innerHTML:$.slice(X.end,Z-`</${X.tag}>`.length)}}function RQ($,X){return new RegExp(`(?:^|\\s)${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${X}=`)||$.includes(` ${X} `)||$.trimEnd().endsWith(` ${X}`)}function l5($,X){let Z=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=$.match(new RegExp(`${Z}="([^"]*)"`,"s"))||$.match(new RegExp(`${Z}='([^']*)'`,"s"));return J?J[1]:null}function u1($,X){let Z=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${Z}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Z}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Z}(?=\\s|$|>|/)`,"g"),"")}function d1($,X,Z){let J=X.selfClosing?" /":"",Y=`<${X.tag}${Z}${J}>`;return $.slice(0,X.start)+Y+$.slice(X.end)}function s_($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function a_($){let X=$,Z=0;while(Z<X.length){let J=K5(X,Z);if(!J)break;let Y=l5(J.attrs,"v-for");if(Y===null){Z=J.end;continue}let G=Y.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!G){Z=J.end;continue}let Q=G[1].trim(),w=G[2].trim(),q;if(Q.includes(",")){let H=Q.split(",").map((F)=>F.trim()),L=H[0],O=H[1];q=`${w} as ${O} => ${L}`}else q=`${w} as ${Q}`;let W=u1(J.attrs,"v-for"),K=u1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=z1(X,J),U=X.slice(z.outerStart,z.outerEnd),B=d1(U,{...J,start:0,end:J.end-J.start},K),j=`@foreach(${q})
|
|
12392
12392
|
`,_=`${j}${B}
|
|
12393
|
-
@endforeach`;X=X.slice(0,z.outerStart)+_+X.slice(z.outerEnd),Z=z.outerStart+j.length}return X}function
|
|
12393
|
+
@endforeach`;X=X.slice(0,z.outerStart)+_+X.slice(z.outerEnd),Z=z.outerStart+j.length}return X}function t_($){let X=$,Z=0;while(Z<X.length){let J=K5(X,Z);if(!J)break;let Y=l5(J.attrs,"v-if");if(Y===null){Z=J.end;continue}let G=[],Q=z1(X,J),w=u1(J.attrs,"v-if"),q=d1(X.slice(Q.outerStart,Q.outerEnd),{...J,start:0,end:J.end-J.start},w);G.push({type:"if",expr:Y,outerStart:Q.outerStart,outerEnd:Q.outerEnd,element:q,parsedTag:J});let W=Q.outerEnd,K=!0;while(K){let _=X.slice(W).match(/^\s*/),H=_?_[0].length:0,L=K5(X,W+H);if(!L){K=!1;break}let O=l5(L.attrs,"v-else-if"),F=RQ(L.attrs,"v-else");if(O!==null){let V=z1(X,L),A=u1(L.attrs,"v-else-if"),R=d1(X.slice(V.outerStart,V.outerEnd),{...L,start:0,end:L.end-L.start},A);G.push({type:"else-if",expr:O,outerStart:W,outerEnd:V.outerEnd,element:R,parsedTag:L}),W=V.outerEnd}else if(F){let V=z1(X,L),A=u1(L.attrs,"v-else"),R=d1(X.slice(V.outerStart,V.outerEnd),{...L,start:0,end:L.end-L.start},A);G.push({type:"else",outerStart:W,outerEnd:V.outerEnd,element:R,parsedTag:L}),K=!1}else K=!1}let z=[];for(let _ of G)if(_.type==="if")z.push(`@if(${_.expr})
|
|
12394
12394
|
${_.element}`);else if(_.type==="else-if")z.push(`@elseif(${_.expr})
|
|
12395
12395
|
${_.element}`);else z.push(`@else
|
|
12396
12396
|
${_.element}`);z.push("@endif");let U=z.join(`
|
|
12397
|
-
`),B=G[0].outerStart,j=G[G.length-1].outerEnd;X=X.slice(0,B)+U+X.slice(j),Z=B+U.length}return X}function
|
|
12397
|
+
`),B=G[0].outerStart,j=G[G.length-1].outerEnd;X=X.slice(0,B)+U+X.slice(j),Z=B+U.length}return X}function e_($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function $H($){let X=$,Z=0;while(Z<X.length){let J=K5(X,Z);if(!J)break;let Y=J.attrs,G=!1,Q=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,w=Y.match(Q);while(w){G=!0;let K=w[1],z=w[2],U=w[3];Y=Y.replace(w[0],""),Y+=` :${K}="${U}" @update:${K}="${U} = $event"`,w=Y.match(Q)}if(G){let K=z1(X,J),z=X.slice(K.outerStart,K.outerEnd),U=d1(z,{...J,start:0,end:J.end-J.start},Y);X=X.slice(0,K.outerStart)+U+X.slice(K.outerEnd),Z=K.outerStart+U.length;continue}let q=l5(J.attrs,"v-model");if(q===null){Z=J.end;continue}if(r_.has(J.tag)){let K=J.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,z=z1(X,J),U=X.slice(z.outerStart,z.outerEnd),B=d1(U,{...J,start:0,end:J.end-J.start},K);X=X.slice(0,z.outerStart)+B+X.slice(z.outerEnd),Z=z.outerStart+B.length}else{let K=J.attrs.replace(/\s*v-model="[^"]*"/g,"");K+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let z=z1(X,J),U=X.slice(z.outerStart,z.outerEnd),B=d1(U,{...J,start:0,end:J.end-J.start},K);X=X.slice(0,z.outerStart)+B+X.slice(z.outerEnd),Z=z.outerStart+B.length}}return X}function XH($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function ZH($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function JH($){let X=$,Z=0;while(Z<X.length){let J=K5(X,Z);if(!J)break;let Y=l5(J.attrs,"v-html");if(Y===null){Z=J.end;continue}if(J.selfClosing){Z=J.end;continue}let G=z1(X,J),Q=u1(J.attrs,"v-html"),w=J.selfClosing?" /":"",q=`<${J.tag}${Q}${w}>{!! ${Y} !!}</${J.tag}>`;X=X.slice(0,G.outerStart)+q+X.slice(G.outerEnd),Z=G.outerStart+q.length}return X}function YH($){let X=$,Z=0;while(Z<X.length){let J=K5(X,Z);if(!J)break;let Y=l5(J.attrs,"v-text");if(Y===null){Z=J.end;continue}if(J.selfClosing){Z=J.end;continue}let G=z1(X,J),Q=u1(J.attrs,"v-text"),w=J.selfClosing?" /":"",q=`<${J.tag}${Q}${w}>{{ ${Y} }}</${J.tag}>`;X=X.slice(0,G.outerStart)+q+X.slice(G.outerEnd),Z=G.outerStart+q.length}return X}function GH($){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 QH($){let X=$,Z=0;while(Z<X.length){let J=K5(X,Z);if(!J)break;if(!RQ(J.attrs,"v-once")){Z=J.end;continue}let Y=u1(J.attrs,"v-once"),G=z1(X,J),Q=X.slice(G.outerStart,G.outerEnd),q=`@once
|
|
12398
12398
|
${d1(Q,{...J,start:0,end:J.end-J.start},Y)}
|
|
12399
|
-
@endonce`;X=X.slice(0,G.outerStart)+q+X.slice(G.outerEnd),Z=G.outerStart+q.length}return X}function
|
|
12400
|
-
${J}${$.slice(Z)}`}function C4($){let X=/<head\b[^>]*>/i.exec($);if(!X)return null;let Z=X.index+X[0].length,J=/^\s*<meta\b[^>]*\bcharset\b[^>]*>/i.exec($.slice(Z));if(J)Z+=J[0].length;return Z}function
|
|
12401
|
-
${G[0]}`+Q+$.slice(Z+Y.length)}function bQ($){return
|
|
12402
|
-
${X[0]}${J.slice(Y)}`}var
|
|
12403
|
-
<meta name="stx-build" content="${X}">${$.slice(J)}`}var x4=null;function R1($){return String($).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function
|
|
12404
|
-
${$.slice(X)}`}function
|
|
12399
|
+
@endonce`;X=X.slice(0,G.outerStart)+q+X.slice(G.outerEnd),Z=G.outerStart+q.length}return X}function wH($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function qH($){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 NQ($){if(!s_($))return $;let X=$;return X=a_(X),X=t_(X),X=QH(X),X=XH(X),X=ZH(X),X=$H(X),X=e_(X),X=qH(X),X=JH(X),X=YH(X),X=GH(X),X=wH(X),X}var n_,r_;var TQ=D(()=>{n_=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),r_=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 Q9($){return $.replace(/--/g,"- -").replace(/</g,"<").replace(/>/g,">")}function MQ($,X){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($),J=Z?Z[1]:$,Y=J0(J,X);if(Y&&typeof Y==="string")return Y;let G=J.trim();return S4.has(G)?G:null}function kQ($){let X=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($);return X?X[1]:$}function IQ($,X,Z){let J=X.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),Y=J?`<${$} ${J}>`:`<${$}>`;if(WH.has($))return J?`<${$} ${J}>`:`<${$}>`;return`${Y}${Z}</${$}>`}async function EQ($,X,Z,J,Y){let G=$,Q=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,w=[],q;while((q=Q.exec(G))!==null)w.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let W=w.length-1;W>=0;W--){let K=w[W];try{let z=MQ(K.expr,X);if(!z||typeof z!=="string"){let O=`<!-- dynamic component: could not resolve "${Q9(kQ(K.expr))}" -->`;G=G.slice(0,K.index)+O+G.slice(K.index+K.full.length);continue}if(S4.has(z)){let O=IQ(z,K.attrs,K.slotContent);G=G.slice(0,K.index)+O+G.slice(K.index+K.full.length);continue}let U=K.attrs.trim(),B={},j=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,_;while((_=j.exec(U))!==null){let O=_[1]||_[2],F=_[3];if(_[1])try{B[O]=J0(F,X)}catch{B[O]=F}else B[O]=F}let H=J.componentsDir||"components",L=await X5(z,B,K.slotContent,H,X,Z,J,new Set,Y??new Set);G=G.slice(0,K.index)+L+G.slice(K.index+K.full.length)}catch(z){let U=z instanceof Error?z.message:String(z),B=`<!-- dynamic component error: ${Q9(U)} -->`;G=G.slice(0,K.index)+B+G.slice(K.index+K.full.length)}}return G=await KH(G,X,Z,J,Y),G}async function KH($,X,Z,J,Y){let G=$,Q=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,w=[],q;while((q=Q.exec(G))!==null)w.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let W=w.length-1;W>=0;W--){let K=w[W];try{let z=MQ(K.expr,X);if(!z||typeof z!=="string"){let j=`<!-- dynamic component: could not resolve "${Q9(kQ(K.expr))}" -->`;G=G.slice(0,K.index)+j+G.slice(K.index+K.full.length);continue}if(S4.has(z)){let j=IQ(z,K.attrs,"");G=G.slice(0,K.index)+j+G.slice(K.index+K.full.length);continue}let U=J.componentsDir||"components",B=await X5(z,{},"",U,X,Z,J,new Set,Y??new Set);G=G.slice(0,K.index)+B+G.slice(K.index+K.full.length)}catch(z){let U=z instanceof Error?z.message:String(z),B=`<!-- dynamic component error: ${Q9(U)} -->`;G=G.slice(0,K.index)+B+G.slice(K.index+K.full.length)}}return G}var S4,WH;var DQ=D(()=>{k0();T0();S4=new Set(["a","abbr","address","article","aside","audio","b","bdi","bdo","blockquote","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","meter","nav","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","video"]),WH=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"])});function _H($){let X=$.storageKey??"stx-color-mode",Z=$.initialMode??"auto",J=$.darkClass===void 0?"dark":$.darkClass,Y=$.attribute??null,G=$.autoValue??null;if(typeof X!=="string"||X.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!zH.has(Z))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(Z)}`);if(J!==null&&(typeof J!=="string"||!BH.test(J)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(J)}`);if(Y!==null&&(typeof Y!=="string"||!jH.test(Y)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(Y)}`);if(G!==null&&!UH.has(G))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(G)}`);if(J===null&&Y===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");return{storageKey:X,initialMode:Z==="system"?"auto":Z,darkClass:J,attribute:Y,autoValue:G}}function HH($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function P4($={}){let X=_H($);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${HH(X)};var p=c.initialMode;var a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}var m=p;if(p==="auto"){try{m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){m="light"}}var r=document.documentElement;if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}try{window.__STX_COLOR_MODE__={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",preference:p,mode:m}}catch(e){}}());`}</script>`}function yQ($,X={}){if($.includes("data-stx-color-mode-boot"))return $;let Z=C4($);if(Z===null)return $;let J=P4(X);return`${$.slice(0,Z)}
|
|
12400
|
+
${J}${$.slice(Z)}`}function C4($){let X=/<head\b[^>]*>/i.exec($);if(!X)return null;let Z=X.index+X[0].length,J=/^\s*<meta\b[^>]*\bcharset\b[^>]*>/i.exec($.slice(Z));if(J)Z+=J[0].length;return Z}function FH($){let X=/<head\b[^>]*>/i.exec($);if(!X)return $;let Z=X.index+X[0].length,J=$.toLowerCase().indexOf("</head>",Z),Y=$.slice(Z,J===-1?$.length:J),G=LH.exec(Y);if(!G||Y.slice(0,G.index).trim()==="")return $;let Q=Y.slice(0,G.index)+Y.slice(G.index+G[0].length);return $.slice(0,Z)+`
|
|
12401
|
+
${G[0]}`+Q+$.slice(Z+Y.length)}function bQ($){return VH(FH($))}function VH($){let X=OH.exec($);if(!X)return $;let Z=C4($);if(Z===null)return $;if(X.index<=Z||$.slice(Z,X.index).trim()==="")return $;let J=$.slice(0,X.index)+$.slice(X.index+X[0].length),Y=C4(J);if(Y===null)return $;return`${J.slice(0,Y)}
|
|
12402
|
+
${X[0]}${J.slice(Y)}`}var zH,UH,jH,BH,OH,LH;var v4=D(()=>{zH=new Set(["light","dark","auto","system"]),UH=new Set(["auto","system"]),jH=/^[a-z][\w:-]*$/i,BH=/^[\w-]+$/;OH=new RegExp("<script\\b[^>]*\\bdata-stx-color-mode-boot\\b[^>]*>[\\s\\S]*?<\\/script>","i"),LH=/<meta\b[^>]*\bcharset\b[^>]*>/i});function AH(){if(x4===null)x4=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return x4}function SQ($,X=AH()){if($.includes('name="stx-build"'))return $;let Z=/<head\b[^>]*>/i.exec($);if(!Z)return $;let J=Z.index+Z[0].length;return`${$.slice(0,J)}
|
|
12403
|
+
<meta name="stx-build" content="${X}">${$.slice(J)}`}var x4=null;function R1($){return String($).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function RH($){return String($).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function f4($){if($.name)return`name="${$.name}"`;if($.property)return`property="${$.property}"`;if($.charset!=null)return"charset=";if($["http-equiv"])return`http-equiv="${$["http-equiv"]}"`;return""}function c5($,X){return Object.entries($).filter(([Z])=>!X?.(Z)).map(([Z,J])=>`${Z}="${R1(String(J))}"`).join(" ")}function NH($={},X="en"){let Z=[],J=[],Y="",G=X;for(let[w,q]of Object.entries($||{})){if(q==null)continue;let W=w.trim();if(!PQ.test(W))continue;let K=W.toLowerCase();if(K==="lang"){G=String(q);continue}if(K==="class"){Y=String(q).trim();continue}Z.push(` ${W}="${R1(String(q))}"`),J.push(W)}let Q=` lang="${R1(G)}"`;if(Y)Q+=` class="${R1(Y)}"`;if(Q+=Z.join(""),Y)Q+=` ${q9}="${R1(Y)}"`;if(J.length)Q+=` ${w9}="${R1(J.join(" "))}"`;return Q}function vQ($={},X={}){let Z={...$,...X};if($.class&&X.class){let J=$.class.split(/\s+/).filter(Boolean);for(let Y of X.class.split(/\s+/).filter(Boolean))if(!J.includes(Y))J.push(Y);Z.class=J.join(" ")}return Z}function xQ($,X={}){if(!X||Object.keys(X).length===0)return $;let Z=$.match(/<html\b([^>]*)>/i);if(!Z)return $;let J={},Y=[],G=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,Q;while((Q=G.exec(Z[1]))!==null){let K=Q[1];if(!(K in J))Y.push(K);J[K]=Q[2]??Q[3]??Q[4]??""}let w=[],q=[];for(let[K,z]of Object.entries(X)){if(z==null)continue;let U=K.trim();if(!PQ.test(U))continue;let B=U.toLowerCase();if(B==="class"){let j=(J.class||"").split(/\s+/).filter(Boolean);for(let _ of String(z).split(/\s+/).filter(Boolean))if(!j.includes(_))j.push(_),w.push(_);if(!("class"in J))Y.push("class");J.class=j.join(" ");continue}if(!(U in J))Y.push(U);if(J[U]=String(z),B!=="lang")q.push(U)}if(w.length){if(!(q9 in J))Y.push(q9);J[q9]=w.join(" ")}if(q.length){if(!(w9 in J))Y.push(w9);J[w9]=q.join(" ")}let W=Y.map((K)=>` ${K}="${R1(J[K])}"`).join("");return $.replace(Z[0],()=>`<html${W}>`)}function fQ($){if($.includes("data-stx-cloak"))return $;let X=$.lastIndexOf("</head>");if(X===-1)return $;return`${$.slice(0,X)}${CQ}
|
|
12404
|
+
${$.slice(X)}`}function TH($){let X=[],Z=0;while(Z<$.length){let G=$.slice(Z),Q=G.match(/^\s+/);if(Q){Z+=Q[0].length;continue}if(G.startsWith("<!--")){let z=$.indexOf("-->",Z);if(z===-1)break;Z=z+3;continue}let w=G.match(/^<script\b[^>]*>/i);if(w){let z=$.toLowerCase().indexOf("</script>",Z+w[0].length);if(z===-1)break;Z=z+9;continue}let q=G.match(/^<link\b[^>]*>/i);if(q){X.push(q[0]),Z+=q[0].length;continue}let W=G.match(/^<meta\b[^>]*>/i);if(W){X.push(W[0]),Z+=W[0].length;continue}let K=G.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(K){X.push(K[0]),Z+=K[0].length;continue}break}if(X.length===0)return{body:$,hoisted:X};let J="",Y=0;while(Y<$.length&&Y<Z){let G=$.slice(Y),Q=G.match(/^<link\b[^>]*>/i);if(Q&&X.includes(Q[0])){Y+=Q[0].length;continue}let w=G.match(/^<meta\b[^>]*>/i);if(w&&X.includes(w[0])){Y+=w[0].length;continue}let q=G.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(q&&X.includes(q[0])){Y+=q[0].length;continue}J+=$[Y],Y++}return J+=$.slice(Z),{body:J,hoisted:X}}function MH($,X={},Z={}){let{title:J="stx App",lang:Y="en",meta:G=[],link:Q=[],script:w=[],headRaw:q="",htmlAttrs:W={},bodyClass:K="",bodyAttrs:z={}}=X,U=Z.title||J,B=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],j=new Set(G.map(f4).filter(Boolean)),H=[...B.filter((k)=>!j.has(f4(k))),...G].map((k)=>{return` <meta ${c5(k)}>`}).join(`
|
|
12405
12405
|
`),L=Q.map((k)=>{return` <link ${c5(k)}>`}).join(`
|
|
12406
12406
|
`),O=w.map((k)=>{if(k.src)return` <script ${c5(k,(y)=>y==="content")}></script>`;if(k.content)return` <script>${k.content}</script>`;return""}).filter(Boolean).join(`
|
|
12407
|
-
`),F=
|
|
12407
|
+
`),F=NH(W,Y),V=Object.entries(z).map(([k,y])=>` ${k}="${R1(String(y))}"`).join(""),A=K?` class="${R1(K)}"`:"",{body:R,hoisted:N}=TH($),T=[H,Z.colorMode?` ${P4(Z.colorMode)}`:"",` <title>${Z.titleIsHtml?U:RH(U)}</title>`,` ${CQ}`,L,O,q?` ${q}`:"",...(Z.styles||[]).map((k)=>` ${k}`),...N.map((k)=>` ${k}`),...(Z.headScripts||[]).map((k)=>` ${k}`),Z.headStack||""].filter(Boolean),M=[R,...(Z.bodyScripts||[]).map((k)=>k),Z.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
|
|
12408
12408
|
<html${F}>
|
|
12409
12409
|
<head>
|
|
12410
12410
|
${T.join(`
|
|
@@ -12416,13 +12416,13 @@ ${M.join(`
|
|
|
12416
12416
|
</body>
|
|
12417
12417
|
</html>`}function g4($){let X=0;while(X<$.length){let Z=$.slice(X),J=Z.match(/^\s+/);if(J){X+=J[0].length;continue}if(Z.startsWith("<!--")){let G=$.indexOf("-->",X);if(G===-1)return!1;X=G+3;continue}let Y=Z.match(/^<(script|style)\b[^>]*>/i);if(Y){let G=`</${Y[1].toLowerCase()}>`,Q=$.toLowerCase().indexOf(G,X+Y[0].length);if(Q===-1)return!1;X=Q+G.length;continue}return/^<!DOCTYPE\b/i.test(Z)||/^<html[\s>]/i.test(Z)}return!1}function h4($){return g4($)}function gQ($,X={}){let Z=$.lastIndexOf("</head>");if(Z===-1)return $;let{meta:J=[],link:Y=[],script:G=[],headRaw:Q=""}=X,w=$.slice(0,Z),q=[];for(let W of J){let K=f4(W);if(K&&w.includes(K))continue;q.push(` <meta ${c5(W)}>`)}for(let W of Y){if(W.href&&w.includes(`href="${W.href}"`))continue;q.push(` <link ${c5(W)}>`)}for(let W of G)if(W.src){if(w.includes(`src="${W.src}"`))continue;q.push(` <script ${c5(W,(K)=>K==="content")}></script>`)}else if(W.content){if(w.includes(W.content))continue;q.push(` <script>${W.content}</script>`)}if(Q&&!w.includes(Q))q.push(` ${Q}`);if(q.length===0)return $;return`${$.slice(0,Z)}${q.join(`
|
|
12418
12418
|
`)}
|
|
12419
|
-
${$.slice(Z)}`}function hQ($,X={},Z={}){if(h4($))return $;return
|
|
12419
|
+
${$.slice(Z)}`}function hQ($,X={},Z={}){if(h4($))return $;return MH($,X,Z)}var CQ="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",w9="data-stx-html-attrs",q9="data-stx-html-class",PQ;var uQ=D(()=>{v4();PQ=/^[A-Za-z_:][\w:.-]*$/});import p5 from"path";function dQ($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function mQ($,X,Z){try{let J;if($.startsWith("/")){let Y=X;for(let G=0;G<5;G++){let Q=p5.join(Y,$);if(await Bun.file(Q).exists())return Q;Y=p5.dirname(Y)}J=p5.join(X,$)}else if($.startsWith("./")||$.startsWith("../"))J=p5.resolve(X,$);else J=p5.resolve(X,$);if(await Bun.file(J).exists())return J;return null}catch{return null}}async function lQ($,X,Z){let J=$,Y=p5.dirname(X),G=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,Q;while((Q=G.exec(J))!==null){let[W,K,z,U]=Q;if(dQ(z))continue;let B=await mQ(z,Y,X);if(B)try{let j=await Bun.file(B).text();if(Z.add(B),z.endsWith(".ts")||z.endsWith(".tsx")){let H=await Bun.build({entrypoints:[B],target:"browser",minify:!1,define:g0()});if(H.outputs.length>0)j=await H.outputs[0].text()}let _=`<script>
|
|
12420
12420
|
// Source: ${z}
|
|
12421
12421
|
${j}
|
|
12422
12422
|
</script>`;J=J.replace(W,_),G.lastIndex=0}catch(j){}}let w=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=w.exec(J))!==null){let[W,K,z,U]=q,B=K+U;if(dQ(z))continue;if(/rel=["']stylesheet["']/.test(B)||z.endsWith(".css")){let _=await mQ(z,Y,X);if(_)try{let H=await Bun.file(_).text();Z.add(_);let L=`<style>
|
|
12423
12423
|
/* Source: ${z} */
|
|
12424
12424
|
${H}
|
|
12425
|
-
</style>`;J=J.replace(W,L),w.lastIndex=0}catch(H){}}}return J}var cQ=D(()=>{E1()});function u4($,X){let Z=$,J=/@json\s*\(/g,Y;while((Y=J.exec(Z))!==null){let G=Y.index,Q=G+Y[0].length-1,w=1,q=Q+1,W=null,K=!1;while(q<Z.length&&w>0){let F=Z[q];if(K){K=!1,q++;continue}if(F==="\\"&&W){K=!0,q++;continue}if(W){if(F===W)W=null;q++;continue}if(F==='"'||F==="'"||F==="`"){W=F,q++;continue}if(F==="(")w++;else if(F===")"){if(w--,w===0)break}q++}if(w!==0)break;let z=Z.substring(Q+1,q).trim(),U=Z.substring(G,q+1),B=-1,j=0,_=null,H=!1;for(let F=0;F<z.length;F++){let V=z[F];if(H){H=!1;continue}if(V==="\\"&&_){H=!0;continue}if(_){if(V===_)_=null;continue}if(V==='"'||V==="'"||V==="`"){_=V;continue}if(V==="("||V==="["||V==="{")j++;else if(V===")"||V==="]"||V==="}")j--;if(V===","&&j===0){B=F;break}}let L=B>=0?z.substring(0,B).trim():z,O=B>=0?z.substring(B+1).trim():void 0;try{let F=L.trim(),V;if(q0(F))V=W0(F,Object.keys(X))(...Object.values(X));else V=void 0;let A;if(O==="true")A=JSON.stringify(V,null,2);else A=JSON.stringify(V);let R=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Z=Z.substring(0,G)+R+Z.substring(q+1),J.lastIndex=G+R.length}catch(F){$1.log(F instanceof Error?F:Error(String(F)),{directive:"@json"},"error"),J.lastIndex=G+U.length}}return Z}function d4($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function pQ($){let X=$,Z=/@memo\s*\(/g,J,Y=[];while((J=Z.exec(X))!==null){let G=J.index,Q=G+J[0].length,w=1,q=Q;while(q<X.length&&w>0){if(X[q]==="(")w++;else if(X[q]===")")w--;q++}if(w!==0)continue;let W=X.slice(Q,q-1).trim(),K=q,z=X.slice(K),U=z.indexOf("@endmemo");if(U===-1)continue;let B=z.slice(0,U),j=K+U+8,_=B.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),H=_?_[0].length:0,L=B.slice(H),O=B.match(/(\s*)$/),F=O?O[0].length:0,V=L.slice(0,L.length-F),A=V.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),R;if(A){let[N,T,M="",k]=A,y=`<${T}${M} data-stx-memo="${W}"${k}>`;R=B.slice(0,H)+y+V.slice(N.length)+B.slice(H+V.length)}else R=`${B.slice(0,H)}<div data-stx-memo="${W}">${V}</div>${B.slice(H+V.length)}`;Y.push({start:G,end:j,replacement:R}),Z.lastIndex=j}for(let G=Y.length-1;G>=0;G--){let Q=Y[G];X=X.slice(0,Q.start)+Q.replacement+X.slice(Q.end)}return X.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function m4($){let X=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return X=X.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),X}function iQ($){let Z=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),J="",Y=0,G;while((G=Z.exec($))!==null){let Q=G.index,w=Q+G[0].length,q=!1,W=!1,K=-1;while(w<$.length){let _=$[w];if(q){if(_==="'")q=!1}else if(W){if(_==='"')W=!1}else if(_==="'")q=!0;else if(_==='"')W=!0;else if(_===">"){K=w;break}w++}if(K===-1)continue;if($.slice(Q,K+1).includes("x-cloak"))continue;let U=$.slice(K+1),B=U.indexOf("</"),j=B>=0?U.slice(0,B):U.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(j))J+=$.slice(Y,K)+" x-cloak>",Y=K+1}return J+=$.slice(Y),J}function nQ($){let X=/<[a-z][\w-]*/gi,Z="",J=0,Y;while((Y=X.exec($))!==null){let G=Y.index,Q=Y[0].slice(1).toLowerCase();if(Q==="script"||Q==="style"){let j=`</${Q}>`,_=$.toLowerCase().indexOf(j,G);if(_!==-1)X.lastIndex=_+j.length;continue}let w=G+Y[0].length,q=!1,W=!1,K=-1;while(w<$.length){let j=$[w];if(q){if(j==="'")q=!1}else if(W){if(j==='"')W=!1}else if(j==="'")q=!0;else if(j==='"')W=!0;else if(j===">"){K=w;break}w++}if(K===-1)continue;let z=$.slice(G+Y[0].length,K);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(z))continue;if(!
|
|
12425
|
+
</style>`;J=J.replace(W,L),w.lastIndex=0}catch(H){}}}return J}var cQ=D(()=>{E1()});function u4($,X){let Z=$,J=/@json\s*\(/g,Y;while((Y=J.exec(Z))!==null){let G=Y.index,Q=G+Y[0].length-1,w=1,q=Q+1,W=null,K=!1;while(q<Z.length&&w>0){let F=Z[q];if(K){K=!1,q++;continue}if(F==="\\"&&W){K=!0,q++;continue}if(W){if(F===W)W=null;q++;continue}if(F==='"'||F==="'"||F==="`"){W=F,q++;continue}if(F==="(")w++;else if(F===")"){if(w--,w===0)break}q++}if(w!==0)break;let z=Z.substring(Q+1,q).trim(),U=Z.substring(G,q+1),B=-1,j=0,_=null,H=!1;for(let F=0;F<z.length;F++){let V=z[F];if(H){H=!1;continue}if(V==="\\"&&_){H=!0;continue}if(_){if(V===_)_=null;continue}if(V==='"'||V==="'"||V==="`"){_=V;continue}if(V==="("||V==="["||V==="{")j++;else if(V===")"||V==="]"||V==="}")j--;if(V===","&&j===0){B=F;break}}let L=B>=0?z.substring(0,B).trim():z,O=B>=0?z.substring(B+1).trim():void 0;try{let F=L.trim(),V;if(q0(F))V=W0(F,Object.keys(X))(...Object.values(X));else V=void 0;let A;if(O==="true")A=JSON.stringify(V,null,2);else A=JSON.stringify(V);let R=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Z=Z.substring(0,G)+R+Z.substring(q+1),J.lastIndex=G+R.length}catch(F){$1.log(F instanceof Error?F:Error(String(F)),{directive:"@json"},"error"),J.lastIndex=G+U.length}}return Z}function d4($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function pQ($){let X=$,Z=/@memo\s*\(/g,J,Y=[];while((J=Z.exec(X))!==null){let G=J.index,Q=G+J[0].length,w=1,q=Q;while(q<X.length&&w>0){if(X[q]==="(")w++;else if(X[q]===")")w--;q++}if(w!==0)continue;let W=X.slice(Q,q-1).trim(),K=q,z=X.slice(K),U=z.indexOf("@endmemo");if(U===-1)continue;let B=z.slice(0,U),j=K+U+8,_=B.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),H=_?_[0].length:0,L=B.slice(H),O=B.match(/(\s*)$/),F=O?O[0].length:0,V=L.slice(0,L.length-F),A=V.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),R;if(A){let[N,T,M="",k]=A,y=`<${T}${M} data-stx-memo="${W}"${k}>`;R=B.slice(0,H)+y+V.slice(N.length)+B.slice(H+V.length)}else R=`${B.slice(0,H)}<div data-stx-memo="${W}">${V}</div>${B.slice(H+V.length)}`;Y.push({start:G,end:j,replacement:R}),Z.lastIndex=j}for(let G=Y.length-1;G>=0;G--){let Q=Y[G];X=X.slice(0,Q.start)+Q.replacement+X.slice(Q.end)}return X.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function m4($){let X=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return X=X.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),X}function iQ($){let Z=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),J="",Y=0,G;while((G=Z.exec($))!==null){let Q=G.index,w=Q+G[0].length,q=!1,W=!1,K=-1;while(w<$.length){let _=$[w];if(q){if(_==="'")q=!1}else if(W){if(_==='"')W=!1}else if(_==="'")q=!0;else if(_==='"')W=!0;else if(_===">"){K=w;break}w++}if(K===-1)continue;if($.slice(Q,K+1).includes("x-cloak"))continue;let U=$.slice(K+1),B=U.indexOf("</"),j=B>=0?U.slice(0,B):U.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(j))J+=$.slice(Y,K)+" x-cloak>",Y=K+1}return J+=$.slice(Y),J}function nQ($){let X=/<[a-z][\w-]*/gi,Z="",J=0,Y;while((Y=X.exec($))!==null){let G=Y.index,Q=Y[0].slice(1).toLowerCase();if(Q==="script"||Q==="style"){let j=`</${Q}>`,_=$.toLowerCase().indexOf(j,G);if(_!==-1)X.lastIndex=_+j.length;continue}let w=G+Y[0].length,q=!1,W=!1,K=-1;while(w<$.length){let j=$[w];if(q){if(j==="'")q=!1}else if(W){if(j==='"')W=!1}else if(j==="'")q=!0;else if(j==='"')W=!0;else if(j===">"){K=w;break}w++}if(K===-1)continue;let z=$.slice(G+Y[0].length,K);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(z))continue;if(!kH.test(z))continue;let U=$[K-1]==="/",B=U?K-1:K;Z+=`${$.slice(J,B)} x-cloak${U?" ":""}`,J=B}return Z+=$.slice(J),Z}var kH;var l4=D(()=>{V1();T0();kH=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function c4($,X,Z,J){let Y=typeof Z==="boolean"?{enabled:Z,failOnViolation:Z}:Z??{enabled:!1},G=Y.allowPatterns??[],Q=[],w=w1($.replace(/\{\{--[\s\S]*?--\}\}/g,(q)=>q.replace(/[^\n]/g," ")));for(let{pattern:q,message:W,suggestion:K}of IH){if(G.some((U)=>/\w/.test(U)&&W.includes(U)))continue;q.lastIndex=0;let z=w.match(q);if(z&&z.length>0){let U=w.split(`
|
|
12426
12426
|
`),B=$.split(`
|
|
12427
12427
|
`),j=[];U.forEach((O,F)=>{if(q.lastIndex=0,q.test(O))j.push(F+1)});let _=j.length>0?` (script line${j.length>1?"s":""} ${j.join(", ")})`:"",H=j.slice(0,3).map((O)=>` ${O} | ${(B[O-1]??"").trim().slice(0,100)}`).join(`
|
|
12428
12428
|
`),L=H?`
|
|
@@ -12430,8 +12430,8 @@ ${H}`:"";Q.push(` \u2717 ${W}${_}
|
|
|
12430
12430
|
\u2192 ${K}${L}`)}}if(Q.length>0&&Y.enabled){let q=(z)=>{let U=`${process.cwd()}/`;return z.startsWith(U)?z.slice(U.length):z},K=`[STX] DOM API violation in ${J&&J!==X?`${q(J)} (composed into ${q(X)})`:q(X)}:
|
|
12431
12431
|
${Q.join(`
|
|
12432
12432
|
`)}
|
|
12433
|
-
Tip: prefer useRef(), navigate(), and composables for component code`;if(Y.failOnViolation)throw Error(K);else console.warn(K)}}var
|
|
12434
|
-
`)}function K9($,X,Z){let J=$.get(X);return J!==void 0&&J.signature===Z?J.value:void 0}function U1($,X,Z,J){return $.set(X,{signature:Z,value:J}),J}var i4=()=>{};var rQ={};a(rQ,{getStoreScript:()=>
|
|
12433
|
+
Tip: prefer useRef(), navigate(), and composables for component code`;if(Y.failOnViolation)throw Error(K);else console.warn(K)}}var IH;var p4=D(()=>{IH=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/(?:\bwindow\.)?localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables \u2014 or @appearanceBootstrap if this must run before first paint, where the runtime does not exist yet"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}]});import EH from"fs";function W9($){return[...$].sort().map((X)=>{try{let Z=EH.statSync(X);return`${X}:${Z.size}:${Z.mtimeMs}`}catch{return`${X}:missing`}}).join(`
|
|
12434
|
+
`)}function K9($,X,Z){let J=$.get(X);return J!==void 0&&J.signature===Z?J.value:void 0}function U1($,X,Z,J){return $.set(X,{signature:Z,value:J}),J}var i4=()=>{};var rQ={};a(rQ,{getStoreScript:()=>yH,clearStoreCache:()=>bH});import z9 from"path";function DH($,X){for(let Z of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(Z[1])X.add(Z[1]);for(let Z of $.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let J of(Z[1]??"").split(",")){let G=((J.includes(":")?J.split(":").pop():J)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(G))X.add(G)}for(let Z of $.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let J of(Z[1]??"").split(",")){let Y=J.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(Y))X.add(Y)}}async function yH($){let X;if($)X=z9.resolve($);else{let j=await t0();X=z9.resolve(j.root||process.cwd(),j.storesDir||"stores")}let Z=new Bun.Glob("*.ts"),J=[];try{for await(let j of Z.scan({cwd:X,absolute:!0})){let _=z9.basename(j,".ts");if(["index","types"].includes(_))continue;if(j.includes(".d.ts"))continue;J.push(j)}}catch{return U1(i5,X,"",""),null}let Y=W9(J),G=K9(i5,X,Y);if(G!==void 0)return G||null;if(J.length===0)return U1(i5,X,Y,""),null;let Q=[];for(let j of J){let _=await Bun.file(j).text();Q.push({file:j,hasUseStore:/useStore\s*\(/.test(_)})}Q.sort((j,_)=>{if(j.hasUseStore===_.hasUseStore)return 0;return j.hasUseStore?1:-1});let w=Q.map((j)=>j.file),q=[],W=new Set,K=new Bun.Transpiler({loader:"ts",target:"browser",define:g0()});for(let j of w)try{let _=await Bun.file(j).text(),H=z9.basename(j,".ts");DH(_,W),_=l0(_),_=A8(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=K.transformSync(_),q.push(`// Store: ${H}
|
|
12435
12435
|
${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load store ${j}:`,_)}if(q.length===0)return U1(i5,X,Y,""),null;let z=q.join(`
|
|
12436
12436
|
|
|
12437
12437
|
`),B=`;(function(){
|
|
@@ -12439,8 +12439,8 @@ var __stx = window.stx || {};
|
|
|
12439
12439
|
${O1.filter((j)=>!W.has(j)&&new RegExp(`\\b${j}\\b`).test(z)).map((j)=>`var ${j} = __stx[${JSON.stringify(j)}];`).join(`
|
|
12440
12440
|
`)}
|
|
12441
12441
|
${z}
|
|
12442
|
-
})();`;return U1(i5,X,Y,B),B}function
|
|
12443
|
-
${Q.transformSync(_).trim()}`);for(let L of H)W.add(L)}catch(L){console.warn(`[stx] framework composable ${U9.basename(j)} could not be bundled:`,L)}}let z=Z.filter((j)=>!W.has(j)&&!
|
|
12442
|
+
})();`;return U1(i5,X,Y,B),B}function bH(){i5.clear()}var i5;var oQ=D(()=>{L1();E1();Q1();i4();i5=new Map});var n4,xI;var sQ=D(()=>{n4=["broadcast","calculateDistance","canNotify","clearCookies","clearFetchCache","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],xI=new Set(n4)});var eQ={};a(eQ,{selectComposableFiles:()=>aQ,referencedFrameworkComposables:()=>tQ,getFrameworkComposableScript:()=>vH,clearFrameworkComposableCache:()=>CH,__setRuntimeOwnedForTest:()=>xH});import U9 from"path";function CH(){Z8.clear()}function aQ($){let X=new Map;for(let Z of $){let J=U9.basename(Z);if(J.endsWith(".d.ts"))continue;let Y=J.replace(/\.[jt]s$/,"");if(Y==="index")continue;if(Y===J)continue;let G=X.get(Y);if(G&&!G.endsWith(".js"))continue;X.set(Y,Z)}return[...X.values()].sort()}function PH($,X){let Z=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Z}\\b`).test($)}function tQ($){if(!$)return[];let X=$.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),Z=[];for(let J of SH){if(r4.has(J))continue;let Y=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${Y}\\s*\\(`).test(X))Z.push(J)}return Z.sort()}async function vH($,X){let Z=tQ($);if(Z.length===0)return null;let J=X??U9.join(import.meta.dir,"composables"),Y=`${J}\x00${Z.join(",")}`,G=Z8.get(Y);if(G!==void 0)return G||null;let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:g0()}),w=new Set(Z),q=[],W=new Set,K=[];try{let j=new Bun.Glob("*.{ts,js}");for await(let _ of j.scan({cwd:J,absolute:!0}))K.push(_)}catch{return Z8.set(Y,""),null}K=aQ(K);for(let j of K){let _;try{_=await Bun.file(j).text()}catch{continue}let H=[];try{H=Q.scan(_).exports.filter((L)=>L!=="default")}catch{continue}if(!H.some((L)=>w.has(L)))continue;try{_=_.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^import\s+type\s+.*$/gm,""),_=_.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),_=_.replace(/^export\s+default\s+/gm,""),_=_.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),q.push(`// ${U9.basename(j).replace(/\.[jt]s$/,"")}
|
|
12443
|
+
${Q.transformSync(_).trim()}`);for(let L of H)W.add(L)}catch(L){console.warn(`[stx] framework composable ${U9.basename(j)} could not be bundled:`,L)}}let z=Z.filter((j)=>!W.has(j)&&!PH($,j));if(z.length>0)console.warn(`[stx] could not bundle ${z.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(q.length===0)return Z8.set(Y,""),null;let U=[...W].map((j)=>` try { if (!(${JSON.stringify(j)} in __s)) { __s[${JSON.stringify(j)}] = ${j}; if (!(${JSON.stringify(j)} in window)) window[${JSON.stringify(j)}] = ${j}; } } catch (e) {}`).join(`
|
|
12444
12444
|
`),B=`<script data-stx-framework-composables>
|
|
12445
12445
|
;(function(){
|
|
12446
12446
|
var __s = window.stx = window.stx || {};
|
|
@@ -12449,7 +12449,7 @@ ${q.join(`
|
|
|
12449
12449
|
`)}
|
|
12450
12450
|
${U}
|
|
12451
12451
|
})();
|
|
12452
|
-
</script>`;return Z8.set(Y,B),B}function
|
|
12452
|
+
</script>`;return Z8.set(Y,B),B}function xH($){r4.clear();for(let X of $)r4.add(X)}var Z8,r4,SH;var $w=D(()=>{E1();sQ();Z8=new Map,r4=new Set,SH=new Set(n4)});var Zw={};a(Zw,{getComposableScript:()=>uH,clearComposableCache:()=>dH});import J8 from"path";function Xw($){let X=J8.basename($,".ts");return X==="index"||X==="types"||$.endsWith(".d.ts")}async function gH($){if($)return J8.resolve($);let X=`<default>:${process.cwd()}`,Z=o4.get(X);if(Z!==void 0)return Z;let J=await hH();if(J!==null)o4.set(X,J);return J}async function hH(){let $=await t0(),X=$.root||process.cwd(),Z=$.composablesDir;if(Z)return J8.resolve(X,Z);for(let J of fH){let Y=J8.resolve(X,J);try{let G=new Bun.Glob("**/*.ts");for await(let Q of G.scan({cwd:Y,absolute:!0}))if(!Xw(Q))return Y}catch{}}return null}async function uH($){let X=await gH($);if(!X)return null;let Z=[];try{let j=new Bun.Glob("**/*.ts");for await(let _ of j.scan({cwd:X,absolute:!0})){if(Xw(_))continue;Z.push(_)}}catch{return U1(n5,X,"",""),null}let J=W9(Z),Y=K9(n5,X,J);if(Y!==void 0)return Y||null;if(Z.length===0)return U1(n5,X,J,""),null;Z.sort();let G=new Bun.Transpiler({loader:"ts",target:"browser",define:g0()}),Q=[],w=new Set,q=new Set;for(let j of Z)try{let _=await Bun.file(j).text(),H=J8.basename(j,".ts");for(let L of _.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(L[1])q.add(L[1]);try{for(let L of G.scan(_).exports)if(L!=="default")w.add(L)}catch{}_=l0(_),_=A8(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=G.transformSync(_),Q.push(`// Composable: ${H}
|
|
12453
12453
|
${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load composable ${j}:`,_)}if(Q.length===0||w.size===0)return U1(n5,X,J,""),null;let W=[...w].map((j)=>` try { __c[${JSON.stringify(j)}] = ${j}; } catch (e) {}`).join(`
|
|
12454
12454
|
`),K=JSON.stringify([...w]),z=Q.join(`
|
|
12455
12455
|
|
|
@@ -12474,7 +12474,7 @@ ${W}
|
|
|
12474
12474
|
}
|
|
12475
12475
|
window[__n] = __c[__n];
|
|
12476
12476
|
}
|
|
12477
|
-
})();`;return U1(n5,X,J,B),B}function
|
|
12477
|
+
})();`;return U1(n5,X,J,B),B}function dH(){n5.clear(),o4.clear()}var n5,o4,fH;var Jw=D(()=>{L1();E1();i4();Q1();n5=new Map,o4=new Map,fH=["composables","functions"]});var Gw={};a(Gw,{processDeferDirectives:()=>iH});function mH(){return`stx-defer-${++Yw}`}function lH($){let X=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(X)return{trigger:X[1],value:X[2]};return{trigger:"immediate"}}function cH($,X,Z){let{trigger:J,value:Y}=lH(X),G=Z,Q,w,q,W=Z.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(W)Q=W[1].trim(),G=G.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let K=Z.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(K)w=K[1].trim(),G=G.replace(/@loading[\s\S]*?(?=@error|$)/,"");let z=Z.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(z)q=z[2].trim(),G=G.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return G=G.trim(),{trigger:J,triggerValue:Y,content:G,placeholder:Q,loading:w,error:q}}function pH($,X){let{trigger:Z,triggerValue:J}=X,Y;switch(Z){case"visible":Y=`
|
|
12478
12478
|
const observer = new IntersectionObserver((entries) => {
|
|
12479
12479
|
if (entries[0].isIntersecting) {
|
|
12480
12480
|
observer.disconnect();
|
|
@@ -12547,7 +12547,7 @@ else {
|
|
|
12547
12547
|
${Y}
|
|
12548
12548
|
})();
|
|
12549
12549
|
</script>
|
|
12550
|
-
`}function
|
|
12550
|
+
`}function iH($,X,Z){Yw=0;let J=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(J,(Y,G,Q)=>{let w=mH(),q=cH(Y,G,Q),W=q.placeholder?`<div data-defer-placeholder>${q.placeholder}</div>`:"",K=q.loading?`<div data-defer-loading style="display: none;">${q.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',z=q.error?`<div data-defer-error style="display: none;">${q.error}</div>`:"",U=`<div data-defer-content style="display: none;">${q.content}</div>`,B=pH(w,q);return`
|
|
12551
12551
|
<div id="${w}" class="stx-defer" data-defer-trigger="${q.trigger}">
|
|
12552
12552
|
${W}
|
|
12553
12553
|
${K}
|
|
@@ -12555,7 +12555,7 @@ else {
|
|
|
12555
12555
|
${z}
|
|
12556
12556
|
</div>
|
|
12557
12557
|
${B}
|
|
12558
|
-
`})}var Yw=0;var ww={};a(ww,{processTeleportDirectives:()=>
|
|
12558
|
+
`})}var Yw=0;var ww={};a(ww,{processTeleportDirectives:()=>sH,ensureTeleportTargets:()=>aH});function nH(){return`stx-teleport-${++Qw}`}function rH($){let X=$.split(",").map((Y)=>Y.trim()),Z=X[0].replace(/['"]/g,""),J;for(let Y=1;Y<X.length;Y++){let G=X[Y].match(/disabled:\s*(.+)/);if(G)J=G[1].trim()}return{target:Z,disabled:J}}function oH($,X){return`
|
|
12559
12559
|
<script>
|
|
12560
12560
|
(function() {
|
|
12561
12561
|
const source = document.getElementById('${$}');
|
|
@@ -12601,12 +12601,12 @@ else {
|
|
|
12601
12601
|
});
|
|
12602
12602
|
})();
|
|
12603
12603
|
</script>
|
|
12604
|
-
`}function
|
|
12604
|
+
`}function sH($,X,Z){Qw=0;let J=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(J,(Y,G,Q)=>{let w=nH(),{target:q,disabled:W}=rH(G),K=Q.trim();if(W)try{let U=!1;if(W==="true")U=!0;else if(W==="false")U=!1;else if(W in X)U=Boolean(X[W]);if(U)return`<div class="stx-teleport-inline" data-teleport-disabled>${K}</div>`}catch{}let z=oH(w,q);return`
|
|
12605
12605
|
<div id="${w}" class="stx-teleport-source" style="display: none;">
|
|
12606
12606
|
<template>${K}</template>
|
|
12607
12607
|
</div>
|
|
12608
12608
|
${z}
|
|
12609
|
-
`})}function
|
|
12609
|
+
`})}function aH(){return`
|
|
12610
12610
|
<script>
|
|
12611
12611
|
(function() {
|
|
12612
12612
|
// Common teleport targets
|
|
@@ -12623,7 +12623,7 @@ else {
|
|
|
12623
12623
|
});
|
|
12624
12624
|
})();
|
|
12625
12625
|
</script>
|
|
12626
|
-
`}var Qw=0;var zw={};a(zw,{processTransitionDirectives:()=>
|
|
12626
|
+
`}var Qw=0;var zw={};a(zw,{processTransitionDirectives:()=>XO,processTransitionAttributes:()=>GO,performLeave:()=>$O,performEnter:()=>eH,generateTransitionRuntime:()=>YO,generateTransitionCSS:()=>JO});function qw($,X={}){return{enterFrom:X.enterClass||`${$}-enter-from`,enterActive:X.enterActiveClass||`${$}-enter-active`,enterTo:X.enterToClass||`${$}-enter-to`,leaveFrom:X.leaveClass||`${$}-leave-from`,leaveActive:X.leaveActiveClass||`${$}-leave-active`,leaveTo:X.leaveToClass||`${$}-leave-to`}}function tH($){let X=getComputedStyle($),Z=X.transitionDuration||"0s",J=X.animationDuration||"0s",Y=(G)=>{let Q=G.match(/^([\d.]+)(s|ms)?$/);if(!Q)return 0;let w=parseFloat(Q[1]);return(Q[2]||"s")==="ms"?w:w*1000};return Math.max(Y(Z),Y(J))}function Ww($,X){return new Promise((Z)=>{let J=X??tH($);if(J===0){Z();return}let Y=!1,G=()=>{if(Y)return;Y=!0,$.removeEventListener("transitionend",Q),$.removeEventListener("animationend",Q),Z()},Q=(w)=>{if(w.target===$)G()};$.addEventListener("transitionend",Q),$.addEventListener("animationend",Q),setTimeout(G,J+50)})}function Kw($){$.offsetHeight}async function eH($,X={}){let Z=X.name||"stx",J=qw(Z,X),Y=typeof X.duration==="object"?X.duration.enter:X.duration;if(X.onBeforeEnter?.($),$.classList.add(J.enterFrom),$.classList.add(J.enterActive),Kw($),$.classList.remove(J.enterFrom),$.classList.add(J.enterTo),X.onEnter)await new Promise((G)=>{X.onEnter($,G)});else await Ww($,Y);$.classList.remove(J.enterActive),$.classList.remove(J.enterTo),X.onAfterEnter?.($)}async function $O($,X={}){let Z=X.name||"stx",J=qw(Z,X),Y=typeof X.duration==="object"?X.duration.leave:X.duration;if(X.onBeforeLeave?.($),$.classList.add(J.leaveFrom),$.classList.add(J.leaveActive),Kw($),$.classList.remove(J.leaveFrom),$.classList.add(J.leaveTo),X.onLeave)await new Promise((G)=>{X.onLeave($,G)});else await Ww($,Y);$.classList.remove(J.leaveActive),$.classList.remove(J.leaveTo),X.onAfterLeave?.($)}function XO($,X={},Z){let J=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(J,(Y,G,Q)=>{let w=ZO(G),q=w.name||"stx",W=w.duration||300,K=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
|
|
12627
12627
|
<div
|
|
12628
12628
|
class="stx-transition-wrapper"
|
|
12629
12629
|
data-transition="${q}"
|
|
@@ -12665,7 +12665,7 @@ else {
|
|
|
12665
12665
|
});
|
|
12666
12666
|
})();
|
|
12667
12667
|
</script>
|
|
12668
|
-
`})}function
|
|
12668
|
+
`})}function ZO($){let X={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Z.exec($))!==null){let Y=J[1],G=J[2]||J[3]||J[4]||J[5];switch(Y){case"name":X.name=G;break;case"duration":X.duration=parseInt(G,10);break;case"mode":X.mode=G;break;case"easing":X.easing=G;break}}return X}function JO(){return`
|
|
12669
12669
|
/* STX Transition Presets */
|
|
12670
12670
|
|
|
12671
12671
|
/* Fade */
|
|
@@ -12852,7 +12852,7 @@ else {
|
|
|
12852
12852
|
opacity: 1;
|
|
12853
12853
|
max-height: 1000px;
|
|
12854
12854
|
}
|
|
12855
|
-
`}function
|
|
12855
|
+
`}function YO(){return`
|
|
12856
12856
|
// STX Transition Runtime
|
|
12857
12857
|
(function() {
|
|
12858
12858
|
if (typeof window === 'undefined') return;
|
|
@@ -12941,7 +12941,7 @@ else {
|
|
|
12941
12941
|
|
|
12942
12942
|
console.log('[stx] Transition runtime initialized');
|
|
12943
12943
|
})();
|
|
12944
|
-
`}function
|
|
12944
|
+
`}function GO($){let X=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(X,(Z,J,Y,G)=>{let Q=Y||"300",w=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${J}" data-stx-transition-duration="${Q}" data-stx-transition-condition="${G}" data-stx-transition-id="${w}"`})}var jw={};a(jw,{withErrorBoundary:()=>Uw,processErrorBoundaryDirectives:()=>qO,generateErrorBoundaryRuntime:()=>jO,generateErrorBoundaryCSS:()=>UO,createErrorBoundary:()=>zO});function wO(){return`eb-${++QO}-${Date.now().toString(36)}`}function qO($,X={},Z){let J=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(J,(Y,G,Q,w)=>{let q=wO(),W=WO(G||"");return KO(q,Q.trim(),w.trim(),W)})}function WO($){let X={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,J;while((J=Z.exec($))!==null){let Y=J[1],G=J[2]||J[3]||J[4];switch(Y){case"id":X.id=G;break;case"logErrors":X.logErrors=G==="true";break}}return X}function KO($,X,Z,J){let Y=J.logErrors!==!1;return`
|
|
12945
12945
|
<div class="stx-error-boundary" data-boundary-id="${$}" data-has-error="false">
|
|
12946
12946
|
<div class="stx-error-boundary-content" data-boundary-content="${$}">
|
|
12947
12947
|
${X}
|
|
@@ -13061,7 +13061,7 @@ else {
|
|
|
13061
13061
|
};
|
|
13062
13062
|
})();
|
|
13063
13063
|
</script>
|
|
13064
|
-
`}async function Uw($,X,Z){try{return await $()}catch(J){if(Z)Z(J instanceof Error?J:Error(String(J)));else console.error("[stx:errorBoundary] SSR Error:",J);return X}}function
|
|
13064
|
+
`}async function Uw($,X,Z){try{return await $()}catch(J){if(Z)Z(J instanceof Error?J:Error(String(J)));else console.error("[stx:errorBoundary] SSR Error:",J);return X}}function zO($,X={}){let Z=X.onError?(J)=>X.onError(J,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(J)=>Uw(J,$,Z)}function UO(){return`
|
|
13065
13065
|
/* STX Error Boundary Styles */
|
|
13066
13066
|
.stx-error-boundary {
|
|
13067
13067
|
position: relative;
|
|
@@ -13105,7 +13105,7 @@ else {
|
|
|
13105
13105
|
color: #fecaca;
|
|
13106
13106
|
}
|
|
13107
13107
|
}
|
|
13108
|
-
`}function
|
|
13108
|
+
`}function jO(){return`
|
|
13109
13109
|
// STX Error Boundary Runtime
|
|
13110
13110
|
(function() {
|
|
13111
13111
|
if (typeof window === 'undefined') return;
|
|
@@ -13170,7 +13170,7 @@ else {
|
|
|
13170
13170
|
|
|
13171
13171
|
console.log('[stx] Error boundary runtime initialized');
|
|
13172
13172
|
})();
|
|
13173
|
-
`}var
|
|
13173
|
+
`}var QO=0;var Bw={};a(Bw,{renderSSRSuspense:()=>VO,processSuspenseDirectives:()=>HO,generateSuspenseRuntime:()=>RO,generateSuspenseCSS:()=>AO,createSSRSuspense:()=>FO});function _O(){return`suspense-${++BO}-${Date.now().toString(36)}`}function HO($,X={},Z){let J=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(J,(Y,G,Q,w)=>{let q=_O(),W=OO(G||"");return LO(q,Q.trim(),w.trim(),W)})}function OO($){let X={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Z.exec($))!==null){let Y=J[1],G=J[2]||J[3],Q=J[4];switch(Y){case"id":X.id=G;break;case"timeout":X.timeout=Q?parseInt(Q,10):void 0;break}}return X}function LO($,X,Z,J){let Y=J.timeout||30000,G=J.id||$;return`
|
|
13174
13174
|
<div class="stx-suspense" data-suspense-id="${$}" data-custom-id="${G}" data-status="pending">
|
|
13175
13175
|
<div class="stx-suspense-fallback" data-suspense-fallback="${$}">
|
|
13176
13176
|
${Z}
|
|
@@ -13360,7 +13360,7 @@ else {
|
|
|
13360
13360
|
}, 0);
|
|
13361
13361
|
})();
|
|
13362
13362
|
</script>
|
|
13363
|
-
`}function
|
|
13363
|
+
`}function FO($,X,Z){return{id:$,fallback:Z,content:X}}async function VO($){let X=$.map((J)=>`
|
|
13364
13364
|
<div id="stx-ssr-suspense-${J.id}" class="stx-ssr-suspense">
|
|
13365
13365
|
${J.fallback}
|
|
13366
13366
|
</div>
|
|
@@ -13385,7 +13385,7 @@ else {
|
|
|
13385
13385
|
}
|
|
13386
13386
|
})();
|
|
13387
13387
|
</script>
|
|
13388
|
-
`}}return{initial:X,streaming:Z()}}function
|
|
13388
|
+
`}}return{initial:X,streaming:Z()}}function AO(){return`
|
|
13389
13389
|
/* STX Suspense Styles */
|
|
13390
13390
|
.stx-suspense {
|
|
13391
13391
|
position: relative;
|
|
@@ -13441,7 +13441,7 @@ else {
|
|
|
13441
13441
|
background-size: 200% 100%;
|
|
13442
13442
|
}
|
|
13443
13443
|
}
|
|
13444
|
-
`}function
|
|
13444
|
+
`}function RO(){return`
|
|
13445
13445
|
// STX Suspense Runtime
|
|
13446
13446
|
(function() {
|
|
13447
13447
|
if (typeof window === 'undefined') return;
|
|
@@ -13508,7 +13508,7 @@ else {
|
|
|
13508
13508
|
|
|
13509
13509
|
console.log('[stx] Suspense runtime initialized');
|
|
13510
13510
|
})();
|
|
13511
|
-
`}var
|
|
13511
|
+
`}var BO=0;var Lw={};a(Lw,{processAsyncDirectives:()=>TO,isAsyncComponent:()=>kO,generateAsyncComponentRuntime:()=>EO,generateAsyncComponentCSS:()=>IO,defineAsyncComponent:()=>MO});function _w(){return`async-${++NO}-${Date.now().toString(36)}`}function TO($,X={},Z){let J=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,Y=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,G=$;return G=G.replace(J,(Q,w,q,W)=>{let K=_w(),z=Hw(w);return Ow(K,z,q.trim(),W.trim())}),G=G.replace(Y,(Q,w,q)=>{let W=_w(),K=Hw(w);return Ow(W,K,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),G}function Hw($){let X={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Z.exec($))!==null){let Y=J[1],G=J[2]||J[3],Q=J[4],w=J[5];switch(Y){case"component":X.component=G||w||"";break;case"timeout":X.timeout=Q?parseInt(Q,10):30000;break;case"delay":X.delay=Q?parseInt(Q,10):200;break;case"suspensible":X.suspensible=w==="true";break;case"retries":X.retries=Q?parseInt(Q,10):0;break;case"loadingComponent":X.loadingComponent=G||w;break;case"errorComponent":X.errorComponent=G||w;break}}return X}function Ow($,X,Z,J){let{component:Y,timeout:G,delay:Q,suspensible:w,retries:q}=X;return`
|
|
13512
13512
|
<div class="stx-async-component" data-async-id="${$}" data-component="${Y}" data-status="pending">
|
|
13513
13513
|
<div class="stx-async-loading" data-async-loading="${$}">
|
|
13514
13514
|
${Z}
|
|
@@ -13735,7 +13735,7 @@ catch (error) {
|
|
|
13735
13735
|
loadComponent();
|
|
13736
13736
|
})();
|
|
13737
13737
|
</script>
|
|
13738
|
-
`}function
|
|
13738
|
+
`}function MO($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function kO($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function IO(){return`
|
|
13739
13739
|
/* STX Async Component Styles */
|
|
13740
13740
|
.stx-async-component {
|
|
13741
13741
|
position: relative;
|
|
@@ -13809,7 +13809,7 @@ catch (error) {
|
|
|
13809
13809
|
background-size: 200% 100%;
|
|
13810
13810
|
}
|
|
13811
13811
|
}
|
|
13812
|
-
`}function
|
|
13812
|
+
`}function EO(){return`
|
|
13813
13813
|
// STX Async Component Runtime
|
|
13814
13814
|
(function() {
|
|
13815
13815
|
if (typeof window === 'undefined') return;
|
|
@@ -13863,7 +13863,7 @@ catch (error) {
|
|
|
13863
13863
|
|
|
13864
13864
|
console.log('[stx] Async component runtime initialized');
|
|
13865
13865
|
})();
|
|
13866
|
-
`}var
|
|
13866
|
+
`}var NO=0;var Vw={};a(Vw,{shouldCacheComponent:()=>PO,processKeepAliveDirectives:()=>yO,onDeactivated:()=>gO,onActivated:()=>fO,generateKeepAliveRuntime:()=>xO,generateKeepAliveCSS:()=>vO,createKeepAliveCache:()=>CO});function Fw(){return`keep-alive-${++DO}-${Date.now().toString(36)}`}function yO($,X={},Z){let J=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(J,(Y,G,Q)=>{let w=Fw(),q=bO(G||"");return SO(w,Q.trim(),q)})}function bO($){let X={max:10},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Z.exec($))!==null){let Y=J[1],G=J[2]||J[3],Q=J[4];switch(Y){case"max":X.max=Q?parseInt(Q,10):10;break;case"include":X.include=G;break;case"exclude":X.exclude=G;break;case"id":X.id=G;break}}return X}function SO($,X,Z){let{max:J,include:Y,exclude:G}=Z,Q=Z.id||$;return`
|
|
13867
13867
|
<div class="stx-keep-alive" data-keep-alive-id="${$}" data-custom-id="${Q}">
|
|
13868
13868
|
<div class="stx-keep-alive-content" data-keep-alive-content="${$}">
|
|
13869
13869
|
${X}
|
|
@@ -14150,7 +14150,7 @@ else {
|
|
|
14150
14150
|
});
|
|
14151
14151
|
})();
|
|
14152
14152
|
</script>
|
|
14153
|
-
`}function
|
|
14153
|
+
`}function CO($={}){return{id:$.id||Fw(),cache:new Map,max:$.max||10,include:$.include?$.include.split(",").map((Z)=>Z.trim()):null,exclude:$.exclude?$.exclude.split(",").map((Z)=>Z.trim()):null}}function PO($,X){if(X.exclude&&X.exclude.includes($))return!1;if(X.include&&!X.include.includes($))return!1;return!0}function vO(){return`
|
|
14154
14154
|
/* STX Keep-Alive Styles */
|
|
14155
14155
|
.stx-keep-alive {
|
|
14156
14156
|
position: relative;
|
|
@@ -14175,7 +14175,7 @@ else {
|
|
|
14175
14175
|
.stx-keep-alive-content > [data-activated] {
|
|
14176
14176
|
opacity: 1;
|
|
14177
14177
|
}
|
|
14178
|
-
`}function
|
|
14178
|
+
`}function xO(){return`
|
|
14179
14179
|
// STX Keep-Alive Runtime
|
|
14180
14180
|
(function() {
|
|
14181
14181
|
if (typeof window === 'undefined') return;
|
|
@@ -14211,7 +14211,7 @@ else {
|
|
|
14211
14211
|
|
|
14212
14212
|
console.log('[stx] Keep-alive runtime initialized');
|
|
14213
14213
|
})();
|
|
14214
|
-
`}function
|
|
14214
|
+
`}function fO($){if(typeof document<"u")document.addEventListener("stx:activated",(X)=>{$(X.detail)})}function gO($){if(typeof document<"u")document.addEventListener("stx:deactivated",(X)=>{$(X.detail)})}var DO=0;var Mw={};a(Mw,{useVirtualList:()=>Rw,processVirtualListDirectives:()=>a4,processVirtualGridDirectives:()=>Tw,processInfiniteListDirectives:()=>Nw,generateVirtualListCSS:()=>Aw,default:()=>hO,createVirtualList:()=>s4});function s4($,X){let{itemHeight:Z,containerHeight:J,overscan:Y=3,keyProperty:G="id",dynamicHeight:Q=!1,estimatedItemHeight:w=Z,direction:q="vertical"}=X,W=[...$],K=0,z=new Map;function U(){if(Q)return B();let R=Math.max(0,Math.floor(K/Z)-Y),N=Math.ceil(J/Z),T=Math.min(W.length-1,R+N+Y*2);return{startIndex:R,endIndex:T}}function B(){let R=0,N=0,T=W.length-1;for(let M=0;M<W.length;M++){let k=z.get(M)||w;if(R+k>K){N=Math.max(0,M-Y);break}R+=k}R=0;for(let M=0;M<W.length;M++){let k=z.get(M)||w;if(R+=k,R>K+J){T=Math.min(W.length-1,M+Y);break}}return{startIndex:N,endIndex:T}}function j(){if(Q){let R=0;for(let N=0;N<W.length;N++)R+=z.get(N)||w;return R}return W.length*Z}function _(R){if(Q){let N=0;for(let T=0;T<R;T++)N+=z.get(T)||w;return N}return R*Z}function H(){let{startIndex:R,endIndex:N}=U();return{startIndex:R,endIndex:N,scrollTop:K,totalHeight:j(),visibleItems:W.slice(R,N+1),itemHeights:new Map(z)}}function L(R,N="auto"){let T=_(R);O(T,N)}function O(R,N="auto"){K=Math.max(0,Math.min(R,j()-J))}function F(){U()}function V(R){W=[...R],z.clear(),F()}function A(){W=[],z.clear()}return{scrollToIndex:L,scrollToOffset:O,getState:H,refresh:F,setItems:V,destroy:A}}function a4($,X={},Z){let J=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(J,(Y,G,Q,w)=>{let q=G.trim(),W=X[q];if(!W||!Array.isArray(W))return`<!-- virtualList: items "${q}" not found or not an array -->`;let K={itemHeight:50,containerHeight:400,overscan:3};if(Q)try{let O=Q.trim(),F=Function(`return ${O}`)();K={...K,...F}}catch{}let z=`vlist-${Math.random().toString(36).substring(2,9)}`,U=Math.ceil(K.containerHeight/K.itemHeight),B=K.overscan||3,j=0,_=Math.min(W.length-1,U+B),H="";for(let O=j;O<=_&&O<W.length;O++){let F=W[O],V=w.replace(/\{\{\s*item\s*\}\}/g,typeof F==="object"?JSON.stringify(F):String(F)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(A,R)=>{if(typeof F==="object"&&F!==null)return String(F[R]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(O));H+=`
|
|
14215
14215
|
<div class="virtual-item ${K.itemClass||""}"
|
|
14216
14216
|
style="position: absolute; top: ${O*K.itemHeight}px; height: ${K.itemHeight}px; width: 100%;"
|
|
14217
14217
|
data-index="${O}">
|
|
@@ -14424,7 +14424,7 @@ else {
|
|
|
14424
14424
|
});
|
|
14425
14425
|
})();
|
|
14426
14426
|
</script>
|
|
14427
|
-
`})}var
|
|
14427
|
+
`})}var hO;var kw=D(()=>{hO={createVirtualList:s4,processVirtualListDirectives:a4,processInfiniteListDirectives:Nw,processVirtualGridDirectives:Tw,generateVirtualListCSS:Aw,useVirtualList:Rw}});function Iw(){return`<script data-stx-hydration-runtime>
|
|
14428
14428
|
(function() {
|
|
14429
14429
|
'use strict';
|
|
14430
14430
|
|
|
@@ -14584,7 +14584,7 @@ else {
|
|
|
14584
14584
|
stxIslands.initIslands();
|
|
14585
14585
|
}
|
|
14586
14586
|
})();
|
|
14587
|
-
</script>`}function Ew($){let X=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(X)return X[1];let Z=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Z)return Z[1];return null}function Dw($,X){let Z={},J=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,Y;while((Y=J.exec($))!==null){let G=Y[1],Q=Y[2];if(Q in X)Z[G]=X[Q];else Z[G]=Q}return Z}var uw={};a(uw,{processStaticDirectives:()=>gw,processPartialHydrationDirectives:()=>bw,onHydrated:()=>fw,isHydrated:()=>xw,hydrateIsland:()=>Cw,hydrateByStrategy:()=>Pw,hydrateAll:()=>vw,generatePartialHydrationCSS:()=>Sw,generateIslandManifest:()=>hw,default:()=>
|
|
14587
|
+
</script>`}function Ew($){let X=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(X)return X[1];let Z=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Z)return Z[1];return null}function Dw($,X){let Z={},J=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,Y;while((Y=J.exec($))!==null){let G=Y[1],Q=Y[2];if(Q in X)Z[G]=X[Q];else Z[G]=Q}return Z}var uw={};a(uw,{processStaticDirectives:()=>gw,processPartialHydrationDirectives:()=>bw,onHydrated:()=>fw,isHydrated:()=>xw,hydrateIsland:()=>Cw,hydrateByStrategy:()=>Pw,hydrateAll:()=>vw,generatePartialHydrationCSS:()=>Sw,generateIslandManifest:()=>hw,default:()=>nO,createIslandRegistry:()=>yw});function yw(){let $=new Map;return{islands:$,register(X){$.set(X.id,X)},get(X){return $.get(X)},async hydrate(X){let Z=$.get(X);if(!Z||Z.hydrated)return;if(Z.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:X,component:Z.component}}))},async hydrateAll(){let X=Array.from($.values()).filter((Z)=>!Z.hydrated).map((Z)=>this.hydrate(Z.id));await Promise.all(X)}}}function uO($){return`
|
|
14588
14588
|
<script data-hydrate="${$}">
|
|
14589
14589
|
(function() {
|
|
14590
14590
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -14595,7 +14595,7 @@ else {
|
|
|
14595
14595
|
island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
|
|
14596
14596
|
})();
|
|
14597
14597
|
</script>
|
|
14598
|
-
`}function
|
|
14598
|
+
`}function dO($,X){let Z=X.timeout||2000,J=X.priority||"low";return`
|
|
14599
14599
|
<script data-hydrate="${$}">
|
|
14600
14600
|
(function() {
|
|
14601
14601
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -14631,7 +14631,7 @@ else {
|
|
|
14631
14631
|
}
|
|
14632
14632
|
})();
|
|
14633
14633
|
</script>
|
|
14634
|
-
`}function
|
|
14634
|
+
`}function mO($,X){let Z=X.rootMargin||"0px",J=X.threshold||0;return`
|
|
14635
14635
|
<script data-hydrate="${$}">
|
|
14636
14636
|
(function() {
|
|
14637
14637
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -14664,7 +14664,7 @@ else {
|
|
|
14664
14664
|
}
|
|
14665
14665
|
})();
|
|
14666
14666
|
</script>
|
|
14667
|
-
`}function
|
|
14667
|
+
`}function lO($,X){let Z=X.media||"(min-width: 768px)";return`
|
|
14668
14668
|
<script data-hydrate="${$}">
|
|
14669
14669
|
(function() {
|
|
14670
14670
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -14693,7 +14693,7 @@ else {
|
|
|
14693
14693
|
}
|
|
14694
14694
|
})();
|
|
14695
14695
|
</script>
|
|
14696
|
-
`}function
|
|
14696
|
+
`}function cO($){return`
|
|
14697
14697
|
<script data-hydrate="${$}">
|
|
14698
14698
|
(function() {
|
|
14699
14699
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -14715,7 +14715,7 @@ else {
|
|
|
14715
14715
|
events.forEach(e => island.addEventListener(e, handler, { once: true, passive: true }));
|
|
14716
14716
|
})();
|
|
14717
14717
|
</script>
|
|
14718
|
-
`}function
|
|
14718
|
+
`}function pO($,X){let Z=X.event||"stx:activate";return`
|
|
14719
14719
|
<script data-hydrate="${$}">
|
|
14720
14720
|
(function() {
|
|
14721
14721
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -14736,9 +14736,9 @@ else {
|
|
|
14736
14736
|
});
|
|
14737
14737
|
})();
|
|
14738
14738
|
</script>
|
|
14739
|
-
`}function bw($,X={},Z){let J=$,Y=!1,G=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(J=r5(J,"load",X),J=r5(J,"idle",X),J=r5(J,"visible",X),J=r5(J,"media",X),J=
|
|
14739
|
+
`}function bw($,X={},Z){let J=$,Y=!1,G=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(J=r5(J,"load",X),J=r5(J,"idle",X),J=r5(J,"visible",X),J=r5(J,"media",X),J=iO(J),J=r5(J,"hover",X),J=r5(J,"event",X),Y=G&&J!==$,Y)J+=`
|
|
14740
14740
|
`+Iw();return J}function r5($,X,Z){let J=new RegExp(`@client:${X}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(J,(Y,G,Q)=>{let w={strategy:X};if(G)try{let _=G.split(",").map((H)=>H.trim());for(let H of _){let[L,O]=H.split(":").map((F)=>F.trim());if(L&&O){let F=O.replace(/^['"]|['"]$/g,"");w[L]=F}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,W=Ew(Q.trim()),K=Dw(Q.trim(),Z),z=[];if(w.rootMargin)z.push(`data-root-margin="${w.rootMargin}"`);if(w.threshold!==void 0)z.push(`data-threshold="${w.threshold}"`);if(w.media)z.push(`data-media="${w.media}"`);if(w.event)z.push(`data-event="${w.event}"`);if(W)z.push(`data-component="${W}"`);let B=Object.keys(K).length>0?`
|
|
14741
|
-
<script type="application/json" data-island-props="${q}">${JSON.stringify(K)}</script>`:"",j="";switch(X){case"load":j=
|
|
14741
|
+
<script type="application/json" data-island-props="${q}">${JSON.stringify(K)}</script>`:"",j="";switch(X){case"load":j=uO(q);break;case"idle":j=dO(q,w);break;case"visible":j=mO(q,w);break;case"media":j=lO(q,w);break;case"hover":j=cO(q);break;case"event":j=pO(q,w);break}return`
|
|
14742
14742
|
<div data-island="${q}"
|
|
14743
14743
|
data-strategy="${X}"
|
|
14744
14744
|
${z.join(`
|
|
@@ -14748,7 +14748,7 @@ else {
|
|
|
14748
14748
|
${Q.trim()}${B}
|
|
14749
14749
|
</div>
|
|
14750
14750
|
${j}
|
|
14751
|
-
`})}function
|
|
14751
|
+
`})}function iO($){let X=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(X,(Z,J)=>{let Y=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
|
|
14752
14752
|
<div data-island="${Y}"
|
|
14753
14753
|
data-strategy="only"
|
|
14754
14754
|
class="stx-island stx-client-only">
|
|
@@ -14812,7 +14812,7 @@ else {
|
|
|
14812
14812
|
<script type="application/json" id="stx-island-manifest">
|
|
14813
14813
|
${JSON.stringify(X)}
|
|
14814
14814
|
</script>
|
|
14815
|
-
`}var
|
|
14815
|
+
`}var nO;var dw=D(()=>{nO={processPartialHydrationDirectives:bw,processStaticDirectives:gw,generatePartialHydrationCSS:Sw,generateIslandManifest:hw,createIslandRegistry:yw,hydrateIsland:Cw,hydrateByStrategy:Pw,hydrateAll:vw,isHydrated:xw,onHydrated:fw}});var tw={};a(tw,{watchMultiple:()=>iw,watchEffect:()=>nw,watch:()=>pw,unref:()=>mw,toRefs:()=>lw,throttledComputed:()=>aw,stxWatchMultiple:()=>iw,stxWatchEffect:()=>nw,stxWatch:()=>pw,stxUnref:()=>mw,stxToRefs:()=>lw,stxThrottledComputed:()=>aw,stxShallowRef:()=>cw,stxRef:()=>o5,stxIsRef:()=>m1,stxDebouncedComputed:()=>sw,stxComputed:()=>G8,shallowRef:()=>cw,ref:()=>o5,processWatchDirectives:()=>ow,processComputedDirectives:()=>rw,isRef:()=>m1,default:()=>rO,debouncedComputed:()=>sw,computed:()=>G8});function o5($){let X=$,Z=new Set,J={get value(){if(j1){let Y=Y8.get(J);if(!Y)Y=new Set,Y8.set(J,Y);Y.add(j1)}return X},set value(Y){if(!Object.is(X,Y)){X=Y,Z.forEach((Q)=>Q(Y));let G=Y8.get(J);if(G)G.forEach((Q)=>Q())}},subscribe(Y){return Z.add(Y),()=>Z.delete(Y)},peek(){return X}};return J}function m1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function mw($){return m1($)?$.value:$}function lw($){let X={};for(let Z in $)if(Object.prototype.hasOwnProperty.call($,Z))X[Z]=o5($[Z]);return X}function cw($){return o5($)}function G8($){let X=typeof $==="function",Z=X?$:$.get,J=X?void 0:$.set,Y=X?Object.is:$.equals||Object.is,G,Q=!0,w=new Set,q=new Set,W=()=>{if(Q=!0,q.size>0){let U=z.value;q.forEach((B)=>B(U))}};function K(){w.clear();let U=j1;j1=W,j9.push(W);try{return Z()}finally{j9.pop(),j1=U}}let z={get value(){if(j1){let U=Y8.get(z);if(!U)U=new Set,Y8.set(z,U);U.add(j1)}if(Q){let U=K();if(!Y(G,U))G=U;Q=!1}return G},set value(U){if(J)J(U);else console.warn("Computed property is readonly")},subscribe(U){return q.add(U),()=>q.delete(U)},peek(){if(Q)G=Z(),Q=!1;return G},invalidate(){Q=!0},get dirty(){return Q},get deps(){return w}};return z}function pw($,X,Z={}){let{immediate:J=!1,deep:Y=!1,flush:G="pre",once:Q=!1}=Z,w,q=!0,W=!1,K=()=>{if(m1($))return Y?z5($.value):$.value;return $()},z=()=>{if(!q||W)return;let j=K();if(w!==void 0&&Object.is(w,j)&&!Y)return;let _=()=>{if(X(j,w),w=Y?z5(j):j,Q)B()};if(G==="sync")_();else if(G==="post")queueMicrotask(_);else Promise.resolve().then(_)},U=null;if(m1($))U=$.subscribe(()=>z());else U=G8($).subscribe(()=>z());if(J)w=void 0,z();else w=K();let B=()=>{if(q=!1,U)U(),U=null};return B.pause=()=>{W=!0},B.resume=()=>{W=!1},B}function iw($,X,Z={}){let{immediate:J=!1,once:Y=!1}=Z,G=$.map((z)=>m1(z)?z.value:void 0),Q=!0,w=!1,q=()=>{if(!Q||w)return;let z=$.map((U)=>m1(U)?U.value:void 0);if(X(z,G),G=[...z],Y)K()},W=$.map((z)=>{if(m1(z))return z.subscribe(()=>q());return()=>{}});if(J)q();let K=()=>{Q=!1,W.forEach((z)=>z())};return K.pause=()=>{w=!0},K.resume=()=>{w=!1},K}function nw($,X={}){let{flush:Z="pre"}=X,J,Y=!0,G=!1,Q=()=>{if(!Y||G)return;if(J)J();let q=j1;j1=Q,j9.push(Q);try{J=$()}finally{j9.pop(),j1=q}};if(Z==="sync")Q();else if(Z==="post")queueMicrotask(Q);else Promise.resolve().then(Q);let w=()=>{if(Y=!1,J)J()};return w.pause=()=>{G=!0},w.resume=()=>{G=!1},w}function rw($,X={},Z){let J=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(J,(Y,G,Q)=>{try{let q=Function(...Object.keys(X),`return ${Q}`)(...Object.values(X));return X[G]=q,`<!-- computed: ${G} = ${q} -->`}catch(w){return`<!-- computed error: ${G} - ${w} -->`}})}function ow($,X={},Z){let J=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(J,(Y,G,Q)=>{return`
|
|
14816
14816
|
<script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
|
|
14817
14817
|
(function() {
|
|
14818
14818
|
// Watch implementation for ${G}
|
|
@@ -14824,9 +14824,9 @@ else {
|
|
|
14824
14824
|
}
|
|
14825
14825
|
})();
|
|
14826
14826
|
</script>
|
|
14827
|
-
`})}function z5($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Z)=>z5(Z));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Z=new Map;return $.forEach((J,Y)=>Z.set(z5(Y),z5(J))),Z}if($ instanceof Set){let Z=new Set;return $.forEach((J)=>Z.add(z5(J))),Z}let X={};for(let Z in $)if(Object.prototype.hasOwnProperty.call($,Z))X[Z]=z5($[Z]);return X}function sw($,X=100){let Z=o5($()),J=null,Y=()=>{if(J)clearTimeout(J);J=setTimeout(()=>{Z.value=$()},X)};return G8($).subscribe(()=>Y()),{get value(){return Z.value},set value(Q){console.warn("Debounced computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){Y()},get dirty(){return!1},get deps(){return new Set}}}function aw($,X=100){let Z=o5($()),J=0,Y=()=>{let Q=Date.now();if(Q-J>=X)J=Q,Z.value=$()};return G8($).subscribe(()=>Y()),{get value(){return Z.value},set value(Q){console.warn("Throttled computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){Y()},get dirty(){return!1},get deps(){return new Set}}}var j1=null,j9,Y8,
|
|
14827
|
+
`})}function z5($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Z)=>z5(Z));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Z=new Map;return $.forEach((J,Y)=>Z.set(z5(Y),z5(J))),Z}if($ instanceof Set){let Z=new Set;return $.forEach((J)=>Z.add(z5(J))),Z}let X={};for(let Z in $)if(Object.prototype.hasOwnProperty.call($,Z))X[Z]=z5($[Z]);return X}function sw($,X=100){let Z=o5($()),J=null,Y=()=>{if(J)clearTimeout(J);J=setTimeout(()=>{Z.value=$()},X)};return G8($).subscribe(()=>Y()),{get value(){return Z.value},set value(Q){console.warn("Debounced computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){Y()},get dirty(){return!1},get deps(){return new Set}}}function aw($,X=100){let Z=o5($()),J=0,Y=()=>{let Q=Date.now();if(Q-J>=X)J=Q,Z.value=$()};return G8($).subscribe(()=>Y()),{get value(){return Z.value},set value(Q){console.warn("Throttled computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){Y()},get dirty(){return!1},get deps(){return new Set}}}var j1=null,j9,Y8,rO;var ew=D(()=>{j9=[],Y8=new WeakMap;rO={ref:o5,computed:G8,watch:pw,watchMultiple:iw,watchEffect:nw,isRef:m1,unref:mw,toRefs:lw,shallowRef:cw,debouncedComputed:sw,throttledComputed:aw,processComputedDirectives:rw,processWatchDirectives:ow}});function Q8($,X){let Z={};for(let J of $)Z[J]=v1(X(J));return new Proxy({},{get:(J,Y)=>Z[Y]?.(),set:(J,Y,G)=>{if(Z[Y])Z[Y].set(G);else Z[Y]=v1(G);return!0},has:(J,Y)=>(Y in Z),deleteProperty:(J,Y)=>{return delete Z[Y],!0},ownKeys:()=>Reflect.ownKeys(Z),getOwnPropertyDescriptor:(J,Y)=>(Y in Z)?{enumerable:!0,configurable:!0,writable:!0,value:Z[Y]()}:void 0})}function oO($,X){let Z={};for(let J of X)Z[J]=$[J];return Z}function t4($,X){let Z=Object.keys($),J=Q8(Z,(O)=>X?.[O]??$[O].getDefaultValue()),Y=Q8(Z,()=>[]),G=Q8(Z,()=>!1),Q=Q8(Z,()=>!1),w=Q8(Z,()=>!1),q=v1(!1);async function W(O){w[O]=!0;let F=await $[O].validate(J[O],J);return Y[O]=F,w[O]=!1,F.length===0}async function K(){q.set(!0);let O=await Promise.all(Z.map(W));return q.set(!1),O.every(Boolean)}function z(){for(let O of Z)J[O]=X?.[O]??$[O].getDefaultValue(),Y[O]=[],G[O]=!1,Q[O]=!1}function U(O){for(let F of Z)if(F in O)J[F]=O[F],Q[F]=!0}function B(O,F){J[O]=F,Q[O]=!0}function j(O,F=!0){if(G[O]=F,F)W(O)}function _(O){return{value:J[O],errors:Y[O],touched:G[O],dirty:Q[O],valid:Y[O].length===0,validating:w[O]}}function H(O){return async(F)=>{F?.preventDefault?.();for(let A of Z)G[A]=!0;if(await K())await O(oO(J,Z))}}return{values:J,errors:Y,touched:G,dirty:Q,get isValid(){return Z.every((O)=>Y[O].length===0)},get isValidating(){return q()||Z.some((O)=>w[O])},get isDirty(){return Z.some((O)=>Q[O])},validate:K,validateField:W,reset:z,setValues:U,setFieldValue:B,setFieldTouched:j,getFieldState:_,handleSubmit:H}}var $q;var Xq=D(()=>{i8();$q=t4});var Gq={};a(Gq,{v:()=>sO,useForm:()=>t4,processHasErrorsDirective:()=>Yq,processFormValidationDirectives:()=>aO,processErrorsDirective:()=>Jq,processErrorDirective:()=>Zq,defineForm:()=>$q,Validator:()=>s5});class s5{rules=[];defaultValue="";addRule($){let X=new s5;return X.rules=[...this.rules,$],X.defaultValue=this.defaultValue,X}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(X)=>{if(X===null||X===void 0)return $;if(typeof X==="string"&&X.trim()==="")return $;if(Array.isArray(X)&&X.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(X)=>{if(!X)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(X))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(X)=>{if(!X)return!0;try{return new URL(String(X)),!0}catch{return $}}})}min($,X){let Z=X||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Z,validate:(J)=>{if(!J)return!0;return String(J).length>=$||Z}})}max($,X){let Z=X||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Z,validate:(J)=>{if(!J)return!0;return String(J).length<=$||Z}})}length($,X,Z){let J=Z||`Must be between ${$} and ${X} characters`;return this.addRule({name:"length",message:J,validate:(Y)=>{if(!Y)return!0;let G=String(Y).length;return G>=$&&G<=X||J}})}pattern($,X="Invalid format"){return this.addRule({name:"pattern",message:X,validate:(Z)=>{if(!Z)return!0;return $.test(String(Z))||X}})}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:(X)=>{if(!X)return!0;return!String(X).includes(" ")||$}})}number($="Must be a number"){let X=this.addRule({name:"number",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return!Number.isNaN(Number(Z))||$}});return X.defaultValue=0,X}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(X)=>{if(!X&&X!==0)return!0;return Number.isInteger(Number(X))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)<0||$}})}minValue($,X){let Z=X||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Z,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)>=$||Z}})}maxValue($,X){let Z=X||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Z,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)<=$||Z}})}between($,X,Z){let J=Z||`Must be between ${$} and ${X}`;return this.addRule({name:"between",message:J,validate:(Y)=>{if(!Y&&Y!==0)return!0;let G=Number(Y);return G>=$&&G<=X||J}})}matches($,X){let Z=X||`Must match ${$}`;return this.addRule({name:"matches",message:Z,validate:(J,Y)=>{if(!Y)return!0;return J===Y[$]||Z}})}oneOf($,X){let Z=X||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Z,validate:(J)=>{if(!J)return!0;return $.includes(J)||Z}})}notOneOf($,X){let Z=X||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Z,validate:(J)=>{if(!J)return!0;return!$.includes(J)||Z}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(X)=>{if(!X)return!0;let Z=new Date(String(X));return!Number.isNaN(Z.getTime())||$}})}before($,X){let Z=new Date($),J=X||`Must be before ${Z.toLocaleDateString()}`;return this.addRule({name:"before",message:J,validate:(Y)=>{if(!Y)return!0;return new Date(String(Y))<Z||J}})}after($,X){let Z=new Date($),J=X||`Must be after ${Z.toLocaleDateString()}`;return this.addRule({name:"after",message:J,validate:(Y)=>{if(!Y)return!0;return new Date(String(Y))>Z||J}})}custom($,X="Invalid value"){return this.addRule({name:"custom",message:X,validate:$})}async($,X="Invalid value"){return this.addRule({name:"async",message:X,async:!0,validate:$})}when($,X){let Z=new s5;Z.rules=[...this.rules],Z.defaultValue=this.defaultValue;for(let J of X.getRules())Z.rules.push({...J,validate:(Y,G)=>{if(!$(Y,G||{}))return!0;return J.validate(Y,G)}});return Z}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let X=new s5;return X.rules=[...this.rules],X.defaultValue=$,X}async validate($,X){let Z=[];for(let J of this.rules){let Y=await J.validate($,X);if(Y!==!0)Z.push(Y)}return Z}validateSync($,X){let Z=[];for(let J of this.rules){if(J.async)continue;let Y=J.validate($,X);if(Y!==!0)Z.push(Y)}return Z}}function Zq($,X,Z){let J=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(J,(Y,G,Q)=>{try{let w=G.trim().split("."),q=X;for(let K of w)if(q&&typeof q==="object"&&K in q)q=q[K];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((K)=>{return Q.replace(/\{\{\s*message\s*\}\}/g,K)}).join(`
|
|
14828
14828
|
`)}catch{return""}})}function Jq($,X,Z){let J=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(J,(Y,G,Q)=>{try{let w=G.trim().split("."),q=X;for(let K of w)if(q&&typeof q==="object"&&K in q)q=q[K];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((K)=>Q.replace(/\{\{\s*message\s*\}\}/g,K)).join(`
|
|
14829
|
-
`)}catch{return""}})}function Yq($,X,Z){let J=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(J,(Y,G,Q)=>{try{let w=G.trim().split("."),q=X;for(let K of w)if(q&&typeof q==="object"&&K in q)q=q[K];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return Q}catch{return""}})}function
|
|
14829
|
+
`)}catch{return""}})}function Yq($,X,Z){let J=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(J,(Y,G,Q)=>{try{let w=G.trim().split("."),q=X;for(let K of w)if(q&&typeof q==="object"&&K in q)q=q[K];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return Q}catch{return""}})}function aO($,X,Z){let J=$;return J=Zq(J,X,Z),J=Jq(J,X,Z),J=Yq(J,X,Z),J}var sO;var Qq=D(()=>{Xq();sO=new s5});var Wq={};a(Wq,{processXElementDirectives:()=>tO,hasXElementDirectives:()=>qq,generateXElementRuntime:()=>wq});function wq(){return`<script data-stx-scoped data-stx-x-element-runtime data-stx-run="always">
|
|
14830
14830
|
(function() {
|
|
14831
14831
|
'use strict';
|
|
14832
14832
|
|
|
@@ -15110,9 +15110,9 @@ else {
|
|
|
15110
15110
|
// Expose for manual initialization
|
|
15111
15111
|
window.XElement = XElement;
|
|
15112
15112
|
})();
|
|
15113
|
-
</script>`}function qq($){return/\bx-data(?:\s|=)/.test($)}function
|
|
15113
|
+
</script>`}function qq($){return/\bx-data(?:\s|=)/.test($)}function tO($){let X=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,Z=$.match(X)||[],J=Z.length>0?$.replace(X,""):$;if(!qq(J))return J;let Y=Z[0]?.trim()||wq(),G=J.lastIndexOf("</body>");if(G!==-1)return J.slice(0,G)+Y+`
|
|
15114
15114
|
`+J.slice(G);return J+`
|
|
15115
|
-
`+Y}var Kq={};a(Kq,{rewriteImagesWithSiblings:()=>
|
|
15115
|
+
`+Y}var Kq={};a(Kq,{rewriteImagesWithSiblings:()=>XL});import N1 from"path";async function XL($,X){let Z=X.formats??$L;if(!X.publicDir)return $;let J=YL($),Y=[],G=/<img\b[^>]*?>/gi,Q=[],w;while((w=G.exec($))!==null){let z=w[0],U=z.match(/\bsrc=["']([^"']+)["']/i);if(!U)continue;if(GL(w.index,J))continue;Q.push({idx:w.index,length:z.length,src:U[1],raw:z})}if(Q.length===0)return $;let q=await Promise.all(Q.map(async(z)=>{let U=await ZL(z.src,X.publicDir,Z);return{match:z,sources:U}}));for(let{match:z,sources:U}of q){if(U.length===0)continue;let j=`<picture>${U.map((_)=>`<source type="${_.mime}" srcset="${QL(_.url)}">`).join("")}${z.raw}</picture>`;Y.push({start:z.idx,end:z.idx+z.length,replacement:j})}if(Y.length===0)return $;let W="",K=0;for(let z of Y)W+=$.slice(K,z.start),W+=z.replacement,K=z.end;return W+=$.slice(K),W}async function ZL($,X,Z){if(!JL($))return[];let J=N1.extname($).toLowerCase();if(!eO.has(J))return[];if(!$.startsWith("/"))return[];let Y=N1.join(X,$.slice(1)),G=N1.dirname(Y),Q=N1.basename(Y,J),w=N1.resolve(G),q=N1.resolve(X);if(!w.startsWith(q))return[];let W=N1.posix.dirname($),K=Z.map(async(U)=>{let B=N1.join(G,`${Q}${U.ext}`);if(!await Bun.file(B).exists())return null;return{url:N1.posix.join(W,`${Q}${U.ext}`),mime:U.mime}});return(await Promise.all(K)).filter((U)=>U!==null)}function JL($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function YL($){let X=[],Z=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,J;while((J=Z.exec($))!==null)X.push([J.index,J.index+J[0].length]);return X}function GL($,X){for(let[Z,J]of X)if($>=Z&&$<J)return!0;return!1}function QL($){return $.replace(/&/g,"&").replace(/"/g,""")}var eO,$L;var zq=D(()=>{eO=new Set([".jpg",".jpeg",".png",".gif"]),$L=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var Uq=()=>{};function e4($){return $.pwa?.serviceWorker?.fileName||"sw.js"}var jq=D(()=>{Uq()});var Bq={};a(Bq,{injectPwaTags:()=>wL,generateThemeColorMeta:()=>KL,generateSwRegistrationScript:()=>qL,generatePwaTags:()=>B9,generateManifestLink:()=>WL});function B9($){let X=$.pwa;if(!X?.enabled)return"";let Z=X.manifest,J=X.icons?.outputDir?`/${X.icons.outputDir}`:"/pwa-icons",Y=e4($),G=`
|
|
15116
15116
|
<!-- stx PWA Meta Tags -->
|
|
15117
15117
|
<link rel="manifest" href="/manifest.json">
|
|
15118
15118
|
<meta name="theme-color" content="${$2(Z?.themeColor||"#000000")}">
|
|
@@ -15156,9 +15156,9 @@ if ('serviceWorker' in navigator) {
|
|
|
15156
15156
|
});
|
|
15157
15157
|
}
|
|
15158
15158
|
</script>
|
|
15159
|
-
<!-- End stx PWA -->`,G}function
|
|
15159
|
+
<!-- End stx PWA -->`,G}function wL($,X){let Z=X.pwa;if(!Z?.enabled||Z.autoInject===!1)return $;if($.includes("<!-- stx PWA Meta Tags -->"))return $;if(!$.includes("</head>")){let Y=$.lastIndexOf("</body>");if(Y!==-1){let G=B9(X);return $.slice(0,Y)+G+`
|
|
15160
15160
|
`+$.slice(Y)}return $+B9(X)}let J=B9(X);return $.replace("</head>",`${J}
|
|
15161
|
-
</head>`)}function
|
|
15161
|
+
</head>`)}function qL($){if(!$.pwa?.enabled)return"";return`<script>
|
|
15162
15162
|
if ('serviceWorker' in navigator) {
|
|
15163
15163
|
window.addEventListener('load', function() {
|
|
15164
15164
|
navigator.serviceWorker.register('/${e4($)}')
|
|
@@ -15170,25 +15170,25 @@ if ('serviceWorker' in navigator) {
|
|
|
15170
15170
|
});
|
|
15171
15171
|
});
|
|
15172
15172
|
}
|
|
15173
|
-
</script>`}function
|
|
15173
|
+
</script>`}function WL(){return'<link rel="manifest" href="/manifest.json">'}function KL($){return`<meta name="theme-color" content="${$2($)}">`}function $2($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var _q=D(()=>{jq()});import zL from"fs";import S0 from"path";function Hq($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function UL($,X){let Z=$.length,J=X,Y=!0,G=[],Q=(w)=>w+9<=Z&&$[w]==="<"&&$[w+1]==="/"&&($[w+2]==="s"||$[w+2]==="S")&&($[w+3]==="c"||$[w+3]==="C")&&($[w+4]==="r"||$[w+4]==="R")&&($[w+5]==="i"||$[w+5]==="I")&&($[w+6]==="p"||$[w+6]==="P")&&($[w+7]==="t"||$[w+7]==="T")&&($[w+8]===">"||/\s/.test($[w+8]));while(J<Z){let w=$[J];if(Q(J))return J;if(w==="/"&&$[J+1]==="/"){if(J=$.indexOf(`
|
|
15174
15174
|
`,J+2),J===-1)return-1;J+=1,Y=!0;continue}if(w==="/"&&$[J+1]==="*"){let q=$.indexOf("*/",J+2);if(q===-1)return-1;J=q+2,Y=!0;continue}if(w==="/"&&Y){let q=J+1,W=!1;while(q<Z){let K=$[q];if(K==="\\"){q+=2;continue}if(K==="[")W=!0;else if(K==="]")W=!1;else if(K==="/"&&!W){q++;break}else if(K===`
|
|
15175
15175
|
`){q=-1;break}q++}if(q===-1){J++,Y=!1;continue}while(q<Z&&/[a-z]/.test($[q]))q++;J=q,Y=!1;continue}if(w==="'"||w==='"'){let q=w;J++;while(J<Z){if($[J]==="\\"){J+=2;continue}if($[J]===q){J++;break}if($[J]===`
|
|
15176
|
-
`)break;J++}Y=!1;continue}if(w==="`"){J++;while(J<Z){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;break}if($[J]==="$"&&$[J+1]==="{"){G.push(!0),J+=2,Y=!0;break}J++}if(G.length===0)Y=!1;continue}if(w==="}"&&G.length>0){G.pop(),J++;while(J<Z){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++,Y=!1;break}if($[J]==="$"&&$[J+1]==="{"){G.push(!0),J+=2,Y=!0;break}J++}continue}if(/\s/.test(w));else if(/[)\].\w$]/.test(w))Y=!1;else Y=!0;J++}return-1}function a5($,X){let Z=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=new RegExp(`<script\\b(?=[^>]*\\b${Z}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!J)return null;let Y=J.index+J[0].length,G=$.indexOf("</script>",Y);if(G===-1)return null;let Q=$.indexOf(">",G);if(Q===-1)return null;return{start:J.index,end:Q+1}}function Oq($){let X=0;while(X<$.length){let Z=$.indexOf("<",X);if(Z===-1)return-1;if($.startsWith("<!--",Z)){let G=$.indexOf("-->",Z+4);X=G===-1?$.length:G+3;continue}let J=$.slice(Z),Y=/^<style\b[^>]*>/i.exec(J);if(Y){let G=$.toLowerCase().indexOf("</style>",Z+Y[0].length);X=G===-1?$.length:G+8;continue}if(/^<script\b[^>]*>/i.test(J))return Z;X=Z+1}return-1}function
|
|
15176
|
+
`)break;J++}Y=!1;continue}if(w==="`"){J++;while(J<Z){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;break}if($[J]==="$"&&$[J+1]==="{"){G.push(!0),J+=2,Y=!0;break}J++}if(G.length===0)Y=!1;continue}if(w==="}"&&G.length>0){G.pop(),J++;while(J<Z){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++,Y=!1;break}if($[J]==="$"&&$[J+1]==="{"){G.push(!0),J+=2,Y=!0;break}J++}continue}if(/\s/.test(w));else if(/[)\].\w$]/.test(w))Y=!1;else Y=!0;J++}return-1}function a5($,X){let Z=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=new RegExp(`<script\\b(?=[^>]*\\b${Z}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!J)return null;let Y=J.index+J[0].length,G=$.indexOf("</script>",Y);if(G===-1)return null;let Q=$.indexOf(">",G);if(Q===-1)return null;return{start:J.index,end:Q+1}}function Oq($){let X=0;while(X<$.length){let Z=$.indexOf("<",X);if(Z===-1)return-1;if($.startsWith("<!--",Z)){let G=$.indexOf("-->",Z+4);X=G===-1?$.length:G+3;continue}let J=$.slice(Z),Y=/^<style\b[^>]*>/i.exec(J);if(Y){let G=$.toLowerCase().indexOf("</style>",Z+Y[0].length);X=G===-1?$.length:G+8;continue}if(/^<script\b[^>]*>/i.test(J))return Z;X=Z+1}return-1}function jL($){let X=a5($,"data-stx-runtime");if(!X)return $;let Z=Oq($);if(Z===-1||Z===X.start)return $;let J=$.slice(X.start,X.end),Y=$.slice(0,X.start)+$.slice(X.end),G=Oq(Y);if(G===-1)return J+`
|
|
15177
15177
|
`+Y;return Y.slice(0,G)+J+`
|
|
15178
|
-
`+Y.slice(G)}async function O0($,X,Z,J,Y){if(J.ssr===!1&&!J.autoShell&&J.buildMode==="spa")return $;if(X.__stx_signals_gate===void 0)X.__stx_signals_gate=F1($);let G=!X.__stxProcessingDepth;if(G)H6(X);if(!X.__stxProcessingDepth)X.__stxProcessingDepth=0;if(X.__stxProcessingDepth++,!X.__onceStore)X.__onceStore=new Set;if((J.debug||!m7()&&!D$())&&Z&&Z.endsWith(".stx"))o3($,Z);try{return await h6.timeAsync("template-processing",async()=>{let Q=await
|
|
15178
|
+
`+Y.slice(G)}async function O0($,X,Z,J,Y){if(J.ssr===!1&&!J.autoShell&&J.buildMode==="spa")return $;if(X.__stx_signals_gate===void 0)X.__stx_signals_gate=F1($);let G=!X.__stxProcessingDepth;if(G)H6(X);if(!X.__stxProcessingDepth)X.__stxProcessingDepth=0;if(X.__stxProcessingDepth++,!X.__onceStore)X.__onceStore=new Set;if((J.debug||!m7()&&!D$())&&Z&&Z.endsWith(".stx"))o3($,Z);try{return await h6.timeAsync("template-processing",async()=>{let Q=await BL($,X,Z,J,Y);if(G)Q=m4(Q);if(G&&J.autoShell&&J.buildMode!=="compile"){let w=J.app?.head||{},W=(X.__stx_runtime_head||null)??wX(),K=(X.__stx_head_raw||"").trim(),z,U=K.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(U)z=U[1].trim(),K=K.replace(U[0],"").trim();let B=X.__sections?.title,j=W.title||z||B,_=!W.title&&(!!z||!!B),H={...w,...j&&{title:j},meta:[...w.meta||[],...W.meta||[]],link:[...w.link||[],...W.link||[]],script:[...w.script||[],...W.script||[]],headRaw:[w.headRaw,K].filter(Boolean).join(`
|
|
15179
15179
|
`),...W.htmlAttrs&&{htmlAttrs:vQ(w.htmlAttrs,W.htmlAttrs)},...W.bodyAttrs&&{bodyAttrs:{...w.bodyAttrs||{},...W.bodyAttrs}}},L=h4(Q);if(Q=hQ(Q,H,{..._&&{titleIsHtml:!0},...J.app?.colorMode&&{colorMode:J.app.colorMode}}),L)Q=gQ(Q,w),Q=xQ(Q,H.htmlAttrs);let O=Q.match(/<!-- stx-layout: ([^ ]+) -->/);if(O&&Q.includes("<head")){let A=O[1],R=j7(A);Q=Q.replace(/<head\b[^>]*>/i,(N)=>`${N}
|
|
15180
15180
|
<meta name="stx-layout" content="${Hq(A)}">
|
|
15181
|
-
<meta name="stx-layout-group" content="${Hq(R)}">`)}let F=Q.match(/function (__stx_setup_\d+_\d+)\(/),V=F?f7(Q):null;if(F&&V&&!/\bdata-stx=/.test(V.tag)){Q=g8(Q,(R,N)=>`<body${N} data-stx="${F[1]}">`);let A=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${F[1]}"`,"i");Q=Q.replace(A,"$1")}}if(G){Q=fQ(Q);let w=J.app?.colorMode;if(w)Q=yQ(Q,w);Q=SQ(Q),Q=
|
|
15181
|
+
<meta name="stx-layout-group" content="${Hq(R)}">`)}let F=Q.match(/function (__stx_setup_\d+_\d+)\(/),V=F?f7(Q):null;if(F&&V&&!/\bdata-stx=/.test(V.tag)){Q=g8(Q,(R,N)=>`<body${N} data-stx="${F[1]}">`);let A=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${F[1]}"`,"i");Q=Q.replace(A,"$1")}}if(G){Q=fQ(Q);let w=J.app?.colorMode;if(w)Q=yQ(Q,w);Q=SQ(Q),Q=jL(Q)}if(G)try{let{getStoreScript:w}=await e("stx/store-loader",()=>Promise.resolve().then(() => (oQ(),rQ))),q=J.storesDir,W=await w(q);if(W){let K=`<script data-stx-stores>${W}</script>`,z=a5(Q,"data-stx-runtime");if(z)Q=Q.slice(0,z.end)+`
|
|
15182
15182
|
`+K+Q.slice(z.end)}}catch{}if(G)try{let{getFrameworkComposableScript:w}=await e("stx/framework-composables",()=>Promise.resolve().then(() => ($w(),eQ))),q=await w(Q);if(q){let W=a5(Q,"data-stx-stores")||a5(Q,"data-stx-runtime");if(W)Q=Q.slice(0,W.end)+`
|
|
15183
15183
|
`+q+Q.slice(W.end)}}catch{}if(G)try{let{getComposableScript:w}=await e("stx/composable-loader",()=>Promise.resolve().then(() => (Jw(),Zw))),q=J.composablesDir,W=await w(q);if(W){let K=`<script data-stx-composables>${W}</script>`,z=a5(Q,"data-stx-stores")||a5(Q,"data-stx-runtime");if(z)Q=Q.slice(0,z.end)+`
|
|
15184
|
-
`+K+Q.slice(z.end)}}catch{}if(G)Q=bQ(Q);if(G&&X.__stx_inject_css!==!1)Q=await i7(Q,void 0,J.buildMode==="serve");if(G)Q=c6(Q);return Q=Q.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),Q})}catch(Q){if(Q instanceof C$)throw Q;let w=Q instanceof Error?Q.message:String(Q),q=new Y5(`Template processing failed: ${w}`,Z,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if($1.log(q,{filePath:Z,context:X}),T3.logDetailedError(q,{filePath:Z,template:$.substring(0,500)}),J.debug)throw q;return R3.createFallbackContent("Template Processing",q)}}async function
|
|
15184
|
+
`+K+Q.slice(z.end)}}catch{}if(G)Q=bQ(Q);if(G&&X.__stx_inject_css!==!1)Q=await i7(Q,void 0,J.buildMode==="serve");if(G)Q=c6(Q);return Q=Q.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),Q})}catch(Q){if(Q instanceof C$)throw Q;let w=Q instanceof Error?Q.message:String(Q),q=new Y5(`Template processing failed: ${w}`,Z,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if($1.log(q,{filePath:Z,context:X}),T3.logDetailedError(q,{filePath:Z,template:$.substring(0,500)}),J.debug)throw q;return R3.createFallbackContent("Template Processing",q)}}async function BL($,X,Z,J,Y){let G=process.cwd(),Q={...J,partialsDir:J.partialsDir&&!S0.isAbsolute(J.partialsDir)?S0.resolve(G,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!S0.isAbsolute(J.componentsDir)?S0.resolve(G,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!S0.isAbsolute(J.layoutsDir)?S0.resolve(G,J.layoutsDir):J.layoutsDir},w=Q,q=$;await OL(Z,X),HL(X,w),q=await P5(()=>UQ(q,X,Z,w),q,(F)=>{$1.log(F,{filePath:Z,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Z}: ${F.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=q1(q,D7,(F,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);q=W.output;let K=W.tokens,z=(F)=>K.length===0?F:F.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(V,A)=>K[Number(A)]??""),U="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,U),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(F,V)=>{return`{{ ${V} }}`}),q=NQ(q),q=await lQ(q,Z,Y);let B={};q=D4(q,B);let j={...X.__sections||{}},_="",H=SY(m$($)),L=/@nolayout\b/.test(q)||H===!1;if(/@nolayout\b/.test(q))q=q.replace(/@nolayout\b\s*/g,"");let O=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(O)_=O[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof H==="string"){if(_=H,!/@section\s*\(/.test(q))q=`@section('content')
|
|
15185
15185
|
${q.trim()}
|
|
15186
15186
|
@endsection`}if(!_&&!L&&w.defaultLayout){let F=g4(q),V=/@section\s*\(/.test(q);if(!F||V){let A="",R=S0.dirname(Z),N=w.layoutsDir?S0.dirname(w.layoutsDir):process.cwd();for(let T=0;T<20;T++){let M=S0.join(R,"_layout.stx");if(await p(M)){A=M;break}let k=S0.dirname(R);if(k===R||k.length<N.length)break;R=k}if(A)_=A;else if(w.layoutsDir){let T=S0.isAbsolute(w.layoutsDir)?w.layoutsDir:S0.resolve(process.cwd(),w.layoutsDir),M=S0.join(T,`${w.defaultLayout}.stx`);if(await p(M))_=M}if(_&&!V)q=`@section('content')
|
|
15187
15187
|
${q.trim()}
|
|
15188
15188
|
@endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(F,V,A)=>{return j[V]=A,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(F,V,A)=>{if(/^(['"]).*\1$/.test(A.trim()))return F;try{let R=J0(A.trim(),X);if(R===void 0)return F;return j[V]=String(R??""),""}catch{return F}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(F,V,A)=>{if(A.includes("@parent"))j[V]=A.replace("@parent",U5);else j[V]=A.trim();return""}),X.__sections=j,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(F,V,A)=>{return j[V]||A||""}),!("slot"in X)||X.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""});if(q=y4(q,B),_){let F=[],V=y1(q),A=q1(V.output,M5,(R,N)=>`\x00STX_ORPHAN_STYLE_${N}\x00`);if(q=A.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(R,N,T)=>{let M=N==="SCRIPT"?V.scripts[Number(T)]:A.tokens[Number(T)];if(M)F.push(M);return""}),F.length>0){let R=F.join(`
|
|
15189
15189
|
`);j.content=j.content?`${j.content}
|
|
15190
|
-
${R}`:R,X.__sections=j}}if(_)try{let F;if(S0.isAbsolute(_))F=_,Y.add(_);else F=await P5(()=>dX(_,Z,Q,Y),null,()=>{throw new Y5(`Failed to resolve layout path: ${_}`,Z,void 0,void 0,`Layout referenced from ${Z}`)});if(!F){let M=[];try{let y=Q.layoutsDir;if(y){let I=S0.isAbsolute(y)?y:S0.resolve(process.cwd(),y);M=
|
|
15191
|
-
${q}`,z(q)}catch(F){return $1.log(F instanceof Error?F:Error(String(F)),{layoutPath:_,filePath:Z},"error"),`[Error processing layout: ${F instanceof Error?F.message:String(F)}]`}return z(await Lq(q,X,Z,Q,Y))}function
|
|
15190
|
+
${R}`:R,X.__sections=j}}if(_)try{let F;if(S0.isAbsolute(_))F=_,Y.add(_);else F=await P5(()=>dX(_,Z,Q,Y),null,()=>{throw new Y5(`Failed to resolve layout path: ${_}`,Z,void 0,void 0,`Layout referenced from ${Z}`)});if(!F){let M=[];try{let y=Q.layoutsDir;if(y){let I=S0.isAbsolute(y)?y:S0.resolve(process.cwd(),y);M=zL.readdirSync(I).filter((S)=>S.endsWith(".stx")).map((S)=>S.replace(/\.stx$/,"")).sort()}}catch{}let k=`Layout not found: ${_} (referenced from ${Z})`+(M.length>0?`. Available layouts: ${M.join(", ")}`:Q.layoutsDir?`. No .stx layouts found in ${Q.layoutsDir}`:"");if($1.log(Error(k),{layoutPath:_,filePath:Z,available:M},"error"),console.error(`[stx] ${k}`),Q.debug)throw new Y5(k,Z);return q}let V=await P5(()=>Bun.file(F).text(),"",()=>{throw new Y5(`Failed to read layout file: ${F}`,Z,void 0,void 0,"Layout content could not be loaded")}),A=V.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(A){if(Q.debug)console.log(`Found nested layout: ${A[1]} in ${F}`);let M={},k=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(S,b,C)=>{return M[b]=C.trim(),""});for(let[S,b]of Object.entries(M))if(j[S]&&j[S].includes(U5)){let C=j[S].indexOf(U5);j[S]=j[S].slice(0,C)+b+j[S].slice(C+U5.length)}else if(!j[S])j[S]=b;let y={...X,__sections:j},I=`@layout('${A[1]}')${k}`;return await O0(I,y,F,Q,Y)}let R=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=D4(R,B),T={};return N=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(M,k,y)=>{return T[k]=y.trim(),`@slot('${k}')`}),N=N.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(M,k,y)=>{if(j[k]){let I=j[k];if(I.includes(U5)){let S=T[k]||"",b=I.indexOf(U5);I=I.slice(0,b)+S+I.slice(b+U5.length)}return I}return y||""}),N=_L(N,j),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),N=y4(N,B),X.__originalFilePath=Z,q=await Lq(N,X,F,Q,Y),q=`<!-- stx-layout: ${_} -->
|
|
15191
|
+
${q}`,z(q)}catch(F){return $1.log(F instanceof Error?F:Error(String(F)),{layoutPath:_,filePath:Z},"error"),`[Error processing layout: ${F instanceof Error?F.message:String(F)}]`}return z(await Lq(q,X,Z,Q,Y))}function _L($,X){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Z,J,Y)=>{let G=X[J];if(G!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(G))return G}return Y||""})}function HL($,X){if($.__stx_sfc_mode=!0,$.__stx_options=X,X.buildMode)$.__stx_buildMode=X.buildMode;let Z=X.envPrefix||"STX_PUBLIC_",J={};for(let[Y,G]of Object.entries(process.env))if(Y.startsWith(Z)&&G!==void 0)J[Y]=G;$.$env=J}async function OL($,X){await P5(()=>OQ($,X),void 0,(Z)=>{$1.log(Z,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Z.message}`)})}async function LL($,X,Z){let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Y;while((Y=J.exec($))!==null){let G=Y[1],Q=Y[2];if(!/\bserver\b/.test(G)||!Q.trim())continue;try{let{extractVariables:q}=await e("stx/variable-extractor",()=>Promise.resolve().then(() => (v7(),v8)));await q(Q,X,Z,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));$1.log(W,{filePath:Z,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Z}: ${W.message}`)}}}async function FL($,X,Z){try{let{interpolateScriptsInTemplate:J}=await e("stx/expressions",()=>Promise.resolve().then(() => (W1(),x6)));return J($,X,{skipServer:!0})}catch(J){let Y=J instanceof Error?J:Error(String(J));return $1.log(Y,{filePath:Z,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Z}: ${Y.message}`),$}}async function Lq($,X,Z,J,Y){let G=$,Q=J;if(await LL(G,X,Z),G=await FL(G,X,Z),G=await QQ(G,X,Z),G=await wQ(G,X,Z),G=await tY(G,X,Z,Q),F1(G))G=vX(G,X),G=fX(G,X);G=xX(G);let{processStreamDirectives:w}=await e("stx/streaming",()=>Promise.resolve().then(() => (r3(),n3)));G=w(G,X),G=M4(G,X,Z,Q),G=await EQ(G,X,Z,Q,Y),G=await Z9(G,X,Z,Q,Y),G=S2(G,X,Z,Q);let{processDeferDirectives:q}=await e("stx/defer",()=>Promise.resolve().then(() => Gw));G=q(G,X,Z);let{processTeleportDirectives:W}=await e("stx/teleport",()=>Promise.resolve().then(() => ww));G=W(G,X,Z);let{processTransitionDirectives:K,processTransitionAttributes:z}=await e("stx/transitions",()=>Promise.resolve().then(() => zw));G=K(G,X,Z),G=z(G);let{processErrorBoundaryDirectives:U}=await e("stx/error-boundaries",()=>Promise.resolve().then(() => jw));G=U(G,X,Z);let{processSuspenseDirectives:B}=await e("stx/suspense",()=>Promise.resolve().then(() => Bw));G=B(G,X,Z);let{processAsyncDirectives:j}=await e("stx/async-components",()=>Promise.resolve().then(() => Lw));G=j(G,X,Z);let{processKeepAliveDirectives:_}=await e("stx/keep-alive",()=>Promise.resolve().then(() => Vw));G=_(G,X,Z);let{processVirtualListDirectives:H,processVirtualGridDirectives:L,processInfiniteListDirectives:O}=await e("stx/virtual-scrolling",()=>Promise.resolve().then(() => (kw(),Mw)));G=H(G,X,Z),G=L(G,X,Z),G=O(G,X,Z);let{processPartialHydrationDirectives:F,processStaticDirectives:V}=await e("stx/partial-hydration",()=>Promise.resolve().then(() => (dw(),uw)));G=F(G,X,Z),G=V(G);let{processComputedDirectives:A,processWatchDirectives:R}=await e("stx/computed",()=>Promise.resolve().then(() => (ew(),tw)));G=A(G,X,Z),G=R(G,X,Z);let{processFormValidationDirectives:N}=await e("stx/forms-validation",()=>Promise.resolve().then(() => (Qq(),Gq)));G=N(G,X,Z);let{processHeadDirective:T,processTitleDirective:M,processMetaDirective:k,resetHead:y}=await e("stx/head",()=>Promise.resolve().then(() => (P7(),WX)));if(!X.__stx_head_preset&&!X.__stx_runtime_head)y();let I=T(G);if(G=I.content,I.headContent)X.__stx_head_raw=`${X.__stx_head_raw||""}${I.headContent}
|
|
15192
15192
|
`;if(G=M(G,X),G=k(G,X),G=_Q(G),G=C3(G,X),G=sY(G),G=KQ(G),G=await E4(G,X,Z,Q,Y),G=await Z9(G,X,Z,Q,Y),X.__stxProcessingDepth===1)G=L6(G,X);if(G=G.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),G=m4(G),G=Q5(G,X,Z),G=P3(G,X),G=v3(G,X),G=n$(G,X),G=wG(G,X),G=qG(G,X),G=await gY(G,X,Z,Q),G=await oZ(G,X,Z),G=await jG(G,X,Z,Q),G=M2(G,X,Z,Q),G=JY(G,X,Z,Q),G=YY(G,X,Z),G=GY(G,X,Z,Q),G=nY(G,X,Z,Q),G=u4(G,X),G=d4(G),G=pQ(G),!Q.skipEventDirectives)G=a2(G,X,Z);if(G=xY(G,X,Z),Q.debug){let n=/\bx-data\s*=/.test(G),s=e8($);if(n&&s)console.warn(`[stx] ${Z}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
15193
15193
|
Both work on the same page, but they manage separate scopes.
|
|
15194
15194
|
Prefer signals (state/derived/effect) for new components.`)}G=VQ(G,X),G=await b1(G,X,Z),G=iQ(G),G=nQ(G),G=EY(G);let{processXElementDirectives:S}=await e("stx/x-element",()=>Promise.resolve().then(() => Wq));G=S(G);let b=X.__originalFilePath||Z,C=k7(X);if(G=await gX(G,Q,b,C),G=JG(G,X),G=await jQ(G,X,Z,Q),Q.media?.image?.autoSiblings){let n=Q.publicDir||"public",{rewriteImagesWithSiblings:s}=await e("stx/image-optimization/auto-sibling",()=>Promise.resolve().then(() => (zq(),Kq)));G=await s(G,{publicDir:n})}if(Q.seo?.enabled)G=QY(G,X,Q);let P=(n,s,K0=!0)=>{if(!s)return n;let I0=s.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),w0=n.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(I0&&w0){if(K0)n=n.replace(w0[0],I0[0]);if(s=s.replace(I0[0],"").trim(),!s)return n}if(/<\/head>/i.test(n))return n.replace(/<\/head>/i,`${s}
|
|
@@ -15202,21 +15202,21 @@ ${TY()}
|
|
|
15202
15202
|
`+v}else G=G.replace("</head>",`${s}
|
|
15203
15203
|
</head>`)}else if(G.includes("<body"))G=G.replace(/<body([^>]*)>/,`<body$1>
|
|
15204
15204
|
${s}`);else G=s+`
|
|
15205
|
-
`+G}{let{scanScriptTags:n}=await e("stx/signal-processing",()=>Promise.resolve().then(() => (h7(),$$))),s=[];for(let K0 of n(G)){if(!/\bserver\b/i.test(K0.attrs))continue;let I0=K0.start+K0.fullMatch.indexOf(">")+1,w0=
|
|
15206
|
-
`+G.slice(K0)}X.__stx_event_bindings=[]}}if(!PZ(G)&&vZ(G))G=await o8(G,Q);if(Q.csp?.enabled&&Q.csp.useNonce&&typeof X.cspNonce==="string")G=iY(G,X.cspNonce);return G}var U5="<!--PARENT_CONTENT_PLACEHOLDER-->";var Y$=D(()=>{d$();OX();r1();g9();MY();DY();bY();d9();h9();i9();E7();fY();hY();c$();rY();aY();$G();YG();V1();P7();W1();WG();BG();GQ();WQ();k4();mX();BQ();E5();HQ();v$();k0();LQ();AQ();TQ();DQ();GX();v4();uQ();h7();N4();cQ();l4();p4();T0();s3();e9();A7();s8();s8();l4();p4()});import F0 from"fs";import G0 from"path";import Y2 from"fs";import Sq from"path";var O9="resources/assets",G2="assets";function Q2($=process.cwd()){let X=Sq.resolve($,O9);return Y2.existsSync(X)&&Y2.statSync(X).isDirectory()?X:null}import H5 from"fs";import L9 from"path";var w2="_stx";function Cq($){return Bun.hash($).toString(16).slice(0,8)}function Pq($){let X=[],Z=(J)=>{for(let Y of H5.readdirSync(J,{withFileTypes:!0})){let G=L9.join(J,Y.name);if(Y.isDirectory())Z(G);else if(Y.isFile()&&G.endsWith(".html"))X.push(G)}};if(H5.existsSync($))Z($);return X}var vq=[{pattern:/<script\b([^>]*\bdata-stx-runtime\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"runtime",extension:"js",contentType:"text/javascript; charset=utf-8",replace:($)=>`<script data-stx-runtime src="${$}"></script>`},{pattern:/<script\b([^>]*\bdata-stx-router\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"router",extension:"js",contentType:"text/javascript; charset=utf-8",replace:($)=>`<script data-stx-router src="${$}"></script>`},{pattern:/<style\b([^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*)>([\s\S]*?)<\/style>/gi,prefix:"crosswind",extension:"css",contentType:"text/css; charset=utf-8",replace:($)=>`<link data-crosswind="generated" rel="stylesheet" href="${$}">`}];function xq($,X=`/${w2}`){let Z=[],J=new Set,Y=0,G=$;for(let Q of vq)G=G.replace(Q.pattern,(w,q,W)=>{if(/\b(?:src|href)\s*=/.test(q)||!W.trim())return w;let K=`${Q.prefix}.${Cq(W)}.${Q.extension}`;if(!J.has(K))J.add(K),Z.push({filename:K,contents:W,contentType:Q.contentType});return Y+=W.length,Q.replace(`${X}/${K}`)});return{html:G,assets:Z,bytesInlined:Y}}function q2($){let X={pages:0,assets:0,bytesInlined:0},Z=L9.join($,w2),J=new Set;for(let Y of Pq($)){let G=H5.readFileSync(Y,"utf8"),{html:Q,assets:w,bytesInlined:q}=xq(G);if(Q===G)continue;for(let W of w){if(J.has(W.filename))continue;J.add(W.filename),H5.mkdirSync(Z,{recursive:!0}),H5.writeFileSync(L9.join(Z,W.filename),W.contents),X.assets++}H5.writeFileSync(Y,Q),X.bytesInlined+=q,X.pages++}return X}x9();Y$();import{createHash as
|
|
15205
|
+
`+G}{let{scanScriptTags:n}=await e("stx/signal-processing",()=>Promise.resolve().then(() => (h7(),$$))),s=[];for(let K0 of n(G)){if(!/\bserver\b/i.test(K0.attrs))continue;let I0=K0.start+K0.fullMatch.indexOf(">")+1,w0=UL(G,I0);if(w0===-1)continue;let E=w0+9;while(E<G.length&&/\s/.test(G[E]))E++;s.push({start:K0.start,end:E})}for(let K0=s.length-1;K0>=0;K0--){let{start:I0,end:w0}=s[K0];G=G.substring(0,I0)+G.substring(w0)}}let u=b8(G,Z);if(u.hasScoped)G=u.html;let t=X.__stx_event_bindings||[],R0=!1,P0=[],j5=/\s:[a-z][\w.-]*\s*=/.test(G),{scanScriptTags:B5}=await e("stx/signal-processing",()=>Promise.resolve().then(() => (h7(),$$)));for(let n of B5(G,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))P0.push({match:n.fullMatch,attrs:n.attrs,content:n.body});for(let{match:n,attrs:s,content:K0}of P0){R0=!0;let I0=K0;c4(K0,Z,J.strict,X.__originalFilePath);let w0=await I7(K0,{eventBindings:t,attrs:s,hasColonDirectives:j5,templateContent:$,filePath:Z,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:C});G=G.replace(n,()=>w0)}if(R0)X.__stx_event_bindings=[];if(!R0&&X.__stxProcessingDepth===1){let n=X.__stx_event_bindings||[];if(n.length>0){let s=p9(n);if(s){let K0=G.lastIndexOf("</body>");G=K0===-1?G+s:G.slice(0,K0)+s+`
|
|
15206
|
+
`+G.slice(K0)}X.__stx_event_bindings=[]}}if(!PZ(G)&&vZ(G))G=await o8(G,Q);if(Q.csp?.enabled&&Q.csp.useNonce&&typeof X.cspNonce==="string")G=iY(G,X.cspNonce);return G}var U5="<!--PARENT_CONTENT_PLACEHOLDER-->";var Y$=D(()=>{d$();OX();r1();g9();MY();DY();bY();d9();h9();i9();E7();fY();hY();c$();rY();aY();$G();YG();V1();P7();W1();WG();BG();GQ();WQ();k4();mX();BQ();E5();HQ();v$();k0();LQ();AQ();TQ();DQ();GX();v4();uQ();h7();N4();cQ();l4();p4();T0();s3();e9();A7();s8();s8();l4();p4()});import F0 from"fs";import G0 from"path";import Y2 from"fs";import Sq from"path";var O9="resources/assets",G2="assets";function Q2($=process.cwd()){let X=Sq.resolve($,O9);return Y2.existsSync(X)&&Y2.statSync(X).isDirectory()?X:null}import H5 from"fs";import L9 from"path";var w2="_stx";function Cq($){return Bun.hash($).toString(16).slice(0,8)}function Pq($){let X=[],Z=(J)=>{for(let Y of H5.readdirSync(J,{withFileTypes:!0})){let G=L9.join(J,Y.name);if(Y.isDirectory())Z(G);else if(Y.isFile()&&G.endsWith(".html"))X.push(G)}};if(H5.existsSync($))Z($);return X}var vq=[{pattern:/<script\b([^>]*\bdata-stx-runtime\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"runtime",extension:"js",contentType:"text/javascript; charset=utf-8",replace:($)=>`<script data-stx-runtime src="${$}"></script>`},{pattern:/<script\b([^>]*\bdata-stx-router\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"router",extension:"js",contentType:"text/javascript; charset=utf-8",replace:($)=>`<script data-stx-router src="${$}"></script>`},{pattern:/<style\b([^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*)>([\s\S]*?)<\/style>/gi,prefix:"crosswind",extension:"css",contentType:"text/css; charset=utf-8",replace:($)=>`<link data-crosswind="generated" rel="stylesheet" href="${$}">`}];function xq($,X=`/${w2}`){let Z=[],J=new Set,Y=0,G=$;for(let Q of vq)G=G.replace(Q.pattern,(w,q,W)=>{if(/\b(?:src|href)\s*=/.test(q)||!W.trim())return w;let K=`${Q.prefix}.${Cq(W)}.${Q.extension}`;if(!J.has(K))J.add(K),Z.push({filename:K,contents:W,contentType:Q.contentType});return Y+=W.length,Q.replace(`${X}/${K}`)});return{html:G,assets:Z,bytesInlined:Y}}function q2($){let X={pages:0,assets:0,bytesInlined:0},Z=L9.join($,w2),J=new Set;for(let Y of Pq($)){let G=H5.readFileSync(Y,"utf8"),{html:Q,assets:w,bytesInlined:q}=xq(G);if(Q===G)continue;for(let W of w){if(J.has(W.filename))continue;J.add(W.filename),H5.mkdirSync(Z,{recursive:!0}),H5.writeFileSync(L9.join(Z,W.filename),W.contents),X.assets++}H5.writeFileSync(Y,Q),X.bytesInlined+=q,X.pages++}return X}x9();Y$();import{createHash as VL}from"crypto";function AL($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}var RL=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function NL($){return Bun.hash($).toString(16)}function Fq($,X={}){if(!$.includes('type="stx/island"'))return{html:$,chunks:[]};let Z=new Map,J=$.replace(RL,(G,Q,w,q)=>{let W=q.trim();if(!W)return G;if(/\bdata-stx-src=/.test(w))return G;if(X.minify)W=AL(W);let K=NL(W);if(!Z.has(K))Z.set(K,W);let z=X.integrity?` data-stx-integrity="sha384-${VL("sha384").update(W).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${Q}" data-stx-src="/_stx/islands/${K}.js"${z}${w}></script>`}),Y=Array.from(Z,([G,Q])=>({hash:G,code:Q}));return{html:J,chunks:Y}}var TL=new Set(["visible","idle"]);function Vq($){if(!$.includes("data-stx-src="))return $;let X=new Map,Z=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,J;while((J=Z.exec($))!==null)X.set(J[1],J[2]);let Y=new Set,G=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,Q;while((Q=G.exec($))!==null)if(TL.has(X.get(Q[1])||""))Y.add(Q[2]);let w=$.lastIndexOf("</head>");if(Y.size===0||w===-1)return $;let q=Array.from(Y).filter((W)=>!$.includes(`rel="prefetch" href="${W}"`)).map((W)=>`<link rel="prefetch" href="${W}" as="script">`).join("");if(!q)return $;return $.slice(0,w)+q+$.slice(w)}L1();import w8 from"fs";import _9 from"path";var ML="layout-types.d.ts";function kL($){let X=[],Z=(J,Y)=>{let G;try{G=w8.readdirSync(J,{withFileTypes:!0})}catch{return}for(let Q of G){if(Q.name.startsWith("."))continue;let w=_9.join(J,Q.name);if(Q.isDirectory())Z(w,Y?`${Y}/${Q.name}`:Q.name);else if(Q.isFile()&&Q.name.endsWith(".stx")&&Q.name!=="_layout.stx"){let q=Q.name.slice(0,-4);X.push(Y?`${Y}/${q}`:q)}}};return Z($,""),X.sort()}function IL($){let X=["// Auto-generated by stx \u2014 do not edit.","//","// Makes `definePageMeta({ layout })` reject a name with no layout behind it.","// Include this file in your tsconfig (it lives in the stx state directory,","// `.stx/` by default) for the check to apply.",""];if($.length===0)return X.push("// No layouts found \u2014 `layout` stays typed as `string`.","export {}",""),X.join(`
|
|
15207
15207
|
`);return X.push("declare module '@stacksjs/stx' {"," interface KnownLayouts {",...$.map((Z)=>` '${Z}': true`)," }","}","","export {}",""),X.join(`
|
|
15208
|
-
`)}function Aq($,X){if(!$)return[];let Z=_9.isAbsolute($)?$:_9.resolve(process.cwd(),$),J=
|
|
15209
|
-
`)}v$();F7();d$();k1();class Mq{cacheDir;cache=new Map;loaded=!1;constructor($){this.cacheDir=$}async load(){if(this.loaded)return;let $=G0.join(this.cacheDir,"build-cache.json");if(await Bun.file($).exists())try{let X=JSON.parse(await Bun.file($).text());for(let[Z,J]of Object.entries(X))this.cache.set(Z,J)}catch{}this.loaded=!0}async save(){await F0.promises.mkdir(this.cacheDir,{recursive:!0});let $=G0.join(this.cacheDir,"build-cache.json"),X={};for(let[Z,J]of this.cache)X[Z]=J;await Bun.write($,JSON.stringify(X))}getHash($,X){let Z=F0.statSync($),J=`${$}:${Z.mtimeMs}`;for(let G of X)if(F0.existsSync(G)){let Q=F0.statSync(G);J+=`:${G}:${Q.mtimeMs}`}let Y=0;for(let G=0;G<J.length;G++){let Q=J.charCodeAt(G);Y=(Y<<5)-Y+Q,Y=Y&Y}return Math.abs(Y).toString(36)}get($,X){let Z=this.cache.get($);if(!Z)return null;let J=this.getHash(X,Z.dependencies??[]);if(Z.hash!==J)return this.cache.delete($),null;return Z.html}set($,X,Z,J){let Y=this.getHash(X,Z);this.cache.set($,{hash:Y,html:J,generatedAt:Date.now(),dependencies:Z})}}class kq{cacheDir;constructor($){this.cacheDir=$}getFilePath($){let X=$.replace(/[^a-zA-Z0-9]/g,"_")+".json";return G0.join(this.cacheDir,"isr",X)}async get($){let X=this.getFilePath($);if(!await Bun.file(X).exists())return null;try{return JSON.parse(await Bun.file(X).text())}catch{return null}}async set($,X){let Z=this.getFilePath($);await F0.promises.mkdir(G0.dirname(Z),{recursive:!0}),await Bun.write(Z,JSON.stringify(X))}async invalidate($){let X=this.getFilePath($);if(await Bun.file(X).exists())await F0.promises.unlink(X)}async invalidatePattern($){let X=G0.join(this.cacheDir,"isr");if(!F0.existsSync(X))return;let Z=await F0.promises.readdir(X);for(let J of Z){let Y=J.replace(/_/g,"/").replace(".json","");if($.test(Y))await F0.promises.unlink(G0.join(X,J))}}async needsRevalidation($){let X=await this.get($);if(!X)return!0;return Date.now()>X.revalidateAfter}}async function
|
|
15208
|
+
`)}function Aq($,X){if(!$)return[];let Z=_9.isAbsolute($)?$:_9.resolve(process.cwd(),$),J=kL(Z),Y=IL(J),G=_9.join(X,ML);try{if(w8.existsSync(G)&&w8.readFileSync(G,"utf8")===Y)return J;w8.mkdirSync(X,{recursive:!0}),w8.writeFileSync(G,Y)}catch{}return J}var EL=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function X2($){let X=$.trim();if(!X)return null;let Z=/^https?:\/\//i.test(X)?X:`https://${X}`;try{return new URL(Z).origin+new URL(Z).pathname.replace(/\/$/,"")}catch{return null}}function DL($){for(let X of EL){let Z=$[X];if(!Z)continue;let J=X2(Z);if(J)return{url:J,source:"env",via:X}}return null}function Rq($){if(!$||typeof $!=="object")return null;let X=$,Z=X.site?.url??X.url??X.app?.url;return typeof Z==="string"?X2(Z):null}async function yL($){let{existsSync:X}=await import("fs"),Z=await import("path");for(let J of["site.config.ts","site.config.js",".config/site.config.ts"]){let Y=Z.resolve($,J);if(!X(Y))continue;try{let G=await import(Y),Q=Rq(G.default??G);if(Q)return Q}catch{}}return null}async function Nq($={}){let X=$.cwd??process.cwd(),Z=$.env??process.env;if($.explicit){let Q=X2($.explicit);if(Q)return{url:Q,source:"option"}}let J=Rq($.stxConfig);if(J)return{url:J,source:"stx.config",via:"site.url"};let Y=await yL(X);if(Y)return{url:Y,source:"site.config",via:"url"};let G=DL(Z);if(G)return G;return{url:"http://localhost",source:"fallback"}}function Tq(){return["No site URL configured \u2014 sitemap.xml and robots.txt will point at http://localhost."," Set one in stx.config.ts (site: { url: 'https://example.com' }), in site.config.ts,"," via --domain, or with SITE_URL in the build environment."].join(`
|
|
15209
|
+
`)}v$();F7();d$();k1();class Mq{cacheDir;cache=new Map;loaded=!1;constructor($){this.cacheDir=$}async load(){if(this.loaded)return;let $=G0.join(this.cacheDir,"build-cache.json");if(await Bun.file($).exists())try{let X=JSON.parse(await Bun.file($).text());for(let[Z,J]of Object.entries(X))this.cache.set(Z,J)}catch{}this.loaded=!0}async save(){await F0.promises.mkdir(this.cacheDir,{recursive:!0});let $=G0.join(this.cacheDir,"build-cache.json"),X={};for(let[Z,J]of this.cache)X[Z]=J;await Bun.write($,JSON.stringify(X))}getHash($,X){let Z=F0.statSync($),J=`${$}:${Z.mtimeMs}`;for(let G of X)if(F0.existsSync(G)){let Q=F0.statSync(G);J+=`:${G}:${Q.mtimeMs}`}let Y=0;for(let G=0;G<J.length;G++){let Q=J.charCodeAt(G);Y=(Y<<5)-Y+Q,Y=Y&Y}return Math.abs(Y).toString(36)}get($,X){let Z=this.cache.get($);if(!Z)return null;let J=this.getHash(X,Z.dependencies??[]);if(Z.hash!==J)return this.cache.delete($),null;return Z.html}set($,X,Z,J){let Y=this.getHash(X,Z);this.cache.set($,{hash:Y,html:J,generatedAt:Date.now(),dependencies:Z})}}class kq{cacheDir;constructor($){this.cacheDir=$}getFilePath($){let X=$.replace(/[^a-zA-Z0-9]/g,"_")+".json";return G0.join(this.cacheDir,"isr",X)}async get($){let X=this.getFilePath($);if(!await Bun.file(X).exists())return null;try{return JSON.parse(await Bun.file(X).text())}catch{return null}}async set($,X){let Z=this.getFilePath($);await F0.promises.mkdir(G0.dirname(Z),{recursive:!0}),await Bun.write(Z,JSON.stringify(X))}async invalidate($){let X=this.getFilePath($);if(await Bun.file(X).exists())await F0.promises.unlink(X)}async invalidatePattern($){let X=G0.join(this.cacheDir,"isr");if(!F0.existsSync(X))return;let Z=await F0.promises.readdir(X);for(let J of Z){let Y=J.replace(/_/g,"/").replace(".json","");if($.test(Y))await F0.promises.unlink(G0.join(X,J))}}async needsRevalidation($){let X=await this.get($);if(!X)return!0;return Date.now()>X.revalidateAfter}}async function bL($){try{let Z=(await Bun.file($).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!Z)return null;let J=Z[1];if(!J.includes("getStaticPaths"))return null;let Y=J.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!Y)return null;return await Function(`
|
|
15210
15210
|
return (async function getStaticPaths() {
|
|
15211
15211
|
${Y[1]}
|
|
15212
15212
|
})()
|
|
15213
|
-
`)()}catch(X){return console.error(`Error extracting static paths from ${$}:`,X),null}}async function
|
|
15213
|
+
`)()}catch(X){return console.error(`Error extracting static paths from ${$}:`,X),null}}async function SL($){let X=[];if(!$.isDynamic)X.push({url:$.pattern,params:{}});else{let Z=await bL($.filePath);if(!Z||Z.paths.length===0)return console.warn(`Warning: Dynamic route ${$.pattern} has no getStaticPaths or returned empty paths`),X;for(let J of Z.paths){let Y=$.pattern;for(let[G,Q]of Object.entries(J.params))Y=Y.replace(`:${G}`,Q).replace(`:${G}*`,Q);X.push({url:Y,params:J.params,props:J.props,revalidate:J.revalidate})}}return X}async function CL($){let X=[$.replace(/\.stx$/,".data.ts"),$.replace(/\.stx$/,".data.js"),$+".data.ts",$+".data.js"];for(let Z of X)if(await Bun.file(Z).exists())try{let J=await import(Z);if(typeof J.default==="function")return await J.default();else if(typeof J.default==="object")return J.default;else if(typeof J.getData==="function")return await J.getData();else{let{default:Y,...G}=J;return G}}catch(J){console.error(`Error loading data file ${Z}:`,J)}return null}async function PL($,X,Z){let J=$.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!J)return null;let Y=J[1];if(!Y.includes("getStaticProps"))return null;try{let G=Y.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!G)return null;return await Function("params",`
|
|
15214
15214
|
return (async function getStaticProps() {
|
|
15215
15215
|
${G[1]}
|
|
15216
15216
|
})()
|
|
15217
|
-
`)(X)}catch(G){return console.error(`Error executing getStaticProps in ${Z}:`,G),null}}function
|
|
15217
|
+
`)(X)}catch(G){return console.error(`Error executing getStaticProps in ${Z}:`,G),null}}function vL($){return/(?:^|[^\w$.])(?:export\s+)?(?:async\s+)?function\s+action\s*\(/.test($)||/(?:^|[^\w$.])(?:export\s+)?(?:const|let|var)\s+action\s*=/.test($)}async function Iq($,X,Z={},J,Y){let G=await Bun.file($.filePath).text(),Q=await CL($.filePath),w=await PL(G,X,$.filePath),q={...Q||{},...w||{},...Z,params:X,$route:{path:$.pattern,params:X}},W=new Set,K={...Y,debug:!1,cache:!1,autoShell:!0};if(vL(G))console.warn(`Warning: ${$.pattern} exports a page action, which cannot run in a static build. Its form will submit to a file. Serve this route with the production server, or point the form's action at a route handler.`);let z=await O0(G,q,$.filePath,K,W);if(Object.keys(X).length>0){let U=`<script>if(window.stx)window.stx._rp=${JSON.stringify(X)};else window.__stx_rp=${JSON.stringify(X)};</script>`;if(z.includes("</head>"))z=z.replace("</head>",`${U}
|
|
15218
15218
|
</head>`);else z=`${U}
|
|
15219
|
-
${z}`}if(z=await CX(z,{router:J.router}),z=await i7(z),J.minify!==!1)return{html:
|
|
15219
|
+
${z}`}if(z=await CX(z,{router:J.router}),z=await i7(z),J.minify!==!1)return{html:xL(z),dependencies:Array.from(W)};return{html:z,dependencies:Array.from(W)}}function xL($){let X=[],Z=0,J=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,Y;while((Y=J.exec($))!==null){let Q=$.slice(Z,Y.index);X.push(Q.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let w=Y[1],q=Y[2],W=Y[3];q=q.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),X.push(w+q+W),Z=Y.index+Y[0].length}let G=$.slice(Z);return X.push(G.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),X.join("").trim()}function fL($){let X=0;for(let Z=0;Z<$.length;Z++){let J=$.charCodeAt(Z);X=(X<<5)-X+J,X=X&X}return`"${Math.abs(X).toString(36)}"`}function gL($,X,Z,J){if(Z?.sitemap===!1)return!0;if(/<meta[^>]+name=["']robots["'][^>]+content=["'][^"']*noindex/i.test(X))return!0;return J.some((Y)=>{if(Y instanceof RegExp)return Y.test($);return Y.endsWith("/")?$===Y.slice(0,-1)||$.startsWith(Y):$===Y})}function hL($,X){return`<?xml version="1.0" encoding="UTF-8"?>
|
|
15220
15220
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
15221
15221
|
${$.map((J)=>{let Y=new URL(J.loc,X).href,G=` <url>
|
|
15222
15222
|
<loc>${J1(Y)}</loc>`;if(J.lastmod)G+=`
|
|
@@ -15225,7 +15225,7 @@ ${$.map((J)=>{let Y=new URL(J.loc,X).href,G=` <url>
|
|
|
15225
15225
|
<priority>${J.priority}</priority>`;return G+=`
|
|
15226
15226
|
</url>`,G}).join(`
|
|
15227
15227
|
`)}
|
|
15228
|
-
</urlset>`}function J1($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function
|
|
15228
|
+
</urlset>`}function J1($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function uL($,X){let Z=X.map((J)=>{let Y=" <item>";if(Y+=`
|
|
15229
15229
|
<title>${J1(J.title)}</title>`,Y+=`
|
|
15230
15230
|
<link>${J1(J.link)}</link>`,J.description)Y+=`
|
|
15231
15231
|
<description>${J1(J.description)}</description>`;if(J.pubDate)Y+=`
|
|
@@ -15246,10 +15246,10 @@ ${$.map((J)=>{let Y=new URL(J.loc,X).href,G=` <url>
|
|
|
15246
15246
|
${Z.join(`
|
|
15247
15247
|
`)}
|
|
15248
15248
|
</channel>
|
|
15249
|
-
</rss>`}async function
|
|
15249
|
+
</rss>`}async function dL($={}){let X=Date.now(),Z=await t0(),J=await Nq({explicit:$.domain,stxConfig:Z});if(J.source==="fallback"&&($.sitemap??!0))console.warn(Tq());let Y={pagesDir:$.pagesDir||"pages",outputDir:$.outputDir||"dist",baseUrl:$.baseUrl||"/",domain:J.url,revalidate:$.revalidate??!1,sitemap:$.sitemap??!0,sitemapExclude:$.sitemapExclude||[],robots:$.robots??!0,rss:$.rss??!1,concurrency:$.concurrency||10,cache:$.cache??!0,cacheDir:$.cacheDir||_1(process.cwd(),"ssg-cache"),contentLoaders:$.contentLoaders||[],hooks:$.hooks||{},minify:$.minify??!1,generate404:$.generate404??!0,publicDir:$.publicDir||"public",trailingSlash:$.trailingSlash??!1,cleanOutput:$.cleanOutput??!0,chunkIslands:$.chunkIslands===!0,prefetchIslands:$.prefetchIslands===!0,integrityIslands:$.integrityIslands===!0},G={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},Q=new Set,w=0,q={},W={};await Y.hooks.onBuildStart?.();try{if(Y.cleanOutput&&F0.existsSync(Y.outputDir))await F0.promises.rm(Y.outputDir,{recursive:!0});await F0.promises.mkdir(Y.outputDir,{recursive:!0});let z=new Mq(Y.cacheDir);if(Y.cache)await z.load();try{let{generateCrosswindCSS:R}=await Promise.resolve().then(() => (d$(),NY));await R('<div class="bg-black"></div>')}catch{}w7();let U=Z?.routeMiddleware?.dir||"middleware";await W7(process.cwd(),U);let B=q7();if(B.length>0)console.log(`Loaded ${B.length} middleware: ${B.join(", ")}`);let j=Z?.routeMiddleware?.global||[];Aq(Z?.layoutsDir,_1(process.cwd()));let _=_7(".",{pagesDir:Y.pagesDir});console.log(`Found ${_.length} routes`);let H=[];for(let R of _){let N=await SL(R);for(let T of N)H.push({route:R,url:T.url,params:T.params,props:T.props,revalidate:T.revalidate??Y.revalidate})}G.totalPages=H.length,console.log(`Generating ${G.totalPages} pages...`);let L=[],O=[];for(let R=0;R<H.length;R+=Y.concurrency)O.push(H.slice(R,R+Y.concurrency));for(let R of O)await Promise.all(R.map(async(N)=>{let{route:T,url:M,params:k,props:y,revalidate:I}=N;try{await Y.hooks.onPageStart?.(M);let S=await Bun.file(T.filePath).text(),b=pL(S),C=b?.middleware?Array.isArray(b.middleware)?b.middleware:[b.middleware]:[],P=[...j,...C];if(P.length>0){let U0=K7(M,k,b||{}),A0=z7(U0,null,void 0,{isServer:!0}),u=await U7(P,A0);if(u.redirect){let t=typeof u.redirect==="string"?u.redirect:u.redirect.path||u.redirect,R0=iL(String(t),M),P0=nL(M,Y);await F0.promises.mkdir(G0.dirname(P0),{recursive:!0}),await Bun.write(P0,R0),G.successCount++,G.pages.push({route:M,outputPath:P0,size:Buffer.byteLength(R0),cached:!1}),L.push({loc:M,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${M} \u2192 redirect to ${t}`);return}if(u.abort){let t=typeof u.abort==="string"?u.abort:u.abort?.error?.message||"aborted";console.warn(` \u21B3 ${M} \u2014 middleware aborted: ${t}`);return}}let x=S.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(x)try{if(!await Function("route",`
|
|
15250
15250
|
const validate = ${x[1]};
|
|
15251
15251
|
return validate(route);
|
|
15252
|
-
`)({params:k})){console.warn(`Validation failed for ${M}, skipping...`);return}}catch{}let f=null,l=!1;if(Y.cache){if(f=z.get(M,T.filePath),f)l=!0,G.cachedCount++}if(!f){let U0=await Iq(T,k,y,Y,Z);if(f=U0.html,Y.cache)z.set(M,T.filePath,U0.dependencies,f)}let $0;if(Y.trailingSlash)$0=G0.join(Y.outputDir,M,"index.html");else $0=M==="/"?G0.join(Y.outputDir,"index.html"):G0.join(Y.outputDir,`${M}.html`);if(Y.chunkIslands){let{html:U0,chunks:A0}=Fq(f,{integrity:Y.integrityIslands,minify:Y.minify});if(A0.length>0){let u=G0.join(Y.outputDir,"_stx","islands");await F0.promises.mkdir(u,{recursive:!0});for(let t of A0){let R0=G0.join(u,`${t.hash}.js`);if(!await Bun.file(R0).exists())await Bun.write(R0,t.code);if(!Q.has(t.hash)){Q.add(t.hash);let P0=Buffer.byteLength(t.code,"utf8");w+=P0,q[t.hash]={bytes:P0,file:`/_stx/islands/${t.hash}.js`}}}if(W[M]=A0.map((t)=>t.hash),f=U0,Y.prefetchIslands)f=Vq(f)}}if(await F0.promises.mkdir(G0.dirname($0),{recursive:!0}),await Bun.write($0,f),!
|
|
15252
|
+
`)({params:k})){console.warn(`Validation failed for ${M}, skipping...`);return}}catch{}let f=null,l=!1;if(Y.cache){if(f=z.get(M,T.filePath),f)l=!0,G.cachedCount++}if(!f){let U0=await Iq(T,k,y,Y,Z);if(f=U0.html,Y.cache)z.set(M,T.filePath,U0.dependencies,f)}let $0;if(Y.trailingSlash)$0=G0.join(Y.outputDir,M,"index.html");else $0=M==="/"?G0.join(Y.outputDir,"index.html"):G0.join(Y.outputDir,`${M}.html`);if(Y.chunkIslands){let{html:U0,chunks:A0}=Fq(f,{integrity:Y.integrityIslands,minify:Y.minify});if(A0.length>0){let u=G0.join(Y.outputDir,"_stx","islands");await F0.promises.mkdir(u,{recursive:!0});for(let t of A0){let R0=G0.join(u,`${t.hash}.js`);if(!await Bun.file(R0).exists())await Bun.write(R0,t.code);if(!Q.has(t.hash)){Q.add(t.hash);let P0=Buffer.byteLength(t.code,"utf8");w+=P0,q[t.hash]={bytes:P0,file:`/_stx/islands/${t.hash}.js`}}}if(W[M]=A0.map((t)=>t.hash),f=U0,Y.prefetchIslands)f=Vq(f)}}if(await F0.promises.mkdir(G0.dirname($0),{recursive:!0}),await Bun.write($0,f),!gL(M,f,b,Y.sitemapExclude))L.push({loc:M,lastmod:new Date().toISOString().split("T")[0],priority:M==="/"?1:0.8});let C0={route:M,outputPath:$0,size:Buffer.byteLength(f,"utf8"),cached:l};if(I!==!1)C0.revalidateAt=Date.now()+I*1000;G.pages.push(C0),G.successCount++,await Y.hooks.onPageEnd?.(M,f)}catch(S){G.failedCount++,G.errors.push({route:M,error:S}),await Y.hooks.onError?.(S,M),console.error(`Error generating ${M}:`,S)}}));if(Y.cache)await z.save();if(Y.generate404){let R=G0.join(Y.pagesDir,"404.stx");if(await Bun.file(R).exists()){let N=new Set,T={...Z,debug:!1,cache:!1},M=await O0(await Bun.file(R).text(),{},R,T,N);await Bun.write(G0.join(Y.outputDir,"404.html"),M)}else await Bun.write(G0.join(Y.outputDir,"404.html"),`<!DOCTYPE html>
|
|
15253
15253
|
<html lang="en">
|
|
15254
15254
|
<head>
|
|
15255
15255
|
<meta charset="UTF-8">
|
|
@@ -15270,7 +15270,7 @@ ${Z.join(`
|
|
|
15270
15270
|
<a href="/">Go home</a>
|
|
15271
15271
|
</div>
|
|
15272
15272
|
</body>
|
|
15273
|
-
</html>`)}for(let R of[500]){let N=G0.join(Y.pagesDir,`${R}.stx`);if(await Bun.file(N).exists()){let T=new Set,M={...Z,debug:!1,cache:!1},k=await O0(await Bun.file(N).text(),{},N,M,T);await Bun.write(G0.join(Y.outputDir,`${R}.html`),k)}}let F=G0.join(Y.pagesDir,"error.stx");if(await Bun.file(F).exists()){let R=new Set,N={...Z,debug:!1,cache:!1},T=await O0(await Bun.file(F).text(),{},F,N,R);await Bun.write(G0.join(Y.outputDir,"error.html"),T)}if(Y.sitemap&&L.length>0){let R=
|
|
15273
|
+
</html>`)}for(let R of[500]){let N=G0.join(Y.pagesDir,`${R}.stx`);if(await Bun.file(N).exists()){let T=new Set,M={...Z,debug:!1,cache:!1},k=await O0(await Bun.file(N).text(),{},N,M,T);await Bun.write(G0.join(Y.outputDir,`${R}.html`),k)}}let F=G0.join(Y.pagesDir,"error.stx");if(await Bun.file(F).exists()){let R=new Set,N={...Z,debug:!1,cache:!1},T=await O0(await Bun.file(F).text(),{},F,N,R);await Bun.write(G0.join(Y.outputDir,"error.html"),T)}if(Y.sitemap&&L.length>0){let R=hL(L,Y.domain),N=G0.join(Y.outputDir,"sitemap.xml");await Bun.write(N,R),G.sitemapPath=N,console.log(`Generated sitemap.xml with ${L.length} URLs`)}if(Y.robots!==!1){let R=typeof Y.robots==="object"?Y.robots:{},N=[...Y.sitemapExclude.filter((M)=>typeof M==="string"),...R.disallow||[]],T=WY({rules:[{userAgent:R.userAgent||"*",allow:R.allow||["/"],...N.length>0?{disallow:N}:{}}],...R.sitemap!==!1&&G.sitemapPath?{sitemap:new URL("/sitemap.xml",Y.domain).href}:{}});await Bun.write(G0.join(Y.outputDir,"robots.txt"),T),console.log("Generated robots.txt")}if(Y.rss){let R=typeof Y.rss==="object"?Y.rss:{title:"Site Feed",description:"Latest updates",link:Y.domain},N=[];if(R.getItems)N=await R.getItems();let T=uL(R,N),M=G0.join(Y.outputDir,"rss.xml");await Bun.write(M,T),G.rssPath=M,console.log(`Generated rss.xml with ${N.length} items`)}let V=q2(Y.outputDir);if(V.assets>0)console.log(`Externalized ${V.assets} asset(s) from ${V.pages} page(s) (${(V.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(Y.publicDir&&F0.existsSync(Y.publicDir))await Z2(Y.publicDir,Y.outputDir),console.log(`Copied public assets from ${Y.publicDir}`);let A=Q2();if(A)await Z2(A,G0.join(Y.outputDir,G2)),console.log(`Copied assets from ${O9}`)}catch(z){throw await Y.hooks.onError?.(z),z}if(G.buildTime=Date.now()-X,Q.size>0){G.islandChunks={count:Q.size,totalBytes:w};let z={generatedChunks:Q.size,totalBytes:w,chunks:q,pages:W};await Bun.write(G0.join(Y.outputDir,"_stx","islands-manifest.json"),JSON.stringify(z,null,2))}await Y.hooks.onBuildEnd?.(G);let K=G.islandChunks?`
|
|
15274
15274
|
Island chunks: ${G.islandChunks.count} (${(G.islandChunks.totalBytes/1024).toFixed(1)} KB lifted out of inline HTML)`:"";return console.log(`
|
|
15275
15275
|
Build complete!
|
|
15276
15276
|
Total: ${G.totalPages} pages
|
|
@@ -15278,8 +15278,8 @@ Build complete!
|
|
|
15278
15278
|
Cached: ${G.cachedCount}
|
|
15279
15279
|
Failed: ${G.failedCount}
|
|
15280
15280
|
Time: ${G.buildTime}ms${K}
|
|
15281
|
-
`),G}async function Z2($,X){await F0.promises.mkdir(X,{recursive:!0});let Z=await F0.promises.readdir($,{withFileTypes:!0});for(let J of Z){let Y=G0.join($,J.name),G=G0.join(X,J.name);if(J.isDirectory())await F0.promises.mkdir(G,{recursive:!0}),await Z2(Y,G);else await F0.promises.copyFile(Y,G)}}function
|
|
15282
|
-
`)){let z=K.indexOf(":");if(z>0){let U=K.slice(0,z).trim(),B=K.slice(z+1).trim();if(B==="true")B=!0;else if(B==="false")B=!1;else if(/^\d+$/.test(B))B=parseInt(B,10);else if(/^\d+\.\d+$/.test(B))B=parseFloat(B);else if(B.startsWith("[")&&B.endsWith("]"))B=B.slice(1,-1).split(",").map((j)=>j.trim().replace(/^['"]|['"]$/g,""));J[U]=B}}}let G=Y.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),Q=[],w=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,q;while((q=w.exec(G))!==null){let W=parseInt(q[1],10),K=q[2],z=K.toLowerCase().replace(/[^a-z0-9]+/g,"-");Q.push({id:z,text:K,level:W})}return{content:G,data:J,toc:Q}}}}function
|
|
15281
|
+
`),G}async function Z2($,X){await F0.promises.mkdir(X,{recursive:!0});let Z=await F0.promises.readdir($,{withFileTypes:!0});for(let J of Z){let Y=G0.join($,J.name),G=G0.join(X,J.name);if(J.isDirectory())await F0.promises.mkdir(G,{recursive:!0}),await Z2(Y,G);else await F0.promises.copyFile(Y,G)}}function mL($={}){let X=$.cacheDir||_1(process.cwd(),"ssg-cache"),Z=new kq(X),J=$.revalidate||3600;return{async get(Y){let G=await Z.get(Y);if(!G)return null;if(Date.now()>G.revalidateAfter)this.revalidate(Y).catch(console.error);return{html:G.html,headers:{"Cache-Control":`public, max-age=${J}, stale-while-revalidate=${J*2}`,ETag:G.etag,"X-ISR-Generated":new Date(G.generatedAt).toISOString(),...G.headers}}},async revalidate(Y){let Q=_7(".",{pagesDir:$.pagesDir||"pages"}).find((z)=>{return Y.match(z.regex)!==null});if(!Q){console.warn(`Route not found for revalidation: ${Y}`);return}let w=Y.match(Q.regex),q={};if(w)Q.params.forEach((z,U)=>{q[z]=w[U+1]});let W=await t0(),{html:K}=await Iq(Q,q,{},$,W);await Z.set(Y,{html:K,generatedAt:Date.now(),revalidateAfter:Date.now()+J*1000,etag:fL(K)}),console.log(`Revalidated: ${Y}`)},async invalidate(Y){if(typeof Y==="string")await Z.invalidate(Y);else await Z.invalidatePattern(Y)}}}function lL($){return async()=>{return{paths:await $(),fallback:!1}}}function cL(){return{name:"markdown",extensions:[".md",".mdx"],async load($){let X=await Bun.file($).text(),Z=X.match(/^---\n([\s\S]*?)\n---/),J={},Y=X;if(Z){let W=Z[1];Y=X.slice(Z[0].length).trim();for(let K of W.split(`
|
|
15282
|
+
`)){let z=K.indexOf(":");if(z>0){let U=K.slice(0,z).trim(),B=K.slice(z+1).trim();if(B==="true")B=!0;else if(B==="false")B=!1;else if(/^\d+$/.test(B))B=parseInt(B,10);else if(/^\d+\.\d+$/.test(B))B=parseFloat(B);else if(B.startsWith("[")&&B.endsWith("]"))B=B.slice(1,-1).split(",").map((j)=>j.trim().replace(/^['"]|['"]$/g,""));J[U]=B}}}let G=Y.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),Q=[],w=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,q;while((q=w.exec(G))!==null){let W=parseInt(q[1],10),K=q[2],z=K.toLowerCase().replace(/[^a-z0-9]+/g,"-");Q.push({id:z,text:K,level:W})}return{content:G,data:J,toc:Q}}}}function pL($){return m$($)}function iL($,X){return`<!DOCTYPE html>
|
|
15283
15283
|
<html>
|
|
15284
15284
|
<head>
|
|
15285
15285
|
<meta charset="utf-8">
|
|
@@ -15291,4 +15291,4 @@ Build complete!
|
|
|
15291
15291
|
<p>Redirecting to <a href="${$}">${$}</a>...</p>
|
|
15292
15292
|
<script>window.location.replace('${$}')</script>
|
|
15293
15293
|
</body>
|
|
15294
|
-
</html>`}function
|
|
15294
|
+
</html>`}function nL($,X){if($==="/"||$==="")return G0.join(X.outputDir,"index.html");let Z=$.replace(/^\/|\/$/g,"");if(X.trailingSlash)return G0.join(X.outputDir,Z,"index.html");return G0.join(X.outputDir,`${Z}.html`)}var xD={generateStaticSite:dL,createISRHandler:mL,defineStaticPaths:lL,createMarkdownLoader:cL};export{gL as isExcludedFromSitemap,dL as generateStaticSite,lL as defineStaticPaths,xD as default,vL as declaresPageAction,cL as createMarkdownLoader,mL as createISRHandler};
|