@stacksjs/stx 0.2.383 → 0.2.385
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-pft07e5a.js → chunk-0bsr2bc9.js} +1 -1
- package/dist/{chunk-wqgdhbkz.js → chunk-0k1g666f.js} +1 -1
- package/dist/{chunk-rg89je2f.js → chunk-2egh74rh.js} +1 -1
- package/dist/{chunk-tmw26m02.js → chunk-2gtwsyyc.js} +1 -1
- package/dist/{chunk-3edgxt8n.js → chunk-2qqc4btz.js} +1 -1
- package/dist/{chunk-qe46ye0t.js → chunk-4a8wet24.js} +37 -20
- package/dist/{chunk-7336vb71.js → chunk-4wr5khha.js} +1 -1
- package/dist/{chunk-28jfhc2j.js → chunk-51v42enn.js} +1 -1
- package/dist/{chunk-hxfbv1v6.js → chunk-5rxfqxw1.js} +1 -1
- package/dist/{chunk-trcv8bvh.js → chunk-6en9gsg5.js} +1 -1
- package/dist/{chunk-gwy5my1m.js → chunk-6tsepxj2.js} +1 -1
- package/dist/{chunk-ps1pq5v7.js → chunk-74pnrjrh.js} +1 -1
- package/dist/{chunk-zwrghd9f.js → chunk-7e31d2d9.js} +1 -1
- package/dist/{chunk-ymyk7xch.js → chunk-7zwkhc9z.js} +1 -1
- package/dist/{chunk-c60bg3z2.js → chunk-864b6wcd.js} +2 -2
- package/dist/{chunk-8b287f0x.js → chunk-9tsdve0c.js} +1 -1
- package/dist/{chunk-6ad7dac2.js → chunk-c30z8jtq.js} +2 -2
- package/dist/{chunk-j22j7m9a.js → chunk-d5h4fq9g.js} +1 -1
- package/dist/{chunk-wbmfa418.js → chunk-daqc7qct.js} +1 -1
- package/dist/{chunk-jfa1x5kd.js → chunk-dpk10wzg.js} +1 -1
- package/dist/{chunk-tyvjhv8y.js → chunk-dwk6afax.js} +1 -1
- package/dist/chunk-e686ewmg.js +2 -0
- package/dist/{chunk-bxw0wt46.js → chunk-eexraz9d.js} +2 -2
- package/dist/{chunk-g9v33v1p.js → chunk-er75fpqj.js} +1 -1
- package/dist/{chunk-jvvzfkt5.js → chunk-gaghjpf3.js} +1 -1
- package/dist/{chunk-bg80g9fa.js → chunk-hgwwpgkn.js} +1 -1
- package/dist/{chunk-fj8t66gj.js → chunk-hr42tde6.js} +1 -1
- package/dist/{chunk-sznpcx4x.js → chunk-jz660eaa.js} +1 -1
- package/dist/{chunk-hktafars.js → chunk-k4f1jwfy.js} +1 -1
- package/dist/{chunk-prvv9a6j.js → chunk-kddj8m3q.js} +2 -2
- package/dist/chunk-kf7mza0j.js +2 -0
- package/dist/{chunk-hv0mawrp.js → chunk-kmbt6knb.js} +1 -1
- package/dist/{chunk-jr34z16t.js → chunk-ndnk50mc.js} +1 -1
- package/dist/{chunk-hzkh5p1g.js → chunk-pefddsqn.js} +1 -1
- package/dist/{chunk-k6wh31tq.js → chunk-pr1spkdp.js} +1 -1
- package/dist/{chunk-8g3gz84z.js → chunk-rck90601.js} +1 -1
- package/dist/{chunk-zevtf8zn.js → chunk-s8wvhby3.js} +1 -1
- package/dist/{chunk-gnrmbthh.js → chunk-sr3f7gk2.js} +1 -1
- package/dist/{chunk-kj9c5ekg.js → chunk-tj7wpqnm.js} +1 -1
- package/dist/{chunk-vp334dmv.js → chunk-trnwjst0.js} +1 -1
- package/dist/{chunk-pkyyjb0s.js → chunk-vj19hasp.js} +17 -17
- package/dist/{chunk-gthsda4k.js → chunk-vsjx1fe3.js} +1 -1
- package/dist/{chunk-daj371qf.js → chunk-x05ycjc4.js} +9 -9
- package/dist/{chunk-xnq6vy47.js → chunk-x3j8w3g8.js} +1 -1
- package/dist/{chunk-hjazykjp.js → chunk-x9xcmaef.js} +1 -1
- package/dist/{chunk-nq4r5zvt.js → chunk-xn3pwe6e.js} +1 -1
- package/dist/{chunk-2bfza2sf.js → chunk-xr9cxkxp.js} +1 -1
- package/dist/{chunk-vhrta9ff.js → chunk-xvp7ye5d.js} +1 -1
- package/dist/{chunk-j4bgqy2d.js → chunk-y2zrdxg3.js} +1 -1
- package/dist/{chunk-wmdjr6s6.js → chunk-yswz2ze7.js} +1 -1
- package/dist/{chunk-hf0gsv8c.js → chunk-yx5ct9vx.js} +1 -1
- package/dist/cli.js +7 -7
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/pwa.js +1 -1
- package/dist/server-bindings.js +2 -2
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-0x51h671.js +0 -2
- package/dist/chunk-zpe4s4ng.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{_r as r8,cs as a8,ms as p4,ns as i4}from"./chunk-21ev9jk2.js";import{ss as Q0,ts as q2}from"./chunk-zn9v6jpb.js";import{vs as r4,ws as a4,xs as H9,ys as U9}from"./chunk-vbyxgwz5.js";import{Es as z9}from"./chunk-38ykv2gd.js";import{Js as r1,Ks as N1,Ls as $Z,Ms as S1,Os as U1,Ps as QJ,Qs as GJ,Rs as U2,Ss as J9,Ts as y9,Us as g2,Vs as S8,Ws as w8,Xs as O1,Ys as f0,Zs as B2,bt as ZZ,ct as c9,pt as JZ}from"./chunk-
|
|
2
|
+
import{_r as r8,cs as a8,ms as p4,ns as i4}from"./chunk-21ev9jk2.js";import{ss as Q0,ts as q2}from"./chunk-zn9v6jpb.js";import{vs as r4,ws as a4,xs as H9,ys as U9}from"./chunk-vbyxgwz5.js";import{Es as z9}from"./chunk-38ykv2gd.js";import{Js as r1,Ks as N1,Ls as $Z,Ms as S1,Os as U1,Ps as QJ,Qs as GJ,Rs as U2,Ss as J9,Ts as y9,Us as g2,Vs as S8,Ws as w8,Xs as O1,Ys as f0,Zs as B2,bt as ZZ,ct as c9,pt as JZ}from"./chunk-xr9cxkxp.js";import{qt as n4,st as s4,tt as o4,vt as R2}from"./chunk-h3r7wcxk.js";import{Ct as S7,Dt as P7,xt as E7,yt as y7,zt as b7}from"./chunk-veky1cte.js";import{It as p9}from"./chunk-5rxfqxw1.js";import{Kt as uZ,Lt as mZ,Mt as dZ,Nt as lZ,Ot as cZ,Qt as e8}from"./chunk-cwba6q7v.js";import{Rt as QZ,St as GZ,Tt as zZ,Ut as KZ,Vt as t4,Wt as e4}from"./chunk-hyzjprnz.js";import{bu as m5,cu as M0,eu as d5,fu as V7,hu as L7,ou as XZ,su as pZ,uu as iZ}from"./chunk-wk6xx6zz.js";import{$u as u2,Ku as D0,Su as h2,Vu as n8,Xu as N0,av as s8,cv as o0,dv as o8,kv as c3,lv as w6,nv as X0,ov as B0,pv as d0,qv as E9,rv as z2,sv as U0,tv as b9}from"./chunk-ha0a1hpx.js";import{uv as e0}from"./chunk-zxfejz72.js";import{xv as YZ}from"./chunk-25tfm9t5.js";import{Av as YJ,Bv as o1,Fv as UJ,Gv as N3,Hv as _8,Jv as e7,Mv as z6,yv as p3,zv as Q2}from"./chunk-aa8015mk.js";import{Bw as t8,Dw as cz,Ew as R5,Hw as O2,aw as c$,dw as X8,kw as b$}from"./chunk-4a8wet24.js";import{Mw as $7}from"./chunk-rtfwn4cm.js";import{Ow as S2,Pw as l3,Qw as P2,Rw as q5}from"./chunk-efyskaw7.js";import{Vw as x}from"./chunk-wjbfget1.js";import v1 from"path";import p2 from"fs";var _J=new Set(["touchstart","touchmove","wheel","mousewheel"]);function J5($,Z){if(Z.passive)return!0;if(Z.prevent||Z.nonpassive)return!1;return _J.has($.toLowerCase())}var _3=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"]),w3={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"},wJ=new Set(["ctrl","alt","shift","meta"]),M3={left:0,middle:1,right:2};function R3($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let J of $){let X=J.toLowerCase();if(X==="prevent")Z.prevent=!0;else if(X==="stop")Z.stop=!0;else if(X==="once")Z.once=!0;else if(X==="capture")Z.capture=!0;else if(X==="self")Z.self=!0;else if(X==="passive")Z.passive=!0;else if(X==="nonpassive")Z.nonpassive=!0;else if(wJ.has(X))Z.systemKeys.push(X);else if(X in M3)Z.mouse=X;else if(X in w3||/^[a-z]$/.test(X))Z.keys.push(w3[X]||X.toUpperCase());else if(X.startsWith("debounce")){let Y=X.match(/debounce(?:\.(\d+))?/);Z.debounce=Y?.[1]?Number.parseInt(Y[1],10):300}else if(X.startsWith("throttle")){let Y=X.match(/throttle(?:\.(\d+))?/);Z.throttle=Y?.[1]?Number.parseInt(Y[1],10):300}}return Z}function A3($,Z=""){let J=[],X=0,Y=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Q;while((Q=Y.exec($))!==null){let[G,z,K]=Q,q=Q.index,W=q+G.length,H=`__stx_evt_${Z}${X++}`,U=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,B;while((B=j.exec(K))!==null){let[,F,O]=B,_=F.split("."),L=_[0];if(!_3.has(L))continue;U.push({attribute:`@${F}`,event:L,handler:O,modifiers:R3(_.slice(1)),elementId:H})}let V=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=V.exec(K))!==null){let[,F,O]=B,_=F.split("."),L=_[0];if(!_3.has(L))continue;U.push({attribute:`@${F}`,event:L,handler:O,modifiers:R3(_.slice(1)),elementId:H})}if(U.length>0)J.push({originalTag:G,elementId:H,events:U,startIndex:q,endIndex:W})}return J}function RJ($){let Z=[],{modifiers:J}=$;if(J.self)Z.push("if ($event.target !== $el) return");for(let X of J.systemKeys)Z.push(`if (!$event.${X}Key) return`);if(J.keys.length>0){let X=J.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");Z.push(`if (!(${X})) return`)}if(J.mouse!==null){let X=M3[J.mouse];Z.push(`if ($event.button !== ${X}) return`)}if(J.prevent)Z.push("$event.preventDefault()");if(J.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function DJ($,Z){let J=$;if(Z.debounce!==null)J=`__stx_debounce(() => { ${J} }, ${Z.debounce})`;else if(Z.throttle!==null)J=`__stx_throttle(() => { ${J} }, ${Z.throttle})`;return J}function X5($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function NJ($){let{modifiers:Z}=$,J=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=RJ($),Y=DJ(X5($.handler),Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(J5($.event,Z))Q.push("passive: true");let G=Q.length>0?`, { ${Q.join(", ")} }`:"",z=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('${J}');
|
|
5
5
|
if (!$el) return;
|
|
@@ -3167,7 +3167,7 @@ ${W}
|
|
|
3167
3167
|
customElements.define('${Z}', ${G});
|
|
3168
3168
|
`}async function l4($,Z,J,X){if(Z.length<1)return N0("WebComponent","@webcomponent directive requires at least the tag name parameter",D0.INVALID_DIRECTIVE_SYNTAX);let Y=Z[0].replace(/['"]/g,""),G=(J.__stx_options||{}).componentsDir||"components",z=g0.isAbsolute(G)?[g0.join(G,`${Y}.stx`),g0.join(g0.dirname(X),`${Y}.stx`)]:[g0.join(g0.dirname(X),G,`${Y}.stx`),g0.join(process.cwd(),G,`${Y}.stx`),g0.join(g0.dirname(X),`${Y}.stx`)],K=null;for(let H of z)if(await e(H)){K=await Bun.file(H).text();break}if(!K)return N0("WebComponent",`Component file not found: ${Y}.stx`,D0.FILE_NOT_FOUND);let q=VY(K,Y);return`<script type="module">
|
|
3169
3169
|
${LY(q)}
|
|
3170
|
-
</script>`}var v5={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:n4,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:D4,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:l4,hasEndTag:!1,description:"Include a web component in the template"},p4,i4,t4,e4,V5,O5,F5,L5,F4,z4,P4,C5,...$7],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,scrollRestoration:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function FY($,Z,J){let X=Z||"pages";if($)return{root:$,pagesDir:X};let Y=J||process.cwd(),Q=P0.join(Y,"resources","views"),G=P0.join(Y,"resources","layouts");if(j9.existsSync(Q)&&j9.existsSync(G))return{root:"resources",pagesDir:"views"};let z=P0.join(Y,"resources","views","pages");if(j9.existsSync(z))return{root:"resources/views",pagesDir:X};return{root:".",pagesDir:X}}var c4=new Set,B9=["partialsDir","componentsDir","layoutsDir"],x5=new WeakMap;function _Y($,Z){let J=Z.replace(/[\\/]+$/,"");if(!J||J===".")return!0;let X=$.replace(/\\/g,"/"),Y=J.replace(/\\/g,"/");return X===Y||X.startsWith(`${Y}/`)}function wY($,Z){let J=!$.root,X=FY($.root,$.pagesDir,Z);if($.root=X.root,$.pagesDir=X.pagesDir,J&&X.root!=="."){let Y=`${Z}::${X.root}`;if(!c4.has(Y))c4.add(Y),console.warn(`[stx] No "root" in config \u2014 inferred "${X.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!x5.has($)){let Y={};for(let Q of B9){let G=$[Q];if(typeof G==="string"&&G)Y[Q]=G}x5.set($,Y)}if($.root&&$.root!=="."){let Y=$.root;for(let Q of B9){let G=$[Q];if(typeof G!=="string"||!G)continue;if(P0.isAbsolute(G)||_Y(G,Y))continue;$[Q]=P0.join(Y,G)}}for(let Y of B9){let Q=$[Y];if(typeof Q!=="string"||!Q||P0.isAbsolute(Q))continue;$[Y]=P0.resolve(Z,Q)}return $}function RY($,Z){let J=x5.get($);for(let X of B9){let Y=$[X];if(typeof Y!=="string"||!Y)continue;let Q=P0.isAbsolute(Y)?Y:P0.join(Z,Y);if(j9.existsSync(Q))continue;let G=J?.[X]??Y,z=$.root,K=!!z&&z!==".";console.warn(`[stx] ${String(X)} resolves to "${Q}", which does not exist. Configured as "${G}"`+(K?`, resolved under root "${z}".`:"."))}}function DY($){if($.customDirectives)$.customDirectives=[...$.customDirectives];if($.middleware)$.middleware=[...$.middleware];if($.apiRoutes)$.apiRoutes={...$.apiRoutes}}function NY($){if(s4($.stateDir),$.stateDir=o4(),$.cachePath=R2($.cachePath),$.build)$.build.cacheDir=R2($.build.cacheDir);if($.media?.cache)$.media.cache.directory=R2($.media.cache.directory);if($.story)$.story.outDir=R2($.story.outDir)}var G1=null,w1=new Map,W9=new Map,D2=null;async function f5($){let Z=$?P0.resolve($):process.cwd(),J=W9.get(Z);if(J&&J.signature!==H9(J.graph)){let Q=w1.get(Z);if(w1.delete(Z),W9.delete(Z),!$)G1=null,D2=null;let{clearComponentCache:G}=await import("./chunk-gthsda4k.js"),{partialsCache:z}=await import("./chunk-j22j7m9a.js");if(G(),z.clear(),Q&&J.configSignature===U9(J.graph)){let K=Q.then(async(q)=>{let W={...J.graph};await a4(W,Z),W9.set(Z,{graph:W,signature:H9(W),configSignature:U9(W)});let H={...q,_layerGraph:W};if(!$)G1=H;return H});return w1.set(Z,K),K}}if(!$){if(G1)return G1;if(D2)return D2}let X=w1.get(Z);if(X)return X;let Y=(async()=>{let G=(await OY({name:"stx",alias:"ui",cwd:Z,defaultConfig:v5,verbose:!1})).config;if(G.extends!==void 0||J){let W=await r4(Z,v5);G=W.config,W9.set(Z,{graph:W.graph,signature:H9(W.graph),configSignature:U9(W.graph)})}if(G.runtimeConfig){let{resolveRuntimeConfig:W}=await import("./chunk-da5jnb8w.js");W(G.runtimeConfig,{});let{generateRuntimeConfigTypes:H}=await import("./chunk-rg89je2f.js");await H(Z,G.runtimeConfig)}DY(G),NY(G),wY(G,Z),RY(G,Z);let z=[],K=new Set((G.plugins??[]).map((W)=>typeof W==="string"?W:W[0]));for(let W of G.componentPackages??["@stacksjs/components"]){let H=`${W}/stx-plugin`;if(K.has(H)||K.has(W))continue;try{x.resolve(H,{paths:[Z]}),z.push(H)}catch{}}let q=[...G.plugins??[],...z];if(q.length>0){let{pluginManager:W}=await import("./chunk-5yxs9aa6.js"),H=[],U=[];for(let j of q){let B=typeof j==="string"?j:j[0],V=typeof j==="string"?{}:j[1]||{};try{let F,O;try{let L=x.resolve(B,{paths:[Z]});F=await import(L),O=P0.dirname(L)}catch{let L=P0.resolve(Z,B);F=await import(L),O=P0.dirname(L)}let _=F.default||F;if(!W.has(_.name))await W.register(_,G);if(_.components){let L=Array.isArray(_.components)?_.components:[_.components];for(let w of L)H.push(P0.resolve(O,w))}if(_.pages){let L=P0.resolve(O,_.pages),w=V.path||"/";U.push({dir:L,prefix:w})}if(_.setup){let L={addDirective:(w)=>{G.customDirectives=G.customDirectives||[],G.customDirectives.push(w)},addRoute:(w,R)=>{G.apiRoutes=G.apiRoutes||{},G.apiRoutes[w]=R},addMiddleware:(w)=>{G.middleware=G.middleware||[],G.middleware.push(w)},pluginDir:O,config:G};await _.setup(V,L)}console.log(`[stx] Plugin loaded: ${_.name||B}`)}catch(F){console.warn(`[stx] Failed to load plugin ${B}:`,F.message)}}G._pluginComponentDirs=H,G._pluginPageDirs=U}return G})();if(w1.set(Z,Y),Y.catch(()=>{if(w1.get(Z)===Y)w1.delete(Z)}),!$)D2=Y,Y.then((Q)=>{G1=Q}).catch(()=>{});return Y}var Z7=new Proxy(v5,{get($,Z){if(G1&&Z in G1)return G1[Z];if(!D2)f5().catch((J)=>{console.warn("[stx] Failed to load config file:",J?.message||J)});return $[Z]}});function XU($){return $}function YU($){let Z=[],J=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let X=["auto","manual","sections"];if(!X.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${X.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let X=["json","yaml","yml","js"];if(!X.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${X.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let X=["AA","AAA"];if(!X.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${X.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let X=["progressive","islands"];if(!X.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${X.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let X=["none","eager","lazy"];if(!X.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${X.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((X,Y)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${Y}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${Y}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((X,Y)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${Y}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${Y}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${Y}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)J.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)J.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let X=["fullscreen","standalone","minimal-ui","browser"];if(!X.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let X=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!X.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.routes){let X=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Y,Q)=>{if(!Y.pattern||typeof Y.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(Y.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(Y.maxAgeSeconds!==void 0&&(typeof Y.maxAgeSeconds!=="number"||Y.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Y.maxEntries!==void 0&&(typeof Y.maxEntries!=="number"||Y.maxEntries<1))Z.push({path:`pwa.routes[${Q}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Y)=>typeof Y!=="number"||Y<16||Y>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let X=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!X.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)J.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)J.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:J}}var h5=new Map;async function IY($,Z={}){try{if(!await e($))throw Error(`Markdown file not found: ${$}`);let X=(await MY.promises.stat($)).mtime.getTime();if(Z.cache&&h5.has($)){let H=h5.get($);if(H.updatedAt>=X)return{content:H.content,data:H.data}}let Y=await Bun.file($).text(),{data:Q,content:G}=w4(Y),z=Z.markdown||Z7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},q=F2(G,{gfm:!0});if(z.syntaxHighlighting?.enabled&&z.syntaxHighlighting?.serverSide)q=await TY(q,z.syntaxHighlighting?.defaultTheme||"github-dark",z.syntaxHighlighting?.highlightUnknownLanguages||!1);let W={content:q,data:Q||{}};if(Z.cache)h5.set($,{...W,updatedAt:X});return W}catch(J){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,J);let X=J instanceof Error?J.message:String(J);return{content:O0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}var V9=null;async function TY($,Z,J){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!V9)try{V9=await AY({theme:Z||"github-dark",cache:!0})}catch(z){return console.error("Failed to initialize ts-syntax-highlighter:",z),$}let Y=async(z,K,q,W)=>{let H=W.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),U=q||(J?"text":"");if(!U)return z;try{if(!V9.getSupportedLanguages().includes(U))return z;return(await V9.highlight(H,U,{theme:Z})).html}catch(j){console.error(`Error highlighting code block with language ${q}:`,j)}return z},Q=$,G=$.matchAll(X);for(let z of G){let[K,q,W,H]=z,U=await Y(K,q,W,H);Q=Q.replace(K,U)}return Q}async function J7($,Z,J="",X={}){return await kY($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,z,K,q)=>{try{let W=z;if(!g5.isAbsolute(z))W=g5.resolve(g5.dirname(J),z);let H={};if(K)try{try{H=JSON.parse(K)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let _=K.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let L of _){let w=L.indexOf(":");if(w>0){let R=L.substring(0,w).trim(),D=L.substring(w+1).trim(),N=D.startsWith('"')&&D.endsWith('"'),T=D.startsWith("'")&&D.endsWith("'");if(N||T)D=D.substring(1,D.length-1);H[R]=D}}}}catch(O){if(X.debug)console.error("Error parsing context in @markdown-file directive:",O)}let{content:U,data:j}=await IY(W,X),B={...Z,...j,...H},V=U,F=/\{\{([^}]+)\}\}/g;return V=V.replace(F,(O,_)=>{let L=_.trim();return B[L]!==void 0?String(B[L]):O}),V}catch(W){let H=W instanceof Error?W.message:String(W);return O0("Markdown File",`Error including markdown file: ${H}`,J,$,q,G)}})}async function kY($,Z,J){let X=[],Y;while((Y=Z.exec($))!==null){let z=Y[0],K=Y.index,q=Y;X.push(J(...q).then((W)=>({match:z,replacement:W,index:K})))}let Q=await Promise.all(X);Q.sort((z,K)=>K.index-z.index);let G=$;for(let{match:z,replacement:K}of Q)G=G.replace(z,()=>K);return G}function z1($,Z){try{let J=$.trim();if(B0(J))return U0(J,Object.keys(Z))(...Object.values(Z));else return X0(J,Z)}catch{return!1}}function K1($,Z){let J=EY($,Z);return J.ok?{expression:J.expression,endPos:J.endPos}:null}function EY($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return{ok:!1,reason:"missing-open-paren",pos:J};let X=M0($,"(",")",J);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:J};return{ok:!0,expression:$.slice(J+1,X),endPos:X+1}}function yY($,Z){let J=$.lastIndexOf("<",Z);if(J===-1)return!1;return J>$.lastIndexOf(">",Z)}function R1($,Z,J,X){let Y=1,Q=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),z=new RegExp(`@${J}(?![a-z])`,"g");while(Q<$.length&&Y>0){G.lastIndex=Q,z.lastIndex=Q;let K=G.exec($),q=z.exec($),W=K?K.index:1/0,H=q?q.index:1/0;if(W<H)Y++,Q=W+K[0].length;else if(H<1/0){if(Y--,Y===0)return H;Q=H+q[0].length}else break}return-1}function X7($,Z){let J=$.slice(Z).match(/^@if\s*/);if(!J)return null;let X=Z+J[0].length,Y=K1($,X);if(!Y)return null;let Q=Y.endPos,G=R1($,"if","endif",Q);if(G===-1)return null;let z=$.slice(Q,G),K=[],q=0,W="if",H=Y.expression,U=0,j=0;while(q<z.length){let B=z.indexOf("@",q);if(B===-1)break;q=B;let V=z.substring(B);if(yY(z,B)){q++;continue}if(/^@if\s*\(/.test(V)){j++,q++;continue}if(/^@endif(?![a-z])/.test(V)){j--,q+=6;continue}if(j===0){let F=V.match(/^@elseif\s*/);if(F){K.push({type:W,condition:H,content:z.substring(U,q),start:Q+U,end:Q+q});let O=q+F[0].length,_=K1(z,O);if(!_){q++;continue}W="elseif",H=_.expression,q=_.endPos,U=q;continue}else if(/^@else(?![a-z])/.test(V)){K.push({type:W,condition:H,content:z.substring(U,q),start:Q+U,end:Q+q}),W="else",H=void 0,q+=5,U=q;continue}}q++}return K.push({type:W,condition:H,content:z.slice(U),start:Q+U,end:Q+z.length}),{fullMatch:$.slice(Z,G+6),branches:K,start:Z,end:G+6}}function N2($){let Z=[],J=/@if\s*\(/g,X=J.exec($);while(X!==null){if(Z.some((G)=>X.index>G.start&&X.index<G.end)){X=J.exec($);continue}let Q=X7($,X.index);if(Q)Z.push(Q),J.lastIndex=Q.end;X=J.exec($)}return Z}function L9($,Z,J){let X=[],Y=new RegExp(`@${Z}\\s*\\(`,"g"),Q=Y.exec($);while(Q!==null){if(X.some((V)=>Q.index>V.start&&Q.index<V.end)){Q=Y.exec($);continue}let z=Q.index,K=z+Q[0].length-1,q=M0($,"(",")",K);if(q===-1){Q=Y.exec($);continue}let W=$.slice(K+1,q),H=q+1,U=R1($,Z,J,H);if(U===-1){Q=Y.exec($);continue}let j=$.slice(H,U),B=U+`@${J}`.length;X.push({fullMatch:$.slice(z,B),name:Z,params:W,content:j,start:z,end:B}),Y.lastIndex=B,Q=Y.exec($)}return X}function u5($,Z){let J=$.slice(Z).match(/^@switch\s*/);if(!J)return null;let X=Z+J[0].length,Y=K1($,X);if(!Y)return null;let Q=Y.endPos,G=R1($,"switch","endswitch",Q);if(G===-1)return null;let z=$.slice(Q,G),K=[],q=0,W=null,H=0;while(q<z.length){let U=z.slice(q),j=U.match(/^@switch\s*\(/),B=U.match(/^@endswitch(?![a-z])/);if(j){if(H++,W)W.content+=j[0];q+=j[0].length;continue}if(B){if(H--,W)W.content+=B[0];q+=B[0].length;continue}if(H>0){if(W)W.content+=z[q];q++;continue}let V=U.match(/^@case\s*/),F=U.match(/^@default(?![a-z])/),O=U.match(/^@break(?![a-z])/);if(V&&U.startsWith("@case")){if(W)K.push(W);let _=q+V[0].length,L=K1(z,_);if(!L){q++;continue}W={type:"case",value:L.expression,content:""},q=L.endPos}else if(F&&U.startsWith("@default")){if(W)K.push(W);W={type:"default",content:""},q+=F[0].length}else if(O&&U.startsWith("@break"))q+=O[0].length;else{if(W)W.content+=z[q];q++}}if(W)K.push(W);return{fullMatch:$.slice(Z,G+10),expression:Y.expression,cases:K,start:Z,end:G+10}}function CY($){let Z=[],J=0;while(J<$.length){let X=$.indexOf("{{",J),Y=$.indexOf("{!!",J),Q=!1,G;if(X===-1&&Y===-1)break;else if(X===-1)G=Y,Q=!0;else if(Y===-1)G=X,Q=!1;else if(Y<X)G=Y,Q=!0;else G=X,Q=!1;if(!Q&&$.slice(G,G+3)==="{{{")Q=!0;let z=Q?$.slice(G,G+3)==="{{{"?"{{{":"{!!":"{{",K=Q?z==="{{{"?"}}}":"!!}":"}}",q=G+z.length,W=SY($,q,K);if(W===-1){J=G+1;continue}let H=$.slice(q,W).trim(),U=W+K.length;Z.push({fullMatch:$.slice(G,U),expression:H,start:G,end:U,isRaw:Q}),J=U}return Z}function SY($,Z,J){let X=Z,Y=null,Q={paren:0,bracket:0,brace:0},G=0;while(X<$.length){let z=$[X];if((X>0?$[X-1]:"")==="\\"&&Y){X++;continue}if((z==='"'||z==="'")&&!Y){Y=z,X++;continue}if(z===Y&&Y!=="`"){Y=null,X++;continue}if(z==="`"&&!Y){Y="`",X++;continue}if(z==="`"&&Y==="`"&&G===0){Y=null,X++;continue}if(Y==="`"&&z==="$"&&$[X+1]==="{"){G++,X+=2;continue}if(G>0){if(z==="{")G++;else if(z==="}")G--;X++;continue}if(Y){X++;continue}if(z==="(")Q.paren++;else if(z===")")Q.paren--;else if(z==="[")Q.bracket++;else if(z==="]")Q.bracket--;else if(z==="{")Q.brace++;else if(z==="}")Q.brace--;if(Q.paren===0&&Q.bracket===0&&Q.brace<=0){if($.slice(X,X+J.length)===J)return X}X++}return-1}function PY($){let Z=d5($);if(Z.length===0)return{baseExpression:"",filters:[]};let J=Z[0],X=[];for(let Y=1;Y<Z.length;Y++){let Q=vY(Z[Y]);if(Q)X.push(Q)}return{baseExpression:J,filters:X}}function vY($){let Z=$.trim();if(!Z)return null;let J=Z.indexOf("(");if(J===-1)return{name:Z,args:[]};let X=Z.slice(0,J).trim(),Y=J+1,Q=M0(Z,"(",")",J);if(Q===-1)return{name:X,args:[]};let G=Z.slice(Y,Q),z=G7(G);return{name:X,args:z}}function G7($){let Z=[],J="",X={paren:0,bracket:0,brace:0},Y=null,Q=0;for(let G=0;G<$.length;G++){let z=$[G];if((G>0?$[G-1]:"")==="\\"&&Y){J+=z;continue}if((z==='"'||z==="'")&&!Y){Y=z,J+=z;continue}if(z===Y&&Y!=="`"){Y=null,J+=z;continue}if(z==="`"&&!Y){Y="`",J+=z;continue}if(z==="`"&&Y==="`"&&Q===0){Y=null,J+=z;continue}if(Y==="`"&&z==="$"&&$[G+1]==="{"){Q++,J+="${",G++;continue}if(Q>0&&z==="{"){Q++,J+=z;continue}if(Q>0&&z==="}"){Q--,J+=z;continue}if(Y){J+=z;continue}if(z==="(")X.paren++;else if(z===")")X.paren--;else if(z==="[")X.bracket++;else if(z==="]")X.bracket--;else if(z==="{")X.brace++;else if(z==="}")X.brace--;if(z===","&&X.paren===0&&X.bracket===0&&X.brace===0){Z.push(J.trim()),J="";continue}J+=z}if(J.trim())Z.push(J.trim());return Z}function xY($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return null;let X=M0($,"(",")",J);if(X===-1)return null;return{params:$.slice(J+1,X),endPos:X+1}}function fY($){let Z=[],X=new m5($).tokenize().filter((Q)=>Q.type!=="WHITESPACE"&&Q.type!=="COMMENT"),Y=0;while(Y<X.length){let Q=X[Y],G=!1;if(Q.type==="IDENTIFIER"&&Q.value==="export"){if(G=!0,Y++,Y>=X.length)break}let z=X[Y];if(z.type==="IDENTIFIER"&&(z.value==="const"||z.value==="let"||z.value==="var")){let K=z.value;if(Y++,Y>=X.length)break;let q=X[Y];if(q.type==="IDENTIFIER"){let W=q.value;if(Y++,Y<X.length&&X[Y].type==="OPERATOR"&&X[Y].value==="="){Y++;let H=Y<X.length?X[Y].start:$.length,U=Y7(X,Y,$);Y=U.nextIndex,Z.push({type:"variable",name:W,value:$.slice(H,U.endPos),exported:G,start:z.start,end:U.endPos})}}else if(q.type==="PUNCTUATION"&&(q.value==="{"||q.value==="[")){let W=q.start,H=q.value==="{"?"}":"]",U=M0($,q.value,H,W);if(U!==-1){let j=$.slice(W,U+1);if(Y=Q7(X,U+1),Y<X.length&&X[Y].type==="OPERATOR"&&X[Y].value==="="){Y++;let B=Y<X.length?X[Y].start:$.length,V=Y7(X,Y,$);Y=V.nextIndex;let F=`__stx_destructured_${Z.length}`;Z.push({type:"variable",name:F,value:`${$.slice(B,V.endPos)}; ${K} ${j} = ${F}`,exported:G,start:z.start,end:V.endPos})}}}}else if(z.type==="IDENTIFIER"&&z.value==="function"){let K=G?X[Y-1].start:z.start;if(Y++,Y>=X.length)break;let q=X[Y];if(q.type==="IDENTIFIER"){let W=q.value;Y++;let H=-1;while(Y<X.length){if(X[Y].type==="PUNCTUATION"&&X[Y].value==="{"){H=X[Y].start;break}Y++}if(H!==-1){let U=M0($,"{","}",H);if(U!==-1)Z.push({type:"function",name:W,value:$.slice(K,U+1).replace(/^export\s+/,""),exported:G,start:K,end:U+1}),Y=Q7(X,U+1)}}}else Y++}return Z}function Y7($,Z,J){let X=Z,Y={paren:0,bracket:0,brace:0},Q=Z<$.length?$[Z].start:J.length;while(X<$.length){let G=$[X];if(G.type==="PUNCTUATION"){if(G.value==="(")Y.paren++;else if(G.value===")")Y.paren--;else if(G.value==="[")Y.bracket++;else if(G.value==="]")Y.bracket--;else if(G.value==="{")Y.brace++;else if(G.value==="}")Y.brace--;if(G.value===";"&&Y.paren===0&&Y.bracket===0&&Y.brace===0){Q=G.start,X++;break}}if(G.type==="IDENTIFIER"&&(G.value==="const"||G.value==="let"||G.value==="var"||G.value==="function"||G.value==="export")){if(Y.paren===0&&Y.bracket===0&&Y.brace===0){Q=$[X-1]?.end??G.start;break}}Q=G.end,X++}return{nextIndex:X,endPos:Q}}function Q7($,Z){for(let J=0;J<$.length;J++)if($[J].start>=Z)return J;return $.length}function gY($,Z,J){let X=$,Y=!0;while(Y){Y=!1;let Q=X.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,z=u5(X,G);if(!z)break;try{let K;if(B0(z.expression))K=U0(z.expression,Object.keys(Z))(...Object.values(Z));else K=X0(z.expression,Z);let q="",W=!1;for(let H of z.cases)if(H.type==="default"){if(!W)q=H.content.trim()}else try{let U;if(H.value&&B0(H.value))U=U0(H.value,Object.keys(Z))(...Object.values(Z));else if(H.value)U=X0(H.value,Z);if(K===U){q=H.content.trim(),W=!0;break}}catch{continue}X=X.substring(0,G)+q+X.substring(z.end),Y=!0}catch(K){let q=K instanceof Error?K.message:String(K),W=N0("Switch",`Error evaluating @switch expression: ${q}`,D0.EVALUATION_ERROR);X=X.substring(0,G)+W+X.substring(z.end);break}}return X}function hY($){let Z=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(X)=>{return Z.push(X),`\x00stx-script-${Z.length-1}\x00`}),scripts:Z}}function uY($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(J,X)=>Z[Number(X)]??J)}function t0($,Z,J){let{masked:X,scripts:Y}=hY($);return uY(mY(X,Z,J),Y)}function mY($,Z,J){let X=$;X=gY(X,Z,J);{let Q=!0;while(Q){Q=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let z=G.index,K=K1(X,z+7);if(!K)break;let q=K.endPos,W=R1(X,"unless","endunless",q);if(W===-1){console.warn(`[stx] @unless directive at position ${z} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let H=X.slice(q,W),U=K.expression,j=-1;{let V=0,F=/@(?:if|unless)\s*\(/g,O=/@(?:endif|endunless)(?![a-z])/g,_=/@else(?![a-z])/g,L=[],w;while((w=F.exec(H))!==null)L.push({pos:w.index,type:"open"});while((w=O.exec(H))!==null)L.push({pos:w.index,type:"close"});while((w=_.exec(H))!==null)L.push({pos:w.index,type:"else"});L.sort((R,D)=>R.pos-D.pos);for(let R of L)if(R.type==="open")V++;else if(R.type==="close")V--;else if(R.type==="else"&&V===0){j=R.pos;break}}let B;if(j!==-1){let V=H.slice(0,j),F=H.slice(j+5);B=`@if (${U})${F}@else ${V}@endif`}else B=`@if (!(${U}))${H}@endif`;X=X.substring(0,z)+B+X.substring(W+10),Q=!0}}X=c5(X,Z,J),X=p5(X,Z,J),X=l5(X,Z);let Y=()=>{let Q=N2(X);if(Q.length===0)return!1;let G=Array(Q.length);for(let q=Q.length-1;q>=0;q--){let W=Q[q];try{let H="",U=!1;for(let j of W.branches){if(U)break;if(j.type==="else")H=j.content,U=!0;else try{let B;if(j.condition&&B0(j.condition))B=U0(j.condition,Object.keys(Z))(...Object.values(Z));else if(j.condition)B=X0(j.condition,Z);if(B)H=j.content,U=!0}catch(B){H=N0(j.type==="if"?"If":"Elseif",`Error in @${j.type}(${j.condition}): ${B instanceof Error?B.message:String(B)}`,D0.EVALUATION_ERROR),U=!0}}G[q]=H}catch(H){let U=H instanceof Error?H.message:String(H);G[q]=N0("If",`Error processing @if block: ${U}`,D0.EVALUATION_ERROR)}}let z=Array(Q.length*2+1),K=0;for(let q=0;q<Q.length;q++){let W=Q[q];z[q*2]=X.slice(K,W.start),z[q*2+1]=G[q],K=W.end}return z[Q.length*2]=X.slice(K),X=z.join(""),!0};while(!0){let Q=X;if(!Y())break;if(X===Q)break}return X}function z7($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let J=$[Z];if(J!=="'"&&J!=='"')return null;Z++;let X=[];while(Z<$.length){let Y=$[Z];if(Y==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(Y===J){Z++;break}X.push(Y),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function l5($,Z){let J=$;function X(z,K,q,W){let H=1,U=W,j=new RegExp(`@${K}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${q}(?![a-z])`,"g");while(U<z.length&&H>0){j.lastIndex=U,B.lastIndex=U;let V=j.exec(z),F=B.exec(z),O=V?V.index:1/0,_=F?F.index:1/0;if(O<_)H++,U=O+V[0].length;else if(_<1/0){if(H--,H===0)return _;U=_+F[0].length}else break}return-1}function Y(z,K,q){let W=0,H=new RegExp(`@${K}(?:\\s*\\(|\\s|$)`,"g"),U=new RegExp(`@${q}(?![a-z])`,"g"),j=/@else(?![a-z])/g,B=[],V;while((V=H.exec(z))!==null)B.push({pos:V.index,type:"open"});while((V=U.exec(z))!==null)B.push({pos:V.index,type:"close"});while((V=j.exec(z))!==null)B.push({pos:V.index,type:"else"});B.sort((F,O)=>F.pos-O.pos);for(let F of B)if(F.type==="open")W++;else if(F.type==="close")W--;else if(F.type==="else"&&W===0)return F.pos;return-1}{let z=!0;while(z){z=!1;let K=J.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!K||K.index===void 0)break;let q=K.index,W,H,U=J.slice(q+5),j=z7(U);if(j)W=j.value,H=q+5+j.consumed;else H=q+5;let B=X(J,"auth","endauth",H);if(B===-1){console.warn(`[stx] @auth directive at position ${q} has no matching @endauth \u2014 the block was skipped.`);break}let V=J.slice(H,B),F=Y(V,"auth","endauth"),O;if(!Z.auth)O=!1;else O=W?z1(`auth?.check && auth?.user?.[${W}]`,Z):z1("auth?.check",Z);let _;if(F!==-1){let L=V.slice(0,F),w=V.slice(F+5);_=O?L:w}else _=O?V:"";J=J.substring(0,q)+_+J.substring(B+8),z=!0}}{let z=!0;while(z){z=!1;let K=J.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!K||K.index===void 0)break;let q=K.index,W,H,U=J.slice(q+6),j=z7(U);if(j)W=j.value,H=q+6+j.consumed;else H=q+6;let B=X(J,"guest","endguest",H);if(B===-1){console.warn(`[stx] @guest directive at position ${q} has no matching @endguest \u2014 the block was skipped.`);break}let V=J.slice(H,B),F=Y(V,"guest","endguest"),O;if(!Z.auth)O=!0;else O=W?z1(`!auth?.check || !auth?.user?.[${W}]`,Z):z1("!auth?.check",Z);let _;if(F!==-1){let L=V.slice(0,F),w=V.slice(F+5);_=O?L:w}else _=O?V:"";J=J.substring(0,q)+_+J.substring(B+9),z=!0}}function Q(z,K,q){if(Z.userCan&&typeof Z.userCan[z]==="boolean")return Z.userCan[z];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let W=[z];if(K)W.push(K);if(q){let H=z1(q,Z);W.push(H)}return Z.permissions.check(...W)}catch{return!1}return!1}function G(z){let K=z.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!K)return null;return{ability:K[1],type:K[2],id:K[3]?.trim(),paramsEnd:K[0].length}}for(let z of["can","cannot"]){let K=`end${z}`,q=z==="can"?"elsecan":"elsecannot",W=!0;while(W){W=!1;let H=J.match(new RegExp(`@${z}\\s*\\(`));if(!H||H.index===void 0)break;let U=H.index,j=J.slice(U+`@${z}`.length),B=G(j);if(!B)break;let V=U+`@${z}`.length+B.paramsEnd,F=X(J,z,K,V);if(F===-1){console.warn(`[stx] @${z} directive at position ${U} has no matching @${K} \u2014 the block was skipped.`);break}let O=J.slice(V,F),_=[],L=0,w=new RegExp(`@${z}\\s*\\(`,"g"),R=new RegExp(`@${K}(?![a-z])`,"g"),D=new RegExp(`@${q}\\s*\\(`,"g"),N=/@else(?![a-z])/g,T=[],M;while((M=w.exec(O))!==null)T.push({pos:M.index,type:"open"});while((M=R.exec(O))!==null)T.push({pos:M.index,type:"close"});while((M=D.exec(O))!==null)T.push({pos:M.index,type:"elseDirective"});while((M=N.exec(O))!==null)T.push({pos:M.index,type:"else"});T.sort((b,y)=>b.pos-y.pos);for(let b of T){if(b.type==="open"){L++;continue}if(b.type==="close"){L--;continue}if(L===0)_.push(b)}let I=[],k=0;for(let b=0;b<_.length;b++){let y=_[b];if(I.push({content:O.slice(k,y.pos),ability:void 0}),y.type==="elseDirective"){let P=O.slice(y.pos+`@${q}`.length),h=G(P);if(h){I[I.length-1]={content:O.slice(k,y.pos)},k=y.pos+`@${q}`.length+h.paramsEnd,I.push({content:"",ability:h.ability,type:h.type,id:h.id}),I.pop();let p=_[b+1],u=p?p.pos:O.length;I.push({content:O.slice(k,u),ability:h.ability,type:h.type,id:h.id}),k=u}}else k=y.pos+5}if(k<O.length){let b=I[I.length-1];if(_.length>0&&_[_.length-1].type==="else")I.push({content:O.slice(k),isFinalElse:!0});else if(I.length===0)I.push({content:O.slice(k)})}let A=Q(B.ability,B.type,B.id),E=z==="can"?A:!A,S="";if(E)S=I[0]?.content||"";else{let b=!1;for(let y=1;y<I.length;y++){let P=I[y];if(P.isFinalElse){S=P.content,b=!0;break}if(P.ability){let h=Q(P.ability,P.type,P.id);if(z==="can"?h:!h){S=P.content,b=!0;break}}}if(!b&&I.length>0){let y=I[I.length-1];if(y.isFinalElse)S=y.content}}J=J.substring(0,U)+S+J.substring(F+`@${K}`.length),W=!0}}return J}function c5($,Z,J){let X=$;function Y(Q,G,z,K,q){let W=!0;while(W){W=!1;let H=new RegExp(`@${G}\\s*\\(`),U=Q.match(H);if(!U||U.index===void 0)break;let j=U.index,B=K1(Q,j+`@${G}`.length);if(!B)break;let V=B.endPos,F=R1(Q,G,z,V);if(F===-1){console.warn(`[stx] @${G} directive at position ${j} has no matching @${z} \u2014 the block was skipped.`);break}let O=Q.slice(V,F),_=B.expression,L=-1,w=0,R=0;while(R<O.length){let D=O.indexOf("@",R);if(D===-1)break;let N=O.substring(D);if(/^@(?:if|unless|isset|empty)\s*\(/.test(N)){w++,R=D+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(N)){w--,R=D+1;continue}if(w===0&&/^@else(?![a-z])/.test(N)){L=D;break}R=D+1}try{let D=K(_.trim()),N;if(L!==-1){let T=O.slice(0,L),M=O.slice(L+5);N=D?T:M}else N=D?O:"";Q=Q.substring(0,j)+N+Q.substring(F+`@${z}`.length),W=!0}catch(D){let N=D instanceof Error?D.message:String(D),T=N0(q,`Error processing @${G} directive: ${N}`,D0.EVALUATION_ERROR);Q=Q.substring(0,j)+T+Q.substring(F+`@${z}`.length);break}}return Q}return X=Y(X,"isset","endisset",(Q)=>{let G=z1(Q,Z);return G!==void 0&&G!==null},"Isset"),X=Y(X,"empty","endempty",(Q)=>{let G=z1(Q,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),X}function p5($,Z,J){let X=$,Y="development";function Q(G,z,K,q){let W=new RegExp(`@${z}(?![a-z])`,"g"),H=new RegExp(`@${K}(?![a-z])`,"g"),U=new RegExp(`^@${z}(?![a-z])`),j=new RegExp(`^@${K}(?![a-z])`),B=G,V=!0;while(V){V=!1,W.lastIndex=0;let F=W.exec(B);if(!F)break;let O=F.index,_=O+F[0].length;if(z==="env"){let A=B.substring(_).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!A)break;_+=A[0].length,q=Y===A[2]}let L=1,w=_,R=-1;while(L>0&&w<B.length){W.lastIndex=w,H.lastIndex=w;let A=W.exec(B),E=H.exec(B),S=A?A.index:1/0,b=E?E.index:1/0;if(S<b)L++,w=S+A[0].length;else if(b<1/0){if(L--,L===0){R=b;break}w=b+E[0].length}else break}if(R===-1){console.warn(`[stx] @${z} directive at position ${O} has no matching @${K} \u2014 the block was skipped.`);break}let D=B.substring(_,R),N=-1,T=0,M=0;while(M<D.length){let A=D.indexOf("@",M);if(A===-1)break;let E=D.substring(A);if(U.test(E)){T++,M=A+1;continue}if(j.test(E)){T--,M=A+1;continue}if(T===0&&/^@else(?![a-z])/.test(E)){N=A;break}M=A+1}let I;if(N!==-1){let A=D.slice(0,N),E=D.slice(N+5);I=q?A:E}else I=q?D:"";let k=`@${K}`.length;B=B.substring(0,O)+I+B.substring(R+k),V=!0}return B}return X=Q(X,"env","endenv",!1),X=Q(X,"production","endproduction",Y==="production"),X=Q(X,"development","enddevelopment",Y==="development"),X=Q(X,"staging","endstaging",Y==="staging"),X=Q(X,"testing","endtesting",Y==="testing"),X}var i5=new WeakMap;function K7($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function D1($,Z){if(!$)return Z?.nonceGenerator?.()??K7();let J=i5.get($);if(!J)J=Z?.nonceGenerator?.()??K7(),i5.set($,J);return J}function yU($){i5.delete($)}function q7($,Z){let J=[];for(let[X,Y]of Object.entries($)){if(Y===void 0||Y===null)continue;if(typeof Y==="boolean"){if(Y)J.push(X);continue}if(Array.isArray(Y)){let Q=[...Y];if(Z&&(X==="script-src"||X==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)J.push(`${X} ${Q.join(" ")}`)}}return J.join("; ")}function s5($,Z){return`<meta http-equiv="Content-Security-Policy" content="${q7($,Z).replace(/&/g,"&").replace(/"/g,""")}">`}var dY={"default-src":["'self'"],"script-src":["'self'","'strict-dynamic'"],"style-src":["'self'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'none'"],"base-uri":["'self'"],"form-action":["'self'"],"frame-ancestors":["'self'"],"upgrade-insecure-requests":!0},n5={"default-src":["'self'"],"script-src":["'self'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'","https:"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'self'"],"base-uri":["'self'"],"form-action":["'self'"],"upgrade-insecure-requests":!0},lY={"default-src":["'self'"],"script-src":["'self'","'unsafe-inline'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:","http:"],"font-src":["'self'","https:","http:","data:"],"connect-src":["'self'","https:","http:","ws:","wss:"],"media-src":["'self'","https:","http:"],"object-src":["'none'"],"frame-src":["'self'","https:"],"base-uri":["'self'"]},cY={"default-src":["'none'"],"frame-ancestors":["'none'"]};function bU($){return{enabled:!0,directives:{strict:dY,moderate:n5,relaxed:lY,api:cY}[$]||n5,useNonce:$==="strict",addMetaTag:!0}}function CU($,Z){let J={...$};for(let[X,Y]of Object.entries(Z)){let Q=X,G=J[Q];if(Y===void 0||Y===null)continue;if(typeof Y==="boolean")J[Q]=G||Y;else if(Array.isArray(Y)){let z=Array.isArray(G)?G:[],K=[...new Set([...z,...Y])];J[Q]=K}}return J}function W7($,Z,J){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=Z.useNonce?D1(J,Z):void 0,Y=s5(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
|
|
3170
|
+
</script>`}var v5={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:n4,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:D4,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:l4,hasEndTag:!1,description:"Include a web component in the template"},p4,i4,t4,e4,V5,O5,F5,L5,F4,z4,P4,C5,...$7],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,scrollRestoration:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function FY($,Z,J){let X=Z||"pages";if($)return{root:$,pagesDir:X};let Y=J||process.cwd(),Q=P0.join(Y,"resources","views"),G=P0.join(Y,"resources","layouts");if(j9.existsSync(Q)&&j9.existsSync(G))return{root:"resources",pagesDir:"views"};let z=P0.join(Y,"resources","views","pages");if(j9.existsSync(z))return{root:"resources/views",pagesDir:X};return{root:".",pagesDir:X}}var c4=new Set,B9=["partialsDir","componentsDir","layoutsDir"],x5=new WeakMap;function _Y($,Z){let J=Z.replace(/[\\/]+$/,"");if(!J||J===".")return!0;let X=$.replace(/\\/g,"/"),Y=J.replace(/\\/g,"/");return X===Y||X.startsWith(`${Y}/`)}function wY($,Z){let J=!$.root,X=FY($.root,$.pagesDir,Z);if($.root=X.root,$.pagesDir=X.pagesDir,J&&X.root!=="."){let Y=`${Z}::${X.root}`;if(!c4.has(Y))c4.add(Y),console.warn(`[stx] No "root" in config \u2014 inferred "${X.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!x5.has($)){let Y={};for(let Q of B9){let G=$[Q];if(typeof G==="string"&&G)Y[Q]=G}x5.set($,Y)}if($.root&&$.root!=="."){let Y=$.root;for(let Q of B9){let G=$[Q];if(typeof G!=="string"||!G)continue;if(P0.isAbsolute(G)||_Y(G,Y))continue;$[Q]=P0.join(Y,G)}}for(let Y of B9){let Q=$[Y];if(typeof Q!=="string"||!Q||P0.isAbsolute(Q))continue;$[Y]=P0.resolve(Z,Q)}return $}function RY($,Z){let J=x5.get($);for(let X of B9){let Y=$[X];if(typeof Y!=="string"||!Y)continue;let Q=P0.isAbsolute(Y)?Y:P0.join(Z,Y);if(j9.existsSync(Q))continue;let G=J?.[X]??Y,z=$.root,K=!!z&&z!==".";console.warn(`[stx] ${String(X)} resolves to "${Q}", which does not exist. Configured as "${G}"`+(K?`, resolved under root "${z}".`:"."))}}function DY($){if($.customDirectives)$.customDirectives=[...$.customDirectives];if($.middleware)$.middleware=[...$.middleware];if($.apiRoutes)$.apiRoutes={...$.apiRoutes}}function NY($){if(s4($.stateDir),$.stateDir=o4(),$.cachePath=R2($.cachePath),$.build)$.build.cacheDir=R2($.build.cacheDir);if($.media?.cache)$.media.cache.directory=R2($.media.cache.directory);if($.story)$.story.outDir=R2($.story.outDir)}var G1=null,w1=new Map,W9=new Map,D2=null;async function f5($){let Z=$?P0.resolve($):process.cwd(),J=W9.get(Z);if(J&&J.signature!==H9(J.graph)){let Q=w1.get(Z);if(w1.delete(Z),W9.delete(Z),!$)G1=null,D2=null;let{clearComponentCache:G}=await import("./chunk-vsjx1fe3.js"),{partialsCache:z}=await import("./chunk-d5h4fq9g.js");if(G(),z.clear(),Q&&J.configSignature===U9(J.graph)){let K=Q.then(async(q)=>{let W={...J.graph};await a4(W,Z),W9.set(Z,{graph:W,signature:H9(W),configSignature:U9(W)});let H={...q,_layerGraph:W};if(!$)G1=H;return H});return w1.set(Z,K),K}}if(!$){if(G1)return G1;if(D2)return D2}let X=w1.get(Z);if(X)return X;let Y=(async()=>{let G=(await OY({name:"stx",alias:"ui",cwd:Z,defaultConfig:v5,verbose:!1})).config;if(G.extends!==void 0||J){let W=await r4(Z,v5);G=W.config,W9.set(Z,{graph:W.graph,signature:H9(W.graph),configSignature:U9(W.graph)})}if(G.runtimeConfig){let{resolveRuntimeConfig:W}=await import("./chunk-da5jnb8w.js");W(G.runtimeConfig,{});let{generateRuntimeConfigTypes:H}=await import("./chunk-2egh74rh.js");await H(Z,G.runtimeConfig)}DY(G),NY(G),wY(G,Z),RY(G,Z);let z=[],K=new Set((G.plugins??[]).map((W)=>typeof W==="string"?W:W[0]));for(let W of G.componentPackages??["@stacksjs/components"]){let H=`${W}/stx-plugin`;if(K.has(H)||K.has(W))continue;try{x.resolve(H,{paths:[Z]}),z.push(H)}catch{}}let q=[...G.plugins??[],...z];if(q.length>0){let{pluginManager:W}=await import("./chunk-5yxs9aa6.js"),H=[],U=[];for(let j of q){let B=typeof j==="string"?j:j[0],V=typeof j==="string"?{}:j[1]||{};try{let F,O;try{let L=x.resolve(B,{paths:[Z]});F=await import(L),O=P0.dirname(L)}catch{let L=P0.resolve(Z,B);F=await import(L),O=P0.dirname(L)}let _=F.default||F;if(!W.has(_.name))await W.register(_,G);if(_.components){let L=Array.isArray(_.components)?_.components:[_.components];for(let w of L)H.push(P0.resolve(O,w))}if(_.pages){let L=P0.resolve(O,_.pages),w=V.path||"/";U.push({dir:L,prefix:w})}if(_.setup){let L={addDirective:(w)=>{G.customDirectives=G.customDirectives||[],G.customDirectives.push(w)},addRoute:(w,R)=>{G.apiRoutes=G.apiRoutes||{},G.apiRoutes[w]=R},addMiddleware:(w)=>{G.middleware=G.middleware||[],G.middleware.push(w)},pluginDir:O,config:G};await _.setup(V,L)}console.log(`[stx] Plugin loaded: ${_.name||B}`)}catch(F){console.warn(`[stx] Failed to load plugin ${B}:`,F.message)}}G._pluginComponentDirs=H,G._pluginPageDirs=U}return G})();if(w1.set(Z,Y),Y.catch(()=>{if(w1.get(Z)===Y)w1.delete(Z)}),!$)D2=Y,Y.then((Q)=>{G1=Q}).catch(()=>{});return Y}var Z7=new Proxy(v5,{get($,Z){if(G1&&Z in G1)return G1[Z];if(!D2)f5().catch((J)=>{console.warn("[stx] Failed to load config file:",J?.message||J)});return $[Z]}});function XU($){return $}function YU($){let Z=[],J=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let X=["auto","manual","sections"];if(!X.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${X.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let X=["json","yaml","yml","js"];if(!X.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${X.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let X=["AA","AAA"];if(!X.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${X.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let X=["progressive","islands"];if(!X.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${X.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let X=["none","eager","lazy"];if(!X.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${X.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((X,Y)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${Y}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${Y}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((X,Y)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${Y}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${Y}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${Y}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)J.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)J.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let X=["fullscreen","standalone","minimal-ui","browser"];if(!X.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let X=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!X.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.routes){let X=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Y,Q)=>{if(!Y.pattern||typeof Y.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(Y.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(Y.maxAgeSeconds!==void 0&&(typeof Y.maxAgeSeconds!=="number"||Y.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Y.maxEntries!==void 0&&(typeof Y.maxEntries!=="number"||Y.maxEntries<1))Z.push({path:`pwa.routes[${Q}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Y)=>typeof Y!=="number"||Y<16||Y>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let X=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!X.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)J.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)J.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:J}}var h5=new Map;async function IY($,Z={}){try{if(!await e($))throw Error(`Markdown file not found: ${$}`);let X=(await MY.promises.stat($)).mtime.getTime();if(Z.cache&&h5.has($)){let H=h5.get($);if(H.updatedAt>=X)return{content:H.content,data:H.data}}let Y=await Bun.file($).text(),{data:Q,content:G}=w4(Y),z=Z.markdown||Z7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},q=F2(G,{gfm:!0});if(z.syntaxHighlighting?.enabled&&z.syntaxHighlighting?.serverSide)q=await TY(q,z.syntaxHighlighting?.defaultTheme||"github-dark",z.syntaxHighlighting?.highlightUnknownLanguages||!1);let W={content:q,data:Q||{}};if(Z.cache)h5.set($,{...W,updatedAt:X});return W}catch(J){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,J);let X=J instanceof Error?J.message:String(J);return{content:O0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}var V9=null;async function TY($,Z,J){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!V9)try{V9=await AY({theme:Z||"github-dark",cache:!0})}catch(z){return console.error("Failed to initialize ts-syntax-highlighter:",z),$}let Y=async(z,K,q,W)=>{let H=W.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),U=q||(J?"text":"");if(!U)return z;try{if(!V9.getSupportedLanguages().includes(U))return z;return(await V9.highlight(H,U,{theme:Z})).html}catch(j){console.error(`Error highlighting code block with language ${q}:`,j)}return z},Q=$,G=$.matchAll(X);for(let z of G){let[K,q,W,H]=z,U=await Y(K,q,W,H);Q=Q.replace(K,U)}return Q}async function J7($,Z,J="",X={}){return await kY($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,z,K,q)=>{try{let W=z;if(!g5.isAbsolute(z))W=g5.resolve(g5.dirname(J),z);let H={};if(K)try{try{H=JSON.parse(K)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let _=K.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let L of _){let w=L.indexOf(":");if(w>0){let R=L.substring(0,w).trim(),D=L.substring(w+1).trim(),N=D.startsWith('"')&&D.endsWith('"'),T=D.startsWith("'")&&D.endsWith("'");if(N||T)D=D.substring(1,D.length-1);H[R]=D}}}}catch(O){if(X.debug)console.error("Error parsing context in @markdown-file directive:",O)}let{content:U,data:j}=await IY(W,X),B={...Z,...j,...H},V=U,F=/\{\{([^}]+)\}\}/g;return V=V.replace(F,(O,_)=>{let L=_.trim();return B[L]!==void 0?String(B[L]):O}),V}catch(W){let H=W instanceof Error?W.message:String(W);return O0("Markdown File",`Error including markdown file: ${H}`,J,$,q,G)}})}async function kY($,Z,J){let X=[],Y;while((Y=Z.exec($))!==null){let z=Y[0],K=Y.index,q=Y;X.push(J(...q).then((W)=>({match:z,replacement:W,index:K})))}let Q=await Promise.all(X);Q.sort((z,K)=>K.index-z.index);let G=$;for(let{match:z,replacement:K}of Q)G=G.replace(z,()=>K);return G}function z1($,Z){try{let J=$.trim();if(B0(J))return U0(J,Object.keys(Z))(...Object.values(Z));else return X0(J,Z)}catch{return!1}}function K1($,Z){let J=EY($,Z);return J.ok?{expression:J.expression,endPos:J.endPos}:null}function EY($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return{ok:!1,reason:"missing-open-paren",pos:J};let X=M0($,"(",")",J);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:J};return{ok:!0,expression:$.slice(J+1,X),endPos:X+1}}function yY($,Z){let J=$.lastIndexOf("<",Z);if(J===-1)return!1;return J>$.lastIndexOf(">",Z)}function R1($,Z,J,X){let Y=1,Q=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),z=new RegExp(`@${J}(?![a-z])`,"g");while(Q<$.length&&Y>0){G.lastIndex=Q,z.lastIndex=Q;let K=G.exec($),q=z.exec($),W=K?K.index:1/0,H=q?q.index:1/0;if(W<H)Y++,Q=W+K[0].length;else if(H<1/0){if(Y--,Y===0)return H;Q=H+q[0].length}else break}return-1}function X7($,Z){let J=$.slice(Z).match(/^@if\s*/);if(!J)return null;let X=Z+J[0].length,Y=K1($,X);if(!Y)return null;let Q=Y.endPos,G=R1($,"if","endif",Q);if(G===-1)return null;let z=$.slice(Q,G),K=[],q=0,W="if",H=Y.expression,U=0,j=0;while(q<z.length){let B=z.indexOf("@",q);if(B===-1)break;q=B;let V=z.substring(B);if(yY(z,B)){q++;continue}if(/^@if\s*\(/.test(V)){j++,q++;continue}if(/^@endif(?![a-z])/.test(V)){j--,q+=6;continue}if(j===0){let F=V.match(/^@elseif\s*/);if(F){K.push({type:W,condition:H,content:z.substring(U,q),start:Q+U,end:Q+q});let O=q+F[0].length,_=K1(z,O);if(!_){q++;continue}W="elseif",H=_.expression,q=_.endPos,U=q;continue}else if(/^@else(?![a-z])/.test(V)){K.push({type:W,condition:H,content:z.substring(U,q),start:Q+U,end:Q+q}),W="else",H=void 0,q+=5,U=q;continue}}q++}return K.push({type:W,condition:H,content:z.slice(U),start:Q+U,end:Q+z.length}),{fullMatch:$.slice(Z,G+6),branches:K,start:Z,end:G+6}}function N2($){let Z=[],J=/@if\s*\(/g,X=J.exec($);while(X!==null){if(Z.some((G)=>X.index>G.start&&X.index<G.end)){X=J.exec($);continue}let Q=X7($,X.index);if(Q)Z.push(Q),J.lastIndex=Q.end;X=J.exec($)}return Z}function L9($,Z,J){let X=[],Y=new RegExp(`@${Z}\\s*\\(`,"g"),Q=Y.exec($);while(Q!==null){if(X.some((V)=>Q.index>V.start&&Q.index<V.end)){Q=Y.exec($);continue}let z=Q.index,K=z+Q[0].length-1,q=M0($,"(",")",K);if(q===-1){Q=Y.exec($);continue}let W=$.slice(K+1,q),H=q+1,U=R1($,Z,J,H);if(U===-1){Q=Y.exec($);continue}let j=$.slice(H,U),B=U+`@${J}`.length;X.push({fullMatch:$.slice(z,B),name:Z,params:W,content:j,start:z,end:B}),Y.lastIndex=B,Q=Y.exec($)}return X}function u5($,Z){let J=$.slice(Z).match(/^@switch\s*/);if(!J)return null;let X=Z+J[0].length,Y=K1($,X);if(!Y)return null;let Q=Y.endPos,G=R1($,"switch","endswitch",Q);if(G===-1)return null;let z=$.slice(Q,G),K=[],q=0,W=null,H=0;while(q<z.length){let U=z.slice(q),j=U.match(/^@switch\s*\(/),B=U.match(/^@endswitch(?![a-z])/);if(j){if(H++,W)W.content+=j[0];q+=j[0].length;continue}if(B){if(H--,W)W.content+=B[0];q+=B[0].length;continue}if(H>0){if(W)W.content+=z[q];q++;continue}let V=U.match(/^@case\s*/),F=U.match(/^@default(?![a-z])/),O=U.match(/^@break(?![a-z])/);if(V&&U.startsWith("@case")){if(W)K.push(W);let _=q+V[0].length,L=K1(z,_);if(!L){q++;continue}W={type:"case",value:L.expression,content:""},q=L.endPos}else if(F&&U.startsWith("@default")){if(W)K.push(W);W={type:"default",content:""},q+=F[0].length}else if(O&&U.startsWith("@break"))q+=O[0].length;else{if(W)W.content+=z[q];q++}}if(W)K.push(W);return{fullMatch:$.slice(Z,G+10),expression:Y.expression,cases:K,start:Z,end:G+10}}function CY($){let Z=[],J=0;while(J<$.length){let X=$.indexOf("{{",J),Y=$.indexOf("{!!",J),Q=!1,G;if(X===-1&&Y===-1)break;else if(X===-1)G=Y,Q=!0;else if(Y===-1)G=X,Q=!1;else if(Y<X)G=Y,Q=!0;else G=X,Q=!1;if(!Q&&$.slice(G,G+3)==="{{{")Q=!0;let z=Q?$.slice(G,G+3)==="{{{"?"{{{":"{!!":"{{",K=Q?z==="{{{"?"}}}":"!!}":"}}",q=G+z.length,W=SY($,q,K);if(W===-1){J=G+1;continue}let H=$.slice(q,W).trim(),U=W+K.length;Z.push({fullMatch:$.slice(G,U),expression:H,start:G,end:U,isRaw:Q}),J=U}return Z}function SY($,Z,J){let X=Z,Y=null,Q={paren:0,bracket:0,brace:0},G=0;while(X<$.length){let z=$[X];if((X>0?$[X-1]:"")==="\\"&&Y){X++;continue}if((z==='"'||z==="'")&&!Y){Y=z,X++;continue}if(z===Y&&Y!=="`"){Y=null,X++;continue}if(z==="`"&&!Y){Y="`",X++;continue}if(z==="`"&&Y==="`"&&G===0){Y=null,X++;continue}if(Y==="`"&&z==="$"&&$[X+1]==="{"){G++,X+=2;continue}if(G>0){if(z==="{")G++;else if(z==="}")G--;X++;continue}if(Y){X++;continue}if(z==="(")Q.paren++;else if(z===")")Q.paren--;else if(z==="[")Q.bracket++;else if(z==="]")Q.bracket--;else if(z==="{")Q.brace++;else if(z==="}")Q.brace--;if(Q.paren===0&&Q.bracket===0&&Q.brace<=0){if($.slice(X,X+J.length)===J)return X}X++}return-1}function PY($){let Z=d5($);if(Z.length===0)return{baseExpression:"",filters:[]};let J=Z[0],X=[];for(let Y=1;Y<Z.length;Y++){let Q=vY(Z[Y]);if(Q)X.push(Q)}return{baseExpression:J,filters:X}}function vY($){let Z=$.trim();if(!Z)return null;let J=Z.indexOf("(");if(J===-1)return{name:Z,args:[]};let X=Z.slice(0,J).trim(),Y=J+1,Q=M0(Z,"(",")",J);if(Q===-1)return{name:X,args:[]};let G=Z.slice(Y,Q),z=G7(G);return{name:X,args:z}}function G7($){let Z=[],J="",X={paren:0,bracket:0,brace:0},Y=null,Q=0;for(let G=0;G<$.length;G++){let z=$[G];if((G>0?$[G-1]:"")==="\\"&&Y){J+=z;continue}if((z==='"'||z==="'")&&!Y){Y=z,J+=z;continue}if(z===Y&&Y!=="`"){Y=null,J+=z;continue}if(z==="`"&&!Y){Y="`",J+=z;continue}if(z==="`"&&Y==="`"&&Q===0){Y=null,J+=z;continue}if(Y==="`"&&z==="$"&&$[G+1]==="{"){Q++,J+="${",G++;continue}if(Q>0&&z==="{"){Q++,J+=z;continue}if(Q>0&&z==="}"){Q--,J+=z;continue}if(Y){J+=z;continue}if(z==="(")X.paren++;else if(z===")")X.paren--;else if(z==="[")X.bracket++;else if(z==="]")X.bracket--;else if(z==="{")X.brace++;else if(z==="}")X.brace--;if(z===","&&X.paren===0&&X.bracket===0&&X.brace===0){Z.push(J.trim()),J="";continue}J+=z}if(J.trim())Z.push(J.trim());return Z}function xY($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return null;let X=M0($,"(",")",J);if(X===-1)return null;return{params:$.slice(J+1,X),endPos:X+1}}function fY($){let Z=[],X=new m5($).tokenize().filter((Q)=>Q.type!=="WHITESPACE"&&Q.type!=="COMMENT"),Y=0;while(Y<X.length){let Q=X[Y],G=!1;if(Q.type==="IDENTIFIER"&&Q.value==="export"){if(G=!0,Y++,Y>=X.length)break}let z=X[Y];if(z.type==="IDENTIFIER"&&(z.value==="const"||z.value==="let"||z.value==="var")){let K=z.value;if(Y++,Y>=X.length)break;let q=X[Y];if(q.type==="IDENTIFIER"){let W=q.value;if(Y++,Y<X.length&&X[Y].type==="OPERATOR"&&X[Y].value==="="){Y++;let H=Y<X.length?X[Y].start:$.length,U=Y7(X,Y,$);Y=U.nextIndex,Z.push({type:"variable",name:W,value:$.slice(H,U.endPos),exported:G,start:z.start,end:U.endPos})}}else if(q.type==="PUNCTUATION"&&(q.value==="{"||q.value==="[")){let W=q.start,H=q.value==="{"?"}":"]",U=M0($,q.value,H,W);if(U!==-1){let j=$.slice(W,U+1);if(Y=Q7(X,U+1),Y<X.length&&X[Y].type==="OPERATOR"&&X[Y].value==="="){Y++;let B=Y<X.length?X[Y].start:$.length,V=Y7(X,Y,$);Y=V.nextIndex;let F=`__stx_destructured_${Z.length}`;Z.push({type:"variable",name:F,value:`${$.slice(B,V.endPos)}; ${K} ${j} = ${F}`,exported:G,start:z.start,end:V.endPos})}}}}else if(z.type==="IDENTIFIER"&&z.value==="function"){let K=G?X[Y-1].start:z.start;if(Y++,Y>=X.length)break;let q=X[Y];if(q.type==="IDENTIFIER"){let W=q.value;Y++;let H=-1;while(Y<X.length){if(X[Y].type==="PUNCTUATION"&&X[Y].value==="{"){H=X[Y].start;break}Y++}if(H!==-1){let U=M0($,"{","}",H);if(U!==-1)Z.push({type:"function",name:W,value:$.slice(K,U+1).replace(/^export\s+/,""),exported:G,start:K,end:U+1}),Y=Q7(X,U+1)}}}else Y++}return Z}function Y7($,Z,J){let X=Z,Y={paren:0,bracket:0,brace:0},Q=Z<$.length?$[Z].start:J.length;while(X<$.length){let G=$[X];if(G.type==="PUNCTUATION"){if(G.value==="(")Y.paren++;else if(G.value===")")Y.paren--;else if(G.value==="[")Y.bracket++;else if(G.value==="]")Y.bracket--;else if(G.value==="{")Y.brace++;else if(G.value==="}")Y.brace--;if(G.value===";"&&Y.paren===0&&Y.bracket===0&&Y.brace===0){Q=G.start,X++;break}}if(G.type==="IDENTIFIER"&&(G.value==="const"||G.value==="let"||G.value==="var"||G.value==="function"||G.value==="export")){if(Y.paren===0&&Y.bracket===0&&Y.brace===0){Q=$[X-1]?.end??G.start;break}}Q=G.end,X++}return{nextIndex:X,endPos:Q}}function Q7($,Z){for(let J=0;J<$.length;J++)if($[J].start>=Z)return J;return $.length}function gY($,Z,J){let X=$,Y=!0;while(Y){Y=!1;let Q=X.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,z=u5(X,G);if(!z)break;try{let K;if(B0(z.expression))K=U0(z.expression,Object.keys(Z))(...Object.values(Z));else K=X0(z.expression,Z);let q="",W=!1;for(let H of z.cases)if(H.type==="default"){if(!W)q=H.content.trim()}else try{let U;if(H.value&&B0(H.value))U=U0(H.value,Object.keys(Z))(...Object.values(Z));else if(H.value)U=X0(H.value,Z);if(K===U){q=H.content.trim(),W=!0;break}}catch{continue}X=X.substring(0,G)+q+X.substring(z.end),Y=!0}catch(K){let q=K instanceof Error?K.message:String(K),W=N0("Switch",`Error evaluating @switch expression: ${q}`,D0.EVALUATION_ERROR);X=X.substring(0,G)+W+X.substring(z.end);break}}return X}function hY($){let Z=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(X)=>{return Z.push(X),`\x00stx-script-${Z.length-1}\x00`}),scripts:Z}}function uY($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(J,X)=>Z[Number(X)]??J)}function t0($,Z,J){let{masked:X,scripts:Y}=hY($);return uY(mY(X,Z,J),Y)}function mY($,Z,J){let X=$;X=gY(X,Z,J);{let Q=!0;while(Q){Q=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let z=G.index,K=K1(X,z+7);if(!K)break;let q=K.endPos,W=R1(X,"unless","endunless",q);if(W===-1){console.warn(`[stx] @unless directive at position ${z} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let H=X.slice(q,W),U=K.expression,j=-1;{let V=0,F=/@(?:if|unless)\s*\(/g,O=/@(?:endif|endunless)(?![a-z])/g,_=/@else(?![a-z])/g,L=[],w;while((w=F.exec(H))!==null)L.push({pos:w.index,type:"open"});while((w=O.exec(H))!==null)L.push({pos:w.index,type:"close"});while((w=_.exec(H))!==null)L.push({pos:w.index,type:"else"});L.sort((R,D)=>R.pos-D.pos);for(let R of L)if(R.type==="open")V++;else if(R.type==="close")V--;else if(R.type==="else"&&V===0){j=R.pos;break}}let B;if(j!==-1){let V=H.slice(0,j),F=H.slice(j+5);B=`@if (${U})${F}@else ${V}@endif`}else B=`@if (!(${U}))${H}@endif`;X=X.substring(0,z)+B+X.substring(W+10),Q=!0}}X=c5(X,Z,J),X=p5(X,Z,J),X=l5(X,Z);let Y=()=>{let Q=N2(X);if(Q.length===0)return!1;let G=Array(Q.length);for(let q=Q.length-1;q>=0;q--){let W=Q[q];try{let H="",U=!1;for(let j of W.branches){if(U)break;if(j.type==="else")H=j.content,U=!0;else try{let B;if(j.condition&&B0(j.condition))B=U0(j.condition,Object.keys(Z))(...Object.values(Z));else if(j.condition)B=X0(j.condition,Z);if(B)H=j.content,U=!0}catch(B){H=N0(j.type==="if"?"If":"Elseif",`Error in @${j.type}(${j.condition}): ${B instanceof Error?B.message:String(B)}`,D0.EVALUATION_ERROR),U=!0}}G[q]=H}catch(H){let U=H instanceof Error?H.message:String(H);G[q]=N0("If",`Error processing @if block: ${U}`,D0.EVALUATION_ERROR)}}let z=Array(Q.length*2+1),K=0;for(let q=0;q<Q.length;q++){let W=Q[q];z[q*2]=X.slice(K,W.start),z[q*2+1]=G[q],K=W.end}return z[Q.length*2]=X.slice(K),X=z.join(""),!0};while(!0){let Q=X;if(!Y())break;if(X===Q)break}return X}function z7($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let J=$[Z];if(J!=="'"&&J!=='"')return null;Z++;let X=[];while(Z<$.length){let Y=$[Z];if(Y==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(Y===J){Z++;break}X.push(Y),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function l5($,Z){let J=$;function X(z,K,q,W){let H=1,U=W,j=new RegExp(`@${K}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${q}(?![a-z])`,"g");while(U<z.length&&H>0){j.lastIndex=U,B.lastIndex=U;let V=j.exec(z),F=B.exec(z),O=V?V.index:1/0,_=F?F.index:1/0;if(O<_)H++,U=O+V[0].length;else if(_<1/0){if(H--,H===0)return _;U=_+F[0].length}else break}return-1}function Y(z,K,q){let W=0,H=new RegExp(`@${K}(?:\\s*\\(|\\s|$)`,"g"),U=new RegExp(`@${q}(?![a-z])`,"g"),j=/@else(?![a-z])/g,B=[],V;while((V=H.exec(z))!==null)B.push({pos:V.index,type:"open"});while((V=U.exec(z))!==null)B.push({pos:V.index,type:"close"});while((V=j.exec(z))!==null)B.push({pos:V.index,type:"else"});B.sort((F,O)=>F.pos-O.pos);for(let F of B)if(F.type==="open")W++;else if(F.type==="close")W--;else if(F.type==="else"&&W===0)return F.pos;return-1}{let z=!0;while(z){z=!1;let K=J.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!K||K.index===void 0)break;let q=K.index,W,H,U=J.slice(q+5),j=z7(U);if(j)W=j.value,H=q+5+j.consumed;else H=q+5;let B=X(J,"auth","endauth",H);if(B===-1){console.warn(`[stx] @auth directive at position ${q} has no matching @endauth \u2014 the block was skipped.`);break}let V=J.slice(H,B),F=Y(V,"auth","endauth"),O;if(!Z.auth)O=!1;else O=W?z1(`auth?.check && auth?.user?.[${W}]`,Z):z1("auth?.check",Z);let _;if(F!==-1){let L=V.slice(0,F),w=V.slice(F+5);_=O?L:w}else _=O?V:"";J=J.substring(0,q)+_+J.substring(B+8),z=!0}}{let z=!0;while(z){z=!1;let K=J.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!K||K.index===void 0)break;let q=K.index,W,H,U=J.slice(q+6),j=z7(U);if(j)W=j.value,H=q+6+j.consumed;else H=q+6;let B=X(J,"guest","endguest",H);if(B===-1){console.warn(`[stx] @guest directive at position ${q} has no matching @endguest \u2014 the block was skipped.`);break}let V=J.slice(H,B),F=Y(V,"guest","endguest"),O;if(!Z.auth)O=!0;else O=W?z1(`!auth?.check || !auth?.user?.[${W}]`,Z):z1("!auth?.check",Z);let _;if(F!==-1){let L=V.slice(0,F),w=V.slice(F+5);_=O?L:w}else _=O?V:"";J=J.substring(0,q)+_+J.substring(B+9),z=!0}}function Q(z,K,q){if(Z.userCan&&typeof Z.userCan[z]==="boolean")return Z.userCan[z];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let W=[z];if(K)W.push(K);if(q){let H=z1(q,Z);W.push(H)}return Z.permissions.check(...W)}catch{return!1}return!1}function G(z){let K=z.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!K)return null;return{ability:K[1],type:K[2],id:K[3]?.trim(),paramsEnd:K[0].length}}for(let z of["can","cannot"]){let K=`end${z}`,q=z==="can"?"elsecan":"elsecannot",W=!0;while(W){W=!1;let H=J.match(new RegExp(`@${z}\\s*\\(`));if(!H||H.index===void 0)break;let U=H.index,j=J.slice(U+`@${z}`.length),B=G(j);if(!B)break;let V=U+`@${z}`.length+B.paramsEnd,F=X(J,z,K,V);if(F===-1){console.warn(`[stx] @${z} directive at position ${U} has no matching @${K} \u2014 the block was skipped.`);break}let O=J.slice(V,F),_=[],L=0,w=new RegExp(`@${z}\\s*\\(`,"g"),R=new RegExp(`@${K}(?![a-z])`,"g"),D=new RegExp(`@${q}\\s*\\(`,"g"),N=/@else(?![a-z])/g,T=[],M;while((M=w.exec(O))!==null)T.push({pos:M.index,type:"open"});while((M=R.exec(O))!==null)T.push({pos:M.index,type:"close"});while((M=D.exec(O))!==null)T.push({pos:M.index,type:"elseDirective"});while((M=N.exec(O))!==null)T.push({pos:M.index,type:"else"});T.sort((b,y)=>b.pos-y.pos);for(let b of T){if(b.type==="open"){L++;continue}if(b.type==="close"){L--;continue}if(L===0)_.push(b)}let I=[],k=0;for(let b=0;b<_.length;b++){let y=_[b];if(I.push({content:O.slice(k,y.pos),ability:void 0}),y.type==="elseDirective"){let P=O.slice(y.pos+`@${q}`.length),h=G(P);if(h){I[I.length-1]={content:O.slice(k,y.pos)},k=y.pos+`@${q}`.length+h.paramsEnd,I.push({content:"",ability:h.ability,type:h.type,id:h.id}),I.pop();let p=_[b+1],u=p?p.pos:O.length;I.push({content:O.slice(k,u),ability:h.ability,type:h.type,id:h.id}),k=u}}else k=y.pos+5}if(k<O.length){let b=I[I.length-1];if(_.length>0&&_[_.length-1].type==="else")I.push({content:O.slice(k),isFinalElse:!0});else if(I.length===0)I.push({content:O.slice(k)})}let A=Q(B.ability,B.type,B.id),E=z==="can"?A:!A,S="";if(E)S=I[0]?.content||"";else{let b=!1;for(let y=1;y<I.length;y++){let P=I[y];if(P.isFinalElse){S=P.content,b=!0;break}if(P.ability){let h=Q(P.ability,P.type,P.id);if(z==="can"?h:!h){S=P.content,b=!0;break}}}if(!b&&I.length>0){let y=I[I.length-1];if(y.isFinalElse)S=y.content}}J=J.substring(0,U)+S+J.substring(F+`@${K}`.length),W=!0}}return J}function c5($,Z,J){let X=$;function Y(Q,G,z,K,q){let W=!0;while(W){W=!1;let H=new RegExp(`@${G}\\s*\\(`),U=Q.match(H);if(!U||U.index===void 0)break;let j=U.index,B=K1(Q,j+`@${G}`.length);if(!B)break;let V=B.endPos,F=R1(Q,G,z,V);if(F===-1){console.warn(`[stx] @${G} directive at position ${j} has no matching @${z} \u2014 the block was skipped.`);break}let O=Q.slice(V,F),_=B.expression,L=-1,w=0,R=0;while(R<O.length){let D=O.indexOf("@",R);if(D===-1)break;let N=O.substring(D);if(/^@(?:if|unless|isset|empty)\s*\(/.test(N)){w++,R=D+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(N)){w--,R=D+1;continue}if(w===0&&/^@else(?![a-z])/.test(N)){L=D;break}R=D+1}try{let D=K(_.trim()),N;if(L!==-1){let T=O.slice(0,L),M=O.slice(L+5);N=D?T:M}else N=D?O:"";Q=Q.substring(0,j)+N+Q.substring(F+`@${z}`.length),W=!0}catch(D){let N=D instanceof Error?D.message:String(D),T=N0(q,`Error processing @${G} directive: ${N}`,D0.EVALUATION_ERROR);Q=Q.substring(0,j)+T+Q.substring(F+`@${z}`.length);break}}return Q}return X=Y(X,"isset","endisset",(Q)=>{let G=z1(Q,Z);return G!==void 0&&G!==null},"Isset"),X=Y(X,"empty","endempty",(Q)=>{let G=z1(Q,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),X}function p5($,Z,J){let X=$,Y="development";function Q(G,z,K,q){let W=new RegExp(`@${z}(?![a-z])`,"g"),H=new RegExp(`@${K}(?![a-z])`,"g"),U=new RegExp(`^@${z}(?![a-z])`),j=new RegExp(`^@${K}(?![a-z])`),B=G,V=!0;while(V){V=!1,W.lastIndex=0;let F=W.exec(B);if(!F)break;let O=F.index,_=O+F[0].length;if(z==="env"){let A=B.substring(_).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!A)break;_+=A[0].length,q=Y===A[2]}let L=1,w=_,R=-1;while(L>0&&w<B.length){W.lastIndex=w,H.lastIndex=w;let A=W.exec(B),E=H.exec(B),S=A?A.index:1/0,b=E?E.index:1/0;if(S<b)L++,w=S+A[0].length;else if(b<1/0){if(L--,L===0){R=b;break}w=b+E[0].length}else break}if(R===-1){console.warn(`[stx] @${z} directive at position ${O} has no matching @${K} \u2014 the block was skipped.`);break}let D=B.substring(_,R),N=-1,T=0,M=0;while(M<D.length){let A=D.indexOf("@",M);if(A===-1)break;let E=D.substring(A);if(U.test(E)){T++,M=A+1;continue}if(j.test(E)){T--,M=A+1;continue}if(T===0&&/^@else(?![a-z])/.test(E)){N=A;break}M=A+1}let I;if(N!==-1){let A=D.slice(0,N),E=D.slice(N+5);I=q?A:E}else I=q?D:"";let k=`@${K}`.length;B=B.substring(0,O)+I+B.substring(R+k),V=!0}return B}return X=Q(X,"env","endenv",!1),X=Q(X,"production","endproduction",Y==="production"),X=Q(X,"development","enddevelopment",Y==="development"),X=Q(X,"staging","endstaging",Y==="staging"),X=Q(X,"testing","endtesting",Y==="testing"),X}var i5=new WeakMap;function K7($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function D1($,Z){if(!$)return Z?.nonceGenerator?.()??K7();let J=i5.get($);if(!J)J=Z?.nonceGenerator?.()??K7(),i5.set($,J);return J}function yU($){i5.delete($)}function q7($,Z){let J=[];for(let[X,Y]of Object.entries($)){if(Y===void 0||Y===null)continue;if(typeof Y==="boolean"){if(Y)J.push(X);continue}if(Array.isArray(Y)){let Q=[...Y];if(Z&&(X==="script-src"||X==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)J.push(`${X} ${Q.join(" ")}`)}}return J.join("; ")}function s5($,Z){return`<meta http-equiv="Content-Security-Policy" content="${q7($,Z).replace(/&/g,"&").replace(/"/g,""")}">`}var dY={"default-src":["'self'"],"script-src":["'self'","'strict-dynamic'"],"style-src":["'self'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'none'"],"base-uri":["'self'"],"form-action":["'self'"],"frame-ancestors":["'self'"],"upgrade-insecure-requests":!0},n5={"default-src":["'self'"],"script-src":["'self'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'","https:"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'self'"],"base-uri":["'self'"],"form-action":["'self'"],"upgrade-insecure-requests":!0},lY={"default-src":["'self'"],"script-src":["'self'","'unsafe-inline'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:","http:"],"font-src":["'self'","https:","http:","data:"],"connect-src":["'self'","https:","http:","ws:","wss:"],"media-src":["'self'","https:","http:"],"object-src":["'none'"],"frame-src":["'self'","https:"],"base-uri":["'self'"]},cY={"default-src":["'none'"],"frame-ancestors":["'none'"]};function bU($){return{enabled:!0,directives:{strict:dY,moderate:n5,relaxed:lY,api:cY}[$]||n5,useNonce:$==="strict",addMetaTag:!0}}function CU($,Z){let J={...$};for(let[X,Y]of Object.entries(Z)){let Q=X,G=J[Q];if(Y===void 0||Y===null)continue;if(typeof Y==="boolean")J[Q]=G||Y;else if(Array.isArray(Y)){let z=Array.isArray(G)?G:[],K=[...new Set([...z,...Y])];J[Q]=K}}return J}function W7($,Z,J){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=Z.useNonce?D1(J,Z):void 0,Y=s5(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
|
|
3171
3171
|
${Y}`)}function H7($,Z){let J=$;return J=J.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(X,Y)=>{if(Y.includes("nonce="))return X;return`<script nonce="${Z}"${Y}>`}),J=J.replace(/<style([^>]*)>/gi,(X,Y)=>{if(Y.includes("nonce="))return X;return`<style nonce="${Z}"${Y}>`}),J}function U7($,Z,J,X){let Y=$,Q=X.csp;if(Y=Y.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?D1(Z,Q):void 0;return s5(Q.directives,G)}),Y=Y.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return D1(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=D1(Z,Q);return Y}var pY={name:"csp",handler:($,Z,J,X)=>{let Q=J.__stx_options?.csp;if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?D1(J,Q):void 0;return s5(Q.directives,G)},hasEndTag:!1,description:"Insert Content-Security-Policy meta tag"},iY={name:"cspNonce",handler:($,Z,J,X)=>{let Q=J.__stx_options?.csp;if(!Q?.enabled||!Q.useNonce)return"";return D1(J,Q)},hasEndTag:!1,description:"Output the current CSP nonce value"};function SU(){return[pY,iY]}function PU($){let Z=[];if($["script-src"]?.includes("'unsafe-inline'"))Z.push("CSP: Using unsafe-inline in script-src significantly reduces XSS protection");if($["script-src"]?.includes("'unsafe-eval'"))Z.push("CSP: Using unsafe-eval in script-src allows eval() and related functions");if(!$["default-src"])Z.push("CSP: No default-src specified. Recommend adding default-src as a fallback");if($["default-src"]?.includes("*"))Z.push("CSP: Using * in default-src provides minimal protection");if(!$["object-src"]&&!$["default-src"]?.includes("'none'"))Z.push("CSP: Consider adding object-src: none to block plugins");if(!$["base-uri"])Z.push("CSP: Consider adding base-uri to prevent base tag injection attacks");for(let[J,X]of Object.entries($))if(Array.isArray(X)&&X.includes("http:"))Z.push(`CSP: Using http: in ${J} allows insecure resources`);return Z}function nY($=!1){return $?"Content-Security-Policy-Report-Only":"Content-Security-Policy"}function vU($,Z){if(!$.enabled)return{};let J=$.useNonce?D1(Z,$):void 0,X=q7($.directives,J);return{[nY($.reportOnly)]:X}}var xU={enabled:!1,reportOnly:!1,directives:n5,useNonce:!1,addMetaTag:!0};import sY from"crypto";var oY=40,j7="_token",o5=null;function rY($=oY){let Z=sY.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return o5=Z,Z}function aY(){if(!o5)rY();return o5}function tY($=j7){let Z=aY();return`<input type="hidden" name="${$}" value="${Z}">`}function B7($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,J,X)=>{return tY(X||j7)})}async function O7($,Z,J,X){if(!X.customDirectives||X.customDirectives.length===0)return $;let Y=$;for(let Q of X.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(X.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)Y=await eY(Y,Q,Z,J,X);else Y=await $Q(Y,Q,Z,J,X)}return Y}async function eY($,Z,J,X,Y){let{name:Q,handler:G}=Z,z=`@${Q}`,K=`@end${Q}`,q=$,W=N1(`${z}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${K}`,"g"),H=[],U=W.exec(q);while(U!==null){let[j,B="",V=""]=U,F=U.index||0;try{let O=B?F7(Z,B):[],_=V.trim(),L=await G(_,O,J,X);H.push({original:j,processed:L,startIndex:F})}catch(O){let _=O instanceof Error?O.message:String(O);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,O);H.push({original:j,processed:N0("CustomDirective",`Error in @${Q}${B?`(${B})`:""}: ${_}`,D0.EVALUATION_ERROR),startIndex:F})}U=W.exec(q)}for(let j=H.length-1;j>=0;j--){let{original:B,processed:V}=H[j];q=q.replace(B,V)}return q}async function $Q($,Z,J,X,Y){let{name:Q,handler:G}=Z,z=$,K=[],q=[];if(Z.rawParams){for(let U of V7(z,N1(`(?<![\\w$@])@${Q}\\s*\\(`,"g")))if(U.end!==-1)q.push({fullMatch:U.call,paramString:U.args,startIndex:U.start})}else{let U=N1(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");U.lastIndex=0;let j=U.exec(z);while(j!==null)q.push({fullMatch:j[0],paramString:j[1]??"",startIndex:j.index||0}),j=U.exec(z)}for(let{fullMatch:U,paramString:j,startIndex:B}of q)try{let V=F7(Z,j),F=await G("",V,J,X);K.push({original:U,processed:F,startIndex:B})}catch(V){let F=V instanceof Error?V.message:String(V);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,V);K.push({original:U,processed:N0("CustomDirective",`Error in @${Q}(${j}): ${F}`,D0.EVALUATION_ERROR),startIndex:B})}let W=N1(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),H=W.exec(z);while(H!==null){let[U]=H,j=H.index||0;try{let B=await G("",[],J,X);K.push({original:U,processed:B,startIndex:j})}catch(B){let V=B instanceof Error?B.message:String(B);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,B);K.push({original:U,processed:N0("CustomDirective",`Error in @${Q}: ${V}`,D0.EVALUATION_ERROR),startIndex:j})}H=W.exec(z)}for(let U=K.length-1;U>=0;U--){let{original:j,processed:B}=K[U];z=z.replace(j,B)}return z}function F7($,Z){return $.rawParams?L7(Z):ZQ(Z)}function ZQ($){if(!$.trim())return[];let Z=[],J="",X=!1,Y="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!X)X=!0,Y=G;else if(G===Y)X=!1;else J+=G;else if(G===","&&!X)Z.push(J.trim()),J="";else J+=G}if(J.trim())Z.push(J.trim());return Z.map((Q)=>{let G=Q.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var _7=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,w7=/^[A-Za-z_$][\w$]*$/,JQ=new Set(["light","dark","system"]);function M1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function XQ($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,J=Z.appearance,X=Z.colorMode;if(M1(Z.storageKey,"storageKey"),!J||typeof J!=="object"||Array.isArray(J))throw Error("@appearanceBootstrap appearance must be an object");if(!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap colorMode must be an object");if(M1(J.key,"appearance.key"),M1(J.attribute,"appearance.attribute"),M1(J.default,"appearance.default"),M1(X.key,"colorMode.key"),M1(X.attribute,"colorMode.attribute"),M1(X.default,"colorMode.default"),!w7.test(J.key)||!w7.test(X.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!_7.test(J.attribute)||!_7.test(X.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(J.allowed)||J.allowed.length===0||J.allowed.some((Y)=>typeof Y!=="string"||Y.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!J.allowed.includes(J.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!JQ.has(X.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:J.key,attribute:J.attribute,allowed:[...new Set(J.allowed)],default:J.default},colorMode:{key:X.key,attribute:X.attribute,default:X.default}}}function YQ($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function QQ($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${YQ($)};const root=document.documentElement;const MODES=["light","dark","system"];function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);const parsed=raw?JSON.parse(raw):{};if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed))stored=parsed}catch{}return stored}function write(stored){try{localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();return{appearance:config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default,colorMode:MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default}}function prefersDark(){try{return matchMedia("(prefers-color-scheme: dark)").matches}catch{return false}}function apply(){const state=resolve();const dark=state.colorMode==="dark"||(state.colorMode==="system"&&prefersDark());root.setAttribute("data-"+config.appearance.attribute,state.appearance);root.setAttribute("data-"+config.colorMode.attribute,state.colorMode);root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light";state.dark=dark;try{window.dispatchEvent(new CustomEvent("stx:appearance",{detail:state}))}catch{}return state}function store(key,allowed,value){if(allowed.includes(value)){const stored=read();stored[key]=value;write(stored)}return apply()}window.__stxAppearance={config:config,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return store(config.appearance.key,config.appearance.allowed,name)},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function GQ($,Z){let J=1,X=null,Y=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(Y){Y=!1;continue}if(X){if(G==="\\")Y=!0;else if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="(")J++;else if(G===")"&&--J===0)return Q}return-1}function R7($,Z){let J=$,X=/@appearanceBootstrap\s*\(/g,Y;while((Y=X.exec(J))!==null){let Q=Y.index+Y[0].length-1,G=GQ(J,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let z=J.slice(Q+1,G).trim(),K=X0(`(${z})`,Z),q=QQ(XQ(K));J=J.slice(0,Y.index)+q+J.slice(G+1),X.lastIndex=Y.index+q.length}return J}import zQ from"crypto";function A0($){return String($??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var a5={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function KQ($){return{...a5,...$.forms?.classes}}function O9($,Z,J,X){let Y=$||Z;return J?`${Y} ${X}`:Y}function h0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function u1($,Z){if(/\bid\s*=/i.test($))return"";return` id="${A0(Z)}"`}function r5($,Z,J){if(!Z)return"";let X="";if(!/\baria-invalid\s*=/i.test(J))X+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(J))X+=` aria-describedby="${A0(`${h0($)}-error`)}"`;return X}function qQ(){return zQ.randomUUID()}function sU($,Z,J,X){let Y=KQ(X),Q=$;return Q=HQ(Q,Z),Q=I2(Q,Z),Q=t5(Q,Z,Y),Q=e5(Q,Z,Y),Q}function I2($,Z){let J=$;return J=J.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=qQ();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${A0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),J=J.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,Y)=>{let Q=Y.toUpperCase();if(Y&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${A0(Q)}">`;return X}),J}function t5($,Z,J=a5){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Y,Q,G,z,K,q="")=>{let W=Q||G||"POST",H=z||K||"",U=q1(q),j=W.toUpperCase(),B=["GET","POST"].includes(j)?j:"POST",V=`<form method="${A0(B)}" action="${A0(H)}"${U?` ${U}`:""}>`;if(V+=`
|
|
3172
3172
|
${I2("@csrf",Z)}`,!["GET","POST"].includes(j))V+=`
|
|
3173
3173
|
${I2(`@method('${j}')`,Z)}`;return V}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Y,Q,G,z,K,q="")=>{let W=Q||G||"",H=z||K||"",U=q1(q),j=M2(W,Z),B=j!==void 0&&j!==null?j:H||"",V=U.match(/type=['"]([^'"]+)['"]/i),F=V?V[1]:"text",O=A2(W,Z),_=U.match(/class=['"]([^'"]+)['"]/i),L=O9(_?_[1]:"",J.input,O,J.inputError),w=U.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${A0(F)}" name="${A0(W)}"${u1(U,h0(W))} value="${A0(B)}" class="${L}"${r5(W,O,U)}${w?` ${w}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Y,Q,G="",z="")=>{let K=q1(G),q=M2(Q,Z)||z.trim(),W=A2(Q,Z),H=K.match(/class=['"]([^'"]+)['"]/i),U=O9(H?H[1]:"",J.input,W,J.inputError),j=K.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${A0(Q)}"${u1(K,h0(Q))} class="${U}"${r5(Q,W,K)}${j?` ${j}`:""}>${A0(q)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Y,Q,G="",z)=>{let K=q1(G),q=M2(Q,Z),W=A2(Q,Z),H=K.match(/class=['"]([^'"]+)['"]/i),U=O9(H?H[1]:"",J.input,W,J.inputError),j=K.replace(/class=['"][^'"]+['"]/i,""),B=z;if(q!==void 0)B=z.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(V,F,O)=>{if((Array.isArray(q)?q.some((L)=>String(L)===O):String(q)===O)&&!F.includes("selected"))return F.replace(/(<option)/,"$1 selected");return V});return`<select name="${A0(Q)}"${u1(K,h0(Q))} class="${U}"${r5(Q,W,K)}${j?` ${j}`:""}>${B}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,z="")=>{let K=G===void 0?"1":G,q=G===void 0?h0(Q):`${h0(Q)}-${h0(K)}`,W=q1(z),H=M2(Q,Z),U=H!==void 0&&(Array.isArray(H)?H.some((F)=>String(F)===K):H===!0||String(H)===K),j=W.match(/class=['"]([^'"]+)['"]/i),B=j?j[1]:J.checkInput,V=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${A0(Q)}"${u1(W,q)} value="${A0(K)}" class="${B}"${U?" checked":""}${V?` ${V}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,z="")=>{let K=q1(z),q=M2(Q,Z),W=q!==void 0&&q===G,H=K.match(/class=['"]([^'"]+)['"]/i),U=H?H[1]:J.checkInput,j=K.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${A0(Q)}"${u1(K,`${h0(Q)}-${h0(G)}`)} value="${A0(G)}" class="${U}"${W?" checked":""}${j?` ${j}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G="")=>{let z=q1(G),K=z.match(/accept=['"]([^'"]+)['"]/i),q=K?K[1]:"",W=z.includes("multiple"),H=A2(Q,Z),U=z.match(/class=['"]([^'"]+)['"]/i),j=O9(U?U[1]:"",J.input,H,J.inputError),B=z.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),V=[`<input type="file" name="${A0(Q)}"${u1(z,h0(Q))}`,`class="${j}"`];if(q)V.push(`accept="${A0(q)}"`);if(W)V.push("multiple");if(B)V.push(B);return`${V.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Y,Q,G="",z)=>{let K=q1(G),q=K.match(/class=['"]([^'"]+)['"]/i),W=q?q[1]:J.label,H=K.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${A0(h0(Q))}" class="${W}"${H?` ${H}`:""}>${z}</label>`}),X}function e5($,Z,J=a5){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,Y,Q)=>{try{if(A2(Y,Z)){let G=Q.replace(/\{\{([^}]+)\}\}/g,(z,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return D7(Y,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Y);return D7(Y,Z)}let q=K.trim();if(B0(q)){let W=X0(q,Z);return W!==void 0?String(W):q}return q}catch{return K}});return`<div id="${A0(`${h0(Y)}-error`)}" role="alert">${G}</div>`}return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function A2($,Z){if(!Z.errors)return!1;if(typeof Z.errors.has==="function")return Z.errors.has($);if(typeof Z.errors==="object")return Object.prototype.hasOwnProperty.call(Z.errors,$);return!1}function D7($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let J=Z.errors[$];return Array.isArray(J)?J[0]:String(J)}return""}function M2($,Z){let J;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let X=$.slice(0,-2);if(J=Z[X],J!==void 0)return J}return Z[$]}function q1($){if(!$.trim())return"";let Z=[],J=$.trim(),X=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Y;while((Y=X.exec(J))!==null){let[,Q,,G]=Y;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}var N7={required:($,Z,J)=>{if($===void 0||$===null||$===""||Array.isArray($)&&$.length===0)return`The ${J} field is required.`;return null},email:($,Z,J)=>{if(!$)return null;if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($)))return`The ${J} field must be a valid email address.`;return null},min:($,Z,J)=>{if(!$)return null;let X=Number(Z[0]);if(typeof $==="string"&&$.length<X)return`The ${J} field must be at least ${X} characters.`;if(typeof $==="number"&&$<X)return`The ${J} field must be at least ${X}.`;if(Array.isArray($)&&$.length<X)return`The ${J} field must have at least ${X} items.`;return null},max:($,Z,J)=>{if(!$)return null;let X=Number(Z[0]);if(typeof $==="string"&&$.length>X)return`The ${J} field must not exceed ${X} characters.`;if(typeof $==="number"&&$>X)return`The ${J} field must not exceed ${X}.`;if(Array.isArray($)&&$.length>X)return`The ${J} field must not have more than ${X} items.`;return null},confirmed:($,Z,J)=>{if(Z[0]!==void 0&&$!==Z[0])return`The ${J} confirmation does not match.`;return null},numeric:($,Z,J)=>{if(!$)return null;if(Number.isNaN(Number($)))return`The ${J} field must be a number.`;return null},integer:($,Z,J)=>{if(!$)return null;if(!Number.isInteger(Number($)))return`The ${J} field must be an integer.`;return null},alpha:($,Z,J)=>{if(!$)return null;if(!/^[a-z]+$/i.test(String($)))return`The ${J} field must only contain letters.`;return null},alphanumeric:($,Z,J)=>{if(!$)return null;if(!/^[a-z0-9]+$/i.test(String($)))return`The ${J} field must only contain letters and numbers.`;return null},url:($,Z,J)=>{if(!$)return null;try{return new URL(String($))?null:null}catch{return`The ${J} field must be a valid URL.`}},regex:($,Z,J)=>{if(!$)return null;try{if(!new RegExp(Z[0]).test(String($)))return`The ${J} field format is invalid.`;return null}catch{return`The ${J} field has an invalid validation pattern.`}},in:($,Z,J)=>{if(!$)return null;if(!Z.includes(String($)))return`The ${J} field must be one of: ${Z.join(", ")}.`;return null},notIn:($,Z,J)=>{if(!$)return null;if(Z.includes(String($)))return`The ${J} field must not be: ${Z.join(", ")}.`;return null},date:($,Z,J)=>{if(!$)return null;let X=new Date($);if(Number.isNaN(X.getTime()))return`The ${J} field must be a valid date.`;return null},before:($,Z,J)=>{if(!$)return null;let X=new Date($),Y=new Date(Z[0]);if(X>=Y)return`The ${J} field must be before ${Z[0]}.`;return null},after:($,Z,J)=>{if(!$)return null;let X=new Date($),Y=new Date(Z[0]);if(X<=Y)return`The ${J} field must be after ${Z[0]}.`;return null}};function oU($,Z){N7[$]=Z}function $$($){let[Z,...J]=$.split(":"),X=J.length>0?J.join(":").split(","):[];return{name:Z.trim(),params:X}}function WQ($,Z,J,X={}){let Y=[],Q=J.split("|").map((G)=>G.trim()).filter(Boolean);for(let G of Q){let z=$$(G),K=N7[z.name];if(!K){console.warn(`Unknown validation rule: ${z.name}`);continue}if(z.name==="confirmed"){let W=`${$}_confirmation`;z.params=[X[W]]}let q=K(Z,z.params||[],$);if(q)Y.push(z.message||q)}return{field:$,valid:Y.length===0,errors:Y}}function rU($,Z){let J={};for(let[X,Y]of Object.entries(Z)){let Q=WQ(X,$[X],Y,$);if(!Q.valid)J[X]=Q.errors}return J}function HQ($,Z){return $.replace(/@validate\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]*)\})?\s*\)/g,(J,X,Y,Q)=>{let G=Y.split("|").map((K)=>K.trim()),z=[];for(let K of G){let q=$$(K);switch(q.name){case"required":z.push("required");break;case"email":z.push('type="email"');break;case"url":z.push('type="url"');break;case"numeric":case"integer":if(z.push('type="number"'),q.name==="integer")z.push('step="1"');break;case"min":if(q.params?.[0])z.push(`minlength="${q.params[0]}"`);break;case"max":if(q.params?.[0])z.push(`maxlength="${q.params[0]}"`);break;case"regex":if(q.params?.[0])z.push(`pattern="${q.params[0]}"`);break}}return`<!-- @validate:${X}:${Y} -->${z.length>0?`<!-- attrs:${z.join(" ")} -->`:""}`})}var M7={required:{name:"required",validate:($)=>{if($===null||$===void 0||$==="")return"This field is required";if(Array.isArray($)&&$.length===0)return"This field is required";return!0},toHtml5:()=>["required"],message:"This field is required"},email:{name:"email",validate:($)=>{if(!$)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($))||"Please enter a valid email address"},toHtml5:()=>['type="email"'],message:"Please enter a valid email address"},url:{name:"url",validate:($)=>{if(!$)return!0;try{return new URL(String($)).protocol.startsWith("http")||"Please enter a valid URL"}catch{return"Please enter a valid URL"}},toHtml5:()=>['type="url"'],message:"Please enter a valid URL"},numeric:{name:"numeric",validate:($)=>{if(!$)return!0;return!Number.isNaN(Number($))||"Please enter a number"},toHtml5:()=>['type="number"'],message:"Please enter a number"},integer:{name:"integer",validate:($)=>{if(!$)return!0;let Z=Number($);return Number.isInteger(Z)||"Please enter a whole number"},toHtml5:()=>['type="number"','step="1"'],message:"Please enter a whole number"},alpha:{name:"alpha",validate:($)=>{if(!$)return!0;return/^[a-z]+$/i.test(String($))||"Please enter only letters"},toHtml5:()=>['pattern="[a-zA-Z]+"'],message:"Please enter only letters"},alphanumeric:{name:"alphanumeric",validate:($)=>{if(!$)return!0;return/^[a-z0-9]+$/i.test(String($))||"Please enter only letters and numbers"},toHtml5:()=>['pattern="[a-zA-Z0-9]+"'],message:"Please enter only letters and numbers"},min:{name:"min",validate:($,Z)=>{if(!$)return!0;let J=Number(Z[0]);if(typeof $==="string")return $.length>=J||`Must be at least ${J} characters`;if(typeof $==="number")return $>=J||`Must be at least ${J}`;if(Array.isArray($))return $.length>=J||`Must have at least ${J} items`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`min="${$[0]}"`],message:"Must be at least {{param}} characters"},max:{name:"max",validate:($,Z)=>{if(!$)return!0;let J=Number(Z[0]);if(typeof $==="string")return $.length<=J||`Must be no more than ${J} characters`;if(typeof $==="number")return $<=J||`Must be no more than ${J}`;if(Array.isArray($))return $.length<=J||`Must have no more than ${J} items`;return!0},toHtml5:($)=>[`maxlength="${$[0]}"`,`max="${$[0]}"`],message:"Must be no more than {{param}} characters"},between:{name:"between",validate:($,Z)=>{if(!$)return!0;let[J,X]=Z.map(Number);if(typeof $==="string")return $.length>=J&&$.length<=X||`Must be between ${J} and ${X} characters`;if(typeof $==="number")return $>=J&&$<=X||`Must be between ${J} and ${X}`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`maxlength="${$[1]}"`],message:"Must be between {{min}} and {{max}}"},confirmed:{name:"confirmed",validate:($,Z,J)=>{let X=Object.keys(J);for(let Y of X)if(Y.endsWith("_confirmation")&&J[Y]===$)return!0;return"Confirmation does not match"},message:"Confirmation does not match"},in:{name:"in",validate:($,Z)=>{if(!$)return!0;return Z.includes(String($))||`Must be one of: ${Z.join(", ")}`},message:"Must be one of: {{values}}"},notIn:{name:"notIn",validate:($,Z)=>{if(!$)return!0;return!Z.includes(String($))||`Must not be: ${Z.join(", ")}`},message:"Must not be: {{values}}"},regex:{name:"regex",validate:($,Z)=>{if(!$)return!0;try{return new RegExp(Z[0]).test(String($))||"Invalid format"}catch{return"Invalid format"}},toHtml5:($)=>[`pattern="${$[0]}"`],message:"Invalid format"},date:{name:"date",validate:($)=>{if(!$)return!0;let Z=new Date(String($));return!Number.isNaN(Z.getTime())||"Please enter a valid date"},toHtml5:()=>['type="date"'],message:"Please enter a valid date"},before:{name:"before",validate:($,Z)=>{if(!$)return!0;let J=new Date(String($)),X=new Date(Z[0]);return J<X||`Must be before ${Z[0]}`},toHtml5:($)=>[`max="${$[0]}"`],message:"Must be before {{date}}"},after:{name:"after",validate:($,Z)=>{if(!$)return!0;let J=new Date(String($)),X=new Date(Z[0]);return J>X||`Must be after ${Z[0]}`},toHtml5:($)=>[`min="${$[0]}"`],message:"Must be after {{date}}"},size:{name:"size",validate:($,Z)=>{if(!$)return!0;let J=Number(Z[0]);if(typeof $==="string")return $.length===J||`Must be exactly ${J} characters`;if(Array.isArray($))return $.length===J||`Must have exactly ${J} items`;return!0},message:"Must be exactly {{size}}"},phone:{name:"phone",validate:($)=>{if(!$)return!0;return/^\+?\(?\d{1,4}\)?[-\s./\d]*$/.test(String($))||"Please enter a valid phone number"},toHtml5:()=>['type="tel"','pattern="\\+?\\(?\\d{1,4}\\)?[-\\s./\\d]*"'],message:"Please enter a valid phone number"}};function aU($){M7[$.name]=$}function UQ($,Z,J={}){let X=[],Y=Z.split("|").map((Q)=>Q.trim());for(let Q of Y){let G=$$(Q),z=M7[G.name];if(!z){console.warn(`Unknown validation rule: ${G.name}`);continue}let K=z.validate($,G.params||[],J);if(K!==!0)X.push(K)}return{valid:X.length===0,errors:X}}function tU($,Z){let J={},X=!0;for(let[Y,Q]of Object.entries(Z)){let G=UQ($[Y],Q,$);if(!G.valid)X=!1,J[Y]=G.errors}return{valid:X,errors:J}}function eU($,Z){let J=JSON.stringify(Z);return`
|
|
@@ -3364,7 +3364,7 @@ document.addEventListener("focusout",function(e){
|
|
|
3364
3364
|
});
|
|
3365
3365
|
})();
|
|
3366
3366
|
`}function l7($,...Z){for(let J of Z){if($.serverDynamic[J]!==void 0)return String($.serverDynamic[J]);let X=$.static[J];if(typeof X==="string")return X}return}function c7($,Z){let J=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),X=$.match(J);if(!X)return{region:null,rest:$};return{region:X[2],rest:$.replace(X[0],"")}}var _$={name:"Suspense",aliases:["suspense"],render($,Z,J){let X=c7(Z,"fallback"),Y=X.rest,Q=c7(Y,"error"),G=Q.rest,z=X.region??l7($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',K=Q.region??l7($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${z}</div><div data-stx-suspense-error hidden>${K}</div><div data-stx-suspense-content hidden>${G}</div></div>`}};function I9($,...Z){for(let J of Z){if($.serverDynamic[J]!==void 0)return String($.serverDynamic[J]);let X=$.static[J];if(typeof X==="string")return X}return}var w$={name:"TransitionGroup",aliases:["transition-group"],render($,Z,J){let X=(I9($,"name")||"v").replace(/["'<>]/g,""),Y=(I9($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=I9($,"class"),G=I9($,"id"),z=[`data-stx-transition-group="${X}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Y} ${z}>${Z}</${Y}>`}};function p7($=m1){$.registerBuiltin(Y$),$.registerBuiltin(W$),$.registerBuiltin(H$),$.registerBuiltin(j$),$.registerBuiltin(B$),$.registerBuiltin(V$),$.registerBuiltin(L$),$.registerBuiltin(O$),$.registerBuiltin(_$),$.registerBuiltin(w$)}function T9($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var i7=new Map;function vQ($){let Z=i7.get($.source);if(!Z)Z=new RegExp(`(${$.source})(?![\\w.:-])`,"y"),i7.set($.source,Z);return Z}var n7=new WeakMap;function s7($){let Z=n7.get($);if(!Z)Z=new Set([...$].map((X)=>X.toLowerCase())),n7.set($,Z);let J=Z;return(X)=>!/[a-z]/.test(X)&&J.has(X.toLowerCase())}function o7($,Z,J){let X=[],Y=0,Q=typeof J==="function"?J:J?(G)=>J.has(G.toLowerCase()):void 0;while(Y<$.length){let G=$.indexOf("<",Y);if(G===-1)break;let z=vQ(Z);z.lastIndex=G+1;let K=z.exec($);if(!K){Y=G+1;continue}let q=K[1];if(Q&&Q(q)){let F=G+1+q.length;while(F<$.length&&$[F]!==">")F++;Y=F+1;continue}let W=G+1+q.length,H=null,U=W,j=-1,B=!1;while(W<$.length){let F=$[W];if(H){if(F==="\\"&&W+1<$.length){W+=2;continue}if(F===H)H=null;W++;continue}if(F==='"'||F==="'"){H=F,W++;continue}if(F==="/"&&W+1<$.length&&$[W+1]===">"){j=W+2,B=!0;break}if(F===">"){j=W+1;break}W++}if(j===-1){Y=G+1;continue}let V=$.slice(U,B?j-2:j-1).trim();if(B)X.push({fullMatch:$.slice(G,j),tagName:q,attributes:V,content:"",startIndex:G,endIndex:j,isSelfClosing:!0}),Y=j;else{let F=`<${q}`,O=`</${q}>`,_=1,L=j,w=-1;while(_>0&&L<$.length){let N=$.indexOf(F,L),T=$.indexOf(O,L);if(T===-1)break;if(N!==-1&&N<T){let M=$[N+F.length];if(M===" "||M===">"||M==="/"||M===`
|
|
3367
|
-
`||M==="\t")_++;L=N+F.length}else{if(_--,_===0){w=T;break}L=T+O.length}}if(w===-1){Y=j;continue}let R=$.slice(j,w),D=w+O.length;X.push({fullMatch:$.slice(G,D),tagName:q,attributes:V,content:R,startIndex:G,endIndex:D,isSelfClosing:!1}),Y=D}}return X}function r7($){return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function a7($,Z){try{let J=Buffer.from($,"base64").toString("utf8");return JSON.parse(J)}catch{}try{let J=$.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(J)}catch(J){if(Z?.debug)console.error("Error decoding __stx_ prop:",J);return $}}function R$($,Z){let J=0,X="",Y=Z;while(Y<$.length){let Q=$[Y];if(X){if(Q==="\\")Y++;else if(Q===X)X=""}else if(Q==='"'||Q==="'"||Q==="`")X=Q;else if(Q==="{")J++;else if(Q==="}"){if(J--,J===0)return $.slice(Z,Y+1)}Y++}return $.slice(Z)}function t7($){let Z=$.trim();if(!Z.startsWith("{")||!Z.endsWith("}"))return null;if(R$(Z,0).length!==Z.length)return null;return Z.slice(1,-1).trim()}var xQ=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),fQ=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function D$($){let Z=[],J=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,X;while((X=J.exec($))!==null){let Y=X[2]||"";if(!/(?:^|\s)(?::for|x-for|v-for|@for)\s*=/.test(Y))continue;let Q=X.index,G=Q+X[0].length,z=X[1].toLowerCase();if(X[0].endsWith("/>")||fQ.has(z)){Z.push([Q,G]);continue}let K=z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),q=new RegExp(`<\\/?${K}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");q.lastIndex=G;let W=1,H=G,U;while((U=q.exec($))!==null)if(U[0].startsWith("</")){if(W--,W===0){H=U.index+U[0].length;break}}else if(!U[0].endsWith("/>"))W++;Z.push([Q,H])}return Z}function $6($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>$6(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function Z6($,Z){if(!/:[\w-]+=/.test($))return $;let J=$,X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Y=[],Q;while((Q=X.exec($))!==null)Y.push([Q.index,Q.index+Q[0].length]);Y.push(...D$($));function G(H){return Y.some(([U,j])=>H>=U&&H<j)}let z=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,K=[],q=new Map,W=256;while((Q=z.exec(J))!==null){if(G(Q.index))continue;let H=Q[0],U=Q[2];if(!U||!U.includes(":"))continue;let j=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,B,V=U,F=!1;while((B=j.exec(U))!==null){let O=B[1],_=B[2];if(e7(O))continue;if(_.includes("()")&&!_.includes(".get(")||_.includes("$store")||_.includes("$ref"))continue;try{let L=Object.keys(Z),w=Object.values(Z),R=_.match(/^([a-zA-Z_$][\w$]*)/);if(R&&!L.includes(R[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(R[1]))continue;let D=JSON.stringify([L,_]),N=q.get(D);if(!N){if(N=Function(...L,`return (${_})`),q.size>=W)q.clear();q.set(D,N)}let T=N(...w);if(O==="class"){let M=$6(T);if(M){let I=V.match(/\sclass="([^"]*)"/);if(I)V=V.replace(I[0],` class="${I[1]} ${M}"`);else V=V.replace(B[0],` class="${M}"`)}else V=V.replace(B[0],"");F=!0;continue}if(xQ.has(O)){if(T)V=V.replace(B[0],` ${O}`);else V=V.replace(B[0],"");F=!0;continue}if(T===null||T===void 0||T===!1)V=V.replace(B[0],"");else{let M=String(T).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");V=V.replace(B[0],` ${O}="${M}"`)}F=!0}catch{continue}}if(F){let O=H.endsWith("/>")?" /":"",L=`<${Q[1]}${V}${O}>`;K.push({start:Q.index,end:Q.index+H.length,replacement:L})}}if(K.length>0){let H=Array(K.length*2+1),U=0;for(let j=0;j<K.length;j++){let{start:B,end:V,replacement:F}=K[j];H[j*2]=J.slice(U,B),H[j*2+1]=F,U=V}H[K.length*2]=J.slice(U),J=H.join("")}return J}import J6 from"fs";import X6 from"path";var b2=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);function C2($){if($.includes("-")||$==="component")return!1;if(/^[A-Z]/.test($))return!/[a-z]/.test($)&&[...b2].some((Z)=>Z.toLowerCase()===$.toLowerCase());return b2.has($)||/[A-Z]/.test($)}var Y6=!1;function gQ($,Z,J,X=!1){let Y={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},Q=new Set(Array.isArray(Z.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),G=(W)=>{if(Q.size===0)return!1;let H=Q0(W),U=H.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(U&&Q.has(U))return!0;for(let j of Q){let B=j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${B}\\s*\\(`).test(H))return!0}return!1},z=new Set(z6),K=(W)=>{if(!W.includes("-")||W.startsWith("@")||W.startsWith(":")||W.startsWith("x-")||W.startsWith("__"))return W;if(W.startsWith("aria-")||W.startsWith("data-"))return W;return W.replace(/-([a-z0-9])/g,(H,U)=>U.toUpperCase())},q=(W,H)=>{let U=K(W);if(Y.static[U]=H,U!==W)Y.staticNames[U]=W};for(let[W,H]of Object.entries($)){let U=W.startsWith("x-")&&!z.has(W)&&!W.startsWith("x-bind:")&&!W.startsWith("x-on:")?`:${W.slice(2)}`:W;if(U.startsWith("@")){Y.events[U]=H;continue}if(U.startsWith("__stx_")){let j=K(U.slice(6));Y.serverDynamic[j]=a7(H,J);continue}if(U.startsWith(":")){let j=K(U.slice(1)),B=H===A1?j:H;if(j==="if"||j==="for"||j==="show"){Y.clientReactive[j]=B;continue}if(X){Y.clientReactive[j]=B;continue}if(G(B)){Y.clientReactive[j]=B;continue}try{if(!B0(B)){if(J.debug)console.error(`Unsafe expression in :${j} binding: ${B}`);Y.clientReactive[j]=B;continue}let V=Object.keys(Z),O=U0(B,V)(...Object.values(Z));if(O===void 0){let _=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(E9(B).some((w)=>!_.has(w)&&!V.includes(w))){Y.clientReactive[j]=B;continue}}if(Y.serverDynamic[j]=O,j!==U.slice(1)&&Y.serverDynamicNames)Y.serverDynamicNames[j]=U.slice(1)}catch{Y.clientReactive[j]=B}continue}if(typeof H==="string"&&H.includes("{{")&&H.includes("}}")){let j=H.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(j)try{let B=j[1];if(B0(B)){let F=U0(B,Object.keys(Z))(...Object.values(Z));q(U,F!=null?String(F):"")}else{if(J.debug)console.error(`Unsafe expression in ${U}: ${B}`);q(U,H)}}catch(B){if(J.debug)console.error(`Error evaluating expression for ${U}:`,B);q(U,H)}else{let B=H,V=/\{\{\s*([\s\S]+?)\s*\}\}/g,F;while((F=V.exec(H))!==null)try{let O=F[1];if(!B0(O)){if(J.debug)console.error(`Unsafe expression in ${U}: ${O}`);continue}let L=U0(O,Object.keys(Z))(...Object.values(Z));B=B.replace(F[0],String(L??""))}catch(O){if(J.debug)console.error(`Error evaluating expression in ${U}:`,O)}q(U,B)}continue}q(U,H===A1?"true":r7(H))}return Y}var hQ=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function uQ($,Z,J){if(!$.includes("@"))return $;if(!hQ.some(([Y,Q])=>Y.test($)&&$.includes(Q)))return $;try{return t0($,Z,J)}catch{return $}}function mQ($){let Z={},J=0,X=$.length;while(J<X){while(J<X&&/\s/.test($[J]))J++;if(J>=X)break;let Y="";while(J<X&&!/[\s=]/.test($[J]))Y+=$[J],J++;if(!Y)break;while(J<X&&/\s/.test($[J]))J++;if(J<X&&$[J]==="="){J++;while(J<X&&/\s/.test($[J]))J++;let Q="";if(J<X&&($[J]==='"'||$[J]==="'")){let G=$[J];J++;while(J<X){let z=$[J];if(z==="\\"&&J+1<X){J++,Q+=$[J],J++;continue}if(z===G){J++;break}Q+=z,J++}}else if($[J]==="{"){Q=R$($,J),J+=Q.length;let G=t7(Q);if(G!==null){Z[`:${Y}`]=G;continue}}else while(J<X&&!/\s/.test($[J]))Q+=$[J],J++;Z[Y]=Q}else Z[Y]=A1}return Z}function Q6($){return Object.entries($).map(([Z,J])=>J===A1?Z:`${Z}="${dQ(J)}"`).join(" ")}function dQ($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function lQ($){let Z=new Set,J=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,X;while((X=J.exec($))!==null){let Y=X[1];if(m1.isBuiltin(Y))Z.add(Y)}return[...Z].sort()}async function cQ($,Z,J,X,Y){if(!/import\s/.test($))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=X6.dirname(J),z=[],K=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let H of $.matchAll(K)){let[U,j,B]=H,V=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,F=B,O,_=[];while((O=V.exec(B))!==null){let[L,w,R,D]=O,N=null,T=null;if(D.startsWith(".")||D.startsWith("/")){let k=X6.resolve(G,D);if(k.endsWith(".stx"))T=k;else{let A=`${k}.stx`;try{if(J6.statSync(A).isFile())T=A}catch{try{if(J6.statSync(k).isDirectory())N=k}catch{}}}}else N=R9(D,G);if(!N&&!T)continue;let M=!1,I=(k,A)=>{Q.set(k,A),Q.set(k.toLowerCase(),A);let E=k.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(E,A),Y.add(A)};if(R&&T)I(R,T),M=!0;else if(w){let k=w.slice(1,-1).split(",").map((E)=>E.trim()).filter(Boolean).map((E)=>{let S=E.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(S)return{source:S[1],local:S[2]};return{source:E,local:E}}),A=N?w9(N):null;for(let{source:E,local:S}of k){let b=null;if(T)b=T;else if(A)b=A.get(E)??A.get(E.toLowerCase())??A.get(E.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(b)I(S,b),M=!0}}if(M)_.push({start:O.index,end:O.index+L.length})}if(_.length===0)continue;for(let L=_.length-1;L>=0;L--)F=F.slice(0,_[L].start)+F.slice(_[L].end);z.push({start:H.index,end:H.index+U.length,value:`<script${j}>${F}</script>`})}if(z.length===0)return $;let q=[],W=0;for(let H of z)q.push($.slice(W,H.start),H.value),W=H.end;return q.push($.slice(W)),q.join("")}async function pQ($,Z,J,X,Y){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,z=/@import\s*\(\s*([^)]+)\s*\)/g,K;while((K=z.exec(Q))!==null){let[q,W]=K,H=W.split(",").map((U)=>U.trim().replace(/^['"]|['"]$/g,"")).filter((U)=>U.length>0);for(let U of H){let j=U.split("/"),V=j[j.length-1].replace(/\.stx$/,""),F=V.includes("-")?V.split("-").map((L)=>L.charAt(0).toUpperCase()+L.slice(1)).join(""):V.charAt(0).toUpperCase()+V.slice(1),O=null,_=D9(U,J,X);for(let L of _)try{if(await Bun.file(L).exists()){O=L;break}}catch{}if(O){G.set(F,O),G.set(V,O),G.set(V.toLowerCase(),O);let L=F.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(L,O),Y.add(O),X.debug)console.log(`Imported component: ${F} -> ${O}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${U}`)}Q=Q.replace(q,""),z.lastIndex=0}return Q}async function iQ($,Z,J,X,Y){let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let z=Z.__processedComponents,K=/@component\s*\(/g,q;while((q=K.exec(Q))!==null){let W=q.index,H=W+q[0].length-1,U=1,j=H+1;while(j<Q.length&&U>0){if(Q[j]==="(")U++;else if(Q[j]===")"){if(U--,U===0)break}j++}if(U!==0)break;let B=Q.substring(H+1,j),V=j+1,F=B.match(/^\s*['"]([^'"]+)['"]/);if(!F){K.lastIndex=0;continue}let O=F[1],_,L=B.slice(F[0].length),w=L.match(/^\s*,\s*/);if(w)_=L.slice(w[0].length).trim();let R={};if(_)try{R=d0(_,Z)}catch(k){let A=k instanceof Error?k.message:String(k);Q=Q.replace(Q.substring(W,V),`[Error parsing component props: ${A}]`);continue}let D="",N=V,M=Q.substring(V).match(/^([\s\S]*?)@endcomponent/);if(M)D=M[1].trim(),N=V+M[0].length;let I=await k1(O,R,D,G,Z,J,X,z,Y);Q=Q.substring(0,W)+I+Q.substring(N),K.lastIndex=0}return Q}async function nQ($,Z,J,X,Y){if(!$)return $;let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let z=Z.__processedComponents,K=f0(Q);Q=K.output;let q=D$(Q);return Q=await j(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await j(Q,/[A-Z][a-zA-Z0-9]*/,!0,s7(b2)),Q=await j(Q,/[a-z][a-z0-9]*/,!1,b2),Q=K.restore(Q),Q;async function j(B,V,F,O){if(!B)return B;let _=B,L=o7(_,V,O),w=new Map;for(let N=L.length-1;N>=0;N--){let T=L[N],M=F?T9(T.tagName):T.tagName,I=mQ(uQ(T.attributes,Z,J)),k=q.some(([h,p])=>T.startIndex>=h&&T.startIndex<p),A=gQ(I,Z,X,k),E=m1.getBuiltin(T.tagName),S=E?await k9(M,G,Z,J,X):!1;if(E&&!S){let h={context:Z,filePath:J,options:X,dependencies:Y},p=E.render(A,T.content,h);if(Object.keys(A.events).length>0){let u=Q6(A.events);p=p.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${u}`)}if(Object.keys(A.clientReactive).length>0)p=G6(p,A.clientReactive);w.set(N,p);continue}if(!F&&T.tagName.includes("-")&&!await k9(M,G,Z,J,X))continue;let b={};for(let[h,p]of Object.entries(A.static))b[h]=p;for(let[h,p]of Object.entries(A.serverDynamic))b[h]=p;let P=await k1(M,b,K.restore(T.content),G,Z,J,X,z,Y);if(Object.keys(A.events).length>0){let h=K6(P);if(h){let p=Q6(A.events),u=Object.keys(A.events).map((o)=>o.replace(/^@/,"").split(".")[0]).join(" ");P=P.substring(0,h.insertPos)+` data-stx-parent-events="${u}" ${p}`+P.substring(h.insertPos)}}if(Object.keys(A.clientReactive).length>0)P=G6(P,A.clientReactive);w.set(N,P)}if(w.size===0)return _;let R="",D=0;for(let N=0;N<L.length;N++){let T=w.get(N);if(T===void 0)continue;R+=_.slice(D,L[N].startIndex),R+=T,D=L[N].endIndex}return R+=_.slice(D),R}}function G6($,Z){let J=new Set(["if","for"]),X=new Set(["show"]),Y=Object.entries(Z).filter(([W])=>!J.has(W)),Q=Y.filter(([W])=>!X.has(W)).map(([W])=>T9(W)).join(" "),G=$,z=Y.length>0?K6(G):null;if(z){let W=Y.map(([U,j])=>`:${T9(U)}="${j.replace(/"/g,""")}"`).join(" "),H=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,z.insertPos)+`${H} ${W}`+G.substring(z.insertPos)}let K=Z.if;if(K)G=`<template :if="${K.replace(/"/g,""")}">${G}</template>`;let q=Z.for;if(q)G=`<template :for="${q.replace(/"/g,""")}">${G}</template>`;return G}function K6($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let J=0;while(J<$.length){let X=$.slice(J),Y=X.match(/^\s+/);if(Y){J+=Y[0].length;continue}if(X.startsWith("<!--")){let z=$.indexOf("-->",J+4);if(z===-1)return null;J=z+3;continue}let Q=X.match(/^<(script|style)\b[^>]*>/i);if(Q){let z=`</${Q[1].toLowerCase()}>`,K=$.toLowerCase().indexOf(z,J+Q[0].length);if(K===-1)return null;J=K+z.length;continue}let G=X.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:J+1+G[1].length}}return null}async function N$($,Z,J,X,Y){if(!Y6)p7(m1),Y6=!0;let Q=await cQ($,Z,J,X,Y);Q=await pQ(Q,Z,J,X,Y),Q=await iQ(Q,Z,J,X,Y);let G=[];for(let z=0;z<3;z++){let K=G.length,q=O1(Q,y9,(H,U)=>`\x00STX_COMPONENT_COMMENT_${K+U}\x00`,`STX_COMPONENT_COMMENT:${K}`);G.push(...q.tokens);let W=Q;if(Q=await nQ(q.output,Z,J,X,Y),Q===W)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(z,K)=>G[Number(K)]??"");if(X.debug){let z=lQ(Q);if(z.length>0)console.warn(`[stx] ${J}: unresolved component tag(s) after render passes: ${z.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}function M$($,Z){let J=0;for(let X=Z;X<$.length;X++){let Y=$[X];if(Y==="("||Y==="["||Y==="{")J++;else if(Y===")"||Y==="]"||Y==="}")J--;else if(Y===","&&J===0)return X}return-1}function oQ($,Z,J){let X=$,Y=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Q=Y.exec(X);while(Q){let G=Q.index,z=G+Q[0].length-1,K=1,q=z+1;while(q<X.length&&K>0){if(X[q]==="(")K++;else if(X[q]===")")K--;q++}if(K!==0)break;let W=X.substring(z+1,q-1),H=`${J}(${W})`;X=X.substring(0,G)+H+X.substring(q),Y.lastIndex=G+H.length,Q=Y.exec(X)}return X}function rQ($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function U6($){let Z=$,J=[],X=new Set,Y=0,Q=0,G=Z.length,z=(H)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===H){Q++;return}Q++}},K=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let H=1;while(Q<G&&H>0)if(Z[Q]==="{")H++,Q++;else if(Z[Q]==="}")H--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')z(Z[Q]);else if(Z[Q]==="`")K();else Q++;continue}Q++}},q=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
|
|
3367
|
+
`||M==="\t")_++;L=N+F.length}else{if(_--,_===0){w=T;break}L=T+O.length}}if(w===-1){Y=j;continue}let R=$.slice(j,w),D=w+O.length;X.push({fullMatch:$.slice(G,D),tagName:q,attributes:V,content:R,startIndex:G,endIndex:D,isSelfClosing:!1}),Y=D}}return X}function r7($){return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function a7($,Z){try{let J=Buffer.from($,"base64").toString("utf8");return JSON.parse(J)}catch{}try{let J=$.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(J)}catch(J){if(Z?.debug)console.error("Error decoding __stx_ prop:",J);return $}}function R$($,Z){let J=0,X="",Y=Z;while(Y<$.length){let Q=$[Y];if(X){if(Q==="\\")Y++;else if(Q===X)X=""}else if(Q==='"'||Q==="'"||Q==="`")X=Q;else if(Q==="{")J++;else if(Q==="}"){if(J--,J===0)return $.slice(Z,Y+1)}Y++}return $.slice(Z)}function t7($){let Z=$.trim();if(!Z.startsWith("{")||!Z.endsWith("}"))return null;if(R$(Z,0).length!==Z.length)return null;return Z.slice(1,-1).trim()}var xQ=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),fQ=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function D$($){let Z=[],J=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,X;while((X=J.exec($))!==null){let Y=X[2]||"";if(!/(?:^|\s)(?::for|x-for|v-for|@for)\s*=/.test(Y))continue;let Q=X.index,G=Q+X[0].length,z=X[1].toLowerCase();if(X[0].endsWith("/>")||fQ.has(z)){Z.push([Q,G]);continue}let K=z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),q=new RegExp(`<\\/?${K}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");q.lastIndex=G;let W=1,H=G,U;while((U=q.exec($))!==null)if(U[0].startsWith("</")){if(W--,W===0){H=U.index+U[0].length;break}}else if(!U[0].endsWith("/>"))W++;Z.push([Q,H])}return Z}function $6($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>$6(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function Z6($,Z){if(!/:[\w-]+=/.test($))return $;let J=$,X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Y=[],Q;while((Q=X.exec($))!==null)Y.push([Q.index,Q.index+Q[0].length]);Y.push(...D$($));function G(H){return Y.some(([U,j])=>H>=U&&H<j)}let z=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*?)\s*(\/?)>/g,K=[],q=new Map,W=256;while((Q=z.exec(J))!==null){if(G(Q.index))continue;let H=Q[0],U=Q[2];if(!U||!U.includes(":"))continue;let j=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,B,V=U,F=!1;while((B=j.exec(U))!==null){let O=B[1],_=B[2];if(e7(O))continue;if(_.includes("()")&&!_.includes(".get(")||_.includes("$store")||_.includes("$ref"))continue;try{let L=Object.keys(Z),w=Object.values(Z),R=_.match(/^([a-zA-Z_$][\w$]*)/);if(R&&!L.includes(R[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(R[1]))continue;let D=JSON.stringify([L,_]),N=q.get(D);if(!N){if(N=Function(...L,`return (${_})`),q.size>=W)q.clear();q.set(D,N)}let T=N(...w);if(O==="class"){let M=$6(T);if(M){let I=V.match(/\sclass="([^"]*)"/);if(I)V=V.replace(I[0],` class="${I[1]} ${M}"`);else V=V.replace(B[0],` class="${M}"`)}else V=V.replace(B[0],"");F=!0;continue}if(xQ.has(O)){if(T)V=V.replace(B[0],` ${O}`);else V=V.replace(B[0],"");F=!0;continue}if(T===null||T===void 0||T===!1)V=V.replace(B[0],"");else{let M=String(T).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");V=V.replace(B[0],` ${O}="${M}"`)}F=!0}catch{continue}}if(F){let O=Q[3]?" /":"",L=`<${Q[1]}${V}${O}>`;K.push({start:Q.index,end:Q.index+H.length,replacement:L})}}if(K.length>0){let H=Array(K.length*2+1),U=0;for(let j=0;j<K.length;j++){let{start:B,end:V,replacement:F}=K[j];H[j*2]=J.slice(U,B),H[j*2+1]=F,U=V}H[K.length*2]=J.slice(U),J=H.join("")}return J}import J6 from"fs";import X6 from"path";var b2=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);function C2($){if($.includes("-")||$==="component")return!1;if(/^[A-Z]/.test($))return!/[a-z]/.test($)&&[...b2].some((Z)=>Z.toLowerCase()===$.toLowerCase());return b2.has($)||/[A-Z]/.test($)}var Y6=!1;function gQ($,Z,J,X=!1){let Y={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},Q=new Set(Array.isArray(Z.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),G=(W)=>{if(Q.size===0)return!1;let H=Q0(W),U=H.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(U&&Q.has(U))return!0;for(let j of Q){let B=j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${B}\\s*\\(`).test(H))return!0}return!1},z=new Set(z6),K=(W)=>{if(!W.includes("-")||W.startsWith("@")||W.startsWith(":")||W.startsWith("x-")||W.startsWith("__"))return W;if(W.startsWith("aria-")||W.startsWith("data-"))return W;return W.replace(/-([a-z0-9])/g,(H,U)=>U.toUpperCase())},q=(W,H)=>{let U=K(W);if(Y.static[U]=H,U!==W)Y.staticNames[U]=W};for(let[W,H]of Object.entries($)){let U=W.startsWith("x-")&&!z.has(W)&&!W.startsWith("x-bind:")&&!W.startsWith("x-on:")?`:${W.slice(2)}`:W;if(U.startsWith("@")){Y.events[U]=H;continue}if(U.startsWith("__stx_")){let j=K(U.slice(6));Y.serverDynamic[j]=a7(H,J);continue}if(U.startsWith(":")){let j=K(U.slice(1)),B=H===A1?j:H;if(j==="if"||j==="for"||j==="show"){Y.clientReactive[j]=B;continue}if(X){Y.clientReactive[j]=B;continue}if(G(B)){Y.clientReactive[j]=B;continue}try{if(!B0(B)){if(J.debug)console.error(`Unsafe expression in :${j} binding: ${B}`);Y.clientReactive[j]=B;continue}let V=Object.keys(Z),O=U0(B,V)(...Object.values(Z));if(O===void 0){let _=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(E9(B).some((w)=>!_.has(w)&&!V.includes(w))){Y.clientReactive[j]=B;continue}}if(Y.serverDynamic[j]=O,j!==U.slice(1)&&Y.serverDynamicNames)Y.serverDynamicNames[j]=U.slice(1)}catch{Y.clientReactive[j]=B}continue}if(typeof H==="string"&&H.includes("{{")&&H.includes("}}")){let j=H.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(j)try{let B=j[1];if(B0(B)){let F=U0(B,Object.keys(Z))(...Object.values(Z));q(U,F!=null?String(F):"")}else{if(J.debug)console.error(`Unsafe expression in ${U}: ${B}`);q(U,H)}}catch(B){if(J.debug)console.error(`Error evaluating expression for ${U}:`,B);q(U,H)}else{let B=H,V=/\{\{\s*([\s\S]+?)\s*\}\}/g,F;while((F=V.exec(H))!==null)try{let O=F[1];if(!B0(O)){if(J.debug)console.error(`Unsafe expression in ${U}: ${O}`);continue}let L=U0(O,Object.keys(Z))(...Object.values(Z));B=B.replace(F[0],String(L??""))}catch(O){if(J.debug)console.error(`Error evaluating expression in ${U}:`,O)}q(U,B)}continue}q(U,H===A1?"true":r7(H))}return Y}var hQ=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function uQ($,Z,J){if(!$.includes("@"))return $;if(!hQ.some(([Y,Q])=>Y.test($)&&$.includes(Q)))return $;try{return t0($,Z,J)}catch{return $}}function mQ($){let Z={},J=0,X=$.length;while(J<X){while(J<X&&/\s/.test($[J]))J++;if(J>=X)break;let Y="";while(J<X&&!/[\s=]/.test($[J]))Y+=$[J],J++;if(!Y)break;while(J<X&&/\s/.test($[J]))J++;if(J<X&&$[J]==="="){J++;while(J<X&&/\s/.test($[J]))J++;let Q="";if(J<X&&($[J]==='"'||$[J]==="'")){let G=$[J];J++;while(J<X){let z=$[J];if(z==="\\"&&J+1<X){J++,Q+=$[J],J++;continue}if(z===G){J++;break}Q+=z,J++}}else if($[J]==="{"){Q=R$($,J),J+=Q.length;let G=t7(Q);if(G!==null){Z[`:${Y}`]=G;continue}}else while(J<X&&!/\s/.test($[J]))Q+=$[J],J++;Z[Y]=Q}else Z[Y]=A1}return Z}function Q6($){return Object.entries($).map(([Z,J])=>J===A1?Z:`${Z}="${dQ(J)}"`).join(" ")}function dQ($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function lQ($){let Z=new Set,J=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,X;while((X=J.exec($))!==null){let Y=X[1];if(m1.isBuiltin(Y))Z.add(Y)}return[...Z].sort()}async function cQ($,Z,J,X,Y){if(!/import\s/.test($))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=X6.dirname(J),z=[],K=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let H of $.matchAll(K)){let[U,j,B]=H,V=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,F=B,O,_=[];while((O=V.exec(B))!==null){let[L,w,R,D]=O,N=null,T=null;if(D.startsWith(".")||D.startsWith("/")){let k=X6.resolve(G,D);if(k.endsWith(".stx"))T=k;else{let A=`${k}.stx`;try{if(J6.statSync(A).isFile())T=A}catch{try{if(J6.statSync(k).isDirectory())N=k}catch{}}}}else N=R9(D,G);if(!N&&!T)continue;let M=!1,I=(k,A)=>{Q.set(k,A),Q.set(k.toLowerCase(),A);let E=k.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(E,A),Y.add(A)};if(R&&T)I(R,T),M=!0;else if(w){let k=w.slice(1,-1).split(",").map((E)=>E.trim()).filter(Boolean).map((E)=>{let S=E.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(S)return{source:S[1],local:S[2]};return{source:E,local:E}}),A=N?w9(N):null;for(let{source:E,local:S}of k){let b=null;if(T)b=T;else if(A)b=A.get(E)??A.get(E.toLowerCase())??A.get(E.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(b)I(S,b),M=!0}}if(M)_.push({start:O.index,end:O.index+L.length})}if(_.length===0)continue;for(let L=_.length-1;L>=0;L--)F=F.slice(0,_[L].start)+F.slice(_[L].end);z.push({start:H.index,end:H.index+U.length,value:`<script${j}>${F}</script>`})}if(z.length===0)return $;let q=[],W=0;for(let H of z)q.push($.slice(W,H.start),H.value),W=H.end;return q.push($.slice(W)),q.join("")}async function pQ($,Z,J,X,Y){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,z=/@import\s*\(\s*([^)]+)\s*\)/g,K;while((K=z.exec(Q))!==null){let[q,W]=K,H=W.split(",").map((U)=>U.trim().replace(/^['"]|['"]$/g,"")).filter((U)=>U.length>0);for(let U of H){let j=U.split("/"),V=j[j.length-1].replace(/\.stx$/,""),F=V.includes("-")?V.split("-").map((L)=>L.charAt(0).toUpperCase()+L.slice(1)).join(""):V.charAt(0).toUpperCase()+V.slice(1),O=null,_=D9(U,J,X);for(let L of _)try{if(await Bun.file(L).exists()){O=L;break}}catch{}if(O){G.set(F,O),G.set(V,O),G.set(V.toLowerCase(),O);let L=F.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(L,O),Y.add(O),X.debug)console.log(`Imported component: ${F} -> ${O}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${U}`)}Q=Q.replace(q,""),z.lastIndex=0}return Q}async function iQ($,Z,J,X,Y){let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let z=Z.__processedComponents,K=/@component\s*\(/g,q;while((q=K.exec(Q))!==null){let W=q.index,H=W+q[0].length-1,U=1,j=H+1;while(j<Q.length&&U>0){if(Q[j]==="(")U++;else if(Q[j]===")"){if(U--,U===0)break}j++}if(U!==0)break;let B=Q.substring(H+1,j),V=j+1,F=B.match(/^\s*['"]([^'"]+)['"]/);if(!F){K.lastIndex=0;continue}let O=F[1],_,L=B.slice(F[0].length),w=L.match(/^\s*,\s*/);if(w)_=L.slice(w[0].length).trim();let R={};if(_)try{R=d0(_,Z)}catch(k){let A=k instanceof Error?k.message:String(k);Q=Q.replace(Q.substring(W,V),`[Error parsing component props: ${A}]`);continue}let D="",N=V,M=Q.substring(V).match(/^([\s\S]*?)@endcomponent/);if(M)D=M[1].trim(),N=V+M[0].length;let I=await k1(O,R,D,G,Z,J,X,z,Y);Q=Q.substring(0,W)+I+Q.substring(N),K.lastIndex=0}return Q}async function nQ($,Z,J,X,Y){if(!$)return $;let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let z=Z.__processedComponents,K=f0(Q);Q=K.output;let q=D$(Q);return Q=await j(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await j(Q,/[A-Z][a-zA-Z0-9]*/,!0,s7(b2)),Q=await j(Q,/[a-z][a-z0-9]*/,!1,b2),Q=K.restore(Q),Q;async function j(B,V,F,O){if(!B)return B;let _=B,L=o7(_,V,O),w=new Map;for(let N=L.length-1;N>=0;N--){let T=L[N],M=F?T9(T.tagName):T.tagName,I=mQ(uQ(T.attributes,Z,J)),k=q.some(([h,p])=>T.startIndex>=h&&T.startIndex<p),A=gQ(I,Z,X,k),E=m1.getBuiltin(T.tagName),S=E?await k9(M,G,Z,J,X):!1;if(E&&!S){let h={context:Z,filePath:J,options:X,dependencies:Y},p=E.render(A,T.content,h);if(Object.keys(A.events).length>0){let u=Q6(A.events);p=p.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${u}`)}if(Object.keys(A.clientReactive).length>0)p=G6(p,A.clientReactive);w.set(N,p);continue}if(!F&&T.tagName.includes("-")&&!await k9(M,G,Z,J,X))continue;let b={};for(let[h,p]of Object.entries(A.static))b[h]=p;for(let[h,p]of Object.entries(A.serverDynamic))b[h]=p;let P=await k1(M,b,K.restore(T.content),G,Z,J,X,z,Y);if(Object.keys(A.events).length>0){let h=K6(P);if(h){let p=Q6(A.events),u=Object.keys(A.events).map((o)=>o.replace(/^@/,"").split(".")[0]).join(" ");P=P.substring(0,h.insertPos)+` data-stx-parent-events="${u}" ${p}`+P.substring(h.insertPos)}}if(Object.keys(A.clientReactive).length>0)P=G6(P,A.clientReactive);w.set(N,P)}if(w.size===0)return _;let R="",D=0;for(let N=0;N<L.length;N++){let T=w.get(N);if(T===void 0)continue;R+=_.slice(D,L[N].startIndex),R+=T,D=L[N].endIndex}return R+=_.slice(D),R}}function G6($,Z){let J=new Set(["if","for"]),X=new Set(["show"]),Y=Object.entries(Z).filter(([W])=>!J.has(W)),Q=Y.filter(([W])=>!X.has(W)).map(([W])=>T9(W)).join(" "),G=$,z=Y.length>0?K6(G):null;if(z){let W=Y.map(([U,j])=>`:${T9(U)}="${j.replace(/"/g,""")}"`).join(" "),H=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,z.insertPos)+`${H} ${W}`+G.substring(z.insertPos)}let K=Z.if;if(K)G=`<template :if="${K.replace(/"/g,""")}">${G}</template>`;let q=Z.for;if(q)G=`<template :for="${q.replace(/"/g,""")}">${G}</template>`;return G}function K6($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let J=0;while(J<$.length){let X=$.slice(J),Y=X.match(/^\s+/);if(Y){J+=Y[0].length;continue}if(X.startsWith("<!--")){let z=$.indexOf("-->",J+4);if(z===-1)return null;J=z+3;continue}let Q=X.match(/^<(script|style)\b[^>]*>/i);if(Q){let z=`</${Q[1].toLowerCase()}>`,K=$.toLowerCase().indexOf(z,J+Q[0].length);if(K===-1)return null;J=K+z.length;continue}let G=X.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:J+1+G[1].length}}return null}async function N$($,Z,J,X,Y){if(!Y6)p7(m1),Y6=!0;let Q=await cQ($,Z,J,X,Y);Q=await pQ(Q,Z,J,X,Y),Q=await iQ(Q,Z,J,X,Y);let G=[];for(let z=0;z<3;z++){let K=G.length,q=O1(Q,y9,(H,U)=>`\x00STX_COMPONENT_COMMENT_${K+U}\x00`,`STX_COMPONENT_COMMENT:${K}`);G.push(...q.tokens);let W=Q;if(Q=await nQ(q.output,Z,J,X,Y),Q===W)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(z,K)=>G[Number(K)]??"");if(X.debug){let z=lQ(Q);if(z.length>0)console.warn(`[stx] ${J}: unresolved component tag(s) after render passes: ${z.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}function M$($,Z){let J=0;for(let X=Z;X<$.length;X++){let Y=$[X];if(Y==="("||Y==="["||Y==="{")J++;else if(Y===")"||Y==="]"||Y==="}")J--;else if(Y===","&&J===0)return X}return-1}function oQ($,Z,J){let X=$,Y=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Q=Y.exec(X);while(Q){let G=Q.index,z=G+Q[0].length-1,K=1,q=z+1;while(q<X.length&&K>0){if(X[q]==="(")K++;else if(X[q]===")")K--;q++}if(K!==0)break;let W=X.substring(z+1,q-1),H=`${J}(${W})`;X=X.substring(0,G)+H+X.substring(q),Y.lastIndex=G+H.length,Q=Y.exec(X)}return X}function rQ($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function U6($){let Z=$,J=[],X=new Set,Y=0,Q=0,G=Z.length,z=(H)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===H){Q++;return}Q++}},K=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let H=1;while(Q<G&&H>0)if(Z[Q]==="{")H++,Q++;else if(Z[Q]==="}")H--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')z(Z[Q]);else if(Z[Q]==="`")K();else Q++;continue}Q++}},q=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
|
|
3368
3368
|
`)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},W=()=>{if(Y!==0)return;let H=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(H){let B=H[2];if(!X.has(B))J.push(B),X.add(B);return}let U=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let B=U[1];if(!X.has(B))J.push(B),X.add(B);return}let j=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!X.has(B))J.push(B),X.add(B)}};while(Q<G){if(q())continue;if(Z[Q]==="'"||Z[Q]==='"'){z(Z[Q]);continue}if(Z[Q]==="`"){K();continue}if(Z[Q]==="{"){Y++,Q++;continue}if(Z[Q]==="}"){Y--,Q++;continue}if(Y===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))W();Q++}return J.join(", ")}function aQ($,Z=""){let J=U6($).split(",").map((X)=>X.trim()).filter(Boolean);return`
|
|
3369
3369
|
(function() {
|
|
3370
3370
|
${o1("var",J)}
|
|
@@ -3403,9 +3403,9 @@ ${Y}
|
|
|
3403
3403
|
} finally {
|
|
3404
3404
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
3405
3405
|
}
|
|
3406
|
-
})();`}function ZG($,Z){if(n0($)){let Y=n0($).tag.match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0,root:"body"};return{html:x1($,(Q,G)=>`<body${G} data-stx-scope="${Z}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let J=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(J){let X=J[2]+J[3],Y=J[2].slice(1),Q=X.match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1],stamped:!0,root:Y};let G=J[1],z=J[2],K=J[3];return{html:`${G}${z} data-stx-scope="${Z}"${K}${$.slice(J[0].length)}`,mergedIntoExisting:null,stamped:!0,root:Y}}return{html:$,mergedIntoExisting:null,stamped:!1,root:null}}var W6=0,A$=new Set;function $V(){A$.clear()}function H6($){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test($)}var ZV=new r1(500),j6=new Set;function JV(){j6.clear()}function JG($){if($.__onceStore instanceof Set)return $.__onceStore;return j6}async function I$($,Z,J,X,Y,Q=new Set){let G=X.partialsDir||z0.join(z0.dirname(J),"partials");if(G&&!z0.isAbsolute(G))G=z0.resolve(process.cwd(),G);let z=oQ($,"@partial","@include"),K=JG(Z);z=z.replace(/@once([\s\S]*?)@endonce/g,(V,F,O)=>{let _=F.trim(),L=`${J}:${_}`;if(K.has(L))return"";return K.add(L),F});{let V=/@includeIf\s*\(/g,F;while((F=V.exec(z))!==null){let O=F.index,_=O+F[0].length-1,L=1,w=_+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")")L--;w++}if(L!==0)break;let R=z.substring(_+1,w-1),D=R.match(/^\s*['"]([^'"]+)['"]/);if(!D){V.lastIndex=w;continue}let N=D[1],T=q(N,G,J),M="";if(T&&await Bun.file(T).exists())Y.add(T),M=`@include(${R})`;z=z.substring(0,O)+M+z.substring(w),V.lastIndex=0}}for(let[V,F]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${V.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),_;while((_=O.exec(z))!==null){let L=_.index,w=L+_[0].length-1,R=1,D=w+1;while(D<z.length&&R>0){if(z[D]==="(")R++;else if(z[D]===")")R--;D++}if(R!==0)break;let N=z.substring(w+1,D-1),T=M$(N,0);if(T===-1){O.lastIndex=D;continue}let M=N.substring(0,T).trim(),I=N.substring(T+1).trim(),k=I.match(/^\s*['"]([^'"]+)['"]/);if(!k){O.lastIndex=D;continue}let A=k[1],E=I.substring(k[0].length),S,b=M$(E,0);if(b!==-1)S=E.substring(b+1).trim();try{let y=`Boolean(${M})`,P;if(B0(y)){let u=U0(y,Object.keys(Z));P=Boolean(u(...Object.values(Z)))}else P=Boolean(X0(y,Z));let h=F?!P:P,p="";if(h){let u=q(A,G,J);if(u&&await Bun.file(u).exists())Y.add(u);p=`@include('${A}'${S?`, ${S}`:""})`}z=z.substring(0,L)+p+z.substring(D),O.lastIndex=0}catch(y){let P=y instanceof Error?y.message:String(y),h=O0("Include",`Error evaluating ${V} condition: ${P}`,J,$,L);z=z.substring(0,L)+h+z.substring(D),O.lastIndex=0}}}{let V=/@each\s*\(/g,F;while((F=V.exec(z))!==null){let O=F.index,_=O+F[0].length-1,L=1,w=_+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let R=z.substring(_+1,w),D=z.substring(O,w+1),N=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){V.lastIndex=0,z=z.replace(D,"");continue}let[,T,M,I,k]=N;try{let A,E=M.trim();if(B0(E))A=U0(E,Object.keys(Z))(...Object.values(Z));else A=X0(E,Z);let S="";if(Array.isArray(A)&&A.length>0)for(let b of A){let y={...Z,[I]:b},P=await U(T,y,$,O);S+=P}else if(k)S=await U(k,{},$,O);z=z.substring(0,O)+S+z.substring(w+1),V.lastIndex=0}catch(A){let E=A instanceof Error?A.message:String(A);z=z.substring(0,O)+O0("Each",`Error in @each: ${E}`,J,$,O)+z.substring(w+1),V.lastIndex=0}}}{let V=/@includeFirst\s*\(/g,F;while((F=V.exec(z))!==null){let O=F.index,_=O+F[0].length-1,L=1,w=_+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let R=z.substring(_+1,w),D=z.substring(O,w+1),N=R.match(/^\s*(\[[^\]]+\])/);if(!N){V.lastIndex=0,z=z.replace(D,"");continue}let T=N[1],M=R.slice(N[0].length),I,k=M.match(/^\s*,\s*\{/);if(k){M=M.slice(k[0].length-1);let S=1,b=1;while(b<M.length&&S>0){if(M[b]==="{")S++;else if(M[b]==="}"){if(S--,S===0)break}b++}I=M.substring(0,b+1),M=M.slice(b+1)}let A,E=M.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(E)A=E[1];try{let S=JSON.parse(T.replace(/'/g,'"')),b={};if(I)try{b=d0(I,Z)}catch(P){let h=P instanceof Error?P.message:String(P);if(X.debug){let p=O0("Include",`Error parsing includeFirst variables: ${h}`,J,$,O,D);z=z.replace(D,()=>p)}else z=z.replace(D,()=>A||"");continue}let y=!1;for(let P of S){let h=q(P,G,J);if(!h)continue;if(await e(h)){let p=await U(P,b,$,O);z=z.replace(D,()=>p),y=!0;break}}if(!y)if(A!==void 0)z=z.replace(D,()=>A);else if(X.debug){let P=O0("Include",`None of the includeFirst paths exist: ${T}`,J,$,O,D);z=z.replace(D,()=>P)}else z=z.replace(D,"")}catch(S){let b=S instanceof Error?S.message:String(S),y=O0("Include",`Error processing @includeFirst: ${b}`,J,$,O,D);z=z.replace(D,()=>y)}V.lastIndex=0}}function q(V,F,O){try{let _=V;if(!V.endsWith(".stx"))_=`${V}.stx`;let L=z0.resolve(F),w=z0.resolve(z0.dirname(O)),R;if(!_.startsWith("./")&&!_.startsWith("../")){for(let k of X._layerPartialDirs??[]){let A=z0.resolve(k,_);if(A.startsWith(`${z0.resolve(k)}${z0.sep}`)&&sQ(A))return A}R=z0.resolve(F,_)}else R=z0.resolve(w,_);let D=z0.normalize(R),N=D.startsWith(L+z0.sep)||D===L,T=D.startsWith(w+z0.sep)||D===w,M=!1,I=z0.dirname(w);if(D.startsWith(I+z0.sep)){if(!z0.relative(I,D).split(z0.sep).some((S)=>S.startsWith(".")&&S!=="."&&S!==".."))M=!0}if(!N&&!T&&!M)return console.error(`Security: Path traversal attempt blocked for include path: ${V}`),console.error(` Resolved to: ${D}`),console.error(` Allowed dirs: ${L}, ${w}`),null;return D}catch(_){return console.error(`Error resolving path ${V}: ${_}`),null}}let W=z0.resolve(J);Q.add(W);function H(V,F,O,_){return X.onIncludeError?.({includePath:V,templatePath:J,message:F,partialsDir:G}),O0("Include",F,J,O,_)}async function U(V,F={},O,_){let L=q(V,G,J);if(!L)return H(V,`Could not resolve path for include: ${V}`,O,_);let w=z0.resolve(L);if(Q.has(w)){let R=[...Q,w].map((D)=>z0.basename(D)).join(" -> ");return H(V,`Circular include detected: ${R}`,O,_)}try{Y.add(L);let R;if(!R)try{R=await Bun.file(L).text()}catch(i){let q0=i instanceof Error?i.message:String(i);return H(V,`Error loading include file ${V}: ${q0}`,O,_)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:i}=await import("./chunk-
|
|
3407
|
-
`;continue}if(L0)try{let{extractVariables:f}=await import("./chunk-
|
|
3408
|
-
`}}if(k.length>0){let{interpolateScriptExpressions:i}=await import("./chunk-
|
|
3406
|
+
})();`}function ZG($,Z){if(n0($)){let Y=n0($).tag.match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0,root:"body"};return{html:x1($,(Q,G)=>`<body${G} data-stx-scope="${Z}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let J=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(J){let X=J[2]+J[3],Y=J[2].slice(1),Q=X.match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1],stamped:!0,root:Y};let G=J[1],z=J[2],K=J[3];return{html:`${G}${z} data-stx-scope="${Z}"${K}${$.slice(J[0].length)}`,mergedIntoExisting:null,stamped:!0,root:Y}}return{html:$,mergedIntoExisting:null,stamped:!1,root:null}}var W6=0,A$=new Set;function $V(){A$.clear()}function H6($){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test($)}var ZV=new r1(500),j6=new Set;function JV(){j6.clear()}function JG($){if($.__onceStore instanceof Set)return $.__onceStore;return j6}async function I$($,Z,J,X,Y,Q=new Set){let G=X.partialsDir||z0.join(z0.dirname(J),"partials");if(G&&!z0.isAbsolute(G))G=z0.resolve(process.cwd(),G);let z=oQ($,"@partial","@include"),K=JG(Z);z=z.replace(/@once([\s\S]*?)@endonce/g,(V,F,O)=>{let _=F.trim(),L=`${J}:${_}`;if(K.has(L))return"";return K.add(L),F});{let V=/@includeIf\s*\(/g,F;while((F=V.exec(z))!==null){let O=F.index,_=O+F[0].length-1,L=1,w=_+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")")L--;w++}if(L!==0)break;let R=z.substring(_+1,w-1),D=R.match(/^\s*['"]([^'"]+)['"]/);if(!D){V.lastIndex=w;continue}let N=D[1],T=q(N,G,J),M="";if(T&&await Bun.file(T).exists())Y.add(T),M=`@include(${R})`;z=z.substring(0,O)+M+z.substring(w),V.lastIndex=0}}for(let[V,F]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${V.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),_;while((_=O.exec(z))!==null){let L=_.index,w=L+_[0].length-1,R=1,D=w+1;while(D<z.length&&R>0){if(z[D]==="(")R++;else if(z[D]===")")R--;D++}if(R!==0)break;let N=z.substring(w+1,D-1),T=M$(N,0);if(T===-1){O.lastIndex=D;continue}let M=N.substring(0,T).trim(),I=N.substring(T+1).trim(),k=I.match(/^\s*['"]([^'"]+)['"]/);if(!k){O.lastIndex=D;continue}let A=k[1],E=I.substring(k[0].length),S,b=M$(E,0);if(b!==-1)S=E.substring(b+1).trim();try{let y=`Boolean(${M})`,P;if(B0(y)){let u=U0(y,Object.keys(Z));P=Boolean(u(...Object.values(Z)))}else P=Boolean(X0(y,Z));let h=F?!P:P,p="";if(h){let u=q(A,G,J);if(u&&await Bun.file(u).exists())Y.add(u);p=`@include('${A}'${S?`, ${S}`:""})`}z=z.substring(0,L)+p+z.substring(D),O.lastIndex=0}catch(y){let P=y instanceof Error?y.message:String(y),h=O0("Include",`Error evaluating ${V} condition: ${P}`,J,$,L);z=z.substring(0,L)+h+z.substring(D),O.lastIndex=0}}}{let V=/@each\s*\(/g,F;while((F=V.exec(z))!==null){let O=F.index,_=O+F[0].length-1,L=1,w=_+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let R=z.substring(_+1,w),D=z.substring(O,w+1),N=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){V.lastIndex=0,z=z.replace(D,"");continue}let[,T,M,I,k]=N;try{let A,E=M.trim();if(B0(E))A=U0(E,Object.keys(Z))(...Object.values(Z));else A=X0(E,Z);let S="";if(Array.isArray(A)&&A.length>0)for(let b of A){let y={...Z,[I]:b},P=await U(T,y,$,O);S+=P}else if(k)S=await U(k,{},$,O);z=z.substring(0,O)+S+z.substring(w+1),V.lastIndex=0}catch(A){let E=A instanceof Error?A.message:String(A);z=z.substring(0,O)+O0("Each",`Error in @each: ${E}`,J,$,O)+z.substring(w+1),V.lastIndex=0}}}{let V=/@includeFirst\s*\(/g,F;while((F=V.exec(z))!==null){let O=F.index,_=O+F[0].length-1,L=1,w=_+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let R=z.substring(_+1,w),D=z.substring(O,w+1),N=R.match(/^\s*(\[[^\]]+\])/);if(!N){V.lastIndex=0,z=z.replace(D,"");continue}let T=N[1],M=R.slice(N[0].length),I,k=M.match(/^\s*,\s*\{/);if(k){M=M.slice(k[0].length-1);let S=1,b=1;while(b<M.length&&S>0){if(M[b]==="{")S++;else if(M[b]==="}"){if(S--,S===0)break}b++}I=M.substring(0,b+1),M=M.slice(b+1)}let A,E=M.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(E)A=E[1];try{let S=JSON.parse(T.replace(/'/g,'"')),b={};if(I)try{b=d0(I,Z)}catch(P){let h=P instanceof Error?P.message:String(P);if(X.debug){let p=O0("Include",`Error parsing includeFirst variables: ${h}`,J,$,O,D);z=z.replace(D,()=>p)}else z=z.replace(D,()=>A||"");continue}let y=!1;for(let P of S){let h=q(P,G,J);if(!h)continue;if(await e(h)){let p=await U(P,b,$,O);z=z.replace(D,()=>p),y=!0;break}}if(!y)if(A!==void 0)z=z.replace(D,()=>A);else if(X.debug){let P=O0("Include",`None of the includeFirst paths exist: ${T}`,J,$,O,D);z=z.replace(D,()=>P)}else z=z.replace(D,"")}catch(S){let b=S instanceof Error?S.message:String(S),y=O0("Include",`Error processing @includeFirst: ${b}`,J,$,O,D);z=z.replace(D,()=>y)}V.lastIndex=0}}function q(V,F,O){try{let _=V;if(!V.endsWith(".stx"))_=`${V}.stx`;let L=z0.resolve(F),w=z0.resolve(z0.dirname(O)),R;if(!_.startsWith("./")&&!_.startsWith("../")){for(let k of X._layerPartialDirs??[]){let A=z0.resolve(k,_);if(A.startsWith(`${z0.resolve(k)}${z0.sep}`)&&sQ(A))return A}R=z0.resolve(F,_)}else R=z0.resolve(w,_);let D=z0.normalize(R),N=D.startsWith(L+z0.sep)||D===L,T=D.startsWith(w+z0.sep)||D===w,M=!1,I=z0.dirname(w);if(D.startsWith(I+z0.sep)){if(!z0.relative(I,D).split(z0.sep).some((S)=>S.startsWith(".")&&S!=="."&&S!==".."))M=!0}if(!N&&!T&&!M)return console.error(`Security: Path traversal attempt blocked for include path: ${V}`),console.error(` Resolved to: ${D}`),console.error(` Allowed dirs: ${L}, ${w}`),null;return D}catch(_){return console.error(`Error resolving path ${V}: ${_}`),null}}let W=z0.resolve(J);Q.add(W);function H(V,F,O,_){return X.onIncludeError?.({includePath:V,templatePath:J,message:F,partialsDir:G}),O0("Include",F,J,O,_)}async function U(V,F={},O,_){let L=q(V,G,J);if(!L)return H(V,`Could not resolve path for include: ${V}`,O,_);let w=z0.resolve(L);if(Q.has(w)){let R=[...Q,w].map((D)=>z0.basename(D)).join(" -> ");return H(V,`Circular include detected: ${R}`,O,_)}try{Y.add(L);let R;if(!R)try{R=await Bun.file(L).text()}catch(i){let q0=i instanceof Error?i.message:String(i);return H(V,`Error loading include file ${V}: ${q0}`,O,_)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:i}=await import("./chunk-pefddsqn.js");R=i(R,Z)}if(R&&(X.debug||!S2()&&!P2()))try{let{warnUnbalancedTags:i}=await import("./chunk-shtm9a7r.js");i(R,L)}catch{}let D=R;try{let{processESImports:i}=await import("./chunk-ndnk50mc.js");await i(R,Z,L,X,Y)}catch(i){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,i instanceof Error?i.message:i)}let N=F9(D);if(N)D=N.content.trim();let M=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),I="";if(M)I=`<style${M[1]}>${M[2]}</style>`;let k=[];D=D.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(i,q0,r)=>{if(!H6(q0))return"";return k.push({attrs:q0,body:r}),`__STX_DATA_BLOCK_${k.length-1}__`}),D=D.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let A={...Z};A.__stx_signals_gate=X1(R,L);for(let[i,q0]of Object.entries(F))A[i]=q0;let E=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...R.matchAll(E)],b="",y=null,P=!1;for(let i of S){let q0=i[1]||"",r=i[2]||"";if(H6(q0))continue;let L0=q0.includes("server"),c0=E1(q0);if(!L0&&r.trim()){let{interpolateScriptExpressions:f}=await import("./chunk-7e31d2d9.js");r=f(r,A,V)}let p0="";try{let{extractAndStripCssImports:f,renderVendorStyleTags:l}=await import("./chunk-jz660eaa.js"),J0=f(r,{filePath:L,projectRoot:process.cwd()});r=J0.code,p0=l(J0.styles)}catch(f){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,f instanceof Error?f.message:f)}if(c0&&r.trim())r=y1(r);if(!L0){try{let{injectBrowserCoreAutoImports:l}=await import("./chunk-jz660eaa.js");r=l(r).code;let{hasUserImports:J0,bundleClientScript:j0}=await import("./chunk-sr3f7gk2.js");if(J0(r))r=await j0(r,L,{projectRoot:process.cwd()})}catch(l){if(X.debug)console.warn(`[stx] bundler skipped for ${L}:`,l instanceof Error?l.message:l)}let{stripStxRuntimeImports:f}=await import("./chunk-s8wvhby3.js");r=f(r)}let B1=rQ(r);if(B1&&!L0){P=!0,y=`stx_scope_${z0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++W6}`;let f=e0(r),l=q6(f,y);b+=`${p0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${y}">${l}</script>
|
|
3407
|
+
`;continue}if(L0)try{let{extractVariables:f}=await import("./chunk-dwk6afax.js");await f(r,A,L)}catch(f){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,f)}if(!L0&&!B1){let f=q0.replace(/\bclient\b/i,"").trim();y=`stx_scope_${z0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++W6}`;let l=e0(r),J0=q6(l,y);b+=`${p0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${y}"${f?` ${f}`:""}>${J0}</script>
|
|
3408
|
+
`}}if(k.length>0){let{interpolateScriptExpressions:i}=await import("./chunk-7e31d2d9.js");D=D.replace(/__STX_DATA_BLOCK_(\d+)__/g,(q0,r)=>{let L0=k[Number(r)];return`<script${L0.attrs}>${i(L0.body,A,V)}</script>`})}if(y){let i=ZG(D,y);if(D=i.html,i.mergedIntoExisting){let r=y,L0=i.mergedIntoExisting;b=b.split(`'${r}'`).join(`'${L0}'`).split(`"${r}"`).join(`"${L0}"`),y=L0}else if(!i.stamped&&P&&!A$.has(L))A$.add(L),console.warn(`[stx] ${z0.relative(process.cwd(),L)} 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.`);let q0=i.stamped&&i.root!==null&&C2(i.root);b=eQ(b,q0?y:null)}if(D.includes("@include")||D.includes("@partial"))D=await I$(D,A,L,X,Y,Q);let{processLoops:h,reportDeferredLoopWarnings:p}=await import("./chunk-0k1g666f.js"),u=h(D,A,L,void 0,!0);u=t0(u,A,L),u=p(u);let{processMetaDirectives:o,processSeoDirective:$0,processStructuredData:Y0}=await import("./chunk-b1372rpb.js");if(u=o(u,A,L,X),u=Y0(u,A,L),u=$0(u,A,L,X),u=F1(u,A,L),I)u+=`
|
|
3409
3409
|
`+I;if(b)u+=`
|
|
3410
3410
|
`+b;return u}catch(R){let D=R instanceof Error?R.message:String(R);return H(V,`Error processing include ${V}: ${D}`,O,_)}}let j=/@include\s*\(/g,B;while((B=j.exec(z))!==null){let V=B.index,F=V+B[0].length-1,O=1,_=F+1;while(_<z.length&&O>0){if(z[_]==="(")O++;else if(z[_]===")")O--;_++}if(O!==0)break;let L=z.substring(V,_),w=z.substring(F+1,_-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){j.lastIndex=_;continue}let D=R[1],N,T=w.substring(R[0].length),M=M$(T,0);if(M!==-1)N=T.substring(M+1).trim();let I={};if(N)try{I=d0(N,Z)}catch(A){let E=A instanceof Error?A.message:String(A);z=z.replace(L,O0("Include",`Error parsing include variables for ${D}: ${E}`,J,$,V)),j.lastIndex=0;continue}let k=await U(D,I,$,V);z=z.substring(0,V)+k+z.substring(_),j.lastIndex=0}return z}function T$($,Z){let J=$;function X(Y,Q,G,z){let K=Y,q=!0;while(q){q=!1;let W=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),H=K.match(W);if(!H||H.index===void 0)break;let U=H.index,j=H[1],B=U+H[0].length,V=new RegExp(`@${Q}\\(`),F=new RegExp(`@${G}(?![a-z])`),O=1,_=B,L=-1;while(O>0&&_<K.length){let R=K.slice(_),D=R.match(V),N=R.match(F),T=D?_+D.index:1/0,M=N?_+N.index:1/0;if(T<M)O++,_=T+(D[0].length||1);else if(M<1/0){if(O--,O===0){L=M;break}_=M+G.length+1}else break}if(L===-1)break;let w=K.slice(B,L);if(!Z[j])Z[j]=[];if(z)Z[j].unshift(w);else Z[j].push(w);K=K.substring(0,U)+K.substring(L+`@${G}`.length),q=!0}return K}return J=X(J,"push","endpush",!1),J=X(J,"prepend","endprepend",!0),J}function k$($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(J,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
|
|
3411
3411
|
`)})}import*as E$ from"path";async function B6($,Z,J=""){if(E$.basename(J)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return L6($,Z,J,"@js","@endjs")}async function V6($,Z,J=""){if(E$.basename(J)==="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 L6($,Z,J,"@ts","@endts")}async function L6($,Z,J,X,Y){let Q=$,G=N1(`${X}([\\s\\S]*?)${Y}`,"g"),z=[],K;while((K=G.exec($))!==null)z.push({fullMatch:K[0],content:K[1]||"",index:K.index});for(let{fullMatch:q,content:W,index:H}of z)try{let U={...Z,global:Z},j=Object.keys(U),B=Object.values(U),V=W.trim();if(X==="@ts")V=V.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let O=(V.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((D)=>D.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),_=O.length>0?`return { ${O.join(", ")} };`:"return {};",L=`
|
|
@@ -3468,14 +3468,14 @@ ${$.slice(J)}`}function J8($,Z={},J={},X){if(X??l$($))return $;return tG($,Z,J)}
|
|
|
3468
3468
|
${Z}${$.slice(Y)}`;if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Z+`
|
|
3469
3469
|
`+$.slice(G)}if(n0($))return x1($,(G)=>`${G}
|
|
3470
3470
|
${Z}`);return`${Z}
|
|
3471
|
-
${$}`}async function g9($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve"){let{getServeClientAsset:Y}=await import("./chunk-
|
|
3471
|
+
${$}`}async function g9($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve"){let{getServeClientAsset:Y}=await import("./chunk-x9xcmaef.js"),{url:Q}=await Y("runtime",Z.debug===!0);return p$($,`<script data-stx-runtime src="${Q}"></script>`)}if(Z.buildMode==="compile")return p$($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:J}=await import("./chunk-x9xcmaef.js"),X=await J(Z.debug);return p$($,`<script data-stx-scoped data-stx-runtime>${X}</script>`)}function Xz($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function H8($){if($.includes("data-stx-tooltip-runtime")||!Xz($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${F$()}</script>`,J=$.lastIndexOf("</body>");if(J===-1)return`${$}
|
|
3472
3472
|
${Z}`;return`${$.slice(0,J)}${Z}
|
|
3473
3473
|
${$.slice(J)}`}var Yz=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function Qz($){return Yz.test($)||$.includes("__stxRouter)return")||$.includes("__stxRouter=true")}async function Gz($,Z){if(!$.includes("</body>"))return $;if(Qz($))return $;let J=Z?.router,X="";{let K={};if(J){if(J.container)K.container=J.container;if(J.interceptAllLinks!==void 0)K.interceptAllLinks=J.interceptAllLinks;if(J.progress!==void 0)K.progress=J.progress;if(J.viewTransitions!==void 0)K.viewTransitions=J.viewTransitions;if(J.viewTransitionDuration!==void 0)K.viewTransitionDuration=J.viewTransitionDuration;if(J.viewTransitionEasing!==void 0)K.viewTransitionEasing=J.viewTransitionEasing;if(J.scrollToTop!==void 0)K.scrollToTop=J.scrollToTop;if(J.scrollRestoration!==void 0)K.scrollRestoration=J.scrollRestoration;if(J.prefetch!==void 0)K.prefetch=J.prefetch;if(J.cache!==void 0)K.cache=J.cache;if(J.progressColor!==void 0)K.progressColor=J.progressColor;if(J.progressHeight!==void 0)K.progressHeight=J.progressHeight}try{let q=await z8(Z?.pagesDir,Z?.root);if(q.length>0)K.ownedRoutes=q}catch{}if(Object.keys(K).length>0)X=`<script>window.__stxRouterConfig=${K8(K)};</script>
|
|
3474
|
-
`}let{getCachedRouterScript:Y,getServeClientAsset:Q}=await import("./chunk-
|
|
3474
|
+
`}let{getCachedRouterScript:Y,getServeClientAsset:Q}=await import("./chunk-x9xcmaef.js"),G=Z?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':Z?.buildMode==="serve"?`<script data-stx-router src="${(await Q("router")).url}"></script>`:`<script data-stx-router>${await Y()}</script>`,z=$.lastIndexOf("</body>");return $.slice(0,z)+X+G+`
|
|
3475
3475
|
</body>`+$.slice(z+7)}var U8=Symbol.for("stx.lazy-module-promises");function zz(){let $=globalThis;return $[U8]??=new Map,$[U8]}function n($,Z){let J=zz(),X=`${import.meta.url}\x00${$}`,Y=J.get(X);if(Y)return Y;let Q=Z();return J.set(X,Q),Q.catch(()=>{if(J.get(X)===Q)J.delete(X)}),Q}var i$=`(?:"[^"]*"|'[^']*'|[^>"'])*`,R8=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,Kz=65536,qz=4,u9=new Map;function bL(){u9.clear()}function Wz($){let Z=[];for(let J of g2($,U2)){let X=J.token.match(/^<script\b([^>]*)>/i),Y=J.token.match(/<\/script\s*>$/i);if(!X||!Y)continue;let Q=X[0].length,G=J.token.length-Y[0].length;Z.push(Object.freeze({fullMatch:J.token,attrs:X[1],body:J.token.slice(Q,G),start:J.start,end:J.end}))}return Z}function Hz($,Z={}){let J=$.length>=Kz,X=J?u9.get($):void 0;if(X===void 0){if(X=Wz($),J)w8(u9,qz),u9.set($,X)}let Y=Z.skipAttrs;if(!Y)return X.slice();let Q=[];for(let G of X)if(Y.lastIndex=0,!Y.test(G.attrs))Q.push(G);return Q}function D8($){let Z=$.trim(),J=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(J){let Y=J[1].trim(),Q=J[2].trim(),{itemVar:G,indexVar:z}=j8(Q);if(G)return{style:"as",iterable:Y,itemVar:G,indexVar:z}}let X=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(X){let Y=X[1].trim(),Q=X[2].trim(),{itemVar:G,indexVar:z}=j8(Y);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:z}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function j8($){let Z=$.trim(),J=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(J)return{itemVar:J[2],indexVar:J[1]};let X=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(X)return{itemVar:X[1],indexVar:X[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 o$($,Z){return _8($,Z)}function Uz($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,J=0,X;while((X=Z.exec($))!==null){let Y=X[1];if(Y.startsWith("if"))J++;else if(Y==="endif")J--;else if(J===0)return!0}return!1}function jz($){let Z=new Set,J=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel)\s*(?:<[^>]*>)?\s*\(/g,Y;while((Y=J.exec($))!==null){let Q=Y[1],G;while((G=X.exec(Q))!==null)Z.add(G[1])}return Z}function Bz($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let Z=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${i$})>`,"iy"),J=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,X=g2($,(Q,G)=>{Z.lastIndex=G;let z=Z.exec(Q);if(!z||z.index!==G||!J.test(z[2]))return-1;return Z.lastIndex}),Y=[];for(let Q of X){Z.lastIndex=0;let G=Z.exec(Q.token);if(!G)continue;let z=G[2].match(J),K=D8(z?.[1]??z?.[2]??""),q=[K.itemVar,K.indexVar].filter(Boolean);if(q.length===0)continue;let W=G[1],U=/\/\s*>$/.test(Q.token)||m9.has(W.toLowerCase())?Q.end:M8($,Q.start,W,Q.end);if(U!==-1)Y.push({start:Q.start,end:U,vars:new Set(q)})}return Y}var B8=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 Vz($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function V8($,Z,J,X){if(!$)return!1;let Y=Vz($),Q=!1,G=!1,z=!1,K=/([a-zA-Z_$][\w$]*)/g,q;while((q=K.exec(Y))!==null){let j=q[1];if(Y.slice(0,q.index).trimEnd().endsWith("."))continue;if(B8.has(j))continue;if(Z.has(j)||X?.has(j))Q=!0;else if(J&&j in J)G=!0}let W=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,H;while((H=W.exec(Y))!==null){let j=H[1];if(Y.slice(0,H.index).trimEnd().endsWith("."))continue;if(B8.has(j)||J&&j in J)continue;z=!0}return(Q||z)&&!G}function h9($,Z,J){let X=J===void 0?` ${Z}`:` ${Z}="${J.replace(/"/g,""")}"`,Y=$.trim(),Q=Y.match(R8);if(Q&&Lz(Q[3],Q[1])){let[,G,z,K]=Q;return`<${G}${z}${X}>${K}</${G}>`}return`<template${X}>${Y}</template>`}function Lz($,Z){let J=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),X=0,Y;while((Y=J.exec($))!==null)if(Y[1]){if(X--,X<0)return!1}else X++;return!0}function N8($,Z){let J=jz($);function X(Y){let Q=Y,G=Bz(Y),z=(H)=>{let U=new Set;for(let j of G)if(H>j.start&&H<j.end)for(let B of j.vars)U.add(B);return U},K=/@if\s*\(/g,q,W=[];while((q=K.exec(Q))!==null){let H=q.index,U=H+q[0].length,j=1,B=U;while(B<Q.length&&j>0){if(Q[B]==="(")j++;else if(Q[B]===")")j--;B++}if(j!==0)continue;let V=Q.substring(U,B-1).trim(),F=B,O=1,_=F,L=/@(if\s*\(|endif)/g;L.lastIndex=F;let w;while((w=L.exec(Q))!==null)if(w[1].startsWith("if"))O++;else if(w[1]==="endif"){if(O--,O===0){_=w.index+w[0].length;break}}if(O!==0)continue;let R=Q.substring(F,_-6).trim(),D;if(Uz(R)){let N=N2(Q.substring(H,_));if(N.length===0)continue;let T=N[0].branches.filter((A)=>A.type!=="else"),M=z(H);if(!(T.length>0&&T.every((A)=>V8(A.condition,J,Z,M))))continue;D=N[0].branches.map((A)=>{let E=X(A.content);if(A.type==="elseif")return h9(E,"@else-if",A.condition??"");if(A.type==="else")return h9(E,"@else");return h9(E,"@if",A.condition??"")}).join(`
|
|
3476
3476
|
`)}else{if(!V8(V,J,Z,z(H)))continue;D=h9(X(R),"@if",V)}W.push({start:H,end:_,replacement:D}),K.lastIndex=_}for(let H=W.length-1;H>=0;H--){let{start:U,end:j,replacement:B}=W[H];Q=Q.substring(0,U)+B+Q.substring(j)}return Q}return X($)}function Oz($){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 J=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(J)return J[1].length>0;let X=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(X)return X[1].length>0;return}var m9=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),L8=/<(script|style)\b/iy,Fz=/<\/script/gi,_z=/<\/style/gi;function M8($,Z,J,X){if(m9.has(J.toLowerCase()))return X;let Y=J.toLowerCase(),Q=$.length,G=1,z=X;while(z<Q){let K=$.indexOf("<",z);if(K===-1)return-1;if(z=K,$.startsWith("<!--",z)){let U=$.indexOf("-->",z+4);if(U===-1)return-1;z=U+3;continue}L8.lastIndex=z;let q=L8.exec($);if(q){let U=$.indexOf(">",z);if(U===-1)return-1;if($[U-1]==="/"){z=U+1;continue}let j=q[1].toLowerCase()==="script"?Fz:_z;j.lastIndex=z;let B=j.exec($);if(B===null)return-1;let V=$.indexOf(">",B.index);if(V===-1)return-1;z=V+1;continue}if($[z+1]==="/"){let U=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(z,z+64));if(!U){z++;continue}if(U[1].toLowerCase()===Y){if(G--,z+=U[0].length,G===0)return z;continue}z+=U[0].length;continue}let W=/^<([a-z][\w-]*)\b/i.exec($.slice(z,z+64));if(!W){z++;continue}let H=$.indexOf(">",z);if(H===-1)return-1;if(W[1].toLowerCase()===Y){let U=$.slice(z,H+1);if(!(/\/\s*>$/.test(U)||m9.has(Y)))G++}z=H+1}return-1}var wz=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function Rz($,Z){let J=Z,X=$.length;for(;;){while(J<X&&$[J]!=="<")J++;if(J>=X)return!1;if($.startsWith("<!--",J)){let G=$.indexOf("-->",J+4);if(G===-1)return!1;J=G+3;continue}break}if($[J+1]==="/")return!1;let Y=$.indexOf(">",J);if(Y===-1)return!1;let Q=$.slice(J,Y+1);return wz.test(Q)}function A8($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,X;while((X=J.exec($))!==null)Z.push([X.index,X.index+X[0].length]);let Y=(H)=>Z.some(([U,j])=>H>=U&&H<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=[],z;while((z=Q.exec($))!==null){if(Y(z.index))continue;let[H,U,j,B,V,F,O]=z,_=Oz(V);if(_===void 0)continue;let L=z.index,w=L+H.length,N=!!O||/\/\s*>$/.test(H)||m9.has(U.toLowerCase())?w:M8($,L,U,w);if(N===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&Rz($,N)){Q.lastIndex=w;continue}if(_===!0){let M=`<${U}${j}${F}${O}>`;G.push({start:L,end:w,replacement:M});continue}G.push({start:L,end:N,replacement:""}),Q.lastIndex=N}if(G.length===0)return $;G.sort((H,U)=>H.start-U.start);let K=[],q=-1;for(let H of G){if(H.start<q)continue;K.push(H),q=H.end}let W=$;for(let H=K.length-1;H>=0;H--){let{start:U,end:j,replacement:B}=K[H];W=W.substring(0,U)+B+W.substring(j)}return W}function r$($,Z){let J=$,X=/@(for|foreach)\s*\(/g,Y,Q=[],G=[];while((Y=X.exec(J))!==null){let z=Y[1],K=Y.index,q=K+Y[0].length,W=1,H=q;while(H<J.length&&W>0){if(J[H]==="(")W++;else if(J[H]===")")W--;H++}if(W!==0)continue;let U=J.substring(q,H-1).trim(),j=H,B=D8(U),V=z==="for"?"@endfor":"@endforeach",F=1,O=j,_=z==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${z}\\s*\\(|end${z})`,"g");_.lastIndex=j;let L;while((L=_.exec(J))!==null)if(L[1].startsWith(z))F++;else if(F--,F===0){O=L.index+L[0].length;break}if(F!==0)continue;let w=()=>{let I=[B.itemVar,B.indexVar].filter(Boolean);if(I.length)G.push({start:K,end:O,vars:I})};if(B.iterable){let I=B.iterable.trim();if(I.startsWith("[")||I.startsWith("{")||I.startsWith("'")||I.startsWith('"')||I.startsWith("`")||/^-?\d/.test(I)){w();continue}let k=I.split(/[.[(]/)[0].trim(),A=Z?k in Z:!1,E=G.some((S)=>K>S.start&&K<S.end&&S.vars.includes(k));if(k&&(A||E)){w();continue}}if(B.style==="as")U=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let R=J.substring(j,O-V.length).trim(),D=Z?{...Z}:{};if(B.itemVar)delete D[B.itemVar];if(B.indexVar)delete D[B.indexVar];let N=r$(R,D),T=N.match(R8),M;if(T){let[,I,k,A]=T;M=`<${I}${k} @for="${U}">${A}</${I}>`}else M=`<template @for="${U}">${N}</template>`;Q.push({start:K,end:O,replacement:M}),X.lastIndex=O}for(let z=Q.length-1;z>=0;z--){let{start:K,end:q,replacement:W}=Q[z];J=J.substring(0,K)+W+J.substring(q)}return J}function Dz($){let Z=new Set,J=[],X=0,Y=0,Q=$.length,G=(W)=>{let H=X+1;while(H<Q){let U=$[H];if(U==="\\"){H+=2;continue}if(U===W)return H+1;H++}return Q},z=()=>{let W=X+2;while(W<Q&&$[W]!==`
|
|
3477
3477
|
`)W++;return W},K=()=>{let W=X+2;while(W<Q-1){if($[W]==="*"&&$[W+1]==="/")return W+2;W++}return Q},q=(W)=>{let H=W,U=0;while(H<Q){let j=$[H];if(j==="/"&&$[H+1]==="/"){let B=H+2;while(B<Q&&$[B]!==`
|
|
3478
|
-
`)B++;H=B;continue}if(j==="/"&&$[H+1]==="*"){let B=H+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;H=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=H+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===j){B++;break}B++}H=B;continue}if(j==="("||j==="["||j==="{"){U++,H++;continue}if(j===")"||j==="]"||j==="}"){U--,H++;continue}if(j===";"&&U===0)return H+1;H++}return Q};while(X<Q){let W=$[X];if(W==="/"&&$[X+1]==="/"){let H=z();J.push($.slice(X,H)),X=H;continue}if(W==="/"&&$[X+1]==="*"){let H=K();J.push($.slice(X,H)),X=H;continue}if(W==='"'||W==="'"||W==="`"){let H=G(W);J.push($.slice(X,H)),X=H;continue}if(W==="{"){Y++,J.push(W),X++;continue}if(W==="}"){Y--,J.push(W),X++;continue}if(Y===0){let H=X>0?$[X-1]:"";if(H===""||/\s/.test(H)||H===";"||H==="}"||H==="{"){let j=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],V=q(X+j[0].length);if(Z.has(B)){J.push(`/* stx: deduped const ${B} */`),X=V;continue}Z.add(B),J.push($.slice(X,V)),X=V;continue}}}J.push(W),X++}return J.join("")}var Nz=new Set(["script","style","html","head","meta","link","title","!doctype"]);function n$($,Z,J){for(let X of J){if(X.start>=Z)return!1;if(X.end>$)return!0}return!1}function Mz($,Z,J){let X=0;while(X<$.length){let Y=$.indexOf(Z,X);if(Y===-1)return!1;if(!n$(Y,Y+Z.length,J))return!0;X=Y+Z.length}return!1}function Az($,Z){if(Mz($,"<body",Z)){let Y=new RegExp(`<body(${i$})>`,"g"),Q;while((Q=Y.exec($))!==null)if(!n$(Q.index,Q.index+Q[0].length,Z))return Q.index+Q[0].length-1;return null}let J=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${i$})>`,"gi"),X;while((X=J.exec($))!==null){if(n$(X.index,X.index+X[0].length,Z))continue;if(Nz.has(X[1].toLowerCase()))continue;return X.index+X[0].length-1}return null}function Iz($,Z,J,X){let Y=[],Q=` data-stx="${X}"`,G=0,z=!1,K=(q)=>{if(J!==null&&!z&&J>=G&&J<=q)Y.push($.slice(G,J),Q,$.slice(J,q)),z=!0;else Y.push($.slice(G,q))};for(let q of Z){if(q.start<G)continue;K(q.start),G=q.end}return K($.length),Y.join("")}async function Tz($,Z,J){let X=Hz($,{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|useModel|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:z}=await n("stx/client-script-bundler",()=>import("./chunk-
|
|
3478
|
+
`)B++;H=B;continue}if(j==="/"&&$[H+1]==="*"){let B=H+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;H=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=H+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===j){B++;break}B++}H=B;continue}if(j==="("||j==="["||j==="{"){U++,H++;continue}if(j===")"||j==="]"||j==="}"){U--,H++;continue}if(j===";"&&U===0)return H+1;H++}return Q};while(X<Q){let W=$[X];if(W==="/"&&$[X+1]==="/"){let H=z();J.push($.slice(X,H)),X=H;continue}if(W==="/"&&$[X+1]==="*"){let H=K();J.push($.slice(X,H)),X=H;continue}if(W==='"'||W==="'"||W==="`"){let H=G(W);J.push($.slice(X,H)),X=H;continue}if(W==="{"){Y++,J.push(W),X++;continue}if(W==="}"){Y--,J.push(W),X++;continue}if(Y===0){let H=X>0?$[X-1]:"";if(H===""||/\s/.test(H)||H===";"||H==="}"||H==="{"){let j=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],V=q(X+j[0].length);if(Z.has(B)){J.push(`/* stx: deduped const ${B} */`),X=V;continue}Z.add(B),J.push($.slice(X,V)),X=V;continue}}}J.push(W),X++}return J.join("")}var Nz=new Set(["script","style","html","head","meta","link","title","!doctype"]);function n$($,Z,J){for(let X of J){if(X.start>=Z)return!1;if(X.end>$)return!0}return!1}function Mz($,Z,J){let X=0;while(X<$.length){let Y=$.indexOf(Z,X);if(Y===-1)return!1;if(!n$(Y,Y+Z.length,J))return!0;X=Y+Z.length}return!1}function Az($,Z){if(Mz($,"<body",Z)){let Y=new RegExp(`<body(${i$})>`,"g"),Q;while((Q=Y.exec($))!==null)if(!n$(Q.index,Q.index+Q[0].length,Z))return Q.index+Q[0].length-1;return null}let J=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${i$})>`,"gi"),X;while((X=J.exec($))!==null){if(n$(X.index,X.index+X[0].length,Z))continue;if(Nz.has(X[1].toLowerCase()))continue;return X.index+X[0].length-1}return null}function Iz($,Z,J,X){let Y=[],Q=` data-stx="${X}"`,G=0,z=!1,K=(q)=>{if(J!==null&&!z&&J>=G&&J<=q)Y.push($.slice(G,J),Q,$.slice(J,q)),z=!0;else Y.push($.slice(G,q))};for(let q of Z){if(q.start<G)continue;K(q.start),G=q.end}return K($.length),Y.join("")}async function Tz($,Z,J){let X=Hz($,{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|useModel|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:z}=await n("stx/client-script-bundler",()=>import("./chunk-sr3f7gk2.js"));for(let _ of X){let L=_.body;if(E1(_.attrs))L=y1(L);if(Y.test(L)){Q.push({content:L,start:_.start,end:_.end});continue}if(!G(L))continue;try{let w=await z(J2(L).code,Z||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(Y.test(w))Q.push({content:L,start:_.start,end:_.end})}catch{}}if(Q.length===0)return{output:$,setupCode:null};let K=`${Z??""}\x00${Q.map((_)=>_.content).join("\x00")}`,q=`__stx_setup_${Bun.hash(K).toString(36).slice(0,10)}`,W=[];for(let _=0;_<Q.length;_++){let L=Q[_].bundled??J2(Q[_].content).code;if(!Q[_].bundled&&G(L))L=await z(L,Z||"",{projectRoot:process.cwd()});L=bz(L);let w=e0(L);W.push(`// \u2500\u2500 merged signal script #${_+1} \u2500\u2500
|
|
3479
3479
|
${w}`)}let H=W.join(`
|
|
3480
3480
|
|
|
3481
3481
|
`);H=Dz(H);let U=kz(H),j=U.split(",").map((_)=>_.trim()).filter(Boolean),B=s$(H,J),V=`
|
|
@@ -3510,13 +3510,13 @@ ${K.join(`
|
|
|
3510
3510
|
Tip: prefer useRef(), navigate(), and composables for component code`;if($3.set(Q,U),Y.failOnViolation)throw Error(U);else console.warn(U)}q5();cz();import J3 from"path";var mz=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,dz=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function lz($,Z){if(!Z||!$.includes("/"))return $;let J=J3.dirname(Z);return $.replace(mz,(X,Y,Q,G)=>{let z=J3.resolve(J,G);return`${Y}${Q}${z.split(J3.sep).join("/")}${Q}`})}function u8($,Z){if(!Z||!$.includes("<script"))return $;return $.replace(dz,(J,X,Y,Q)=>`${X}${lz(Y,Z)}${Q}`)}var P1="<!--PARENT_CONTENT_PLACEHOLDER-->";function m8($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function qZ($,Z){let J=$.length,X=Z,Y=!0,Q=[],G=(z)=>z+9<=J&&$[z]==="<"&&$[z+1]==="/"&&($[z+2]==="s"||$[z+2]==="S")&&($[z+3]==="c"||$[z+3]==="C")&&($[z+4]==="r"||$[z+4]==="R")&&($[z+5]==="i"||$[z+5]==="I")&&($[z+6]==="p"||$[z+6]==="P")&&($[z+7]==="t"||$[z+7]==="T")&&($[z+8]===">"||/\s/.test($[z+8]));while(X<J){let z=$[X];if(G(X))return X;if(z==="/"&&$[X+1]==="/"){if(X=$.indexOf(`
|
|
3511
3511
|
`,X+2),X===-1)return-1;X+=1,Y=!0;continue}if(z==="/"&&$[X+1]==="*"){let K=$.indexOf("*/",X+2);if(K===-1)return-1;X=K+2,Y=!0;continue}if(z==="/"&&Y){let K=X+1,q=!1;while(K<J){let W=$[K];if(W==="\\"){K+=2;continue}if(W==="[")q=!0;else if(W==="]")q=!1;else if(W==="/"&&!q){K++;break}else if(W===`
|
|
3512
3512
|
`){K=-1;break}K++}if(K===-1){X++,Y=!1;continue}while(K<J&&/[a-z]/.test($[K]))K++;X=K,Y=!1;continue}if(z==="'"||z==='"'){let K=z;X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]===K){X++;break}if($[X]===`
|
|
3513
|
-
`)break;X++}Y=!1;continue}if(z==="`"){X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,Y=!0;break}X++}if(Q.length===0)Y=!1;continue}if(z==="}"&&Q.length>0){Q.pop(),X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++,Y=!1;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,Y=!0;break}X++}continue}if(/\s/.test(z));else if(/[)\].\w$]/.test(z))Y=!1;else Y=!0;X++}return-1}function WZ($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`<script\\b(?=[^>]*\\b${J}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!X)return null;let Y=X.index+X[0].length,Q=$.indexOf("</script>",Y);if(Q===-1)return null;let G=$.indexOf(">",Q);if(G===-1)return null;return{start:X.index,end:G+1}}async function d8($,Z,J){try{let{registeredModuleIdsIn:X,buildModuleRegistryScript:Y}=await n("stx/client-module-registry",()=>import("./chunk-
|
|
3513
|
+
`)break;X++}Y=!1;continue}if(z==="`"){X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,Y=!0;break}X++}if(Q.length===0)Y=!1;continue}if(z==="}"&&Q.length>0){Q.pop(),X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++,Y=!1;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,Y=!0;break}X++}continue}if(/\s/.test(z));else if(/[)\].\w$]/.test(z))Y=!1;else Y=!0;X++}return-1}function WZ($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`<script\\b(?=[^>]*\\b${J}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!X)return null;let Y=X.index+X[0].length,Q=$.indexOf("</script>",Y);if(Q===-1)return null;let G=$.indexOf(">",Q);if(G===-1)return null;return{start:X.index,end:G+1}}async function d8($,Z,J){try{let{registeredModuleIdsIn:X,buildModuleRegistryScript:Y}=await n("stx/client-module-registry",()=>import("./chunk-tj7wpqnm.js")),Q=[],G=await Y(X(...$),{minify:Z.buildMode==="compile",collectInputs:Q});for(let z of Q)J?.add(z);if(!G)return null;if(Z.buildMode==="serve"){let{registerServeModuleBundle:z}=await import("./chunk-x9xcmaef.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${z(G)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${G.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function iz($,Z=""){let J=WZ($,"data-stx-runtime");if(!J)return $;let X=V2($);if(X===-1||X===J.start){if(!Z)return $;return $.slice(0,J.end)+Z+$.slice(J.end)}if(X<J.start)return $.slice(0,X)+$.slice(J.start,J.end)+Z+`
|
|
3514
3514
|
`+$.slice(X,J.start)+$.slice(J.end);let Y=$.slice(J.start,J.end),Q=$.slice(0,J.start)+$.slice(J.end),G=V2(Q);if(G===-1)return Y+Z+`
|
|
3515
3515
|
`+Q;return Q.slice(0,G)+Y+Z+`
|
|
3516
3516
|
`+Q.slice(G)}async function Y3($,Z,J,X,Y){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;if(Z.__stx_signals_gate===void 0)Z.__stx_signals_gate=X1($,J);let Q=!Z.__stxProcessingDepth;g$(Z);for(let G of X._layerGraph?.configDependencies??[])Y.add(G);if(Q&&X.runtimeConfig)await p9(Z,J,X.runtimeConfig);if(Q)E3(Z),Z.__stx_head_injections=S$(),Z.__stx_seo_staged=!1;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((X.debug||!S2()&&!P2())&&J&&J.endsWith(".stx"))YZ($,J);try{return await $Z.timeAsync("template-processing",async()=>{let G=await nz($,Z,J,X,Y);if(Q)G=e$(G);if(Q&&X.autoShell&&X.buildMode!=="compile"){let z=X.app?.head||{},q=(Z.__stx_runtime_head||null)??XZ(),W=(Z.__stx_head_raw||"").trim(),H,U=W.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(U)H=U[1].trim(),W=W.replace(U[0],"").trim();let j=Z.__sections?.title,B=q.title||H||j,V=!q.title&&(!!H||!!j),F=q.meta||[],O=new Set(F.map((N)=>$2(N)).filter(Boolean)),_={...z,...B&&{title:B},meta:[...(z.meta||[]).filter((N)=>!O.has($2(N))),...F],link:[...z.link||[],...q.link||[]],script:[...z.script||[],...q.script||[]],headRaw:[z.headRaw,W].filter(Boolean).join(`
|
|
3517
3517
|
`),...q.htmlAttrs&&{htmlAttrs:e6(z.htmlAttrs,q.htmlAttrs)},...q.bodyAttrs&&{bodyAttrs:{...z.bodyAttrs||{},...q.bodyAttrs}}},L=l$(G);if(G=J8(G,_,{...V&&{titleIsHtml:!0},...X.app?.colorMode&&{colorMode:X.app.colorMode}},L),L)G=Z8(G,z),G=$8(G,_.htmlAttrs);let w=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(w&&G.includes("<head")){let N=w[1],T=t8(N);G=G.replace(/<head\b[^>]*>/i,(M)=>`${M}
|
|
3518
3518
|
<meta name="stx-layout" content="${m8(N)}">
|
|
3519
|
-
<meta name="stx-layout-group" content="${m8(T)}">`)}let R=G.match(/function (__stx_setup_\w+)\(/),D=R?n0(G):null;if(R&&D&&!/\bdata-stx=/.test(D.tag)){G=x1(G,(T,M)=>`<body${M} data-stx="${R[1]}">`);let N=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${R[1]}"`,"i");G=G.replace(N,"$1")}}if(Q){let z=Z.__stx_head_injections??S$(),K=m$(G);if(K!==null)z.beforeClose.push(K);let q=f$(G);if(q!==null)z.afterOpen.push(q);G=h6(G,z);let W=X.app?.colorMode;if(W)G=d6(G,W)}if(Q)if(WZ(G,"data-stx-runtime")){let K=null,q=null,W=null,H=null;try{let{getStoreScript:j}=await n("stx/store-loader",()=>import("./chunk-
|
|
3519
|
+
<meta name="stx-layout-group" content="${m8(T)}">`)}let R=G.match(/function (__stx_setup_\w+)\(/),D=R?n0(G):null;if(R&&D&&!/\bdata-stx=/.test(D.tag)){G=x1(G,(T,M)=>`<body${M} data-stx="${R[1]}">`);let N=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${R[1]}"`,"i");G=G.replace(N,"$1")}}if(Q){let z=Z.__stx_head_injections??S$(),K=m$(G);if(K!==null)z.beforeClose.push(K);let q=f$(G);if(q!==null)z.afterOpen.push(q);G=h6(G,z);let W=X.app?.colorMode;if(W)G=d6(G,W)}if(Q)if(WZ(G,"data-stx-runtime")){let K=null,q=null,W=null,H=null;try{let{getStoreScript:j}=await n("stx/store-loader",()=>import("./chunk-er75fpqj.js")),B=X.storesDir,V=await j(B);if(V)q=`<script data-stx-stores>${V}</script>`}catch{}K=await d8([G,q],X,Y);try{let{getFrameworkComposableScript:j}=await n("stx/framework-composables",()=>import("./chunk-7zwkhc9z.js"));H=await j(G)}catch{}try{let{getComposableScript:j}=await n("stx/composable-loader",()=>import("./chunk-kmbt6knb.js")),B=X.composablesDir,V=[K,q,H].filter((O)=>O!==null),F=await j(X._layerComposableDirs??B,G,V);if(F)W=`<script data-stx-scoped data-stx-run="always" data-stx-composables>${F}</script>`}catch{}let U=[K,q,W,H].filter((j)=>j!==null).map((j)=>`
|
|
3520
3520
|
${j}`).join("");G=iz(G,U)}else{let K=await d8([G],X,Y);if(K){let q=G.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(q!==-1)G=G.slice(0,q)+K+`
|
|
3521
3521
|
`+G.slice(q)}}if(Q)G=l6(G);if(Q&&Z.__stx_inject_css!==!1)G=await JZ(G,void 0,X.buildMode==="serve",!0);else if(Q)G=ZZ(G);if(G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),Q&&Z.__stx_runtime_config)G=e8(G,Z.__stx_runtime_config);if(Q&&!Z.__stx_defer_server_data){let z=s6(Z);if(z){let K=/<head\b[^>]*>/i.exec(G),q=K?K.index+K[0].length:0;G=G.slice(0,q)+z+G.slice(q)}}return G})}catch(G){if(G instanceof n8)throw G;let z=G instanceof Error?G.message:String(G),K=new h2(`Template processing failed: ${z}`,J,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(o0.log(K,{filePath:J,context:Z}),o8.logDetailedError(K,{filePath:J,template:$.substring(0,500)}),X.debug)throw K;return s8.createFallbackContent("Template Processing",K)}}async function nz($,Z,J,X,Y){let Q=process.cwd(),G={...X,partialsDir:X.partialsDir&&!C0.isAbsolute(X.partialsDir)?C0.resolve(Q,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!C0.isAbsolute(X.componentsDir)?C0.resolve(Q,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!C0.isAbsolute(X.layoutsDir)?C0.resolve(Q,X.layoutsDir):X.layoutsDir},z=G,K=$;await rz(J,Z),oz(Z,z),K=await u2(()=>k6(K,Z,J,z),K,(L)=>{o0.log(L,{filePath:J,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${J}: ${L.message}`)}),K=K.replace(/\{\{--[\s\S]*?--\}\}/g,"");let q=O1(K,y9,(L,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);K=q.output;let W=q.tokens,H=(L)=>W.length===0?L:L.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,R)=>W[Number(R)]??""),U="\x00STX_ESCAPED_AT\x00";K=K.replace(/@@/g,U),K=K.replace(/@\{\{([\s\S]*?)\}\}/g,(L,w)=>{return`{{ ${w} }}`}),K=S6(K),K=await b8(K,J,Y);let j={};K=T$(K,j);let B={...Z.__sections||{}},V="",F=U4(H4($)),O=/@nolayout\b/.test(K)||F===!1;if(/@nolayout\b/.test(K))K=K.replace(/@nolayout\b\s*/g,"");let _=K.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(_)V=_[1],K=K.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof F==="string"){if(V=F,!/@section\s*\(/.test(K))K=`@section('content')
|
|
3522
3522
|
${K.trim()}
|
|
@@ -3525,7 +3525,7 @@ ${K.trim()}
|
|
|
3525
3525
|
@endsection`}}if(V&&K.includes("<script")){let L=f0(K),w=L.scripts.map((R)=>l8(R,J)??R);K=B2(L.output,w)}if(K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(L,w,R)=>{return B[w]=R,""}),K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(L,w,R)=>{if(/^(['"]).*\1$/.test(R.trim()))return L;try{let D=X0(R.trim(),Z);if(D===void 0)return L;return B[w]=String(D??""),""}catch{return L}}),K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(L,w,R)=>{if(R.includes("@parent"))B[w]=R.replace("@parent",P1);else B[w]=R.trim();return""}),Z.__sections=B,K=K.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(L,w,R)=>{return B[w]||R||""}),!("slot"in Z)||Z.slot===void 0)K=K.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(K=k$(K,j),V){let L=[],w=f0(K),R=O1(w.output,J9,(D,N)=>`\x00STX_ORPHAN_STYLE_${N}\x00`);if(K=R.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(D,N,T)=>{let M=N==="SCRIPT"?l8(w.scripts[Number(T)],J):R.tokens[Number(T)];if(M)L.push(M);return""}),L.length>0){let D=L.join(`
|
|
3526
3526
|
`);B.content=B.content?`${B.content}
|
|
3527
3527
|
${D}`:D,Z.__sections=B}}if(V)try{let L;if(C0.isAbsolute(V))L=V,Y.add(V);else L=await u2(()=>q9(V,J,G,Y),null,()=>{throw new h2(`Failed to resolve layout path: ${V}`,J,void 0,void 0,`Layout referenced from ${J}`)});if(!L){let M=(A)=>{if(!A)return[];try{let E=C0.isAbsolute(A)?A:C0.resolve(process.cwd(),A);return pz.readdirSync(E).filter((S)=>S.endsWith(".stx")).map((S)=>S.replace(/\.stx$/,""))}catch{return[]}},I=[...M(G.layoutsDir),...M(G.fallbackLayoutsDir)].filter((A,E,S)=>S.indexOf(A)===E).sort(),k=`Layout not found: ${V} (referenced from ${J})`+(I.length>0?`. Available layouts: ${I.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(o0.log(Error(k),{layoutPath:V,filePath:J,available:I},"error"),console.error(`[stx] ${k}`),G.debug)throw new h2(k,J);return K}let w=await u2(()=>Bun.file(L).text(),"",()=>{throw new h2(`Failed to read layout file: ${L}`,J,void 0,void 0,"Layout content could not be loaded")});w=u8(w,L);let R=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(R){if(G.debug)console.log(`Found nested layout: ${R[1]} in ${L}`);let M={},I=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(E,S,b)=>{return M[S]=b.trim(),""});for(let[E,S]of Object.entries(M))if(B[E]&&B[E].includes(P1)){let b=B[E].indexOf(P1);B[E]=B[E].slice(0,b)+S+B[E].slice(b+P1.length)}else if(!B[E])B[E]=S;let k={...Z,__sections:B},A=`@layout('${R[1]}')${I}`;return await Y3(A,k,L,G,Y)}let D=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=T$(D,j),T={};return N=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(M,I,k)=>{return T[I]=k.trim(),`@slot('${I}')`}),N=N.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(M,I,k)=>{if(B[I]){let A=B[I];if(A.includes(P1)){let E=T[I]||"",S=A.indexOf(P1);A=A.slice(0,S)+E+A.slice(S+P1.length)}return A}return k||""}),N=sz(N,B),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),N=k$(N,j),Z.__originalFilePath=J,K=await i8(N,Z,L,G,Y),K=`<!-- stx-layout: ${V} -->
|
|
3528
|
-
${K}`,H(K)}catch(L){return o0.log(L instanceof Error?L:Error(String(L)),{layoutPath:V,filePath:J},"error"),`[Error processing layout: ${L instanceof Error?L.message:String(L)}]`}return H(await i8(K,Z,J,G,Y))}function sz($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(J,X,Y)=>{let Q=Z[X];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return Y||""})}function oz($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let J=Z.envPrefix||"STX_PUBLIC_",X={};for(let[Y,Q]of Object.entries(process.env))if(Y.startsWith(J)&&Q!==void 0)X[Y]=Q;$.$env=X}async function rz($,Z){await u2(()=>b6($,Z),void 0,(J)=>{o0.log(J,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${J.message}`)})}var X3="data-stx-source";function l8($,Z){if(!$)return $;let J=/^<script\b([^>]*)>/i.exec($);if(!J||!/\bserver\b/.test(J[1])||J[1].includes(X3))return $;return`<script ${X3}="${encodeURIComponent(Z)}"${$.slice(7)}`}function az($){let Z=new RegExp(`${X3}="([^"]*)"`).exec($);return Z?decodeURIComponent(Z[1]):void 0}function c8($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function p8($,Z,J){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a <script server> ${Z==="module-resolution"?"imports a module that does not resolve":Z==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${c8($)}</span><span style="display:block;margin-top:4px">${c8(J)}</span></div>`}async function tz($,Z,J,X){let{scanScriptTags:Y}=await n("stx/signal-processing",()=>import("./chunk-
|
|
3528
|
+
${K}`,H(K)}catch(L){return o0.log(L instanceof Error?L:Error(String(L)),{layoutPath:V,filePath:J},"error"),`[Error processing layout: ${L instanceof Error?L.message:String(L)}]`}return H(await i8(K,Z,J,G,Y))}function sz($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(J,X,Y)=>{let Q=Z[X];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return Y||""})}function oz($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let J=Z.envPrefix||"STX_PUBLIC_",X={};for(let[Y,Q]of Object.entries(process.env))if(Y.startsWith(J)&&Q!==void 0)X[Y]=Q;$.$env=X}async function rz($,Z){await u2(()=>b6($,Z),void 0,(J)=>{o0.log(J,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${J.message}`)})}var X3="data-stx-source";function l8($,Z){if(!$)return $;let J=/^<script\b([^>]*)>/i.exec($);if(!J||!/\bserver\b/.test(J[1])||J[1].includes(X3))return $;return`<script ${X3}="${encodeURIComponent(Z)}"${$.slice(7)}`}function az($){let Z=new RegExp(`${X3}="([^"]*)"`).exec($);return Z?decodeURIComponent(Z[1]):void 0}function c8($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function p8($,Z,J){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a <script server> ${Z==="module-resolution"?"imports a module that does not resolve":Z==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${c8($)}</span><span style="display:block;margin-top:4px">${c8(J)}</span></div>`}async function tz($,Z,J,X){let{scanScriptTags:Y}=await n("stx/signal-processing",()=>import("./chunk-s8wvhby3.js")),Q=[],G=!S2()&&!P2();for(let K of Y($)){let q=K.attrs;if(!/\bserver\b/.test(q))continue;let W=K.start+K.fullMatch.indexOf(">")+1,H=qZ($,W);if(H===-1)continue;let U=$.slice(W,H);if(!U.trim())continue;let j=az(q)??J,B={index:K.start,length:H+9-K.start};try{let{extractVariables:V}=await n("stx/variable-extractor",()=>import("./chunk-dwk6afax.js"));await V(U,Z,j,{preserveExisting:!0,onFailure:(F)=>{if(F.kind==="unknown")return;if(X?.onServerScriptError?.({sourcePath:j,kind:F.kind,message:F.message}),!G)return;Q.push({...B,markup:p8(j,F.kind,F.message)})}})}catch(V){let F=V instanceof Error?V:Error(String(V));if(o0.log(F,{filePath:j,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${j}: ${F.message}`),G)Q.push({...B,markup:p8(j,"unknown",F.message)})}}if(Q.length===0)return $;let z=$;for(let K of Q.sort((q,W)=>W.index-q.index))z=z.slice(0,K.index)+K.markup+z.slice(K.index+K.length);return z}async function ez($,Z,J){try{let{interpolateScriptsInTemplate:X}=await n("stx/expressions",()=>import("./chunk-7e31d2d9.js"));return X($,Z,{skipServer:!0})}catch(X){let Y=X instanceof Error?X:Error(String(X));return o0.log(Y,{filePath:J,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${J}: ${Y.message}`),$}}async function i8($,Z,J,X,Y){let Q=$,G=X;if(Q=await tz(Q,Z,J,X),Q=await ez(Q,Z,J),Q=await B6(Q,Z,J),Q=await V6(Q,Z,J),Q=await O7(Q,Z,J,G),X1(Q))Q=N8(Q,Z),Q=r$(Q,Z);Q=A8(Q);let{processStreamDirectives:z}=await n("stx/streaming",()=>import("./chunk-pefddsqn.js"));Q=z(Q,Z),Q=N6(Q,Z,J,G,!0),Q=await f6(Q,Z,J,G,Y),Q=await N$(Q,Z,J,G,Y),Q=W4(Q,Z,J,G);let{processDeferDirectives:K}=await n("stx/defer",()=>import("./chunk-d5mmmjd8.js"));Q=K(Q,Z,J);let{processTeleportDirectives:q}=await n("stx/teleport",()=>import("./chunk-1jfcd66s.js"));Q=q(Q,Z,J);let{processTransitionDirectives:W,processTransitionAttributes:H}=await n("stx/transitions",()=>import("./chunk-2t84w57n.js"));Q=W(Q,Z,J),Q=H(Q);let{processErrorBoundaryDirectives:U,stripRenderFailedMarkers:j}=await n("stx/error-boundaries",()=>import("./chunk-zzwtcfht.js"));Q=U(Q,Z,J),Q=j(Q);let{processSuspenseDirectives:B}=await n("stx/suspense",()=>import("./chunk-0j0re4xx.js"));Q=B(Q,Z,J);let{processAsyncDirectives:V}=await n("stx/async-components",()=>import("./chunk-jwwyq1a8.js"));Q=V(Q,Z,J);let{processKeepAliveDirectives:F}=await n("stx/keep-alive",()=>import("./chunk-9qtnemsa.js"));Q=F(Q,Z,J);let{processVirtualListDirectives:O,processVirtualGridDirectives:_,processInfiniteListDirectives:L}=await n("stx/virtual-scrolling",()=>import("./chunk-10q0m99z.js"));Q=O(Q,Z,J),Q=_(Q,Z,J),Q=L(Q,Z,J);let{processPartialHydrationDirectives:w,processStaticDirectives:R}=await n("stx/partial-hydration",()=>import("./chunk-1emtk9xm.js"));Q=w(Q,Z,J),Q=R(Q);let{processComputedDirectives:D,processWatchDirectives:N}=await n("stx/computed",()=>import("./chunk-bdahs78b.js"));Q=D(Q,Z,J),Q=N(Q,Z,J);let{processFormValidationDirectives:T}=await n("stx/forms-validation",()=>import("./chunk-9wbbga8w.js"));Q=T(Q,Z,J);let{processHeadDirective:M,processTitleDirective:I,processMetaDirective:k,resetHead:A}=await n("stx/head",()=>import("./chunk-9xej4h3f.js"));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)A();let E=M(Q);if(Q=E.content,E.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${E.headContent}
|
|
3529
3529
|
`;if(Q=I(Q,Z),Q=k(Q,Z,J),Q=y6(Q),Q=l5(Q,Z),Q=B7(Q),Q=I6(Q),Q=await I$(Q,Z,J,G,Y),Q=await N$(Q,Z,J,G,Y),Z.__stxProcessingDepth===1)Q=y3(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=e$(Q),Q=t0(Q,Z,J),Q=y$(Q),Q=B4(Q,Z,{filePath:J,buildMode:G.buildMode}),Q=c5(Q,Z),Q=p5(Q,Z),Q=I2(Q,Z),Q=t5(Q,Z),Q=e5(Q,Z),Q=await J7(Q,Z,J,G),Q=await R4(Q,Z,J),Q=await r8(Q,Z,J,G),Q=a8(Q,Z,J,G),Q=QZ(Q,Z,J,G),Q=GZ(Q,Z,J),Q=zZ(Q,Z,J,G),Q=U7(Q,Z,J,G),Q=a$(Q,Z),Q=t$(Q),Q=P8(Q),!G.skipEventDirectives)Q=I3(Q,Z,J);if(Q=O4(Q,Z,J),G.debug){let f=/\bx-data\s*=/.test(Q),l=o$($);if(f&&l)console.warn(`[stx] ${J}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
3530
3530
|
Both work on the same page, but they manage separate scopes.
|
|
3531
3531
|
Prefer signals (state/derived/effect) for new components.`)}Q=Z6(Q,Z),Q=await F1(Q,Z,J),Q=g8(Q),Q=h8(Q),Q=J4(Q);let{processXElementDirectives:S}=await n("stx/x-element",()=>import("./chunk-pxgkj5yv.js"));Q=S(Q);let b=Z.__originalFilePath||J,y=d9(Z);if(Q=await I8(Q,G,b,y),Q=R7(Q,Z),Q=await E6(Q,Z,J,G),G.media?.image?.autoSiblings){let f=G.publicDir||"public",{rewriteImagesWithSiblings:l}=await n("stx/image-optimization/auto-sibling",()=>import("./chunk-qjtkqv7h.js"));Q=await l(Q,{publicDir:f})}if(G.seo?.enabled)Q=KZ(Q,Z,G);let P=(f,l,J0=!0)=>{if(!l)return f;let j0=l.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),_0=f.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(j0&&_0){if(J0)f=f.replace(_0[0],j0[0]);if(l=l.replace(j0[0],"").trim(),!l)return f}if(/<\/head>/i.test(f))return f.replace(/<\/head>/i,`${l}
|
|
@@ -3539,7 +3539,7 @@ ${e3()}
|
|
|
3539
3539
|
`+i0}else Q=Q.replace("</head>",`${l}
|
|
3540
3540
|
</head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
|
|
3541
3541
|
${l}`);else Q=l+`
|
|
3542
|
-
`+Q}{let{scanScriptTags:f}=await n("stx/signal-processing",()=>import("./chunk-
|
|
3542
|
+
`+Q}{let{scanScriptTags:f}=await n("stx/signal-processing",()=>import("./chunk-s8wvhby3.js")),l=[];for(let J0 of f(Q)){if(!/\bserver\b/i.test(J0.attrs))continue;let j0=J0.start+J0.fullMatch.indexOf(">")+1,_0=qZ(Q,j0);if(_0===-1)continue;let W0=_0+9;while(W0<Q.length&&/\s/.test(Q[W0]))W0++;l.push({start:J0.start,end:W0})}if(l.length>0){let J0=Array(l.length+1),j0=0;for(let _0=0;_0<l.length;_0++){let{start:W0,end:i0}=l[_0];J0[_0]=Q.slice(j0,W0),j0=i0}J0[l.length]=Q.slice(j0),Q=J0.join("")}}let q0=c9(Q,J);if(q0.hasScoped)Q=q0.html;let r=Z.__stx_event_bindings||[],L0=!1,c0=[],p0=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:B1}=await n("stx/signal-processing",()=>import("./chunk-s8wvhby3.js"));for(let f of B1(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))c0.push({match:f.fullMatch,attrs:f.attrs,content:f.body});for(let{match:f,attrs:l,content:J0}of c0){L0=!0;let j0=J0;Z3(J0,J,X.strict,Z.__originalFilePath);let _0=await l9(J0,{eventBindings:r,attrs:l,hasColonDirectives:p0,templateContent:$,filePath:J,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:y});Q=Q.replace(f,()=>_0)}if(L0)Z.__stx_event_bindings=[];if(!L0&&Z.__stxProcessingDepth===1){let f=Z.__stx_event_bindings||[];if(f.length>0){let l=Y5(f);if(l){let J0=Q.lastIndexOf("</body>");Q=J0===-1?Q+l:Q.slice(0,J0)+l+`
|
|
3543
3543
|
`+Q.slice(J0)}Z.__stx_event_bindings=[]}}if(!q8(Q)&&W8(Q))Q=await g9(Q,G);if(Q=H8(Q),G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=H7(Q,Z.cspNonce);return Q}import AZ from"path";import G3 from"fs";import m2 from"path";function HZ($,Z,J,X){let Y=0;for(let Q=Z;Q<$.length;Q++)if($[Q]===J)Y++;else if($[Q]===X&&!(X===">"&&$[Q-1]==="=")){if(--Y===0)return Q}return-1}function $K($){let Z=Q0($),J=0,X=0,Y=[];for(let Q=0;Q<Z.length;Q++)if("([{".includes(Z[Q]))J++;else if(")]}".includes(Z[Q]))J--;else if(Z[Q]===","&&J===0)Y.push($.slice(X,Q).trim()),X=Q+1;return Y.push($.slice(X).trim()),Y}function Q3($,Z){let J=Q0($),X=new RegExp(`\\b(?:${Z.map((Y)=>Y.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let Y of J.matchAll(X)){let Q=Y.index+Y[0].length,G="";if(J[Q]==="<"){let K=HZ(J,Q,"<",">");if(K<0)continue;G=$.slice(Q+1,K),Q=K+1;while(/\s/.test(J[Q]||"")&&Q<J.length)Q++}if(J[Q]!=="(")continue;let z=HZ(J,Q,"(",")");if(z>=0)return{type:G,args:$K($.slice(Q+1,z))}}return null}var UZ=`
|
|
3544
3544
|
type __StxCtor<T> = T extends StringConstructor ? string : T extends NumberConstructor ? number : T extends BooleanConstructor ? boolean : T extends ArrayConstructor ? unknown[] : T extends ObjectConstructor ? object : T extends readonly unknown[] ? __StxCtor<T[number]> : T extends abstract new (...args: any[]) => infer V ? V : unknown;
|
|
3545
3545
|
type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
|
|
@@ -3601,8 +3601,8 @@ ${G}`,Y++}return{functionCode:X,nextIndex:Y}}function hZ($,Z){let J=X0($,Z)??X0(
|
|
|
3601
3601
|
`)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<Q-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},q=()=>{if(X!==0)return;let W=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(W){let B=W[2].split(",").map((V)=>{let F=V.trim().split(":");return F[F.length-1].trim()});for(let V of B)if(V&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(V)&&!J.has(V))Z.push(V),J.add(V);return}let H=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(H){let B=H[2];if(!J.has(B))Z.push(B),J.add(B);return}let U=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let B=U[1];if(!J.has(B))Z.push(B),J.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(!J.has(B))Z.push(B),J.add(B)}};while(Y<Q){if(K())continue;if($[Y]==="'"||$[Y]==='"'){G($[Y]);continue}if($[Y]==="`"){z();continue}if($[Y]==="{"){X++,Y++;continue}if($[Y]==="}"){X--,Y++;continue}if(X===0&&/[a-z]/i.test($[Y])&&(Y===0||/\s|[;{}()]/.test($[Y-1])))q();Y++}return Z}function Kq($){let Z=[],J=0,X=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==="{")J++;else if(G===")"||G==="]"||G==="}")J--;else if(G===","&&J===0)Z.push($.slice(X,Q)),X=Q+1}if(X<$.length)Z.push($.slice(X));return Z}function qq($){let Z=0,J=null;for(let X=0;X<$.length;X++){let Y=$[X];if(J){if(Y==="\\"){X++;continue}if(Y===J)J=null;continue}if(Y==='"'||Y==="'"||Y==="`"){J=Y;continue}if(Y==="("||Y==="["||Y==="{")Z++;else if(Y===")"||Y==="]"||Y==="}")Z--;else if(Y==="="&&Z===0){let Q=$[X-1],G=$[X+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return X}}return-1}function Wq($,Z){try{let J=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!J)return;let X=J.index-1;while(X>=0&&/\s/.test($[X]))X--;if($[X]!=="}")return;let Y=X,Q=0,G=-1;for(;X>=0;X--){let K=$[X];if(K==="}")Q++;else if(K==="{"){if(Q--,Q===0){G=X;break}}}if(G===-1)return;let z=$.slice(G+1,Y);for(let K of Kq(z)){let q=K.trim();if(!q||q.startsWith("..."))continue;let W=qq(q);if(W===-1)continue;let H=q.slice(0,W).trim();if(!/^[A-Z_$][\w$]*$/i.test(H))continue;if(Z[H]!==void 0)continue;let U=q.slice(W+1).trim();if(!U)continue;try{let j=Object.keys(Z).filter(z2),B=Function(...j,`"use strict"; return (${U});`);Z[H]=B(...j.map((V)=>Z[V]))}catch{}}}catch{}}var Hq=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd"]);function Uq($,Z){let J=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!J)return null;let X=J[2].toLowerCase();if(!Hq.has(X))return null;if(($.match(new RegExp(`<${X}(?=[\\s/>])`,"gi"))??[]).length!==1)return null;if(!new RegExp(`</${X}>\\s*$`,"i").test($))return null;let Q=J[0].length;return $.slice(0,Q)+Z+$.slice(Q)}async function k9($,Z,J,X,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(O)=>O.split("-").map((_)=>_.charAt(0).toUpperCase()+_.slice(1)).join(""),z=(O)=>O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),K=J.__importedComponents;if(K){for(let O of[Q,Q.toLowerCase(),G(Q),z(Q)])if(K.has(O))return!0}let q=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${z(Q)}.stx`])],W=typeof Y.root==="string"?g.resolve(Y.root):void 0,H=W??g.dirname(X),U=[],j=(O)=>{if(O&&!U.includes(O))U.push(O)},B=J.__originalFilePath;if(B)j(g.join(g.dirname(B),"components"));if(j(Z),j(Y._rootComponentsDir),j(g.join(g.dirname(X),"components")),j(Y.componentsDir),W)j(g.resolve(W,"resources/views/components")),j(g.resolve(W,"resources/components")),j(g.resolve(W,"src/components")),j(g.resolve(W,"components"));for(let O of Y._layerComponentDirs??[])j(O);let V=Y._pluginComponentDirs;if(Array.isArray(V))for(let O of V)j(typeof O==="string"?O:null);if(j(Y.fallbackComponentsDir),Q.startsWith("./")||Q.startsWith("../"))return e(g.resolve(g.dirname(X),`${Q}.stx`));let F=$J(g.resolve(import.meta.dir,"components"));for(let O of U){let _=g.isAbsolute(O)?O:g.resolve(H,O);if($J(_)===F)continue;for(let L of q)if(await e(g.join(_,L)))return!0}return!1}function $J($){try{return zJ.realpathSync($)}catch{return $}}function jq($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function Bq($){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 Vq($,Z,J){if(!$.includes("{{")&&!$.includes("{!!"))return $;let X=(Y,Q)=>{let G;try{G=S0(Y,Z)}catch{return Q}if(G===void 0||G===null)return"";let z=String(G);if(/<\/style/i.test(z))return console.warn(`[stx] a <style> expression in ${J??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return z};return $.replace(/\{!!([\s\S]*?)!!\}/g,(Y,Q)=>X(Q,Y)).replace(/\{\{([\s\S]*?)\}\}/g,(Y,Q)=>X(Q,Y))}var ZJ=new Set;function JJ($,Z,J,X){let Y=`${$}\x00${Z}\x00${X??""}`;if(!process.env.STX_DEBUG&&ZJ.has(Y))return;ZJ.add(Y);let Q=Z?` used in ${Z}`:"",G=X?` Cause: ${X}.`:"",z=J.length>0?`
|
|
3602
3602
|
searched:
|
|
3603
3603
|
${J.map((K)=>` - ${K}`).join(`
|
|
3604
|
-
`)}`:"";console.error(`[stx] component <${$}> could not be resolved${Q}, so it rendered as nothing.${G}${z}`)}function XJ($){return`<!-- stx: component "${$.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Lq($){let Z=new Set,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let X of $){let Y;while((Y=J.exec(X))!==null)Z.add(Y[1]);J.lastIndex=0}return[...Z]}async function k1($,Z,J,X,Y,Q,G,z=new Set,K){let{extractVariables:q}=await n("stx/variable-extractor",()=>import("./chunk-
|
|
3605
|
-
`)}`}if(J&&W0.includes("{{ text || slot }}"))W0=W0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>J);let{applySlots:i0}=await n("stx/slots",()=>import("./chunk-
|
|
3604
|
+
`)}`:"";console.error(`[stx] component <${$}> could not be resolved${Q}, so it rendered as nothing.${G}${z}`)}function XJ($){return`<!-- stx: component "${$.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Lq($){let Z=new Set,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let X of $){let Y;while((Y=J.exec(X))!==null)Z.add(Y[1]);J.lastIndex=0}return[...Z]}async function k1($,Z,J,X,Y,Q,G,z=new Set,K){let{extractVariables:q}=await n("stx/variable-extractor",()=>import("./chunk-dwk6afax.js")),W=z??new Set;if(W.has($))return`[Circular component reference: ${$}]`;let H=new Set(W);H.add($);let U=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let j=U&&U!=="load"&&jq(U)?U:"";try{let B=(d)=>d.split("-").map((c)=>c.charAt(0).toUpperCase()+c.slice(1)).join(""),V=(d)=>d.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),F=$.endsWith(".stx")?$.slice(0,-4):$,O=null,_=Y.__importedComponents;if(_){let d=[F,F.toLowerCase(),B(F),V(F)];for(let c of d)if(_.has(c)){O=_.get(c);break}}let L=[];if(!O){let d=[`${F}.stx`,`${B(F)}.stx`,`${V(F)}.stx`],c=[...new Set(d)],G0=Y.__originalFilePath,s=[];if(s.push(...G._layerComponentDirs??[]),G0){let I0=g.join(g.dirname(G0),"components");s.push(I0)}if(X)s.push(X);let R0=G._rootComponentsDir;if(typeof R0==="string"&&!s.includes(R0))s.push(R0);let H0=g.join(g.dirname(Q),"components");if(!s.includes(H0))s.push(H0);if(G.componentsDir&&G.componentsDir!==X&&!s.includes(G.componentsDir))s.push(G.componentsDir);let b0=typeof G.root==="string"?g.resolve(G.root):void 0,J1=b0??g.dirname(Q),v0=[];if(b0)v0.push(g.resolve(b0,"resources/views/components")),v0.push(g.resolve(b0,"resources/components")),v0.push(g.resolve(b0,"src/components")),v0.push(g.resolve(b0,"components"));v0.push(g.resolve(import.meta.dir,"components"));for(let I0 of v0)if(!s.includes(I0))s.push(I0);let a=G._pluginComponentDirs;if(Array.isArray(a)){for(let I0 of a)if(typeof I0==="string"&&!s.includes(I0))s.push(I0)}if(G.fallbackComponentsDir&&!s.includes(G.fallbackComponentsDir))s.push(G.fallbackComponentsDir);let u0=[...new Set(s.map((I0)=>{if(!I0)return I0;return g.isAbsolute(I0)?I0:g.resolve(J1,I0)}))];s.length=0,s.push(...u0);let L1=`${F}\x00${Q}\x00${u0.join("\x00")}`,e9=o9.get(L1);if(e9)if(await e(e9))O=e9;else o9.delete(L1);if(!O&&(F.startsWith("./")||F.startsWith("../")))O=g.resolve(g.dirname(Q),`${F}.stx`),L.push(O);else if(!O)for(let I0 of s){if(!I0)continue;for(let i2 of c){let n2=g.join(I0,i2);if(L.push(n2),await e(n2)){O=n2;break}}if(O)break;if(!O)try{let i2=await import("fs");if(!i2.statSync(I0,{throwIfNoEntry:!1})?.isDirectory())continue;let OJ=8,$5=[{path:I0,depth:0}];while($5.length>0&&!O){let s2=$5.pop();if(s2.depth>=OJ)continue;let O3;try{O3=i2.readdirSync(s2.path,{withFileTypes:!0})}catch{continue}for(let o2 of O3){if(!o2.isDirectory())continue;if(o2.name==="node_modules"||o2.name.startsWith("."))continue;let F3=g.join(s2.path,o2.name);for(let FJ of c){let Z5=g.join(F3,FJ);if(L.push(Z5),await e(Z5)){O=Z5;break}}if(O)break;$5.push({path:F3,depth:s2.depth+1})}}}catch{}if(O)break}if(O)o9.set(L1,O)}if(!O||!await e(O))return JJ($,Q,L),XJ($);K.add(O);let w;if(c2.has(O))w=c2.get(O);else try{w=await Bun.file(O).text(),c2.set(O,w)}catch(d){let c=d instanceof Error?d.message:String(d);return JJ($,Q,[O],c),XJ($)}let R=new Set(["__originalFilePath","__importedComponents",a2,"__stx_client_signal_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),D={};for(let[d,c]of Object.entries(Y))if(!d.startsWith("__")||R.has(d))D[d]=c;let N=J;if(J.includes("@include")){let{processIncludes:d}=await n("stx/includes",()=>import("./chunk-d5h4fq9g.js"));N=await d(J,Y,Q,G,K)}let T=f0(N),M=[],I=T.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(d,c)=>{let G0=T.scripts[Number(c)]||"",s=G0.match(/^<script\b([^>]*)>/i)?.[1]||"",R0=s.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),H0=!R0||["module","text/javascript","application/javascript"].includes(R0);if(!/\bserver\b/i.test(s)&&H0)return M.push(G0),"";return G0}),{extractSlotContent:k}=await n("stx/slots",()=>import("./chunk-xvp7ye5d.js")),A=k(I),E={};if(A.defaultSlot?.trim())E.default=A.defaultSlot;for(let[d,c]of A.namedSlots)E[d]=c.content;let S=Y.__stx_scope_seq??={n:0,key:Bun.hash(String(Y.__filename??Q)).toString(36).slice(0,6)},b=`stx_${F.replace(/[^a-zA-Z0-9]/g,"_")}_${++S.n}_${S.key}`,y={...D,$uid:b,...Z,props:Z,slot:I,$slots:E,__processedComponents:H,__sections:{},__stx_signals_gate:X1(w)||Bq(J)};Wq(w,y);let P=w,h=F9(P);if(h)P=h.content.trim();let p=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,u=[...w.matchAll(p)],o=[],$0=null,Y0=u.some((d)=>/\bserver\b/.test(d[1]||"")&&/\bcache\b/.test(d[1]||"")),i=null,q0=null,r=null,L0=0,c0=null;if(Xq(G),Y0&&j3>0){let d=Yq({props:Z,slot:J,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0,layers:G._layerGraph?.layers.map((c)=>c.configFile),uid:b});if(d!==null){i=`${O}\x00${U1(w)}\x00${d}`;let c=r9.get(i);if(c){for(let G0 of c.dependencies)K.add(G0);if(S3(Y,c.clientFactories),S.n+=c.uidsConsumed,c.preservedClientExpressions.length>0){let G0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let s of c.preservedClientExpressions)G0.add(s);Y.__stx_preserved_client_expressions=[...G0]}return c.output}q0=new Set(K),r=b3(Y),L0=S.n,c0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[])}}let p0=new Set;for(let d of u){let c=d[1]||"",G0=d[2]||"",s=c.includes("server");if(E1(c)&&G0.trim())G0=y1(G0);if(s&&G0){for(let H0 of j1(G0))p0.add(H0);try{await q(G0,y,O,{onFailure:(H0)=>{if(H0.kind!=="unknown")$0=H0.kind}})}catch(H0){}}if(!s){let H0=G0.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),b0=H0.includes("{{")&&H0.includes("}}"),J1=H0.includes("{!!")&&H0.includes("!!}");if(b0||J1)H0=U5(H0,y,O);let v0=c.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");o.push(`<script${v0}>${H0}</script>`)}}let f=f0(w).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),l=f?f[1]:"",J0=f?f[2]:"",j0="",_0=l&&/\bscoped\b/i.test(l);if(f)j0=`<style${l}>${Vq(J0,y,O)}</style>`;let W0=P;if(W0=W0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),f)W0=W0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let d=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,c=[];if(W0=W0.replace(d,(G0,s)=>{let R0=s.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(R0)c.push(`<style${R0[1]}>${R0[2]}</style>`);return""}),W0=W0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),c.length>0)j0=`${j0}${c.join(`
|
|
3605
|
+
`)}`}if(J&&W0.includes("{{ text || slot }}"))W0=W0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>J);let{applySlots:i0}=await n("stx/slots",()=>import("./chunk-xvp7ye5d.js")),{defaultSlot:a9,namedSlots:t9}=A,K2=o.some((d)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(d)),C=(d)=>K2?v8(d,b):d,v=new Map([...t9].map(([d,c])=>[d,{...c,content:C(c.content)}]));W0=await i0(W0,C(a9),v,y);let m=Lq(o),t=(Array.isArray(y.__stx_client_signal_names)?y.__stx_client_signal_names:[]).filter((d)=>!p0.has(d));if(m.length>0||t.length>0)y.__stx_client_signal_names=[...new Set([...t,...m])];else delete y.__stx_client_signal_names;let K0={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:g.dirname(O),skipSignalsRuntime:!0,skipEventDirectives:K2||o.length===0,defaultLayout:void 0};y.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let w0=await Y3(W0,y,O,K0,K),Z1=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let d of w0.matchAll(/\{\{([\s\S]*?)\}\}/g))Z1.add(d[1].trim());if(Z1.size>0)Y.__stx_preserved_client_expressions=[...Z1];let V1=b,y0=w0;if(K2){let d="";if(Object.keys(Z).length>0)try{d=` data-stx-props="${tZ(JSON.stringify(Z))}"`}catch{}let c=j?` stx-hydrate="${tZ(j)}"`:"",G0=` data-stx-scope="${V1}"${d}${c}`;y0=Uq(w0,G0)??`<div${G0}>${w0}</div>`;let s=await Promise.all(o.map(async(R0)=>{let H0=R0.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!H0)return R0;let[,b0,J1]=H0,{vendorStyleTags:v0,factoryBody:a}=await _q(J1,O,G.buildMode==="compile"),u0=j?null:Q5(Y,a),L1=u0?`window.__stxComponentFactories[${JSON.stringify(u0)}](${JSON.stringify(V1)});`:`(${a})(${JSON.stringify(V1)});`;if(j)return`${v0}<script type="stx/island" data-stx-island="${V1}" data-stx-scoped data-stx-owner="${V1}"${b0}>${L1}</script>`;return`${v0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${V1}"${b0}>${L1}</script>`}));if(y0=y0+`
|
|
3606
3606
|
`+s.join(`
|
|
3607
3607
|
`),j0)y0+=`
|
|
3608
3608
|
`+j0}else{if(j0)y0+=`
|
|
@@ -3625,7 +3625,7 @@ ${Z0.yellow}${Z0.bold}Message:${Z0.reset} ${Z}
|
|
|
3625
3625
|
`,z)W+=`
|
|
3626
3626
|
${Z0.blue}${Z0.bold}Context:${Z0.reset}
|
|
3627
3627
|
${Z0.dim}${z}${Z0.reset}
|
|
3628
|
-
`;return W}function j_(){c2.clear(),o9.clear(),r9.clear()}function B_(){return{size:c2.size,maxSize:500}}var U3=S1(128);async function _q($,Z,J){let X=U1($,Z,J),Y=U3.get(X);if(Y){if(GJ(Y.deps))return Y;U3.delete(X)}let Q=V3($,{filePath:Z,projectRoot:process.cwd()}),G=Q.code,z=L3(Q.styles);G=J2(G).code;let{hasUserImports:K,bundleClientScript:q}=await n("stx/client-script-bundler",()=>import("./chunk-
|
|
3628
|
+
`;return W}function j_(){c2.clear(),o9.clear(),r9.clear()}function B_(){return{size:c2.size,maxSize:500}}var U3=S1(128);async function _q($,Z,J){let X=U1($,Z,J),Y=U3.get(X);if(Y){if(GJ(Y.deps))return Y;U3.delete(X)}let Q=V3($,{filePath:Z,projectRoot:process.cwd()}),G=Q.code,z=L3(Q.styles);G=J2(G).code;let{hasUserImports:K,bundleClientScript:q}=await n("stx/client-script-bundler",()=>import("./chunk-sr3f7gk2.js")),W=[],H=!1;if(K(G)){let O=G;G=await q(O,Z,{projectRoot:process.cwd(),minify:J,collectInputs:W}),H=G===O}let{stripStxRuntimeImports:U}=await n("stx/signal-processing",()=>import("./chunk-s8wvhby3.js"));G=U(G);let j=e0(G),B=zq(j),V=`function(__scopeId) {
|
|
3629
3629
|
${o1("const",[...YJ,...B],j)}
|
|
3630
3630
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
3631
3631
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
@@ -3724,7 +3724,7 @@ else {
|
|
|
3724
3724
|
// STX: auto-generated event bindings
|
|
3725
3725
|
${$.map((J,X)=>vq(J,X)).join(`
|
|
3726
3726
|
`)}`}function HJ($){let Z=[],J=new Set,X=$.replace(/^\s*import\s+.*$/gm,""),Y=0,Q=X.length,G=0;while(G<Q){let z=X[G];if(z==="'"||z==='"'||z==="`"){let K=z;if(G++,K==="`"){let q=0;while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]==="`"&&q===0){G++;break}if(X[G]==="$"&&X[G+1]==="{"){q++,G+=2;continue}if(X[G]==="}"&&q>0){q--,G++;continue}G++}}else while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]===K){G++;break}G++}continue}if(z==="/"&&X[G+1]==="/"){while(G<Q&&X[G]!==`
|
|
3727
|
-
`)G++;continue}if(z==="/"&&X[G+1]==="*"){G+=2;while(G<Q-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(z==="{"){Y++,G++;continue}if(z==="}"){Y--,G++;continue}if(Y===0){let K=X.slice(G),q=K.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(q){let U=q[1];if(!U.startsWith("_")&&!J.has(U))Z.push(U),J.add(U);G+=q[0].length;continue}let W=K.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(W){W[1].split(",").forEach((U)=>{let j=U.trim(),B=j.indexOf(":"),V=B>=0?j.slice(B+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(V&&!V.startsWith("_")&&!J.has(V))Z.push(V),J.add(V)}),G+=W[0].length;continue}let H=K.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(H){let U=H[1];if(!U.startsWith("_")&&!J.has(U))Z.push(U),J.add(U);G+=H[0].length;continue}}G++}return Z}var fq=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 gq($){let Z=new Set,J=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(U){let j;while((j=J.exec(U))!==null){let B=j[0];if(!fq.has(B))Z.add(B)}}let Y=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=Y.exec($))!==null)X(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)X(Q[1]);let z=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=z.exec($))!==null)X(Q[1]);let K=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=K.exec($))!==null)X(Q[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)X(Q[1]);let W=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=W.exec($))!==null)X(Q[1]);let H=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=H.exec($))!==null)X(Q[1]);return Z}async function l9($,Z={}){let J=$,X="",Y=!1,Q=[],G=V3(J,{filePath:Z.filePath,projectRoot:Z.projectRoot});J=G.code;let z=L3(G.styles),K=J2(J);J=K.code,Q=[...K.imports,...K.models];let{hasUserImports:q,bundleClientScript:W}=await n("stx/client-script-bundler",()=>import("./chunk-
|
|
3727
|
+
`)G++;continue}if(z==="/"&&X[G+1]==="*"){G+=2;while(G<Q-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(z==="{"){Y++,G++;continue}if(z==="}"){Y--,G++;continue}if(Y===0){let K=X.slice(G),q=K.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(q){let U=q[1];if(!U.startsWith("_")&&!J.has(U))Z.push(U),J.add(U);G+=q[0].length;continue}let W=K.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(W){W[1].split(",").forEach((U)=>{let j=U.trim(),B=j.indexOf(":"),V=B>=0?j.slice(B+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(V&&!V.startsWith("_")&&!J.has(V))Z.push(V),J.add(V)}),G+=W[0].length;continue}let H=K.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(H){let U=H[1];if(!U.startsWith("_")&&!J.has(U))Z.push(U),J.add(U);G+=H[0].length;continue}}G++}return Z}var fq=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 gq($){let Z=new Set,J=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(U){let j;while((j=J.exec(U))!==null){let B=j[0];if(!fq.has(B))Z.add(B)}}let Y=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=Y.exec($))!==null)X(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)X(Q[1]);let z=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=z.exec($))!==null)X(Q[1]);let K=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=K.exec($))!==null)X(Q[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)X(Q[1]);let W=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=W.exec($))!==null)X(Q[1]);let H=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=H.exec($))!==null)X(Q[1]);return Z}async function l9($,Z={}){let J=$,X="",Y=!1,Q=[],G=V3(J,{filePath:Z.filePath,projectRoot:Z.projectRoot});J=G.code;let z=L3(G.styles),K=J2(J);J=K.code,Q=[...K.imports,...K.models];let{hasUserImports:q,bundleClientScript:W}=await n("stx/client-script-bundler",()=>import("./chunk-sr3f7gk2.js"));if(q(J))J=await W(J,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Y=!0;if(Z.autoImports!==!1){let L=BJ(J);J=L.code,X=LJ(L.stxImports,L.browserImports.filter((w)=>!Q.includes(w)))}if(X=`${s$(J,Z.serverData)}${X}`,J=e0(J),!Y&&E1(Z.attrs||""))J=y1(J);let H=xq(Z.eventBindings||[]),U=(Z.attrs||"").trim(),j=/\btype\s*=\s*["']module["']/i.test(U),B=Z.instanceId?` data-stx-instance="${Z.instanceId}"`:"";if(j){let L=U.replace(/\btype\s*=\s*["']module["']/i,"").trim(),w=`type="module" data-stx-scoped${B}${L?` ${L}`:""}`;return`${z}<script ${w}>
|
|
3728
3728
|
${Z2(`${X}${J}
|
|
3729
3729
|
${H}`)}
|
|
3730
3730
|
</script>`}let V=UJ($),F=/function __stx_setup_/.test(J),O=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function _(L){let w=L.length>0?`
|