@stacksjs/stx 0.2.273 → 0.2.274
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/{chunk-kmj6hxen.js → chunk-30jz1ens.js} +1 -1
- package/dist/{chunk-e5ncpk9f.js → chunk-48yhwh4b.js} +8 -8
- package/dist/{chunk-980vbj13.js → chunk-4drmhqx2.js} +1 -1
- package/dist/{chunk-e7b2p0h4.js → chunk-4g93sqtn.js} +1 -1
- package/dist/{chunk-czsv3zcn.js → chunk-4xcpdp6k.js} +1 -1
- package/dist/{chunk-cdmnfb6q.js → chunk-4z55rsz6.js} +1 -1
- package/dist/{chunk-egbaw4bh.js → chunk-56w05c8k.js} +1 -1
- package/dist/{chunk-gwkxf766.js → chunk-689wa5cj.js} +1 -1
- package/dist/{chunk-rsr2m2hq.js → chunk-6hxqck1t.js} +1 -1
- package/dist/{chunk-8sg8tspq.js → chunk-7hghkqzt.js} +1 -1
- package/dist/{chunk-dw3c9zg3.js → chunk-8qvk5sna.js} +1 -1
- package/dist/{chunk-3cacp3v6.js → chunk-94jz7dpg.js} +1 -1
- package/dist/{chunk-sbppctqw.js → chunk-aehdyekj.js} +1 -1
- package/dist/{chunk-4c6wz64s.js → chunk-aqhnv526.js} +1 -1
- package/dist/{chunk-6pshqqjt.js → chunk-ayfbw3ke.js} +1 -1
- package/dist/{chunk-1eg447es.js → chunk-c3s5pez3.js} +1 -1
- package/dist/{chunk-ph0q97r5.js → chunk-c98tk6zv.js} +1 -1
- package/dist/{chunk-crkxdfsc.js → chunk-cp0dnekw.js} +1 -1
- package/dist/{chunk-edt2q2bp.js → chunk-cs20nm0r.js} +1 -1
- package/dist/{chunk-sj8887k1.js → chunk-cwg4czbe.js} +2 -2
- package/dist/{chunk-jjfet3b4.js → chunk-djzbg6pr.js} +1 -1
- package/dist/{chunk-z7yenntp.js → chunk-dry0kpjd.js} +1 -1
- package/dist/{chunk-eaqh53ea.js → chunk-e6a2gr2w.js} +1 -1
- package/dist/{chunk-m0n5rn6r.js → chunk-e88gqmtz.js} +1 -1
- package/dist/{chunk-av7n7vdr.js → chunk-eq8f3dwn.js} +1 -1
- package/dist/{chunk-wanmxrha.js → chunk-eqnwq9m0.js} +1 -1
- package/dist/{chunk-yapm6eaz.js → chunk-f68eb80q.js} +1 -1
- package/dist/{chunk-0vjgbyf7.js → chunk-f69mqf03.js} +17 -17
- package/dist/{chunk-yn1k391m.js → chunk-g6rfy2b9.js} +1 -1
- package/dist/{chunk-z7pzgevr.js → chunk-kpzy8wd7.js} +1 -1
- package/dist/{chunk-5cket5g3.js → chunk-kw05bztg.js} +2 -2
- package/dist/{chunk-zmm9fkte.js → chunk-mtk42c2k.js} +1 -1
- package/dist/{chunk-qv6cjn0k.js → chunk-ner93kgx.js} +1 -1
- package/dist/{chunk-b8mq8vaz.js → chunk-nsb6fcde.js} +1 -1
- package/dist/{chunk-qsty6qvn.js → chunk-r13htfx6.js} +1 -1
- package/dist/{chunk-2ymz6nrt.js → chunk-sevgcxxp.js} +1 -1
- package/dist/{chunk-h7fzgd2n.js → chunk-sfn4z72v.js} +1 -1
- package/dist/{chunk-jks6f8f5.js → chunk-twna1gqh.js} +1 -1
- package/dist/{chunk-75w11fde.js → chunk-vds4gmts.js} +1 -1
- package/dist/{chunk-tdcrah1x.js → chunk-vfdabmm2.js} +1 -1
- package/dist/{chunk-rda8tspf.js → chunk-vrx2rq5x.js} +1 -1
- package/dist/{chunk-hqpsxzxe.js → chunk-w6v7pwkn.js} +1 -1
- package/dist/{chunk-51qxyf3s.js → chunk-x25ppstj.js} +1 -1
- package/dist/{chunk-5z466wfw.js → chunk-yce1ntz9.js} +1 -1
- package/dist/{chunk-76258rpp.js → chunk-zzpsgq47.js} +1 -1
- package/dist/cli.js +8 -8
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/pwa.js +1 -1
- package/dist/signals.js +1 -1
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Rl as x,Sq as M}from"./chunk-
|
|
2
|
+
import{Rl as x,Sq as M}from"./chunk-f69mqf03.js";import"./chunk-1bwwtctk.js";import"./chunk-q9zsjgpf.js";import"./chunk-a6a9djpq.js";import"./chunk-txys90mf.js";import{Ts as B,Vs as P}from"./chunk-e6a2gr2w.js";import"./chunk-1spzqjve.js";import"./chunk-h45js0cg.js";import"./chunk-t7b39wwk.js";import"./chunk-w18t3nmy.js";import"./chunk-yvpagchj.js";import"./chunk-rhbq1var.js";import"./chunk-2c2z8n54.js";import"./chunk-71gwef4q.js";import G from"path";var T=["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"],O=new Set(T);var K=new Map,U=B(64),V=new Set,D=0,N=new Set(T);function f(){K.clear(),U.clear()}function S(H){let J=new Map;for(let Q of H){let Z=G.basename(Q);if(Z.endsWith(".d.ts"))continue;let z=Z.replace(/\.[jt]s$/,"");if(z==="index")continue;if(z===Z)continue;let X=J.get(z);if(X&&!X.endsWith(".js"))continue;J.set(z,Q)}return[...J.values()].sort()}function g(H,J){let Q=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Q}\\b`).test(H)}function y(H){if(!H)return[];let J=P(H,D),Q=U.get(J);if(Q)return Q.slice();let Z=H.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 X of N){if(V.has(X))continue;let A=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${A}\\s*\\(`).test(Z))z.push(X)}return z.sort(),U.set(J,z),z.slice()}async function p(H,J){let Q=y(H);if(Q.length===0)return null;let Z=J??G.join(import.meta.dir,"composables"),z=`${Z}\x00${Q.join(",")}`,X=K.get(z);if(X!==void 0)return X||null;let A=M({loader:"ts",target:"browser",define:x()}),L=new Set(Q),W=[],C=new Set,F=[];try{let q=new Bun.Glob("*.{ts,js}");for await(let j of q.scan({cwd:Z,absolute:!0}))F.push(j)}catch{return K.set(z,""),null}F=S(F);for(let q of F){let j;try{j=await Bun.file(q).text()}catch{continue}let I=[];try{I=A.scan(j).exports.filter(($)=>$!=="default")}catch{continue}if(!I.some(($)=>L.has($)))continue;try{j=j.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^import\s+type\s+.*$/gm,""),j=j.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),j=j.replace(/^export\s+default\s+/gm,""),j=j.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),W.push(`// ${G.basename(q).replace(/\.[jt]s$/,"")}
|
|
3
3
|
${A.transformSync(j).trim()}`);for(let $ of I)C.add($)}catch($){console.warn(`[stx] framework composable ${G.basename(q)} could not be bundled:`,$)}}let Y=Q.filter((q)=>!C.has(q)&&!g(H,q));if(Y.length>0)console.warn(`[stx] could not bundle ${Y.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(W.length===0)return K.set(z,""),null;let k=[...C].map((q)=>` try { if (!(${JSON.stringify(q)} in __s)) { __s[${JSON.stringify(q)}] = ${q}; if (!(${JSON.stringify(q)} in window)) window[${JSON.stringify(q)}] = ${q}; } } catch (e) {}`).join(`
|
|
4
4
|
`),w=`<script data-stx-framework-composables>
|
|
5
5
|
;(function(){
|
|
@@ -11,7 +11,7 @@ catch (e) {
|
|
|
11
11
|
}
|
|
12
12
|
throw e;
|
|
13
13
|
}
|
|
14
|
-
`),Z.set(X,V)}return V(...W)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:U,context:J.slice()});return U}clear(){this.pool.length=0,this.fnCache.clear()}}var pJ=new qJ;class UJ{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(Q){this.enabled=Q}isEnabled(){return this.enabled}setBudget(Q,J){this.budgets.set(Q,{warnThreshold:0.8,action:"warn",...J})}setBudgets(Q){for(let[J,Y]of Object.entries(Q))this.setBudget(J,Y)}removeBudget(Q){this.budgets.delete(Q)}getBudgets(){let Q={};for(let[J,Y]of this.budgets.entries())Q[J]=Y;return Q}onViolation(Q){this.violationHandlers.push(Q)}offViolation(Q){let J=this.violationHandlers.indexOf(Q);if(J!==-1)this.violationHandlers.splice(J,1)}time(Q,J){if(!this.enabled)return J();let Y=performance.now(),$=J(),Z=performance.now()-Y;return this.recordTime(Q,Z),this.checkBudget(Q,Z),$}async timeAsync(Q,J){if(!this.enabled)return J();let Y=performance.now(),$=await J(),Z=performance.now()-Y;return this.recordTime(Q,Z),this.checkBudget(Q,Z),$}checkBudget(Q,J){let Y=this.budgets.get(Q);if(!Y)return;let $=J/Y.maxTime*100,Z=Y.warnThreshold!==void 0?J>=Y.maxTime*Y.warnThreshold&&J<Y.maxTime:!1,q=J>=Y.maxTime;if(!Z&&!q)return;let U={label:Q,actualTime:J,budgetTime:Y.maxTime,exceedancePercent:$,timestamp:new Date,isWarning:Z};this.violations.push(U);while(this.violations.length>this.maxViolations)this.violations.shift();for(let G of this.violationHandlers)try{G(U)}catch{}let W=Z?`[Performance Warning] "${Q}" took ${J.toFixed(2)}ms (${$.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${Q}" took ${J.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${($-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(W);break;case"warn":console.warn(W);break;case"error":console.error(W);break;case"throw":if(q)throw Error(W);else console.warn(W);break}}recordTime(Q,J){let Y=this.metrics.get(Q);if(Y)Y.count++,Y.totalTime+=J,Y.maxTime=Math.max(Y.maxTime,J),Y.minTime=Math.min(Y.minTime,J);else this.metrics.set(Q,{count:1,totalTime:J,maxTime:J,minTime:J})}getStats(Q){if(Q){let Y=this.metrics.get(Q);if(!Y)return{};let $=this.budgets.get(Q);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:$?.maxTime,budgetUtilization:$?Y.totalTime/Y.count/$.maxTime*100:void 0}}let J={};for(let[Y,$]of this.metrics.entries()){let Z=this.budgets.get(Y);J[Y]={count:$.count,avgTime:$.totalTime/$.count,totalTime:$.totalTime,maxTime:$.maxTime,minTime:$.minTime,budget:Z?.maxTime,budgetUtilization:Z?$.totalTime/$.count/Z.maxTime*100:void 0}}return J}getViolations(Q){if(Q)return this.violations.filter((J)=>J.label===Q);return[...this.violations]}getViolationStats(){let Q={},J=0,Y=0;for(let $ of this.violations)if(Q[$.label]=(Q[$.label]||0)+1,$.isWarning)J++;else Y++;return{total:this.violations.length,byLabel:Q,warnings:J,errors:Y}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var h=null;function zJ(){if(!h)h=new UJ;return h}var gJ=new Proxy({},{get(Q,J){return zJ()[J]}});var WJ=[];function FJ(Q){let J=new c(Q);return WJ.push(J),J}function hJ(){for(let Q of WJ)Q.clear()}function i(Q,...J){return`${J.map((Y)=>String(Y??"")).join("\x00")}\x00${Q.length}\x00${Bun.hash(Q)}`}function cJ(Q){let J=[];for(let Y of new Set(Q))try{J.push({path:Y,mtimeMs:OJ.statSync(Y).mtimeMs})}catch{}return J}function iJ(Q){for(let J of Q)try{if(OJ.statSync(J.path).mtimeMs!==J.mtimeMs)return!1}catch{return!1}return!0}var L=null,n=!1,I=null,M="",K=!1,IJ=256,z=new Map,j=new Map,H=null,w=null;function k(Q){return Bun.hash(Q).toString(16).padStart(16,"0").slice(0,16)}function l(Q,J){if(z.has(Q))z.delete(Q);else if(z.size>=IJ)z.delete(z.keys().next().value);z.set(Q,J)}function HJ(Q){let J=k(Q);if(j.has(J))j.delete(J);else if(j.size>=IJ)j.delete(j.keys().next().value);return j.set(J,Q),J}function eJ(Q){let J=j.get(Q);if(J===void 0)return;return j.delete(Q),j.set(Q,J),J}async function TJ(Q){if(!H)return null;try{let J=Bun.file(O.join(H,`cw-${k(Q)}.css`));if(!await J.exists())return null;return await J.text()}catch{return null}}async function BJ(Q,J){if(!H)return;try{if(!fs.existsSync(H))fs.mkdirSync(H,{recursive:!0});await Bun.write(O.join(H,`cw-${k(Q)}.css`),J)}catch{}}async function GJ(Q){try{let J=await import(Q);if(J&&J.CSSGenerator)return{CSSGenerator:J.CSSGenerator,config:J.config,build:J.build,defaultConfig:J.defaultConfig,extractClasses:J.extractClasses}}catch{}return null}function KJ(){let Q=[],J=process.cwd();while(J!==O.dirname(J))Q.push(O.join(J,"node_modules","@cwcss","crosswind","dist","index.js")),Q.push(O.join(J,"node_modules","@cwcss","crosswind","src","index.ts")),Q.push(O.join(J,"pantry","@cwcss","crosswind","dist","index.js")),Q.push(O.join(J,"pantry","@cwcss","crosswind","src","index.ts")),Q.push(O.join(J,"node_modules","@stacksjs","crosswind","dist","index.js")),Q.push(O.join(J,"pantry","@stacksjs","crosswind","dist","index.js")),J=O.dirname(J);return Q}function RJ(){let Q=[],J=process.env.HOME||process.env.USERPROFILE||"";if(J){let Y=[O.join(J,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),O.join(J,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),O.join(J,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),O.join(J,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),O.join(J,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),O.join(J,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];Q.push(...Y)}return Q.push(O.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),Q.push(O.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),Q}async function XJ(){if(n)return L;n=!0;try{let Q=async(Z)=>{for(let q of Z){if(!await Bun.file(q).exists())continue;let U=await GJ(q);if(U){if(!process.env.STACKS_DEV_QUIET)console.log(`${F.green}[Crosswind]${F.reset} CSS engine loaded from ${O.dirname(O.dirname(q))}`);return U}}return null};if(process.env.CROSSWIND_SRC){let Z=O.resolve(process.env.CROSSWIND_SRC),q=await Q([Z]);if(!q)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${Z}`);return L=q,L}let J=await Q(KJ());if(J)return L=J,L;let Y=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Z of Y){let q=await GJ(Z);if(q){if(L=q,!process.env.STACKS_DEV_QUIET)console.log(`${F.green}[Crosswind]${F.reset} CSS engine loaded`);return L}}let $=await Q(RJ());if($)return L=$,L;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${F.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${F.reset}`),console.warn(`${F.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${F.reset}`),null}}function JQ(){x.clear(),z.clear(),j.clear()}function QQ(){x.clear(),L=null,n=!1,I=null,M="",z.clear(),j.clear(),w=null}async function VJ(Q){try{if(!AJ({name:"crosswind",cwd:Q}))return null;let{loadConfigWithResult:J}=await import("bunfig"),Y=await J({name:"crosswind",cwd:Q,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Y?.path||!Y.config||Object.keys(Y.config).length===0)return null;let $=O.relative(Q,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${F.green}[Crosswind]${F.reset} Loaded config from ${$||Y.path}`);return Y.config}catch(J){if(J instanceof Error&&J.name==="ConfigNotFoundError")return null;return console.warn(`${F.yellow}[Crosswind]${F.reset} Failed to load crosswind config:`,J instanceof Error?J.message:J),null}}async function PJ(Q){let J=null;try{let{loadStxConfig:Y}=await import("./chunk-dw3c9zg3.js"),$=await Y(Q);if($.css)if(typeof $.css==="string"){let Z=O.isAbsolute($.css)?$.css:O.resolve(Q,$.css);if(await Bun.file(Z).exists()){let q=await import(Z);J=q.default||q,console.log(`${F.green}[Crosswind]${F.reset} Loaded config from stx.config.ts \u2192 ${$.css}`)}}else{if(J={...$.css,content:$.css.content||[],preflight:$.css.preflight??!0,minify:$.css.minify??!1},$.css.config){let Z=O.isAbsolute($.css.config)?$.css.config:O.resolve(Q,$.css.config);if(await Bun.file(Z).exists()){let q=await import(Z);J={...q.default||q,...J}}}console.log(`${F.green}[Crosswind]${F.reset} Using inline CSS config from stx.config.ts`)}}catch{}return J||await VJ(Q)}function EJ(Q){try{let J=new WeakSet;return k(JSON.stringify(Q??{},(Y,$)=>{if(typeof $==="function")return`[fn]${String($)}`;if(typeof $==="object"&&$!==null){if(J.has($))return"[circular]";J.add($)}return $})??"")}catch{return"unhashable"}}async function DJ(Q){if(K)return M;K=!0;try{let J=await XJ();if(!J||!J.build)return K=!1,"";if(!I)I=await VJ(Q);if(!I)return K=!1,"";let Y=J.defaultConfig?.theme||{},$=I.theme||{},Z={...J.defaultConfig,...I,theme:{...Y,...$,extend:{...Y.extend||{},...$.extend||{}}}},q=performance.now(),U=await J.build(Z),W=performance.now()-q;if(M=U.css,console.log(`${F.cyan}[Crosswind]${F.reset} Built ${U.classes.size} classes in ${W.toFixed(1)}ms`),Z.output){let G=O.isAbsolute(Z.output)?Z.output:O.join(Q,Z.output),X=O.dirname(G);if(!fs.existsSync(X))fs.mkdirSync(X,{recursive:!0});await Bun.write(G,U.css)}return K=!1,U.css}catch(J){return console.error(`${F.red}[Crosswind]${F.reset} Build error:`,J),K=!1,M}}async function YQ(Q){I=null,await DJ(Q)}function $Q(){return M}function MJ(Q){let J=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,$=Y.exec(Q);while($!==null){for(let U of $[1].split(/\s+/))if(U.trim())J.add(U.trim());$=Y.exec(Q)}let Z=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,q=Z.exec(Q);while(q!==null){let U=q[1].match(/'([^']+)'/g);if(U){for(let W of U)for(let G of W.slice(1,-1).split(/\s+/))if(G.trim())J.add(G.trim())}q=Z.exec(Q)}return J}var x=FJ(64);async function wJ(Q,J){let Y=x.get(i(Q,J,w));if(Y!==void 0)return Y;let $=await SJ(Q,J);if($)x.set(i(Q,J,w),$);return $}async function SJ(Q,J){try{let Y=await XJ();if(!Y)return"";let $=typeof Y.extractClasses==="function"?Y.extractClasses(Q):MJ(Q);if($.size===0)return"";let Z=J?O.resolve(J):process.cwd();if(!H)H=jJ(Z,"cache");let q=[...$].sort().join(" "),U=`${w||"default"}::${q}`,W=z.get(U);if(W!==void 0)return l(U,W),W;let G=await TJ(U);if(G!==null)return l(U,G),G;if(!I)I=await PJ(Z),w=EJ(I);let X=Y.defaultConfig||Y.config,V=I||{},A=ZJ(X,V),{safelist:T,includePreflight:R,minify:b,tokenCSS:LJ}=A,o=A.config,P=new Y.CSSGenerator(o);for(let N of T)P.generate(N);for(let N of $)P.generate(N);let _=P.toCSS(R,b),r=o.shortcuts||V.shortcuts||{};for(let[N,y]of Object.entries(r)){if(!$.has(N)&&!T.includes(N))continue;let f=y.split(/\s+/).filter(Boolean);for(let D of f)P.generate(D)}_=P.toCSS(R,b);let E=_.split(`
|
|
14
|
+
`),Z.set(X,V)}return V(...W)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:U,context:J.slice()});return U}clear(){this.pool.length=0,this.fnCache.clear()}}var pJ=new qJ;class UJ{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(Q){this.enabled=Q}isEnabled(){return this.enabled}setBudget(Q,J){this.budgets.set(Q,{warnThreshold:0.8,action:"warn",...J})}setBudgets(Q){for(let[J,Y]of Object.entries(Q))this.setBudget(J,Y)}removeBudget(Q){this.budgets.delete(Q)}getBudgets(){let Q={};for(let[J,Y]of this.budgets.entries())Q[J]=Y;return Q}onViolation(Q){this.violationHandlers.push(Q)}offViolation(Q){let J=this.violationHandlers.indexOf(Q);if(J!==-1)this.violationHandlers.splice(J,1)}time(Q,J){if(!this.enabled)return J();let Y=performance.now(),$=J(),Z=performance.now()-Y;return this.recordTime(Q,Z),this.checkBudget(Q,Z),$}async timeAsync(Q,J){if(!this.enabled)return J();let Y=performance.now(),$=await J(),Z=performance.now()-Y;return this.recordTime(Q,Z),this.checkBudget(Q,Z),$}checkBudget(Q,J){let Y=this.budgets.get(Q);if(!Y)return;let $=J/Y.maxTime*100,Z=Y.warnThreshold!==void 0?J>=Y.maxTime*Y.warnThreshold&&J<Y.maxTime:!1,q=J>=Y.maxTime;if(!Z&&!q)return;let U={label:Q,actualTime:J,budgetTime:Y.maxTime,exceedancePercent:$,timestamp:new Date,isWarning:Z};this.violations.push(U);while(this.violations.length>this.maxViolations)this.violations.shift();for(let G of this.violationHandlers)try{G(U)}catch{}let W=Z?`[Performance Warning] "${Q}" took ${J.toFixed(2)}ms (${$.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${Q}" took ${J.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${($-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(W);break;case"warn":console.warn(W);break;case"error":console.error(W);break;case"throw":if(q)throw Error(W);else console.warn(W);break}}recordTime(Q,J){let Y=this.metrics.get(Q);if(Y)Y.count++,Y.totalTime+=J,Y.maxTime=Math.max(Y.maxTime,J),Y.minTime=Math.min(Y.minTime,J);else this.metrics.set(Q,{count:1,totalTime:J,maxTime:J,minTime:J})}getStats(Q){if(Q){let Y=this.metrics.get(Q);if(!Y)return{};let $=this.budgets.get(Q);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:$?.maxTime,budgetUtilization:$?Y.totalTime/Y.count/$.maxTime*100:void 0}}let J={};for(let[Y,$]of this.metrics.entries()){let Z=this.budgets.get(Y);J[Y]={count:$.count,avgTime:$.totalTime/$.count,totalTime:$.totalTime,maxTime:$.maxTime,minTime:$.minTime,budget:Z?.maxTime,budgetUtilization:Z?$.totalTime/$.count/Z.maxTime*100:void 0}}return J}getViolations(Q){if(Q)return this.violations.filter((J)=>J.label===Q);return[...this.violations]}getViolationStats(){let Q={},J=0,Y=0;for(let $ of this.violations)if(Q[$.label]=(Q[$.label]||0)+1,$.isWarning)J++;else Y++;return{total:this.violations.length,byLabel:Q,warnings:J,errors:Y}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var h=null;function zJ(){if(!h)h=new UJ;return h}var gJ=new Proxy({},{get(Q,J){return zJ()[J]}});var WJ=[];function FJ(Q){let J=new c(Q);return WJ.push(J),J}function hJ(){for(let Q of WJ)Q.clear()}function i(Q,...J){return`${J.map((Y)=>String(Y??"")).join("\x00")}\x00${Q.length}\x00${Bun.hash(Q)}`}function cJ(Q){let J=[];for(let Y of new Set(Q))try{J.push({path:Y,mtimeMs:OJ.statSync(Y).mtimeMs})}catch{}return J}function iJ(Q){for(let J of Q)try{if(OJ.statSync(J.path).mtimeMs!==J.mtimeMs)return!1}catch{return!1}return!0}var L=null,n=!1,I=null,M="",K=!1,IJ=256,z=new Map,j=new Map,H=null,w=null;function k(Q){return Bun.hash(Q).toString(16).padStart(16,"0").slice(0,16)}function l(Q,J){if(z.has(Q))z.delete(Q);else if(z.size>=IJ)z.delete(z.keys().next().value);z.set(Q,J)}function HJ(Q){let J=k(Q);if(j.has(J))j.delete(J);else if(j.size>=IJ)j.delete(j.keys().next().value);return j.set(J,Q),J}function eJ(Q){let J=j.get(Q);if(J===void 0)return;return j.delete(Q),j.set(Q,J),J}async function TJ(Q){if(!H)return null;try{let J=Bun.file(O.join(H,`cw-${k(Q)}.css`));if(!await J.exists())return null;return await J.text()}catch{return null}}async function BJ(Q,J){if(!H)return;try{if(!fs.existsSync(H))fs.mkdirSync(H,{recursive:!0});await Bun.write(O.join(H,`cw-${k(Q)}.css`),J)}catch{}}async function GJ(Q){try{let J=await import(Q);if(J&&J.CSSGenerator)return{CSSGenerator:J.CSSGenerator,config:J.config,build:J.build,defaultConfig:J.defaultConfig,extractClasses:J.extractClasses}}catch{}return null}function KJ(){let Q=[],J=process.cwd();while(J!==O.dirname(J))Q.push(O.join(J,"node_modules","@cwcss","crosswind","dist","index.js")),Q.push(O.join(J,"node_modules","@cwcss","crosswind","src","index.ts")),Q.push(O.join(J,"pantry","@cwcss","crosswind","dist","index.js")),Q.push(O.join(J,"pantry","@cwcss","crosswind","src","index.ts")),Q.push(O.join(J,"node_modules","@stacksjs","crosswind","dist","index.js")),Q.push(O.join(J,"pantry","@stacksjs","crosswind","dist","index.js")),J=O.dirname(J);return Q}function RJ(){let Q=[],J=process.env.HOME||process.env.USERPROFILE||"";if(J){let Y=[O.join(J,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),O.join(J,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),O.join(J,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),O.join(J,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),O.join(J,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),O.join(J,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];Q.push(...Y)}return Q.push(O.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),Q.push(O.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),Q}async function XJ(){if(n)return L;n=!0;try{let Q=async(Z)=>{for(let q of Z){if(!await Bun.file(q).exists())continue;let U=await GJ(q);if(U){if(!process.env.STACKS_DEV_QUIET)console.log(`${F.green}[Crosswind]${F.reset} CSS engine loaded from ${O.dirname(O.dirname(q))}`);return U}}return null};if(process.env.CROSSWIND_SRC){let Z=O.resolve(process.env.CROSSWIND_SRC),q=await Q([Z]);if(!q)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${Z}`);return L=q,L}let J=await Q(KJ());if(J)return L=J,L;let Y=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Z of Y){let q=await GJ(Z);if(q){if(L=q,!process.env.STACKS_DEV_QUIET)console.log(`${F.green}[Crosswind]${F.reset} CSS engine loaded`);return L}}let $=await Q(RJ());if($)return L=$,L;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${F.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${F.reset}`),console.warn(`${F.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${F.reset}`),null}}function JQ(){x.clear(),z.clear(),j.clear()}function QQ(){x.clear(),L=null,n=!1,I=null,M="",z.clear(),j.clear(),w=null}async function VJ(Q){try{if(!AJ({name:"crosswind",cwd:Q}))return null;let{loadConfigWithResult:J}=await import("bunfig"),Y=await J({name:"crosswind",cwd:Q,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Y?.path||!Y.config||Object.keys(Y.config).length===0)return null;let $=O.relative(Q,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${F.green}[Crosswind]${F.reset} Loaded config from ${$||Y.path}`);return Y.config}catch(J){if(J instanceof Error&&J.name==="ConfigNotFoundError")return null;return console.warn(`${F.yellow}[Crosswind]${F.reset} Failed to load crosswind config:`,J instanceof Error?J.message:J),null}}async function PJ(Q){let J=null;try{let{loadStxConfig:Y}=await import("./chunk-8qvk5sna.js"),$=await Y(Q);if($.css)if(typeof $.css==="string"){let Z=O.isAbsolute($.css)?$.css:O.resolve(Q,$.css);if(await Bun.file(Z).exists()){let q=await import(Z);J=q.default||q,console.log(`${F.green}[Crosswind]${F.reset} Loaded config from stx.config.ts \u2192 ${$.css}`)}}else{if(J={...$.css,content:$.css.content||[],preflight:$.css.preflight??!0,minify:$.css.minify??!1},$.css.config){let Z=O.isAbsolute($.css.config)?$.css.config:O.resolve(Q,$.css.config);if(await Bun.file(Z).exists()){let q=await import(Z);J={...q.default||q,...J}}}console.log(`${F.green}[Crosswind]${F.reset} Using inline CSS config from stx.config.ts`)}}catch{}return J||await VJ(Q)}function EJ(Q){try{let J=new WeakSet;return k(JSON.stringify(Q??{},(Y,$)=>{if(typeof $==="function")return`[fn]${String($)}`;if(typeof $==="object"&&$!==null){if(J.has($))return"[circular]";J.add($)}return $})??"")}catch{return"unhashable"}}async function DJ(Q){if(K)return M;K=!0;try{let J=await XJ();if(!J||!J.build)return K=!1,"";if(!I)I=await VJ(Q);if(!I)return K=!1,"";let Y=J.defaultConfig?.theme||{},$=I.theme||{},Z={...J.defaultConfig,...I,theme:{...Y,...$,extend:{...Y.extend||{},...$.extend||{}}}},q=performance.now(),U=await J.build(Z),W=performance.now()-q;if(M=U.css,console.log(`${F.cyan}[Crosswind]${F.reset} Built ${U.classes.size} classes in ${W.toFixed(1)}ms`),Z.output){let G=O.isAbsolute(Z.output)?Z.output:O.join(Q,Z.output),X=O.dirname(G);if(!fs.existsSync(X))fs.mkdirSync(X,{recursive:!0});await Bun.write(G,U.css)}return K=!1,U.css}catch(J){return console.error(`${F.red}[Crosswind]${F.reset} Build error:`,J),K=!1,M}}async function YQ(Q){I=null,await DJ(Q)}function $Q(){return M}function MJ(Q){let J=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,$=Y.exec(Q);while($!==null){for(let U of $[1].split(/\s+/))if(U.trim())J.add(U.trim());$=Y.exec(Q)}let Z=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,q=Z.exec(Q);while(q!==null){let U=q[1].match(/'([^']+)'/g);if(U){for(let W of U)for(let G of W.slice(1,-1).split(/\s+/))if(G.trim())J.add(G.trim())}q=Z.exec(Q)}return J}var x=FJ(64);async function wJ(Q,J){let Y=x.get(i(Q,J,w));if(Y!==void 0)return Y;let $=await SJ(Q,J);if($)x.set(i(Q,J,w),$);return $}async function SJ(Q,J){try{let Y=await XJ();if(!Y)return"";let $=typeof Y.extractClasses==="function"?Y.extractClasses(Q):MJ(Q);if($.size===0)return"";let Z=J?O.resolve(J):process.cwd();if(!H)H=jJ(Z,"cache");let q=[...$].sort().join(" "),U=`${w||"default"}::${q}`,W=z.get(U);if(W!==void 0)return l(U,W),W;let G=await TJ(U);if(G!==null)return l(U,G),G;if(!I)I=await PJ(Z),w=EJ(I);let X=Y.defaultConfig||Y.config,V=I||{},A=ZJ(X,V),{safelist:T,includePreflight:R,minify:b,tokenCSS:LJ}=A,o=A.config,P=new Y.CSSGenerator(o);for(let N of T)P.generate(N);for(let N of $)P.generate(N);let _=P.toCSS(R,b),r=o.shortcuts||V.shortcuts||{};for(let[N,y]of Object.entries(r)){if(!$.has(N)&&!T.includes(N))continue;let f=y.split(/\s+/).filter(Boolean);for(let D of f)P.generate(D)}_=P.toCSS(R,b);let E=_.split(`
|
|
15
15
|
`);for(let[N,y]of Object.entries(r)){if(!$.has(N)&&!T.includes(N))continue;let f=y.split(/\s+/).filter(Boolean),D=[],C=[];for(let p of f){let a=p.startsWith("dark:"),s=`.${(a?p.slice(5):p).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let S=0;S<E.length;S++){let t=E[S].trim();if(t===`${s} {`||t.startsWith(`${s} {`)){let v=S,e="";while(v<E.length){if(e+=E[v],E[v].includes("}"))break;v++}let g=e.match(/\{([^}]+)\}/);if(g)if(a)C.push(g[1].trim());else D.push(g[1].trim());break}}}if(D.length)_+=`
|
|
16
16
|
.${N} { ${D.join(" ")} }`;if(C.length)_+=`
|
|
17
17
|
@media (prefers-color-scheme: dark) { .dark .${N} { ${C.join(" ")} } }`}return _=LJ+_,l(U,_),BJ(U,_),_}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function ZQ(Q,J,Y=!1){let $=await wJ(Q,J);if(!$)return Q;let Z=Y?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${HJ($)}.css">`:`<style data-crosswind="generated">
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{bm as F,em as V,sm as I}from"./chunk-
|
|
2
|
+
import{bm as F,em as V,sm as I}from"./chunk-f69mqf03.js";function R(j,W){let U=1,z=W,G="<template",X="</template";while(z<j.length&&U>0){let J=j.indexOf("<",z);if(J===-1)break;if(z=J,j.startsWith(G,z)&&(z+G.length>=j.length||/[\s>\/]/.test(j[z+G.length]))){U++,z+=G.length;continue}if(j.startsWith(X,z)){let Y=j.indexOf(">",z+X.length);if(Y!==-1){if(U--,U===0)return Y+1;z=Y+1;continue}}z++}return U===0?z:-1}var P=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function D(j,W){let U=null;for(let z=W;z<j.length;z++){let G=j[z];if(U){if(G==="\\"){z++;continue}if(G===U)U=null;continue}if(G==='"'||G==="'"){U=G;continue}if(G===">")return z+1}return-1}function b(j){let W=[],U=[],z=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,G=0;while(G<j.length){let X=j.indexOf("<",G);if(X===-1)break;if(j.startsWith("<!--",X)){let $=j.indexOf("-->",X+4);G=$===-1?j.length:$+3;continue}let J=D(j,X+1);if(J===-1)break;let Y=j.slice(X,J),Q=Y.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!Q){G=J;continue}let Z=Q[1]==="/",H=Q[2].toLowerCase();if(Z){let $=U.lastIndexOf(H);if($!==-1)U.splice($);G=J;continue}if(H==="template"&&U.length===0){let $=Y.match(z);if($){let K=R(j,J);if(K!==-1){let O=$[1]||$[2]||$[3];W.push({start:X,end:K,slotName:O,content:j.slice(J,K-11).trim(),propsBinding:$[4]||void 0}),G=K;continue}}}if(!/\/\s*>$/.test(Y)&&!P.has(H)){if(U.push(H),H==="script"||H==="style"){let $=j.toLowerCase().indexOf(`</${H}>`,J);if($!==-1){G=$;continue}}}G=J}return W}function w(j){let W={default:"",named:new Map},U=j,z=b(j);for(let Q of z)W.named.set(Q.slotName,{name:Q.slotName,content:Q.content,propsBinding:Q.propsBinding});z.sort((Q,Z)=>Z.start-Q.start);for(let Q of z)U=U.slice(0,Q.start)+U.slice(Q.end);let G=[],X=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,J;while((J=X.exec(U))!==null){let[Q,Z,H,_,$,K]=J,O=H.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),B=$.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=(O+B).trim(),q=`<${Z}${L?" "+L:""}>${K}</${Z}>`;G.push({start:J.index,end:J.index+Q.length,slotName:_,element:q})}let Y=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((J=Y.exec(U))!==null){let[Q,Z,H,_,$]=J,K=H.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),O=$.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),B=(K+O).trim(),L=`<${Z}${B?" "+B:""} />`;G.push({start:J.index,end:J.index+Q.length,slotName:_,element:L})}G.sort((Q,Z)=>Z.start-Q.start);for(let Q of G){let Z=W.named.get(Q.slotName);if(Z)Z.content+=Q.element;else W.named.set(Q.slotName,{name:Q.slotName,content:Q.element});U=U.slice(0,Q.start)+U.slice(Q.end)}return W.default=U.trim(),W}function C(j){let W=j.match(/name\s*=\s*["']([^"']+)["']/),U=W?W[1]:"",z={},G=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,X;while((X=G.exec(j))!==null)z[X[1]]=X[2];let J=j.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),Y=J?J[1].trim():"";return{name:U,props:z,defaultContent:Y}}async function N(j,W,U,z){if(!j)return U;let G=j.content;if(j.propsBinding&&Object.keys(W).length>0){let X=j.propsBinding.trim(),J={...z};if(X.startsWith("{")&&X.endsWith("}")){let Y=X.slice(1,-1).split(",").map((Q)=>Q.trim()).filter(Boolean);for(let Q of Y){let[Z,H]=Q.split(":").map(($)=>$.trim()),_=H||Z;if(W[Z]!==void 0)J[_]=W[Z]}}else J[X]=W;G=k(G,J)}return G}function k(j,W){return j.replace(/\{\{\s*([^}]+)\s*\}\}/g,(U,z)=>{try{let G=z.trim(),X=y(G,W);return I(String(X??""))}catch{return`{{ ${z} }}`}})}function y(j,W){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(j)){let z=j.split("."),G=W;for(let X of z)if(G&&typeof G==="object"&&X in G)G=G[X];else return;return G}let U=j.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(U){let[,z,G,X]=U,J=W[z],Y=parseInt(X,10);if(typeof J==="number")switch(G){case"+":return J+Y;case"-":return J-Y;case"*":return J*Y;case"/":return J/Y}}try{if(!F(j))return;return V(j,Object.keys(W))(...Object.values(W))}catch{return}}async function A(j,W,U){let z=j;z=await v(z,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(J,Y,Q,Z)=>{let H=W.named.get(Y),_=Z?.trim()||"",$=Q||"",K={},O=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,B;while((B=O.exec($))!==null){let L=B[1],q=B[2];K[L]=y(q,U)}return await N(H,K,_,U)});let X=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return z=z.replace(X,(J,Y)=>{if(J.includes("name="))return J;let Q=Y?.trim()||"";return W.default||Q}),z}async function v(j,W,U){let z=[],G=[];j.replace(W,(Y,...Q)=>{let Z=Q[Q.length-2];return G.push({match:Y,index:Z}),z.push(U(Y,...Q.slice(0,-2))),Y});let X=await Promise.all(z),J=j;for(let Y=G.length-1;Y>=0;Y--){let{match:Q,index:Z}=G[Y];J=J.slice(0,Z)+X[Y]+J.slice(Z+Q.length)}return J}function E(j){let W=w(j);return{defaultSlot:W.default,namedSlots:W.named}}async function M(j,W,U,z){return await A(j,{default:W,named:U},z)}
|
|
3
3
|
export{w as Eh,C as Fh,N as Gh,A as Hh,E as Ih,M as Jh};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Kq as X,ym as W}from"./chunk-
|
|
2
|
+
import{Kq as X,ym as W}from"./chunk-f69mqf03.js";import V from"fs";import M from"path";import*as Y from"readline";var j={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},Q={help:{description:"Show available commands",usage:"help [command]",handler:async(q,z)=>{if(q[0]&&Q[q[0]]){let A=Q[q[0]];console.log(`
|
|
3
3
|
${j.bold}${q[0]}${j.reset} - ${A.description}`),console.log(` Usage: ${j.cyan}${A.usage}${j.reset}
|
|
4
4
|
`)}else{console.log(`
|
|
5
5
|
${j.bold}Available Commands:${j.reset}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{dm as a,dp as b,ep as c}from"./chunk-
|
|
2
|
+
import{dm as a,dp as b,ep as c}from"./chunk-f69mqf03.js";import"./chunk-1bwwtctk.js";import"./chunk-q9zsjgpf.js";import"./chunk-a6a9djpq.js";import"./chunk-txys90mf.js";import"./chunk-e6a2gr2w.js";import"./chunk-1spzqjve.js";import"./chunk-h45js0cg.js";import"./chunk-t7b39wwk.js";import"./chunk-w18t3nmy.js";import"./chunk-yvpagchj.js";import"./chunk-rhbq1var.js";import"./chunk-2c2z8n54.js";import"./chunk-71gwef4q.js";export{b as processESImports,c as processComponents,a as freeIdentifiers};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ap as f,Bp as g,Cp as h,Dp as i,Ep as j,vp as a,wp as b,xp as c,yp as d,zp as e}from"./chunk-
|
|
2
|
+
import{Ap as f,Bp as g,Cp as h,Dp as i,Ep as j,vp as a,wp as b,xp as c,yp as d,zp as e}from"./chunk-f69mqf03.js";import"./chunk-1bwwtctk.js";import"./chunk-q9zsjgpf.js";import"./chunk-a6a9djpq.js";import"./chunk-txys90mf.js";import"./chunk-e6a2gr2w.js";import"./chunk-1spzqjve.js";import"./chunk-h45js0cg.js";import"./chunk-t7b39wwk.js";import"./chunk-w18t3nmy.js";import"./chunk-yvpagchj.js";import"./chunk-rhbq1var.js";import"./chunk-2c2z8n54.js";import"./chunk-71gwef4q.js";export{b as stripTypeScript,h as splitDeclaration,c as isModuleResolutionFailure,d as isMissingBindingFailure,f as isCompleteImport,j as hasVariables,e as extractVariables,i as extractScriptFromTemplate,g as convertToCommonJS,a as STX_ENGINE_BINDING_NAMES};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{As as S6,Bs as C6,qs as j2}from"./chunk-1bwwtctk.js";import{Hs as t5}from"./chunk-q9zsjgpf.js";import{Ps as c0}from"./chunk-txys90mf.js";import{Qs as p1,Rs as m1,Ss as _2,Ts as G5,Vs as b1,Ws as v2,Xs as f2,lt as V2}from"./chunk-
|
|
2
|
+
import{As as S6,Bs as C6,qs as j2}from"./chunk-1bwwtctk.js";import{Hs as t5}from"./chunk-q9zsjgpf.js";import{Ps as c0}from"./chunk-txys90mf.js";import{Qs as p1,Rs as m1,Ss as _2,Ts as G5,Vs as b1,Ws as v2,Xs as f2,lt as V2}from"./chunk-e6a2gr2w.js";import{mt as P6,ot as v6,pt as f6,rt as L5}from"./chunk-1spzqjve.js";import{st as v8}from"./chunk-h45js0cg.js";import{Bt as k2,vt as O2,zt as G$}from"./chunk-t7b39wwk.js";import{Mt as F2}from"./chunk-w18t3nmy.js";import{$t as $2,Nt as w7,Ot as d2,Pt as P2,Qt as c1,Ut as m2,Vt as t4,Wt as D8,Yt as P9}from"./chunk-yvpagchj.js";import{Ku as B2,Mu as dG,Nu as X3,Pu as j5,ju as K4,mu as K8,tu as $4}from"./chunk-rhbq1var.js";import{Uu as x6}from"./chunk-2c2z8n54.js";import{Zu as x}from"./chunk-71gwef4q.js";import S1 from"path";import S5 from"fs";var o4=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),r4={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},s2=new Set(["ctrl","alt","shift","meta"]),e4={left:0,middle:1,right:2};function a4($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let X of $){let J=X.toLowerCase();if(J==="prevent")Z.prevent=!0;else if(J==="stop")Z.stop=!0;else if(J==="once")Z.once=!0;else if(J==="capture")Z.capture=!0;else if(J==="self")Z.self=!0;else if(J==="passive")Z.passive=!0;else if(s2.has(J))Z.systemKeys.push(J);else if(J in e4)Z.mouse=J;else if(J in r4||/^[a-z]$/.test(J))Z.keys.push(r4[J]||J.toUpperCase());else if(J.startsWith("debounce")){let Y=J.match(/debounce(?:\.(\d+))?/);Z.debounce=Y?.[1]?Number.parseInt(Y[1],10):300}else if(J.startsWith("throttle")){let Y=J.match(/throttle(?:\.(\d+))?/);Z.throttle=Y?.[1]?Number.parseInt(Y[1],10):300}}return Z}function $7($){let Z=[],X=0,J=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Y;while((Y=J.exec($))!==null){let[Q,G,q]=Y,W=Y.index,K=W+Q.length,U=`__stx_evt_${X++}`,z=[],H=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,j;while((j=H.exec(q))!==null){let[,_,L]=j,V=_.split("."),O=V[0];if(!o4.has(O))continue;z.push({attribute:`@${_}`,event:O,handler:L,modifiers:a4(V.slice(1)),elementId:U})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((j=B.exec(q))!==null){let[,_,L]=j,V=_.split("."),O=V[0];if(!o4.has(O))continue;z.push({attribute:`@${_}`,event:O,handler:L,modifiers:a4(V.slice(1)),elementId:U})}if(z.length>0)Z.push({originalTag:Q,elementId:U,events:z,startIndex:W,endIndex:K})}return Z}function o2($){let Z=[],{modifiers:X}=$;if(X.self)Z.push("if ($event.target !== $el) return");for(let J of X.systemKeys)Z.push(`if (!$event.${J}Key) return`);if(X.keys.length>0){let J=X.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");Z.push(`if (!(${J})) return`)}if(X.mouse!==null){let J=e4[X.mouse];Z.push(`if ($event.button !== ${J}) return`)}if(X.prevent)Z.push("$event.preventDefault()");if(X.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function r2($,Z){let X=$;if(Z.debounce!==null)X=`__stx_debounce(() => { ${X} }, ${Z.debounce})`;else if(Z.throttle!==null)X=`__stx_throttle(() => { ${X} }, ${Z.throttle})`;return X}function m$($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function a2($){let{modifiers:Z}=$,X=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=o2($),Y=r2(m$($.handler),Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(Z.passive)Q.push("passive: true");let G=Q.length>0?`, { ${Q.join(", ")} }`:"",q=Y.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
|
|
3
3
|
(function() {
|
|
4
4
|
var $el = document.getElementById('${X}');
|
|
5
5
|
if (!$el) return;
|
|
@@ -3352,9 +3352,9 @@ ${j9($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
|
|
|
3352
3352
|
} finally {
|
|
3353
3353
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
3354
3354
|
}
|
|
3355
|
-
})();`}function PY($,Z){if(q1($)){let Y=q1($).tag.match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0};return{html:v1($,(Q,G)=>`<body${G} data-stx-scope="${Z}">`),mergedIntoExisting:null,stamped:!0}}let X=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(X){let Y=(X[2]+X[3]).match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0};let Q=X[1],G=X[2],q=X[3];return{html:`${Q}${G} data-stx-scope="${Z}"${q}${$.slice(X[0].length)}`,mergedIntoExisting:null,stamped:!0}}return{html:$,mergedIntoExisting:null,stamped:!1}}var H9=0,FH=new p1(500),V9=new Set;function LH(){V9.clear()}function vY($){if($.__onceStore instanceof Set)return $.__onceStore;return V9}async function r3($,Z,X,J,Y,Q=new Set){let G=J.partialsDir||z0.join(z0.dirname(X),"partials");if(G&&!z0.isAbsolute(G))G=z0.resolve(process.cwd(),G);let q=yY($,"@partial","@include"),W=vY(Z);q=q.replace(/@once([\s\S]*?)@endonce/g,(_,L,V)=>{let O=L.trim(),F=`${X}:${O}`;if(W.has(F))return"";return W.add(F),L});{let _=/@includeIf\s*\(/g,L;while((L=_.exec(q))!==null){let V=L.index,O=V+L[0].length-1,F=1,w=O+1;while(w<q.length&&F>0){if(q[w]==="(")F++;else if(q[w]===")")F--;w++}if(F!==0)break;let R=q.substring(O+1,w-1),D=R.match(/^\s*['"]([^'"]+)['"]/);if(!D){_.lastIndex=w;continue}let A=D[1],k=K(A,G,X),N="";if(k&&await Bun.file(k).exists())Y.add(k),N=`@include(${R})`;q=q.substring(0,V)+N+q.substring(w),_.lastIndex=0}}for(let[_,L]of[["@includeWhen",!1],["@includeUnless",!0]]){let V=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),O;while((O=V.exec(q))!==null){let F=O.index,w=F+O[0].length-1,R=1,D=w+1;while(D<q.length&&R>0){if(q[D]==="(")R++;else if(q[D]===")")R--;D++}if(R!==0)break;let A=q.substring(w+1,D-1),k=o3(A,0);if(k===-1){V.lastIndex=D;continue}let N=A.substring(0,k).trim(),M=A.substring(k+1).trim(),T=M.match(/^\s*['"]([^'"]+)['"]/);if(!T){V.lastIndex=D;continue}let I=T[1],C=M.substring(T[0].length),E,b=o3(C,0);if(b!==-1)E=C.substring(b+1).trim();try{let y=`Boolean(${N})`,P;if(q0(y)){let g=W0(y,Object.keys(Z));P=Boolean(g(...Object.values(Z)))}else P=Boolean(e(y,Z));let f=L?!P:P,d="";if(f){let g=K(I,G,X);if(g&&await Bun.file(g).exists())Y.add(g);d=`@include('${I}'${E?`, ${E}`:""})`}q=q.substring(0,F)+d+q.substring(D),V.lastIndex=0}catch(y){let P=y instanceof Error?y.message:String(y),f=j0("Include",`Error evaluating ${_} condition: ${P}`,X,$,F);q=q.substring(0,F)+f+q.substring(D),V.lastIndex=0}}}{let _=/@each\s*\(/g,L;while((L=_.exec(q))!==null){let V=L.index,O=V+L[0].length-1,F=1,w=O+1;while(w<q.length&&F>0){if(q[w]==="(")F++;else if(q[w]===")"){if(F--,F===0)break}w++}if(F!==0)break;let R=q.substring(O+1,w),D=q.substring(V,w+1),A=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!A){_.lastIndex=0,q=q.replace(D,"");continue}let[,k,N,M,T]=A;try{let I,C=N.trim();if(q0(C))I=W0(C,Object.keys(Z))(...Object.values(Z));else I=e(C,Z);let E="";if(Array.isArray(I)&&I.length>0)for(let b of I){let y={...Z,[M]:b},P=await H(k,y,$,V);E+=P}else if(T)E=await H(T,{},$,V);q=q.substring(0,V)+E+q.substring(w+1),_.lastIndex=0}catch(I){let C=I instanceof Error?I.message:String(I);q=q.substring(0,V)+j0("Each",`Error in @each: ${C}`,X,$,V)+q.substring(w+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,L;while((L=_.exec(q))!==null){let V=L.index,O=V+L[0].length-1,F=1,w=O+1;while(w<q.length&&F>0){if(q[w]==="(")F++;else if(q[w]===")"){if(F--,F===0)break}w++}if(F!==0)break;let R=q.substring(O+1,w),D=q.substring(V,w+1),A=R.match(/^\s*(\[[^\]]+\])/);if(!A){_.lastIndex=0,q=q.replace(D,"");continue}let k=A[1],N=R.slice(A[0].length),M,T=N.match(/^\s*,\s*\{/);if(T){N=N.slice(T[0].length-1);let E=1,b=1;while(b<N.length&&E>0){if(N[b]==="{")E++;else if(N[b]==="}"){if(E--,E===0)break}b++}M=N.substring(0,b+1),N=N.slice(b+1)}let I,C=N.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(C)I=C[1];try{let E=JSON.parse(k.replace(/'/g,'"')),b={};if(M)try{b=R0(M,Z)}catch(P){let f=P instanceof Error?P.message:String(P);if(J.debug){let d=j0("Include",`Error parsing includeFirst variables: ${f}`,X,$,V,D);q=q.replace(D,()=>d)}else q=q.replace(D,()=>I||"");continue}let y=!1;for(let P of E){let f=K(P,G,X);if(!f)continue;if(await t(f)){let d=await H(P,b,$,V);q=q.replace(D,()=>d),y=!0;break}}if(!y)if(I!==void 0)q=q.replace(D,()=>I);else if(J.debug){let P=j0("Include",`None of the includeFirst paths exist: ${k}`,X,$,V,D);q=q.replace(D,()=>P)}else q=q.replace(D,"")}catch(E){let b=E instanceof Error?E.message:String(E),y=j0("Include",`Error processing @includeFirst: ${b}`,X,$,V,D);q=q.replace(D,()=>y)}_.lastIndex=0}}function K(_,L,V){try{let O=_;if(!_.endsWith(".stx"))O=`${_}.stx`;let F=z0.resolve(L),w=z0.resolve(z0.dirname(V)),R;if(!O.startsWith("./")&&!O.startsWith("../"))R=z0.resolve(L,O);else R=z0.resolve(w,O);let D=z0.normalize(R),A=D.startsWith(F+z0.sep)||D===F,k=D.startsWith(w+z0.sep)||D===w,N=!1,M=z0.dirname(w);if(D.startsWith(M+z0.sep)){if(!z0.relative(M,D).split(z0.sep).some((E)=>E.startsWith(".")&&E!=="."&&E!==".."))N=!0}if(!A&&!k&&!N)return console.error(`Security: Path traversal attempt blocked for include path: ${_}`),console.error(` Resolved to: ${D}`),console.error(` Allowed dirs: ${F}, ${w}`),null;return D}catch(O){return console.error(`Error resolving path ${_}: ${O}`),null}}let U=z0.resolve(X);Q.add(U);function z(_,L,V,O){return J.onIncludeError?.({includePath:_,templatePath:X,message:L,partialsDir:G}),j0("Include",L,X,V,O)}async function H(_,L={},V,O){let F=K(_,G,X);if(!F)return z(_,`Could not resolve path for include: ${_}`,V,O);let w=z0.resolve(F);if(Q.has(w)){let R=[...Q,w].map((D)=>z0.basename(D)).join(" -> ");return z(_,`Circular include detected: ${R}`,V,O)}try{Y.add(F);let R;if(!R)try{R=await Bun.file(F).text()}catch(f){let d=f instanceof Error?f.message:String(f);return z(_,`Error loading include file ${_}: ${d}`,V,O)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:f}=await import("./chunk-
|
|
3356
|
-
`;continue}if(Q0)try{let{extractVariables:X0}=await import("./chunk-
|
|
3357
|
-
`}}if(b){let f=PY(D,b);if(D=f.html,f.mergedIntoExisting)E=E.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${f.mergedIntoExisting}']`),b=f.mergedIntoExisting;else if(!f.stamped)console.warn(`[stx] ${z0.relative(process.cwd(),F)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`)}if(D.includes("@include")||D.includes("@partial"))D=await r3(D,T,F,J,Y,Q);let{processLoops:y}=await import("./chunk-
|
|
3355
|
+
})();`}function PY($,Z){if(q1($)){let Y=q1($).tag.match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0};return{html:v1($,(Q,G)=>`<body${G} data-stx-scope="${Z}">`),mergedIntoExisting:null,stamped:!0}}let X=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(X){let Y=(X[2]+X[3]).match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0};let Q=X[1],G=X[2],q=X[3];return{html:`${Q}${G} data-stx-scope="${Z}"${q}${$.slice(X[0].length)}`,mergedIntoExisting:null,stamped:!0}}return{html:$,mergedIntoExisting:null,stamped:!1}}var H9=0,FH=new p1(500),V9=new Set;function LH(){V9.clear()}function vY($){if($.__onceStore instanceof Set)return $.__onceStore;return V9}async function r3($,Z,X,J,Y,Q=new Set){let G=J.partialsDir||z0.join(z0.dirname(X),"partials");if(G&&!z0.isAbsolute(G))G=z0.resolve(process.cwd(),G);let q=yY($,"@partial","@include"),W=vY(Z);q=q.replace(/@once([\s\S]*?)@endonce/g,(_,L,V)=>{let O=L.trim(),F=`${X}:${O}`;if(W.has(F))return"";return W.add(F),L});{let _=/@includeIf\s*\(/g,L;while((L=_.exec(q))!==null){let V=L.index,O=V+L[0].length-1,F=1,w=O+1;while(w<q.length&&F>0){if(q[w]==="(")F++;else if(q[w]===")")F--;w++}if(F!==0)break;let R=q.substring(O+1,w-1),D=R.match(/^\s*['"]([^'"]+)['"]/);if(!D){_.lastIndex=w;continue}let A=D[1],k=K(A,G,X),N="";if(k&&await Bun.file(k).exists())Y.add(k),N=`@include(${R})`;q=q.substring(0,V)+N+q.substring(w),_.lastIndex=0}}for(let[_,L]of[["@includeWhen",!1],["@includeUnless",!0]]){let V=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),O;while((O=V.exec(q))!==null){let F=O.index,w=F+O[0].length-1,R=1,D=w+1;while(D<q.length&&R>0){if(q[D]==="(")R++;else if(q[D]===")")R--;D++}if(R!==0)break;let A=q.substring(w+1,D-1),k=o3(A,0);if(k===-1){V.lastIndex=D;continue}let N=A.substring(0,k).trim(),M=A.substring(k+1).trim(),T=M.match(/^\s*['"]([^'"]+)['"]/);if(!T){V.lastIndex=D;continue}let I=T[1],C=M.substring(T[0].length),E,b=o3(C,0);if(b!==-1)E=C.substring(b+1).trim();try{let y=`Boolean(${N})`,P;if(q0(y)){let g=W0(y,Object.keys(Z));P=Boolean(g(...Object.values(Z)))}else P=Boolean(e(y,Z));let f=L?!P:P,d="";if(f){let g=K(I,G,X);if(g&&await Bun.file(g).exists())Y.add(g);d=`@include('${I}'${E?`, ${E}`:""})`}q=q.substring(0,F)+d+q.substring(D),V.lastIndex=0}catch(y){let P=y instanceof Error?y.message:String(y),f=j0("Include",`Error evaluating ${_} condition: ${P}`,X,$,F);q=q.substring(0,F)+f+q.substring(D),V.lastIndex=0}}}{let _=/@each\s*\(/g,L;while((L=_.exec(q))!==null){let V=L.index,O=V+L[0].length-1,F=1,w=O+1;while(w<q.length&&F>0){if(q[w]==="(")F++;else if(q[w]===")"){if(F--,F===0)break}w++}if(F!==0)break;let R=q.substring(O+1,w),D=q.substring(V,w+1),A=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!A){_.lastIndex=0,q=q.replace(D,"");continue}let[,k,N,M,T]=A;try{let I,C=N.trim();if(q0(C))I=W0(C,Object.keys(Z))(...Object.values(Z));else I=e(C,Z);let E="";if(Array.isArray(I)&&I.length>0)for(let b of I){let y={...Z,[M]:b},P=await H(k,y,$,V);E+=P}else if(T)E=await H(T,{},$,V);q=q.substring(0,V)+E+q.substring(w+1),_.lastIndex=0}catch(I){let C=I instanceof Error?I.message:String(I);q=q.substring(0,V)+j0("Each",`Error in @each: ${C}`,X,$,V)+q.substring(w+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,L;while((L=_.exec(q))!==null){let V=L.index,O=V+L[0].length-1,F=1,w=O+1;while(w<q.length&&F>0){if(q[w]==="(")F++;else if(q[w]===")"){if(F--,F===0)break}w++}if(F!==0)break;let R=q.substring(O+1,w),D=q.substring(V,w+1),A=R.match(/^\s*(\[[^\]]+\])/);if(!A){_.lastIndex=0,q=q.replace(D,"");continue}let k=A[1],N=R.slice(A[0].length),M,T=N.match(/^\s*,\s*\{/);if(T){N=N.slice(T[0].length-1);let E=1,b=1;while(b<N.length&&E>0){if(N[b]==="{")E++;else if(N[b]==="}"){if(E--,E===0)break}b++}M=N.substring(0,b+1),N=N.slice(b+1)}let I,C=N.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(C)I=C[1];try{let E=JSON.parse(k.replace(/'/g,'"')),b={};if(M)try{b=R0(M,Z)}catch(P){let f=P instanceof Error?P.message:String(P);if(J.debug){let d=j0("Include",`Error parsing includeFirst variables: ${f}`,X,$,V,D);q=q.replace(D,()=>d)}else q=q.replace(D,()=>I||"");continue}let y=!1;for(let P of E){let f=K(P,G,X);if(!f)continue;if(await t(f)){let d=await H(P,b,$,V);q=q.replace(D,()=>d),y=!0;break}}if(!y)if(I!==void 0)q=q.replace(D,()=>I);else if(J.debug){let P=j0("Include",`None of the includeFirst paths exist: ${k}`,X,$,V,D);q=q.replace(D,()=>P)}else q=q.replace(D,"")}catch(E){let b=E instanceof Error?E.message:String(E),y=j0("Include",`Error processing @includeFirst: ${b}`,X,$,V,D);q=q.replace(D,()=>y)}_.lastIndex=0}}function K(_,L,V){try{let O=_;if(!_.endsWith(".stx"))O=`${_}.stx`;let F=z0.resolve(L),w=z0.resolve(z0.dirname(V)),R;if(!O.startsWith("./")&&!O.startsWith("../"))R=z0.resolve(L,O);else R=z0.resolve(w,O);let D=z0.normalize(R),A=D.startsWith(F+z0.sep)||D===F,k=D.startsWith(w+z0.sep)||D===w,N=!1,M=z0.dirname(w);if(D.startsWith(M+z0.sep)){if(!z0.relative(M,D).split(z0.sep).some((E)=>E.startsWith(".")&&E!=="."&&E!==".."))N=!0}if(!A&&!k&&!N)return console.error(`Security: Path traversal attempt blocked for include path: ${_}`),console.error(` Resolved to: ${D}`),console.error(` Allowed dirs: ${F}, ${w}`),null;return D}catch(O){return console.error(`Error resolving path ${_}: ${O}`),null}}let U=z0.resolve(X);Q.add(U);function z(_,L,V,O){return J.onIncludeError?.({includePath:_,templatePath:X,message:L,partialsDir:G}),j0("Include",L,X,V,O)}async function H(_,L={},V,O){let F=K(_,G,X);if(!F)return z(_,`Could not resolve path for include: ${_}`,V,O);let w=z0.resolve(F);if(Q.has(w)){let R=[...Q,w].map((D)=>z0.basename(D)).join(" -> ");return z(_,`Circular include detected: ${R}`,V,O)}try{Y.add(F);let R;if(!R)try{R=await Bun.file(F).text()}catch(f){let d=f instanceof Error?f.message:String(f);return z(_,`Error loading include file ${_}: ${d}`,V,O)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:f}=await import("./chunk-twna1gqh.js");R=f(R,Z)}if(R&&(J.debug||!O5()&&!Z$()))try{let{warnUnbalancedTags:f}=await import("./chunk-6nar1v2y.js");f(R,F)}catch{}let D=R;try{let{processESImports:f}=await import("./chunk-eqnwq9m0.js");await f(R,Z,F,J,Y)}catch(f){if(J.debug)console.warn(`[stx] partial ES import extraction skipped for ${F}:`,f instanceof Error?f.message:f)}let A=V$(D);if(A)D=A.content.trim();let N=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(N)M=`<style${N[1]}>${N[2]}</style>`;D=D.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),D=D.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let T={...Z};T.__stx_signals_gate=G1(R,F);for(let[f,d]of Object.entries(L))T[f]=d;let I=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,C=[...R.matchAll(I)],E="",b=null;for(let f of C){let d=f[1]||"",g=f[2]||"",Q0=d.includes("server"),e0=A1(d);if(!Q0&&g.trim()){let{interpolateScriptExpressions:X0}=await import("./chunk-6hxqck1t.js");g=X0(g,T)}let k0="";try{let{extractAndStripCssImports:X0,renderVendorStyleTags:H0}=await import("./chunk-djzbg6pr.js"),I0=X0(g,{filePath:F,projectRoot:process.cwd()});g=I0.code,k0=H0(I0.styles)}catch(X0){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${F}:`,X0 instanceof Error?X0.message:X0)}if(e0&&g.trim())g=M1(g);if(!Q0){try{let{injectBrowserCoreAutoImports:H0}=await import("./chunk-djzbg6pr.js");g=H0(g).code;let{hasUserImports:I0,bundleClientScript:E0}=await import("./chunk-vrx2rq5x.js");if(I0(g))g=await E0(g,F,{projectRoot:process.cwd()})}catch(H0){if(J.debug)console.warn(`[stx] bundler skipped for ${F}:`,H0 instanceof Error?H0.message:H0)}let{stripStxRuntimeImports:X0}=await import("./chunk-sevgcxxp.js");g=X0(g)}let C0=SY(g);if(C0&&!Q0){b=`stx_scope_${z0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++H9}`;let X0=$1(g),H0=CY(X0,b);E+=`${k0}<script data-stx-scoped data-stx-run="always">${H0}</script>
|
|
3356
|
+
`;continue}if(Q0)try{let{extractVariables:X0}=await import("./chunk-f68eb80q.js");await X0(g,T,F)}catch(X0){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${F}:`,X0)}if(!Q0&&!C0){let X0=d.replace(/\bclient\b/i,"").trim();b=`stx_scope_${z0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++H9}`;let H0=$1(g),I0=_9(H0,b),E0=B9(H0,I0);E+=`${k0}<script data-stx-scoped data-stx-run="always"${X0?` ${X0}`:""}>${E0}</script>
|
|
3357
|
+
`}}if(b){let f=PY(D,b);if(D=f.html,f.mergedIntoExisting)E=E.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${f.mergedIntoExisting}']`),b=f.mergedIntoExisting;else if(!f.stamped)console.warn(`[stx] ${z0.relative(process.cwd(),F)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`)}if(D.includes("@include")||D.includes("@partial"))D=await r3(D,T,F,J,Y,Q);let{processLoops:y}=await import("./chunk-aqhnv526.js"),P=y(D,T,F);if(P=X1(P,T,F),P=O1(P,T,F),M)P+=`
|
|
3358
3358
|
`+M;if(E)P+=`
|
|
3359
3359
|
`+E;return P}catch(R){let D=R instanceof Error?R.message:String(R);return z(_,`Error processing include ${_}: ${D}`,V,O)}}let j=/@include\s*\(/g,B;while((B=j.exec(q))!==null){let _=B.index,L=_+B[0].length-1,V=1,O=L+1;while(O<q.length&&V>0){if(q[O]==="(")V++;else if(q[O]===")")V--;O++}if(V!==0)break;let F=q.substring(_,O),w=q.substring(L+1,O-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){j.lastIndex=O;continue}let D=R[1],A,k=w.substring(R[0].length),N=o3(k,0);if(N!==-1)A=k.substring(N+1).trim();let M={};if(A)try{M=R0(A,Z)}catch(I){let C=I instanceof Error?I.message:String(I);q=q.replace(F,j0("Include",`Error parsing include variables for ${D}: ${C}`,X,$,_)),j.lastIndex=0;continue}let T=await H(D,M,$,_);q=q.substring(0,_)+T+q.substring(O),j.lastIndex=0}return q}function a3($,Z){let X=$;function J(Y,Q,G,q){let W=Y,K=!0;while(K){K=!1;let U=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),z=W.match(U);if(!z||z.index===void 0)break;let H=z.index,j=z[1],B=H+z[0].length,_=new RegExp(`@${Q}\\(`),L=new RegExp(`@${G}(?![a-z])`),V=1,O=B,F=-1;while(V>0&&O<W.length){let R=W.slice(O),D=R.match(_),A=R.match(L),k=D?O+D.index:1/0,N=A?O+A.index:1/0;if(k<N)V++,O=k+(D[0].length||1);else if(N<1/0){if(V--,V===0){F=N;break}O=N+G.length+1}else break}if(F===-1)break;let w=W.slice(B,F);if(!Z[j])Z[j]=[];if(q)Z[j].unshift(w);else Z[j].push(w);W=W.substring(0,H)+W.substring(F+`@${G}`.length),K=!0}return W}return X=J(X,"push","endpush",!1),X=J(X,"prepend","endprepend",!0),X}function t3($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(X,J)=>{if(!Z[J]||Z[J].length===0)return"";return Z[J].join(`
|
|
3360
3360
|
`)})}import*as e3 from"path";async function O9($,Z,X=""){if(e3.basename(X)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return L9($,Z,X,"@js","@endjs")}async function F9($,Z,X=""){if(e3.basename(X)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((Q)=>({...Q,displayName:`User ${Q.id}: ${Q.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return L9($,Z,X,"@ts","@endts")}async function L9($,Z,X,J,Y){let Q=$,G=m1(`${J}([\\s\\S]*?)${Y}`,"g"),q=[],W;while((W=G.exec($))!==null)q.push({fullMatch:W[0],content:W[1]||"",index:W.index});for(let{fullMatch:K,content:U,index:z}of q)try{let H={...Z,global:Z},j=Object.keys(H),B=Object.values(H),_=U.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 V=(_.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((D)=>D.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),O=V.length>0?`return { ${V.join(", ")} };`:"return {};",F=`
|
|
@@ -3526,14 +3526,14 @@ document.addEventListener("focusout",function(e){
|
|
|
3526
3526
|
${Z}${$.slice(G)}`}if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Z+`
|
|
3527
3527
|
`+$.slice(G)}if(q1($))return v1($,(G)=>`${G}
|
|
3528
3528
|
${Z}`);return`${Z}
|
|
3529
|
-
${$}`}async function M$($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve")return z4($,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if(Z.buildMode==="compile")return z4($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:X}=await import("./chunk-
|
|
3529
|
+
${$}`}async function M$($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve")return z4($,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if(Z.buildMode==="compile")return z4($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:X}=await import("./chunk-4z55rsz6.js"),J=await X(Z.debug);return z4($,`<script data-stx-scoped data-stx-runtime>${J}</script>`)}function hQ($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function V8($){if($.includes("data-stx-tooltip-runtime")||!hQ($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${U4()}</script>`,X=$.lastIndexOf("</body>");if(X===-1)return`${$}
|
|
3530
3530
|
${Z}`;return`${$.slice(0,X)}${Z}
|
|
3531
3531
|
${$.slice(X)}`}var uQ=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function dQ($){return uQ.test($)||$.includes("__stxRouter)return")||$.includes("__stxRouter=true")}async function mQ($,Z){if(!$.includes("</body>"))return $;if(dQ($))return $;let X=Z?.router,J="";{let q={};if(X){if(X.container)q.container=X.container;if(X.interceptAllLinks!==void 0)q.interceptAllLinks=X.interceptAllLinks;if(X.progress!==void 0)q.progress=X.progress;if(X.viewTransitions!==void 0)q.viewTransitions=X.viewTransitions;if(X.viewTransitionDuration!==void 0)q.viewTransitionDuration=X.viewTransitionDuration;if(X.viewTransitionEasing!==void 0)q.viewTransitionEasing=X.viewTransitionEasing;if(X.scrollToTop!==void 0)q.scrollToTop=X.scrollToTop;if(X.prefetch!==void 0)q.prefetch=X.prefetch;if(X.cache!==void 0)q.cache=X.cache;if(X.progressColor!==void 0)q.progressColor=X.progressColor;if(X.progressHeight!==void 0)q.progressHeight=X.progressHeight}try{let W=await H8(Z?.pagesDir);if(W.length>0)q.ownedRoutes=W}catch{}if(Object.keys(q).length>0)J=`<script>window.__stxRouterConfig=${j8(q)};</script>
|
|
3532
|
-
`}let{getCachedRouterScript:Y}=await import("./chunk-
|
|
3532
|
+
`}let{getCachedRouterScript:Y}=await import("./chunk-4z55rsz6.js"),Q=Z?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':Z?.buildMode==="serve"?'<script data-stx-router src="/_stx/router.js"></script>':`<script data-stx-router>${await Y()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+J+Q+`
|
|
3533
3533
|
</body>`+$.slice(G+7)}var O8=Symbol.for("stx.lazy-module-promises");function lQ(){let $=globalThis;return $[O8]??=new Map,$[O8]}function o($,Z){let X=lQ(),J=`${import.meta.url}\x00${$}`,Y=X.get(J);if(Y)return Y;let Q=Z();return X.set(J,Q),Q.catch(()=>{if(X.get(J)===Q)X.delete(J)}),Q}var j4=`(?:"[^"]*"|'[^']*'|[^>"'])*`,N8=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;function cQ($,Z={}){let X=[];for(let J of n5($,Q1)){let Y=J.token.match(/^<script\b([^>]*)>/i),Q=J.token.match(/<\/script\s*>$/i);if(!Y||!Q)continue;let G=Y[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let q=Y[0].length,W=J.token.length-Q[0].length;X.push({fullMatch:J.token,attrs:G,body:J.token.slice(q,W),start:J.start,end:J.end})}return X}function A8($){let Z=$.trim(),X=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(X){let Y=X[1].trim(),Q=X[2].trim(),{itemVar:G,indexVar:q}=F8(Q);if(G)return{style:"as",iterable:Y,itemVar:G,indexVar:q}}let J=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(J){let Y=J[1].trim(),Q=J[2].trim(),{itemVar:G,indexVar:q}=F8(Y);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:q}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function F8($){let Z=$.trim(),X=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(X)return{itemVar:X[2],indexVar:X[1]};let J=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(J)return{itemVar:J[1],indexVar:J[2]||null};let Y=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]};let Q=Z.match(/^(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:null};return{itemVar:null,indexVar:null}}function _4($,Z){return D8($,Z)}function pQ($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,X=0,J;while((J=Z.exec($))!==null){let Y=J[1];if(Y.startsWith("if"))X++;else if(Y==="endif")X--;else if(X===0)return!0}return!1}function iQ($){let Z=new Set,X=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,Y;while((Y=X.exec($))!==null){let Q=Y[1],G;while((G=J.exec(Q))!==null)Z.add(G[1])}return Z}function nQ($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let Z=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${j4})>`,"iy"),X=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,J=n5($,(Q,G)=>{Z.lastIndex=G;let q=Z.exec(Q);if(!q||q.index!==G||!X.test(q[2]))return-1;return Z.lastIndex}),Y=[];for(let Q of J){Z.lastIndex=0;let G=Z.exec(Q.token);if(!G)continue;let q=G[2].match(X),W=A8(q?.[1]??q?.[2]??""),K=[W.itemVar,W.indexVar].filter(Boolean);if(K.length===0)continue;let U=G[1],H=/\/\s*>$/.test(Q.token)||I$.has(U.toLowerCase())?Q.end:k8($,Q.start,U,Q.end);if(H!==-1)Y.push({start:Q.start,end:H,vars:new Set(K)})}return Y}var L8=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);function sQ($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function w8($,Z,X,J){if(!$)return!1;let Y=sQ($),Q=!1,G=!1,q=!1,W=/([a-zA-Z_$][\w$]*)/g,K;while((K=W.exec(Y))!==null){let j=K[1];if(Y.slice(0,K.index).trimEnd().endsWith("."))continue;if(L8.has(j))continue;if(Z.has(j)||J?.has(j))Q=!0;else if(X&&j in X)G=!0}let U=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,z;while((z=U.exec(Y))!==null){let j=z[1];if(Y.slice(0,z.index).trimEnd().endsWith("."))continue;if(L8.has(j)||X&&j in X)continue;q=!0}return(Q||q)&&!G}function k$($,Z,X){let J=X===void 0?` ${Z}`:` ${Z}="${X.replace(/"/g,""")}"`,Y=$.trim(),Q=Y.match(N8);if(Q&&oQ(Q[3],Q[1])){let[,G,q,W]=Q;return`<${G}${q}${J}>${W}</${G}>`}return`<template${J}>${Y}</template>`}function oQ($,Z){let X=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),J=0,Y;while((Y=X.exec($))!==null)if(Y[1]){if(J--,J<0)return!1}else J++;return!0}function M8($,Z){let X=iQ($);function J(Y){let Q=Y,G=nQ(Y),q=(z)=>{let H=new Set;for(let j of G)if(z>j.start&&z<j.end)for(let B of j.vars)H.add(B);return H},W=/@if\s*\(/g,K,U=[];while((K=W.exec(Q))!==null){let z=K.index,H=z+K[0].length,j=1,B=H;while(B<Q.length&&j>0){if(Q[B]==="(")j++;else if(Q[B]===")")j--;B++}if(j!==0)continue;let _=Q.substring(H,B-1).trim(),L=B,V=1,O=L,F=/@(if\s*\(|endif)/g;F.lastIndex=L;let w;while((w=F.exec(Q))!==null)if(w[1].startsWith("if"))V++;else if(w[1]==="endif"){if(V--,V===0){O=w.index+w[0].length;break}}if(V!==0)continue;let R=Q.substring(L,O-6).trim(),D;if(pQ(R)){let A=w5(Q.substring(z,O));if(A.length===0)continue;let k=A[0].branches.filter((I)=>I.type!=="else"),N=q(z);if(!(k.length>0&&k.every((I)=>w8(I.condition,X,Z,N))))continue;D=A[0].branches.map((I)=>{let C=J(I.content);if(I.type==="elseif")return k$(C,"@else-if",I.condition??"");if(I.type==="else")return k$(C,"@else");return k$(C,"@if",I.condition??"")}).join(`
|
|
3534
3534
|
`)}else{if(!w8(_,X,Z,q(z)))continue;D=k$(J(R),"@if",_)}U.push({start:z,end:O,replacement:D}),W.lastIndex=O}for(let z=U.length-1;z>=0;z--){let{start:H,end:j,replacement:B}=U[z];Q=Q.substring(0,H)+B+Q.substring(j)}return Q}return J($)}function rQ($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let Y=Number(Z);return Y!==0&&!Number.isNaN(Y)}let X=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(X)return X[1].length>0;let J=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(J)return J[1].length>0;return}var I$=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function k8($,Z,X,J){if(I$.has(X.toLowerCase()))return J;let Y=X.toLowerCase(),Q=$.toLowerCase(),G=$.length,q=1,W=J;while(W<G){let K=$.indexOf("<",W);if(K===-1)return-1;if(W=K,$.startsWith("<!--",W)){let j=$.indexOf("-->",W+4);if(j===-1)return-1;W=j+3;continue}let U=/^<(script|style)\b/i.exec($.slice(W,W+8));if(U){let j=$.indexOf(">",W);if(j===-1)return-1;if($[j-1]==="/"){W=j+1;continue}let B=Q.indexOf(`</${U[1].toLowerCase()}`,W);if(B===-1)return-1;let _=$.indexOf(">",B);if(_===-1)return-1;W=_+1;continue}if($[W+1]==="/"){let j=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(W,W+64));if(!j){W++;continue}if(j[1].toLowerCase()===Y){if(q--,W+=j[0].length,q===0)return W;continue}W+=j[0].length;continue}let z=/^<([a-z][\w-]*)\b/i.exec($.slice(W,W+64));if(!z){W++;continue}let H=$.indexOf(">",W);if(H===-1)return-1;if(z[1].toLowerCase()===Y){let j=$.slice(W,H+1);if(!(/\/\s*>$/.test(j)||I$.has(Y)))q++}W=H+1}return-1}var aQ=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function tQ($,Z){let X=Z,J=$.length;for(;;){while(X<J&&$[X]!=="<")X++;if(X>=J)return!1;if($.startsWith("<!--",X)){let G=$.indexOf("-->",X+4);if(G===-1)return!1;X=G+3;continue}break}if($[X+1]==="/")return!1;let Y=$.indexOf(">",X);if(Y===-1)return!1;let Q=$.slice(X,Y+1);return aQ.test(Q)}function I8($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,J;while((J=X.exec($))!==null)Z.push([J.index,J.index+J[0].length]);let Y=(z)=>Z.some(([H,j])=>z>=H&&z<j),Q=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],q;while((q=Q.exec($))!==null){if(Y(q.index))continue;let[z,H,j,B,_,L,V]=q,O=rQ(_);if(O===void 0)continue;let F=q.index,w=F+z.length,A=!!V||/\/\s*>$/.test(z)||I$.has(H.toLowerCase())?w:k8($,F,H,w);if(A===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&tQ($,A)){Q.lastIndex=w;continue}if(O===!0){let N=`<${H}${j}${L}${V}>`;G.push({start:F,end:w,replacement:N});continue}G.push({start:F,end:A,replacement:""}),Q.lastIndex=A}if(G.length===0)return $;G.sort((z,H)=>z.start-H.start);let W=[],K=-1;for(let z of G){if(z.start<K)continue;W.push(z),K=z.end}let U=$;for(let z=W.length-1;z>=0;z--){let{start:H,end:j,replacement:B}=W[z];U=U.substring(0,H)+B+U.substring(j)}return U}function T8($,Z){let X=$,J=/@(for|foreach)\s*\(/g,Y,Q=[],G=[];while((Y=J.exec(X))!==null){let q=Y[1],W=Y.index,K=W+Y[0].length,U=1,z=K;while(z<X.length&&U>0){if(X[z]==="(")U++;else if(X[z]===")")U--;z++}if(U!==0)continue;let H=X.substring(K,z-1).trim(),j=z,B=A8(H),_=q==="for"?"@endfor":"@endforeach",L=1,V=j,O=q==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${q}\\s*\\(|end${q})`,"g");O.lastIndex=j;let F;while((F=O.exec(X))!==null)if(F[1].startsWith(q))L++;else if(L--,L===0){V=F.index+F[0].length;break}if(L!==0)continue;let w=()=>{let k=[B.itemVar,B.indexVar].filter(Boolean);if(k.length)G.push({start:W,end:V,vars:k})};if(B.iterable){let k=B.iterable.trim();if(k.startsWith("[")||k.startsWith("{")||k.startsWith("'")||k.startsWith('"')||k.startsWith("`")||/^-?\d/.test(k)){w();continue}let N=k.split(/[.[(]/)[0].trim(),M=Z?N in Z:!1,T=G.some((I)=>W>I.start&&W<I.end&&I.vars.includes(N));if(N&&(M||T)){w();continue}}if(B.style==="as")H=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let R=X.substring(j,V-_.length).trim(),D=R.match(N8),A;if(D){let[,k,N,M]=D;A=`<${k}${N} @for="${H}">${M}</${k}>`}else A=`<template @for="${H}">${R}</template>`;Q.push({start:W,end:V,replacement:A})}for(let q=Q.length-1;q>=0;q--){let{start:W,end:K,replacement:U}=Q[q];X=X.substring(0,W)+U+X.substring(K)}return X}function eQ($){let Z=new Set,X=[],J=0,Y=0,Q=$.length,G=(U)=>{let z=J+1;while(z<Q){let H=$[z];if(H==="\\"){z+=2;continue}if(H===U)return z+1;z++}return Q},q=()=>{let U=J+2;while(U<Q&&$[U]!==`
|
|
3535
3535
|
`)U++;return U},W=()=>{let U=J+2;while(U<Q-1){if($[U]==="*"&&$[U+1]==="/")return U+2;U++}return Q},K=(U)=>{let z=U,H=0;while(z<Q){let j=$[z];if(j==="/"&&$[z+1]==="/"){let B=z+2;while(B<Q&&$[B]!==`
|
|
3536
|
-
`)B++;z=B;continue}if(j==="/"&&$[z+1]==="*"){let B=z+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;z=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=z+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===j){B++;break}B++}z=B;continue}if(j==="("||j==="["||j==="{"){H++,z++;continue}if(j===")"||j==="]"||j==="}"){H--,z++;continue}if(j===";"&&H===0)return z+1;z++}return Q};while(J<Q){let U=$[J];if(U==="/"&&$[J+1]==="/"){let z=q();X.push($.slice(J,z)),J=z;continue}if(U==="/"&&$[J+1]==="*"){let z=W();X.push($.slice(J,z)),J=z;continue}if(U==='"'||U==="'"||U==="`"){let z=G(U);X.push($.slice(J,z)),J=z;continue}if(U==="{"){Y++,X.push(U),J++;continue}if(U==="}"){Y--,X.push(U),J++;continue}if(Y===0){let z=J>0?$[J-1]:"";if(z===""||/\s/.test(z)||z===";"||z==="}"||z==="{"){let j=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],_=K(J+j[0].length);if(Z.has(B)){X.push(`/* stx: deduped const ${B} */`),J=_;continue}Z.add(B),X.push($.slice(J,_)),J=_;continue}}}X.push(U),J++}return X.join("")}async function $G($,Z,X){let J=cQ($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Y=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,Q=[],{hasUserImports:G,bundleClientScript:q}=await o("stx/client-script-bundler",()=>import("./chunk-
|
|
3536
|
+
`)B++;z=B;continue}if(j==="/"&&$[z+1]==="*"){let B=z+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;z=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=z+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===j){B++;break}B++}z=B;continue}if(j==="("||j==="["||j==="{"){H++,z++;continue}if(j===")"||j==="]"||j==="}"){H--,z++;continue}if(j===";"&&H===0)return z+1;z++}return Q};while(J<Q){let U=$[J];if(U==="/"&&$[J+1]==="/"){let z=q();X.push($.slice(J,z)),J=z;continue}if(U==="/"&&$[J+1]==="*"){let z=W();X.push($.slice(J,z)),J=z;continue}if(U==='"'||U==="'"||U==="`"){let z=G(U);X.push($.slice(J,z)),J=z;continue}if(U==="{"){Y++,X.push(U),J++;continue}if(U==="}"){Y--,X.push(U),J++;continue}if(Y===0){let z=J>0?$[J-1]:"";if(z===""||/\s/.test(z)||z===";"||z==="}"||z==="{"){let j=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],_=K(J+j[0].length);if(Z.has(B)){X.push(`/* stx: deduped const ${B} */`),J=_;continue}Z.add(B),X.push($.slice(J,_)),J=_;continue}}}X.push(U),J++}return X.join("")}async function $G($,Z,X){let J=cQ($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Y=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,Q=[],{hasUserImports:G,bundleClientScript:q}=await o("stx/client-script-bundler",()=>import("./chunk-vrx2rq5x.js"));for(let V of J){let O=V.body;if(A1(V.attrs))O=M1(O);if(Y.test(O)){Q.push({fullMatch:V.fullMatch,attrs:V.attrs,content:O});continue}if(!G(O))continue;try{let F=await q(r1(O).code,Z||"",{projectRoot:process.cwd()});if(Y.test(F))Q.push({fullMatch:V.fullMatch,attrs:V.attrs,content:O,bundled:F})}catch{}}if(Q.length===0)return{output:$,setupCode:null};let W=`${Z??""}\x00${Q.map((V)=>V.content).join("\x00")}`,K=`__stx_setup_${Bun.hash(W).toString(36).slice(0,10)}`,U=[];for(let V=0;V<Q.length;V++){let O=Q[V].bundled??r1(Q[V].content).code;if(!Q[V].bundled&&G(O))O=await q(O,Z||"",{projectRoot:process.cwd()});O=YG(O);let F=$1(O);U.push(`// \u2500\u2500 merged signal script #${V+1} \u2500\u2500
|
|
3537
3537
|
${F}`)}let z=U.join(`
|
|
3538
3538
|
|
|
3539
3539
|
`);z=eQ(z);let H=ZG(z),j=H.split(",").map((V)=>V.trim()).filter(Boolean),B=B4(z,X),_=`
|
|
@@ -3611,9 +3611,9 @@ ${W.join(`
|
|
|
3611
3611
|
`+Y.slice(Q)}async function h4($,Z,X,J,Y){if(J.ssr===!1&&!J.autoShell&&J.buildMode==="spa")return $;if(Z.__stx_signals_gate===void 0)Z.__stx_signals_gate=G1($,X);let Q=!Z.__stxProcessingDepth;if(Q)X7(Z);if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((J.debug||!O5()&&!Z$())&&X&&X.endsWith(".stx"))F2($,X);try{return await _2.timeAsync("template-processing",async()=>{let G=await pG($,Z,X,J,Y);if(Q)G=f4(G);if(Q&&J.autoShell&&J.buildMode!=="compile"){let q=J.app?.head||{},K=(Z.__stx_runtime_head||null)??O2(),U=(Z.__stx_head_raw||"").trim(),z,H=U.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(H)z=H[1].trim(),U=U.replace(H[0],"").trim();let j=Z.__sections?.title,B=K.title||z||j,_=!K.title&&(!!z||!!j),L=K.meta||[],V=new Set(L.map((A)=>s1(A)).filter(Boolean)),O={...q,...B&&{title:B},meta:[...(q.meta||[]).filter((A)=>!V.has(s1(A))),...L],link:[...q.link||[],...K.link||[]],script:[...q.script||[],...K.script||[]],headRaw:[q.headRaw,U].filter(Boolean).join(`
|
|
3612
3612
|
`),...K.htmlAttrs&&{htmlAttrs:Y8(q.htmlAttrs,K.htmlAttrs)},...K.bodyAttrs&&{bodyAttrs:{...q.bodyAttrs||{},...K.bodyAttrs}}},F=W4(G);if(G=W8(G,O,{..._&&{titleIsHtml:!0},...J.app?.colorMode&&{colorMode:J.app.colorMode}}),F)G=q8(G,q),G=Q8(G,O.htmlAttrs);let w=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(w&&G.includes("<head")){let A=w[1],k=B2(A);G=G.replace(/<head\b[^>]*>/i,(N)=>`${N}
|
|
3613
3613
|
<meta name="stx-layout" content="${U2(A)}">
|
|
3614
|
-
<meta name="stx-layout-group" content="${U2(k)}">`)}let R=G.match(/function (__stx_setup_\w+)\(/),D=R?q1(G):null;if(R&&D&&!/\bdata-stx=/.test(D.tag)){G=v1(G,(k,N)=>`<body${N} data-stx="${R[1]}">`);let A=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${R[1]}"`,"i");G=G.replace(A,"$1")}}if(Q){G=G8(G);let q=J.app?.colorMode;if(q)G=e9(G,q);G=Z8(G),G=cG(G)}if(Q)try{let{getStoreScript:q}=await o("stx/store-loader",()=>import("./chunk-
|
|
3615
|
-
`+U+G.slice(z.end)}}catch{}if(Q)try{let{getFrameworkComposableScript:q}=await o("stx/framework-composables",()=>import("./chunk-
|
|
3616
|
-
`+W+G.slice(K.end)}}catch{}if(Q)try{let{getComposableScript:q}=await o("stx/composable-loader",()=>import("./chunk-
|
|
3614
|
+
<meta name="stx-layout-group" content="${U2(k)}">`)}let R=G.match(/function (__stx_setup_\w+)\(/),D=R?q1(G):null;if(R&&D&&!/\bdata-stx=/.test(D.tag)){G=v1(G,(k,N)=>`<body${N} data-stx="${R[1]}">`);let A=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${R[1]}"`,"i");G=G.replace(A,"$1")}}if(Q){G=G8(G);let q=J.app?.colorMode;if(q)G=e9(G,q);G=Z8(G),G=cG(G)}if(Q)try{let{getStoreScript:q}=await o("stx/store-loader",()=>import("./chunk-mtk42c2k.js")),W=J.storesDir,K=await q(W);if(K){let U=`<script data-stx-stores>${K}</script>`,z=q5(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
|
|
3615
|
+
`+U+G.slice(z.end)}}catch{}if(Q)try{let{getFrameworkComposableScript:q}=await o("stx/framework-composables",()=>import("./chunk-dry0kpjd.js")),W=await q(G);if(W){let K=q5(G,"data-stx-stores")||q5(G,"data-stx-runtime");if(K)G=G.slice(0,K.end)+`
|
|
3616
|
+
`+W+G.slice(K.end)}}catch{}if(Q)try{let{getComposableScript:q}=await o("stx/composable-loader",()=>import("./chunk-ayfbw3ke.js")),W=J.composablesDir,K=await q(W,G);if(K){let U=`<script data-stx-composables>${K}</script>`,z=q5(G,"data-stx-stores")||q5(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
|
|
3617
3617
|
`+U+G.slice(z.end)}}catch{}if(Q)G=$8(G);if(Q&&Z.__stx_inject_css!==!1)G=await V2(G,void 0,J.buildMode==="serve");if(Q)G=r9(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof Y$)throw G;let q=G instanceof Error?G.message:String(G),W=new w1(`Template processing failed: ${q}`,X,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(i0.log(W,{filePath:X,context:Z}),F3.logDetailedError(W,{filePath:X,template:$.substring(0,500)}),J.debug)throw W;return V3.createFallbackContent("Template Processing",W)}}async function pG($,Z,X,J,Y){let Q=process.cwd(),G={...J,partialsDir:J.partialsDir&&!M0.isAbsolute(J.partialsDir)?M0.resolve(Q,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!M0.isAbsolute(J.componentsDir)?M0.resolve(Q,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!M0.isAbsolute(J.layoutsDir)?M0.resolve(Q,J.layoutsDir):J.layoutsDir},q=G,W=$;await sG(X,Z),nG(Z,q),W=await h1(()=>b9(W,Z,X,q),W,(F)=>{i0.log(F,{filePath:X,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${X}: ${F.message}`)}),W=W.replace(/\{\{--[\s\S]*?--\}\}/g,"");let K=o0(W,U5,(F,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);W=K.output;let U=K.tokens,z=(F)=>U.length===0?F:F.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,R)=>U[Number(R)]??""),H="\x00STX_ESCAPED_AT\x00";W=W.replace(/@@/g,H),W=W.replace(/@\{\{([\s\S]*?)\}\}/g,(F,w)=>{return`{{ ${w} }}`}),W=g9(W),W=await Q2(W,X,Y);let j={};W=a3(W,j);let B={...Z.__sections||{}},_="",L=g7(x7($)),V=/@nolayout\b/.test(W)||L===!1;if(/@nolayout\b/.test(W))W=W.replace(/@nolayout\b\s*/g,"");let O=W.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(O)_=O[1],W=W.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof L==="string"){if(_=L,!/@section\s*\(/.test(W))W=`@section('content')
|
|
3618
3618
|
${W.trim()}
|
|
3619
3619
|
@endsection`}if(!_&&!V&&q.defaultLayout){let F=q4(W),w=/@section\s*\(/.test(W);if(!F||w){let R="",D=M0.dirname(X),A=q.layoutsDir?M0.dirname(q.layoutsDir):process.cwd();for(let k=0;k<20;k++){let N=M0.join(D,"_layout.stx");if(await t(N)){R=N;break}let M=M0.dirname(D);if(M===D||M.length<A.length)break;D=M}if(R)_=R;else if(q.layoutsDir){let k=M0.isAbsolute(q.layoutsDir)?q.layoutsDir:M0.resolve(process.cwd(),q.layoutsDir),N=M0.join(k,`${q.defaultLayout}.stx`);if(await t(N))_=N}if(_&&!w)W=`@section('content')
|
|
@@ -3621,7 +3621,7 @@ ${W.trim()}
|
|
|
3621
3621
|
@endsection`}}if(W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(F,w,R)=>{return B[w]=R,""}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(F,w,R)=>{if(/^(['"]).*\1$/.test(R.trim()))return F;try{let D=e(R.trim(),Z);if(D===void 0)return F;return B[w]=String(D??""),""}catch{return F}}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(F,w,R)=>{if(R.includes("@parent"))B[w]=R.replace("@parent",y1);else B[w]=R.trim();return""}),Z.__sections=B,W=W.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(F,w,R)=>{return B[w]||R||""}),!("slot"in Z)||Z.slot===void 0)W=W.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(W=t3(W,j),_){let F=[],w=r0(W),R=o0(w.output,C1,(D,A)=>`\x00STX_ORPHAN_STYLE_${A}\x00`);if(W=R.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(D,A,k)=>{let N=A==="SCRIPT"?w.scripts[Number(k)]:R.tokens[Number(k)];if(N)F.push(N);return""}),F.length>0){let D=F.join(`
|
|
3622
3622
|
`);B.content=B.content?`${B.content}
|
|
3623
3623
|
${D}`:D,Z.__sections=B}}if(_)try{let F;if(M0.isAbsolute(_))F=_,Y.add(_);else F=await h1(()=>q$(_,X,G,Y),null,()=>{throw new w1(`Failed to resolve layout path: ${_}`,X,void 0,void 0,`Layout referenced from ${X}`)});if(!F){let N=(I)=>{if(!I)return[];try{let C=M0.isAbsolute(I)?I:M0.resolve(process.cwd(),I);return mG.readdirSync(C).filter((E)=>E.endsWith(".stx")).map((E)=>E.replace(/\.stx$/,""))}catch{return[]}},M=[...N(G.layoutsDir),...N(G.fallbackLayoutsDir)].filter((I,C,E)=>E.indexOf(I)===C).sort(),T=`Layout not found: ${_} (referenced from ${X})`+(M.length>0?`. Available layouts: ${M.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(i0.log(Error(T),{layoutPath:_,filePath:X,available:M},"error"),console.error(`[stx] ${T}`),G.debug)throw new w1(T,X);return W}let w=await h1(()=>Bun.file(F).text(),"",()=>{throw new w1(`Failed to read layout file: ${F}`,X,void 0,void 0,"Layout content could not be loaded")}),R=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(R){if(G.debug)console.log(`Found nested layout: ${R[1]} in ${F}`);let N={},M=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(C,E,b)=>{return N[E]=b.trim(),""});for(let[C,E]of Object.entries(N))if(B[C]&&B[C].includes(y1)){let b=B[C].indexOf(y1);B[C]=B[C].slice(0,b)+E+B[C].slice(b+y1.length)}else if(!B[C])B[C]=E;let T={...Z,__sections:B},I=`@layout('${R[1]}')${M}`;return await h4(I,T,F,G,Y)}let D=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),A=a3(D,j),k={};return A=A.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(N,M,T)=>{return k[M]=T.trim(),`@slot('${M}')`}),A=A.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(N,M,T)=>{if(B[M]){let I=B[M];if(I.includes(y1)){let C=k[M]||"",E=I.indexOf(y1);I=I.slice(0,E)+C+I.slice(E+y1.length)}return I}return T||""}),A=iG(A,B),A=A.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),A=t3(A,j),Z.__originalFilePath=X,W=await H2(A,Z,F,G,Y),W=`<!-- stx-layout: ${_} -->
|
|
3624
|
-
${W}`,z(W)}catch(F){return i0.log(F instanceof Error?F:Error(String(F)),{layoutPath:_,filePath:X},"error"),`[Error processing layout: ${F instanceof Error?F.message:String(F)}]`}return z(await H2(W,Z,X,G,Y))}function iG($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(X,J,Y)=>{let Q=Z[J];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return Y||""})}function nG($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let X=Z.envPrefix||"STX_PUBLIC_",J={};for(let[Y,Q]of Object.entries(process.env))if(Y.startsWith(X)&&Q!==void 0)J[Y]=Q;$.$env=J}async function sG($,Z){await h1(()=>C9($,Z),void 0,(X)=>{i0.log(X,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${X.message}`)})}async function oG($,Z,X){let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Y;while((Y=J.exec($))!==null){let Q=Y[1],G=Y[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:W}=await o("stx/variable-extractor",()=>import("./chunk-
|
|
3624
|
+
${W}`,z(W)}catch(F){return i0.log(F instanceof Error?F:Error(String(F)),{layoutPath:_,filePath:X},"error"),`[Error processing layout: ${F instanceof Error?F.message:String(F)}]`}return z(await H2(W,Z,X,G,Y))}function iG($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(X,J,Y)=>{let Q=Z[J];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return Y||""})}function nG($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let X=Z.envPrefix||"STX_PUBLIC_",J={};for(let[Y,Q]of Object.entries(process.env))if(Y.startsWith(X)&&Q!==void 0)J[Y]=Q;$.$env=J}async function sG($,Z){await h1(()=>C9($,Z),void 0,(X)=>{i0.log(X,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${X.message}`)})}async function oG($,Z,X){let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Y;while((Y=J.exec($))!==null){let Q=Y[1],G=Y[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:W}=await o("stx/variable-extractor",()=>import("./chunk-f68eb80q.js"));await W(G,Z,X,{preserveExisting:!0})}catch(W){let K=W instanceof Error?W:Error(String(W));i0.log(K,{filePath:X,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${X}: ${K.message}`)}}}async function rG($,Z,X){try{let{interpolateScriptsInTemplate:J}=await o("stx/expressions",()=>import("./chunk-6hxqck1t.js"));return J($,Z,{skipServer:!0})}catch(J){let Y=J instanceof Error?J:Error(String(J));return i0.log(Y,{filePath:X,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${X}: ${Y.message}`),$}}async function H2($,Z,X,J,Y){let Q=$,G=J;if(await oG(Q,Z,X),Q=await rG(Q,Z,X),Q=await O9(Q,Z,X),Q=await F9(Q,Z,X),Q=await $9(Q,Z,X,G),G1(Q))Q=M8(Q,Z),Q=T8(Q,Z);Q=I8(Q);let{processStreamDirectives:q}=await o("stx/streaming",()=>import("./chunk-twna1gqh.js"));Q=q(Q,Z),Q=M9(Q,Z,X,G),Q=await m9(Q,Z,X,G,Y),Q=await C4(Q,Z,X,G,Y),Q=f7(Q,Z,X,G);let{processDeferDirectives:W}=await o("stx/defer",()=>import("./chunk-d8np0m39.js"));Q=W(Q,Z,X);let{processTeleportDirectives:K}=await o("stx/teleport",()=>import("./chunk-fk5y786g.js"));Q=K(Q,Z,X);let{processTransitionDirectives:U,processTransitionAttributes:z}=await o("stx/transitions",()=>import("./chunk-s5r7hwsw.js"));Q=U(Q,Z,X),Q=z(Q);let{processErrorBoundaryDirectives:H}=await o("stx/error-boundaries",()=>import("./chunk-e5z100yg.js"));Q=H(Q,Z,X);let{processSuspenseDirectives:j}=await o("stx/suspense",()=>import("./chunk-1fgbwc7a.js"));Q=j(Q,Z,X);let{processAsyncDirectives:B}=await o("stx/async-components",()=>import("./chunk-0gpkptex.js"));Q=B(Q,Z,X);let{processKeepAliveDirectives:_}=await o("stx/keep-alive",()=>import("./chunk-5xj9t4wa.js"));Q=_(Q,Z,X);let{processVirtualListDirectives:L,processVirtualGridDirectives:V,processInfiniteListDirectives:O}=await o("stx/virtual-scrolling",()=>import("./chunk-a53v7hcy.js"));Q=L(Q,Z,X),Q=V(Q,Z,X),Q=O(Q,Z,X);let{processPartialHydrationDirectives:F,processStaticDirectives:w}=await o("stx/partial-hydration",()=>import("./chunk-nsn7gfew.js"));Q=F(Q,Z,X),Q=w(Q);let{processComputedDirectives:R,processWatchDirectives:D}=await o("stx/computed",()=>import("./chunk-t1xzgpdm.js"));Q=R(Q,Z,X),Q=D(Q,Z,X);let{processFormValidationDirectives:A}=await o("stx/forms-validation",()=>import("./chunk-qyfh6mf4.js"));Q=A(Q,Z,X);let{processHeadDirective:k,processTitleDirective:N,processMetaDirective:M,resetHead:T}=await o("stx/head",()=>import("./chunk-0ye9aj3r.js"));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)T();let I=k(Q);if(Q=I.content,I.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${I.headContent}
|
|
3625
3625
|
`;if(Q=N(Q,Z),Q=M(Q,Z),Q=S9(Q),Q=y3(Q,Z),Q=e6(Q),Q=T9(Q),Q=await r3(Q,Z,X,G,Y),Q=await C4(Q,Z,X,G,Y),Z.__stxProcessingDepth===1)Q=J7(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=f4(Q),Q=X1(Q,Z,X),Q=u7(Q,Z,{filePath:X,buildMode:G.buildMode}),Q=S3(Q,Z),Q=C3(Q,Z),Q=N5(Q,Z),Q=u3(Q,Z),Q=d3(Q,Z),Q=await u6(Q,Z,X,G),Q=await n7(Q,Z,X),Q=await z9(Q,Z,X,G),Q=j2(Q,Z,X,G),Q=M6(Q,Z,X,G),Q=k6(Q,Z,X),Q=I6(Q,Z,X,G),Q=a6(Q,Z,X,G),Q=P4(Q,Z),Q=v4(Q),Q=G2(Q),!G.skipEventDirectives)Q=Z7(Q,Z,X);if(Q=l7(Q,Z,X),G.debug){let p=/\bx-data\s*=/.test(Q),i=_4($);if(p&&i)console.warn(`[stx] ${X}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
3626
3626
|
Both work on the same page, but they manage separate scopes.
|
|
3627
3627
|
Prefer signals (state/derived/effect) for new components.`)}Q=f9(Q,Z),Q=await O1(Q,Z,X),Q=W2(Q),Q=K2(Q),Q=T7(Q);let{processXElementDirectives:C}=await o("stx/x-element",()=>import("./chunk-vesr13aj.js"));Q=C(Q);let E=Z.__originalFilePath||X,b=v$(Z);if(Q=await E8(Q,G,E,b),Q=Y9(Q,Z),Q=await y9(Q,Z,X,G),G.media?.image?.autoSiblings){let p=G.publicDir||"public",{rewriteImagesWithSiblings:i}=await o("stx/image-optimization/auto-sibling",()=>import("./chunk-5arv7j0q.js"));Q=await i(Q,{publicDir:p})}if(G.seo?.enabled)Q=T6(Q,Z,G);let y=(p,i,K0=!0)=>{if(!i)return p;let G0=i.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),N0=p.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(G0&&N0){if(K0)p=p.replace(N0[0],G0[0]);if(i=i.replace(G0[0],"").trim(),!i)return p}if(/<\/head>/i.test(p))return p.replace(/<\/head>/i,`${i}
|
|
@@ -3635,7 +3635,7 @@ ${M7()}
|
|
|
3635
3635
|
`+K5}else Q=Q.replace("</head>",`${i}
|
|
3636
3636
|
</head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
|
|
3637
3637
|
${i}`);else Q=i+`
|
|
3638
|
-
`+Q}{let{scanScriptTags:p}=await o("stx/signal-processing",()=>import("./chunk-
|
|
3638
|
+
`+Q}{let{scanScriptTags:p}=await o("stx/signal-processing",()=>import("./chunk-sevgcxxp.js")),i=[];for(let K0 of p(Q)){if(!/\bserver\b/i.test(K0.attrs))continue;let G0=K0.start+K0.fullMatch.indexOf(">")+1,N0=lG(Q,G0);if(N0===-1)continue;let P0=N0+9;while(P0<Q.length&&/\s/.test(Q[P0]))P0++;i.push({start:K0.start,end:P0})}for(let K0=i.length-1;K0>=0;K0--){let{start:G0,end:N0}=i[K0];Q=Q.substring(0,G0)+Q.substring(N0)}}let C0=R$(Q,X);if(C0.hasScoped)Q=C0.html;let X0=Z.__stx_event_bindings||[],H0=!1,I0=[],E0=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:m0}=await o("stx/signal-processing",()=>import("./chunk-sevgcxxp.js"));for(let p of m0(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))I0.push({match:p.fullMatch,attrs:p.attrs,content:p.body});for(let{match:p,attrs:i,content:K0}of I0){H0=!0;let G0=K0;g4(K0,X,J.strict,Z.__originalFilePath);let N0=await f$(K0,{eventBindings:X0,attrs:i,hasColonDirectives:E0,templateContent:$,filePath:X,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:b});Q=Q.replace(p,()=>N0)}if(H0)Z.__stx_event_bindings=[];if(!H0&&Z.__stxProcessingDepth===1){let p=Z.__stx_event_bindings||[];if(p.length>0){let i=l$(p);if(i){let K0=Q.lastIndexOf("</body>");Q=K0===-1?Q+i:Q.slice(0,K0)+i+`
|
|
3639
3639
|
`+Q.slice(K0)}Z.__stx_event_bindings=[]}}if(!B8(Q)&&_8(Q))Q=await M$(Q,G);if(Q=V8(Q),G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=r6(Q,Z.cspNonce);return Q}var aG=[{open:"@if",close:"@endif",name:"if"},{open:"@unless",close:"@endunless",name:"unless"},{open:"@foreach",close:"@endforeach",name:"foreach"},{open:"@for",close:"@endfor",name:"for"},{open:"@while",close:"@endwhile",name:"while"},{open:"@forelse",close:"@endforelse",name:"forelse"},{open:"@switch",close:"@endswitch",name:"switch"},{open:"@isset",close:"@endisset",name:"isset"},{open:"@empty",close:"@endempty",name:"empty"},{open:"@auth",close:"@endauth",name:"auth"},{open:"@guest",close:"@endguest",name:"guest"},{open:"@can",close:"@endcan",name:"can"},{open:"@cannot",close:"@endcannot",name:"cannot"},{open:"@section",close:"@endsection",name:"section",altClose:"@show"},{open:"@push",close:"@endpush",name:"push"},{open:"@prepend",close:"@endprepend",name:"prepend"},{open:"@once",close:"@endonce",name:"once"},{open:"@markdown",close:"@endmarkdown",name:"markdown"},{open:"@component",close:"@endcomponent",name:"component"}],tG=[{pattern:/@if\s*[^(]/,message:"@if directive missing parentheses",suggestion:"Use @if(condition)"},{pattern:/@foreach\s*[^(]/,message:"@foreach directive missing parentheses",suggestion:"Use @foreach(items as item)"},{pattern:/@foreach\([^)]*\)\s*[^@\n<]/,message:"@foreach may have content on same line",suggestion:"Put content on new line after @foreach()"},{pattern:/@include\s*[^(]/,message:"@include directive missing parentheses",suggestion:"Use @include('partial-name')"},{pattern:/@extends\s*[^(]/,message:"@extends directive missing parentheses",suggestion:"Use @extends('layout-name') or @layout('layout-name')"},{pattern:/@layout\s*[^(]/,message:"@layout directive missing parentheses",suggestion:"Use @layout('layout-name')"}],eG=[{pattern:/\{\{\s*constructor\s*\}\}/,message:"Attempting to access constructor property"},{pattern:/\{\{\s*__proto__\s*\}\}/,message:"Attempting to access __proto__ property"},{pattern:/\{\{\s*eval\s*\(/,message:"Attempting to use eval in expression"}];function $q($){let Z=[],X=[];return Zq($,Z),Xq($,Z,X),Jq($,X),Yq($,Z),{valid:Z.length===0,errors:Z,warnings:X}}function Zq($,Z){let X=($.match(/\{\{/g)||[]).length,J=($.match(/\}\}/g)||[]).length;if(X!==J)Z.push({type:"expression",message:`Unclosed expression brackets: found ${X} opening '{{' and ${J} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function Xq($,Z,X){for(let J of aG){let Y=new RegExp(`${J.open}(?:\\s|\\()`,"g"),Q=new RegExp(J.close,"g"),G=($.match(Y)||[]).length,q=($.match(Q)||[]).length;if(J.altClose){let W=new RegExp(J.altClose,"g");q+=($.match(W)||[]).length}if(G>q)Z.push({type:"directive",message:`Unclosed @${J.name} directive: found ${G} opening and ${q} closing`,suggestion:`Add ${G-q} missing ${J.close} tag(s)`});else if(q>G)X.push({type:"directive",message:`Extra ${J.close} found: ${q-G} more closing than opening`,suggestion:`Check for orphaned ${J.close} tags`})}}function Jq($,Z){for(let X of tG)if(X.pattern.test($))Z.push({type:"syntax",message:X.message,suggestion:X.suggestion})}function Yq($,Z){for(let X of eG)if(X.pattern.test($))Z.push({type:"expression",message:`Security warning: ${X.message}`,suggestion:"Remove dangerous code from template expressions"})}function Qq($,Z){let X=$.slice(0,Z).split(`
|
|
3640
3640
|
`);return{line:X.length,column:X[X.length-1].length+1}}function Gq($,Z,X){let J=[];switch($){case"if":case"elseif":case"unless":if(X.length===0)J.push({type:"syntax",message:`@${$} requires a condition`,suggestion:`Use @${$}(condition)`});break;case"foreach":if(X.length===0||!X[0].includes(" as "))J.push({type:"syntax",message:'@foreach requires "items as item" syntax',suggestion:"Use @foreach(items as item) or @foreach(items as key => value)"});break;case"for":if(X.length===0)J.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(X.length===0)J.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(X.length===0)J.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(X.length===0)J.push({type:"syntax",message:`@${$} requires a path`,suggestion:`Use @${$}('path/to/template')`});break}return J}function qq($){return/@[a-z]+/i.test($)||/\{\{/.test($)}function Wq($){let Z=$.matchAll(/@([a-z]+)/gi),X=new Set;for(let J of Z){let Y=J[1].toLowerCase();if(!Y.startsWith("end"))X.add(Y)}return Array.from(X)}import t0 from"path";import W5 from"process";var I2=["module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","setResponseStatus","setResponseHeader","notFound","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params"],L2=new Set(I2),Kq=new Set(["props","$props","defineProps"]),Uq=new Set(["stx","@stacksjs/stx"]),w2=G5(128);function zq($){let Z=[],X=0,J=$.split(`
|
|
3641
3641
|
`);for(let Y of J){let Q=X,G=null,q=!1;for(let W=0;W<Y.length;W++){let K=Y[W];if(q){q=!1;continue}if(K==="\\"){q=!0;continue}if(G){if(K===G)G=null;continue}if(K==="'"||K==='"'||K==="`"){G=K;continue}if(K==="/"&&W+1<Y.length&&Y[W+1]==="/")break;if(K==="{")X++;else if(K==="}")X--}if(Q===0){let W=Y.match(/(?:const|let|var)\s+(\w+)\s*=/);if(W)Z.push(W[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Y)){let K=Y.match(/(?:const|let|var)\s+(\w+)/);if(K)Z.push(K[1])}else{let K=Y.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(K){let z=K[1].slice(1,-1).split(",").map((H)=>{let j=H.split(":");return(j.length>1?j[1]:j[0]).trim()}).filter((H)=>/^\w+$/.test(H));Z.push(...z)}}}}return[...new Set(Z)]}function Hq($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function X(J){if(!J.includes(":"))return J;let Y=[],Q="",G=0,q=0,W=null;for(let K=0;K<J.length;K++){let U=J[K];if(W){if(Q+=U,U===W)W=null;continue}if(U==='"'||U==="'"||U==="`"){W=U,Q+=U;continue}if(U==="<")G++;else if(U===">"&&G>0)G--;else if(U==="(")q++;else if(U===")")q--;if(U===","&&G===0&&q===0){Y.push(Q),Q="";continue}Q+=U}if(Q)Y.push(Q);return Y.map((K)=>{let U=K.trim(),z=U.startsWith("..."),H=z?U.slice(3):U,j=-1,B=0;for(let R=0;R<H.length;R++)if(H[R]==="<")B++;else if(H[R]===">")B--;else if(H[R]===":"&&B===0){j=R;break}if(j===-1)return K;let L=H.substring(0,j).trim().replace(/\?$/,""),V=H.substring(j+1),O=-1,F=0;for(let R=0;R<V.length;R++)if(V[R]==="<")F++;else if(V[R]===">")F--;else if(V[R]==="="&&F===0){O=R;break}let w=z?"...":"";if(O!==-1)return`${w}${L} = ${V.substring(O+1).trim()}`;return`${w}${L}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(J,Y,Q)=>{if(!Q.includes(":"))return J;return`${Y}(${X(Q)})`});{let J=/\b(function\s+\w*\s*)\(/g,Y,Q=[];while((Y=J.exec(Z))!==null){let G=Y.index+Y[0].length-1,q=1,W=G+1,K=0,U=null;while(W<Z.length&&q>0){let j=Z[W];if(U){if(j===U)U=null;W++;continue}if(j==='"'||j==="'"||j==="`"){U=j,W++;continue}if(j==="<")K++;else if(j===">"&&K>0)K--;else if(K===0){if(j==="(")q++;else if(j===")")q--}if(q>0)W++}if(q!==0)continue;let z=Z.substring(G+1,W);if(!z.includes(":"))continue;let H=X(z);Q.push({start:G+1,end:W,replacement:H})}for(let G=Q.length-1;G>=0;G--){let{start:q,end:W,replacement:K}=Q[G];Z=Z.substring(0,q)+K+Z.substring(W)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(J,Y)=>{if(!Y.includes(":"))return J;if(Y.includes("{")||Y.includes("}"))return J;return`(${Y.split(",").map((G)=>{let[q,...W]=G.split("="),K=q.split(":")[0].trim();if(W.length>0)return`${K} = ${W.join("=").trim()}`;return K}).join(", ")}) =>`}),Z=Z.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
|
|
@@ -3657,11 +3657,11 @@ ${$[K]}`,K++;else break}return W=W.trim().replace(/;$/,""),{type:Q,name:G,value:
|
|
|
3657
3657
|
${Q}`,Y++}while(Y<$.length){let Q=$[Y].trim();if(Q.startsWith(".")||Q.startsWith("?."))J+=`
|
|
3658
3658
|
${$[Y]}`,Y++;else break}return{value:J,nextIndex:Y}}function Dq($,Z,X){let J=X,Y=Z+1;while(Y<$.length){let Q=S2(J);if(Q!==-1){if(B0(J,"{","}",Q)!==-1)break}let G=$[Y];J+=`
|
|
3659
3659
|
${G}`,Y++}return{functionCode:J,nextIndex:Y}}function M2($,Z){let X=e($,Z)??e(`(${$})`,Z);if(X!==void 0)return X;if(!/\bprocess\b/.test($))return;let J={...Z,process:Object.freeze({env:{...W5.env}})};try{return Function(...Object.keys(J),`'use strict'; return (${$});`)(...Object.values(J))}catch{try{return Function(...Object.keys(J),`'use strict'; return ${$};`)(...Object.values(J))}catch{return}}}async function Nq($,Z,X){let J=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of J){let[,,G,q]=Q;try{let W=q.trim().replace(/;$/,""),K=M2(W,Z);if(K!==void 0)Z[G]=K}catch(W){console.warn(`Failed to parse export ${G} in fallback:`,W)}}let Y=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of Y){let[,,G,q]=Q;if(!(G in Z))try{let W=q.trim().replace(/;$/,""),K=M2(W,Z);if(K!==void 0)Z[G]=K}catch{}}}function Aq($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=Z?Z[1]:"",J=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:X,templateWithoutScript:J}}function Mq($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var y5=new p1(500),g$=new p1(1000),Iq=33554432,l4=new p1(2000,{maxBytes:Iq,sizeOf:($)=>$.output.length});function Tq($){let Z=new WeakSet;try{let X=(J)=>{if(J===void 0)return{__stxType:"undefined"};if(typeof J==="bigint")return{__stxType:"bigint",value:J.toString()};if(typeof J==="function"||typeof J==="symbol")throw TypeError("Non-serializable component input");if(J===null||typeof J!=="object")return J;if(Z.has(J))throw TypeError("Circular component input");if(Z.add(J),J instanceof Date)return{__stxType:"date",value:J.toISOString()};if(Array.isArray(J))return J.map(X);let Y={};for(let Q of Object.keys(J).sort())Y[Q]=X(J[Q]);return Y};return JSON.stringify(X($))}catch{return null}}function C2($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Eq($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function A1($){return!Eq($)}var x$=new Map;function d4($){let Z;try{Z=JSON.stringify($)}catch{return new Bun.Transpiler($)}let X=x$.get(Z);if(X)return X;if(x$.size>=16)x$.clear();let J=new Bun.Transpiler($);return x$.set(Z,J),J}function M1($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let X=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(Q)=>{let G=X.length;return X.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(Q)=>{let G=X.length;return X.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(Q)=>{let G=X.length;return X.push(Q),`"__STX_EXPR_${G}__"`});let Y=d4({loader:"ts",target:"browser",define:Y5()}).transformSync(Z);for(let Q=0;Q<X.length;Q++)Y=Y.replace(`"__STX_EXPR_${Q}__"`,X[Q]),Y=Y.replace(`'__STX_EXPR_${Q}__'`,X[Q]);return Y}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function bq($){let Z=[],X=new Set,J=0,Y=0,Q=$.length,G=(U)=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]===U){Y++;return}Y++}},q=()=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++;return}if($[Y]==="$"&&$[Y+1]==="{"){Y+=2;let U=1;while(Y<Q&&U>0)if($[Y]==="{")U++,Y++;else if($[Y]==="}")U--,Y++;else if($[Y]==="'"||$[Y]==='"')G($[Y]);else if($[Y]==="`")q();else Y++;continue}Y++}},W=()=>{if($[Y]==="/"&&$[Y+1]==="/"){while(Y<Q&&$[Y]!==`
|
|
3660
|
-
`)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<Q-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},K=()=>{if(J!==0)return;let U=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let B=U[2].split(",").map((_)=>{let L=_.trim().split(":");return L[L.length-1].trim()});for(let _ of B)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!X.has(_))Z.push(_),X.add(_);return}let z=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let B=z[2];if(!X.has(B))Z.push(B),X.add(B);return}let H=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!X.has(B))Z.push(B),X.add(B);return}let j=$.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!X.has(B))Z.push(B),X.add(B)}};while(Y<Q){if(W())continue;if($[Y]==="'"||$[Y]==='"'){G($[Y]);continue}if($[Y]==="`"){q();continue}if($[Y]==="{"){J++,Y++;continue}if($[Y]==="}"){J--,Y++;continue}if(J===0&&/[a-z]/i.test($[Y])&&(Y===0||/\s|[;{}()]/.test($[Y-1])))K();Y++}return Z}function yq($){let Z=[],X=0,J=0,Y=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(Y){if(G==="\\"){Q++;continue}if(G===Y)Y=null;continue}if(G==='"'||G==="'"||G==="`"){Y=G;continue}if(G==="("||G==="["||G==="{")X++;else if(G===")"||G==="]"||G==="}")X--;else if(G===","&&X===0)Z.push($.slice(J,Q)),J=Q+1}if(J<$.length)Z.push($.slice(J));return Z}function Sq($){let Z=0,X=null;for(let J=0;J<$.length;J++){let Y=$[J];if(X){if(Y==="\\"){J++;continue}if(Y===X)X=null;continue}if(Y==='"'||Y==="'"||Y==="`"){X=Y;continue}if(Y==="("||Y==="["||Y==="{")Z++;else if(Y===")"||Y==="]"||Y==="}")Z--;else if(Y==="="&&Z===0){let Q=$[J-1],G=$[J+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return J}}return-1}function Cq($,Z){try{let X=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!X)return;let J=X.index-1;while(J>=0&&/\s/.test($[J]))J--;if($[J]!=="}")return;let Y=J,Q=0,G=-1;for(;J>=0;J--){let W=$[J];if(W==="}")Q++;else if(W==="{"){if(Q--,Q===0){G=J;break}}}if(G===-1)return;let q=$.slice(G+1,Y);for(let W of yq(q)){let K=W.trim();if(!K||K.startsWith("..."))continue;let U=Sq(K);if(U===-1)continue;let z=K.slice(0,U).trim();if(!/^[A-Z_$][\w$]*$/i.test(z))continue;if(Z[z]!==void 0)continue;let H=K.slice(U+1).trim();if(!H)continue;try{let j=Object.keys(Z),B=Function(...j,`"use strict"; return (${H});`);Z[z]=B(...j.map((_)=>Z[_]))}catch{}}}catch{}}async function C$($,Z,X,J,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""),q=(L)=>L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),W=X.__importedComponents;if(W){for(let L of[Q,Q.toLowerCase(),G(Q),q(Q)])if(W.has(L))return!0}let K=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${q(Q)}.stx`])],U=typeof Y.root==="string"?h.resolve(Y.root):void 0,z=U??h.dirname(J),H=[],j=(L)=>{if(L&&!H.includes(L))H.push(L)},B=X.__originalFilePath;if(B)j(h.join(h.dirname(B),"components"));if(j(Z),j(Y._rootComponentsDir),j(h.join(h.dirname(J),"components")),j(Y.componentsDir),U)j(h.resolve(U,"resources/views/components")),j(h.resolve(U,"resources/components")),j(h.resolve(U,"src/components")),j(h.resolve(U,"components"));let _=Y._pluginComponentDirs;if(Array.isArray(_))for(let L of _)j(typeof L==="string"?L:null);if(j(Y.fallbackComponentsDir),Q.startsWith("./")||Q.startsWith("../"))return t(h.resolve(h.dirname(J),`${Q}.stx`));for(let L of H){let V=h.isAbsolute(L)?L:h.resolve(z,L);for(let O of K)if(await t(h.join(V,O)))return!0}return!1}function Pq($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function vq($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function fq($){let Z=new Set,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let J of $){let Y;while((Y=X.exec(J))!==null)Z.add(Y[1]);X.lastIndex=0}return[...Z]}async function I1($,Z,X,J,Y,Q,G,q=new Set,W){let{extractVariables:K}=await o("stx/variable-extractor",()=>import("./chunk-
|
|
3660
|
+
`)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<Q-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},K=()=>{if(J!==0)return;let U=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let B=U[2].split(",").map((_)=>{let L=_.trim().split(":");return L[L.length-1].trim()});for(let _ of B)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!X.has(_))Z.push(_),X.add(_);return}let z=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let B=z[2];if(!X.has(B))Z.push(B),X.add(B);return}let H=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!X.has(B))Z.push(B),X.add(B);return}let j=$.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!X.has(B))Z.push(B),X.add(B)}};while(Y<Q){if(W())continue;if($[Y]==="'"||$[Y]==='"'){G($[Y]);continue}if($[Y]==="`"){q();continue}if($[Y]==="{"){J++,Y++;continue}if($[Y]==="}"){J--,Y++;continue}if(J===0&&/[a-z]/i.test($[Y])&&(Y===0||/\s|[;{}()]/.test($[Y-1])))K();Y++}return Z}function yq($){let Z=[],X=0,J=0,Y=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(Y){if(G==="\\"){Q++;continue}if(G===Y)Y=null;continue}if(G==='"'||G==="'"||G==="`"){Y=G;continue}if(G==="("||G==="["||G==="{")X++;else if(G===")"||G==="]"||G==="}")X--;else if(G===","&&X===0)Z.push($.slice(J,Q)),J=Q+1}if(J<$.length)Z.push($.slice(J));return Z}function Sq($){let Z=0,X=null;for(let J=0;J<$.length;J++){let Y=$[J];if(X){if(Y==="\\"){J++;continue}if(Y===X)X=null;continue}if(Y==='"'||Y==="'"||Y==="`"){X=Y;continue}if(Y==="("||Y==="["||Y==="{")Z++;else if(Y===")"||Y==="]"||Y==="}")Z--;else if(Y==="="&&Z===0){let Q=$[J-1],G=$[J+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return J}}return-1}function Cq($,Z){try{let X=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!X)return;let J=X.index-1;while(J>=0&&/\s/.test($[J]))J--;if($[J]!=="}")return;let Y=J,Q=0,G=-1;for(;J>=0;J--){let W=$[J];if(W==="}")Q++;else if(W==="{"){if(Q--,Q===0){G=J;break}}}if(G===-1)return;let q=$.slice(G+1,Y);for(let W of yq(q)){let K=W.trim();if(!K||K.startsWith("..."))continue;let U=Sq(K);if(U===-1)continue;let z=K.slice(0,U).trim();if(!/^[A-Z_$][\w$]*$/i.test(z))continue;if(Z[z]!==void 0)continue;let H=K.slice(U+1).trim();if(!H)continue;try{let j=Object.keys(Z),B=Function(...j,`"use strict"; return (${H});`);Z[z]=B(...j.map((_)=>Z[_]))}catch{}}}catch{}}async function C$($,Z,X,J,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""),q=(L)=>L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),W=X.__importedComponents;if(W){for(let L of[Q,Q.toLowerCase(),G(Q),q(Q)])if(W.has(L))return!0}let K=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${q(Q)}.stx`])],U=typeof Y.root==="string"?h.resolve(Y.root):void 0,z=U??h.dirname(J),H=[],j=(L)=>{if(L&&!H.includes(L))H.push(L)},B=X.__originalFilePath;if(B)j(h.join(h.dirname(B),"components"));if(j(Z),j(Y._rootComponentsDir),j(h.join(h.dirname(J),"components")),j(Y.componentsDir),U)j(h.resolve(U,"resources/views/components")),j(h.resolve(U,"resources/components")),j(h.resolve(U,"src/components")),j(h.resolve(U,"components"));let _=Y._pluginComponentDirs;if(Array.isArray(_))for(let L of _)j(typeof L==="string"?L:null);if(j(Y.fallbackComponentsDir),Q.startsWith("./")||Q.startsWith("../"))return t(h.resolve(h.dirname(J),`${Q}.stx`));for(let L of H){let V=h.isAbsolute(L)?L:h.resolve(z,L);for(let O of K)if(await t(h.join(V,O)))return!0}return!1}function Pq($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function vq($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function fq($){let Z=new Set,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let J of $){let Y;while((Y=X.exec(J))!==null)Z.add(Y[1]);X.lastIndex=0}return[...Z]}async function I1($,Z,X,J,Y,Q,G,q=new Set,W){let{extractVariables:K}=await o("stx/variable-extractor",()=>import("./chunk-f68eb80q.js")),U=q??new Set;if(U.has($))return`[Circular component reference: ${$}]`;let z=new Set(U);z.add($);let H=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let j=H&&H!=="load"&&Pq(H)?H:"";try{let B=(u)=>u.split("-").map((m)=>m.charAt(0).toUpperCase()+m.slice(1)).join(""),_=(u)=>u.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=$.endsWith(".stx")?$.slice(0,-4):$,V=null,O=Y.__importedComponents;if(O){let u=[L,L.toLowerCase(),B(L),_(L)];for(let m of u)if(O.has(m)){V=O.get(m);break}}let F=[];if(!V){let u=[`${L}.stx`,`${B(L)}.stx`,`${_(L)}.stx`],m=[...new Set(u)],U0=Y.__originalFilePath,n=[];if(U0){let L0=h.join(h.dirname(U0),"components");n.push(L0)}if(J)n.push(J);let O0=G._rootComponentsDir;if(typeof O0==="string"&&!n.includes(O0))n.push(O0);let F0=h.join(h.dirname(Q),"components");if(!n.includes(F0))n.push(F0);if(G.componentsDir&&G.componentsDir!==J&&!n.includes(G.componentsDir))n.push(G.componentsDir);let v0=typeof G.root==="string"?h.resolve(G.root):void 0,V1=v0??h.dirname(Q),b0=[];if(v0)b0.push(h.resolve(v0,"resources/views/components")),b0.push(h.resolve(v0,"resources/components")),b0.push(h.resolve(v0,"src/components")),b0.push(h.resolve(v0,"components"));b0.push(h.resolve(import.meta.dir,"components"));for(let L0 of b0)if(!n.includes(L0))n.push(L0);let s=G._pluginComponentDirs;if(Array.isArray(s)){for(let L0 of s)if(typeof L0==="string"&&!n.includes(L0))n.push(L0)}if(G.fallbackComponentsDir&&!n.includes(G.fallbackComponentsDir))n.push(G.fallbackComponentsDir);let l0=[...new Set(n.map((L0)=>{if(!L0)return L0;return h.isAbsolute(L0)?L0:h.resolve(V1,L0)}))];n.length=0,n.push(...l0);let v5=`${L}\x00${Q}\x00${l0.join("\x00")}`,h$=g$.get(v5);if(h$)if(await t(h$))V=h$;else g$.delete(v5);if(!V&&(L.startsWith("./")||L.startsWith("../")))V=h.resolve(h.dirname(Q),`${L}.stx`),F.push(V);else if(!V)for(let L0 of n){if(!L0)continue;for(let f5 of m){let x5=h.join(L0,f5);if(F.push(x5),await t(x5)){V=x5;break}}if(V)break;if(!V)try{let f5=await import("fs");if(!f5.statSync(L0,{throwIfNoEntry:!1})?.isDirectory())continue;let i2=8,u$=[{path:L0,depth:0}];while(u$.length>0&&!V){let g5=u$.pop();if(g5.depth>=i2)continue;let n4;try{n4=f5.readdirSync(g5.path,{withFileTypes:!0})}catch{continue}for(let h5 of n4){if(!h5.isDirectory())continue;if(h5.name==="node_modules"||h5.name.startsWith("."))continue;let s4=h.join(g5.path,h5.name);for(let n2 of m){let d$=h.join(s4,n2);if(F.push(d$),await t(d$)){V=d$;break}}if(V)break;u$.push({path:s4,depth:g5.depth+1})}}}catch{}if(V)break}if(V)g$.set(v5,V)}if(!V||!await t(V)){let u=F.length>0?`
|
|
3661
3661
|
Searched paths:
|
|
3662
3662
|
${F.map((m)=>` - ${m}`).join(`
|
|
3663
|
-
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${u}`}W.add(V);let w;if(y5.has(V))w=y5.get(V);else try{w=await Bun.file(V).text(),y5.set(V,w)}catch(u){return`[Error loading component: ${u instanceof Error?u.message:String(u)}]`}let R=new Set(["__originalFilePath","__importedComponents",u5,"__stx_client_signal_names","__stxServeContext","__stx_scope_seq"]),D={};for(let[u,m]of Object.entries(Y))if(!u.startsWith("__")||R.has(u))D[u]=m;let A=X;if(X.includes("@include")){let{processIncludes:u}=await o("stx/includes",()=>import("./chunk-
|
|
3664
|
-
`)}`}if(X&&G0.includes("{{ text || slot }}"))G0=G0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>X);let{applySlots:N0}=await o("stx/slots",()=>import("./chunk-
|
|
3663
|
+
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${u}`}W.add(V);let w;if(y5.has(V))w=y5.get(V);else try{w=await Bun.file(V).text(),y5.set(V,w)}catch(u){return`[Error loading component: ${u instanceof Error?u.message:String(u)}]`}let R=new Set(["__originalFilePath","__importedComponents",u5,"__stx_client_signal_names","__stxServeContext","__stx_scope_seq"]),D={};for(let[u,m]of Object.entries(Y))if(!u.startsWith("__")||R.has(u))D[u]=m;let A=X;if(X.includes("@include")){let{processIncludes:u}=await o("stx/includes",()=>import("./chunk-cp0dnekw.js"));A=await u(X,Y,Q,G,W)}let k=r0(A),N=[],M=k.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(u,m)=>{let U0=k.scripts[Number(m)]||"",n=U0.match(/^<script\b([^>]*)>/i)?.[1]||"",O0=n.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),F0=!O0||["module","text/javascript","application/javascript"].includes(O0);if(!/\bserver\b/i.test(n)&&F0)return N.push(U0),"";return U0}),{extractSlotContent:T}=await o("stx/slots",()=>import("./chunk-ner93kgx.js")),I=T(M),C={};if(I.defaultSlot?.trim())C.default=I.defaultSlot;for(let[u,m]of I.namedSlots)C[u]=m.content;let E=Y.__stx_scope_seq??={n:0,key:Bun.hash(String(Y.__filename??Q)).toString(36).slice(0,6)},b=`stx_${L.replace(/[^a-zA-Z0-9]/g,"_")}_${++E.n}_${E.key}`,y={...D,$uid:b,...Z,props:Z,slot:M,$slots:C,__processedComponents:z,__sections:{},__stx_signals_gate:G1(w)||vq(X)};Cq(w,y);let P=w,f=V$(P);if(f)P=f.content.trim();let d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g=[...w.matchAll(d)],Q0=[],e0=g.some((u)=>/\bserver\b/.test(u[1]||"")&&/\bcache\b/.test(u[1]||"")),k0=null,C0=null,X0=null,H0=0,I0=null;if(e0){let u=Tq({props:Z,slot:X,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0,uid:b});if(u!==null){k0=`${V}\x00${b1(w)}\x00${u}`;let m=l4.get(k0);if(m){for(let U0 of m.dependencies)W.add(U0);if(G7(Y,m.clientFactories),E.n+=m.uidsConsumed,m.preservedClientExpressions.length>0){let U0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let n of m.preservedClientExpressions)U0.add(n);Y.__stx_preserved_client_expressions=[...U0]}return m.output}C0=new Set(W),X0=Y7(Y),H0=E.n,I0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[])}}for(let u of g){let m=u[1]||"",U0=u[2]||"",n=m.includes("server");if(A1(m)&&U0.trim())U0=M1(U0);if(n&&U0)try{await K(U0,y,V)}catch(F0){}if(!n){let F0=U0.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),v0=F0.includes("{{")&&F0.includes("}}"),V1=F0.includes("{!!")&&F0.includes("!!}");if(v0||V1)F0=n$(F0,y);let b0=m.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Q0.push(`<script${b0}>${F0}</script>`)}}let E0=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),m0=E0?E0[1]:"",p=E0?E0[2]:"",i="",K0=m0&&/\bscoped\b/i.test(m0);if(E0)i=`<style${m0}>${p}</style>`;let G0=P;if(G0=G0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),E0)G0=G0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let u=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,m=[];if(G0=G0.replace(u,(U0,n)=>{let O0=n.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(O0)m.push(`<style${O0[1]}>${O0[2]}</style>`);return""}),G0=G0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),m.length>0)i=`${i}${m.join(`
|
|
3664
|
+
`)}`}if(X&&G0.includes("{{ text || slot }}"))G0=G0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>X);let{applySlots:N0}=await o("stx/slots",()=>import("./chunk-ner93kgx.js")),{defaultSlot:P0,namedSlots:K5}=I;G0=await N0(G0,P0,K5,y);let C5=Q0.some((u)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(u)),P5=fq(Q0),S=Array.isArray(y.__stx_client_signal_names)?y.__stx_client_signal_names:[];if(P5.length>0||S.length>0)y.__stx_client_signal_names=[...new Set([...S,...P5])];let v={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:h.dirname(V),skipSignalsRuntime:!0,skipEventDirectives:C5||Q0.length===0,defaultLayout:void 0};y.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let r=await h4(G0,y,V,v,W),a=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let u of r.matchAll(/\{\{([\s\S]*?)\}\}/g))a.add(u[1].trim());if(a.size>0)Y.__stx_preserved_client_expressions=[...a];let J0=b,Y0=r;if(C5){let u="";if(Object.keys(Z).length>0)try{u=` data-stx-props="${C2(JSON.stringify(Z))}"`}catch{}let m=j?` stx-hydrate="${C2(j)}"`:"";Y0=`<div data-stx-scope="${J0}"${u}${m}>${r}</div>`;let U0=await Promise.all(Q0.map(async(n)=>{let O0=n.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!O0)return n;let[,F0,v0]=O0,{vendorStyleTags:V1,factoryBody:b0}=await hq(v0,V,G.buildMode==="compile"),s=j?null:c$(Y,b0),l0=s?`window.__stxComponentFactories[${JSON.stringify(s)}](${JSON.stringify(J0)});`:`(${b0})(${JSON.stringify(J0)});`;if(j)return`${V1}<script type="stx/island" data-stx-island="${J0}" data-stx-scoped${F0}>${l0}</script>`;return`${V1}<script data-stx-scoped data-stx-run="always"${F0}>${l0}</script>`}));if(Y0=Y0+`
|
|
3665
3665
|
`+U0.join(`
|
|
3666
3666
|
`),i)Y0+=`
|
|
3667
3667
|
`+i}else{if(i)Y0+=`
|
|
@@ -3684,7 +3684,7 @@ ${Z0.yellow}${Z0.bold}Message:${Z0.reset} ${Z}
|
|
|
3684
3684
|
`,q)U+=`
|
|
3685
3685
|
${Z0.blue}${Z0.bold}Context:${Z0.reset}
|
|
3686
3686
|
${Z0.dim}${q}${Z0.reset}
|
|
3687
|
-
`;return U}function KO(){y5.clear(),g$.clear(),l4.clear()}function UO(){return{size:y5.size,maxSize:500}}var m4=G5(128);async function hq($,Z,X){let J=b1($,Z,X),Y=m4.get(J);if(Y){if(f2(Y.deps))return Y;m4.delete(J)}let Q=p4($,{filePath:Z,projectRoot:process.cwd()}),G=Q.code,q=i4(Q.styles);G=r1(G).code;let{hasUserImports:W,bundleClientScript:K}=await o("stx/client-script-bundler",()=>import("./chunk-
|
|
3687
|
+
`;return U}function KO(){y5.clear(),g$.clear(),l4.clear()}function UO(){return{size:y5.size,maxSize:500}}var m4=G5(128);async function hq($,Z,X){let J=b1($,Z,X),Y=m4.get(J);if(Y){if(f2(Y.deps))return Y;m4.delete(J)}let Q=p4($,{filePath:Z,projectRoot:process.cwd()}),G=Q.code,q=i4(Q.styles);G=r1(G).code;let{hasUserImports:W,bundleClientScript:K}=await o("stx/client-script-bundler",()=>import("./chunk-vrx2rq5x.js")),U=[],z=!1;if(W(G)){let V=G;G=await K(V,Z,{projectRoot:process.cwd(),minify:X,collectInputs:U}),z=G===V}let{stripStxRuntimeImports:H}=await o("stx/signal-processing",()=>import("./chunk-sevgcxxp.js"));G=H(G);let j=$1(G),B=bq(j),_=`function(__scopeId) {
|
|
3688
3688
|
${c1("const",[...P2,...B],j)}
|
|
3689
3689
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
3690
3690
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
@@ -3783,7 +3783,7 @@ else {
|
|
|
3783
3783
|
// STX: auto-generated event bindings
|
|
3784
3784
|
${$.map((X,J)=>XW(X,J)).join(`
|
|
3785
3785
|
`)}`}function u2($){let Z=[],X=new Set,J=$.replace(/^\s*import\s+.*$/gm,""),Y=0,Q=J.length,G=0;while(G<Q){let q=J[G];if(q==="'"||q==='"'||q==="`"){let W=q;if(G++,W==="`"){let K=0;while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]==="`"&&K===0){G++;break}if(J[G]==="$"&&J[G+1]==="{"){K++,G+=2;continue}if(J[G]==="}"&&K>0){K--,G++;continue}G++}}else while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]===W){G++;break}G++}continue}if(q==="/"&&J[G+1]==="/"){while(G<Q&&J[G]!==`
|
|
3786
|
-
`)G++;continue}if(q==="/"&&J[G+1]==="*"){G+=2;while(G<Q-1&&!(J[G]==="*"&&J[G+1]==="/"))G++;G+=2;continue}if(q==="{"){Y++,G++;continue}if(q==="}"){Y--,G++;continue}if(Y===0){let W=J.slice(G),K=W.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(K){let H=K[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=K[0].length;continue}let U=W.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[1].split(",").forEach((H)=>{let j=H.trim(),B=j.indexOf(":"),_=B>=0?j.slice(B+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!X.has(_))Z.push(_),X.add(_)}),G+=U[0].length;continue}let z=W.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(z){let H=z[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=z[0].length;continue}}G++}return Z}var YW=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function QW($){let Z=new Set,X=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function J(H){let j;while((j=X.exec(H))!==null){let B=j[0];if(!YW.has(B))Z.add(B)}}let Y=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=Y.exec($))!==null)J(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)J(Q[1]);let q=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)J(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=W.exec($))!==null)J(Q[1]);let K=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=K.exec($))!==null)J(Q[1]);let U=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=U.exec($))!==null)J(Q[1]);let z=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=z.exec($))!==null)J(Q[1]);return Z}async function f$($,Z={}){let X=$,J="",Y=!1,Q=[],G=p4(X,{filePath:Z.filePath,projectRoot:Z.projectRoot});X=G.code;let q=i4(G.styles),W=r1(X);X=W.code,Q=[...W.imports,...W.models];let{hasUserImports:K,bundleClientScript:U}=await o("stx/client-script-bundler",()=>import("./chunk-
|
|
3786
|
+
`)G++;continue}if(q==="/"&&J[G+1]==="*"){G+=2;while(G<Q-1&&!(J[G]==="*"&&J[G+1]==="/"))G++;G+=2;continue}if(q==="{"){Y++,G++;continue}if(q==="}"){Y--,G++;continue}if(Y===0){let W=J.slice(G),K=W.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(K){let H=K[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=K[0].length;continue}let U=W.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[1].split(",").forEach((H)=>{let j=H.trim(),B=j.indexOf(":"),_=B>=0?j.slice(B+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!X.has(_))Z.push(_),X.add(_)}),G+=U[0].length;continue}let z=W.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(z){let H=z[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=z[0].length;continue}}G++}return Z}var YW=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function QW($){let Z=new Set,X=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function J(H){let j;while((j=X.exec(H))!==null){let B=j[0];if(!YW.has(B))Z.add(B)}}let Y=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=Y.exec($))!==null)J(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)J(Q[1]);let q=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)J(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=W.exec($))!==null)J(Q[1]);let K=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=K.exec($))!==null)J(Q[1]);let U=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=U.exec($))!==null)J(Q[1]);let z=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=z.exec($))!==null)J(Q[1]);return Z}async function f$($,Z={}){let X=$,J="",Y=!1,Q=[],G=p4(X,{filePath:Z.filePath,projectRoot:Z.projectRoot});X=G.code;let q=i4(G.styles),W=r1(X);X=W.code,Q=[...W.imports,...W.models];let{hasUserImports:K,bundleClientScript:U}=await o("stx/client-script-bundler",()=>import("./chunk-vrx2rq5x.js"));if(K(X))X=await U(X,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Y=!0;if(Z.autoImports!==!1){let O=c2(X);X=O.code,J=p2(O.stxImports,O.browserImports.filter((F)=>!Q.includes(F)))}if(J=`${B4(X,Z.serverData)}${J}`,X=$1(X),!Y&&A1(Z.attrs||""))X=M1(X);let z=JW(Z.eventBindings||[]),H=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(H)){let O=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${O?` ${O}`:""}`;return`${q}<script ${F}>
|
|
3787
3787
|
${o1(`${J}${X}
|
|
3788
3788
|
${z}`)}
|
|
3789
3789
|
</script>`}let B=m2($),_=/function __stx_setup_/.test(X),L=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function V(O){let F=O.length>0?`
|